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    /// # tokio_test::block_on(async {
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    /// # gax::client_builder::Result::<()>::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    /// ```no_run
80    /// # use google_cloud_discoveryengine_v1::builder;
81    /// use builder::assistant_service::ListOperations;
82    /// # tokio_test::block_on(async {
83    /// use gax::paginator::ItemPaginator;
84    ///
85    /// let builder = prepare_request_builder();
86    /// let mut items = builder.by_item();
87    /// while let Some(result) = items.next().await {
88    ///   let item = result?;
89    /// }
90    /// # gax::Result::<()>::Ok(()) });
91    ///
92    /// fn prepare_request_builder() -> ListOperations {
93    ///   # panic!();
94    ///   // ... details omitted ...
95    /// }
96    /// ```
97    #[derive(Clone, Debug)]
98    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
99
100    impl ListOperations {
101        pub(crate) fn new(
102            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
103        ) -> Self {
104            Self(RequestBuilder::new(stub))
105        }
106
107        /// Sets the full request, replacing any prior values.
108        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
109            mut self,
110            v: V,
111        ) -> Self {
112            self.0.request = v.into();
113            self
114        }
115
116        /// Sets all the options, replacing any prior values.
117        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
118            self.0.options = v.into();
119            self
120        }
121
122        /// Sends the request.
123        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
124            (*self.0.stub)
125                .list_operations(self.0.request, self.0.options)
126                .await
127                .map(gax::response::Response::into_body)
128        }
129
130        /// Streams each page in the collection.
131        pub fn by_page(
132            self,
133        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
134        {
135            use std::clone::Clone;
136            let token = self.0.request.page_token.clone();
137            let execute = move |token: String| {
138                let mut builder = self.clone();
139                builder.0.request = builder.0.request.set_page_token(token);
140                builder.send()
141            };
142            gax::paginator::internal::new_paginator(token, execute)
143        }
144
145        /// Streams each item in the collection.
146        pub fn by_item(
147            self,
148        ) -> impl gax::paginator::ItemPaginator<
149            longrunning::model::ListOperationsResponse,
150            gax::error::Error,
151        > {
152            use gax::paginator::Paginator;
153            self.by_page().items()
154        }
155
156        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
157        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
158            self.0.request.name = v.into();
159            self
160        }
161
162        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
163        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
164            self.0.request.filter = v.into();
165            self
166        }
167
168        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
169        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
170            self.0.request.page_size = v.into();
171            self
172        }
173
174        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
175        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.page_token = v.into();
177            self
178        }
179
180        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
181        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
182            self.0.request.return_partial_success = v.into();
183            self
184        }
185    }
186
187    #[doc(hidden)]
188    impl gax::options::internal::RequestBuilder for ListOperations {
189        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
190            &mut self.0.options
191        }
192    }
193
194    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
195    ///
196    /// # Example
197    /// ```no_run
198    /// # use google_cloud_discoveryengine_v1::builder;
199    /// use builder::assistant_service::GetOperation;
200    /// # tokio_test::block_on(async {
201    ///
202    /// let builder = prepare_request_builder();
203    /// let response = builder.send().await?;
204    /// # gax::Result::<()>::Ok(()) });
205    ///
206    /// fn prepare_request_builder() -> GetOperation {
207    ///   # panic!();
208    ///   // ... details omitted ...
209    /// }
210    /// ```
211    #[derive(Clone, Debug)]
212    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
213
214    impl GetOperation {
215        pub(crate) fn new(
216            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
217        ) -> Self {
218            Self(RequestBuilder::new(stub))
219        }
220
221        /// Sets the full request, replacing any prior values.
222        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
223            mut self,
224            v: V,
225        ) -> Self {
226            self.0.request = v.into();
227            self
228        }
229
230        /// Sets all the options, replacing any prior values.
231        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
232            self.0.options = v.into();
233            self
234        }
235
236        /// Sends the request.
237        pub async fn send(self) -> Result<longrunning::model::Operation> {
238            (*self.0.stub)
239                .get_operation(self.0.request, self.0.options)
240                .await
241                .map(gax::response::Response::into_body)
242        }
243
244        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
245        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
246            self.0.request.name = v.into();
247            self
248        }
249    }
250
251    #[doc(hidden)]
252    impl gax::options::internal::RequestBuilder for GetOperation {
253        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
254            &mut self.0.options
255        }
256    }
257
258    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
259    ///
260    /// # Example
261    /// ```no_run
262    /// # use google_cloud_discoveryengine_v1::builder;
263    /// use builder::assistant_service::CancelOperation;
264    /// # tokio_test::block_on(async {
265    ///
266    /// let builder = prepare_request_builder();
267    /// let response = builder.send().await?;
268    /// # gax::Result::<()>::Ok(()) });
269    ///
270    /// fn prepare_request_builder() -> CancelOperation {
271    ///   # panic!();
272    ///   // ... details omitted ...
273    /// }
274    /// ```
275    #[derive(Clone, Debug)]
276    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
277
278    impl CancelOperation {
279        pub(crate) fn new(
280            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
281        ) -> Self {
282            Self(RequestBuilder::new(stub))
283        }
284
285        /// Sets the full request, replacing any prior values.
286        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
287            mut self,
288            v: V,
289        ) -> Self {
290            self.0.request = v.into();
291            self
292        }
293
294        /// Sets all the options, replacing any prior values.
295        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
296            self.0.options = v.into();
297            self
298        }
299
300        /// Sends the request.
301        pub async fn send(self) -> Result<()> {
302            (*self.0.stub)
303                .cancel_operation(self.0.request, self.0.options)
304                .await
305                .map(gax::response::Response::into_body)
306        }
307
308        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
309        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
310            self.0.request.name = v.into();
311            self
312        }
313    }
314
315    #[doc(hidden)]
316    impl gax::options::internal::RequestBuilder for CancelOperation {
317        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
318            &mut self.0.options
319        }
320    }
321}
322
323#[cfg(feature = "cmek-config-service")]
324#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
325pub mod cmek_config_service {
326    use crate::Result;
327
328    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
329    ///
330    /// ```
331    /// # tokio_test::block_on(async {
332    /// # use google_cloud_discoveryengine_v1::*;
333    /// # use builder::cmek_config_service::ClientBuilder;
334    /// # use client::CmekConfigService;
335    /// let builder : ClientBuilder = CmekConfigService::builder();
336    /// let client = builder
337    ///     .with_endpoint("https://discoveryengine.googleapis.com")
338    ///     .build().await?;
339    /// # gax::client_builder::Result::<()>::Ok(()) });
340    /// ```
341    pub type ClientBuilder =
342        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
343
344    pub(crate) mod client {
345        use super::super::super::client::CmekConfigService;
346        pub struct Factory;
347        impl gax::client_builder::internal::ClientFactory for Factory {
348            type Client = CmekConfigService;
349            type Credentials = gaxi::options::Credentials;
350            async fn build(
351                self,
352                config: gaxi::options::ClientConfig,
353            ) -> gax::client_builder::Result<Self::Client> {
354                Self::Client::new(config).await
355            }
356        }
357    }
358
359    /// Common implementation for [crate::client::CmekConfigService] request builders.
360    #[derive(Clone, Debug)]
361    pub(crate) struct RequestBuilder<R: std::default::Default> {
362        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
363        request: R,
364        options: gax::options::RequestOptions,
365    }
366
367    impl<R> RequestBuilder<R>
368    where
369        R: std::default::Default,
370    {
371        pub(crate) fn new(
372            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
373        ) -> Self {
374            Self {
375                stub,
376                request: R::default(),
377                options: gax::options::RequestOptions::default(),
378            }
379        }
380    }
381
382    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
383    ///
384    /// # Example
385    /// ```no_run
386    /// # use google_cloud_discoveryengine_v1::builder;
387    /// use builder::cmek_config_service::UpdateCmekConfig;
388    /// # tokio_test::block_on(async {
389    /// use lro::Poller;
390    ///
391    /// let builder = prepare_request_builder();
392    /// let response = builder.poller().until_done().await?;
393    /// # gax::Result::<()>::Ok(()) });
394    ///
395    /// fn prepare_request_builder() -> UpdateCmekConfig {
396    ///   # panic!();
397    ///   // ... details omitted ...
398    /// }
399    /// ```
400    #[derive(Clone, Debug)]
401    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
402
403    impl UpdateCmekConfig {
404        pub(crate) fn new(
405            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
406        ) -> Self {
407            Self(RequestBuilder::new(stub))
408        }
409
410        /// Sets the full request, replacing any prior values.
411        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
412            mut self,
413            v: V,
414        ) -> Self {
415            self.0.request = v.into();
416            self
417        }
418
419        /// Sets all the options, replacing any prior values.
420        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
421            self.0.options = v.into();
422            self
423        }
424
425        /// Sends the request.
426        ///
427        /// # Long running operations
428        ///
429        /// This starts, but does not poll, a longrunning operation. More information
430        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
431        pub async fn send(self) -> Result<longrunning::model::Operation> {
432            (*self.0.stub)
433                .update_cmek_config(self.0.request, self.0.options)
434                .await
435                .map(gax::response::Response::into_body)
436        }
437
438        /// Creates a [Poller][lro::Poller] to work with `update_cmek_config`.
439        pub fn poller(
440            self,
441        ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
442        {
443            type Operation = lro::internal::Operation<
444                crate::model::CmekConfig,
445                crate::model::UpdateCmekConfigMetadata,
446            >;
447            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
448            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
449
450            let stub = self.0.stub.clone();
451            let mut options = self.0.options.clone();
452            options.set_retry_policy(gax::retry_policy::NeverRetry);
453            let query = move |name| {
454                let stub = stub.clone();
455                let options = options.clone();
456                async {
457                    let op = GetOperation::new(stub)
458                        .set_name(name)
459                        .with_options(options)
460                        .send()
461                        .await?;
462                    Ok(Operation::new(op))
463                }
464            };
465
466            let start = move || async {
467                let op = self.send().await?;
468                Ok(Operation::new(op))
469            };
470
471            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
472        }
473
474        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
475        ///
476        /// This is a **required** field for requests.
477        pub fn set_config<T>(mut self, v: T) -> Self
478        where
479            T: std::convert::Into<crate::model::CmekConfig>,
480        {
481            self.0.request.config = std::option::Option::Some(v.into());
482            self
483        }
484
485        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
486        ///
487        /// This is a **required** field for requests.
488        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
489        where
490            T: std::convert::Into<crate::model::CmekConfig>,
491        {
492            self.0.request.config = v.map(|x| x.into());
493            self
494        }
495
496        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
497        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
498            self.0.request.set_default = v.into();
499            self
500        }
501    }
502
503    #[doc(hidden)]
504    impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
505        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
506            &mut self.0.options
507        }
508    }
509
510    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
511    ///
512    /// # Example
513    /// ```no_run
514    /// # use google_cloud_discoveryengine_v1::builder;
515    /// use builder::cmek_config_service::GetCmekConfig;
516    /// # tokio_test::block_on(async {
517    ///
518    /// let builder = prepare_request_builder();
519    /// let response = builder.send().await?;
520    /// # gax::Result::<()>::Ok(()) });
521    ///
522    /// fn prepare_request_builder() -> GetCmekConfig {
523    ///   # panic!();
524    ///   // ... details omitted ...
525    /// }
526    /// ```
527    #[derive(Clone, Debug)]
528    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
529
530    impl GetCmekConfig {
531        pub(crate) fn new(
532            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
533        ) -> Self {
534            Self(RequestBuilder::new(stub))
535        }
536
537        /// Sets the full request, replacing any prior values.
538        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
539            self.0.request = v.into();
540            self
541        }
542
543        /// Sets all the options, replacing any prior values.
544        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
545            self.0.options = v.into();
546            self
547        }
548
549        /// Sends the request.
550        pub async fn send(self) -> Result<crate::model::CmekConfig> {
551            (*self.0.stub)
552                .get_cmek_config(self.0.request, self.0.options)
553                .await
554                .map(gax::response::Response::into_body)
555        }
556
557        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
558        ///
559        /// This is a **required** field for requests.
560        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
561            self.0.request.name = v.into();
562            self
563        }
564    }
565
566    #[doc(hidden)]
567    impl gax::options::internal::RequestBuilder for GetCmekConfig {
568        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
569            &mut self.0.options
570        }
571    }
572
573    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
574    ///
575    /// # Example
576    /// ```no_run
577    /// # use google_cloud_discoveryengine_v1::builder;
578    /// use builder::cmek_config_service::ListCmekConfigs;
579    /// # tokio_test::block_on(async {
580    ///
581    /// let builder = prepare_request_builder();
582    /// let response = builder.send().await?;
583    /// # gax::Result::<()>::Ok(()) });
584    ///
585    /// fn prepare_request_builder() -> ListCmekConfigs {
586    ///   # panic!();
587    ///   // ... details omitted ...
588    /// }
589    /// ```
590    #[derive(Clone, Debug)]
591    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
592
593    impl ListCmekConfigs {
594        pub(crate) fn new(
595            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
596        ) -> Self {
597            Self(RequestBuilder::new(stub))
598        }
599
600        /// Sets the full request, replacing any prior values.
601        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
602            self.0.request = v.into();
603            self
604        }
605
606        /// Sets all the options, replacing any prior values.
607        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
608            self.0.options = v.into();
609            self
610        }
611
612        /// Sends the request.
613        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
614            (*self.0.stub)
615                .list_cmek_configs(self.0.request, self.0.options)
616                .await
617                .map(gax::response::Response::into_body)
618        }
619
620        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
621        ///
622        /// This is a **required** field for requests.
623        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
624            self.0.request.parent = v.into();
625            self
626        }
627    }
628
629    #[doc(hidden)]
630    impl gax::options::internal::RequestBuilder for ListCmekConfigs {
631        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
632            &mut self.0.options
633        }
634    }
635
636    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
637    ///
638    /// # Example
639    /// ```no_run
640    /// # use google_cloud_discoveryengine_v1::builder;
641    /// use builder::cmek_config_service::DeleteCmekConfig;
642    /// # tokio_test::block_on(async {
643    /// use lro::Poller;
644    ///
645    /// let builder = prepare_request_builder();
646    /// let response = builder.poller().until_done().await?;
647    /// # gax::Result::<()>::Ok(()) });
648    ///
649    /// fn prepare_request_builder() -> DeleteCmekConfig {
650    ///   # panic!();
651    ///   // ... details omitted ...
652    /// }
653    /// ```
654    #[derive(Clone, Debug)]
655    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
656
657    impl DeleteCmekConfig {
658        pub(crate) fn new(
659            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
660        ) -> Self {
661            Self(RequestBuilder::new(stub))
662        }
663
664        /// Sets the full request, replacing any prior values.
665        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
666            mut self,
667            v: V,
668        ) -> Self {
669            self.0.request = v.into();
670            self
671        }
672
673        /// Sets all the options, replacing any prior values.
674        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
675            self.0.options = v.into();
676            self
677        }
678
679        /// Sends the request.
680        ///
681        /// # Long running operations
682        ///
683        /// This starts, but does not poll, a longrunning operation. More information
684        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
685        pub async fn send(self) -> Result<longrunning::model::Operation> {
686            (*self.0.stub)
687                .delete_cmek_config(self.0.request, self.0.options)
688                .await
689                .map(gax::response::Response::into_body)
690        }
691
692        /// Creates a [Poller][lro::Poller] to work with `delete_cmek_config`.
693        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
694            type Operation =
695                lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
696            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
697            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
698
699            let stub = self.0.stub.clone();
700            let mut options = self.0.options.clone();
701            options.set_retry_policy(gax::retry_policy::NeverRetry);
702            let query = move |name| {
703                let stub = stub.clone();
704                let options = options.clone();
705                async {
706                    let op = GetOperation::new(stub)
707                        .set_name(name)
708                        .with_options(options)
709                        .send()
710                        .await?;
711                    Ok(Operation::new(op))
712                }
713            };
714
715            let start = move || async {
716                let op = self.send().await?;
717                Ok(Operation::new(op))
718            };
719
720            lro::internal::new_unit_response_poller(
721                polling_error_policy,
722                polling_backoff_policy,
723                start,
724                query,
725            )
726        }
727
728        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
729        ///
730        /// This is a **required** field for requests.
731        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
732            self.0.request.name = v.into();
733            self
734        }
735    }
736
737    #[doc(hidden)]
738    impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
739        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
740            &mut self.0.options
741        }
742    }
743
744    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
745    ///
746    /// # Example
747    /// ```no_run
748    /// # use google_cloud_discoveryengine_v1::builder;
749    /// use builder::cmek_config_service::ListOperations;
750    /// # tokio_test::block_on(async {
751    /// use gax::paginator::ItemPaginator;
752    ///
753    /// let builder = prepare_request_builder();
754    /// let mut items = builder.by_item();
755    /// while let Some(result) = items.next().await {
756    ///   let item = result?;
757    /// }
758    /// # gax::Result::<()>::Ok(()) });
759    ///
760    /// fn prepare_request_builder() -> ListOperations {
761    ///   # panic!();
762    ///   // ... details omitted ...
763    /// }
764    /// ```
765    #[derive(Clone, Debug)]
766    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
767
768    impl ListOperations {
769        pub(crate) fn new(
770            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
771        ) -> Self {
772            Self(RequestBuilder::new(stub))
773        }
774
775        /// Sets the full request, replacing any prior values.
776        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
777            mut self,
778            v: V,
779        ) -> Self {
780            self.0.request = v.into();
781            self
782        }
783
784        /// Sets all the options, replacing any prior values.
785        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
786            self.0.options = v.into();
787            self
788        }
789
790        /// Sends the request.
791        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
792            (*self.0.stub)
793                .list_operations(self.0.request, self.0.options)
794                .await
795                .map(gax::response::Response::into_body)
796        }
797
798        /// Streams each page in the collection.
799        pub fn by_page(
800            self,
801        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
802        {
803            use std::clone::Clone;
804            let token = self.0.request.page_token.clone();
805            let execute = move |token: String| {
806                let mut builder = self.clone();
807                builder.0.request = builder.0.request.set_page_token(token);
808                builder.send()
809            };
810            gax::paginator::internal::new_paginator(token, execute)
811        }
812
813        /// Streams each item in the collection.
814        pub fn by_item(
815            self,
816        ) -> impl gax::paginator::ItemPaginator<
817            longrunning::model::ListOperationsResponse,
818            gax::error::Error,
819        > {
820            use gax::paginator::Paginator;
821            self.by_page().items()
822        }
823
824        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
825        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
826            self.0.request.name = v.into();
827            self
828        }
829
830        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
831        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
832            self.0.request.filter = v.into();
833            self
834        }
835
836        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
837        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
838            self.0.request.page_size = v.into();
839            self
840        }
841
842        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
843        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
844            self.0.request.page_token = v.into();
845            self
846        }
847
848        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
849        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
850            self.0.request.return_partial_success = v.into();
851            self
852        }
853    }
854
855    #[doc(hidden)]
856    impl gax::options::internal::RequestBuilder for ListOperations {
857        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
858            &mut self.0.options
859        }
860    }
861
862    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
863    ///
864    /// # Example
865    /// ```no_run
866    /// # use google_cloud_discoveryengine_v1::builder;
867    /// use builder::cmek_config_service::GetOperation;
868    /// # tokio_test::block_on(async {
869    ///
870    /// let builder = prepare_request_builder();
871    /// let response = builder.send().await?;
872    /// # gax::Result::<()>::Ok(()) });
873    ///
874    /// fn prepare_request_builder() -> GetOperation {
875    ///   # panic!();
876    ///   // ... details omitted ...
877    /// }
878    /// ```
879    #[derive(Clone, Debug)]
880    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
881
882    impl GetOperation {
883        pub(crate) fn new(
884            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
885        ) -> Self {
886            Self(RequestBuilder::new(stub))
887        }
888
889        /// Sets the full request, replacing any prior values.
890        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
891            mut self,
892            v: V,
893        ) -> Self {
894            self.0.request = v.into();
895            self
896        }
897
898        /// Sets all the options, replacing any prior values.
899        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
900            self.0.options = v.into();
901            self
902        }
903
904        /// Sends the request.
905        pub async fn send(self) -> Result<longrunning::model::Operation> {
906            (*self.0.stub)
907                .get_operation(self.0.request, self.0.options)
908                .await
909                .map(gax::response::Response::into_body)
910        }
911
912        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
913        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
914            self.0.request.name = v.into();
915            self
916        }
917    }
918
919    #[doc(hidden)]
920    impl gax::options::internal::RequestBuilder for GetOperation {
921        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
922            &mut self.0.options
923        }
924    }
925
926    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
927    ///
928    /// # Example
929    /// ```no_run
930    /// # use google_cloud_discoveryengine_v1::builder;
931    /// use builder::cmek_config_service::CancelOperation;
932    /// # tokio_test::block_on(async {
933    ///
934    /// let builder = prepare_request_builder();
935    /// let response = builder.send().await?;
936    /// # gax::Result::<()>::Ok(()) });
937    ///
938    /// fn prepare_request_builder() -> CancelOperation {
939    ///   # panic!();
940    ///   // ... details omitted ...
941    /// }
942    /// ```
943    #[derive(Clone, Debug)]
944    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
945
946    impl CancelOperation {
947        pub(crate) fn new(
948            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
949        ) -> Self {
950            Self(RequestBuilder::new(stub))
951        }
952
953        /// Sets the full request, replacing any prior values.
954        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
955            mut self,
956            v: V,
957        ) -> Self {
958            self.0.request = v.into();
959            self
960        }
961
962        /// Sets all the options, replacing any prior values.
963        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
964            self.0.options = v.into();
965            self
966        }
967
968        /// Sends the request.
969        pub async fn send(self) -> Result<()> {
970            (*self.0.stub)
971                .cancel_operation(self.0.request, self.0.options)
972                .await
973                .map(gax::response::Response::into_body)
974        }
975
976        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
977        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
978            self.0.request.name = v.into();
979            self
980        }
981    }
982
983    #[doc(hidden)]
984    impl gax::options::internal::RequestBuilder for CancelOperation {
985        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
986            &mut self.0.options
987        }
988    }
989}
990
991#[cfg(feature = "completion-service")]
992#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
993pub mod completion_service {
994    use crate::Result;
995
996    /// A builder for [CompletionService][crate::client::CompletionService].
997    ///
998    /// ```
999    /// # tokio_test::block_on(async {
1000    /// # use google_cloud_discoveryengine_v1::*;
1001    /// # use builder::completion_service::ClientBuilder;
1002    /// # use client::CompletionService;
1003    /// let builder : ClientBuilder = CompletionService::builder();
1004    /// let client = builder
1005    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1006    ///     .build().await?;
1007    /// # gax::client_builder::Result::<()>::Ok(()) });
1008    /// ```
1009    pub type ClientBuilder =
1010        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1011
1012    pub(crate) mod client {
1013        use super::super::super::client::CompletionService;
1014        pub struct Factory;
1015        impl gax::client_builder::internal::ClientFactory for Factory {
1016            type Client = CompletionService;
1017            type Credentials = gaxi::options::Credentials;
1018            async fn build(
1019                self,
1020                config: gaxi::options::ClientConfig,
1021            ) -> gax::client_builder::Result<Self::Client> {
1022                Self::Client::new(config).await
1023            }
1024        }
1025    }
1026
1027    /// Common implementation for [crate::client::CompletionService] request builders.
1028    #[derive(Clone, Debug)]
1029    pub(crate) struct RequestBuilder<R: std::default::Default> {
1030        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1031        request: R,
1032        options: gax::options::RequestOptions,
1033    }
1034
1035    impl<R> RequestBuilder<R>
1036    where
1037        R: std::default::Default,
1038    {
1039        pub(crate) fn new(
1040            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1041        ) -> Self {
1042            Self {
1043                stub,
1044                request: R::default(),
1045                options: gax::options::RequestOptions::default(),
1046            }
1047        }
1048    }
1049
1050    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1051    ///
1052    /// # Example
1053    /// ```no_run
1054    /// # use google_cloud_discoveryengine_v1::builder;
1055    /// use builder::completion_service::CompleteQuery;
1056    /// # tokio_test::block_on(async {
1057    ///
1058    /// let builder = prepare_request_builder();
1059    /// let response = builder.send().await?;
1060    /// # gax::Result::<()>::Ok(()) });
1061    ///
1062    /// fn prepare_request_builder() -> CompleteQuery {
1063    ///   # panic!();
1064    ///   // ... details omitted ...
1065    /// }
1066    /// ```
1067    #[derive(Clone, Debug)]
1068    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1069
1070    impl CompleteQuery {
1071        pub(crate) fn new(
1072            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1073        ) -> Self {
1074            Self(RequestBuilder::new(stub))
1075        }
1076
1077        /// Sets the full request, replacing any prior values.
1078        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1079            self.0.request = v.into();
1080            self
1081        }
1082
1083        /// Sets all the options, replacing any prior values.
1084        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1085            self.0.options = v.into();
1086            self
1087        }
1088
1089        /// Sends the request.
1090        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1091            (*self.0.stub)
1092                .complete_query(self.0.request, self.0.options)
1093                .await
1094                .map(gax::response::Response::into_body)
1095        }
1096
1097        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1098        ///
1099        /// This is a **required** field for requests.
1100        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1101            self.0.request.data_store = v.into();
1102            self
1103        }
1104
1105        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1106        ///
1107        /// This is a **required** field for requests.
1108        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109            self.0.request.query = v.into();
1110            self
1111        }
1112
1113        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1114        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115            self.0.request.query_model = v.into();
1116            self
1117        }
1118
1119        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1120        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1121            self.0.request.user_pseudo_id = v.into();
1122            self
1123        }
1124
1125        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1126        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1127            self.0.request.include_tail_suggestions = v.into();
1128            self
1129        }
1130    }
1131
1132    #[doc(hidden)]
1133    impl gax::options::internal::RequestBuilder for CompleteQuery {
1134        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1135            &mut self.0.options
1136        }
1137    }
1138
1139    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1140    ///
1141    /// # Example
1142    /// ```no_run
1143    /// # use google_cloud_discoveryengine_v1::builder;
1144    /// use builder::completion_service::ImportSuggestionDenyListEntries;
1145    /// # tokio_test::block_on(async {
1146    /// use lro::Poller;
1147    ///
1148    /// let builder = prepare_request_builder();
1149    /// let response = builder.poller().until_done().await?;
1150    /// # gax::Result::<()>::Ok(()) });
1151    ///
1152    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1153    ///   # panic!();
1154    ///   // ... details omitted ...
1155    /// }
1156    /// ```
1157    #[derive(Clone, Debug)]
1158    pub struct ImportSuggestionDenyListEntries(
1159        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1160    );
1161
1162    impl ImportSuggestionDenyListEntries {
1163        pub(crate) fn new(
1164            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1165        ) -> Self {
1166            Self(RequestBuilder::new(stub))
1167        }
1168
1169        /// Sets the full request, replacing any prior values.
1170        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1171            mut self,
1172            v: V,
1173        ) -> Self {
1174            self.0.request = v.into();
1175            self
1176        }
1177
1178        /// Sets all the options, replacing any prior values.
1179        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1180            self.0.options = v.into();
1181            self
1182        }
1183
1184        /// Sends the request.
1185        ///
1186        /// # Long running operations
1187        ///
1188        /// This starts, but does not poll, a longrunning operation. More information
1189        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1190        pub async fn send(self) -> Result<longrunning::model::Operation> {
1191            (*self.0.stub)
1192                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1193                .await
1194                .map(gax::response::Response::into_body)
1195        }
1196
1197        /// Creates a [Poller][lro::Poller] to work with `import_suggestion_deny_list_entries`.
1198        pub fn poller(
1199            self,
1200        ) -> impl lro::Poller<
1201            crate::model::ImportSuggestionDenyListEntriesResponse,
1202            crate::model::ImportSuggestionDenyListEntriesMetadata,
1203        > {
1204            type Operation = lro::internal::Operation<
1205                crate::model::ImportSuggestionDenyListEntriesResponse,
1206                crate::model::ImportSuggestionDenyListEntriesMetadata,
1207            >;
1208            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1209            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1210
1211            let stub = self.0.stub.clone();
1212            let mut options = self.0.options.clone();
1213            options.set_retry_policy(gax::retry_policy::NeverRetry);
1214            let query = move |name| {
1215                let stub = stub.clone();
1216                let options = options.clone();
1217                async {
1218                    let op = GetOperation::new(stub)
1219                        .set_name(name)
1220                        .with_options(options)
1221                        .send()
1222                        .await?;
1223                    Ok(Operation::new(op))
1224                }
1225            };
1226
1227            let start = move || async {
1228                let op = self.send().await?;
1229                Ok(Operation::new(op))
1230            };
1231
1232            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1233        }
1234
1235        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1236        ///
1237        /// This is a **required** field for requests.
1238        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1239            self.0.request.parent = v.into();
1240            self
1241        }
1242
1243        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1244        ///
1245        /// Note that all the setters affecting `source` are
1246        /// mutually exclusive.
1247        pub fn set_source<
1248            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1249        >(
1250            mut self,
1251            v: T,
1252        ) -> Self {
1253            self.0.request.source = v.into();
1254            self
1255        }
1256
1257        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1258        /// to hold a `InlineSource`.
1259        ///
1260        /// Note that all the setters affecting `source` are
1261        /// mutually exclusive.
1262        pub fn set_inline_source<
1263            T: std::convert::Into<
1264                    std::boxed::Box<
1265                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1266                    >,
1267                >,
1268        >(
1269            mut self,
1270            v: T,
1271        ) -> Self {
1272            self.0.request = self.0.request.set_inline_source(v);
1273            self
1274        }
1275
1276        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1277        /// to hold a `GcsSource`.
1278        ///
1279        /// Note that all the setters affecting `source` are
1280        /// mutually exclusive.
1281        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1282            mut self,
1283            v: T,
1284        ) -> Self {
1285            self.0.request = self.0.request.set_gcs_source(v);
1286            self
1287        }
1288    }
1289
1290    #[doc(hidden)]
1291    impl gax::options::internal::RequestBuilder for ImportSuggestionDenyListEntries {
1292        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1293            &mut self.0.options
1294        }
1295    }
1296
1297    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1298    ///
1299    /// # Example
1300    /// ```no_run
1301    /// # use google_cloud_discoveryengine_v1::builder;
1302    /// use builder::completion_service::PurgeSuggestionDenyListEntries;
1303    /// # tokio_test::block_on(async {
1304    /// use lro::Poller;
1305    ///
1306    /// let builder = prepare_request_builder();
1307    /// let response = builder.poller().until_done().await?;
1308    /// # gax::Result::<()>::Ok(()) });
1309    ///
1310    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1311    ///   # panic!();
1312    ///   // ... details omitted ...
1313    /// }
1314    /// ```
1315    #[derive(Clone, Debug)]
1316    pub struct PurgeSuggestionDenyListEntries(
1317        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1318    );
1319
1320    impl PurgeSuggestionDenyListEntries {
1321        pub(crate) fn new(
1322            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1323        ) -> Self {
1324            Self(RequestBuilder::new(stub))
1325        }
1326
1327        /// Sets the full request, replacing any prior values.
1328        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1329            mut self,
1330            v: V,
1331        ) -> Self {
1332            self.0.request = v.into();
1333            self
1334        }
1335
1336        /// Sets all the options, replacing any prior values.
1337        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1338            self.0.options = v.into();
1339            self
1340        }
1341
1342        /// Sends the request.
1343        ///
1344        /// # Long running operations
1345        ///
1346        /// This starts, but does not poll, a longrunning operation. More information
1347        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1348        pub async fn send(self) -> Result<longrunning::model::Operation> {
1349            (*self.0.stub)
1350                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1351                .await
1352                .map(gax::response::Response::into_body)
1353        }
1354
1355        /// Creates a [Poller][lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1356        pub fn poller(
1357            self,
1358        ) -> impl lro::Poller<
1359            crate::model::PurgeSuggestionDenyListEntriesResponse,
1360            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1361        > {
1362            type Operation = lro::internal::Operation<
1363                crate::model::PurgeSuggestionDenyListEntriesResponse,
1364                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1365            >;
1366            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1367            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1368
1369            let stub = self.0.stub.clone();
1370            let mut options = self.0.options.clone();
1371            options.set_retry_policy(gax::retry_policy::NeverRetry);
1372            let query = move |name| {
1373                let stub = stub.clone();
1374                let options = options.clone();
1375                async {
1376                    let op = GetOperation::new(stub)
1377                        .set_name(name)
1378                        .with_options(options)
1379                        .send()
1380                        .await?;
1381                    Ok(Operation::new(op))
1382                }
1383            };
1384
1385            let start = move || async {
1386                let op = self.send().await?;
1387                Ok(Operation::new(op))
1388            };
1389
1390            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1391        }
1392
1393        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1394        ///
1395        /// This is a **required** field for requests.
1396        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1397            self.0.request.parent = v.into();
1398            self
1399        }
1400    }
1401
1402    #[doc(hidden)]
1403    impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1404        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1405            &mut self.0.options
1406        }
1407    }
1408
1409    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1410    ///
1411    /// # Example
1412    /// ```no_run
1413    /// # use google_cloud_discoveryengine_v1::builder;
1414    /// use builder::completion_service::ImportCompletionSuggestions;
1415    /// # tokio_test::block_on(async {
1416    /// use lro::Poller;
1417    ///
1418    /// let builder = prepare_request_builder();
1419    /// let response = builder.poller().until_done().await?;
1420    /// # gax::Result::<()>::Ok(()) });
1421    ///
1422    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1423    ///   # panic!();
1424    ///   // ... details omitted ...
1425    /// }
1426    /// ```
1427    #[derive(Clone, Debug)]
1428    pub struct ImportCompletionSuggestions(
1429        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1430    );
1431
1432    impl ImportCompletionSuggestions {
1433        pub(crate) fn new(
1434            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1435        ) -> Self {
1436            Self(RequestBuilder::new(stub))
1437        }
1438
1439        /// Sets the full request, replacing any prior values.
1440        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1441            mut self,
1442            v: V,
1443        ) -> Self {
1444            self.0.request = v.into();
1445            self
1446        }
1447
1448        /// Sets all the options, replacing any prior values.
1449        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1450            self.0.options = v.into();
1451            self
1452        }
1453
1454        /// Sends the request.
1455        ///
1456        /// # Long running operations
1457        ///
1458        /// This starts, but does not poll, a longrunning operation. More information
1459        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1460        pub async fn send(self) -> Result<longrunning::model::Operation> {
1461            (*self.0.stub)
1462                .import_completion_suggestions(self.0.request, self.0.options)
1463                .await
1464                .map(gax::response::Response::into_body)
1465        }
1466
1467        /// Creates a [Poller][lro::Poller] to work with `import_completion_suggestions`.
1468        pub fn poller(
1469            self,
1470        ) -> impl lro::Poller<
1471            crate::model::ImportCompletionSuggestionsResponse,
1472            crate::model::ImportCompletionSuggestionsMetadata,
1473        > {
1474            type Operation = lro::internal::Operation<
1475                crate::model::ImportCompletionSuggestionsResponse,
1476                crate::model::ImportCompletionSuggestionsMetadata,
1477            >;
1478            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1479            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1480
1481            let stub = self.0.stub.clone();
1482            let mut options = self.0.options.clone();
1483            options.set_retry_policy(gax::retry_policy::NeverRetry);
1484            let query = move |name| {
1485                let stub = stub.clone();
1486                let options = options.clone();
1487                async {
1488                    let op = GetOperation::new(stub)
1489                        .set_name(name)
1490                        .with_options(options)
1491                        .send()
1492                        .await?;
1493                    Ok(Operation::new(op))
1494                }
1495            };
1496
1497            let start = move || async {
1498                let op = self.send().await?;
1499                Ok(Operation::new(op))
1500            };
1501
1502            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1503        }
1504
1505        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1506        ///
1507        /// This is a **required** field for requests.
1508        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1509            self.0.request.parent = v.into();
1510            self
1511        }
1512
1513        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1514        pub fn set_error_config<T>(mut self, v: T) -> Self
1515        where
1516            T: std::convert::Into<crate::model::ImportErrorConfig>,
1517        {
1518            self.0.request.error_config = std::option::Option::Some(v.into());
1519            self
1520        }
1521
1522        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1523        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1524        where
1525            T: std::convert::Into<crate::model::ImportErrorConfig>,
1526        {
1527            self.0.request.error_config = v.map(|x| x.into());
1528            self
1529        }
1530
1531        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1532        ///
1533        /// Note that all the setters affecting `source` are
1534        /// mutually exclusive.
1535        pub fn set_source<
1536            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1537        >(
1538            mut self,
1539            v: T,
1540        ) -> Self {
1541            self.0.request.source = v.into();
1542            self
1543        }
1544
1545        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1546        /// to hold a `InlineSource`.
1547        ///
1548        /// Note that all the setters affecting `source` are
1549        /// mutually exclusive.
1550        pub fn set_inline_source<
1551            T: std::convert::Into<
1552                    std::boxed::Box<
1553                        crate::model::import_completion_suggestions_request::InlineSource,
1554                    >,
1555                >,
1556        >(
1557            mut self,
1558            v: T,
1559        ) -> Self {
1560            self.0.request = self.0.request.set_inline_source(v);
1561            self
1562        }
1563
1564        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1565        /// to hold a `GcsSource`.
1566        ///
1567        /// Note that all the setters affecting `source` are
1568        /// mutually exclusive.
1569        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1570            mut self,
1571            v: T,
1572        ) -> Self {
1573            self.0.request = self.0.request.set_gcs_source(v);
1574            self
1575        }
1576
1577        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1578        /// to hold a `BigquerySource`.
1579        ///
1580        /// Note that all the setters affecting `source` are
1581        /// mutually exclusive.
1582        pub fn set_bigquery_source<
1583            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1584        >(
1585            mut self,
1586            v: T,
1587        ) -> Self {
1588            self.0.request = self.0.request.set_bigquery_source(v);
1589            self
1590        }
1591    }
1592
1593    #[doc(hidden)]
1594    impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1595        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1596            &mut self.0.options
1597        }
1598    }
1599
1600    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1601    ///
1602    /// # Example
1603    /// ```no_run
1604    /// # use google_cloud_discoveryengine_v1::builder;
1605    /// use builder::completion_service::PurgeCompletionSuggestions;
1606    /// # tokio_test::block_on(async {
1607    /// use lro::Poller;
1608    ///
1609    /// let builder = prepare_request_builder();
1610    /// let response = builder.poller().until_done().await?;
1611    /// # gax::Result::<()>::Ok(()) });
1612    ///
1613    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1614    ///   # panic!();
1615    ///   // ... details omitted ...
1616    /// }
1617    /// ```
1618    #[derive(Clone, Debug)]
1619    pub struct PurgeCompletionSuggestions(
1620        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1621    );
1622
1623    impl PurgeCompletionSuggestions {
1624        pub(crate) fn new(
1625            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1626        ) -> Self {
1627            Self(RequestBuilder::new(stub))
1628        }
1629
1630        /// Sets the full request, replacing any prior values.
1631        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1632            mut self,
1633            v: V,
1634        ) -> Self {
1635            self.0.request = v.into();
1636            self
1637        }
1638
1639        /// Sets all the options, replacing any prior values.
1640        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1641            self.0.options = v.into();
1642            self
1643        }
1644
1645        /// Sends the request.
1646        ///
1647        /// # Long running operations
1648        ///
1649        /// This starts, but does not poll, a longrunning operation. More information
1650        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1651        pub async fn send(self) -> Result<longrunning::model::Operation> {
1652            (*self.0.stub)
1653                .purge_completion_suggestions(self.0.request, self.0.options)
1654                .await
1655                .map(gax::response::Response::into_body)
1656        }
1657
1658        /// Creates a [Poller][lro::Poller] to work with `purge_completion_suggestions`.
1659        pub fn poller(
1660            self,
1661        ) -> impl lro::Poller<
1662            crate::model::PurgeCompletionSuggestionsResponse,
1663            crate::model::PurgeCompletionSuggestionsMetadata,
1664        > {
1665            type Operation = lro::internal::Operation<
1666                crate::model::PurgeCompletionSuggestionsResponse,
1667                crate::model::PurgeCompletionSuggestionsMetadata,
1668            >;
1669            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1670            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1671
1672            let stub = self.0.stub.clone();
1673            let mut options = self.0.options.clone();
1674            options.set_retry_policy(gax::retry_policy::NeverRetry);
1675            let query = move |name| {
1676                let stub = stub.clone();
1677                let options = options.clone();
1678                async {
1679                    let op = GetOperation::new(stub)
1680                        .set_name(name)
1681                        .with_options(options)
1682                        .send()
1683                        .await?;
1684                    Ok(Operation::new(op))
1685                }
1686            };
1687
1688            let start = move || async {
1689                let op = self.send().await?;
1690                Ok(Operation::new(op))
1691            };
1692
1693            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1694        }
1695
1696        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1697        ///
1698        /// This is a **required** field for requests.
1699        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1700            self.0.request.parent = v.into();
1701            self
1702        }
1703    }
1704
1705    #[doc(hidden)]
1706    impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1707        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1708            &mut self.0.options
1709        }
1710    }
1711
1712    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1713    ///
1714    /// # Example
1715    /// ```no_run
1716    /// # use google_cloud_discoveryengine_v1::builder;
1717    /// use builder::completion_service::ListOperations;
1718    /// # tokio_test::block_on(async {
1719    /// use gax::paginator::ItemPaginator;
1720    ///
1721    /// let builder = prepare_request_builder();
1722    /// let mut items = builder.by_item();
1723    /// while let Some(result) = items.next().await {
1724    ///   let item = result?;
1725    /// }
1726    /// # gax::Result::<()>::Ok(()) });
1727    ///
1728    /// fn prepare_request_builder() -> ListOperations {
1729    ///   # panic!();
1730    ///   // ... details omitted ...
1731    /// }
1732    /// ```
1733    #[derive(Clone, Debug)]
1734    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1735
1736    impl ListOperations {
1737        pub(crate) fn new(
1738            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1739        ) -> Self {
1740            Self(RequestBuilder::new(stub))
1741        }
1742
1743        /// Sets the full request, replacing any prior values.
1744        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1745            mut self,
1746            v: V,
1747        ) -> Self {
1748            self.0.request = v.into();
1749            self
1750        }
1751
1752        /// Sets all the options, replacing any prior values.
1753        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1754            self.0.options = v.into();
1755            self
1756        }
1757
1758        /// Sends the request.
1759        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1760            (*self.0.stub)
1761                .list_operations(self.0.request, self.0.options)
1762                .await
1763                .map(gax::response::Response::into_body)
1764        }
1765
1766        /// Streams each page in the collection.
1767        pub fn by_page(
1768            self,
1769        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1770        {
1771            use std::clone::Clone;
1772            let token = self.0.request.page_token.clone();
1773            let execute = move |token: String| {
1774                let mut builder = self.clone();
1775                builder.0.request = builder.0.request.set_page_token(token);
1776                builder.send()
1777            };
1778            gax::paginator::internal::new_paginator(token, execute)
1779        }
1780
1781        /// Streams each item in the collection.
1782        pub fn by_item(
1783            self,
1784        ) -> impl gax::paginator::ItemPaginator<
1785            longrunning::model::ListOperationsResponse,
1786            gax::error::Error,
1787        > {
1788            use gax::paginator::Paginator;
1789            self.by_page().items()
1790        }
1791
1792        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1793        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1794            self.0.request.name = v.into();
1795            self
1796        }
1797
1798        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1799        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800            self.0.request.filter = v.into();
1801            self
1802        }
1803
1804        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1805        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1806            self.0.request.page_size = v.into();
1807            self
1808        }
1809
1810        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1811        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1812            self.0.request.page_token = v.into();
1813            self
1814        }
1815
1816        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1817        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1818            self.0.request.return_partial_success = v.into();
1819            self
1820        }
1821    }
1822
1823    #[doc(hidden)]
1824    impl gax::options::internal::RequestBuilder for ListOperations {
1825        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1826            &mut self.0.options
1827        }
1828    }
1829
1830    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1831    ///
1832    /// # Example
1833    /// ```no_run
1834    /// # use google_cloud_discoveryengine_v1::builder;
1835    /// use builder::completion_service::GetOperation;
1836    /// # tokio_test::block_on(async {
1837    ///
1838    /// let builder = prepare_request_builder();
1839    /// let response = builder.send().await?;
1840    /// # gax::Result::<()>::Ok(()) });
1841    ///
1842    /// fn prepare_request_builder() -> GetOperation {
1843    ///   # panic!();
1844    ///   // ... details omitted ...
1845    /// }
1846    /// ```
1847    #[derive(Clone, Debug)]
1848    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1849
1850    impl GetOperation {
1851        pub(crate) fn new(
1852            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1853        ) -> Self {
1854            Self(RequestBuilder::new(stub))
1855        }
1856
1857        /// Sets the full request, replacing any prior values.
1858        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1859            mut self,
1860            v: V,
1861        ) -> Self {
1862            self.0.request = v.into();
1863            self
1864        }
1865
1866        /// Sets all the options, replacing any prior values.
1867        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1868            self.0.options = v.into();
1869            self
1870        }
1871
1872        /// Sends the request.
1873        pub async fn send(self) -> Result<longrunning::model::Operation> {
1874            (*self.0.stub)
1875                .get_operation(self.0.request, self.0.options)
1876                .await
1877                .map(gax::response::Response::into_body)
1878        }
1879
1880        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1881        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1882            self.0.request.name = v.into();
1883            self
1884        }
1885    }
1886
1887    #[doc(hidden)]
1888    impl gax::options::internal::RequestBuilder for GetOperation {
1889        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1890            &mut self.0.options
1891        }
1892    }
1893
1894    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1895    ///
1896    /// # Example
1897    /// ```no_run
1898    /// # use google_cloud_discoveryengine_v1::builder;
1899    /// use builder::completion_service::CancelOperation;
1900    /// # tokio_test::block_on(async {
1901    ///
1902    /// let builder = prepare_request_builder();
1903    /// let response = builder.send().await?;
1904    /// # gax::Result::<()>::Ok(()) });
1905    ///
1906    /// fn prepare_request_builder() -> CancelOperation {
1907    ///   # panic!();
1908    ///   // ... details omitted ...
1909    /// }
1910    /// ```
1911    #[derive(Clone, Debug)]
1912    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1913
1914    impl CancelOperation {
1915        pub(crate) fn new(
1916            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1917        ) -> Self {
1918            Self(RequestBuilder::new(stub))
1919        }
1920
1921        /// Sets the full request, replacing any prior values.
1922        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1923            mut self,
1924            v: V,
1925        ) -> Self {
1926            self.0.request = v.into();
1927            self
1928        }
1929
1930        /// Sets all the options, replacing any prior values.
1931        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1932            self.0.options = v.into();
1933            self
1934        }
1935
1936        /// Sends the request.
1937        pub async fn send(self) -> Result<()> {
1938            (*self.0.stub)
1939                .cancel_operation(self.0.request, self.0.options)
1940                .await
1941                .map(gax::response::Response::into_body)
1942        }
1943
1944        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1945        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1946            self.0.request.name = v.into();
1947            self
1948        }
1949    }
1950
1951    #[doc(hidden)]
1952    impl gax::options::internal::RequestBuilder for CancelOperation {
1953        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1954            &mut self.0.options
1955        }
1956    }
1957}
1958
1959#[cfg(feature = "control-service")]
1960#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1961pub mod control_service {
1962    use crate::Result;
1963
1964    /// A builder for [ControlService][crate::client::ControlService].
1965    ///
1966    /// ```
1967    /// # tokio_test::block_on(async {
1968    /// # use google_cloud_discoveryengine_v1::*;
1969    /// # use builder::control_service::ClientBuilder;
1970    /// # use client::ControlService;
1971    /// let builder : ClientBuilder = ControlService::builder();
1972    /// let client = builder
1973    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1974    ///     .build().await?;
1975    /// # gax::client_builder::Result::<()>::Ok(()) });
1976    /// ```
1977    pub type ClientBuilder =
1978        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1979
1980    pub(crate) mod client {
1981        use super::super::super::client::ControlService;
1982        pub struct Factory;
1983        impl gax::client_builder::internal::ClientFactory for Factory {
1984            type Client = ControlService;
1985            type Credentials = gaxi::options::Credentials;
1986            async fn build(
1987                self,
1988                config: gaxi::options::ClientConfig,
1989            ) -> gax::client_builder::Result<Self::Client> {
1990                Self::Client::new(config).await
1991            }
1992        }
1993    }
1994
1995    /// Common implementation for [crate::client::ControlService] request builders.
1996    #[derive(Clone, Debug)]
1997    pub(crate) struct RequestBuilder<R: std::default::Default> {
1998        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1999        request: R,
2000        options: gax::options::RequestOptions,
2001    }
2002
2003    impl<R> RequestBuilder<R>
2004    where
2005        R: std::default::Default,
2006    {
2007        pub(crate) fn new(
2008            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2009        ) -> Self {
2010            Self {
2011                stub,
2012                request: R::default(),
2013                options: gax::options::RequestOptions::default(),
2014            }
2015        }
2016    }
2017
2018    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2019    ///
2020    /// # Example
2021    /// ```no_run
2022    /// # use google_cloud_discoveryengine_v1::builder;
2023    /// use builder::control_service::CreateControl;
2024    /// # tokio_test::block_on(async {
2025    ///
2026    /// let builder = prepare_request_builder();
2027    /// let response = builder.send().await?;
2028    /// # gax::Result::<()>::Ok(()) });
2029    ///
2030    /// fn prepare_request_builder() -> CreateControl {
2031    ///   # panic!();
2032    ///   // ... details omitted ...
2033    /// }
2034    /// ```
2035    #[derive(Clone, Debug)]
2036    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2037
2038    impl CreateControl {
2039        pub(crate) fn new(
2040            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2041        ) -> Self {
2042            Self(RequestBuilder::new(stub))
2043        }
2044
2045        /// Sets the full request, replacing any prior values.
2046        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2047            self.0.request = v.into();
2048            self
2049        }
2050
2051        /// Sets all the options, replacing any prior values.
2052        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2053            self.0.options = v.into();
2054            self
2055        }
2056
2057        /// Sends the request.
2058        pub async fn send(self) -> Result<crate::model::Control> {
2059            (*self.0.stub)
2060                .create_control(self.0.request, self.0.options)
2061                .await
2062                .map(gax::response::Response::into_body)
2063        }
2064
2065        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2066        ///
2067        /// This is a **required** field for requests.
2068        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2069            self.0.request.parent = v.into();
2070            self
2071        }
2072
2073        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2074        ///
2075        /// This is a **required** field for requests.
2076        pub fn set_control<T>(mut self, v: T) -> Self
2077        where
2078            T: std::convert::Into<crate::model::Control>,
2079        {
2080            self.0.request.control = std::option::Option::Some(v.into());
2081            self
2082        }
2083
2084        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2085        ///
2086        /// This is a **required** field for requests.
2087        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2088        where
2089            T: std::convert::Into<crate::model::Control>,
2090        {
2091            self.0.request.control = v.map(|x| x.into());
2092            self
2093        }
2094
2095        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2096        ///
2097        /// This is a **required** field for requests.
2098        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2099            self.0.request.control_id = v.into();
2100            self
2101        }
2102    }
2103
2104    #[doc(hidden)]
2105    impl gax::options::internal::RequestBuilder for CreateControl {
2106        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2107            &mut self.0.options
2108        }
2109    }
2110
2111    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2112    ///
2113    /// # Example
2114    /// ```no_run
2115    /// # use google_cloud_discoveryengine_v1::builder;
2116    /// use builder::control_service::DeleteControl;
2117    /// # tokio_test::block_on(async {
2118    ///
2119    /// let builder = prepare_request_builder();
2120    /// let response = builder.send().await?;
2121    /// # gax::Result::<()>::Ok(()) });
2122    ///
2123    /// fn prepare_request_builder() -> DeleteControl {
2124    ///   # panic!();
2125    ///   // ... details omitted ...
2126    /// }
2127    /// ```
2128    #[derive(Clone, Debug)]
2129    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2130
2131    impl DeleteControl {
2132        pub(crate) fn new(
2133            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2134        ) -> Self {
2135            Self(RequestBuilder::new(stub))
2136        }
2137
2138        /// Sets the full request, replacing any prior values.
2139        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2140            self.0.request = v.into();
2141            self
2142        }
2143
2144        /// Sets all the options, replacing any prior values.
2145        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2146            self.0.options = v.into();
2147            self
2148        }
2149
2150        /// Sends the request.
2151        pub async fn send(self) -> Result<()> {
2152            (*self.0.stub)
2153                .delete_control(self.0.request, self.0.options)
2154                .await
2155                .map(gax::response::Response::into_body)
2156        }
2157
2158        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2159        ///
2160        /// This is a **required** field for requests.
2161        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2162            self.0.request.name = v.into();
2163            self
2164        }
2165    }
2166
2167    #[doc(hidden)]
2168    impl gax::options::internal::RequestBuilder for DeleteControl {
2169        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2170            &mut self.0.options
2171        }
2172    }
2173
2174    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2175    ///
2176    /// # Example
2177    /// ```no_run
2178    /// # use google_cloud_discoveryengine_v1::builder;
2179    /// use builder::control_service::UpdateControl;
2180    /// # tokio_test::block_on(async {
2181    ///
2182    /// let builder = prepare_request_builder();
2183    /// let response = builder.send().await?;
2184    /// # gax::Result::<()>::Ok(()) });
2185    ///
2186    /// fn prepare_request_builder() -> UpdateControl {
2187    ///   # panic!();
2188    ///   // ... details omitted ...
2189    /// }
2190    /// ```
2191    #[derive(Clone, Debug)]
2192    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2193
2194    impl UpdateControl {
2195        pub(crate) fn new(
2196            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2197        ) -> Self {
2198            Self(RequestBuilder::new(stub))
2199        }
2200
2201        /// Sets the full request, replacing any prior values.
2202        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2203            self.0.request = v.into();
2204            self
2205        }
2206
2207        /// Sets all the options, replacing any prior values.
2208        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2209            self.0.options = v.into();
2210            self
2211        }
2212
2213        /// Sends the request.
2214        pub async fn send(self) -> Result<crate::model::Control> {
2215            (*self.0.stub)
2216                .update_control(self.0.request, self.0.options)
2217                .await
2218                .map(gax::response::Response::into_body)
2219        }
2220
2221        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2222        ///
2223        /// This is a **required** field for requests.
2224        pub fn set_control<T>(mut self, v: T) -> Self
2225        where
2226            T: std::convert::Into<crate::model::Control>,
2227        {
2228            self.0.request.control = std::option::Option::Some(v.into());
2229            self
2230        }
2231
2232        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2233        ///
2234        /// This is a **required** field for requests.
2235        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2236        where
2237            T: std::convert::Into<crate::model::Control>,
2238        {
2239            self.0.request.control = v.map(|x| x.into());
2240            self
2241        }
2242
2243        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2244        pub fn set_update_mask<T>(mut self, v: T) -> Self
2245        where
2246            T: std::convert::Into<wkt::FieldMask>,
2247        {
2248            self.0.request.update_mask = std::option::Option::Some(v.into());
2249            self
2250        }
2251
2252        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2253        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2254        where
2255            T: std::convert::Into<wkt::FieldMask>,
2256        {
2257            self.0.request.update_mask = v.map(|x| x.into());
2258            self
2259        }
2260    }
2261
2262    #[doc(hidden)]
2263    impl gax::options::internal::RequestBuilder for UpdateControl {
2264        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2265            &mut self.0.options
2266        }
2267    }
2268
2269    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2270    ///
2271    /// # Example
2272    /// ```no_run
2273    /// # use google_cloud_discoveryengine_v1::builder;
2274    /// use builder::control_service::GetControl;
2275    /// # tokio_test::block_on(async {
2276    ///
2277    /// let builder = prepare_request_builder();
2278    /// let response = builder.send().await?;
2279    /// # gax::Result::<()>::Ok(()) });
2280    ///
2281    /// fn prepare_request_builder() -> GetControl {
2282    ///   # panic!();
2283    ///   // ... details omitted ...
2284    /// }
2285    /// ```
2286    #[derive(Clone, Debug)]
2287    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2288
2289    impl GetControl {
2290        pub(crate) fn new(
2291            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2292        ) -> Self {
2293            Self(RequestBuilder::new(stub))
2294        }
2295
2296        /// Sets the full request, replacing any prior values.
2297        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2298            self.0.request = v.into();
2299            self
2300        }
2301
2302        /// Sets all the options, replacing any prior values.
2303        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2304            self.0.options = v.into();
2305            self
2306        }
2307
2308        /// Sends the request.
2309        pub async fn send(self) -> Result<crate::model::Control> {
2310            (*self.0.stub)
2311                .get_control(self.0.request, self.0.options)
2312                .await
2313                .map(gax::response::Response::into_body)
2314        }
2315
2316        /// Sets the value of [name][crate::model::GetControlRequest::name].
2317        ///
2318        /// This is a **required** field for requests.
2319        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2320            self.0.request.name = v.into();
2321            self
2322        }
2323    }
2324
2325    #[doc(hidden)]
2326    impl gax::options::internal::RequestBuilder for GetControl {
2327        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2328            &mut self.0.options
2329        }
2330    }
2331
2332    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2333    ///
2334    /// # Example
2335    /// ```no_run
2336    /// # use google_cloud_discoveryengine_v1::builder;
2337    /// use builder::control_service::ListControls;
2338    /// # tokio_test::block_on(async {
2339    /// use gax::paginator::ItemPaginator;
2340    ///
2341    /// let builder = prepare_request_builder();
2342    /// let mut items = builder.by_item();
2343    /// while let Some(result) = items.next().await {
2344    ///   let item = result?;
2345    /// }
2346    /// # gax::Result::<()>::Ok(()) });
2347    ///
2348    /// fn prepare_request_builder() -> ListControls {
2349    ///   # panic!();
2350    ///   // ... details omitted ...
2351    /// }
2352    /// ```
2353    #[derive(Clone, Debug)]
2354    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2355
2356    impl ListControls {
2357        pub(crate) fn new(
2358            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2359        ) -> Self {
2360            Self(RequestBuilder::new(stub))
2361        }
2362
2363        /// Sets the full request, replacing any prior values.
2364        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2365            self.0.request = v.into();
2366            self
2367        }
2368
2369        /// Sets all the options, replacing any prior values.
2370        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2371            self.0.options = v.into();
2372            self
2373        }
2374
2375        /// Sends the request.
2376        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2377            (*self.0.stub)
2378                .list_controls(self.0.request, self.0.options)
2379                .await
2380                .map(gax::response::Response::into_body)
2381        }
2382
2383        /// Streams each page in the collection.
2384        pub fn by_page(
2385            self,
2386        ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2387        {
2388            use std::clone::Clone;
2389            let token = self.0.request.page_token.clone();
2390            let execute = move |token: String| {
2391                let mut builder = self.clone();
2392                builder.0.request = builder.0.request.set_page_token(token);
2393                builder.send()
2394            };
2395            gax::paginator::internal::new_paginator(token, execute)
2396        }
2397
2398        /// Streams each item in the collection.
2399        pub fn by_item(
2400            self,
2401        ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2402        {
2403            use gax::paginator::Paginator;
2404            self.by_page().items()
2405        }
2406
2407        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2408        ///
2409        /// This is a **required** field for requests.
2410        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2411            self.0.request.parent = v.into();
2412            self
2413        }
2414
2415        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2416        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2417            self.0.request.page_size = v.into();
2418            self
2419        }
2420
2421        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2422        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2423            self.0.request.page_token = v.into();
2424            self
2425        }
2426
2427        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2428        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2429            self.0.request.filter = v.into();
2430            self
2431        }
2432    }
2433
2434    #[doc(hidden)]
2435    impl gax::options::internal::RequestBuilder for ListControls {
2436        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2437            &mut self.0.options
2438        }
2439    }
2440
2441    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2442    ///
2443    /// # Example
2444    /// ```no_run
2445    /// # use google_cloud_discoveryengine_v1::builder;
2446    /// use builder::control_service::ListOperations;
2447    /// # tokio_test::block_on(async {
2448    /// use gax::paginator::ItemPaginator;
2449    ///
2450    /// let builder = prepare_request_builder();
2451    /// let mut items = builder.by_item();
2452    /// while let Some(result) = items.next().await {
2453    ///   let item = result?;
2454    /// }
2455    /// # gax::Result::<()>::Ok(()) });
2456    ///
2457    /// fn prepare_request_builder() -> ListOperations {
2458    ///   # panic!();
2459    ///   // ... details omitted ...
2460    /// }
2461    /// ```
2462    #[derive(Clone, Debug)]
2463    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2464
2465    impl ListOperations {
2466        pub(crate) fn new(
2467            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2468        ) -> Self {
2469            Self(RequestBuilder::new(stub))
2470        }
2471
2472        /// Sets the full request, replacing any prior values.
2473        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2474            mut self,
2475            v: V,
2476        ) -> Self {
2477            self.0.request = v.into();
2478            self
2479        }
2480
2481        /// Sets all the options, replacing any prior values.
2482        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2483            self.0.options = v.into();
2484            self
2485        }
2486
2487        /// Sends the request.
2488        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2489            (*self.0.stub)
2490                .list_operations(self.0.request, self.0.options)
2491                .await
2492                .map(gax::response::Response::into_body)
2493        }
2494
2495        /// Streams each page in the collection.
2496        pub fn by_page(
2497            self,
2498        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2499        {
2500            use std::clone::Clone;
2501            let token = self.0.request.page_token.clone();
2502            let execute = move |token: String| {
2503                let mut builder = self.clone();
2504                builder.0.request = builder.0.request.set_page_token(token);
2505                builder.send()
2506            };
2507            gax::paginator::internal::new_paginator(token, execute)
2508        }
2509
2510        /// Streams each item in the collection.
2511        pub fn by_item(
2512            self,
2513        ) -> impl gax::paginator::ItemPaginator<
2514            longrunning::model::ListOperationsResponse,
2515            gax::error::Error,
2516        > {
2517            use gax::paginator::Paginator;
2518            self.by_page().items()
2519        }
2520
2521        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2522        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2523            self.0.request.name = v.into();
2524            self
2525        }
2526
2527        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2528        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2529            self.0.request.filter = v.into();
2530            self
2531        }
2532
2533        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2534        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2535            self.0.request.page_size = v.into();
2536            self
2537        }
2538
2539        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2540        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2541            self.0.request.page_token = v.into();
2542            self
2543        }
2544
2545        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2546        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2547            self.0.request.return_partial_success = v.into();
2548            self
2549        }
2550    }
2551
2552    #[doc(hidden)]
2553    impl gax::options::internal::RequestBuilder for ListOperations {
2554        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2555            &mut self.0.options
2556        }
2557    }
2558
2559    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2560    ///
2561    /// # Example
2562    /// ```no_run
2563    /// # use google_cloud_discoveryengine_v1::builder;
2564    /// use builder::control_service::GetOperation;
2565    /// # tokio_test::block_on(async {
2566    ///
2567    /// let builder = prepare_request_builder();
2568    /// let response = builder.send().await?;
2569    /// # gax::Result::<()>::Ok(()) });
2570    ///
2571    /// fn prepare_request_builder() -> GetOperation {
2572    ///   # panic!();
2573    ///   // ... details omitted ...
2574    /// }
2575    /// ```
2576    #[derive(Clone, Debug)]
2577    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2578
2579    impl GetOperation {
2580        pub(crate) fn new(
2581            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2582        ) -> Self {
2583            Self(RequestBuilder::new(stub))
2584        }
2585
2586        /// Sets the full request, replacing any prior values.
2587        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2588            mut self,
2589            v: V,
2590        ) -> Self {
2591            self.0.request = v.into();
2592            self
2593        }
2594
2595        /// Sets all the options, replacing any prior values.
2596        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2597            self.0.options = v.into();
2598            self
2599        }
2600
2601        /// Sends the request.
2602        pub async fn send(self) -> Result<longrunning::model::Operation> {
2603            (*self.0.stub)
2604                .get_operation(self.0.request, self.0.options)
2605                .await
2606                .map(gax::response::Response::into_body)
2607        }
2608
2609        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2610        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2611            self.0.request.name = v.into();
2612            self
2613        }
2614    }
2615
2616    #[doc(hidden)]
2617    impl gax::options::internal::RequestBuilder for GetOperation {
2618        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2619            &mut self.0.options
2620        }
2621    }
2622
2623    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2624    ///
2625    /// # Example
2626    /// ```no_run
2627    /// # use google_cloud_discoveryengine_v1::builder;
2628    /// use builder::control_service::CancelOperation;
2629    /// # tokio_test::block_on(async {
2630    ///
2631    /// let builder = prepare_request_builder();
2632    /// let response = builder.send().await?;
2633    /// # gax::Result::<()>::Ok(()) });
2634    ///
2635    /// fn prepare_request_builder() -> CancelOperation {
2636    ///   # panic!();
2637    ///   // ... details omitted ...
2638    /// }
2639    /// ```
2640    #[derive(Clone, Debug)]
2641    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2642
2643    impl CancelOperation {
2644        pub(crate) fn new(
2645            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2646        ) -> Self {
2647            Self(RequestBuilder::new(stub))
2648        }
2649
2650        /// Sets the full request, replacing any prior values.
2651        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2652            mut self,
2653            v: V,
2654        ) -> Self {
2655            self.0.request = v.into();
2656            self
2657        }
2658
2659        /// Sets all the options, replacing any prior values.
2660        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2661            self.0.options = v.into();
2662            self
2663        }
2664
2665        /// Sends the request.
2666        pub async fn send(self) -> Result<()> {
2667            (*self.0.stub)
2668                .cancel_operation(self.0.request, self.0.options)
2669                .await
2670                .map(gax::response::Response::into_body)
2671        }
2672
2673        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2674        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2675            self.0.request.name = v.into();
2676            self
2677        }
2678    }
2679
2680    #[doc(hidden)]
2681    impl gax::options::internal::RequestBuilder for CancelOperation {
2682        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2683            &mut self.0.options
2684        }
2685    }
2686}
2687
2688#[cfg(feature = "conversational-search-service")]
2689#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2690pub mod conversational_search_service {
2691    use crate::Result;
2692
2693    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2694    ///
2695    /// ```
2696    /// # tokio_test::block_on(async {
2697    /// # use google_cloud_discoveryengine_v1::*;
2698    /// # use builder::conversational_search_service::ClientBuilder;
2699    /// # use client::ConversationalSearchService;
2700    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2701    /// let client = builder
2702    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2703    ///     .build().await?;
2704    /// # gax::client_builder::Result::<()>::Ok(()) });
2705    /// ```
2706    pub type ClientBuilder =
2707        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2708
2709    pub(crate) mod client {
2710        use super::super::super::client::ConversationalSearchService;
2711        pub struct Factory;
2712        impl gax::client_builder::internal::ClientFactory for Factory {
2713            type Client = ConversationalSearchService;
2714            type Credentials = gaxi::options::Credentials;
2715            async fn build(
2716                self,
2717                config: gaxi::options::ClientConfig,
2718            ) -> gax::client_builder::Result<Self::Client> {
2719                Self::Client::new(config).await
2720            }
2721        }
2722    }
2723
2724    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2725    #[derive(Clone, Debug)]
2726    pub(crate) struct RequestBuilder<R: std::default::Default> {
2727        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2728        request: R,
2729        options: gax::options::RequestOptions,
2730    }
2731
2732    impl<R> RequestBuilder<R>
2733    where
2734        R: std::default::Default,
2735    {
2736        pub(crate) fn new(
2737            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2738        ) -> Self {
2739            Self {
2740                stub,
2741                request: R::default(),
2742                options: gax::options::RequestOptions::default(),
2743            }
2744        }
2745    }
2746
2747    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2748    ///
2749    /// # Example
2750    /// ```no_run
2751    /// # use google_cloud_discoveryengine_v1::builder;
2752    /// use builder::conversational_search_service::ConverseConversation;
2753    /// # tokio_test::block_on(async {
2754    ///
2755    /// let builder = prepare_request_builder();
2756    /// let response = builder.send().await?;
2757    /// # gax::Result::<()>::Ok(()) });
2758    ///
2759    /// fn prepare_request_builder() -> ConverseConversation {
2760    ///   # panic!();
2761    ///   // ... details omitted ...
2762    /// }
2763    /// ```
2764    #[derive(Clone, Debug)]
2765    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2766
2767    impl ConverseConversation {
2768        pub(crate) fn new(
2769            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2770        ) -> Self {
2771            Self(RequestBuilder::new(stub))
2772        }
2773
2774        /// Sets the full request, replacing any prior values.
2775        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2776            mut self,
2777            v: V,
2778        ) -> Self {
2779            self.0.request = v.into();
2780            self
2781        }
2782
2783        /// Sets all the options, replacing any prior values.
2784        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2785            self.0.options = v.into();
2786            self
2787        }
2788
2789        /// Sends the request.
2790        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2791            (*self.0.stub)
2792                .converse_conversation(self.0.request, self.0.options)
2793                .await
2794                .map(gax::response::Response::into_body)
2795        }
2796
2797        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2798        ///
2799        /// This is a **required** field for requests.
2800        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2801            self.0.request.name = v.into();
2802            self
2803        }
2804
2805        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2806        ///
2807        /// This is a **required** field for requests.
2808        pub fn set_query<T>(mut self, v: T) -> Self
2809        where
2810            T: std::convert::Into<crate::model::TextInput>,
2811        {
2812            self.0.request.query = std::option::Option::Some(v.into());
2813            self
2814        }
2815
2816        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2817        ///
2818        /// This is a **required** field for requests.
2819        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2820        where
2821            T: std::convert::Into<crate::model::TextInput>,
2822        {
2823            self.0.request.query = v.map(|x| x.into());
2824            self
2825        }
2826
2827        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2828        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2829            self.0.request.serving_config = v.into();
2830            self
2831        }
2832
2833        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2834        pub fn set_conversation<T>(mut self, v: T) -> Self
2835        where
2836            T: std::convert::Into<crate::model::Conversation>,
2837        {
2838            self.0.request.conversation = std::option::Option::Some(v.into());
2839            self
2840        }
2841
2842        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2843        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2844        where
2845            T: std::convert::Into<crate::model::Conversation>,
2846        {
2847            self.0.request.conversation = v.map(|x| x.into());
2848            self
2849        }
2850
2851        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2852        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2853            self.0.request.safe_search = v.into();
2854            self
2855        }
2856
2857        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2858        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2859        where
2860            T: std::iter::IntoIterator<Item = (K, V)>,
2861            K: std::convert::Into<std::string::String>,
2862            V: std::convert::Into<std::string::String>,
2863        {
2864            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2865            self
2866        }
2867
2868        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2869        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2870        where
2871            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2872        {
2873            self.0.request.summary_spec = std::option::Option::Some(v.into());
2874            self
2875        }
2876
2877        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2878        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2879        where
2880            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2881        {
2882            self.0.request.summary_spec = v.map(|x| x.into());
2883            self
2884        }
2885
2886        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2887        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2888            self.0.request.filter = v.into();
2889            self
2890        }
2891
2892        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2893        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2894        where
2895            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2896        {
2897            self.0.request.boost_spec = std::option::Option::Some(v.into());
2898            self
2899        }
2900
2901        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2902        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2903        where
2904            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2905        {
2906            self.0.request.boost_spec = v.map(|x| x.into());
2907            self
2908        }
2909    }
2910
2911    #[doc(hidden)]
2912    impl gax::options::internal::RequestBuilder for ConverseConversation {
2913        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2914            &mut self.0.options
2915        }
2916    }
2917
2918    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2919    ///
2920    /// # Example
2921    /// ```no_run
2922    /// # use google_cloud_discoveryengine_v1::builder;
2923    /// use builder::conversational_search_service::CreateConversation;
2924    /// # tokio_test::block_on(async {
2925    ///
2926    /// let builder = prepare_request_builder();
2927    /// let response = builder.send().await?;
2928    /// # gax::Result::<()>::Ok(()) });
2929    ///
2930    /// fn prepare_request_builder() -> CreateConversation {
2931    ///   # panic!();
2932    ///   // ... details omitted ...
2933    /// }
2934    /// ```
2935    #[derive(Clone, Debug)]
2936    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2937
2938    impl CreateConversation {
2939        pub(crate) fn new(
2940            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2941        ) -> Self {
2942            Self(RequestBuilder::new(stub))
2943        }
2944
2945        /// Sets the full request, replacing any prior values.
2946        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2947            mut self,
2948            v: V,
2949        ) -> Self {
2950            self.0.request = v.into();
2951            self
2952        }
2953
2954        /// Sets all the options, replacing any prior values.
2955        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2956            self.0.options = v.into();
2957            self
2958        }
2959
2960        /// Sends the request.
2961        pub async fn send(self) -> Result<crate::model::Conversation> {
2962            (*self.0.stub)
2963                .create_conversation(self.0.request, self.0.options)
2964                .await
2965                .map(gax::response::Response::into_body)
2966        }
2967
2968        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
2969        ///
2970        /// This is a **required** field for requests.
2971        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2972            self.0.request.parent = v.into();
2973            self
2974        }
2975
2976        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
2977        ///
2978        /// This is a **required** field for requests.
2979        pub fn set_conversation<T>(mut self, v: T) -> Self
2980        where
2981            T: std::convert::Into<crate::model::Conversation>,
2982        {
2983            self.0.request.conversation = std::option::Option::Some(v.into());
2984            self
2985        }
2986
2987        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
2988        ///
2989        /// This is a **required** field for requests.
2990        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2991        where
2992            T: std::convert::Into<crate::model::Conversation>,
2993        {
2994            self.0.request.conversation = v.map(|x| x.into());
2995            self
2996        }
2997    }
2998
2999    #[doc(hidden)]
3000    impl gax::options::internal::RequestBuilder for CreateConversation {
3001        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3002            &mut self.0.options
3003        }
3004    }
3005
3006    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
3007    ///
3008    /// # Example
3009    /// ```no_run
3010    /// # use google_cloud_discoveryengine_v1::builder;
3011    /// use builder::conversational_search_service::DeleteConversation;
3012    /// # tokio_test::block_on(async {
3013    ///
3014    /// let builder = prepare_request_builder();
3015    /// let response = builder.send().await?;
3016    /// # gax::Result::<()>::Ok(()) });
3017    ///
3018    /// fn prepare_request_builder() -> DeleteConversation {
3019    ///   # panic!();
3020    ///   // ... details omitted ...
3021    /// }
3022    /// ```
3023    #[derive(Clone, Debug)]
3024    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3025
3026    impl DeleteConversation {
3027        pub(crate) fn new(
3028            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3029        ) -> Self {
3030            Self(RequestBuilder::new(stub))
3031        }
3032
3033        /// Sets the full request, replacing any prior values.
3034        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3035            mut self,
3036            v: V,
3037        ) -> Self {
3038            self.0.request = v.into();
3039            self
3040        }
3041
3042        /// Sets all the options, replacing any prior values.
3043        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3044            self.0.options = v.into();
3045            self
3046        }
3047
3048        /// Sends the request.
3049        pub async fn send(self) -> Result<()> {
3050            (*self.0.stub)
3051                .delete_conversation(self.0.request, self.0.options)
3052                .await
3053                .map(gax::response::Response::into_body)
3054        }
3055
3056        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3057        ///
3058        /// This is a **required** field for requests.
3059        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3060            self.0.request.name = v.into();
3061            self
3062        }
3063    }
3064
3065    #[doc(hidden)]
3066    impl gax::options::internal::RequestBuilder for DeleteConversation {
3067        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3068            &mut self.0.options
3069        }
3070    }
3071
3072    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3073    ///
3074    /// # Example
3075    /// ```no_run
3076    /// # use google_cloud_discoveryengine_v1::builder;
3077    /// use builder::conversational_search_service::UpdateConversation;
3078    /// # tokio_test::block_on(async {
3079    ///
3080    /// let builder = prepare_request_builder();
3081    /// let response = builder.send().await?;
3082    /// # gax::Result::<()>::Ok(()) });
3083    ///
3084    /// fn prepare_request_builder() -> UpdateConversation {
3085    ///   # panic!();
3086    ///   // ... details omitted ...
3087    /// }
3088    /// ```
3089    #[derive(Clone, Debug)]
3090    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3091
3092    impl UpdateConversation {
3093        pub(crate) fn new(
3094            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3095        ) -> Self {
3096            Self(RequestBuilder::new(stub))
3097        }
3098
3099        /// Sets the full request, replacing any prior values.
3100        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3101            mut self,
3102            v: V,
3103        ) -> Self {
3104            self.0.request = v.into();
3105            self
3106        }
3107
3108        /// Sets all the options, replacing any prior values.
3109        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3110            self.0.options = v.into();
3111            self
3112        }
3113
3114        /// Sends the request.
3115        pub async fn send(self) -> Result<crate::model::Conversation> {
3116            (*self.0.stub)
3117                .update_conversation(self.0.request, self.0.options)
3118                .await
3119                .map(gax::response::Response::into_body)
3120        }
3121
3122        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3123        ///
3124        /// This is a **required** field for requests.
3125        pub fn set_conversation<T>(mut self, v: T) -> Self
3126        where
3127            T: std::convert::Into<crate::model::Conversation>,
3128        {
3129            self.0.request.conversation = std::option::Option::Some(v.into());
3130            self
3131        }
3132
3133        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3134        ///
3135        /// This is a **required** field for requests.
3136        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3137        where
3138            T: std::convert::Into<crate::model::Conversation>,
3139        {
3140            self.0.request.conversation = v.map(|x| x.into());
3141            self
3142        }
3143
3144        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3145        pub fn set_update_mask<T>(mut self, v: T) -> Self
3146        where
3147            T: std::convert::Into<wkt::FieldMask>,
3148        {
3149            self.0.request.update_mask = std::option::Option::Some(v.into());
3150            self
3151        }
3152
3153        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3154        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3155        where
3156            T: std::convert::Into<wkt::FieldMask>,
3157        {
3158            self.0.request.update_mask = v.map(|x| x.into());
3159            self
3160        }
3161    }
3162
3163    #[doc(hidden)]
3164    impl gax::options::internal::RequestBuilder for UpdateConversation {
3165        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3166            &mut self.0.options
3167        }
3168    }
3169
3170    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3171    ///
3172    /// # Example
3173    /// ```no_run
3174    /// # use google_cloud_discoveryengine_v1::builder;
3175    /// use builder::conversational_search_service::GetConversation;
3176    /// # tokio_test::block_on(async {
3177    ///
3178    /// let builder = prepare_request_builder();
3179    /// let response = builder.send().await?;
3180    /// # gax::Result::<()>::Ok(()) });
3181    ///
3182    /// fn prepare_request_builder() -> GetConversation {
3183    ///   # panic!();
3184    ///   // ... details omitted ...
3185    /// }
3186    /// ```
3187    #[derive(Clone, Debug)]
3188    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3189
3190    impl GetConversation {
3191        pub(crate) fn new(
3192            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3193        ) -> Self {
3194            Self(RequestBuilder::new(stub))
3195        }
3196
3197        /// Sets the full request, replacing any prior values.
3198        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3199            self.0.request = v.into();
3200            self
3201        }
3202
3203        /// Sets all the options, replacing any prior values.
3204        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3205            self.0.options = v.into();
3206            self
3207        }
3208
3209        /// Sends the request.
3210        pub async fn send(self) -> Result<crate::model::Conversation> {
3211            (*self.0.stub)
3212                .get_conversation(self.0.request, self.0.options)
3213                .await
3214                .map(gax::response::Response::into_body)
3215        }
3216
3217        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3218        ///
3219        /// This is a **required** field for requests.
3220        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3221            self.0.request.name = v.into();
3222            self
3223        }
3224    }
3225
3226    #[doc(hidden)]
3227    impl gax::options::internal::RequestBuilder for GetConversation {
3228        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3229            &mut self.0.options
3230        }
3231    }
3232
3233    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3234    ///
3235    /// # Example
3236    /// ```no_run
3237    /// # use google_cloud_discoveryengine_v1::builder;
3238    /// use builder::conversational_search_service::ListConversations;
3239    /// # tokio_test::block_on(async {
3240    /// use gax::paginator::ItemPaginator;
3241    ///
3242    /// let builder = prepare_request_builder();
3243    /// let mut items = builder.by_item();
3244    /// while let Some(result) = items.next().await {
3245    ///   let item = result?;
3246    /// }
3247    /// # gax::Result::<()>::Ok(()) });
3248    ///
3249    /// fn prepare_request_builder() -> ListConversations {
3250    ///   # panic!();
3251    ///   // ... details omitted ...
3252    /// }
3253    /// ```
3254    #[derive(Clone, Debug)]
3255    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3256
3257    impl ListConversations {
3258        pub(crate) fn new(
3259            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3260        ) -> Self {
3261            Self(RequestBuilder::new(stub))
3262        }
3263
3264        /// Sets the full request, replacing any prior values.
3265        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3266            mut self,
3267            v: V,
3268        ) -> Self {
3269            self.0.request = v.into();
3270            self
3271        }
3272
3273        /// Sets all the options, replacing any prior values.
3274        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3275            self.0.options = v.into();
3276            self
3277        }
3278
3279        /// Sends the request.
3280        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3281            (*self.0.stub)
3282                .list_conversations(self.0.request, self.0.options)
3283                .await
3284                .map(gax::response::Response::into_body)
3285        }
3286
3287        /// Streams each page in the collection.
3288        pub fn by_page(
3289            self,
3290        ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3291        {
3292            use std::clone::Clone;
3293            let token = self.0.request.page_token.clone();
3294            let execute = move |token: String| {
3295                let mut builder = self.clone();
3296                builder.0.request = builder.0.request.set_page_token(token);
3297                builder.send()
3298            };
3299            gax::paginator::internal::new_paginator(token, execute)
3300        }
3301
3302        /// Streams each item in the collection.
3303        pub fn by_item(
3304            self,
3305        ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3306        {
3307            use gax::paginator::Paginator;
3308            self.by_page().items()
3309        }
3310
3311        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3312        ///
3313        /// This is a **required** field for requests.
3314        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3315            self.0.request.parent = v.into();
3316            self
3317        }
3318
3319        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3320        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3321            self.0.request.page_size = v.into();
3322            self
3323        }
3324
3325        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3326        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3327            self.0.request.page_token = v.into();
3328            self
3329        }
3330
3331        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3332        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3333            self.0.request.filter = v.into();
3334            self
3335        }
3336
3337        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3338        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3339            self.0.request.order_by = v.into();
3340            self
3341        }
3342    }
3343
3344    #[doc(hidden)]
3345    impl gax::options::internal::RequestBuilder for ListConversations {
3346        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3347            &mut self.0.options
3348        }
3349    }
3350
3351    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3352    ///
3353    /// # Example
3354    /// ```no_run
3355    /// # use google_cloud_discoveryengine_v1::builder;
3356    /// use builder::conversational_search_service::AnswerQuery;
3357    /// # tokio_test::block_on(async {
3358    ///
3359    /// let builder = prepare_request_builder();
3360    /// let response = builder.send().await?;
3361    /// # gax::Result::<()>::Ok(()) });
3362    ///
3363    /// fn prepare_request_builder() -> AnswerQuery {
3364    ///   # panic!();
3365    ///   // ... details omitted ...
3366    /// }
3367    /// ```
3368    #[derive(Clone, Debug)]
3369    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3370
3371    impl AnswerQuery {
3372        pub(crate) fn new(
3373            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3374        ) -> Self {
3375            Self(RequestBuilder::new(stub))
3376        }
3377
3378        /// Sets the full request, replacing any prior values.
3379        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3380            self.0.request = v.into();
3381            self
3382        }
3383
3384        /// Sets all the options, replacing any prior values.
3385        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3386            self.0.options = v.into();
3387            self
3388        }
3389
3390        /// Sends the request.
3391        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3392            (*self.0.stub)
3393                .answer_query(self.0.request, self.0.options)
3394                .await
3395                .map(gax::response::Response::into_body)
3396        }
3397
3398        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3399        ///
3400        /// This is a **required** field for requests.
3401        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3402            self.0.request.serving_config = v.into();
3403            self
3404        }
3405
3406        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3407        ///
3408        /// This is a **required** field for requests.
3409        pub fn set_query<T>(mut self, v: T) -> Self
3410        where
3411            T: std::convert::Into<crate::model::Query>,
3412        {
3413            self.0.request.query = std::option::Option::Some(v.into());
3414            self
3415        }
3416
3417        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3418        ///
3419        /// This is a **required** field for requests.
3420        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3421        where
3422            T: std::convert::Into<crate::model::Query>,
3423        {
3424            self.0.request.query = v.map(|x| x.into());
3425            self
3426        }
3427
3428        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3429        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3430            self.0.request.session = v.into();
3431            self
3432        }
3433
3434        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3435        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3436        where
3437            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3438        {
3439            self.0.request.safety_spec = std::option::Option::Some(v.into());
3440            self
3441        }
3442
3443        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3444        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3445        where
3446            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3447        {
3448            self.0.request.safety_spec = v.map(|x| x.into());
3449            self
3450        }
3451
3452        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3453        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3454        where
3455            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3456        {
3457            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3458            self
3459        }
3460
3461        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3462        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3463        where
3464            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3465        {
3466            self.0.request.related_questions_spec = v.map(|x| x.into());
3467            self
3468        }
3469
3470        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3471        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3472        where
3473            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3474        {
3475            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3476            self
3477        }
3478
3479        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3480        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3481        where
3482            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3483        {
3484            self.0.request.grounding_spec = v.map(|x| x.into());
3485            self
3486        }
3487
3488        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3489        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3490        where
3491            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3492        {
3493            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3494            self
3495        }
3496
3497        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3498        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3499        where
3500            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3501        {
3502            self.0.request.answer_generation_spec = v.map(|x| x.into());
3503            self
3504        }
3505
3506        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3507        pub fn set_search_spec<T>(mut self, v: T) -> Self
3508        where
3509            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3510        {
3511            self.0.request.search_spec = std::option::Option::Some(v.into());
3512            self
3513        }
3514
3515        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3516        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3517        where
3518            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3519        {
3520            self.0.request.search_spec = v.map(|x| x.into());
3521            self
3522        }
3523
3524        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3525        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3526        where
3527            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3528        {
3529            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3530            self
3531        }
3532
3533        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3534        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3535        where
3536            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3537        {
3538            self.0.request.query_understanding_spec = v.map(|x| x.into());
3539            self
3540        }
3541
3542        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3543        #[deprecated]
3544        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3545            self.0.request.asynchronous_mode = v.into();
3546            self
3547        }
3548
3549        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3550        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3551            self.0.request.user_pseudo_id = v.into();
3552            self
3553        }
3554
3555        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3556        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3557        where
3558            T: std::iter::IntoIterator<Item = (K, V)>,
3559            K: std::convert::Into<std::string::String>,
3560            V: std::convert::Into<std::string::String>,
3561        {
3562            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3563            self
3564        }
3565
3566        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3567        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3568        where
3569            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3570        {
3571            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3572            self
3573        }
3574
3575        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3576        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3577        where
3578            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3579        {
3580            self.0.request.end_user_spec = v.map(|x| x.into());
3581            self
3582        }
3583    }
3584
3585    #[doc(hidden)]
3586    impl gax::options::internal::RequestBuilder for AnswerQuery {
3587        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3588            &mut self.0.options
3589        }
3590    }
3591
3592    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3593    ///
3594    /// # Example
3595    /// ```no_run
3596    /// # use google_cloud_discoveryengine_v1::builder;
3597    /// use builder::conversational_search_service::GetAnswer;
3598    /// # tokio_test::block_on(async {
3599    ///
3600    /// let builder = prepare_request_builder();
3601    /// let response = builder.send().await?;
3602    /// # gax::Result::<()>::Ok(()) });
3603    ///
3604    /// fn prepare_request_builder() -> GetAnswer {
3605    ///   # panic!();
3606    ///   // ... details omitted ...
3607    /// }
3608    /// ```
3609    #[derive(Clone, Debug)]
3610    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3611
3612    impl GetAnswer {
3613        pub(crate) fn new(
3614            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3615        ) -> Self {
3616            Self(RequestBuilder::new(stub))
3617        }
3618
3619        /// Sets the full request, replacing any prior values.
3620        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3621            self.0.request = v.into();
3622            self
3623        }
3624
3625        /// Sets all the options, replacing any prior values.
3626        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3627            self.0.options = v.into();
3628            self
3629        }
3630
3631        /// Sends the request.
3632        pub async fn send(self) -> Result<crate::model::Answer> {
3633            (*self.0.stub)
3634                .get_answer(self.0.request, self.0.options)
3635                .await
3636                .map(gax::response::Response::into_body)
3637        }
3638
3639        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3640        ///
3641        /// This is a **required** field for requests.
3642        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3643            self.0.request.name = v.into();
3644            self
3645        }
3646    }
3647
3648    #[doc(hidden)]
3649    impl gax::options::internal::RequestBuilder for GetAnswer {
3650        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3651            &mut self.0.options
3652        }
3653    }
3654
3655    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3656    ///
3657    /// # Example
3658    /// ```no_run
3659    /// # use google_cloud_discoveryengine_v1::builder;
3660    /// use builder::conversational_search_service::CreateSession;
3661    /// # tokio_test::block_on(async {
3662    ///
3663    /// let builder = prepare_request_builder();
3664    /// let response = builder.send().await?;
3665    /// # gax::Result::<()>::Ok(()) });
3666    ///
3667    /// fn prepare_request_builder() -> CreateSession {
3668    ///   # panic!();
3669    ///   // ... details omitted ...
3670    /// }
3671    /// ```
3672    #[derive(Clone, Debug)]
3673    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3674
3675    impl CreateSession {
3676        pub(crate) fn new(
3677            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3678        ) -> Self {
3679            Self(RequestBuilder::new(stub))
3680        }
3681
3682        /// Sets the full request, replacing any prior values.
3683        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3684            self.0.request = v.into();
3685            self
3686        }
3687
3688        /// Sets all the options, replacing any prior values.
3689        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3690            self.0.options = v.into();
3691            self
3692        }
3693
3694        /// Sends the request.
3695        pub async fn send(self) -> Result<crate::model::Session> {
3696            (*self.0.stub)
3697                .create_session(self.0.request, self.0.options)
3698                .await
3699                .map(gax::response::Response::into_body)
3700        }
3701
3702        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3703        ///
3704        /// This is a **required** field for requests.
3705        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3706            self.0.request.parent = v.into();
3707            self
3708        }
3709
3710        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3711        ///
3712        /// This is a **required** field for requests.
3713        pub fn set_session<T>(mut self, v: T) -> Self
3714        where
3715            T: std::convert::Into<crate::model::Session>,
3716        {
3717            self.0.request.session = std::option::Option::Some(v.into());
3718            self
3719        }
3720
3721        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3722        ///
3723        /// This is a **required** field for requests.
3724        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3725        where
3726            T: std::convert::Into<crate::model::Session>,
3727        {
3728            self.0.request.session = v.map(|x| x.into());
3729            self
3730        }
3731    }
3732
3733    #[doc(hidden)]
3734    impl gax::options::internal::RequestBuilder for CreateSession {
3735        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3736            &mut self.0.options
3737        }
3738    }
3739
3740    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3741    ///
3742    /// # Example
3743    /// ```no_run
3744    /// # use google_cloud_discoveryengine_v1::builder;
3745    /// use builder::conversational_search_service::DeleteSession;
3746    /// # tokio_test::block_on(async {
3747    ///
3748    /// let builder = prepare_request_builder();
3749    /// let response = builder.send().await?;
3750    /// # gax::Result::<()>::Ok(()) });
3751    ///
3752    /// fn prepare_request_builder() -> DeleteSession {
3753    ///   # panic!();
3754    ///   // ... details omitted ...
3755    /// }
3756    /// ```
3757    #[derive(Clone, Debug)]
3758    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3759
3760    impl DeleteSession {
3761        pub(crate) fn new(
3762            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3763        ) -> Self {
3764            Self(RequestBuilder::new(stub))
3765        }
3766
3767        /// Sets the full request, replacing any prior values.
3768        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3769            self.0.request = v.into();
3770            self
3771        }
3772
3773        /// Sets all the options, replacing any prior values.
3774        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3775            self.0.options = v.into();
3776            self
3777        }
3778
3779        /// Sends the request.
3780        pub async fn send(self) -> Result<()> {
3781            (*self.0.stub)
3782                .delete_session(self.0.request, self.0.options)
3783                .await
3784                .map(gax::response::Response::into_body)
3785        }
3786
3787        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3788        ///
3789        /// This is a **required** field for requests.
3790        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3791            self.0.request.name = v.into();
3792            self
3793        }
3794    }
3795
3796    #[doc(hidden)]
3797    impl gax::options::internal::RequestBuilder for DeleteSession {
3798        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3799            &mut self.0.options
3800        }
3801    }
3802
3803    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3804    ///
3805    /// # Example
3806    /// ```no_run
3807    /// # use google_cloud_discoveryengine_v1::builder;
3808    /// use builder::conversational_search_service::UpdateSession;
3809    /// # tokio_test::block_on(async {
3810    ///
3811    /// let builder = prepare_request_builder();
3812    /// let response = builder.send().await?;
3813    /// # gax::Result::<()>::Ok(()) });
3814    ///
3815    /// fn prepare_request_builder() -> UpdateSession {
3816    ///   # panic!();
3817    ///   // ... details omitted ...
3818    /// }
3819    /// ```
3820    #[derive(Clone, Debug)]
3821    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3822
3823    impl UpdateSession {
3824        pub(crate) fn new(
3825            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3826        ) -> Self {
3827            Self(RequestBuilder::new(stub))
3828        }
3829
3830        /// Sets the full request, replacing any prior values.
3831        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3832            self.0.request = v.into();
3833            self
3834        }
3835
3836        /// Sets all the options, replacing any prior values.
3837        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3838            self.0.options = v.into();
3839            self
3840        }
3841
3842        /// Sends the request.
3843        pub async fn send(self) -> Result<crate::model::Session> {
3844            (*self.0.stub)
3845                .update_session(self.0.request, self.0.options)
3846                .await
3847                .map(gax::response::Response::into_body)
3848        }
3849
3850        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3851        ///
3852        /// This is a **required** field for requests.
3853        pub fn set_session<T>(mut self, v: T) -> Self
3854        where
3855            T: std::convert::Into<crate::model::Session>,
3856        {
3857            self.0.request.session = std::option::Option::Some(v.into());
3858            self
3859        }
3860
3861        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3862        ///
3863        /// This is a **required** field for requests.
3864        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3865        where
3866            T: std::convert::Into<crate::model::Session>,
3867        {
3868            self.0.request.session = v.map(|x| x.into());
3869            self
3870        }
3871
3872        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3873        pub fn set_update_mask<T>(mut self, v: T) -> Self
3874        where
3875            T: std::convert::Into<wkt::FieldMask>,
3876        {
3877            self.0.request.update_mask = std::option::Option::Some(v.into());
3878            self
3879        }
3880
3881        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3882        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3883        where
3884            T: std::convert::Into<wkt::FieldMask>,
3885        {
3886            self.0.request.update_mask = v.map(|x| x.into());
3887            self
3888        }
3889    }
3890
3891    #[doc(hidden)]
3892    impl gax::options::internal::RequestBuilder for UpdateSession {
3893        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3894            &mut self.0.options
3895        }
3896    }
3897
3898    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3899    ///
3900    /// # Example
3901    /// ```no_run
3902    /// # use google_cloud_discoveryengine_v1::builder;
3903    /// use builder::conversational_search_service::GetSession;
3904    /// # tokio_test::block_on(async {
3905    ///
3906    /// let builder = prepare_request_builder();
3907    /// let response = builder.send().await?;
3908    /// # gax::Result::<()>::Ok(()) });
3909    ///
3910    /// fn prepare_request_builder() -> GetSession {
3911    ///   # panic!();
3912    ///   // ... details omitted ...
3913    /// }
3914    /// ```
3915    #[derive(Clone, Debug)]
3916    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3917
3918    impl GetSession {
3919        pub(crate) fn new(
3920            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3921        ) -> Self {
3922            Self(RequestBuilder::new(stub))
3923        }
3924
3925        /// Sets the full request, replacing any prior values.
3926        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3927            self.0.request = v.into();
3928            self
3929        }
3930
3931        /// Sets all the options, replacing any prior values.
3932        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3933            self.0.options = v.into();
3934            self
3935        }
3936
3937        /// Sends the request.
3938        pub async fn send(self) -> Result<crate::model::Session> {
3939            (*self.0.stub)
3940                .get_session(self.0.request, self.0.options)
3941                .await
3942                .map(gax::response::Response::into_body)
3943        }
3944
3945        /// Sets the value of [name][crate::model::GetSessionRequest::name].
3946        ///
3947        /// This is a **required** field for requests.
3948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3949            self.0.request.name = v.into();
3950            self
3951        }
3952
3953        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
3954        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3955            self.0.request.include_answer_details = v.into();
3956            self
3957        }
3958    }
3959
3960    #[doc(hidden)]
3961    impl gax::options::internal::RequestBuilder for GetSession {
3962        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3963            &mut self.0.options
3964        }
3965    }
3966
3967    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
3968    ///
3969    /// # Example
3970    /// ```no_run
3971    /// # use google_cloud_discoveryengine_v1::builder;
3972    /// use builder::conversational_search_service::ListSessions;
3973    /// # tokio_test::block_on(async {
3974    /// use gax::paginator::ItemPaginator;
3975    ///
3976    /// let builder = prepare_request_builder();
3977    /// let mut items = builder.by_item();
3978    /// while let Some(result) = items.next().await {
3979    ///   let item = result?;
3980    /// }
3981    /// # gax::Result::<()>::Ok(()) });
3982    ///
3983    /// fn prepare_request_builder() -> ListSessions {
3984    ///   # panic!();
3985    ///   // ... details omitted ...
3986    /// }
3987    /// ```
3988    #[derive(Clone, Debug)]
3989    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3990
3991    impl ListSessions {
3992        pub(crate) fn new(
3993            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3994        ) -> Self {
3995            Self(RequestBuilder::new(stub))
3996        }
3997
3998        /// Sets the full request, replacing any prior values.
3999        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4000            self.0.request = v.into();
4001            self
4002        }
4003
4004        /// Sets all the options, replacing any prior values.
4005        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4006            self.0.options = v.into();
4007            self
4008        }
4009
4010        /// Sends the request.
4011        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4012            (*self.0.stub)
4013                .list_sessions(self.0.request, self.0.options)
4014                .await
4015                .map(gax::response::Response::into_body)
4016        }
4017
4018        /// Streams each page in the collection.
4019        pub fn by_page(
4020            self,
4021        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
4022        {
4023            use std::clone::Clone;
4024            let token = self.0.request.page_token.clone();
4025            let execute = move |token: String| {
4026                let mut builder = self.clone();
4027                builder.0.request = builder.0.request.set_page_token(token);
4028                builder.send()
4029            };
4030            gax::paginator::internal::new_paginator(token, execute)
4031        }
4032
4033        /// Streams each item in the collection.
4034        pub fn by_item(
4035            self,
4036        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
4037        {
4038            use gax::paginator::Paginator;
4039            self.by_page().items()
4040        }
4041
4042        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4043        ///
4044        /// This is a **required** field for requests.
4045        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4046            self.0.request.parent = v.into();
4047            self
4048        }
4049
4050        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4051        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4052            self.0.request.page_size = v.into();
4053            self
4054        }
4055
4056        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4057        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4058            self.0.request.page_token = v.into();
4059            self
4060        }
4061
4062        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4063        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4064            self.0.request.filter = v.into();
4065            self
4066        }
4067
4068        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4069        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4070            self.0.request.order_by = v.into();
4071            self
4072        }
4073    }
4074
4075    #[doc(hidden)]
4076    impl gax::options::internal::RequestBuilder for ListSessions {
4077        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4078            &mut self.0.options
4079        }
4080    }
4081
4082    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4083    ///
4084    /// # Example
4085    /// ```no_run
4086    /// # use google_cloud_discoveryengine_v1::builder;
4087    /// use builder::conversational_search_service::ListOperations;
4088    /// # tokio_test::block_on(async {
4089    /// use gax::paginator::ItemPaginator;
4090    ///
4091    /// let builder = prepare_request_builder();
4092    /// let mut items = builder.by_item();
4093    /// while let Some(result) = items.next().await {
4094    ///   let item = result?;
4095    /// }
4096    /// # gax::Result::<()>::Ok(()) });
4097    ///
4098    /// fn prepare_request_builder() -> ListOperations {
4099    ///   # panic!();
4100    ///   // ... details omitted ...
4101    /// }
4102    /// ```
4103    #[derive(Clone, Debug)]
4104    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4105
4106    impl ListOperations {
4107        pub(crate) fn new(
4108            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4109        ) -> Self {
4110            Self(RequestBuilder::new(stub))
4111        }
4112
4113        /// Sets the full request, replacing any prior values.
4114        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4115            mut self,
4116            v: V,
4117        ) -> Self {
4118            self.0.request = v.into();
4119            self
4120        }
4121
4122        /// Sets all the options, replacing any prior values.
4123        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4124            self.0.options = v.into();
4125            self
4126        }
4127
4128        /// Sends the request.
4129        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4130            (*self.0.stub)
4131                .list_operations(self.0.request, self.0.options)
4132                .await
4133                .map(gax::response::Response::into_body)
4134        }
4135
4136        /// Streams each page in the collection.
4137        pub fn by_page(
4138            self,
4139        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4140        {
4141            use std::clone::Clone;
4142            let token = self.0.request.page_token.clone();
4143            let execute = move |token: String| {
4144                let mut builder = self.clone();
4145                builder.0.request = builder.0.request.set_page_token(token);
4146                builder.send()
4147            };
4148            gax::paginator::internal::new_paginator(token, execute)
4149        }
4150
4151        /// Streams each item in the collection.
4152        pub fn by_item(
4153            self,
4154        ) -> impl gax::paginator::ItemPaginator<
4155            longrunning::model::ListOperationsResponse,
4156            gax::error::Error,
4157        > {
4158            use gax::paginator::Paginator;
4159            self.by_page().items()
4160        }
4161
4162        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4163        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4164            self.0.request.name = v.into();
4165            self
4166        }
4167
4168        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4169        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4170            self.0.request.filter = v.into();
4171            self
4172        }
4173
4174        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4175        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4176            self.0.request.page_size = v.into();
4177            self
4178        }
4179
4180        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4181        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4182            self.0.request.page_token = v.into();
4183            self
4184        }
4185
4186        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4187        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4188            self.0.request.return_partial_success = v.into();
4189            self
4190        }
4191    }
4192
4193    #[doc(hidden)]
4194    impl gax::options::internal::RequestBuilder for ListOperations {
4195        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4196            &mut self.0.options
4197        }
4198    }
4199
4200    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4201    ///
4202    /// # Example
4203    /// ```no_run
4204    /// # use google_cloud_discoveryengine_v1::builder;
4205    /// use builder::conversational_search_service::GetOperation;
4206    /// # tokio_test::block_on(async {
4207    ///
4208    /// let builder = prepare_request_builder();
4209    /// let response = builder.send().await?;
4210    /// # gax::Result::<()>::Ok(()) });
4211    ///
4212    /// fn prepare_request_builder() -> GetOperation {
4213    ///   # panic!();
4214    ///   // ... details omitted ...
4215    /// }
4216    /// ```
4217    #[derive(Clone, Debug)]
4218    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4219
4220    impl GetOperation {
4221        pub(crate) fn new(
4222            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4223        ) -> Self {
4224            Self(RequestBuilder::new(stub))
4225        }
4226
4227        /// Sets the full request, replacing any prior values.
4228        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4229            mut self,
4230            v: V,
4231        ) -> Self {
4232            self.0.request = v.into();
4233            self
4234        }
4235
4236        /// Sets all the options, replacing any prior values.
4237        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4238            self.0.options = v.into();
4239            self
4240        }
4241
4242        /// Sends the request.
4243        pub async fn send(self) -> Result<longrunning::model::Operation> {
4244            (*self.0.stub)
4245                .get_operation(self.0.request, self.0.options)
4246                .await
4247                .map(gax::response::Response::into_body)
4248        }
4249
4250        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4251        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4252            self.0.request.name = v.into();
4253            self
4254        }
4255    }
4256
4257    #[doc(hidden)]
4258    impl gax::options::internal::RequestBuilder for GetOperation {
4259        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4260            &mut self.0.options
4261        }
4262    }
4263
4264    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4265    ///
4266    /// # Example
4267    /// ```no_run
4268    /// # use google_cloud_discoveryengine_v1::builder;
4269    /// use builder::conversational_search_service::CancelOperation;
4270    /// # tokio_test::block_on(async {
4271    ///
4272    /// let builder = prepare_request_builder();
4273    /// let response = builder.send().await?;
4274    /// # gax::Result::<()>::Ok(()) });
4275    ///
4276    /// fn prepare_request_builder() -> CancelOperation {
4277    ///   # panic!();
4278    ///   // ... details omitted ...
4279    /// }
4280    /// ```
4281    #[derive(Clone, Debug)]
4282    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4283
4284    impl CancelOperation {
4285        pub(crate) fn new(
4286            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4287        ) -> Self {
4288            Self(RequestBuilder::new(stub))
4289        }
4290
4291        /// Sets the full request, replacing any prior values.
4292        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4293            mut self,
4294            v: V,
4295        ) -> Self {
4296            self.0.request = v.into();
4297            self
4298        }
4299
4300        /// Sets all the options, replacing any prior values.
4301        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4302            self.0.options = v.into();
4303            self
4304        }
4305
4306        /// Sends the request.
4307        pub async fn send(self) -> Result<()> {
4308            (*self.0.stub)
4309                .cancel_operation(self.0.request, self.0.options)
4310                .await
4311                .map(gax::response::Response::into_body)
4312        }
4313
4314        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4315        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4316            self.0.request.name = v.into();
4317            self
4318        }
4319    }
4320
4321    #[doc(hidden)]
4322    impl gax::options::internal::RequestBuilder for CancelOperation {
4323        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4324            &mut self.0.options
4325        }
4326    }
4327}
4328
4329#[cfg(feature = "data-store-service")]
4330#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4331pub mod data_store_service {
4332    use crate::Result;
4333
4334    /// A builder for [DataStoreService][crate::client::DataStoreService].
4335    ///
4336    /// ```
4337    /// # tokio_test::block_on(async {
4338    /// # use google_cloud_discoveryengine_v1::*;
4339    /// # use builder::data_store_service::ClientBuilder;
4340    /// # use client::DataStoreService;
4341    /// let builder : ClientBuilder = DataStoreService::builder();
4342    /// let client = builder
4343    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4344    ///     .build().await?;
4345    /// # gax::client_builder::Result::<()>::Ok(()) });
4346    /// ```
4347    pub type ClientBuilder =
4348        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4349
4350    pub(crate) mod client {
4351        use super::super::super::client::DataStoreService;
4352        pub struct Factory;
4353        impl gax::client_builder::internal::ClientFactory for Factory {
4354            type Client = DataStoreService;
4355            type Credentials = gaxi::options::Credentials;
4356            async fn build(
4357                self,
4358                config: gaxi::options::ClientConfig,
4359            ) -> gax::client_builder::Result<Self::Client> {
4360                Self::Client::new(config).await
4361            }
4362        }
4363    }
4364
4365    /// Common implementation for [crate::client::DataStoreService] request builders.
4366    #[derive(Clone, Debug)]
4367    pub(crate) struct RequestBuilder<R: std::default::Default> {
4368        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4369        request: R,
4370        options: gax::options::RequestOptions,
4371    }
4372
4373    impl<R> RequestBuilder<R>
4374    where
4375        R: std::default::Default,
4376    {
4377        pub(crate) fn new(
4378            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4379        ) -> Self {
4380            Self {
4381                stub,
4382                request: R::default(),
4383                options: gax::options::RequestOptions::default(),
4384            }
4385        }
4386    }
4387
4388    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4389    ///
4390    /// # Example
4391    /// ```no_run
4392    /// # use google_cloud_discoveryengine_v1::builder;
4393    /// use builder::data_store_service::CreateDataStore;
4394    /// # tokio_test::block_on(async {
4395    /// use lro::Poller;
4396    ///
4397    /// let builder = prepare_request_builder();
4398    /// let response = builder.poller().until_done().await?;
4399    /// # gax::Result::<()>::Ok(()) });
4400    ///
4401    /// fn prepare_request_builder() -> CreateDataStore {
4402    ///   # panic!();
4403    ///   // ... details omitted ...
4404    /// }
4405    /// ```
4406    #[derive(Clone, Debug)]
4407    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4408
4409    impl CreateDataStore {
4410        pub(crate) fn new(
4411            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4412        ) -> Self {
4413            Self(RequestBuilder::new(stub))
4414        }
4415
4416        /// Sets the full request, replacing any prior values.
4417        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4418            self.0.request = v.into();
4419            self
4420        }
4421
4422        /// Sets all the options, replacing any prior values.
4423        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4424            self.0.options = v.into();
4425            self
4426        }
4427
4428        /// Sends the request.
4429        ///
4430        /// # Long running operations
4431        ///
4432        /// This starts, but does not poll, a longrunning operation. More information
4433        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4434        pub async fn send(self) -> Result<longrunning::model::Operation> {
4435            (*self.0.stub)
4436                .create_data_store(self.0.request, self.0.options)
4437                .await
4438                .map(gax::response::Response::into_body)
4439        }
4440
4441        /// Creates a [Poller][lro::Poller] to work with `create_data_store`.
4442        pub fn poller(
4443            self,
4444        ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4445        {
4446            type Operation = lro::internal::Operation<
4447                crate::model::DataStore,
4448                crate::model::CreateDataStoreMetadata,
4449            >;
4450            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4451            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4452
4453            let stub = self.0.stub.clone();
4454            let mut options = self.0.options.clone();
4455            options.set_retry_policy(gax::retry_policy::NeverRetry);
4456            let query = move |name| {
4457                let stub = stub.clone();
4458                let options = options.clone();
4459                async {
4460                    let op = GetOperation::new(stub)
4461                        .set_name(name)
4462                        .with_options(options)
4463                        .send()
4464                        .await?;
4465                    Ok(Operation::new(op))
4466                }
4467            };
4468
4469            let start = move || async {
4470                let op = self.send().await?;
4471                Ok(Operation::new(op))
4472            };
4473
4474            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4475        }
4476
4477        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4478        ///
4479        /// This is a **required** field for requests.
4480        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4481            self.0.request.parent = v.into();
4482            self
4483        }
4484
4485        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4486        ///
4487        /// This is a **required** field for requests.
4488        pub fn set_data_store<T>(mut self, v: T) -> Self
4489        where
4490            T: std::convert::Into<crate::model::DataStore>,
4491        {
4492            self.0.request.data_store = std::option::Option::Some(v.into());
4493            self
4494        }
4495
4496        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4497        ///
4498        /// This is a **required** field for requests.
4499        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4500        where
4501            T: std::convert::Into<crate::model::DataStore>,
4502        {
4503            self.0.request.data_store = v.map(|x| x.into());
4504            self
4505        }
4506
4507        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4508        ///
4509        /// This is a **required** field for requests.
4510        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4511            self.0.request.data_store_id = v.into();
4512            self
4513        }
4514
4515        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4516        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4517            self.0.request.create_advanced_site_search = v.into();
4518            self
4519        }
4520
4521        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4522        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4523            self.0.request.skip_default_schema_creation = v.into();
4524            self
4525        }
4526
4527        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4528        ///
4529        /// Note that all the setters affecting `cmek_options` are
4530        /// mutually exclusive.
4531        pub fn set_cmek_options<
4532            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4533        >(
4534            mut self,
4535            v: T,
4536        ) -> Self {
4537            self.0.request.cmek_options = v.into();
4538            self
4539        }
4540
4541        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4542        /// to hold a `CmekConfigName`.
4543        ///
4544        /// Note that all the setters affecting `cmek_options` are
4545        /// mutually exclusive.
4546        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4547            mut self,
4548            v: T,
4549        ) -> Self {
4550            self.0.request = self.0.request.set_cmek_config_name(v);
4551            self
4552        }
4553
4554        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4555        /// to hold a `DisableCmek`.
4556        ///
4557        /// Note that all the setters affecting `cmek_options` are
4558        /// mutually exclusive.
4559        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4560            self.0.request = self.0.request.set_disable_cmek(v);
4561            self
4562        }
4563    }
4564
4565    #[doc(hidden)]
4566    impl gax::options::internal::RequestBuilder for CreateDataStore {
4567        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4568            &mut self.0.options
4569        }
4570    }
4571
4572    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4573    ///
4574    /// # Example
4575    /// ```no_run
4576    /// # use google_cloud_discoveryengine_v1::builder;
4577    /// use builder::data_store_service::GetDataStore;
4578    /// # tokio_test::block_on(async {
4579    ///
4580    /// let builder = prepare_request_builder();
4581    /// let response = builder.send().await?;
4582    /// # gax::Result::<()>::Ok(()) });
4583    ///
4584    /// fn prepare_request_builder() -> GetDataStore {
4585    ///   # panic!();
4586    ///   // ... details omitted ...
4587    /// }
4588    /// ```
4589    #[derive(Clone, Debug)]
4590    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4591
4592    impl GetDataStore {
4593        pub(crate) fn new(
4594            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4595        ) -> Self {
4596            Self(RequestBuilder::new(stub))
4597        }
4598
4599        /// Sets the full request, replacing any prior values.
4600        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4601            self.0.request = v.into();
4602            self
4603        }
4604
4605        /// Sets all the options, replacing any prior values.
4606        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4607            self.0.options = v.into();
4608            self
4609        }
4610
4611        /// Sends the request.
4612        pub async fn send(self) -> Result<crate::model::DataStore> {
4613            (*self.0.stub)
4614                .get_data_store(self.0.request, self.0.options)
4615                .await
4616                .map(gax::response::Response::into_body)
4617        }
4618
4619        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4620        ///
4621        /// This is a **required** field for requests.
4622        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4623            self.0.request.name = v.into();
4624            self
4625        }
4626    }
4627
4628    #[doc(hidden)]
4629    impl gax::options::internal::RequestBuilder for GetDataStore {
4630        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4631            &mut self.0.options
4632        }
4633    }
4634
4635    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4636    ///
4637    /// # Example
4638    /// ```no_run
4639    /// # use google_cloud_discoveryengine_v1::builder;
4640    /// use builder::data_store_service::ListDataStores;
4641    /// # tokio_test::block_on(async {
4642    /// use gax::paginator::ItemPaginator;
4643    ///
4644    /// let builder = prepare_request_builder();
4645    /// let mut items = builder.by_item();
4646    /// while let Some(result) = items.next().await {
4647    ///   let item = result?;
4648    /// }
4649    /// # gax::Result::<()>::Ok(()) });
4650    ///
4651    /// fn prepare_request_builder() -> ListDataStores {
4652    ///   # panic!();
4653    ///   // ... details omitted ...
4654    /// }
4655    /// ```
4656    #[derive(Clone, Debug)]
4657    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4658
4659    impl ListDataStores {
4660        pub(crate) fn new(
4661            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4662        ) -> Self {
4663            Self(RequestBuilder::new(stub))
4664        }
4665
4666        /// Sets the full request, replacing any prior values.
4667        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4668            self.0.request = v.into();
4669            self
4670        }
4671
4672        /// Sets all the options, replacing any prior values.
4673        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4674            self.0.options = v.into();
4675            self
4676        }
4677
4678        /// Sends the request.
4679        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4680            (*self.0.stub)
4681                .list_data_stores(self.0.request, self.0.options)
4682                .await
4683                .map(gax::response::Response::into_body)
4684        }
4685
4686        /// Streams each page in the collection.
4687        pub fn by_page(
4688            self,
4689        ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4690        {
4691            use std::clone::Clone;
4692            let token = self.0.request.page_token.clone();
4693            let execute = move |token: String| {
4694                let mut builder = self.clone();
4695                builder.0.request = builder.0.request.set_page_token(token);
4696                builder.send()
4697            };
4698            gax::paginator::internal::new_paginator(token, execute)
4699        }
4700
4701        /// Streams each item in the collection.
4702        pub fn by_item(
4703            self,
4704        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4705        {
4706            use gax::paginator::Paginator;
4707            self.by_page().items()
4708        }
4709
4710        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4711        ///
4712        /// This is a **required** field for requests.
4713        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4714            self.0.request.parent = v.into();
4715            self
4716        }
4717
4718        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4719        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4720            self.0.request.page_size = v.into();
4721            self
4722        }
4723
4724        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4725        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4726            self.0.request.page_token = v.into();
4727            self
4728        }
4729
4730        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4731        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4732            self.0.request.filter = v.into();
4733            self
4734        }
4735    }
4736
4737    #[doc(hidden)]
4738    impl gax::options::internal::RequestBuilder for ListDataStores {
4739        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4740            &mut self.0.options
4741        }
4742    }
4743
4744    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4745    ///
4746    /// # Example
4747    /// ```no_run
4748    /// # use google_cloud_discoveryengine_v1::builder;
4749    /// use builder::data_store_service::DeleteDataStore;
4750    /// # tokio_test::block_on(async {
4751    /// use lro::Poller;
4752    ///
4753    /// let builder = prepare_request_builder();
4754    /// let response = builder.poller().until_done().await?;
4755    /// # gax::Result::<()>::Ok(()) });
4756    ///
4757    /// fn prepare_request_builder() -> DeleteDataStore {
4758    ///   # panic!();
4759    ///   // ... details omitted ...
4760    /// }
4761    /// ```
4762    #[derive(Clone, Debug)]
4763    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4764
4765    impl DeleteDataStore {
4766        pub(crate) fn new(
4767            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4768        ) -> Self {
4769            Self(RequestBuilder::new(stub))
4770        }
4771
4772        /// Sets the full request, replacing any prior values.
4773        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4774            self.0.request = v.into();
4775            self
4776        }
4777
4778        /// Sets all the options, replacing any prior values.
4779        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4780            self.0.options = v.into();
4781            self
4782        }
4783
4784        /// Sends the request.
4785        ///
4786        /// # Long running operations
4787        ///
4788        /// This starts, but does not poll, a longrunning operation. More information
4789        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4790        pub async fn send(self) -> Result<longrunning::model::Operation> {
4791            (*self.0.stub)
4792                .delete_data_store(self.0.request, self.0.options)
4793                .await
4794                .map(gax::response::Response::into_body)
4795        }
4796
4797        /// Creates a [Poller][lro::Poller] to work with `delete_data_store`.
4798        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4799            type Operation =
4800                lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4801            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4802            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4803
4804            let stub = self.0.stub.clone();
4805            let mut options = self.0.options.clone();
4806            options.set_retry_policy(gax::retry_policy::NeverRetry);
4807            let query = move |name| {
4808                let stub = stub.clone();
4809                let options = options.clone();
4810                async {
4811                    let op = GetOperation::new(stub)
4812                        .set_name(name)
4813                        .with_options(options)
4814                        .send()
4815                        .await?;
4816                    Ok(Operation::new(op))
4817                }
4818            };
4819
4820            let start = move || async {
4821                let op = self.send().await?;
4822                Ok(Operation::new(op))
4823            };
4824
4825            lro::internal::new_unit_response_poller(
4826                polling_error_policy,
4827                polling_backoff_policy,
4828                start,
4829                query,
4830            )
4831        }
4832
4833        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4834        ///
4835        /// This is a **required** field for requests.
4836        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4837            self.0.request.name = v.into();
4838            self
4839        }
4840    }
4841
4842    #[doc(hidden)]
4843    impl gax::options::internal::RequestBuilder for DeleteDataStore {
4844        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4845            &mut self.0.options
4846        }
4847    }
4848
4849    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4850    ///
4851    /// # Example
4852    /// ```no_run
4853    /// # use google_cloud_discoveryengine_v1::builder;
4854    /// use builder::data_store_service::UpdateDataStore;
4855    /// # tokio_test::block_on(async {
4856    ///
4857    /// let builder = prepare_request_builder();
4858    /// let response = builder.send().await?;
4859    /// # gax::Result::<()>::Ok(()) });
4860    ///
4861    /// fn prepare_request_builder() -> UpdateDataStore {
4862    ///   # panic!();
4863    ///   // ... details omitted ...
4864    /// }
4865    /// ```
4866    #[derive(Clone, Debug)]
4867    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4868
4869    impl UpdateDataStore {
4870        pub(crate) fn new(
4871            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4872        ) -> Self {
4873            Self(RequestBuilder::new(stub))
4874        }
4875
4876        /// Sets the full request, replacing any prior values.
4877        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4878            self.0.request = v.into();
4879            self
4880        }
4881
4882        /// Sets all the options, replacing any prior values.
4883        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4884            self.0.options = v.into();
4885            self
4886        }
4887
4888        /// Sends the request.
4889        pub async fn send(self) -> Result<crate::model::DataStore> {
4890            (*self.0.stub)
4891                .update_data_store(self.0.request, self.0.options)
4892                .await
4893                .map(gax::response::Response::into_body)
4894        }
4895
4896        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4897        ///
4898        /// This is a **required** field for requests.
4899        pub fn set_data_store<T>(mut self, v: T) -> Self
4900        where
4901            T: std::convert::Into<crate::model::DataStore>,
4902        {
4903            self.0.request.data_store = std::option::Option::Some(v.into());
4904            self
4905        }
4906
4907        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4908        ///
4909        /// This is a **required** field for requests.
4910        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4911        where
4912            T: std::convert::Into<crate::model::DataStore>,
4913        {
4914            self.0.request.data_store = v.map(|x| x.into());
4915            self
4916        }
4917
4918        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4919        pub fn set_update_mask<T>(mut self, v: T) -> Self
4920        where
4921            T: std::convert::Into<wkt::FieldMask>,
4922        {
4923            self.0.request.update_mask = std::option::Option::Some(v.into());
4924            self
4925        }
4926
4927        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4928        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4929        where
4930            T: std::convert::Into<wkt::FieldMask>,
4931        {
4932            self.0.request.update_mask = v.map(|x| x.into());
4933            self
4934        }
4935    }
4936
4937    #[doc(hidden)]
4938    impl gax::options::internal::RequestBuilder for UpdateDataStore {
4939        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4940            &mut self.0.options
4941        }
4942    }
4943
4944    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
4945    ///
4946    /// # Example
4947    /// ```no_run
4948    /// # use google_cloud_discoveryengine_v1::builder;
4949    /// use builder::data_store_service::ListOperations;
4950    /// # tokio_test::block_on(async {
4951    /// use gax::paginator::ItemPaginator;
4952    ///
4953    /// let builder = prepare_request_builder();
4954    /// let mut items = builder.by_item();
4955    /// while let Some(result) = items.next().await {
4956    ///   let item = result?;
4957    /// }
4958    /// # gax::Result::<()>::Ok(()) });
4959    ///
4960    /// fn prepare_request_builder() -> ListOperations {
4961    ///   # panic!();
4962    ///   // ... details omitted ...
4963    /// }
4964    /// ```
4965    #[derive(Clone, Debug)]
4966    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4967
4968    impl ListOperations {
4969        pub(crate) fn new(
4970            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4971        ) -> Self {
4972            Self(RequestBuilder::new(stub))
4973        }
4974
4975        /// Sets the full request, replacing any prior values.
4976        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4977            mut self,
4978            v: V,
4979        ) -> Self {
4980            self.0.request = v.into();
4981            self
4982        }
4983
4984        /// Sets all the options, replacing any prior values.
4985        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4986            self.0.options = v.into();
4987            self
4988        }
4989
4990        /// Sends the request.
4991        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4992            (*self.0.stub)
4993                .list_operations(self.0.request, self.0.options)
4994                .await
4995                .map(gax::response::Response::into_body)
4996        }
4997
4998        /// Streams each page in the collection.
4999        pub fn by_page(
5000            self,
5001        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5002        {
5003            use std::clone::Clone;
5004            let token = self.0.request.page_token.clone();
5005            let execute = move |token: String| {
5006                let mut builder = self.clone();
5007                builder.0.request = builder.0.request.set_page_token(token);
5008                builder.send()
5009            };
5010            gax::paginator::internal::new_paginator(token, execute)
5011        }
5012
5013        /// Streams each item in the collection.
5014        pub fn by_item(
5015            self,
5016        ) -> impl gax::paginator::ItemPaginator<
5017            longrunning::model::ListOperationsResponse,
5018            gax::error::Error,
5019        > {
5020            use gax::paginator::Paginator;
5021            self.by_page().items()
5022        }
5023
5024        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
5025        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5026            self.0.request.name = v.into();
5027            self
5028        }
5029
5030        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
5031        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5032            self.0.request.filter = v.into();
5033            self
5034        }
5035
5036        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
5037        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5038            self.0.request.page_size = v.into();
5039            self
5040        }
5041
5042        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
5043        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5044            self.0.request.page_token = v.into();
5045            self
5046        }
5047
5048        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
5049        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5050            self.0.request.return_partial_success = v.into();
5051            self
5052        }
5053    }
5054
5055    #[doc(hidden)]
5056    impl gax::options::internal::RequestBuilder for ListOperations {
5057        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5058            &mut self.0.options
5059        }
5060    }
5061
5062    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5063    ///
5064    /// # Example
5065    /// ```no_run
5066    /// # use google_cloud_discoveryengine_v1::builder;
5067    /// use builder::data_store_service::GetOperation;
5068    /// # tokio_test::block_on(async {
5069    ///
5070    /// let builder = prepare_request_builder();
5071    /// let response = builder.send().await?;
5072    /// # gax::Result::<()>::Ok(()) });
5073    ///
5074    /// fn prepare_request_builder() -> GetOperation {
5075    ///   # panic!();
5076    ///   // ... details omitted ...
5077    /// }
5078    /// ```
5079    #[derive(Clone, Debug)]
5080    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5081
5082    impl GetOperation {
5083        pub(crate) fn new(
5084            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5085        ) -> Self {
5086            Self(RequestBuilder::new(stub))
5087        }
5088
5089        /// Sets the full request, replacing any prior values.
5090        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5091            mut self,
5092            v: V,
5093        ) -> Self {
5094            self.0.request = v.into();
5095            self
5096        }
5097
5098        /// Sets all the options, replacing any prior values.
5099        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5100            self.0.options = v.into();
5101            self
5102        }
5103
5104        /// Sends the request.
5105        pub async fn send(self) -> Result<longrunning::model::Operation> {
5106            (*self.0.stub)
5107                .get_operation(self.0.request, self.0.options)
5108                .await
5109                .map(gax::response::Response::into_body)
5110        }
5111
5112        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5113        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5114            self.0.request.name = v.into();
5115            self
5116        }
5117    }
5118
5119    #[doc(hidden)]
5120    impl gax::options::internal::RequestBuilder for GetOperation {
5121        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5122            &mut self.0.options
5123        }
5124    }
5125
5126    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5127    ///
5128    /// # Example
5129    /// ```no_run
5130    /// # use google_cloud_discoveryengine_v1::builder;
5131    /// use builder::data_store_service::CancelOperation;
5132    /// # tokio_test::block_on(async {
5133    ///
5134    /// let builder = prepare_request_builder();
5135    /// let response = builder.send().await?;
5136    /// # gax::Result::<()>::Ok(()) });
5137    ///
5138    /// fn prepare_request_builder() -> CancelOperation {
5139    ///   # panic!();
5140    ///   // ... details omitted ...
5141    /// }
5142    /// ```
5143    #[derive(Clone, Debug)]
5144    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5145
5146    impl CancelOperation {
5147        pub(crate) fn new(
5148            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5149        ) -> Self {
5150            Self(RequestBuilder::new(stub))
5151        }
5152
5153        /// Sets the full request, replacing any prior values.
5154        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5155            mut self,
5156            v: V,
5157        ) -> Self {
5158            self.0.request = v.into();
5159            self
5160        }
5161
5162        /// Sets all the options, replacing any prior values.
5163        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5164            self.0.options = v.into();
5165            self
5166        }
5167
5168        /// Sends the request.
5169        pub async fn send(self) -> Result<()> {
5170            (*self.0.stub)
5171                .cancel_operation(self.0.request, self.0.options)
5172                .await
5173                .map(gax::response::Response::into_body)
5174        }
5175
5176        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
5177        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5178            self.0.request.name = v.into();
5179            self
5180        }
5181    }
5182
5183    #[doc(hidden)]
5184    impl gax::options::internal::RequestBuilder for CancelOperation {
5185        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5186            &mut self.0.options
5187        }
5188    }
5189}
5190
5191#[cfg(feature = "document-service")]
5192#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5193pub mod document_service {
5194    use crate::Result;
5195
5196    /// A builder for [DocumentService][crate::client::DocumentService].
5197    ///
5198    /// ```
5199    /// # tokio_test::block_on(async {
5200    /// # use google_cloud_discoveryengine_v1::*;
5201    /// # use builder::document_service::ClientBuilder;
5202    /// # use client::DocumentService;
5203    /// let builder : ClientBuilder = DocumentService::builder();
5204    /// let client = builder
5205    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5206    ///     .build().await?;
5207    /// # gax::client_builder::Result::<()>::Ok(()) });
5208    /// ```
5209    pub type ClientBuilder =
5210        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5211
5212    pub(crate) mod client {
5213        use super::super::super::client::DocumentService;
5214        pub struct Factory;
5215        impl gax::client_builder::internal::ClientFactory for Factory {
5216            type Client = DocumentService;
5217            type Credentials = gaxi::options::Credentials;
5218            async fn build(
5219                self,
5220                config: gaxi::options::ClientConfig,
5221            ) -> gax::client_builder::Result<Self::Client> {
5222                Self::Client::new(config).await
5223            }
5224        }
5225    }
5226
5227    /// Common implementation for [crate::client::DocumentService] request builders.
5228    #[derive(Clone, Debug)]
5229    pub(crate) struct RequestBuilder<R: std::default::Default> {
5230        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5231        request: R,
5232        options: gax::options::RequestOptions,
5233    }
5234
5235    impl<R> RequestBuilder<R>
5236    where
5237        R: std::default::Default,
5238    {
5239        pub(crate) fn new(
5240            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5241        ) -> Self {
5242            Self {
5243                stub,
5244                request: R::default(),
5245                options: gax::options::RequestOptions::default(),
5246            }
5247        }
5248    }
5249
5250    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5251    ///
5252    /// # Example
5253    /// ```no_run
5254    /// # use google_cloud_discoveryengine_v1::builder;
5255    /// use builder::document_service::GetDocument;
5256    /// # tokio_test::block_on(async {
5257    ///
5258    /// let builder = prepare_request_builder();
5259    /// let response = builder.send().await?;
5260    /// # gax::Result::<()>::Ok(()) });
5261    ///
5262    /// fn prepare_request_builder() -> GetDocument {
5263    ///   # panic!();
5264    ///   // ... details omitted ...
5265    /// }
5266    /// ```
5267    #[derive(Clone, Debug)]
5268    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5269
5270    impl GetDocument {
5271        pub(crate) fn new(
5272            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5273        ) -> Self {
5274            Self(RequestBuilder::new(stub))
5275        }
5276
5277        /// Sets the full request, replacing any prior values.
5278        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5279            self.0.request = v.into();
5280            self
5281        }
5282
5283        /// Sets all the options, replacing any prior values.
5284        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5285            self.0.options = v.into();
5286            self
5287        }
5288
5289        /// Sends the request.
5290        pub async fn send(self) -> Result<crate::model::Document> {
5291            (*self.0.stub)
5292                .get_document(self.0.request, self.0.options)
5293                .await
5294                .map(gax::response::Response::into_body)
5295        }
5296
5297        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5298        ///
5299        /// This is a **required** field for requests.
5300        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5301            self.0.request.name = v.into();
5302            self
5303        }
5304    }
5305
5306    #[doc(hidden)]
5307    impl gax::options::internal::RequestBuilder for GetDocument {
5308        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5309            &mut self.0.options
5310        }
5311    }
5312
5313    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5314    ///
5315    /// # Example
5316    /// ```no_run
5317    /// # use google_cloud_discoveryengine_v1::builder;
5318    /// use builder::document_service::ListDocuments;
5319    /// # tokio_test::block_on(async {
5320    /// use gax::paginator::ItemPaginator;
5321    ///
5322    /// let builder = prepare_request_builder();
5323    /// let mut items = builder.by_item();
5324    /// while let Some(result) = items.next().await {
5325    ///   let item = result?;
5326    /// }
5327    /// # gax::Result::<()>::Ok(()) });
5328    ///
5329    /// fn prepare_request_builder() -> ListDocuments {
5330    ///   # panic!();
5331    ///   // ... details omitted ...
5332    /// }
5333    /// ```
5334    #[derive(Clone, Debug)]
5335    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5336
5337    impl ListDocuments {
5338        pub(crate) fn new(
5339            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5340        ) -> Self {
5341            Self(RequestBuilder::new(stub))
5342        }
5343
5344        /// Sets the full request, replacing any prior values.
5345        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5346            self.0.request = v.into();
5347            self
5348        }
5349
5350        /// Sets all the options, replacing any prior values.
5351        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5352            self.0.options = v.into();
5353            self
5354        }
5355
5356        /// Sends the request.
5357        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5358            (*self.0.stub)
5359                .list_documents(self.0.request, self.0.options)
5360                .await
5361                .map(gax::response::Response::into_body)
5362        }
5363
5364        /// Streams each page in the collection.
5365        pub fn by_page(
5366            self,
5367        ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5368        {
5369            use std::clone::Clone;
5370            let token = self.0.request.page_token.clone();
5371            let execute = move |token: String| {
5372                let mut builder = self.clone();
5373                builder.0.request = builder.0.request.set_page_token(token);
5374                builder.send()
5375            };
5376            gax::paginator::internal::new_paginator(token, execute)
5377        }
5378
5379        /// Streams each item in the collection.
5380        pub fn by_item(
5381            self,
5382        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5383        {
5384            use gax::paginator::Paginator;
5385            self.by_page().items()
5386        }
5387
5388        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5389        ///
5390        /// This is a **required** field for requests.
5391        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5392            self.0.request.parent = v.into();
5393            self
5394        }
5395
5396        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5397        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5398            self.0.request.page_size = v.into();
5399            self
5400        }
5401
5402        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5403        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5404            self.0.request.page_token = v.into();
5405            self
5406        }
5407    }
5408
5409    #[doc(hidden)]
5410    impl gax::options::internal::RequestBuilder for ListDocuments {
5411        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5412            &mut self.0.options
5413        }
5414    }
5415
5416    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5417    ///
5418    /// # Example
5419    /// ```no_run
5420    /// # use google_cloud_discoveryengine_v1::builder;
5421    /// use builder::document_service::CreateDocument;
5422    /// # tokio_test::block_on(async {
5423    ///
5424    /// let builder = prepare_request_builder();
5425    /// let response = builder.send().await?;
5426    /// # gax::Result::<()>::Ok(()) });
5427    ///
5428    /// fn prepare_request_builder() -> CreateDocument {
5429    ///   # panic!();
5430    ///   // ... details omitted ...
5431    /// }
5432    /// ```
5433    #[derive(Clone, Debug)]
5434    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5435
5436    impl CreateDocument {
5437        pub(crate) fn new(
5438            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5439        ) -> Self {
5440            Self(RequestBuilder::new(stub))
5441        }
5442
5443        /// Sets the full request, replacing any prior values.
5444        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5445            self.0.request = v.into();
5446            self
5447        }
5448
5449        /// Sets all the options, replacing any prior values.
5450        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5451            self.0.options = v.into();
5452            self
5453        }
5454
5455        /// Sends the request.
5456        pub async fn send(self) -> Result<crate::model::Document> {
5457            (*self.0.stub)
5458                .create_document(self.0.request, self.0.options)
5459                .await
5460                .map(gax::response::Response::into_body)
5461        }
5462
5463        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5464        ///
5465        /// This is a **required** field for requests.
5466        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5467            self.0.request.parent = v.into();
5468            self
5469        }
5470
5471        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5472        ///
5473        /// This is a **required** field for requests.
5474        pub fn set_document<T>(mut self, v: T) -> Self
5475        where
5476            T: std::convert::Into<crate::model::Document>,
5477        {
5478            self.0.request.document = std::option::Option::Some(v.into());
5479            self
5480        }
5481
5482        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5483        ///
5484        /// This is a **required** field for requests.
5485        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5486        where
5487            T: std::convert::Into<crate::model::Document>,
5488        {
5489            self.0.request.document = v.map(|x| x.into());
5490            self
5491        }
5492
5493        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5494        ///
5495        /// This is a **required** field for requests.
5496        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5497            self.0.request.document_id = v.into();
5498            self
5499        }
5500    }
5501
5502    #[doc(hidden)]
5503    impl gax::options::internal::RequestBuilder for CreateDocument {
5504        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5505            &mut self.0.options
5506        }
5507    }
5508
5509    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5510    ///
5511    /// # Example
5512    /// ```no_run
5513    /// # use google_cloud_discoveryengine_v1::builder;
5514    /// use builder::document_service::UpdateDocument;
5515    /// # tokio_test::block_on(async {
5516    ///
5517    /// let builder = prepare_request_builder();
5518    /// let response = builder.send().await?;
5519    /// # gax::Result::<()>::Ok(()) });
5520    ///
5521    /// fn prepare_request_builder() -> UpdateDocument {
5522    ///   # panic!();
5523    ///   // ... details omitted ...
5524    /// }
5525    /// ```
5526    #[derive(Clone, Debug)]
5527    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5528
5529    impl UpdateDocument {
5530        pub(crate) fn new(
5531            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5532        ) -> Self {
5533            Self(RequestBuilder::new(stub))
5534        }
5535
5536        /// Sets the full request, replacing any prior values.
5537        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5538            self.0.request = v.into();
5539            self
5540        }
5541
5542        /// Sets all the options, replacing any prior values.
5543        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5544            self.0.options = v.into();
5545            self
5546        }
5547
5548        /// Sends the request.
5549        pub async fn send(self) -> Result<crate::model::Document> {
5550            (*self.0.stub)
5551                .update_document(self.0.request, self.0.options)
5552                .await
5553                .map(gax::response::Response::into_body)
5554        }
5555
5556        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5557        ///
5558        /// This is a **required** field for requests.
5559        pub fn set_document<T>(mut self, v: T) -> Self
5560        where
5561            T: std::convert::Into<crate::model::Document>,
5562        {
5563            self.0.request.document = std::option::Option::Some(v.into());
5564            self
5565        }
5566
5567        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5568        ///
5569        /// This is a **required** field for requests.
5570        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5571        where
5572            T: std::convert::Into<crate::model::Document>,
5573        {
5574            self.0.request.document = v.map(|x| x.into());
5575            self
5576        }
5577
5578        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5579        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5580            self.0.request.allow_missing = v.into();
5581            self
5582        }
5583
5584        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5585        pub fn set_update_mask<T>(mut self, v: T) -> Self
5586        where
5587            T: std::convert::Into<wkt::FieldMask>,
5588        {
5589            self.0.request.update_mask = std::option::Option::Some(v.into());
5590            self
5591        }
5592
5593        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5594        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5595        where
5596            T: std::convert::Into<wkt::FieldMask>,
5597        {
5598            self.0.request.update_mask = v.map(|x| x.into());
5599            self
5600        }
5601    }
5602
5603    #[doc(hidden)]
5604    impl gax::options::internal::RequestBuilder for UpdateDocument {
5605        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5606            &mut self.0.options
5607        }
5608    }
5609
5610    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5611    ///
5612    /// # Example
5613    /// ```no_run
5614    /// # use google_cloud_discoveryengine_v1::builder;
5615    /// use builder::document_service::DeleteDocument;
5616    /// # tokio_test::block_on(async {
5617    ///
5618    /// let builder = prepare_request_builder();
5619    /// let response = builder.send().await?;
5620    /// # gax::Result::<()>::Ok(()) });
5621    ///
5622    /// fn prepare_request_builder() -> DeleteDocument {
5623    ///   # panic!();
5624    ///   // ... details omitted ...
5625    /// }
5626    /// ```
5627    #[derive(Clone, Debug)]
5628    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5629
5630    impl DeleteDocument {
5631        pub(crate) fn new(
5632            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5633        ) -> Self {
5634            Self(RequestBuilder::new(stub))
5635        }
5636
5637        /// Sets the full request, replacing any prior values.
5638        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5639            self.0.request = v.into();
5640            self
5641        }
5642
5643        /// Sets all the options, replacing any prior values.
5644        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5645            self.0.options = v.into();
5646            self
5647        }
5648
5649        /// Sends the request.
5650        pub async fn send(self) -> Result<()> {
5651            (*self.0.stub)
5652                .delete_document(self.0.request, self.0.options)
5653                .await
5654                .map(gax::response::Response::into_body)
5655        }
5656
5657        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5658        ///
5659        /// This is a **required** field for requests.
5660        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5661            self.0.request.name = v.into();
5662            self
5663        }
5664    }
5665
5666    #[doc(hidden)]
5667    impl gax::options::internal::RequestBuilder for DeleteDocument {
5668        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5669            &mut self.0.options
5670        }
5671    }
5672
5673    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5674    ///
5675    /// # Example
5676    /// ```no_run
5677    /// # use google_cloud_discoveryengine_v1::builder;
5678    /// use builder::document_service::ImportDocuments;
5679    /// # tokio_test::block_on(async {
5680    /// use lro::Poller;
5681    ///
5682    /// let builder = prepare_request_builder();
5683    /// let response = builder.poller().until_done().await?;
5684    /// # gax::Result::<()>::Ok(()) });
5685    ///
5686    /// fn prepare_request_builder() -> ImportDocuments {
5687    ///   # panic!();
5688    ///   // ... details omitted ...
5689    /// }
5690    /// ```
5691    #[derive(Clone, Debug)]
5692    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5693
5694    impl ImportDocuments {
5695        pub(crate) fn new(
5696            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5697        ) -> Self {
5698            Self(RequestBuilder::new(stub))
5699        }
5700
5701        /// Sets the full request, replacing any prior values.
5702        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5703            self.0.request = v.into();
5704            self
5705        }
5706
5707        /// Sets all the options, replacing any prior values.
5708        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5709            self.0.options = v.into();
5710            self
5711        }
5712
5713        /// Sends the request.
5714        ///
5715        /// # Long running operations
5716        ///
5717        /// This starts, but does not poll, a longrunning operation. More information
5718        /// on [import_documents][crate::client::DocumentService::import_documents].
5719        pub async fn send(self) -> Result<longrunning::model::Operation> {
5720            (*self.0.stub)
5721                .import_documents(self.0.request, self.0.options)
5722                .await
5723                .map(gax::response::Response::into_body)
5724        }
5725
5726        /// Creates a [Poller][lro::Poller] to work with `import_documents`.
5727        pub fn poller(
5728            self,
5729        ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5730        {
5731            type Operation = lro::internal::Operation<
5732                crate::model::ImportDocumentsResponse,
5733                crate::model::ImportDocumentsMetadata,
5734            >;
5735            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5736            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5737
5738            let stub = self.0.stub.clone();
5739            let mut options = self.0.options.clone();
5740            options.set_retry_policy(gax::retry_policy::NeverRetry);
5741            let query = move |name| {
5742                let stub = stub.clone();
5743                let options = options.clone();
5744                async {
5745                    let op = GetOperation::new(stub)
5746                        .set_name(name)
5747                        .with_options(options)
5748                        .send()
5749                        .await?;
5750                    Ok(Operation::new(op))
5751                }
5752            };
5753
5754            let start = move || async {
5755                let op = self.send().await?;
5756                Ok(Operation::new(op))
5757            };
5758
5759            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5760        }
5761
5762        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5763        ///
5764        /// This is a **required** field for requests.
5765        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5766            self.0.request.parent = v.into();
5767            self
5768        }
5769
5770        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5771        pub fn set_error_config<T>(mut self, v: T) -> Self
5772        where
5773            T: std::convert::Into<crate::model::ImportErrorConfig>,
5774        {
5775            self.0.request.error_config = std::option::Option::Some(v.into());
5776            self
5777        }
5778
5779        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5780        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5781        where
5782            T: std::convert::Into<crate::model::ImportErrorConfig>,
5783        {
5784            self.0.request.error_config = v.map(|x| x.into());
5785            self
5786        }
5787
5788        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5789        pub fn set_reconciliation_mode<
5790            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5791        >(
5792            mut self,
5793            v: T,
5794        ) -> Self {
5795            self.0.request.reconciliation_mode = v.into();
5796            self
5797        }
5798
5799        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5800        pub fn set_update_mask<T>(mut self, v: T) -> Self
5801        where
5802            T: std::convert::Into<wkt::FieldMask>,
5803        {
5804            self.0.request.update_mask = std::option::Option::Some(v.into());
5805            self
5806        }
5807
5808        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5809        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5810        where
5811            T: std::convert::Into<wkt::FieldMask>,
5812        {
5813            self.0.request.update_mask = v.map(|x| x.into());
5814            self
5815        }
5816
5817        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5818        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5819            self.0.request.auto_generate_ids = v.into();
5820            self
5821        }
5822
5823        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5824        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5825            self.0.request.id_field = v.into();
5826            self
5827        }
5828
5829        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5830        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5831            self.0.request.force_refresh_content = v.into();
5832            self
5833        }
5834
5835        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5836        ///
5837        /// Note that all the setters affecting `source` are
5838        /// mutually exclusive.
5839        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5840            mut self,
5841            v: T,
5842        ) -> Self {
5843            self.0.request.source = v.into();
5844            self
5845        }
5846
5847        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5848        /// to hold a `InlineSource`.
5849        ///
5850        /// Note that all the setters affecting `source` are
5851        /// mutually exclusive.
5852        pub fn set_inline_source<
5853            T: std::convert::Into<
5854                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5855                >,
5856        >(
5857            mut self,
5858            v: T,
5859        ) -> Self {
5860            self.0.request = self.0.request.set_inline_source(v);
5861            self
5862        }
5863
5864        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5865        /// to hold a `GcsSource`.
5866        ///
5867        /// Note that all the setters affecting `source` are
5868        /// mutually exclusive.
5869        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5870            mut self,
5871            v: T,
5872        ) -> Self {
5873            self.0.request = self.0.request.set_gcs_source(v);
5874            self
5875        }
5876
5877        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5878        /// to hold a `BigquerySource`.
5879        ///
5880        /// Note that all the setters affecting `source` are
5881        /// mutually exclusive.
5882        pub fn set_bigquery_source<
5883            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5884        >(
5885            mut self,
5886            v: T,
5887        ) -> Self {
5888            self.0.request = self.0.request.set_bigquery_source(v);
5889            self
5890        }
5891
5892        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5893        /// to hold a `FhirStoreSource`.
5894        ///
5895        /// Note that all the setters affecting `source` are
5896        /// mutually exclusive.
5897        pub fn set_fhir_store_source<
5898            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5899        >(
5900            mut self,
5901            v: T,
5902        ) -> Self {
5903            self.0.request = self.0.request.set_fhir_store_source(v);
5904            self
5905        }
5906
5907        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5908        /// to hold a `SpannerSource`.
5909        ///
5910        /// Note that all the setters affecting `source` are
5911        /// mutually exclusive.
5912        pub fn set_spanner_source<
5913            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5914        >(
5915            mut self,
5916            v: T,
5917        ) -> Self {
5918            self.0.request = self.0.request.set_spanner_source(v);
5919            self
5920        }
5921
5922        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5923        /// to hold a `CloudSqlSource`.
5924        ///
5925        /// Note that all the setters affecting `source` are
5926        /// mutually exclusive.
5927        pub fn set_cloud_sql_source<
5928            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5929        >(
5930            mut self,
5931            v: T,
5932        ) -> Self {
5933            self.0.request = self.0.request.set_cloud_sql_source(v);
5934            self
5935        }
5936
5937        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5938        /// to hold a `FirestoreSource`.
5939        ///
5940        /// Note that all the setters affecting `source` are
5941        /// mutually exclusive.
5942        pub fn set_firestore_source<
5943            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5944        >(
5945            mut self,
5946            v: T,
5947        ) -> Self {
5948            self.0.request = self.0.request.set_firestore_source(v);
5949            self
5950        }
5951
5952        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5953        /// to hold a `AlloyDbSource`.
5954        ///
5955        /// Note that all the setters affecting `source` are
5956        /// mutually exclusive.
5957        pub fn set_alloy_db_source<
5958            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5959        >(
5960            mut self,
5961            v: T,
5962        ) -> Self {
5963            self.0.request = self.0.request.set_alloy_db_source(v);
5964            self
5965        }
5966
5967        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5968        /// to hold a `BigtableSource`.
5969        ///
5970        /// Note that all the setters affecting `source` are
5971        /// mutually exclusive.
5972        pub fn set_bigtable_source<
5973            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5974        >(
5975            mut self,
5976            v: T,
5977        ) -> Self {
5978            self.0.request = self.0.request.set_bigtable_source(v);
5979            self
5980        }
5981    }
5982
5983    #[doc(hidden)]
5984    impl gax::options::internal::RequestBuilder for ImportDocuments {
5985        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5986            &mut self.0.options
5987        }
5988    }
5989
5990    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
5991    ///
5992    /// # Example
5993    /// ```no_run
5994    /// # use google_cloud_discoveryengine_v1::builder;
5995    /// use builder::document_service::PurgeDocuments;
5996    /// # tokio_test::block_on(async {
5997    /// use lro::Poller;
5998    ///
5999    /// let builder = prepare_request_builder();
6000    /// let response = builder.poller().until_done().await?;
6001    /// # gax::Result::<()>::Ok(()) });
6002    ///
6003    /// fn prepare_request_builder() -> PurgeDocuments {
6004    ///   # panic!();
6005    ///   // ... details omitted ...
6006    /// }
6007    /// ```
6008    #[derive(Clone, Debug)]
6009    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6010
6011    impl PurgeDocuments {
6012        pub(crate) fn new(
6013            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6014        ) -> Self {
6015            Self(RequestBuilder::new(stub))
6016        }
6017
6018        /// Sets the full request, replacing any prior values.
6019        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6020            self.0.request = v.into();
6021            self
6022        }
6023
6024        /// Sets all the options, replacing any prior values.
6025        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6026            self.0.options = v.into();
6027            self
6028        }
6029
6030        /// Sends the request.
6031        ///
6032        /// # Long running operations
6033        ///
6034        /// This starts, but does not poll, a longrunning operation. More information
6035        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6036        pub async fn send(self) -> Result<longrunning::model::Operation> {
6037            (*self.0.stub)
6038                .purge_documents(self.0.request, self.0.options)
6039                .await
6040                .map(gax::response::Response::into_body)
6041        }
6042
6043        /// Creates a [Poller][lro::Poller] to work with `purge_documents`.
6044        pub fn poller(
6045            self,
6046        ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
6047        {
6048            type Operation = lro::internal::Operation<
6049                crate::model::PurgeDocumentsResponse,
6050                crate::model::PurgeDocumentsMetadata,
6051            >;
6052            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6053            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6054
6055            let stub = self.0.stub.clone();
6056            let mut options = self.0.options.clone();
6057            options.set_retry_policy(gax::retry_policy::NeverRetry);
6058            let query = move |name| {
6059                let stub = stub.clone();
6060                let options = options.clone();
6061                async {
6062                    let op = GetOperation::new(stub)
6063                        .set_name(name)
6064                        .with_options(options)
6065                        .send()
6066                        .await?;
6067                    Ok(Operation::new(op))
6068                }
6069            };
6070
6071            let start = move || async {
6072                let op = self.send().await?;
6073                Ok(Operation::new(op))
6074            };
6075
6076            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6077        }
6078
6079        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6080        ///
6081        /// This is a **required** field for requests.
6082        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6083            self.0.request.parent = v.into();
6084            self
6085        }
6086
6087        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6088        ///
6089        /// This is a **required** field for requests.
6090        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6091            self.0.request.filter = v.into();
6092            self
6093        }
6094
6095        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6096        pub fn set_error_config<T>(mut self, v: T) -> Self
6097        where
6098            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6099        {
6100            self.0.request.error_config = std::option::Option::Some(v.into());
6101            self
6102        }
6103
6104        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6105        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6106        where
6107            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6108        {
6109            self.0.request.error_config = v.map(|x| x.into());
6110            self
6111        }
6112
6113        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6114        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6115            self.0.request.force = v.into();
6116            self
6117        }
6118
6119        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6120        ///
6121        /// Note that all the setters affecting `source` are
6122        /// mutually exclusive.
6123        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6124            mut self,
6125            v: T,
6126        ) -> Self {
6127            self.0.request.source = v.into();
6128            self
6129        }
6130
6131        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6132        /// to hold a `GcsSource`.
6133        ///
6134        /// Note that all the setters affecting `source` are
6135        /// mutually exclusive.
6136        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6137            mut self,
6138            v: T,
6139        ) -> Self {
6140            self.0.request = self.0.request.set_gcs_source(v);
6141            self
6142        }
6143
6144        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6145        /// to hold a `InlineSource`.
6146        ///
6147        /// Note that all the setters affecting `source` are
6148        /// mutually exclusive.
6149        pub fn set_inline_source<
6150            T: std::convert::Into<
6151                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6152                >,
6153        >(
6154            mut self,
6155            v: T,
6156        ) -> Self {
6157            self.0.request = self.0.request.set_inline_source(v);
6158            self
6159        }
6160    }
6161
6162    #[doc(hidden)]
6163    impl gax::options::internal::RequestBuilder for PurgeDocuments {
6164        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6165            &mut self.0.options
6166        }
6167    }
6168
6169    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6170    ///
6171    /// # Example
6172    /// ```no_run
6173    /// # use google_cloud_discoveryengine_v1::builder;
6174    /// use builder::document_service::BatchGetDocumentsMetadata;
6175    /// # tokio_test::block_on(async {
6176    ///
6177    /// let builder = prepare_request_builder();
6178    /// let response = builder.send().await?;
6179    /// # gax::Result::<()>::Ok(()) });
6180    ///
6181    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6182    ///   # panic!();
6183    ///   // ... details omitted ...
6184    /// }
6185    /// ```
6186    #[derive(Clone, Debug)]
6187    pub struct BatchGetDocumentsMetadata(
6188        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6189    );
6190
6191    impl BatchGetDocumentsMetadata {
6192        pub(crate) fn new(
6193            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6194        ) -> Self {
6195            Self(RequestBuilder::new(stub))
6196        }
6197
6198        /// Sets the full request, replacing any prior values.
6199        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6200            mut self,
6201            v: V,
6202        ) -> Self {
6203            self.0.request = v.into();
6204            self
6205        }
6206
6207        /// Sets all the options, replacing any prior values.
6208        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6209            self.0.options = v.into();
6210            self
6211        }
6212
6213        /// Sends the request.
6214        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6215            (*self.0.stub)
6216                .batch_get_documents_metadata(self.0.request, self.0.options)
6217                .await
6218                .map(gax::response::Response::into_body)
6219        }
6220
6221        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6222        ///
6223        /// This is a **required** field for requests.
6224        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6225            self.0.request.parent = v.into();
6226            self
6227        }
6228
6229        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6230        ///
6231        /// This is a **required** field for requests.
6232        pub fn set_matcher<T>(mut self, v: T) -> Self
6233        where
6234            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6235        {
6236            self.0.request.matcher = std::option::Option::Some(v.into());
6237            self
6238        }
6239
6240        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6241        ///
6242        /// This is a **required** field for requests.
6243        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6244        where
6245            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6246        {
6247            self.0.request.matcher = v.map(|x| x.into());
6248            self
6249        }
6250    }
6251
6252    #[doc(hidden)]
6253    impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6254        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6255            &mut self.0.options
6256        }
6257    }
6258
6259    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6260    ///
6261    /// # Example
6262    /// ```no_run
6263    /// # use google_cloud_discoveryengine_v1::builder;
6264    /// use builder::document_service::ListOperations;
6265    /// # tokio_test::block_on(async {
6266    /// use gax::paginator::ItemPaginator;
6267    ///
6268    /// let builder = prepare_request_builder();
6269    /// let mut items = builder.by_item();
6270    /// while let Some(result) = items.next().await {
6271    ///   let item = result?;
6272    /// }
6273    /// # gax::Result::<()>::Ok(()) });
6274    ///
6275    /// fn prepare_request_builder() -> ListOperations {
6276    ///   # panic!();
6277    ///   // ... details omitted ...
6278    /// }
6279    /// ```
6280    #[derive(Clone, Debug)]
6281    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6282
6283    impl ListOperations {
6284        pub(crate) fn new(
6285            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6286        ) -> Self {
6287            Self(RequestBuilder::new(stub))
6288        }
6289
6290        /// Sets the full request, replacing any prior values.
6291        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6292            mut self,
6293            v: V,
6294        ) -> Self {
6295            self.0.request = v.into();
6296            self
6297        }
6298
6299        /// Sets all the options, replacing any prior values.
6300        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6301            self.0.options = v.into();
6302            self
6303        }
6304
6305        /// Sends the request.
6306        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6307            (*self.0.stub)
6308                .list_operations(self.0.request, self.0.options)
6309                .await
6310                .map(gax::response::Response::into_body)
6311        }
6312
6313        /// Streams each page in the collection.
6314        pub fn by_page(
6315            self,
6316        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6317        {
6318            use std::clone::Clone;
6319            let token = self.0.request.page_token.clone();
6320            let execute = move |token: String| {
6321                let mut builder = self.clone();
6322                builder.0.request = builder.0.request.set_page_token(token);
6323                builder.send()
6324            };
6325            gax::paginator::internal::new_paginator(token, execute)
6326        }
6327
6328        /// Streams each item in the collection.
6329        pub fn by_item(
6330            self,
6331        ) -> impl gax::paginator::ItemPaginator<
6332            longrunning::model::ListOperationsResponse,
6333            gax::error::Error,
6334        > {
6335            use gax::paginator::Paginator;
6336            self.by_page().items()
6337        }
6338
6339        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6340        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6341            self.0.request.name = v.into();
6342            self
6343        }
6344
6345        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6346        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6347            self.0.request.filter = v.into();
6348            self
6349        }
6350
6351        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6352        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6353            self.0.request.page_size = v.into();
6354            self
6355        }
6356
6357        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6358        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6359            self.0.request.page_token = v.into();
6360            self
6361        }
6362
6363        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
6364        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6365            self.0.request.return_partial_success = v.into();
6366            self
6367        }
6368    }
6369
6370    #[doc(hidden)]
6371    impl gax::options::internal::RequestBuilder for ListOperations {
6372        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6373            &mut self.0.options
6374        }
6375    }
6376
6377    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6378    ///
6379    /// # Example
6380    /// ```no_run
6381    /// # use google_cloud_discoveryengine_v1::builder;
6382    /// use builder::document_service::GetOperation;
6383    /// # tokio_test::block_on(async {
6384    ///
6385    /// let builder = prepare_request_builder();
6386    /// let response = builder.send().await?;
6387    /// # gax::Result::<()>::Ok(()) });
6388    ///
6389    /// fn prepare_request_builder() -> GetOperation {
6390    ///   # panic!();
6391    ///   // ... details omitted ...
6392    /// }
6393    /// ```
6394    #[derive(Clone, Debug)]
6395    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6396
6397    impl GetOperation {
6398        pub(crate) fn new(
6399            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6400        ) -> Self {
6401            Self(RequestBuilder::new(stub))
6402        }
6403
6404        /// Sets the full request, replacing any prior values.
6405        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6406            mut self,
6407            v: V,
6408        ) -> Self {
6409            self.0.request = v.into();
6410            self
6411        }
6412
6413        /// Sets all the options, replacing any prior values.
6414        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6415            self.0.options = v.into();
6416            self
6417        }
6418
6419        /// Sends the request.
6420        pub async fn send(self) -> Result<longrunning::model::Operation> {
6421            (*self.0.stub)
6422                .get_operation(self.0.request, self.0.options)
6423                .await
6424                .map(gax::response::Response::into_body)
6425        }
6426
6427        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6428        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6429            self.0.request.name = v.into();
6430            self
6431        }
6432    }
6433
6434    #[doc(hidden)]
6435    impl gax::options::internal::RequestBuilder for GetOperation {
6436        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6437            &mut self.0.options
6438        }
6439    }
6440
6441    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6442    ///
6443    /// # Example
6444    /// ```no_run
6445    /// # use google_cloud_discoveryengine_v1::builder;
6446    /// use builder::document_service::CancelOperation;
6447    /// # tokio_test::block_on(async {
6448    ///
6449    /// let builder = prepare_request_builder();
6450    /// let response = builder.send().await?;
6451    /// # gax::Result::<()>::Ok(()) });
6452    ///
6453    /// fn prepare_request_builder() -> CancelOperation {
6454    ///   # panic!();
6455    ///   // ... details omitted ...
6456    /// }
6457    /// ```
6458    #[derive(Clone, Debug)]
6459    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6460
6461    impl CancelOperation {
6462        pub(crate) fn new(
6463            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6464        ) -> Self {
6465            Self(RequestBuilder::new(stub))
6466        }
6467
6468        /// Sets the full request, replacing any prior values.
6469        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6470            mut self,
6471            v: V,
6472        ) -> Self {
6473            self.0.request = v.into();
6474            self
6475        }
6476
6477        /// Sets all the options, replacing any prior values.
6478        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6479            self.0.options = v.into();
6480            self
6481        }
6482
6483        /// Sends the request.
6484        pub async fn send(self) -> Result<()> {
6485            (*self.0.stub)
6486                .cancel_operation(self.0.request, self.0.options)
6487                .await
6488                .map(gax::response::Response::into_body)
6489        }
6490
6491        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
6492        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6493            self.0.request.name = v.into();
6494            self
6495        }
6496    }
6497
6498    #[doc(hidden)]
6499    impl gax::options::internal::RequestBuilder for CancelOperation {
6500        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6501            &mut self.0.options
6502        }
6503    }
6504}
6505
6506#[cfg(feature = "engine-service")]
6507#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6508pub mod engine_service {
6509    use crate::Result;
6510
6511    /// A builder for [EngineService][crate::client::EngineService].
6512    ///
6513    /// ```
6514    /// # tokio_test::block_on(async {
6515    /// # use google_cloud_discoveryengine_v1::*;
6516    /// # use builder::engine_service::ClientBuilder;
6517    /// # use client::EngineService;
6518    /// let builder : ClientBuilder = EngineService::builder();
6519    /// let client = builder
6520    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6521    ///     .build().await?;
6522    /// # gax::client_builder::Result::<()>::Ok(()) });
6523    /// ```
6524    pub type ClientBuilder =
6525        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6526
6527    pub(crate) mod client {
6528        use super::super::super::client::EngineService;
6529        pub struct Factory;
6530        impl gax::client_builder::internal::ClientFactory for Factory {
6531            type Client = EngineService;
6532            type Credentials = gaxi::options::Credentials;
6533            async fn build(
6534                self,
6535                config: gaxi::options::ClientConfig,
6536            ) -> gax::client_builder::Result<Self::Client> {
6537                Self::Client::new(config).await
6538            }
6539        }
6540    }
6541
6542    /// Common implementation for [crate::client::EngineService] request builders.
6543    #[derive(Clone, Debug)]
6544    pub(crate) struct RequestBuilder<R: std::default::Default> {
6545        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6546        request: R,
6547        options: gax::options::RequestOptions,
6548    }
6549
6550    impl<R> RequestBuilder<R>
6551    where
6552        R: std::default::Default,
6553    {
6554        pub(crate) fn new(
6555            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6556        ) -> Self {
6557            Self {
6558                stub,
6559                request: R::default(),
6560                options: gax::options::RequestOptions::default(),
6561            }
6562        }
6563    }
6564
6565    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6566    ///
6567    /// # Example
6568    /// ```no_run
6569    /// # use google_cloud_discoveryengine_v1::builder;
6570    /// use builder::engine_service::CreateEngine;
6571    /// # tokio_test::block_on(async {
6572    /// use lro::Poller;
6573    ///
6574    /// let builder = prepare_request_builder();
6575    /// let response = builder.poller().until_done().await?;
6576    /// # gax::Result::<()>::Ok(()) });
6577    ///
6578    /// fn prepare_request_builder() -> CreateEngine {
6579    ///   # panic!();
6580    ///   // ... details omitted ...
6581    /// }
6582    /// ```
6583    #[derive(Clone, Debug)]
6584    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6585
6586    impl CreateEngine {
6587        pub(crate) fn new(
6588            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6589        ) -> Self {
6590            Self(RequestBuilder::new(stub))
6591        }
6592
6593        /// Sets the full request, replacing any prior values.
6594        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6595            self.0.request = v.into();
6596            self
6597        }
6598
6599        /// Sets all the options, replacing any prior values.
6600        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6601            self.0.options = v.into();
6602            self
6603        }
6604
6605        /// Sends the request.
6606        ///
6607        /// # Long running operations
6608        ///
6609        /// This starts, but does not poll, a longrunning operation. More information
6610        /// on [create_engine][crate::client::EngineService::create_engine].
6611        pub async fn send(self) -> Result<longrunning::model::Operation> {
6612            (*self.0.stub)
6613                .create_engine(self.0.request, self.0.options)
6614                .await
6615                .map(gax::response::Response::into_body)
6616        }
6617
6618        /// Creates a [Poller][lro::Poller] to work with `create_engine`.
6619        pub fn poller(
6620            self,
6621        ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6622            type Operation =
6623                lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6624            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6625            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6626
6627            let stub = self.0.stub.clone();
6628            let mut options = self.0.options.clone();
6629            options.set_retry_policy(gax::retry_policy::NeverRetry);
6630            let query = move |name| {
6631                let stub = stub.clone();
6632                let options = options.clone();
6633                async {
6634                    let op = GetOperation::new(stub)
6635                        .set_name(name)
6636                        .with_options(options)
6637                        .send()
6638                        .await?;
6639                    Ok(Operation::new(op))
6640                }
6641            };
6642
6643            let start = move || async {
6644                let op = self.send().await?;
6645                Ok(Operation::new(op))
6646            };
6647
6648            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6649        }
6650
6651        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6652        ///
6653        /// This is a **required** field for requests.
6654        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6655            self.0.request.parent = v.into();
6656            self
6657        }
6658
6659        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6660        ///
6661        /// This is a **required** field for requests.
6662        pub fn set_engine<T>(mut self, v: T) -> Self
6663        where
6664            T: std::convert::Into<crate::model::Engine>,
6665        {
6666            self.0.request.engine = std::option::Option::Some(v.into());
6667            self
6668        }
6669
6670        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6671        ///
6672        /// This is a **required** field for requests.
6673        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6674        where
6675            T: std::convert::Into<crate::model::Engine>,
6676        {
6677            self.0.request.engine = v.map(|x| x.into());
6678            self
6679        }
6680
6681        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6682        ///
6683        /// This is a **required** field for requests.
6684        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6685            self.0.request.engine_id = v.into();
6686            self
6687        }
6688    }
6689
6690    #[doc(hidden)]
6691    impl gax::options::internal::RequestBuilder for CreateEngine {
6692        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6693            &mut self.0.options
6694        }
6695    }
6696
6697    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6698    ///
6699    /// # Example
6700    /// ```no_run
6701    /// # use google_cloud_discoveryengine_v1::builder;
6702    /// use builder::engine_service::DeleteEngine;
6703    /// # tokio_test::block_on(async {
6704    /// use lro::Poller;
6705    ///
6706    /// let builder = prepare_request_builder();
6707    /// let response = builder.poller().until_done().await?;
6708    /// # gax::Result::<()>::Ok(()) });
6709    ///
6710    /// fn prepare_request_builder() -> DeleteEngine {
6711    ///   # panic!();
6712    ///   // ... details omitted ...
6713    /// }
6714    /// ```
6715    #[derive(Clone, Debug)]
6716    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6717
6718    impl DeleteEngine {
6719        pub(crate) fn new(
6720            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6721        ) -> Self {
6722            Self(RequestBuilder::new(stub))
6723        }
6724
6725        /// Sets the full request, replacing any prior values.
6726        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6727            self.0.request = v.into();
6728            self
6729        }
6730
6731        /// Sets all the options, replacing any prior values.
6732        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6733            self.0.options = v.into();
6734            self
6735        }
6736
6737        /// Sends the request.
6738        ///
6739        /// # Long running operations
6740        ///
6741        /// This starts, but does not poll, a longrunning operation. More information
6742        /// on [delete_engine][crate::client::EngineService::delete_engine].
6743        pub async fn send(self) -> Result<longrunning::model::Operation> {
6744            (*self.0.stub)
6745                .delete_engine(self.0.request, self.0.options)
6746                .await
6747                .map(gax::response::Response::into_body)
6748        }
6749
6750        /// Creates a [Poller][lro::Poller] to work with `delete_engine`.
6751        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6752            type Operation =
6753                lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6754            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6755            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6756
6757            let stub = self.0.stub.clone();
6758            let mut options = self.0.options.clone();
6759            options.set_retry_policy(gax::retry_policy::NeverRetry);
6760            let query = move |name| {
6761                let stub = stub.clone();
6762                let options = options.clone();
6763                async {
6764                    let op = GetOperation::new(stub)
6765                        .set_name(name)
6766                        .with_options(options)
6767                        .send()
6768                        .await?;
6769                    Ok(Operation::new(op))
6770                }
6771            };
6772
6773            let start = move || async {
6774                let op = self.send().await?;
6775                Ok(Operation::new(op))
6776            };
6777
6778            lro::internal::new_unit_response_poller(
6779                polling_error_policy,
6780                polling_backoff_policy,
6781                start,
6782                query,
6783            )
6784        }
6785
6786        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6787        ///
6788        /// This is a **required** field for requests.
6789        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6790            self.0.request.name = v.into();
6791            self
6792        }
6793    }
6794
6795    #[doc(hidden)]
6796    impl gax::options::internal::RequestBuilder for DeleteEngine {
6797        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6798            &mut self.0.options
6799        }
6800    }
6801
6802    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6803    ///
6804    /// # Example
6805    /// ```no_run
6806    /// # use google_cloud_discoveryengine_v1::builder;
6807    /// use builder::engine_service::UpdateEngine;
6808    /// # tokio_test::block_on(async {
6809    ///
6810    /// let builder = prepare_request_builder();
6811    /// let response = builder.send().await?;
6812    /// # gax::Result::<()>::Ok(()) });
6813    ///
6814    /// fn prepare_request_builder() -> UpdateEngine {
6815    ///   # panic!();
6816    ///   // ... details omitted ...
6817    /// }
6818    /// ```
6819    #[derive(Clone, Debug)]
6820    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6821
6822    impl UpdateEngine {
6823        pub(crate) fn new(
6824            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6825        ) -> Self {
6826            Self(RequestBuilder::new(stub))
6827        }
6828
6829        /// Sets the full request, replacing any prior values.
6830        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6831            self.0.request = v.into();
6832            self
6833        }
6834
6835        /// Sets all the options, replacing any prior values.
6836        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6837            self.0.options = v.into();
6838            self
6839        }
6840
6841        /// Sends the request.
6842        pub async fn send(self) -> Result<crate::model::Engine> {
6843            (*self.0.stub)
6844                .update_engine(self.0.request, self.0.options)
6845                .await
6846                .map(gax::response::Response::into_body)
6847        }
6848
6849        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
6850        ///
6851        /// This is a **required** field for requests.
6852        pub fn set_engine<T>(mut self, v: T) -> Self
6853        where
6854            T: std::convert::Into<crate::model::Engine>,
6855        {
6856            self.0.request.engine = std::option::Option::Some(v.into());
6857            self
6858        }
6859
6860        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
6861        ///
6862        /// This is a **required** field for requests.
6863        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6864        where
6865            T: std::convert::Into<crate::model::Engine>,
6866        {
6867            self.0.request.engine = v.map(|x| x.into());
6868            self
6869        }
6870
6871        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6872        pub fn set_update_mask<T>(mut self, v: T) -> Self
6873        where
6874            T: std::convert::Into<wkt::FieldMask>,
6875        {
6876            self.0.request.update_mask = std::option::Option::Some(v.into());
6877            self
6878        }
6879
6880        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6881        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6882        where
6883            T: std::convert::Into<wkt::FieldMask>,
6884        {
6885            self.0.request.update_mask = v.map(|x| x.into());
6886            self
6887        }
6888    }
6889
6890    #[doc(hidden)]
6891    impl gax::options::internal::RequestBuilder for UpdateEngine {
6892        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6893            &mut self.0.options
6894        }
6895    }
6896
6897    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
6898    ///
6899    /// # Example
6900    /// ```no_run
6901    /// # use google_cloud_discoveryengine_v1::builder;
6902    /// use builder::engine_service::GetEngine;
6903    /// # tokio_test::block_on(async {
6904    ///
6905    /// let builder = prepare_request_builder();
6906    /// let response = builder.send().await?;
6907    /// # gax::Result::<()>::Ok(()) });
6908    ///
6909    /// fn prepare_request_builder() -> GetEngine {
6910    ///   # panic!();
6911    ///   // ... details omitted ...
6912    /// }
6913    /// ```
6914    #[derive(Clone, Debug)]
6915    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6916
6917    impl GetEngine {
6918        pub(crate) fn new(
6919            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6920        ) -> Self {
6921            Self(RequestBuilder::new(stub))
6922        }
6923
6924        /// Sets the full request, replacing any prior values.
6925        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6926            self.0.request = v.into();
6927            self
6928        }
6929
6930        /// Sets all the options, replacing any prior values.
6931        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6932            self.0.options = v.into();
6933            self
6934        }
6935
6936        /// Sends the request.
6937        pub async fn send(self) -> Result<crate::model::Engine> {
6938            (*self.0.stub)
6939                .get_engine(self.0.request, self.0.options)
6940                .await
6941                .map(gax::response::Response::into_body)
6942        }
6943
6944        /// Sets the value of [name][crate::model::GetEngineRequest::name].
6945        ///
6946        /// This is a **required** field for requests.
6947        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6948            self.0.request.name = v.into();
6949            self
6950        }
6951    }
6952
6953    #[doc(hidden)]
6954    impl gax::options::internal::RequestBuilder for GetEngine {
6955        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6956            &mut self.0.options
6957        }
6958    }
6959
6960    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
6961    ///
6962    /// # Example
6963    /// ```no_run
6964    /// # use google_cloud_discoveryengine_v1::builder;
6965    /// use builder::engine_service::ListEngines;
6966    /// # tokio_test::block_on(async {
6967    /// use gax::paginator::ItemPaginator;
6968    ///
6969    /// let builder = prepare_request_builder();
6970    /// let mut items = builder.by_item();
6971    /// while let Some(result) = items.next().await {
6972    ///   let item = result?;
6973    /// }
6974    /// # gax::Result::<()>::Ok(()) });
6975    ///
6976    /// fn prepare_request_builder() -> ListEngines {
6977    ///   # panic!();
6978    ///   // ... details omitted ...
6979    /// }
6980    /// ```
6981    #[derive(Clone, Debug)]
6982    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6983
6984    impl ListEngines {
6985        pub(crate) fn new(
6986            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6987        ) -> Self {
6988            Self(RequestBuilder::new(stub))
6989        }
6990
6991        /// Sets the full request, replacing any prior values.
6992        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6993            self.0.request = v.into();
6994            self
6995        }
6996
6997        /// Sets all the options, replacing any prior values.
6998        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6999            self.0.options = v.into();
7000            self
7001        }
7002
7003        /// Sends the request.
7004        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7005            (*self.0.stub)
7006                .list_engines(self.0.request, self.0.options)
7007                .await
7008                .map(gax::response::Response::into_body)
7009        }
7010
7011        /// Streams each page in the collection.
7012        pub fn by_page(
7013            self,
7014        ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
7015        {
7016            use std::clone::Clone;
7017            let token = self.0.request.page_token.clone();
7018            let execute = move |token: String| {
7019                let mut builder = self.clone();
7020                builder.0.request = builder.0.request.set_page_token(token);
7021                builder.send()
7022            };
7023            gax::paginator::internal::new_paginator(token, execute)
7024        }
7025
7026        /// Streams each item in the collection.
7027        pub fn by_item(
7028            self,
7029        ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
7030        {
7031            use gax::paginator::Paginator;
7032            self.by_page().items()
7033        }
7034
7035        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
7036        ///
7037        /// This is a **required** field for requests.
7038        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7039            self.0.request.parent = v.into();
7040            self
7041        }
7042
7043        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7044        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7045            self.0.request.page_size = v.into();
7046            self
7047        }
7048
7049        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7050        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7051            self.0.request.page_token = v.into();
7052            self
7053        }
7054
7055        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7056        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7057            self.0.request.filter = v.into();
7058            self
7059        }
7060    }
7061
7062    #[doc(hidden)]
7063    impl gax::options::internal::RequestBuilder for ListEngines {
7064        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7065            &mut self.0.options
7066        }
7067    }
7068
7069    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7070    ///
7071    /// # Example
7072    /// ```no_run
7073    /// # use google_cloud_discoveryengine_v1::builder;
7074    /// use builder::engine_service::ListOperations;
7075    /// # tokio_test::block_on(async {
7076    /// use gax::paginator::ItemPaginator;
7077    ///
7078    /// let builder = prepare_request_builder();
7079    /// let mut items = builder.by_item();
7080    /// while let Some(result) = items.next().await {
7081    ///   let item = result?;
7082    /// }
7083    /// # gax::Result::<()>::Ok(()) });
7084    ///
7085    /// fn prepare_request_builder() -> ListOperations {
7086    ///   # panic!();
7087    ///   // ... details omitted ...
7088    /// }
7089    /// ```
7090    #[derive(Clone, Debug)]
7091    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7092
7093    impl ListOperations {
7094        pub(crate) fn new(
7095            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7096        ) -> Self {
7097            Self(RequestBuilder::new(stub))
7098        }
7099
7100        /// Sets the full request, replacing any prior values.
7101        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7102            mut self,
7103            v: V,
7104        ) -> Self {
7105            self.0.request = v.into();
7106            self
7107        }
7108
7109        /// Sets all the options, replacing any prior values.
7110        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7111            self.0.options = v.into();
7112            self
7113        }
7114
7115        /// Sends the request.
7116        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7117            (*self.0.stub)
7118                .list_operations(self.0.request, self.0.options)
7119                .await
7120                .map(gax::response::Response::into_body)
7121        }
7122
7123        /// Streams each page in the collection.
7124        pub fn by_page(
7125            self,
7126        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7127        {
7128            use std::clone::Clone;
7129            let token = self.0.request.page_token.clone();
7130            let execute = move |token: String| {
7131                let mut builder = self.clone();
7132                builder.0.request = builder.0.request.set_page_token(token);
7133                builder.send()
7134            };
7135            gax::paginator::internal::new_paginator(token, execute)
7136        }
7137
7138        /// Streams each item in the collection.
7139        pub fn by_item(
7140            self,
7141        ) -> impl gax::paginator::ItemPaginator<
7142            longrunning::model::ListOperationsResponse,
7143            gax::error::Error,
7144        > {
7145            use gax::paginator::Paginator;
7146            self.by_page().items()
7147        }
7148
7149        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7150        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7151            self.0.request.name = v.into();
7152            self
7153        }
7154
7155        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7156        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7157            self.0.request.filter = v.into();
7158            self
7159        }
7160
7161        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7162        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7163            self.0.request.page_size = v.into();
7164            self
7165        }
7166
7167        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7168        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7169            self.0.request.page_token = v.into();
7170            self
7171        }
7172
7173        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
7174        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7175            self.0.request.return_partial_success = v.into();
7176            self
7177        }
7178    }
7179
7180    #[doc(hidden)]
7181    impl gax::options::internal::RequestBuilder for ListOperations {
7182        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7183            &mut self.0.options
7184        }
7185    }
7186
7187    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7188    ///
7189    /// # Example
7190    /// ```no_run
7191    /// # use google_cloud_discoveryengine_v1::builder;
7192    /// use builder::engine_service::GetOperation;
7193    /// # tokio_test::block_on(async {
7194    ///
7195    /// let builder = prepare_request_builder();
7196    /// let response = builder.send().await?;
7197    /// # gax::Result::<()>::Ok(()) });
7198    ///
7199    /// fn prepare_request_builder() -> GetOperation {
7200    ///   # panic!();
7201    ///   // ... details omitted ...
7202    /// }
7203    /// ```
7204    #[derive(Clone, Debug)]
7205    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7206
7207    impl GetOperation {
7208        pub(crate) fn new(
7209            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7210        ) -> Self {
7211            Self(RequestBuilder::new(stub))
7212        }
7213
7214        /// Sets the full request, replacing any prior values.
7215        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7216            mut self,
7217            v: V,
7218        ) -> Self {
7219            self.0.request = v.into();
7220            self
7221        }
7222
7223        /// Sets all the options, replacing any prior values.
7224        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7225            self.0.options = v.into();
7226            self
7227        }
7228
7229        /// Sends the request.
7230        pub async fn send(self) -> Result<longrunning::model::Operation> {
7231            (*self.0.stub)
7232                .get_operation(self.0.request, self.0.options)
7233                .await
7234                .map(gax::response::Response::into_body)
7235        }
7236
7237        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7238        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7239            self.0.request.name = v.into();
7240            self
7241        }
7242    }
7243
7244    #[doc(hidden)]
7245    impl gax::options::internal::RequestBuilder for GetOperation {
7246        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7247            &mut self.0.options
7248        }
7249    }
7250
7251    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7252    ///
7253    /// # Example
7254    /// ```no_run
7255    /// # use google_cloud_discoveryengine_v1::builder;
7256    /// use builder::engine_service::CancelOperation;
7257    /// # tokio_test::block_on(async {
7258    ///
7259    /// let builder = prepare_request_builder();
7260    /// let response = builder.send().await?;
7261    /// # gax::Result::<()>::Ok(()) });
7262    ///
7263    /// fn prepare_request_builder() -> CancelOperation {
7264    ///   # panic!();
7265    ///   // ... details omitted ...
7266    /// }
7267    /// ```
7268    #[derive(Clone, Debug)]
7269    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7270
7271    impl CancelOperation {
7272        pub(crate) fn new(
7273            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7274        ) -> Self {
7275            Self(RequestBuilder::new(stub))
7276        }
7277
7278        /// Sets the full request, replacing any prior values.
7279        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7280            mut self,
7281            v: V,
7282        ) -> Self {
7283            self.0.request = v.into();
7284            self
7285        }
7286
7287        /// Sets all the options, replacing any prior values.
7288        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7289            self.0.options = v.into();
7290            self
7291        }
7292
7293        /// Sends the request.
7294        pub async fn send(self) -> Result<()> {
7295            (*self.0.stub)
7296                .cancel_operation(self.0.request, self.0.options)
7297                .await
7298                .map(gax::response::Response::into_body)
7299        }
7300
7301        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7302        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7303            self.0.request.name = v.into();
7304            self
7305        }
7306    }
7307
7308    #[doc(hidden)]
7309    impl gax::options::internal::RequestBuilder for CancelOperation {
7310        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7311            &mut self.0.options
7312        }
7313    }
7314}
7315
7316#[cfg(feature = "grounded-generation-service")]
7317#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7318pub mod grounded_generation_service {
7319    use crate::Result;
7320
7321    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7322    ///
7323    /// ```
7324    /// # tokio_test::block_on(async {
7325    /// # use google_cloud_discoveryengine_v1::*;
7326    /// # use builder::grounded_generation_service::ClientBuilder;
7327    /// # use client::GroundedGenerationService;
7328    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7329    /// let client = builder
7330    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7331    ///     .build().await?;
7332    /// # gax::client_builder::Result::<()>::Ok(()) });
7333    /// ```
7334    pub type ClientBuilder =
7335        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7336
7337    pub(crate) mod client {
7338        use super::super::super::client::GroundedGenerationService;
7339        pub struct Factory;
7340        impl gax::client_builder::internal::ClientFactory for Factory {
7341            type Client = GroundedGenerationService;
7342            type Credentials = gaxi::options::Credentials;
7343            async fn build(
7344                self,
7345                config: gaxi::options::ClientConfig,
7346            ) -> gax::client_builder::Result<Self::Client> {
7347                Self::Client::new(config).await
7348            }
7349        }
7350    }
7351
7352    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7353    #[derive(Clone, Debug)]
7354    pub(crate) struct RequestBuilder<R: std::default::Default> {
7355        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7356        request: R,
7357        options: gax::options::RequestOptions,
7358    }
7359
7360    impl<R> RequestBuilder<R>
7361    where
7362        R: std::default::Default,
7363    {
7364        pub(crate) fn new(
7365            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7366        ) -> Self {
7367            Self {
7368                stub,
7369                request: R::default(),
7370                options: gax::options::RequestOptions::default(),
7371            }
7372        }
7373    }
7374
7375    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7376    ///
7377    /// # Example
7378    /// ```no_run
7379    /// # use google_cloud_discoveryengine_v1::builder;
7380    /// use builder::grounded_generation_service::GenerateGroundedContent;
7381    /// # tokio_test::block_on(async {
7382    ///
7383    /// let builder = prepare_request_builder();
7384    /// let response = builder.send().await?;
7385    /// # gax::Result::<()>::Ok(()) });
7386    ///
7387    /// fn prepare_request_builder() -> GenerateGroundedContent {
7388    ///   # panic!();
7389    ///   // ... details omitted ...
7390    /// }
7391    /// ```
7392    #[derive(Clone, Debug)]
7393    pub struct GenerateGroundedContent(
7394        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7395    );
7396
7397    impl GenerateGroundedContent {
7398        pub(crate) fn new(
7399            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7400        ) -> Self {
7401            Self(RequestBuilder::new(stub))
7402        }
7403
7404        /// Sets the full request, replacing any prior values.
7405        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7406            mut self,
7407            v: V,
7408        ) -> Self {
7409            self.0.request = v.into();
7410            self
7411        }
7412
7413        /// Sets all the options, replacing any prior values.
7414        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7415            self.0.options = v.into();
7416            self
7417        }
7418
7419        /// Sends the request.
7420        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7421            (*self.0.stub)
7422                .generate_grounded_content(self.0.request, self.0.options)
7423                .await
7424                .map(gax::response::Response::into_body)
7425        }
7426
7427        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7428        ///
7429        /// This is a **required** field for requests.
7430        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7431            self.0.request.location = v.into();
7432            self
7433        }
7434
7435        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7436        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7437        where
7438            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7439        {
7440            self.0.request.system_instruction = std::option::Option::Some(v.into());
7441            self
7442        }
7443
7444        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7445        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7446        where
7447            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7448        {
7449            self.0.request.system_instruction = v.map(|x| x.into());
7450            self
7451        }
7452
7453        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7454        pub fn set_contents<T, V>(mut self, v: T) -> Self
7455        where
7456            T: std::iter::IntoIterator<Item = V>,
7457            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7458        {
7459            use std::iter::Iterator;
7460            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7461            self
7462        }
7463
7464        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7465        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7466        where
7467            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7468        {
7469            self.0.request.generation_spec = std::option::Option::Some(v.into());
7470            self
7471        }
7472
7473        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7474        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7475        where
7476            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7477        {
7478            self.0.request.generation_spec = v.map(|x| x.into());
7479            self
7480        }
7481
7482        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7483        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7484        where
7485            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7486        {
7487            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7488            self
7489        }
7490
7491        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7492        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7493        where
7494            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7495        {
7496            self.0.request.grounding_spec = v.map(|x| x.into());
7497            self
7498        }
7499
7500        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7501        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7502        where
7503            T: std::iter::IntoIterator<Item = (K, V)>,
7504            K: std::convert::Into<std::string::String>,
7505            V: std::convert::Into<std::string::String>,
7506        {
7507            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7508            self
7509        }
7510    }
7511
7512    #[doc(hidden)]
7513    impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7514        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7515            &mut self.0.options
7516        }
7517    }
7518
7519    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7520    ///
7521    /// # Example
7522    /// ```no_run
7523    /// # use google_cloud_discoveryengine_v1::builder;
7524    /// use builder::grounded_generation_service::CheckGrounding;
7525    /// # tokio_test::block_on(async {
7526    ///
7527    /// let builder = prepare_request_builder();
7528    /// let response = builder.send().await?;
7529    /// # gax::Result::<()>::Ok(()) });
7530    ///
7531    /// fn prepare_request_builder() -> CheckGrounding {
7532    ///   # panic!();
7533    ///   // ... details omitted ...
7534    /// }
7535    /// ```
7536    #[derive(Clone, Debug)]
7537    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7538
7539    impl CheckGrounding {
7540        pub(crate) fn new(
7541            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7542        ) -> Self {
7543            Self(RequestBuilder::new(stub))
7544        }
7545
7546        /// Sets the full request, replacing any prior values.
7547        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7548            self.0.request = v.into();
7549            self
7550        }
7551
7552        /// Sets all the options, replacing any prior values.
7553        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7554            self.0.options = v.into();
7555            self
7556        }
7557
7558        /// Sends the request.
7559        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7560            (*self.0.stub)
7561                .check_grounding(self.0.request, self.0.options)
7562                .await
7563                .map(gax::response::Response::into_body)
7564        }
7565
7566        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7567        ///
7568        /// This is a **required** field for requests.
7569        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7570            self.0.request.grounding_config = v.into();
7571            self
7572        }
7573
7574        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7575        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7576            self.0.request.answer_candidate = v.into();
7577            self
7578        }
7579
7580        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7581        pub fn set_facts<T, V>(mut self, v: T) -> Self
7582        where
7583            T: std::iter::IntoIterator<Item = V>,
7584            V: std::convert::Into<crate::model::GroundingFact>,
7585        {
7586            use std::iter::Iterator;
7587            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7588            self
7589        }
7590
7591        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7592        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7593        where
7594            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7595        {
7596            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7597            self
7598        }
7599
7600        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7601        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7602        where
7603            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7604        {
7605            self.0.request.grounding_spec = v.map(|x| x.into());
7606            self
7607        }
7608
7609        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7610        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7611        where
7612            T: std::iter::IntoIterator<Item = (K, V)>,
7613            K: std::convert::Into<std::string::String>,
7614            V: std::convert::Into<std::string::String>,
7615        {
7616            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7617            self
7618        }
7619    }
7620
7621    #[doc(hidden)]
7622    impl gax::options::internal::RequestBuilder for CheckGrounding {
7623        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7624            &mut self.0.options
7625        }
7626    }
7627
7628    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7629    ///
7630    /// # Example
7631    /// ```no_run
7632    /// # use google_cloud_discoveryengine_v1::builder;
7633    /// use builder::grounded_generation_service::ListOperations;
7634    /// # tokio_test::block_on(async {
7635    /// use gax::paginator::ItemPaginator;
7636    ///
7637    /// let builder = prepare_request_builder();
7638    /// let mut items = builder.by_item();
7639    /// while let Some(result) = items.next().await {
7640    ///   let item = result?;
7641    /// }
7642    /// # gax::Result::<()>::Ok(()) });
7643    ///
7644    /// fn prepare_request_builder() -> ListOperations {
7645    ///   # panic!();
7646    ///   // ... details omitted ...
7647    /// }
7648    /// ```
7649    #[derive(Clone, Debug)]
7650    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7651
7652    impl ListOperations {
7653        pub(crate) fn new(
7654            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7655        ) -> Self {
7656            Self(RequestBuilder::new(stub))
7657        }
7658
7659        /// Sets the full request, replacing any prior values.
7660        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7661            mut self,
7662            v: V,
7663        ) -> Self {
7664            self.0.request = v.into();
7665            self
7666        }
7667
7668        /// Sets all the options, replacing any prior values.
7669        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7670            self.0.options = v.into();
7671            self
7672        }
7673
7674        /// Sends the request.
7675        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7676            (*self.0.stub)
7677                .list_operations(self.0.request, self.0.options)
7678                .await
7679                .map(gax::response::Response::into_body)
7680        }
7681
7682        /// Streams each page in the collection.
7683        pub fn by_page(
7684            self,
7685        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7686        {
7687            use std::clone::Clone;
7688            let token = self.0.request.page_token.clone();
7689            let execute = move |token: String| {
7690                let mut builder = self.clone();
7691                builder.0.request = builder.0.request.set_page_token(token);
7692                builder.send()
7693            };
7694            gax::paginator::internal::new_paginator(token, execute)
7695        }
7696
7697        /// Streams each item in the collection.
7698        pub fn by_item(
7699            self,
7700        ) -> impl gax::paginator::ItemPaginator<
7701            longrunning::model::ListOperationsResponse,
7702            gax::error::Error,
7703        > {
7704            use gax::paginator::Paginator;
7705            self.by_page().items()
7706        }
7707
7708        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7709        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7710            self.0.request.name = v.into();
7711            self
7712        }
7713
7714        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7715        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7716            self.0.request.filter = v.into();
7717            self
7718        }
7719
7720        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7721        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7722            self.0.request.page_size = v.into();
7723            self
7724        }
7725
7726        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7727        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7728            self.0.request.page_token = v.into();
7729            self
7730        }
7731
7732        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
7733        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7734            self.0.request.return_partial_success = v.into();
7735            self
7736        }
7737    }
7738
7739    #[doc(hidden)]
7740    impl gax::options::internal::RequestBuilder for ListOperations {
7741        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7742            &mut self.0.options
7743        }
7744    }
7745
7746    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7747    ///
7748    /// # Example
7749    /// ```no_run
7750    /// # use google_cloud_discoveryengine_v1::builder;
7751    /// use builder::grounded_generation_service::GetOperation;
7752    /// # tokio_test::block_on(async {
7753    ///
7754    /// let builder = prepare_request_builder();
7755    /// let response = builder.send().await?;
7756    /// # gax::Result::<()>::Ok(()) });
7757    ///
7758    /// fn prepare_request_builder() -> GetOperation {
7759    ///   # panic!();
7760    ///   // ... details omitted ...
7761    /// }
7762    /// ```
7763    #[derive(Clone, Debug)]
7764    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7765
7766    impl GetOperation {
7767        pub(crate) fn new(
7768            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7769        ) -> Self {
7770            Self(RequestBuilder::new(stub))
7771        }
7772
7773        /// Sets the full request, replacing any prior values.
7774        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7775            mut self,
7776            v: V,
7777        ) -> Self {
7778            self.0.request = v.into();
7779            self
7780        }
7781
7782        /// Sets all the options, replacing any prior values.
7783        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7784            self.0.options = v.into();
7785            self
7786        }
7787
7788        /// Sends the request.
7789        pub async fn send(self) -> Result<longrunning::model::Operation> {
7790            (*self.0.stub)
7791                .get_operation(self.0.request, self.0.options)
7792                .await
7793                .map(gax::response::Response::into_body)
7794        }
7795
7796        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7797        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7798            self.0.request.name = v.into();
7799            self
7800        }
7801    }
7802
7803    #[doc(hidden)]
7804    impl gax::options::internal::RequestBuilder for GetOperation {
7805        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7806            &mut self.0.options
7807        }
7808    }
7809
7810    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7811    ///
7812    /// # Example
7813    /// ```no_run
7814    /// # use google_cloud_discoveryengine_v1::builder;
7815    /// use builder::grounded_generation_service::CancelOperation;
7816    /// # tokio_test::block_on(async {
7817    ///
7818    /// let builder = prepare_request_builder();
7819    /// let response = builder.send().await?;
7820    /// # gax::Result::<()>::Ok(()) });
7821    ///
7822    /// fn prepare_request_builder() -> CancelOperation {
7823    ///   # panic!();
7824    ///   // ... details omitted ...
7825    /// }
7826    /// ```
7827    #[derive(Clone, Debug)]
7828    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7829
7830    impl CancelOperation {
7831        pub(crate) fn new(
7832            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7833        ) -> Self {
7834            Self(RequestBuilder::new(stub))
7835        }
7836
7837        /// Sets the full request, replacing any prior values.
7838        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7839            mut self,
7840            v: V,
7841        ) -> Self {
7842            self.0.request = v.into();
7843            self
7844        }
7845
7846        /// Sets all the options, replacing any prior values.
7847        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7848            self.0.options = v.into();
7849            self
7850        }
7851
7852        /// Sends the request.
7853        pub async fn send(self) -> Result<()> {
7854            (*self.0.stub)
7855                .cancel_operation(self.0.request, self.0.options)
7856                .await
7857                .map(gax::response::Response::into_body)
7858        }
7859
7860        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7861        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7862            self.0.request.name = v.into();
7863            self
7864        }
7865    }
7866
7867    #[doc(hidden)]
7868    impl gax::options::internal::RequestBuilder for CancelOperation {
7869        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7870            &mut self.0.options
7871        }
7872    }
7873}
7874
7875#[cfg(feature = "identity-mapping-store-service")]
7876#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7877pub mod identity_mapping_store_service {
7878    use crate::Result;
7879
7880    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7881    ///
7882    /// ```
7883    /// # tokio_test::block_on(async {
7884    /// # use google_cloud_discoveryengine_v1::*;
7885    /// # use builder::identity_mapping_store_service::ClientBuilder;
7886    /// # use client::IdentityMappingStoreService;
7887    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
7888    /// let client = builder
7889    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7890    ///     .build().await?;
7891    /// # gax::client_builder::Result::<()>::Ok(()) });
7892    /// ```
7893    pub type ClientBuilder =
7894        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7895
7896    pub(crate) mod client {
7897        use super::super::super::client::IdentityMappingStoreService;
7898        pub struct Factory;
7899        impl gax::client_builder::internal::ClientFactory for Factory {
7900            type Client = IdentityMappingStoreService;
7901            type Credentials = gaxi::options::Credentials;
7902            async fn build(
7903                self,
7904                config: gaxi::options::ClientConfig,
7905            ) -> gax::client_builder::Result<Self::Client> {
7906                Self::Client::new(config).await
7907            }
7908        }
7909    }
7910
7911    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
7912    #[derive(Clone, Debug)]
7913    pub(crate) struct RequestBuilder<R: std::default::Default> {
7914        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7915        request: R,
7916        options: gax::options::RequestOptions,
7917    }
7918
7919    impl<R> RequestBuilder<R>
7920    where
7921        R: std::default::Default,
7922    {
7923        pub(crate) fn new(
7924            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7925        ) -> Self {
7926            Self {
7927                stub,
7928                request: R::default(),
7929                options: gax::options::RequestOptions::default(),
7930            }
7931        }
7932    }
7933
7934    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
7935    ///
7936    /// # Example
7937    /// ```no_run
7938    /// # use google_cloud_discoveryengine_v1::builder;
7939    /// use builder::identity_mapping_store_service::CreateIdentityMappingStore;
7940    /// # tokio_test::block_on(async {
7941    ///
7942    /// let builder = prepare_request_builder();
7943    /// let response = builder.send().await?;
7944    /// # gax::Result::<()>::Ok(()) });
7945    ///
7946    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
7947    ///   # panic!();
7948    ///   // ... details omitted ...
7949    /// }
7950    /// ```
7951    #[derive(Clone, Debug)]
7952    pub struct CreateIdentityMappingStore(
7953        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7954    );
7955
7956    impl CreateIdentityMappingStore {
7957        pub(crate) fn new(
7958            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7959        ) -> Self {
7960            Self(RequestBuilder::new(stub))
7961        }
7962
7963        /// Sets the full request, replacing any prior values.
7964        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7965            mut self,
7966            v: V,
7967        ) -> Self {
7968            self.0.request = v.into();
7969            self
7970        }
7971
7972        /// Sets all the options, replacing any prior values.
7973        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7974            self.0.options = v.into();
7975            self
7976        }
7977
7978        /// Sends the request.
7979        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7980            (*self.0.stub)
7981                .create_identity_mapping_store(self.0.request, self.0.options)
7982                .await
7983                .map(gax::response::Response::into_body)
7984        }
7985
7986        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
7987        ///
7988        /// This is a **required** field for requests.
7989        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7990            self.0.request.parent = v.into();
7991            self
7992        }
7993
7994        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
7995        ///
7996        /// This is a **required** field for requests.
7997        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7998            self.0.request.identity_mapping_store_id = v.into();
7999            self
8000        }
8001
8002        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8003        ///
8004        /// This is a **required** field for requests.
8005        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8006        where
8007            T: std::convert::Into<crate::model::IdentityMappingStore>,
8008        {
8009            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8010            self
8011        }
8012
8013        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8014        ///
8015        /// This is a **required** field for requests.
8016        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8017        where
8018            T: std::convert::Into<crate::model::IdentityMappingStore>,
8019        {
8020            self.0.request.identity_mapping_store = v.map(|x| x.into());
8021            self
8022        }
8023
8024        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
8025        ///
8026        /// Note that all the setters affecting `cmek_options` are
8027        /// mutually exclusive.
8028        pub fn set_cmek_options<
8029            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8030        >(
8031            mut self,
8032            v: T,
8033        ) -> Self {
8034            self.0.request.cmek_options = v.into();
8035            self
8036        }
8037
8038        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8039        /// to hold a `CmekConfigName`.
8040        ///
8041        /// Note that all the setters affecting `cmek_options` are
8042        /// mutually exclusive.
8043        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8044            mut self,
8045            v: T,
8046        ) -> Self {
8047            self.0.request = self.0.request.set_cmek_config_name(v);
8048            self
8049        }
8050
8051        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8052        /// to hold a `DisableCmek`.
8053        ///
8054        /// Note that all the setters affecting `cmek_options` are
8055        /// mutually exclusive.
8056        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8057            self.0.request = self.0.request.set_disable_cmek(v);
8058            self
8059        }
8060    }
8061
8062    #[doc(hidden)]
8063    impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
8064        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8065            &mut self.0.options
8066        }
8067    }
8068
8069    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8070    ///
8071    /// # Example
8072    /// ```no_run
8073    /// # use google_cloud_discoveryengine_v1::builder;
8074    /// use builder::identity_mapping_store_service::GetIdentityMappingStore;
8075    /// # tokio_test::block_on(async {
8076    ///
8077    /// let builder = prepare_request_builder();
8078    /// let response = builder.send().await?;
8079    /// # gax::Result::<()>::Ok(()) });
8080    ///
8081    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8082    ///   # panic!();
8083    ///   // ... details omitted ...
8084    /// }
8085    /// ```
8086    #[derive(Clone, Debug)]
8087    pub struct GetIdentityMappingStore(
8088        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8089    );
8090
8091    impl GetIdentityMappingStore {
8092        pub(crate) fn new(
8093            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8094        ) -> Self {
8095            Self(RequestBuilder::new(stub))
8096        }
8097
8098        /// Sets the full request, replacing any prior values.
8099        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8100            mut self,
8101            v: V,
8102        ) -> Self {
8103            self.0.request = v.into();
8104            self
8105        }
8106
8107        /// Sets all the options, replacing any prior values.
8108        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8109            self.0.options = v.into();
8110            self
8111        }
8112
8113        /// Sends the request.
8114        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8115            (*self.0.stub)
8116                .get_identity_mapping_store(self.0.request, self.0.options)
8117                .await
8118                .map(gax::response::Response::into_body)
8119        }
8120
8121        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8122        ///
8123        /// This is a **required** field for requests.
8124        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8125            self.0.request.name = v.into();
8126            self
8127        }
8128    }
8129
8130    #[doc(hidden)]
8131    impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8132        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8133            &mut self.0.options
8134        }
8135    }
8136
8137    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8138    ///
8139    /// # Example
8140    /// ```no_run
8141    /// # use google_cloud_discoveryengine_v1::builder;
8142    /// use builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8143    /// # tokio_test::block_on(async {
8144    /// use lro::Poller;
8145    ///
8146    /// let builder = prepare_request_builder();
8147    /// let response = builder.poller().until_done().await?;
8148    /// # gax::Result::<()>::Ok(()) });
8149    ///
8150    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8151    ///   # panic!();
8152    ///   // ... details omitted ...
8153    /// }
8154    /// ```
8155    #[derive(Clone, Debug)]
8156    pub struct DeleteIdentityMappingStore(
8157        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8158    );
8159
8160    impl DeleteIdentityMappingStore {
8161        pub(crate) fn new(
8162            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8163        ) -> Self {
8164            Self(RequestBuilder::new(stub))
8165        }
8166
8167        /// Sets the full request, replacing any prior values.
8168        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8169            mut self,
8170            v: V,
8171        ) -> Self {
8172            self.0.request = v.into();
8173            self
8174        }
8175
8176        /// Sets all the options, replacing any prior values.
8177        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8178            self.0.options = v.into();
8179            self
8180        }
8181
8182        /// Sends the request.
8183        ///
8184        /// # Long running operations
8185        ///
8186        /// This starts, but does not poll, a longrunning operation. More information
8187        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8188        pub async fn send(self) -> Result<longrunning::model::Operation> {
8189            (*self.0.stub)
8190                .delete_identity_mapping_store(self.0.request, self.0.options)
8191                .await
8192                .map(gax::response::Response::into_body)
8193        }
8194
8195        /// Creates a [Poller][lro::Poller] to work with `delete_identity_mapping_store`.
8196        pub fn poller(
8197            self,
8198        ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8199            type Operation = lro::internal::Operation<
8200                wkt::Empty,
8201                crate::model::DeleteIdentityMappingStoreMetadata,
8202            >;
8203            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8204            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8205
8206            let stub = self.0.stub.clone();
8207            let mut options = self.0.options.clone();
8208            options.set_retry_policy(gax::retry_policy::NeverRetry);
8209            let query = move |name| {
8210                let stub = stub.clone();
8211                let options = options.clone();
8212                async {
8213                    let op = GetOperation::new(stub)
8214                        .set_name(name)
8215                        .with_options(options)
8216                        .send()
8217                        .await?;
8218                    Ok(Operation::new(op))
8219                }
8220            };
8221
8222            let start = move || async {
8223                let op = self.send().await?;
8224                Ok(Operation::new(op))
8225            };
8226
8227            lro::internal::new_unit_response_poller(
8228                polling_error_policy,
8229                polling_backoff_policy,
8230                start,
8231                query,
8232            )
8233        }
8234
8235        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8236        ///
8237        /// This is a **required** field for requests.
8238        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8239            self.0.request.name = v.into();
8240            self
8241        }
8242    }
8243
8244    #[doc(hidden)]
8245    impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8246        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8247            &mut self.0.options
8248        }
8249    }
8250
8251    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8252    ///
8253    /// # Example
8254    /// ```no_run
8255    /// # use google_cloud_discoveryengine_v1::builder;
8256    /// use builder::identity_mapping_store_service::ImportIdentityMappings;
8257    /// # tokio_test::block_on(async {
8258    /// use lro::Poller;
8259    ///
8260    /// let builder = prepare_request_builder();
8261    /// let response = builder.poller().until_done().await?;
8262    /// # gax::Result::<()>::Ok(()) });
8263    ///
8264    /// fn prepare_request_builder() -> ImportIdentityMappings {
8265    ///   # panic!();
8266    ///   // ... details omitted ...
8267    /// }
8268    /// ```
8269    #[derive(Clone, Debug)]
8270    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8271
8272    impl ImportIdentityMappings {
8273        pub(crate) fn new(
8274            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8275        ) -> Self {
8276            Self(RequestBuilder::new(stub))
8277        }
8278
8279        /// Sets the full request, replacing any prior values.
8280        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8281            mut self,
8282            v: V,
8283        ) -> Self {
8284            self.0.request = v.into();
8285            self
8286        }
8287
8288        /// Sets all the options, replacing any prior values.
8289        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8290            self.0.options = v.into();
8291            self
8292        }
8293
8294        /// Sends the request.
8295        ///
8296        /// # Long running operations
8297        ///
8298        /// This starts, but does not poll, a longrunning operation. More information
8299        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8300        pub async fn send(self) -> Result<longrunning::model::Operation> {
8301            (*self.0.stub)
8302                .import_identity_mappings(self.0.request, self.0.options)
8303                .await
8304                .map(gax::response::Response::into_body)
8305        }
8306
8307        /// Creates a [Poller][lro::Poller] to work with `import_identity_mappings`.
8308        pub fn poller(
8309            self,
8310        ) -> impl lro::Poller<
8311            crate::model::ImportIdentityMappingsResponse,
8312            crate::model::IdentityMappingEntryOperationMetadata,
8313        > {
8314            type Operation = lro::internal::Operation<
8315                crate::model::ImportIdentityMappingsResponse,
8316                crate::model::IdentityMappingEntryOperationMetadata,
8317            >;
8318            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8319            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8320
8321            let stub = self.0.stub.clone();
8322            let mut options = self.0.options.clone();
8323            options.set_retry_policy(gax::retry_policy::NeverRetry);
8324            let query = move |name| {
8325                let stub = stub.clone();
8326                let options = options.clone();
8327                async {
8328                    let op = GetOperation::new(stub)
8329                        .set_name(name)
8330                        .with_options(options)
8331                        .send()
8332                        .await?;
8333                    Ok(Operation::new(op))
8334                }
8335            };
8336
8337            let start = move || async {
8338                let op = self.send().await?;
8339                Ok(Operation::new(op))
8340            };
8341
8342            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8343        }
8344
8345        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8346        ///
8347        /// This is a **required** field for requests.
8348        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8349            self.0.request.identity_mapping_store = v.into();
8350            self
8351        }
8352
8353        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8354        ///
8355        /// Note that all the setters affecting `source` are
8356        /// mutually exclusive.
8357        pub fn set_source<
8358            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8359        >(
8360            mut self,
8361            v: T,
8362        ) -> Self {
8363            self.0.request.source = v.into();
8364            self
8365        }
8366
8367        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8368        /// to hold a `InlineSource`.
8369        ///
8370        /// Note that all the setters affecting `source` are
8371        /// mutually exclusive.
8372        pub fn set_inline_source<
8373            T: std::convert::Into<
8374                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8375                >,
8376        >(
8377            mut self,
8378            v: T,
8379        ) -> Self {
8380            self.0.request = self.0.request.set_inline_source(v);
8381            self
8382        }
8383    }
8384
8385    #[doc(hidden)]
8386    impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8387        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8388            &mut self.0.options
8389        }
8390    }
8391
8392    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8393    ///
8394    /// # Example
8395    /// ```no_run
8396    /// # use google_cloud_discoveryengine_v1::builder;
8397    /// use builder::identity_mapping_store_service::PurgeIdentityMappings;
8398    /// # tokio_test::block_on(async {
8399    /// use lro::Poller;
8400    ///
8401    /// let builder = prepare_request_builder();
8402    /// let response = builder.poller().until_done().await?;
8403    /// # gax::Result::<()>::Ok(()) });
8404    ///
8405    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8406    ///   # panic!();
8407    ///   // ... details omitted ...
8408    /// }
8409    /// ```
8410    #[derive(Clone, Debug)]
8411    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8412
8413    impl PurgeIdentityMappings {
8414        pub(crate) fn new(
8415            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8416        ) -> Self {
8417            Self(RequestBuilder::new(stub))
8418        }
8419
8420        /// Sets the full request, replacing any prior values.
8421        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8422            mut self,
8423            v: V,
8424        ) -> Self {
8425            self.0.request = v.into();
8426            self
8427        }
8428
8429        /// Sets all the options, replacing any prior values.
8430        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8431            self.0.options = v.into();
8432            self
8433        }
8434
8435        /// Sends the request.
8436        ///
8437        /// # Long running operations
8438        ///
8439        /// This starts, but does not poll, a longrunning operation. More information
8440        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8441        pub async fn send(self) -> Result<longrunning::model::Operation> {
8442            (*self.0.stub)
8443                .purge_identity_mappings(self.0.request, self.0.options)
8444                .await
8445                .map(gax::response::Response::into_body)
8446        }
8447
8448        /// Creates a [Poller][lro::Poller] to work with `purge_identity_mappings`.
8449        pub fn poller(
8450            self,
8451        ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8452            type Operation = lro::internal::Operation<
8453                wkt::Empty,
8454                crate::model::IdentityMappingEntryOperationMetadata,
8455            >;
8456            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8457            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8458
8459            let stub = self.0.stub.clone();
8460            let mut options = self.0.options.clone();
8461            options.set_retry_policy(gax::retry_policy::NeverRetry);
8462            let query = move |name| {
8463                let stub = stub.clone();
8464                let options = options.clone();
8465                async {
8466                    let op = GetOperation::new(stub)
8467                        .set_name(name)
8468                        .with_options(options)
8469                        .send()
8470                        .await?;
8471                    Ok(Operation::new(op))
8472                }
8473            };
8474
8475            let start = move || async {
8476                let op = self.send().await?;
8477                Ok(Operation::new(op))
8478            };
8479
8480            lro::internal::new_unit_response_poller(
8481                polling_error_policy,
8482                polling_backoff_policy,
8483                start,
8484                query,
8485            )
8486        }
8487
8488        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8489        ///
8490        /// This is a **required** field for requests.
8491        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8492            self.0.request.identity_mapping_store = v.into();
8493            self
8494        }
8495
8496        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8497        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8498            self.0.request.filter = v.into();
8499            self
8500        }
8501
8502        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8503        pub fn set_force<T>(mut self, v: T) -> Self
8504        where
8505            T: std::convert::Into<bool>,
8506        {
8507            self.0.request.force = std::option::Option::Some(v.into());
8508            self
8509        }
8510
8511        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8512        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8513        where
8514            T: std::convert::Into<bool>,
8515        {
8516            self.0.request.force = v.map(|x| x.into());
8517            self
8518        }
8519
8520        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8521        ///
8522        /// Note that all the setters affecting `source` are
8523        /// mutually exclusive.
8524        pub fn set_source<
8525            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8526        >(
8527            mut self,
8528            v: T,
8529        ) -> Self {
8530            self.0.request.source = v.into();
8531            self
8532        }
8533
8534        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8535        /// to hold a `InlineSource`.
8536        ///
8537        /// Note that all the setters affecting `source` are
8538        /// mutually exclusive.
8539        pub fn set_inline_source<
8540            T: std::convert::Into<
8541                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8542                >,
8543        >(
8544            mut self,
8545            v: T,
8546        ) -> Self {
8547            self.0.request = self.0.request.set_inline_source(v);
8548            self
8549        }
8550    }
8551
8552    #[doc(hidden)]
8553    impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8554        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8555            &mut self.0.options
8556        }
8557    }
8558
8559    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8560    ///
8561    /// # Example
8562    /// ```no_run
8563    /// # use google_cloud_discoveryengine_v1::builder;
8564    /// use builder::identity_mapping_store_service::ListIdentityMappings;
8565    /// # tokio_test::block_on(async {
8566    /// use gax::paginator::ItemPaginator;
8567    ///
8568    /// let builder = prepare_request_builder();
8569    /// let mut items = builder.by_item();
8570    /// while let Some(result) = items.next().await {
8571    ///   let item = result?;
8572    /// }
8573    /// # gax::Result::<()>::Ok(()) });
8574    ///
8575    /// fn prepare_request_builder() -> ListIdentityMappings {
8576    ///   # panic!();
8577    ///   // ... details omitted ...
8578    /// }
8579    /// ```
8580    #[derive(Clone, Debug)]
8581    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8582
8583    impl ListIdentityMappings {
8584        pub(crate) fn new(
8585            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8586        ) -> Self {
8587            Self(RequestBuilder::new(stub))
8588        }
8589
8590        /// Sets the full request, replacing any prior values.
8591        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8592            mut self,
8593            v: V,
8594        ) -> Self {
8595            self.0.request = v.into();
8596            self
8597        }
8598
8599        /// Sets all the options, replacing any prior values.
8600        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8601            self.0.options = v.into();
8602            self
8603        }
8604
8605        /// Sends the request.
8606        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8607            (*self.0.stub)
8608                .list_identity_mappings(self.0.request, self.0.options)
8609                .await
8610                .map(gax::response::Response::into_body)
8611        }
8612
8613        /// Streams each page in the collection.
8614        pub fn by_page(
8615            self,
8616        ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8617        {
8618            use std::clone::Clone;
8619            let token = self.0.request.page_token.clone();
8620            let execute = move |token: String| {
8621                let mut builder = self.clone();
8622                builder.0.request = builder.0.request.set_page_token(token);
8623                builder.send()
8624            };
8625            gax::paginator::internal::new_paginator(token, execute)
8626        }
8627
8628        /// Streams each item in the collection.
8629        pub fn by_item(
8630            self,
8631        ) -> impl gax::paginator::ItemPaginator<
8632            crate::model::ListIdentityMappingsResponse,
8633            gax::error::Error,
8634        > {
8635            use gax::paginator::Paginator;
8636            self.by_page().items()
8637        }
8638
8639        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8640        ///
8641        /// This is a **required** field for requests.
8642        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8643            self.0.request.identity_mapping_store = v.into();
8644            self
8645        }
8646
8647        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8648        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8649            self.0.request.page_size = v.into();
8650            self
8651        }
8652
8653        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8654        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8655            self.0.request.page_token = v.into();
8656            self
8657        }
8658    }
8659
8660    #[doc(hidden)]
8661    impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8662        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8663            &mut self.0.options
8664        }
8665    }
8666
8667    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8668    ///
8669    /// # Example
8670    /// ```no_run
8671    /// # use google_cloud_discoveryengine_v1::builder;
8672    /// use builder::identity_mapping_store_service::ListIdentityMappingStores;
8673    /// # tokio_test::block_on(async {
8674    /// use gax::paginator::ItemPaginator;
8675    ///
8676    /// let builder = prepare_request_builder();
8677    /// let mut items = builder.by_item();
8678    /// while let Some(result) = items.next().await {
8679    ///   let item = result?;
8680    /// }
8681    /// # gax::Result::<()>::Ok(()) });
8682    ///
8683    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8684    ///   # panic!();
8685    ///   // ... details omitted ...
8686    /// }
8687    /// ```
8688    #[derive(Clone, Debug)]
8689    pub struct ListIdentityMappingStores(
8690        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8691    );
8692
8693    impl ListIdentityMappingStores {
8694        pub(crate) fn new(
8695            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8696        ) -> Self {
8697            Self(RequestBuilder::new(stub))
8698        }
8699
8700        /// Sets the full request, replacing any prior values.
8701        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8702            mut self,
8703            v: V,
8704        ) -> Self {
8705            self.0.request = v.into();
8706            self
8707        }
8708
8709        /// Sets all the options, replacing any prior values.
8710        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8711            self.0.options = v.into();
8712            self
8713        }
8714
8715        /// Sends the request.
8716        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8717            (*self.0.stub)
8718                .list_identity_mapping_stores(self.0.request, self.0.options)
8719                .await
8720                .map(gax::response::Response::into_body)
8721        }
8722
8723        /// Streams each page in the collection.
8724        pub fn by_page(
8725            self,
8726        ) -> impl gax::paginator::Paginator<
8727            crate::model::ListIdentityMappingStoresResponse,
8728            gax::error::Error,
8729        > {
8730            use std::clone::Clone;
8731            let token = self.0.request.page_token.clone();
8732            let execute = move |token: String| {
8733                let mut builder = self.clone();
8734                builder.0.request = builder.0.request.set_page_token(token);
8735                builder.send()
8736            };
8737            gax::paginator::internal::new_paginator(token, execute)
8738        }
8739
8740        /// Streams each item in the collection.
8741        pub fn by_item(
8742            self,
8743        ) -> impl gax::paginator::ItemPaginator<
8744            crate::model::ListIdentityMappingStoresResponse,
8745            gax::error::Error,
8746        > {
8747            use gax::paginator::Paginator;
8748            self.by_page().items()
8749        }
8750
8751        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8752        ///
8753        /// This is a **required** field for requests.
8754        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8755            self.0.request.parent = v.into();
8756            self
8757        }
8758
8759        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8760        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8761            self.0.request.page_size = v.into();
8762            self
8763        }
8764
8765        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8766        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8767            self.0.request.page_token = v.into();
8768            self
8769        }
8770    }
8771
8772    #[doc(hidden)]
8773    impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8774        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8775            &mut self.0.options
8776        }
8777    }
8778
8779    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8780    ///
8781    /// # Example
8782    /// ```no_run
8783    /// # use google_cloud_discoveryengine_v1::builder;
8784    /// use builder::identity_mapping_store_service::ListOperations;
8785    /// # tokio_test::block_on(async {
8786    /// use gax::paginator::ItemPaginator;
8787    ///
8788    /// let builder = prepare_request_builder();
8789    /// let mut items = builder.by_item();
8790    /// while let Some(result) = items.next().await {
8791    ///   let item = result?;
8792    /// }
8793    /// # gax::Result::<()>::Ok(()) });
8794    ///
8795    /// fn prepare_request_builder() -> ListOperations {
8796    ///   # panic!();
8797    ///   // ... details omitted ...
8798    /// }
8799    /// ```
8800    #[derive(Clone, Debug)]
8801    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8802
8803    impl ListOperations {
8804        pub(crate) fn new(
8805            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8806        ) -> Self {
8807            Self(RequestBuilder::new(stub))
8808        }
8809
8810        /// Sets the full request, replacing any prior values.
8811        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8812            mut self,
8813            v: V,
8814        ) -> Self {
8815            self.0.request = v.into();
8816            self
8817        }
8818
8819        /// Sets all the options, replacing any prior values.
8820        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8821            self.0.options = v.into();
8822            self
8823        }
8824
8825        /// Sends the request.
8826        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8827            (*self.0.stub)
8828                .list_operations(self.0.request, self.0.options)
8829                .await
8830                .map(gax::response::Response::into_body)
8831        }
8832
8833        /// Streams each page in the collection.
8834        pub fn by_page(
8835            self,
8836        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8837        {
8838            use std::clone::Clone;
8839            let token = self.0.request.page_token.clone();
8840            let execute = move |token: String| {
8841                let mut builder = self.clone();
8842                builder.0.request = builder.0.request.set_page_token(token);
8843                builder.send()
8844            };
8845            gax::paginator::internal::new_paginator(token, execute)
8846        }
8847
8848        /// Streams each item in the collection.
8849        pub fn by_item(
8850            self,
8851        ) -> impl gax::paginator::ItemPaginator<
8852            longrunning::model::ListOperationsResponse,
8853            gax::error::Error,
8854        > {
8855            use gax::paginator::Paginator;
8856            self.by_page().items()
8857        }
8858
8859        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
8860        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8861            self.0.request.name = v.into();
8862            self
8863        }
8864
8865        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
8866        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8867            self.0.request.filter = v.into();
8868            self
8869        }
8870
8871        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
8872        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8873            self.0.request.page_size = v.into();
8874            self
8875        }
8876
8877        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
8878        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8879            self.0.request.page_token = v.into();
8880            self
8881        }
8882
8883        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
8884        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8885            self.0.request.return_partial_success = v.into();
8886            self
8887        }
8888    }
8889
8890    #[doc(hidden)]
8891    impl gax::options::internal::RequestBuilder for ListOperations {
8892        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8893            &mut self.0.options
8894        }
8895    }
8896
8897    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
8898    ///
8899    /// # Example
8900    /// ```no_run
8901    /// # use google_cloud_discoveryengine_v1::builder;
8902    /// use builder::identity_mapping_store_service::GetOperation;
8903    /// # tokio_test::block_on(async {
8904    ///
8905    /// let builder = prepare_request_builder();
8906    /// let response = builder.send().await?;
8907    /// # gax::Result::<()>::Ok(()) });
8908    ///
8909    /// fn prepare_request_builder() -> GetOperation {
8910    ///   # panic!();
8911    ///   // ... details omitted ...
8912    /// }
8913    /// ```
8914    #[derive(Clone, Debug)]
8915    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8916
8917    impl GetOperation {
8918        pub(crate) fn new(
8919            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8920        ) -> Self {
8921            Self(RequestBuilder::new(stub))
8922        }
8923
8924        /// Sets the full request, replacing any prior values.
8925        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8926            mut self,
8927            v: V,
8928        ) -> Self {
8929            self.0.request = v.into();
8930            self
8931        }
8932
8933        /// Sets all the options, replacing any prior values.
8934        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8935            self.0.options = v.into();
8936            self
8937        }
8938
8939        /// Sends the request.
8940        pub async fn send(self) -> Result<longrunning::model::Operation> {
8941            (*self.0.stub)
8942                .get_operation(self.0.request, self.0.options)
8943                .await
8944                .map(gax::response::Response::into_body)
8945        }
8946
8947        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8949            self.0.request.name = v.into();
8950            self
8951        }
8952    }
8953
8954    #[doc(hidden)]
8955    impl gax::options::internal::RequestBuilder for GetOperation {
8956        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8957            &mut self.0.options
8958        }
8959    }
8960
8961    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
8962    ///
8963    /// # Example
8964    /// ```no_run
8965    /// # use google_cloud_discoveryengine_v1::builder;
8966    /// use builder::identity_mapping_store_service::CancelOperation;
8967    /// # tokio_test::block_on(async {
8968    ///
8969    /// let builder = prepare_request_builder();
8970    /// let response = builder.send().await?;
8971    /// # gax::Result::<()>::Ok(()) });
8972    ///
8973    /// fn prepare_request_builder() -> CancelOperation {
8974    ///   # panic!();
8975    ///   // ... details omitted ...
8976    /// }
8977    /// ```
8978    #[derive(Clone, Debug)]
8979    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8980
8981    impl CancelOperation {
8982        pub(crate) fn new(
8983            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8984        ) -> Self {
8985            Self(RequestBuilder::new(stub))
8986        }
8987
8988        /// Sets the full request, replacing any prior values.
8989        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8990            mut self,
8991            v: V,
8992        ) -> Self {
8993            self.0.request = v.into();
8994            self
8995        }
8996
8997        /// Sets all the options, replacing any prior values.
8998        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8999            self.0.options = v.into();
9000            self
9001        }
9002
9003        /// Sends the request.
9004        pub async fn send(self) -> Result<()> {
9005            (*self.0.stub)
9006                .cancel_operation(self.0.request, self.0.options)
9007                .await
9008                .map(gax::response::Response::into_body)
9009        }
9010
9011        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9012        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9013            self.0.request.name = v.into();
9014            self
9015        }
9016    }
9017
9018    #[doc(hidden)]
9019    impl gax::options::internal::RequestBuilder for CancelOperation {
9020        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9021            &mut self.0.options
9022        }
9023    }
9024}
9025
9026#[cfg(feature = "project-service")]
9027#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9028pub mod project_service {
9029    use crate::Result;
9030
9031    /// A builder for [ProjectService][crate::client::ProjectService].
9032    ///
9033    /// ```
9034    /// # tokio_test::block_on(async {
9035    /// # use google_cloud_discoveryengine_v1::*;
9036    /// # use builder::project_service::ClientBuilder;
9037    /// # use client::ProjectService;
9038    /// let builder : ClientBuilder = ProjectService::builder();
9039    /// let client = builder
9040    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9041    ///     .build().await?;
9042    /// # gax::client_builder::Result::<()>::Ok(()) });
9043    /// ```
9044    pub type ClientBuilder =
9045        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9046
9047    pub(crate) mod client {
9048        use super::super::super::client::ProjectService;
9049        pub struct Factory;
9050        impl gax::client_builder::internal::ClientFactory for Factory {
9051            type Client = ProjectService;
9052            type Credentials = gaxi::options::Credentials;
9053            async fn build(
9054                self,
9055                config: gaxi::options::ClientConfig,
9056            ) -> gax::client_builder::Result<Self::Client> {
9057                Self::Client::new(config).await
9058            }
9059        }
9060    }
9061
9062    /// Common implementation for [crate::client::ProjectService] request builders.
9063    #[derive(Clone, Debug)]
9064    pub(crate) struct RequestBuilder<R: std::default::Default> {
9065        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9066        request: R,
9067        options: gax::options::RequestOptions,
9068    }
9069
9070    impl<R> RequestBuilder<R>
9071    where
9072        R: std::default::Default,
9073    {
9074        pub(crate) fn new(
9075            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9076        ) -> Self {
9077            Self {
9078                stub,
9079                request: R::default(),
9080                options: gax::options::RequestOptions::default(),
9081            }
9082        }
9083    }
9084
9085    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9086    ///
9087    /// # Example
9088    /// ```no_run
9089    /// # use google_cloud_discoveryengine_v1::builder;
9090    /// use builder::project_service::ProvisionProject;
9091    /// # tokio_test::block_on(async {
9092    /// use lro::Poller;
9093    ///
9094    /// let builder = prepare_request_builder();
9095    /// let response = builder.poller().until_done().await?;
9096    /// # gax::Result::<()>::Ok(()) });
9097    ///
9098    /// fn prepare_request_builder() -> ProvisionProject {
9099    ///   # panic!();
9100    ///   // ... details omitted ...
9101    /// }
9102    /// ```
9103    #[derive(Clone, Debug)]
9104    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9105
9106    impl ProvisionProject {
9107        pub(crate) fn new(
9108            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9109        ) -> Self {
9110            Self(RequestBuilder::new(stub))
9111        }
9112
9113        /// Sets the full request, replacing any prior values.
9114        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9115            mut self,
9116            v: V,
9117        ) -> Self {
9118            self.0.request = v.into();
9119            self
9120        }
9121
9122        /// Sets all the options, replacing any prior values.
9123        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9124            self.0.options = v.into();
9125            self
9126        }
9127
9128        /// Sends the request.
9129        ///
9130        /// # Long running operations
9131        ///
9132        /// This starts, but does not poll, a longrunning operation. More information
9133        /// on [provision_project][crate::client::ProjectService::provision_project].
9134        pub async fn send(self) -> Result<longrunning::model::Operation> {
9135            (*self.0.stub)
9136                .provision_project(self.0.request, self.0.options)
9137                .await
9138                .map(gax::response::Response::into_body)
9139        }
9140
9141        /// Creates a [Poller][lro::Poller] to work with `provision_project`.
9142        pub fn poller(
9143            self,
9144        ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9145        {
9146            type Operation = lro::internal::Operation<
9147                crate::model::Project,
9148                crate::model::ProvisionProjectMetadata,
9149            >;
9150            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9151            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9152
9153            let stub = self.0.stub.clone();
9154            let mut options = self.0.options.clone();
9155            options.set_retry_policy(gax::retry_policy::NeverRetry);
9156            let query = move |name| {
9157                let stub = stub.clone();
9158                let options = options.clone();
9159                async {
9160                    let op = GetOperation::new(stub)
9161                        .set_name(name)
9162                        .with_options(options)
9163                        .send()
9164                        .await?;
9165                    Ok(Operation::new(op))
9166                }
9167            };
9168
9169            let start = move || async {
9170                let op = self.send().await?;
9171                Ok(Operation::new(op))
9172            };
9173
9174            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9175        }
9176
9177        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9178        ///
9179        /// This is a **required** field for requests.
9180        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9181            self.0.request.name = v.into();
9182            self
9183        }
9184
9185        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9186        ///
9187        /// This is a **required** field for requests.
9188        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9189            self.0.request.accept_data_use_terms = v.into();
9190            self
9191        }
9192
9193        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9194        ///
9195        /// This is a **required** field for requests.
9196        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9197            self.0.request.data_use_terms_version = v.into();
9198            self
9199        }
9200    }
9201
9202    #[doc(hidden)]
9203    impl gax::options::internal::RequestBuilder for ProvisionProject {
9204        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9205            &mut self.0.options
9206        }
9207    }
9208
9209    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9210    ///
9211    /// # Example
9212    /// ```no_run
9213    /// # use google_cloud_discoveryengine_v1::builder;
9214    /// use builder::project_service::ListOperations;
9215    /// # tokio_test::block_on(async {
9216    /// use gax::paginator::ItemPaginator;
9217    ///
9218    /// let builder = prepare_request_builder();
9219    /// let mut items = builder.by_item();
9220    /// while let Some(result) = items.next().await {
9221    ///   let item = result?;
9222    /// }
9223    /// # gax::Result::<()>::Ok(()) });
9224    ///
9225    /// fn prepare_request_builder() -> ListOperations {
9226    ///   # panic!();
9227    ///   // ... details omitted ...
9228    /// }
9229    /// ```
9230    #[derive(Clone, Debug)]
9231    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9232
9233    impl ListOperations {
9234        pub(crate) fn new(
9235            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9236        ) -> Self {
9237            Self(RequestBuilder::new(stub))
9238        }
9239
9240        /// Sets the full request, replacing any prior values.
9241        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9242            mut self,
9243            v: V,
9244        ) -> Self {
9245            self.0.request = v.into();
9246            self
9247        }
9248
9249        /// Sets all the options, replacing any prior values.
9250        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9251            self.0.options = v.into();
9252            self
9253        }
9254
9255        /// Sends the request.
9256        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9257            (*self.0.stub)
9258                .list_operations(self.0.request, self.0.options)
9259                .await
9260                .map(gax::response::Response::into_body)
9261        }
9262
9263        /// Streams each page in the collection.
9264        pub fn by_page(
9265            self,
9266        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9267        {
9268            use std::clone::Clone;
9269            let token = self.0.request.page_token.clone();
9270            let execute = move |token: String| {
9271                let mut builder = self.clone();
9272                builder.0.request = builder.0.request.set_page_token(token);
9273                builder.send()
9274            };
9275            gax::paginator::internal::new_paginator(token, execute)
9276        }
9277
9278        /// Streams each item in the collection.
9279        pub fn by_item(
9280            self,
9281        ) -> impl gax::paginator::ItemPaginator<
9282            longrunning::model::ListOperationsResponse,
9283            gax::error::Error,
9284        > {
9285            use gax::paginator::Paginator;
9286            self.by_page().items()
9287        }
9288
9289        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9290        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9291            self.0.request.name = v.into();
9292            self
9293        }
9294
9295        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9296        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9297            self.0.request.filter = v.into();
9298            self
9299        }
9300
9301        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9302        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9303            self.0.request.page_size = v.into();
9304            self
9305        }
9306
9307        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9308        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9309            self.0.request.page_token = v.into();
9310            self
9311        }
9312
9313        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
9314        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9315            self.0.request.return_partial_success = v.into();
9316            self
9317        }
9318    }
9319
9320    #[doc(hidden)]
9321    impl gax::options::internal::RequestBuilder for ListOperations {
9322        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9323            &mut self.0.options
9324        }
9325    }
9326
9327    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9328    ///
9329    /// # Example
9330    /// ```no_run
9331    /// # use google_cloud_discoveryengine_v1::builder;
9332    /// use builder::project_service::GetOperation;
9333    /// # tokio_test::block_on(async {
9334    ///
9335    /// let builder = prepare_request_builder();
9336    /// let response = builder.send().await?;
9337    /// # gax::Result::<()>::Ok(()) });
9338    ///
9339    /// fn prepare_request_builder() -> GetOperation {
9340    ///   # panic!();
9341    ///   // ... details omitted ...
9342    /// }
9343    /// ```
9344    #[derive(Clone, Debug)]
9345    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9346
9347    impl GetOperation {
9348        pub(crate) fn new(
9349            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9350        ) -> Self {
9351            Self(RequestBuilder::new(stub))
9352        }
9353
9354        /// Sets the full request, replacing any prior values.
9355        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9356            mut self,
9357            v: V,
9358        ) -> Self {
9359            self.0.request = v.into();
9360            self
9361        }
9362
9363        /// Sets all the options, replacing any prior values.
9364        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9365            self.0.options = v.into();
9366            self
9367        }
9368
9369        /// Sends the request.
9370        pub async fn send(self) -> Result<longrunning::model::Operation> {
9371            (*self.0.stub)
9372                .get_operation(self.0.request, self.0.options)
9373                .await
9374                .map(gax::response::Response::into_body)
9375        }
9376
9377        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9378        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9379            self.0.request.name = v.into();
9380            self
9381        }
9382    }
9383
9384    #[doc(hidden)]
9385    impl gax::options::internal::RequestBuilder for GetOperation {
9386        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9387            &mut self.0.options
9388        }
9389    }
9390
9391    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9392    ///
9393    /// # Example
9394    /// ```no_run
9395    /// # use google_cloud_discoveryengine_v1::builder;
9396    /// use builder::project_service::CancelOperation;
9397    /// # tokio_test::block_on(async {
9398    ///
9399    /// let builder = prepare_request_builder();
9400    /// let response = builder.send().await?;
9401    /// # gax::Result::<()>::Ok(()) });
9402    ///
9403    /// fn prepare_request_builder() -> CancelOperation {
9404    ///   # panic!();
9405    ///   // ... details omitted ...
9406    /// }
9407    /// ```
9408    #[derive(Clone, Debug)]
9409    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9410
9411    impl CancelOperation {
9412        pub(crate) fn new(
9413            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9414        ) -> Self {
9415            Self(RequestBuilder::new(stub))
9416        }
9417
9418        /// Sets the full request, replacing any prior values.
9419        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9420            mut self,
9421            v: V,
9422        ) -> Self {
9423            self.0.request = v.into();
9424            self
9425        }
9426
9427        /// Sets all the options, replacing any prior values.
9428        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9429            self.0.options = v.into();
9430            self
9431        }
9432
9433        /// Sends the request.
9434        pub async fn send(self) -> Result<()> {
9435            (*self.0.stub)
9436                .cancel_operation(self.0.request, self.0.options)
9437                .await
9438                .map(gax::response::Response::into_body)
9439        }
9440
9441        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9442        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9443            self.0.request.name = v.into();
9444            self
9445        }
9446    }
9447
9448    #[doc(hidden)]
9449    impl gax::options::internal::RequestBuilder for CancelOperation {
9450        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9451            &mut self.0.options
9452        }
9453    }
9454}
9455
9456#[cfg(feature = "rank-service")]
9457#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9458pub mod rank_service {
9459    use crate::Result;
9460
9461    /// A builder for [RankService][crate::client::RankService].
9462    ///
9463    /// ```
9464    /// # tokio_test::block_on(async {
9465    /// # use google_cloud_discoveryengine_v1::*;
9466    /// # use builder::rank_service::ClientBuilder;
9467    /// # use client::RankService;
9468    /// let builder : ClientBuilder = RankService::builder();
9469    /// let client = builder
9470    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9471    ///     .build().await?;
9472    /// # gax::client_builder::Result::<()>::Ok(()) });
9473    /// ```
9474    pub type ClientBuilder =
9475        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9476
9477    pub(crate) mod client {
9478        use super::super::super::client::RankService;
9479        pub struct Factory;
9480        impl gax::client_builder::internal::ClientFactory for Factory {
9481            type Client = RankService;
9482            type Credentials = gaxi::options::Credentials;
9483            async fn build(
9484                self,
9485                config: gaxi::options::ClientConfig,
9486            ) -> gax::client_builder::Result<Self::Client> {
9487                Self::Client::new(config).await
9488            }
9489        }
9490    }
9491
9492    /// Common implementation for [crate::client::RankService] request builders.
9493    #[derive(Clone, Debug)]
9494    pub(crate) struct RequestBuilder<R: std::default::Default> {
9495        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9496        request: R,
9497        options: gax::options::RequestOptions,
9498    }
9499
9500    impl<R> RequestBuilder<R>
9501    where
9502        R: std::default::Default,
9503    {
9504        pub(crate) fn new(
9505            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9506        ) -> Self {
9507            Self {
9508                stub,
9509                request: R::default(),
9510                options: gax::options::RequestOptions::default(),
9511            }
9512        }
9513    }
9514
9515    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9516    ///
9517    /// # Example
9518    /// ```no_run
9519    /// # use google_cloud_discoveryengine_v1::builder;
9520    /// use builder::rank_service::Rank;
9521    /// # tokio_test::block_on(async {
9522    ///
9523    /// let builder = prepare_request_builder();
9524    /// let response = builder.send().await?;
9525    /// # gax::Result::<()>::Ok(()) });
9526    ///
9527    /// fn prepare_request_builder() -> Rank {
9528    ///   # panic!();
9529    ///   // ... details omitted ...
9530    /// }
9531    /// ```
9532    #[derive(Clone, Debug)]
9533    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9534
9535    impl Rank {
9536        pub(crate) fn new(
9537            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9538        ) -> Self {
9539            Self(RequestBuilder::new(stub))
9540        }
9541
9542        /// Sets the full request, replacing any prior values.
9543        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9544            self.0.request = v.into();
9545            self
9546        }
9547
9548        /// Sets all the options, replacing any prior values.
9549        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9550            self.0.options = v.into();
9551            self
9552        }
9553
9554        /// Sends the request.
9555        pub async fn send(self) -> Result<crate::model::RankResponse> {
9556            (*self.0.stub)
9557                .rank(self.0.request, self.0.options)
9558                .await
9559                .map(gax::response::Response::into_body)
9560        }
9561
9562        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9563        ///
9564        /// This is a **required** field for requests.
9565        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9566            self.0.request.ranking_config = v.into();
9567            self
9568        }
9569
9570        /// Sets the value of [model][crate::model::RankRequest::model].
9571        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9572            self.0.request.model = v.into();
9573            self
9574        }
9575
9576        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9577        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9578            self.0.request.top_n = v.into();
9579            self
9580        }
9581
9582        /// Sets the value of [query][crate::model::RankRequest::query].
9583        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9584            self.0.request.query = v.into();
9585            self
9586        }
9587
9588        /// Sets the value of [records][crate::model::RankRequest::records].
9589        ///
9590        /// This is a **required** field for requests.
9591        pub fn set_records<T, V>(mut self, v: T) -> Self
9592        where
9593            T: std::iter::IntoIterator<Item = V>,
9594            V: std::convert::Into<crate::model::RankingRecord>,
9595        {
9596            use std::iter::Iterator;
9597            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9598            self
9599        }
9600
9601        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9602        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9603            self.0.request.ignore_record_details_in_response = v.into();
9604            self
9605        }
9606
9607        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9608        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9609        where
9610            T: std::iter::IntoIterator<Item = (K, V)>,
9611            K: std::convert::Into<std::string::String>,
9612            V: std::convert::Into<std::string::String>,
9613        {
9614            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9615            self
9616        }
9617    }
9618
9619    #[doc(hidden)]
9620    impl gax::options::internal::RequestBuilder for Rank {
9621        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9622            &mut self.0.options
9623        }
9624    }
9625
9626    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9627    ///
9628    /// # Example
9629    /// ```no_run
9630    /// # use google_cloud_discoveryengine_v1::builder;
9631    /// use builder::rank_service::ListOperations;
9632    /// # tokio_test::block_on(async {
9633    /// use gax::paginator::ItemPaginator;
9634    ///
9635    /// let builder = prepare_request_builder();
9636    /// let mut items = builder.by_item();
9637    /// while let Some(result) = items.next().await {
9638    ///   let item = result?;
9639    /// }
9640    /// # gax::Result::<()>::Ok(()) });
9641    ///
9642    /// fn prepare_request_builder() -> ListOperations {
9643    ///   # panic!();
9644    ///   // ... details omitted ...
9645    /// }
9646    /// ```
9647    #[derive(Clone, Debug)]
9648    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9649
9650    impl ListOperations {
9651        pub(crate) fn new(
9652            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9653        ) -> Self {
9654            Self(RequestBuilder::new(stub))
9655        }
9656
9657        /// Sets the full request, replacing any prior values.
9658        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9659            mut self,
9660            v: V,
9661        ) -> Self {
9662            self.0.request = v.into();
9663            self
9664        }
9665
9666        /// Sets all the options, replacing any prior values.
9667        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9668            self.0.options = v.into();
9669            self
9670        }
9671
9672        /// Sends the request.
9673        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9674            (*self.0.stub)
9675                .list_operations(self.0.request, self.0.options)
9676                .await
9677                .map(gax::response::Response::into_body)
9678        }
9679
9680        /// Streams each page in the collection.
9681        pub fn by_page(
9682            self,
9683        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9684        {
9685            use std::clone::Clone;
9686            let token = self.0.request.page_token.clone();
9687            let execute = move |token: String| {
9688                let mut builder = self.clone();
9689                builder.0.request = builder.0.request.set_page_token(token);
9690                builder.send()
9691            };
9692            gax::paginator::internal::new_paginator(token, execute)
9693        }
9694
9695        /// Streams each item in the collection.
9696        pub fn by_item(
9697            self,
9698        ) -> impl gax::paginator::ItemPaginator<
9699            longrunning::model::ListOperationsResponse,
9700            gax::error::Error,
9701        > {
9702            use gax::paginator::Paginator;
9703            self.by_page().items()
9704        }
9705
9706        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9707        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9708            self.0.request.name = v.into();
9709            self
9710        }
9711
9712        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9713        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9714            self.0.request.filter = v.into();
9715            self
9716        }
9717
9718        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9719        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9720            self.0.request.page_size = v.into();
9721            self
9722        }
9723
9724        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9725        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9726            self.0.request.page_token = v.into();
9727            self
9728        }
9729
9730        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
9731        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9732            self.0.request.return_partial_success = v.into();
9733            self
9734        }
9735    }
9736
9737    #[doc(hidden)]
9738    impl gax::options::internal::RequestBuilder for ListOperations {
9739        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9740            &mut self.0.options
9741        }
9742    }
9743
9744    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9745    ///
9746    /// # Example
9747    /// ```no_run
9748    /// # use google_cloud_discoveryengine_v1::builder;
9749    /// use builder::rank_service::GetOperation;
9750    /// # tokio_test::block_on(async {
9751    ///
9752    /// let builder = prepare_request_builder();
9753    /// let response = builder.send().await?;
9754    /// # gax::Result::<()>::Ok(()) });
9755    ///
9756    /// fn prepare_request_builder() -> GetOperation {
9757    ///   # panic!();
9758    ///   // ... details omitted ...
9759    /// }
9760    /// ```
9761    #[derive(Clone, Debug)]
9762    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9763
9764    impl GetOperation {
9765        pub(crate) fn new(
9766            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9767        ) -> Self {
9768            Self(RequestBuilder::new(stub))
9769        }
9770
9771        /// Sets the full request, replacing any prior values.
9772        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9773            mut self,
9774            v: V,
9775        ) -> Self {
9776            self.0.request = v.into();
9777            self
9778        }
9779
9780        /// Sets all the options, replacing any prior values.
9781        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9782            self.0.options = v.into();
9783            self
9784        }
9785
9786        /// Sends the request.
9787        pub async fn send(self) -> Result<longrunning::model::Operation> {
9788            (*self.0.stub)
9789                .get_operation(self.0.request, self.0.options)
9790                .await
9791                .map(gax::response::Response::into_body)
9792        }
9793
9794        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9795        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9796            self.0.request.name = v.into();
9797            self
9798        }
9799    }
9800
9801    #[doc(hidden)]
9802    impl gax::options::internal::RequestBuilder for GetOperation {
9803        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9804            &mut self.0.options
9805        }
9806    }
9807
9808    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
9809    ///
9810    /// # Example
9811    /// ```no_run
9812    /// # use google_cloud_discoveryengine_v1::builder;
9813    /// use builder::rank_service::CancelOperation;
9814    /// # tokio_test::block_on(async {
9815    ///
9816    /// let builder = prepare_request_builder();
9817    /// let response = builder.send().await?;
9818    /// # gax::Result::<()>::Ok(()) });
9819    ///
9820    /// fn prepare_request_builder() -> CancelOperation {
9821    ///   # panic!();
9822    ///   // ... details omitted ...
9823    /// }
9824    /// ```
9825    #[derive(Clone, Debug)]
9826    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9827
9828    impl CancelOperation {
9829        pub(crate) fn new(
9830            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9831        ) -> Self {
9832            Self(RequestBuilder::new(stub))
9833        }
9834
9835        /// Sets the full request, replacing any prior values.
9836        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9837            mut self,
9838            v: V,
9839        ) -> Self {
9840            self.0.request = v.into();
9841            self
9842        }
9843
9844        /// Sets all the options, replacing any prior values.
9845        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9846            self.0.options = v.into();
9847            self
9848        }
9849
9850        /// Sends the request.
9851        pub async fn send(self) -> Result<()> {
9852            (*self.0.stub)
9853                .cancel_operation(self.0.request, self.0.options)
9854                .await
9855                .map(gax::response::Response::into_body)
9856        }
9857
9858        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9859        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9860            self.0.request.name = v.into();
9861            self
9862        }
9863    }
9864
9865    #[doc(hidden)]
9866    impl gax::options::internal::RequestBuilder for CancelOperation {
9867        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9868            &mut self.0.options
9869        }
9870    }
9871}
9872
9873#[cfg(feature = "recommendation-service")]
9874#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9875pub mod recommendation_service {
9876    use crate::Result;
9877
9878    /// A builder for [RecommendationService][crate::client::RecommendationService].
9879    ///
9880    /// ```
9881    /// # tokio_test::block_on(async {
9882    /// # use google_cloud_discoveryengine_v1::*;
9883    /// # use builder::recommendation_service::ClientBuilder;
9884    /// # use client::RecommendationService;
9885    /// let builder : ClientBuilder = RecommendationService::builder();
9886    /// let client = builder
9887    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9888    ///     .build().await?;
9889    /// # gax::client_builder::Result::<()>::Ok(()) });
9890    /// ```
9891    pub type ClientBuilder =
9892        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9893
9894    pub(crate) mod client {
9895        use super::super::super::client::RecommendationService;
9896        pub struct Factory;
9897        impl gax::client_builder::internal::ClientFactory for Factory {
9898            type Client = RecommendationService;
9899            type Credentials = gaxi::options::Credentials;
9900            async fn build(
9901                self,
9902                config: gaxi::options::ClientConfig,
9903            ) -> gax::client_builder::Result<Self::Client> {
9904                Self::Client::new(config).await
9905            }
9906        }
9907    }
9908
9909    /// Common implementation for [crate::client::RecommendationService] request builders.
9910    #[derive(Clone, Debug)]
9911    pub(crate) struct RequestBuilder<R: std::default::Default> {
9912        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9913        request: R,
9914        options: gax::options::RequestOptions,
9915    }
9916
9917    impl<R> RequestBuilder<R>
9918    where
9919        R: std::default::Default,
9920    {
9921        pub(crate) fn new(
9922            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9923        ) -> Self {
9924            Self {
9925                stub,
9926                request: R::default(),
9927                options: gax::options::RequestOptions::default(),
9928            }
9929        }
9930    }
9931
9932    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
9933    ///
9934    /// # Example
9935    /// ```no_run
9936    /// # use google_cloud_discoveryengine_v1::builder;
9937    /// use builder::recommendation_service::Recommend;
9938    /// # tokio_test::block_on(async {
9939    ///
9940    /// let builder = prepare_request_builder();
9941    /// let response = builder.send().await?;
9942    /// # gax::Result::<()>::Ok(()) });
9943    ///
9944    /// fn prepare_request_builder() -> Recommend {
9945    ///   # panic!();
9946    ///   // ... details omitted ...
9947    /// }
9948    /// ```
9949    #[derive(Clone, Debug)]
9950    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9951
9952    impl Recommend {
9953        pub(crate) fn new(
9954            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9955        ) -> Self {
9956            Self(RequestBuilder::new(stub))
9957        }
9958
9959        /// Sets the full request, replacing any prior values.
9960        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9961            self.0.request = v.into();
9962            self
9963        }
9964
9965        /// Sets all the options, replacing any prior values.
9966        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9967            self.0.options = v.into();
9968            self
9969        }
9970
9971        /// Sends the request.
9972        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9973            (*self.0.stub)
9974                .recommend(self.0.request, self.0.options)
9975                .await
9976                .map(gax::response::Response::into_body)
9977        }
9978
9979        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
9980        ///
9981        /// This is a **required** field for requests.
9982        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9983            self.0.request.serving_config = v.into();
9984            self
9985        }
9986
9987        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
9988        ///
9989        /// This is a **required** field for requests.
9990        pub fn set_user_event<T>(mut self, v: T) -> Self
9991        where
9992            T: std::convert::Into<crate::model::UserEvent>,
9993        {
9994            self.0.request.user_event = std::option::Option::Some(v.into());
9995            self
9996        }
9997
9998        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
9999        ///
10000        /// This is a **required** field for requests.
10001        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10002        where
10003            T: std::convert::Into<crate::model::UserEvent>,
10004        {
10005            self.0.request.user_event = v.map(|x| x.into());
10006            self
10007        }
10008
10009        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
10010        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10011            self.0.request.page_size = v.into();
10012            self
10013        }
10014
10015        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
10016        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10017            self.0.request.filter = v.into();
10018            self
10019        }
10020
10021        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
10022        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10023            self.0.request.validate_only = v.into();
10024            self
10025        }
10026
10027        /// Sets the value of [params][crate::model::RecommendRequest::params].
10028        pub fn set_params<T, K, V>(mut self, v: T) -> Self
10029        where
10030            T: std::iter::IntoIterator<Item = (K, V)>,
10031            K: std::convert::Into<std::string::String>,
10032            V: std::convert::Into<wkt::Value>,
10033        {
10034            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10035            self
10036        }
10037
10038        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
10039        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10040        where
10041            T: std::iter::IntoIterator<Item = (K, V)>,
10042            K: std::convert::Into<std::string::String>,
10043            V: std::convert::Into<std::string::String>,
10044        {
10045            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10046            self
10047        }
10048    }
10049
10050    #[doc(hidden)]
10051    impl gax::options::internal::RequestBuilder for Recommend {
10052        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10053            &mut self.0.options
10054        }
10055    }
10056
10057    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
10058    ///
10059    /// # Example
10060    /// ```no_run
10061    /// # use google_cloud_discoveryengine_v1::builder;
10062    /// use builder::recommendation_service::ListOperations;
10063    /// # tokio_test::block_on(async {
10064    /// use gax::paginator::ItemPaginator;
10065    ///
10066    /// let builder = prepare_request_builder();
10067    /// let mut items = builder.by_item();
10068    /// while let Some(result) = items.next().await {
10069    ///   let item = result?;
10070    /// }
10071    /// # gax::Result::<()>::Ok(()) });
10072    ///
10073    /// fn prepare_request_builder() -> ListOperations {
10074    ///   # panic!();
10075    ///   // ... details omitted ...
10076    /// }
10077    /// ```
10078    #[derive(Clone, Debug)]
10079    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10080
10081    impl ListOperations {
10082        pub(crate) fn new(
10083            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10084        ) -> Self {
10085            Self(RequestBuilder::new(stub))
10086        }
10087
10088        /// Sets the full request, replacing any prior values.
10089        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10090            mut self,
10091            v: V,
10092        ) -> Self {
10093            self.0.request = v.into();
10094            self
10095        }
10096
10097        /// Sets all the options, replacing any prior values.
10098        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10099            self.0.options = v.into();
10100            self
10101        }
10102
10103        /// Sends the request.
10104        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10105            (*self.0.stub)
10106                .list_operations(self.0.request, self.0.options)
10107                .await
10108                .map(gax::response::Response::into_body)
10109        }
10110
10111        /// Streams each page in the collection.
10112        pub fn by_page(
10113            self,
10114        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10115        {
10116            use std::clone::Clone;
10117            let token = self.0.request.page_token.clone();
10118            let execute = move |token: String| {
10119                let mut builder = self.clone();
10120                builder.0.request = builder.0.request.set_page_token(token);
10121                builder.send()
10122            };
10123            gax::paginator::internal::new_paginator(token, execute)
10124        }
10125
10126        /// Streams each item in the collection.
10127        pub fn by_item(
10128            self,
10129        ) -> impl gax::paginator::ItemPaginator<
10130            longrunning::model::ListOperationsResponse,
10131            gax::error::Error,
10132        > {
10133            use gax::paginator::Paginator;
10134            self.by_page().items()
10135        }
10136
10137        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10138        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10139            self.0.request.name = v.into();
10140            self
10141        }
10142
10143        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10144        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10145            self.0.request.filter = v.into();
10146            self
10147        }
10148
10149        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10150        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10151            self.0.request.page_size = v.into();
10152            self
10153        }
10154
10155        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10156        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10157            self.0.request.page_token = v.into();
10158            self
10159        }
10160
10161        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
10162        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10163            self.0.request.return_partial_success = v.into();
10164            self
10165        }
10166    }
10167
10168    #[doc(hidden)]
10169    impl gax::options::internal::RequestBuilder for ListOperations {
10170        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10171            &mut self.0.options
10172        }
10173    }
10174
10175    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10176    ///
10177    /// # Example
10178    /// ```no_run
10179    /// # use google_cloud_discoveryengine_v1::builder;
10180    /// use builder::recommendation_service::GetOperation;
10181    /// # tokio_test::block_on(async {
10182    ///
10183    /// let builder = prepare_request_builder();
10184    /// let response = builder.send().await?;
10185    /// # gax::Result::<()>::Ok(()) });
10186    ///
10187    /// fn prepare_request_builder() -> GetOperation {
10188    ///   # panic!();
10189    ///   // ... details omitted ...
10190    /// }
10191    /// ```
10192    #[derive(Clone, Debug)]
10193    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10194
10195    impl GetOperation {
10196        pub(crate) fn new(
10197            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10198        ) -> Self {
10199            Self(RequestBuilder::new(stub))
10200        }
10201
10202        /// Sets the full request, replacing any prior values.
10203        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10204            mut self,
10205            v: V,
10206        ) -> Self {
10207            self.0.request = v.into();
10208            self
10209        }
10210
10211        /// Sets all the options, replacing any prior values.
10212        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10213            self.0.options = v.into();
10214            self
10215        }
10216
10217        /// Sends the request.
10218        pub async fn send(self) -> Result<longrunning::model::Operation> {
10219            (*self.0.stub)
10220                .get_operation(self.0.request, self.0.options)
10221                .await
10222                .map(gax::response::Response::into_body)
10223        }
10224
10225        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
10226        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10227            self.0.request.name = v.into();
10228            self
10229        }
10230    }
10231
10232    #[doc(hidden)]
10233    impl gax::options::internal::RequestBuilder for GetOperation {
10234        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10235            &mut self.0.options
10236        }
10237    }
10238
10239    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10240    ///
10241    /// # Example
10242    /// ```no_run
10243    /// # use google_cloud_discoveryengine_v1::builder;
10244    /// use builder::recommendation_service::CancelOperation;
10245    /// # tokio_test::block_on(async {
10246    ///
10247    /// let builder = prepare_request_builder();
10248    /// let response = builder.send().await?;
10249    /// # gax::Result::<()>::Ok(()) });
10250    ///
10251    /// fn prepare_request_builder() -> CancelOperation {
10252    ///   # panic!();
10253    ///   // ... details omitted ...
10254    /// }
10255    /// ```
10256    #[derive(Clone, Debug)]
10257    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10258
10259    impl CancelOperation {
10260        pub(crate) fn new(
10261            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10262        ) -> Self {
10263            Self(RequestBuilder::new(stub))
10264        }
10265
10266        /// Sets the full request, replacing any prior values.
10267        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10268            mut self,
10269            v: V,
10270        ) -> Self {
10271            self.0.request = v.into();
10272            self
10273        }
10274
10275        /// Sets all the options, replacing any prior values.
10276        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10277            self.0.options = v.into();
10278            self
10279        }
10280
10281        /// Sends the request.
10282        pub async fn send(self) -> Result<()> {
10283            (*self.0.stub)
10284                .cancel_operation(self.0.request, self.0.options)
10285                .await
10286                .map(gax::response::Response::into_body)
10287        }
10288
10289        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
10290        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10291            self.0.request.name = v.into();
10292            self
10293        }
10294    }
10295
10296    #[doc(hidden)]
10297    impl gax::options::internal::RequestBuilder for CancelOperation {
10298        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10299            &mut self.0.options
10300        }
10301    }
10302}
10303
10304#[cfg(feature = "schema-service")]
10305#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10306pub mod schema_service {
10307    use crate::Result;
10308
10309    /// A builder for [SchemaService][crate::client::SchemaService].
10310    ///
10311    /// ```
10312    /// # tokio_test::block_on(async {
10313    /// # use google_cloud_discoveryengine_v1::*;
10314    /// # use builder::schema_service::ClientBuilder;
10315    /// # use client::SchemaService;
10316    /// let builder : ClientBuilder = SchemaService::builder();
10317    /// let client = builder
10318    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10319    ///     .build().await?;
10320    /// # gax::client_builder::Result::<()>::Ok(()) });
10321    /// ```
10322    pub type ClientBuilder =
10323        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10324
10325    pub(crate) mod client {
10326        use super::super::super::client::SchemaService;
10327        pub struct Factory;
10328        impl gax::client_builder::internal::ClientFactory for Factory {
10329            type Client = SchemaService;
10330            type Credentials = gaxi::options::Credentials;
10331            async fn build(
10332                self,
10333                config: gaxi::options::ClientConfig,
10334            ) -> gax::client_builder::Result<Self::Client> {
10335                Self::Client::new(config).await
10336            }
10337        }
10338    }
10339
10340    /// Common implementation for [crate::client::SchemaService] request builders.
10341    #[derive(Clone, Debug)]
10342    pub(crate) struct RequestBuilder<R: std::default::Default> {
10343        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10344        request: R,
10345        options: gax::options::RequestOptions,
10346    }
10347
10348    impl<R> RequestBuilder<R>
10349    where
10350        R: std::default::Default,
10351    {
10352        pub(crate) fn new(
10353            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10354        ) -> Self {
10355            Self {
10356                stub,
10357                request: R::default(),
10358                options: gax::options::RequestOptions::default(),
10359            }
10360        }
10361    }
10362
10363    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10364    ///
10365    /// # Example
10366    /// ```no_run
10367    /// # use google_cloud_discoveryengine_v1::builder;
10368    /// use builder::schema_service::GetSchema;
10369    /// # tokio_test::block_on(async {
10370    ///
10371    /// let builder = prepare_request_builder();
10372    /// let response = builder.send().await?;
10373    /// # gax::Result::<()>::Ok(()) });
10374    ///
10375    /// fn prepare_request_builder() -> GetSchema {
10376    ///   # panic!();
10377    ///   // ... details omitted ...
10378    /// }
10379    /// ```
10380    #[derive(Clone, Debug)]
10381    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10382
10383    impl GetSchema {
10384        pub(crate) fn new(
10385            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10386        ) -> Self {
10387            Self(RequestBuilder::new(stub))
10388        }
10389
10390        /// Sets the full request, replacing any prior values.
10391        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10392            self.0.request = v.into();
10393            self
10394        }
10395
10396        /// Sets all the options, replacing any prior values.
10397        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10398            self.0.options = v.into();
10399            self
10400        }
10401
10402        /// Sends the request.
10403        pub async fn send(self) -> Result<crate::model::Schema> {
10404            (*self.0.stub)
10405                .get_schema(self.0.request, self.0.options)
10406                .await
10407                .map(gax::response::Response::into_body)
10408        }
10409
10410        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10411        ///
10412        /// This is a **required** field for requests.
10413        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10414            self.0.request.name = v.into();
10415            self
10416        }
10417    }
10418
10419    #[doc(hidden)]
10420    impl gax::options::internal::RequestBuilder for GetSchema {
10421        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10422            &mut self.0.options
10423        }
10424    }
10425
10426    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10427    ///
10428    /// # Example
10429    /// ```no_run
10430    /// # use google_cloud_discoveryengine_v1::builder;
10431    /// use builder::schema_service::ListSchemas;
10432    /// # tokio_test::block_on(async {
10433    /// use gax::paginator::ItemPaginator;
10434    ///
10435    /// let builder = prepare_request_builder();
10436    /// let mut items = builder.by_item();
10437    /// while let Some(result) = items.next().await {
10438    ///   let item = result?;
10439    /// }
10440    /// # gax::Result::<()>::Ok(()) });
10441    ///
10442    /// fn prepare_request_builder() -> ListSchemas {
10443    ///   # panic!();
10444    ///   // ... details omitted ...
10445    /// }
10446    /// ```
10447    #[derive(Clone, Debug)]
10448    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10449
10450    impl ListSchemas {
10451        pub(crate) fn new(
10452            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10453        ) -> Self {
10454            Self(RequestBuilder::new(stub))
10455        }
10456
10457        /// Sets the full request, replacing any prior values.
10458        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10459            self.0.request = v.into();
10460            self
10461        }
10462
10463        /// Sets all the options, replacing any prior values.
10464        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10465            self.0.options = v.into();
10466            self
10467        }
10468
10469        /// Sends the request.
10470        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10471            (*self.0.stub)
10472                .list_schemas(self.0.request, self.0.options)
10473                .await
10474                .map(gax::response::Response::into_body)
10475        }
10476
10477        /// Streams each page in the collection.
10478        pub fn by_page(
10479            self,
10480        ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10481        {
10482            use std::clone::Clone;
10483            let token = self.0.request.page_token.clone();
10484            let execute = move |token: String| {
10485                let mut builder = self.clone();
10486                builder.0.request = builder.0.request.set_page_token(token);
10487                builder.send()
10488            };
10489            gax::paginator::internal::new_paginator(token, execute)
10490        }
10491
10492        /// Streams each item in the collection.
10493        pub fn by_item(
10494            self,
10495        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10496        {
10497            use gax::paginator::Paginator;
10498            self.by_page().items()
10499        }
10500
10501        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10502        ///
10503        /// This is a **required** field for requests.
10504        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10505            self.0.request.parent = v.into();
10506            self
10507        }
10508
10509        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10510        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10511            self.0.request.page_size = v.into();
10512            self
10513        }
10514
10515        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10516        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10517            self.0.request.page_token = v.into();
10518            self
10519        }
10520    }
10521
10522    #[doc(hidden)]
10523    impl gax::options::internal::RequestBuilder for ListSchemas {
10524        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10525            &mut self.0.options
10526        }
10527    }
10528
10529    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10530    ///
10531    /// # Example
10532    /// ```no_run
10533    /// # use google_cloud_discoveryengine_v1::builder;
10534    /// use builder::schema_service::CreateSchema;
10535    /// # tokio_test::block_on(async {
10536    /// use lro::Poller;
10537    ///
10538    /// let builder = prepare_request_builder();
10539    /// let response = builder.poller().until_done().await?;
10540    /// # gax::Result::<()>::Ok(()) });
10541    ///
10542    /// fn prepare_request_builder() -> CreateSchema {
10543    ///   # panic!();
10544    ///   // ... details omitted ...
10545    /// }
10546    /// ```
10547    #[derive(Clone, Debug)]
10548    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10549
10550    impl CreateSchema {
10551        pub(crate) fn new(
10552            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10553        ) -> Self {
10554            Self(RequestBuilder::new(stub))
10555        }
10556
10557        /// Sets the full request, replacing any prior values.
10558        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10559            self.0.request = v.into();
10560            self
10561        }
10562
10563        /// Sets all the options, replacing any prior values.
10564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10565            self.0.options = v.into();
10566            self
10567        }
10568
10569        /// Sends the request.
10570        ///
10571        /// # Long running operations
10572        ///
10573        /// This starts, but does not poll, a longrunning operation. More information
10574        /// on [create_schema][crate::client::SchemaService::create_schema].
10575        pub async fn send(self) -> Result<longrunning::model::Operation> {
10576            (*self.0.stub)
10577                .create_schema(self.0.request, self.0.options)
10578                .await
10579                .map(gax::response::Response::into_body)
10580        }
10581
10582        /// Creates a [Poller][lro::Poller] to work with `create_schema`.
10583        pub fn poller(
10584            self,
10585        ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10586            type Operation =
10587                lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10588            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10589            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10590
10591            let stub = self.0.stub.clone();
10592            let mut options = self.0.options.clone();
10593            options.set_retry_policy(gax::retry_policy::NeverRetry);
10594            let query = move |name| {
10595                let stub = stub.clone();
10596                let options = options.clone();
10597                async {
10598                    let op = GetOperation::new(stub)
10599                        .set_name(name)
10600                        .with_options(options)
10601                        .send()
10602                        .await?;
10603                    Ok(Operation::new(op))
10604                }
10605            };
10606
10607            let start = move || async {
10608                let op = self.send().await?;
10609                Ok(Operation::new(op))
10610            };
10611
10612            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10613        }
10614
10615        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10616        ///
10617        /// This is a **required** field for requests.
10618        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10619            self.0.request.parent = v.into();
10620            self
10621        }
10622
10623        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10624        ///
10625        /// This is a **required** field for requests.
10626        pub fn set_schema<T>(mut self, v: T) -> Self
10627        where
10628            T: std::convert::Into<crate::model::Schema>,
10629        {
10630            self.0.request.schema = std::option::Option::Some(v.into());
10631            self
10632        }
10633
10634        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10635        ///
10636        /// This is a **required** field for requests.
10637        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10638        where
10639            T: std::convert::Into<crate::model::Schema>,
10640        {
10641            self.0.request.schema = v.map(|x| x.into());
10642            self
10643        }
10644
10645        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10646        ///
10647        /// This is a **required** field for requests.
10648        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10649            self.0.request.schema_id = v.into();
10650            self
10651        }
10652    }
10653
10654    #[doc(hidden)]
10655    impl gax::options::internal::RequestBuilder for CreateSchema {
10656        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10657            &mut self.0.options
10658        }
10659    }
10660
10661    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10662    ///
10663    /// # Example
10664    /// ```no_run
10665    /// # use google_cloud_discoveryengine_v1::builder;
10666    /// use builder::schema_service::UpdateSchema;
10667    /// # tokio_test::block_on(async {
10668    /// use lro::Poller;
10669    ///
10670    /// let builder = prepare_request_builder();
10671    /// let response = builder.poller().until_done().await?;
10672    /// # gax::Result::<()>::Ok(()) });
10673    ///
10674    /// fn prepare_request_builder() -> UpdateSchema {
10675    ///   # panic!();
10676    ///   // ... details omitted ...
10677    /// }
10678    /// ```
10679    #[derive(Clone, Debug)]
10680    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10681
10682    impl UpdateSchema {
10683        pub(crate) fn new(
10684            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10685        ) -> Self {
10686            Self(RequestBuilder::new(stub))
10687        }
10688
10689        /// Sets the full request, replacing any prior values.
10690        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10691            self.0.request = v.into();
10692            self
10693        }
10694
10695        /// Sets all the options, replacing any prior values.
10696        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10697            self.0.options = v.into();
10698            self
10699        }
10700
10701        /// Sends the request.
10702        ///
10703        /// # Long running operations
10704        ///
10705        /// This starts, but does not poll, a longrunning operation. More information
10706        /// on [update_schema][crate::client::SchemaService::update_schema].
10707        pub async fn send(self) -> Result<longrunning::model::Operation> {
10708            (*self.0.stub)
10709                .update_schema(self.0.request, self.0.options)
10710                .await
10711                .map(gax::response::Response::into_body)
10712        }
10713
10714        /// Creates a [Poller][lro::Poller] to work with `update_schema`.
10715        pub fn poller(
10716            self,
10717        ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10718            type Operation =
10719                lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10720            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10721            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10722
10723            let stub = self.0.stub.clone();
10724            let mut options = self.0.options.clone();
10725            options.set_retry_policy(gax::retry_policy::NeverRetry);
10726            let query = move |name| {
10727                let stub = stub.clone();
10728                let options = options.clone();
10729                async {
10730                    let op = GetOperation::new(stub)
10731                        .set_name(name)
10732                        .with_options(options)
10733                        .send()
10734                        .await?;
10735                    Ok(Operation::new(op))
10736                }
10737            };
10738
10739            let start = move || async {
10740                let op = self.send().await?;
10741                Ok(Operation::new(op))
10742            };
10743
10744            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10745        }
10746
10747        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10748        ///
10749        /// This is a **required** field for requests.
10750        pub fn set_schema<T>(mut self, v: T) -> Self
10751        where
10752            T: std::convert::Into<crate::model::Schema>,
10753        {
10754            self.0.request.schema = std::option::Option::Some(v.into());
10755            self
10756        }
10757
10758        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10759        ///
10760        /// This is a **required** field for requests.
10761        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10762        where
10763            T: std::convert::Into<crate::model::Schema>,
10764        {
10765            self.0.request.schema = v.map(|x| x.into());
10766            self
10767        }
10768
10769        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
10770        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10771            self.0.request.allow_missing = v.into();
10772            self
10773        }
10774    }
10775
10776    #[doc(hidden)]
10777    impl gax::options::internal::RequestBuilder for UpdateSchema {
10778        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10779            &mut self.0.options
10780        }
10781    }
10782
10783    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
10784    ///
10785    /// # Example
10786    /// ```no_run
10787    /// # use google_cloud_discoveryengine_v1::builder;
10788    /// use builder::schema_service::DeleteSchema;
10789    /// # tokio_test::block_on(async {
10790    /// use lro::Poller;
10791    ///
10792    /// let builder = prepare_request_builder();
10793    /// let response = builder.poller().until_done().await?;
10794    /// # gax::Result::<()>::Ok(()) });
10795    ///
10796    /// fn prepare_request_builder() -> DeleteSchema {
10797    ///   # panic!();
10798    ///   // ... details omitted ...
10799    /// }
10800    /// ```
10801    #[derive(Clone, Debug)]
10802    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10803
10804    impl DeleteSchema {
10805        pub(crate) fn new(
10806            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10807        ) -> Self {
10808            Self(RequestBuilder::new(stub))
10809        }
10810
10811        /// Sets the full request, replacing any prior values.
10812        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10813            self.0.request = v.into();
10814            self
10815        }
10816
10817        /// Sets all the options, replacing any prior values.
10818        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10819            self.0.options = v.into();
10820            self
10821        }
10822
10823        /// Sends the request.
10824        ///
10825        /// # Long running operations
10826        ///
10827        /// This starts, but does not poll, a longrunning operation. More information
10828        /// on [delete_schema][crate::client::SchemaService::delete_schema].
10829        pub async fn send(self) -> Result<longrunning::model::Operation> {
10830            (*self.0.stub)
10831                .delete_schema(self.0.request, self.0.options)
10832                .await
10833                .map(gax::response::Response::into_body)
10834        }
10835
10836        /// Creates a [Poller][lro::Poller] to work with `delete_schema`.
10837        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10838            type Operation =
10839                lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10840            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10841            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10842
10843            let stub = self.0.stub.clone();
10844            let mut options = self.0.options.clone();
10845            options.set_retry_policy(gax::retry_policy::NeverRetry);
10846            let query = move |name| {
10847                let stub = stub.clone();
10848                let options = options.clone();
10849                async {
10850                    let op = GetOperation::new(stub)
10851                        .set_name(name)
10852                        .with_options(options)
10853                        .send()
10854                        .await?;
10855                    Ok(Operation::new(op))
10856                }
10857            };
10858
10859            let start = move || async {
10860                let op = self.send().await?;
10861                Ok(Operation::new(op))
10862            };
10863
10864            lro::internal::new_unit_response_poller(
10865                polling_error_policy,
10866                polling_backoff_policy,
10867                start,
10868                query,
10869            )
10870        }
10871
10872        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
10873        ///
10874        /// This is a **required** field for requests.
10875        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10876            self.0.request.name = v.into();
10877            self
10878        }
10879    }
10880
10881    #[doc(hidden)]
10882    impl gax::options::internal::RequestBuilder for DeleteSchema {
10883        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10884            &mut self.0.options
10885        }
10886    }
10887
10888    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
10889    ///
10890    /// # Example
10891    /// ```no_run
10892    /// # use google_cloud_discoveryengine_v1::builder;
10893    /// use builder::schema_service::ListOperations;
10894    /// # tokio_test::block_on(async {
10895    /// use gax::paginator::ItemPaginator;
10896    ///
10897    /// let builder = prepare_request_builder();
10898    /// let mut items = builder.by_item();
10899    /// while let Some(result) = items.next().await {
10900    ///   let item = result?;
10901    /// }
10902    /// # gax::Result::<()>::Ok(()) });
10903    ///
10904    /// fn prepare_request_builder() -> ListOperations {
10905    ///   # panic!();
10906    ///   // ... details omitted ...
10907    /// }
10908    /// ```
10909    #[derive(Clone, Debug)]
10910    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10911
10912    impl ListOperations {
10913        pub(crate) fn new(
10914            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10915        ) -> Self {
10916            Self(RequestBuilder::new(stub))
10917        }
10918
10919        /// Sets the full request, replacing any prior values.
10920        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10921            mut self,
10922            v: V,
10923        ) -> Self {
10924            self.0.request = v.into();
10925            self
10926        }
10927
10928        /// Sets all the options, replacing any prior values.
10929        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10930            self.0.options = v.into();
10931            self
10932        }
10933
10934        /// Sends the request.
10935        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10936            (*self.0.stub)
10937                .list_operations(self.0.request, self.0.options)
10938                .await
10939                .map(gax::response::Response::into_body)
10940        }
10941
10942        /// Streams each page in the collection.
10943        pub fn by_page(
10944            self,
10945        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10946        {
10947            use std::clone::Clone;
10948            let token = self.0.request.page_token.clone();
10949            let execute = move |token: String| {
10950                let mut builder = self.clone();
10951                builder.0.request = builder.0.request.set_page_token(token);
10952                builder.send()
10953            };
10954            gax::paginator::internal::new_paginator(token, execute)
10955        }
10956
10957        /// Streams each item in the collection.
10958        pub fn by_item(
10959            self,
10960        ) -> impl gax::paginator::ItemPaginator<
10961            longrunning::model::ListOperationsResponse,
10962            gax::error::Error,
10963        > {
10964            use gax::paginator::Paginator;
10965            self.by_page().items()
10966        }
10967
10968        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10969        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10970            self.0.request.name = v.into();
10971            self
10972        }
10973
10974        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10975        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10976            self.0.request.filter = v.into();
10977            self
10978        }
10979
10980        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10981        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10982            self.0.request.page_size = v.into();
10983            self
10984        }
10985
10986        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10987        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10988            self.0.request.page_token = v.into();
10989            self
10990        }
10991
10992        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
10993        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10994            self.0.request.return_partial_success = v.into();
10995            self
10996        }
10997    }
10998
10999    #[doc(hidden)]
11000    impl gax::options::internal::RequestBuilder for ListOperations {
11001        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11002            &mut self.0.options
11003        }
11004    }
11005
11006    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
11007    ///
11008    /// # Example
11009    /// ```no_run
11010    /// # use google_cloud_discoveryengine_v1::builder;
11011    /// use builder::schema_service::GetOperation;
11012    /// # tokio_test::block_on(async {
11013    ///
11014    /// let builder = prepare_request_builder();
11015    /// let response = builder.send().await?;
11016    /// # gax::Result::<()>::Ok(()) });
11017    ///
11018    /// fn prepare_request_builder() -> GetOperation {
11019    ///   # panic!();
11020    ///   // ... details omitted ...
11021    /// }
11022    /// ```
11023    #[derive(Clone, Debug)]
11024    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
11025
11026    impl GetOperation {
11027        pub(crate) fn new(
11028            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11029        ) -> Self {
11030            Self(RequestBuilder::new(stub))
11031        }
11032
11033        /// Sets the full request, replacing any prior values.
11034        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
11035            mut self,
11036            v: V,
11037        ) -> Self {
11038            self.0.request = v.into();
11039            self
11040        }
11041
11042        /// Sets all the options, replacing any prior values.
11043        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11044            self.0.options = v.into();
11045            self
11046        }
11047
11048        /// Sends the request.
11049        pub async fn send(self) -> Result<longrunning::model::Operation> {
11050            (*self.0.stub)
11051                .get_operation(self.0.request, self.0.options)
11052                .await
11053                .map(gax::response::Response::into_body)
11054        }
11055
11056        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
11057        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11058            self.0.request.name = v.into();
11059            self
11060        }
11061    }
11062
11063    #[doc(hidden)]
11064    impl gax::options::internal::RequestBuilder for GetOperation {
11065        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11066            &mut self.0.options
11067        }
11068    }
11069
11070    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
11071    ///
11072    /// # Example
11073    /// ```no_run
11074    /// # use google_cloud_discoveryengine_v1::builder;
11075    /// use builder::schema_service::CancelOperation;
11076    /// # tokio_test::block_on(async {
11077    ///
11078    /// let builder = prepare_request_builder();
11079    /// let response = builder.send().await?;
11080    /// # gax::Result::<()>::Ok(()) });
11081    ///
11082    /// fn prepare_request_builder() -> CancelOperation {
11083    ///   # panic!();
11084    ///   // ... details omitted ...
11085    /// }
11086    /// ```
11087    #[derive(Clone, Debug)]
11088    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11089
11090    impl CancelOperation {
11091        pub(crate) fn new(
11092            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11093        ) -> Self {
11094            Self(RequestBuilder::new(stub))
11095        }
11096
11097        /// Sets the full request, replacing any prior values.
11098        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11099            mut self,
11100            v: V,
11101        ) -> Self {
11102            self.0.request = v.into();
11103            self
11104        }
11105
11106        /// Sets all the options, replacing any prior values.
11107        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11108            self.0.options = v.into();
11109            self
11110        }
11111
11112        /// Sends the request.
11113        pub async fn send(self) -> Result<()> {
11114            (*self.0.stub)
11115                .cancel_operation(self.0.request, self.0.options)
11116                .await
11117                .map(gax::response::Response::into_body)
11118        }
11119
11120        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
11121        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11122            self.0.request.name = v.into();
11123            self
11124        }
11125    }
11126
11127    #[doc(hidden)]
11128    impl gax::options::internal::RequestBuilder for CancelOperation {
11129        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11130            &mut self.0.options
11131        }
11132    }
11133}
11134
11135#[cfg(feature = "search-service")]
11136#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11137pub mod search_service {
11138    use crate::Result;
11139
11140    /// A builder for [SearchService][crate::client::SearchService].
11141    ///
11142    /// ```
11143    /// # tokio_test::block_on(async {
11144    /// # use google_cloud_discoveryengine_v1::*;
11145    /// # use builder::search_service::ClientBuilder;
11146    /// # use client::SearchService;
11147    /// let builder : ClientBuilder = SearchService::builder();
11148    /// let client = builder
11149    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11150    ///     .build().await?;
11151    /// # gax::client_builder::Result::<()>::Ok(()) });
11152    /// ```
11153    pub type ClientBuilder =
11154        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11155
11156    pub(crate) mod client {
11157        use super::super::super::client::SearchService;
11158        pub struct Factory;
11159        impl gax::client_builder::internal::ClientFactory for Factory {
11160            type Client = SearchService;
11161            type Credentials = gaxi::options::Credentials;
11162            async fn build(
11163                self,
11164                config: gaxi::options::ClientConfig,
11165            ) -> gax::client_builder::Result<Self::Client> {
11166                Self::Client::new(config).await
11167            }
11168        }
11169    }
11170
11171    /// Common implementation for [crate::client::SearchService] request builders.
11172    #[derive(Clone, Debug)]
11173    pub(crate) struct RequestBuilder<R: std::default::Default> {
11174        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11175        request: R,
11176        options: gax::options::RequestOptions,
11177    }
11178
11179    impl<R> RequestBuilder<R>
11180    where
11181        R: std::default::Default,
11182    {
11183        pub(crate) fn new(
11184            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11185        ) -> Self {
11186            Self {
11187                stub,
11188                request: R::default(),
11189                options: gax::options::RequestOptions::default(),
11190            }
11191        }
11192    }
11193
11194    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11195    ///
11196    /// # Example
11197    /// ```no_run
11198    /// # use google_cloud_discoveryengine_v1::builder;
11199    /// use builder::search_service::Search;
11200    /// # tokio_test::block_on(async {
11201    /// use gax::paginator::ItemPaginator;
11202    ///
11203    /// let builder = prepare_request_builder();
11204    /// let mut items = builder.by_item();
11205    /// while let Some(result) = items.next().await {
11206    ///   let item = result?;
11207    /// }
11208    /// # gax::Result::<()>::Ok(()) });
11209    ///
11210    /// fn prepare_request_builder() -> Search {
11211    ///   # panic!();
11212    ///   // ... details omitted ...
11213    /// }
11214    /// ```
11215    #[derive(Clone, Debug)]
11216    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11217
11218    impl Search {
11219        pub(crate) fn new(
11220            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11221        ) -> Self {
11222            Self(RequestBuilder::new(stub))
11223        }
11224
11225        /// Sets the full request, replacing any prior values.
11226        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11227            self.0.request = v.into();
11228            self
11229        }
11230
11231        /// Sets all the options, replacing any prior values.
11232        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11233            self.0.options = v.into();
11234            self
11235        }
11236
11237        /// Sends the request.
11238        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11239            (*self.0.stub)
11240                .search(self.0.request, self.0.options)
11241                .await
11242                .map(gax::response::Response::into_body)
11243        }
11244
11245        /// Streams each page in the collection.
11246        pub fn by_page(
11247            self,
11248        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11249        {
11250            use std::clone::Clone;
11251            let token = self.0.request.page_token.clone();
11252            let execute = move |token: String| {
11253                let mut builder = self.clone();
11254                builder.0.request = builder.0.request.set_page_token(token);
11255                builder.send()
11256            };
11257            gax::paginator::internal::new_paginator(token, execute)
11258        }
11259
11260        /// Streams each item in the collection.
11261        pub fn by_item(
11262            self,
11263        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11264        {
11265            use gax::paginator::Paginator;
11266            self.by_page().items()
11267        }
11268
11269        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11270        ///
11271        /// This is a **required** field for requests.
11272        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11273            self.0.request.serving_config = v.into();
11274            self
11275        }
11276
11277        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11278        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11279            self.0.request.branch = v.into();
11280            self
11281        }
11282
11283        /// Sets the value of [query][crate::model::SearchRequest::query].
11284        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11285            self.0.request.query = v.into();
11286            self
11287        }
11288
11289        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11290        pub fn set_image_query<T>(mut self, v: T) -> Self
11291        where
11292            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11293        {
11294            self.0.request.image_query = std::option::Option::Some(v.into());
11295            self
11296        }
11297
11298        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11299        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11300        where
11301            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11302        {
11303            self.0.request.image_query = v.map(|x| x.into());
11304            self
11305        }
11306
11307        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11308        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11309            self.0.request.page_size = v.into();
11310            self
11311        }
11312
11313        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11314        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11315            self.0.request.page_token = v.into();
11316            self
11317        }
11318
11319        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11320        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11321            self.0.request.offset = v.into();
11322            self
11323        }
11324
11325        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11326        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11327            self.0.request.one_box_page_size = v.into();
11328            self
11329        }
11330
11331        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11332        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11333        where
11334            T: std::iter::IntoIterator<Item = V>,
11335            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11336        {
11337            use std::iter::Iterator;
11338            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11339            self
11340        }
11341
11342        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11343        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11344            self.0.request.filter = v.into();
11345            self
11346        }
11347
11348        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11349        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11350            self.0.request.canonical_filter = v.into();
11351            self
11352        }
11353
11354        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11355        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11356            self.0.request.order_by = v.into();
11357            self
11358        }
11359
11360        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11361        pub fn set_user_info<T>(mut self, v: T) -> Self
11362        where
11363            T: std::convert::Into<crate::model::UserInfo>,
11364        {
11365            self.0.request.user_info = std::option::Option::Some(v.into());
11366            self
11367        }
11368
11369        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11370        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11371        where
11372            T: std::convert::Into<crate::model::UserInfo>,
11373        {
11374            self.0.request.user_info = v.map(|x| x.into());
11375            self
11376        }
11377
11378        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11379        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11380            self.0.request.language_code = v.into();
11381            self
11382        }
11383
11384        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11385        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11386        where
11387            T: std::iter::IntoIterator<Item = V>,
11388            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11389        {
11390            use std::iter::Iterator;
11391            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11392            self
11393        }
11394
11395        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11396        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11397        where
11398            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11399        {
11400            self.0.request.boost_spec = std::option::Option::Some(v.into());
11401            self
11402        }
11403
11404        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11405        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11406        where
11407            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11408        {
11409            self.0.request.boost_spec = v.map(|x| x.into());
11410            self
11411        }
11412
11413        /// Sets the value of [params][crate::model::SearchRequest::params].
11414        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11415        where
11416            T: std::iter::IntoIterator<Item = (K, V)>,
11417            K: std::convert::Into<std::string::String>,
11418            V: std::convert::Into<wkt::Value>,
11419        {
11420            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11421            self
11422        }
11423
11424        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11425        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11426        where
11427            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11428        {
11429            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11430            self
11431        }
11432
11433        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11434        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11435        where
11436            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11437        {
11438            self.0.request.query_expansion_spec = v.map(|x| x.into());
11439            self
11440        }
11441
11442        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11443        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11444        where
11445            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11446        {
11447            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11448            self
11449        }
11450
11451        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11452        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11453        where
11454            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11455        {
11456            self.0.request.spell_correction_spec = v.map(|x| x.into());
11457            self
11458        }
11459
11460        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11461        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11462            self.0.request.user_pseudo_id = v.into();
11463            self
11464        }
11465
11466        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11467        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11468        where
11469            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11470        {
11471            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11472            self
11473        }
11474
11475        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11476        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11477        where
11478            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11479        {
11480            self.0.request.content_search_spec = v.map(|x| x.into());
11481            self
11482        }
11483
11484        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11485        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11486            self.0.request.safe_search = v.into();
11487            self
11488        }
11489
11490        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11491        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11492        where
11493            T: std::iter::IntoIterator<Item = (K, V)>,
11494            K: std::convert::Into<std::string::String>,
11495            V: std::convert::Into<std::string::String>,
11496        {
11497            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11498            self
11499        }
11500
11501        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11502        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11503        where
11504            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11505        {
11506            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11507            self
11508        }
11509
11510        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11511        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11512        where
11513            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11514        {
11515            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11516            self
11517        }
11518
11519        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11520        pub fn set_display_spec<T>(mut self, v: T) -> Self
11521        where
11522            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11523        {
11524            self.0.request.display_spec = std::option::Option::Some(v.into());
11525            self
11526        }
11527
11528        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11529        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11530        where
11531            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11532        {
11533            self.0.request.display_spec = v.map(|x| x.into());
11534            self
11535        }
11536
11537        /// Sets the value of [session][crate::model::SearchRequest::session].
11538        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11539            self.0.request.session = v.into();
11540            self
11541        }
11542
11543        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11544        pub fn set_session_spec<T>(mut self, v: T) -> Self
11545        where
11546            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11547        {
11548            self.0.request.session_spec = std::option::Option::Some(v.into());
11549            self
11550        }
11551
11552        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11553        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11554        where
11555            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11556        {
11557            self.0.request.session_spec = v.map(|x| x.into());
11558            self
11559        }
11560
11561        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11562        pub fn set_relevance_threshold<
11563            T: Into<crate::model::search_request::RelevanceThreshold>,
11564        >(
11565            mut self,
11566            v: T,
11567        ) -> Self {
11568            self.0.request.relevance_threshold = v.into();
11569            self
11570        }
11571
11572        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11573        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11574        where
11575            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11576        {
11577            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11578            self
11579        }
11580
11581        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11582        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11583        where
11584            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11585        {
11586            self.0.request.relevance_score_spec = v.map(|x| x.into());
11587            self
11588        }
11589
11590        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11591        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11592            self.0.request.ranking_expression = v.into();
11593            self
11594        }
11595
11596        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11597        pub fn set_ranking_expression_backend<
11598            T: Into<crate::model::search_request::RankingExpressionBackend>,
11599        >(
11600            mut self,
11601            v: T,
11602        ) -> Self {
11603            self.0.request.ranking_expression_backend = v.into();
11604            self
11605        }
11606    }
11607
11608    #[doc(hidden)]
11609    impl gax::options::internal::RequestBuilder for Search {
11610        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11611            &mut self.0.options
11612        }
11613    }
11614
11615    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11616    ///
11617    /// # Example
11618    /// ```no_run
11619    /// # use google_cloud_discoveryengine_v1::builder;
11620    /// use builder::search_service::SearchLite;
11621    /// # tokio_test::block_on(async {
11622    /// use gax::paginator::ItemPaginator;
11623    ///
11624    /// let builder = prepare_request_builder();
11625    /// let mut items = builder.by_item();
11626    /// while let Some(result) = items.next().await {
11627    ///   let item = result?;
11628    /// }
11629    /// # gax::Result::<()>::Ok(()) });
11630    ///
11631    /// fn prepare_request_builder() -> SearchLite {
11632    ///   # panic!();
11633    ///   // ... details omitted ...
11634    /// }
11635    /// ```
11636    #[derive(Clone, Debug)]
11637    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11638
11639    impl SearchLite {
11640        pub(crate) fn new(
11641            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11642        ) -> Self {
11643            Self(RequestBuilder::new(stub))
11644        }
11645
11646        /// Sets the full request, replacing any prior values.
11647        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11648            self.0.request = v.into();
11649            self
11650        }
11651
11652        /// Sets all the options, replacing any prior values.
11653        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11654            self.0.options = v.into();
11655            self
11656        }
11657
11658        /// Sends the request.
11659        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11660            (*self.0.stub)
11661                .search_lite(self.0.request, self.0.options)
11662                .await
11663                .map(gax::response::Response::into_body)
11664        }
11665
11666        /// Streams each page in the collection.
11667        pub fn by_page(
11668            self,
11669        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11670        {
11671            use std::clone::Clone;
11672            let token = self.0.request.page_token.clone();
11673            let execute = move |token: String| {
11674                let mut builder = self.clone();
11675                builder.0.request = builder.0.request.set_page_token(token);
11676                builder.send()
11677            };
11678            gax::paginator::internal::new_paginator(token, execute)
11679        }
11680
11681        /// Streams each item in the collection.
11682        pub fn by_item(
11683            self,
11684        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11685        {
11686            use gax::paginator::Paginator;
11687            self.by_page().items()
11688        }
11689
11690        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11691        ///
11692        /// This is a **required** field for requests.
11693        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11694            self.0.request.serving_config = v.into();
11695            self
11696        }
11697
11698        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11699        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11700            self.0.request.branch = v.into();
11701            self
11702        }
11703
11704        /// Sets the value of [query][crate::model::SearchRequest::query].
11705        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11706            self.0.request.query = v.into();
11707            self
11708        }
11709
11710        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11711        pub fn set_image_query<T>(mut self, v: T) -> Self
11712        where
11713            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11714        {
11715            self.0.request.image_query = std::option::Option::Some(v.into());
11716            self
11717        }
11718
11719        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11720        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11721        where
11722            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11723        {
11724            self.0.request.image_query = v.map(|x| x.into());
11725            self
11726        }
11727
11728        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11729        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11730            self.0.request.page_size = v.into();
11731            self
11732        }
11733
11734        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11735        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11736            self.0.request.page_token = v.into();
11737            self
11738        }
11739
11740        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11741        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11742            self.0.request.offset = v.into();
11743            self
11744        }
11745
11746        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11747        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11748            self.0.request.one_box_page_size = v.into();
11749            self
11750        }
11751
11752        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11753        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11754        where
11755            T: std::iter::IntoIterator<Item = V>,
11756            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11757        {
11758            use std::iter::Iterator;
11759            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11760            self
11761        }
11762
11763        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11764        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11765            self.0.request.filter = v.into();
11766            self
11767        }
11768
11769        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11770        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11771            self.0.request.canonical_filter = v.into();
11772            self
11773        }
11774
11775        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11776        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11777            self.0.request.order_by = v.into();
11778            self
11779        }
11780
11781        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11782        pub fn set_user_info<T>(mut self, v: T) -> Self
11783        where
11784            T: std::convert::Into<crate::model::UserInfo>,
11785        {
11786            self.0.request.user_info = std::option::Option::Some(v.into());
11787            self
11788        }
11789
11790        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11791        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11792        where
11793            T: std::convert::Into<crate::model::UserInfo>,
11794        {
11795            self.0.request.user_info = v.map(|x| x.into());
11796            self
11797        }
11798
11799        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11800        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11801            self.0.request.language_code = v.into();
11802            self
11803        }
11804
11805        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11806        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11807        where
11808            T: std::iter::IntoIterator<Item = V>,
11809            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11810        {
11811            use std::iter::Iterator;
11812            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11813            self
11814        }
11815
11816        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11817        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11818        where
11819            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11820        {
11821            self.0.request.boost_spec = std::option::Option::Some(v.into());
11822            self
11823        }
11824
11825        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11826        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11827        where
11828            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11829        {
11830            self.0.request.boost_spec = v.map(|x| x.into());
11831            self
11832        }
11833
11834        /// Sets the value of [params][crate::model::SearchRequest::params].
11835        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11836        where
11837            T: std::iter::IntoIterator<Item = (K, V)>,
11838            K: std::convert::Into<std::string::String>,
11839            V: std::convert::Into<wkt::Value>,
11840        {
11841            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11842            self
11843        }
11844
11845        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11846        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11847        where
11848            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11849        {
11850            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11851            self
11852        }
11853
11854        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11855        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11856        where
11857            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11858        {
11859            self.0.request.query_expansion_spec = v.map(|x| x.into());
11860            self
11861        }
11862
11863        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11864        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11865        where
11866            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11867        {
11868            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11869            self
11870        }
11871
11872        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11873        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11874        where
11875            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11876        {
11877            self.0.request.spell_correction_spec = v.map(|x| x.into());
11878            self
11879        }
11880
11881        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11882        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11883            self.0.request.user_pseudo_id = v.into();
11884            self
11885        }
11886
11887        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11888        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11889        where
11890            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11891        {
11892            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11893            self
11894        }
11895
11896        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11897        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11898        where
11899            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11900        {
11901            self.0.request.content_search_spec = v.map(|x| x.into());
11902            self
11903        }
11904
11905        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11906        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11907            self.0.request.safe_search = v.into();
11908            self
11909        }
11910
11911        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11912        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11913        where
11914            T: std::iter::IntoIterator<Item = (K, V)>,
11915            K: std::convert::Into<std::string::String>,
11916            V: std::convert::Into<std::string::String>,
11917        {
11918            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11919            self
11920        }
11921
11922        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11923        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11924        where
11925            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11926        {
11927            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11928            self
11929        }
11930
11931        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11932        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11933        where
11934            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11935        {
11936            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11937            self
11938        }
11939
11940        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11941        pub fn set_display_spec<T>(mut self, v: T) -> Self
11942        where
11943            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11944        {
11945            self.0.request.display_spec = std::option::Option::Some(v.into());
11946            self
11947        }
11948
11949        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11950        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11951        where
11952            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11953        {
11954            self.0.request.display_spec = v.map(|x| x.into());
11955            self
11956        }
11957
11958        /// Sets the value of [session][crate::model::SearchRequest::session].
11959        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11960            self.0.request.session = v.into();
11961            self
11962        }
11963
11964        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11965        pub fn set_session_spec<T>(mut self, v: T) -> Self
11966        where
11967            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11968        {
11969            self.0.request.session_spec = std::option::Option::Some(v.into());
11970            self
11971        }
11972
11973        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11974        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11975        where
11976            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11977        {
11978            self.0.request.session_spec = v.map(|x| x.into());
11979            self
11980        }
11981
11982        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11983        pub fn set_relevance_threshold<
11984            T: Into<crate::model::search_request::RelevanceThreshold>,
11985        >(
11986            mut self,
11987            v: T,
11988        ) -> Self {
11989            self.0.request.relevance_threshold = v.into();
11990            self
11991        }
11992
11993        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11994        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11995        where
11996            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11997        {
11998            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11999            self
12000        }
12001
12002        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12003        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12004        where
12005            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12006        {
12007            self.0.request.relevance_score_spec = v.map(|x| x.into());
12008            self
12009        }
12010
12011        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12012        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12013            self.0.request.ranking_expression = v.into();
12014            self
12015        }
12016
12017        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12018        pub fn set_ranking_expression_backend<
12019            T: Into<crate::model::search_request::RankingExpressionBackend>,
12020        >(
12021            mut self,
12022            v: T,
12023        ) -> Self {
12024            self.0.request.ranking_expression_backend = v.into();
12025            self
12026        }
12027    }
12028
12029    #[doc(hidden)]
12030    impl gax::options::internal::RequestBuilder for SearchLite {
12031        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12032            &mut self.0.options
12033        }
12034    }
12035
12036    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
12037    ///
12038    /// # Example
12039    /// ```no_run
12040    /// # use google_cloud_discoveryengine_v1::builder;
12041    /// use builder::search_service::ListOperations;
12042    /// # tokio_test::block_on(async {
12043    /// use gax::paginator::ItemPaginator;
12044    ///
12045    /// let builder = prepare_request_builder();
12046    /// let mut items = builder.by_item();
12047    /// while let Some(result) = items.next().await {
12048    ///   let item = result?;
12049    /// }
12050    /// # gax::Result::<()>::Ok(()) });
12051    ///
12052    /// fn prepare_request_builder() -> ListOperations {
12053    ///   # panic!();
12054    ///   // ... details omitted ...
12055    /// }
12056    /// ```
12057    #[derive(Clone, Debug)]
12058    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12059
12060    impl ListOperations {
12061        pub(crate) fn new(
12062            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12063        ) -> Self {
12064            Self(RequestBuilder::new(stub))
12065        }
12066
12067        /// Sets the full request, replacing any prior values.
12068        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12069            mut self,
12070            v: V,
12071        ) -> Self {
12072            self.0.request = v.into();
12073            self
12074        }
12075
12076        /// Sets all the options, replacing any prior values.
12077        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12078            self.0.options = v.into();
12079            self
12080        }
12081
12082        /// Sends the request.
12083        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12084            (*self.0.stub)
12085                .list_operations(self.0.request, self.0.options)
12086                .await
12087                .map(gax::response::Response::into_body)
12088        }
12089
12090        /// Streams each page in the collection.
12091        pub fn by_page(
12092            self,
12093        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12094        {
12095            use std::clone::Clone;
12096            let token = self.0.request.page_token.clone();
12097            let execute = move |token: String| {
12098                let mut builder = self.clone();
12099                builder.0.request = builder.0.request.set_page_token(token);
12100                builder.send()
12101            };
12102            gax::paginator::internal::new_paginator(token, execute)
12103        }
12104
12105        /// Streams each item in the collection.
12106        pub fn by_item(
12107            self,
12108        ) -> impl gax::paginator::ItemPaginator<
12109            longrunning::model::ListOperationsResponse,
12110            gax::error::Error,
12111        > {
12112            use gax::paginator::Paginator;
12113            self.by_page().items()
12114        }
12115
12116        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12117        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12118            self.0.request.name = v.into();
12119            self
12120        }
12121
12122        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12123        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12124            self.0.request.filter = v.into();
12125            self
12126        }
12127
12128        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12129        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12130            self.0.request.page_size = v.into();
12131            self
12132        }
12133
12134        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12135        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12136            self.0.request.page_token = v.into();
12137            self
12138        }
12139
12140        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
12141        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12142            self.0.request.return_partial_success = v.into();
12143            self
12144        }
12145    }
12146
12147    #[doc(hidden)]
12148    impl gax::options::internal::RequestBuilder for ListOperations {
12149        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12150            &mut self.0.options
12151        }
12152    }
12153
12154    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12155    ///
12156    /// # Example
12157    /// ```no_run
12158    /// # use google_cloud_discoveryengine_v1::builder;
12159    /// use builder::search_service::GetOperation;
12160    /// # tokio_test::block_on(async {
12161    ///
12162    /// let builder = prepare_request_builder();
12163    /// let response = builder.send().await?;
12164    /// # gax::Result::<()>::Ok(()) });
12165    ///
12166    /// fn prepare_request_builder() -> GetOperation {
12167    ///   # panic!();
12168    ///   // ... details omitted ...
12169    /// }
12170    /// ```
12171    #[derive(Clone, Debug)]
12172    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12173
12174    impl GetOperation {
12175        pub(crate) fn new(
12176            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12177        ) -> Self {
12178            Self(RequestBuilder::new(stub))
12179        }
12180
12181        /// Sets the full request, replacing any prior values.
12182        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12183            mut self,
12184            v: V,
12185        ) -> Self {
12186            self.0.request = v.into();
12187            self
12188        }
12189
12190        /// Sets all the options, replacing any prior values.
12191        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12192            self.0.options = v.into();
12193            self
12194        }
12195
12196        /// Sends the request.
12197        pub async fn send(self) -> Result<longrunning::model::Operation> {
12198            (*self.0.stub)
12199                .get_operation(self.0.request, self.0.options)
12200                .await
12201                .map(gax::response::Response::into_body)
12202        }
12203
12204        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12205        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12206            self.0.request.name = v.into();
12207            self
12208        }
12209    }
12210
12211    #[doc(hidden)]
12212    impl gax::options::internal::RequestBuilder for GetOperation {
12213        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12214            &mut self.0.options
12215        }
12216    }
12217
12218    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12219    ///
12220    /// # Example
12221    /// ```no_run
12222    /// # use google_cloud_discoveryengine_v1::builder;
12223    /// use builder::search_service::CancelOperation;
12224    /// # tokio_test::block_on(async {
12225    ///
12226    /// let builder = prepare_request_builder();
12227    /// let response = builder.send().await?;
12228    /// # gax::Result::<()>::Ok(()) });
12229    ///
12230    /// fn prepare_request_builder() -> CancelOperation {
12231    ///   # panic!();
12232    ///   // ... details omitted ...
12233    /// }
12234    /// ```
12235    #[derive(Clone, Debug)]
12236    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12237
12238    impl CancelOperation {
12239        pub(crate) fn new(
12240            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12241        ) -> Self {
12242            Self(RequestBuilder::new(stub))
12243        }
12244
12245        /// Sets the full request, replacing any prior values.
12246        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12247            mut self,
12248            v: V,
12249        ) -> Self {
12250            self.0.request = v.into();
12251            self
12252        }
12253
12254        /// Sets all the options, replacing any prior values.
12255        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12256            self.0.options = v.into();
12257            self
12258        }
12259
12260        /// Sends the request.
12261        pub async fn send(self) -> Result<()> {
12262            (*self.0.stub)
12263                .cancel_operation(self.0.request, self.0.options)
12264                .await
12265                .map(gax::response::Response::into_body)
12266        }
12267
12268        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12269        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12270            self.0.request.name = v.into();
12271            self
12272        }
12273    }
12274
12275    #[doc(hidden)]
12276    impl gax::options::internal::RequestBuilder for CancelOperation {
12277        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12278            &mut self.0.options
12279        }
12280    }
12281}
12282
12283#[cfg(feature = "search-tuning-service")]
12284#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12285pub mod search_tuning_service {
12286    use crate::Result;
12287
12288    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12289    ///
12290    /// ```
12291    /// # tokio_test::block_on(async {
12292    /// # use google_cloud_discoveryengine_v1::*;
12293    /// # use builder::search_tuning_service::ClientBuilder;
12294    /// # use client::SearchTuningService;
12295    /// let builder : ClientBuilder = SearchTuningService::builder();
12296    /// let client = builder
12297    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12298    ///     .build().await?;
12299    /// # gax::client_builder::Result::<()>::Ok(()) });
12300    /// ```
12301    pub type ClientBuilder =
12302        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12303
12304    pub(crate) mod client {
12305        use super::super::super::client::SearchTuningService;
12306        pub struct Factory;
12307        impl gax::client_builder::internal::ClientFactory for Factory {
12308            type Client = SearchTuningService;
12309            type Credentials = gaxi::options::Credentials;
12310            async fn build(
12311                self,
12312                config: gaxi::options::ClientConfig,
12313            ) -> gax::client_builder::Result<Self::Client> {
12314                Self::Client::new(config).await
12315            }
12316        }
12317    }
12318
12319    /// Common implementation for [crate::client::SearchTuningService] request builders.
12320    #[derive(Clone, Debug)]
12321    pub(crate) struct RequestBuilder<R: std::default::Default> {
12322        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12323        request: R,
12324        options: gax::options::RequestOptions,
12325    }
12326
12327    impl<R> RequestBuilder<R>
12328    where
12329        R: std::default::Default,
12330    {
12331        pub(crate) fn new(
12332            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12333        ) -> Self {
12334            Self {
12335                stub,
12336                request: R::default(),
12337                options: gax::options::RequestOptions::default(),
12338            }
12339        }
12340    }
12341
12342    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12343    ///
12344    /// # Example
12345    /// ```no_run
12346    /// # use google_cloud_discoveryengine_v1::builder;
12347    /// use builder::search_tuning_service::TrainCustomModel;
12348    /// # tokio_test::block_on(async {
12349    /// use lro::Poller;
12350    ///
12351    /// let builder = prepare_request_builder();
12352    /// let response = builder.poller().until_done().await?;
12353    /// # gax::Result::<()>::Ok(()) });
12354    ///
12355    /// fn prepare_request_builder() -> TrainCustomModel {
12356    ///   # panic!();
12357    ///   // ... details omitted ...
12358    /// }
12359    /// ```
12360    #[derive(Clone, Debug)]
12361    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12362
12363    impl TrainCustomModel {
12364        pub(crate) fn new(
12365            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12366        ) -> Self {
12367            Self(RequestBuilder::new(stub))
12368        }
12369
12370        /// Sets the full request, replacing any prior values.
12371        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12372            mut self,
12373            v: V,
12374        ) -> Self {
12375            self.0.request = v.into();
12376            self
12377        }
12378
12379        /// Sets all the options, replacing any prior values.
12380        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12381            self.0.options = v.into();
12382            self
12383        }
12384
12385        /// Sends the request.
12386        ///
12387        /// # Long running operations
12388        ///
12389        /// This starts, but does not poll, a longrunning operation. More information
12390        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12391        pub async fn send(self) -> Result<longrunning::model::Operation> {
12392            (*self.0.stub)
12393                .train_custom_model(self.0.request, self.0.options)
12394                .await
12395                .map(gax::response::Response::into_body)
12396        }
12397
12398        /// Creates a [Poller][lro::Poller] to work with `train_custom_model`.
12399        pub fn poller(
12400            self,
12401        ) -> impl lro::Poller<
12402            crate::model::TrainCustomModelResponse,
12403            crate::model::TrainCustomModelMetadata,
12404        > {
12405            type Operation = lro::internal::Operation<
12406                crate::model::TrainCustomModelResponse,
12407                crate::model::TrainCustomModelMetadata,
12408            >;
12409            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12410            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12411
12412            let stub = self.0.stub.clone();
12413            let mut options = self.0.options.clone();
12414            options.set_retry_policy(gax::retry_policy::NeverRetry);
12415            let query = move |name| {
12416                let stub = stub.clone();
12417                let options = options.clone();
12418                async {
12419                    let op = GetOperation::new(stub)
12420                        .set_name(name)
12421                        .with_options(options)
12422                        .send()
12423                        .await?;
12424                    Ok(Operation::new(op))
12425                }
12426            };
12427
12428            let start = move || async {
12429                let op = self.send().await?;
12430                Ok(Operation::new(op))
12431            };
12432
12433            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12434        }
12435
12436        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12437        ///
12438        /// This is a **required** field for requests.
12439        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12440            self.0.request.data_store = v.into();
12441            self
12442        }
12443
12444        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12445        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12446            self.0.request.model_type = v.into();
12447            self
12448        }
12449
12450        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12451        pub fn set_error_config<T>(mut self, v: T) -> Self
12452        where
12453            T: std::convert::Into<crate::model::ImportErrorConfig>,
12454        {
12455            self.0.request.error_config = std::option::Option::Some(v.into());
12456            self
12457        }
12458
12459        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12460        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12461        where
12462            T: std::convert::Into<crate::model::ImportErrorConfig>,
12463        {
12464            self.0.request.error_config = v.map(|x| x.into());
12465            self
12466        }
12467
12468        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12469        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12470            self.0.request.model_id = v.into();
12471            self
12472        }
12473
12474        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12475        ///
12476        /// Note that all the setters affecting `training_input` are
12477        /// mutually exclusive.
12478        pub fn set_training_input<
12479            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12480        >(
12481            mut self,
12482            v: T,
12483        ) -> Self {
12484            self.0.request.training_input = v.into();
12485            self
12486        }
12487
12488        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12489        /// to hold a `GcsTrainingInput`.
12490        ///
12491        /// Note that all the setters affecting `training_input` are
12492        /// mutually exclusive.
12493        pub fn set_gcs_training_input<
12494            T: std::convert::Into<
12495                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12496                >,
12497        >(
12498            mut self,
12499            v: T,
12500        ) -> Self {
12501            self.0.request = self.0.request.set_gcs_training_input(v);
12502            self
12503        }
12504    }
12505
12506    #[doc(hidden)]
12507    impl gax::options::internal::RequestBuilder for TrainCustomModel {
12508        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12509            &mut self.0.options
12510        }
12511    }
12512
12513    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12514    ///
12515    /// # Example
12516    /// ```no_run
12517    /// # use google_cloud_discoveryengine_v1::builder;
12518    /// use builder::search_tuning_service::ListCustomModels;
12519    /// # tokio_test::block_on(async {
12520    ///
12521    /// let builder = prepare_request_builder();
12522    /// let response = builder.send().await?;
12523    /// # gax::Result::<()>::Ok(()) });
12524    ///
12525    /// fn prepare_request_builder() -> ListCustomModels {
12526    ///   # panic!();
12527    ///   // ... details omitted ...
12528    /// }
12529    /// ```
12530    #[derive(Clone, Debug)]
12531    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12532
12533    impl ListCustomModels {
12534        pub(crate) fn new(
12535            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12536        ) -> Self {
12537            Self(RequestBuilder::new(stub))
12538        }
12539
12540        /// Sets the full request, replacing any prior values.
12541        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12542            mut self,
12543            v: V,
12544        ) -> Self {
12545            self.0.request = v.into();
12546            self
12547        }
12548
12549        /// Sets all the options, replacing any prior values.
12550        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12551            self.0.options = v.into();
12552            self
12553        }
12554
12555        /// Sends the request.
12556        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12557            (*self.0.stub)
12558                .list_custom_models(self.0.request, self.0.options)
12559                .await
12560                .map(gax::response::Response::into_body)
12561        }
12562
12563        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12564        ///
12565        /// This is a **required** field for requests.
12566        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12567            self.0.request.data_store = v.into();
12568            self
12569        }
12570    }
12571
12572    #[doc(hidden)]
12573    impl gax::options::internal::RequestBuilder for ListCustomModels {
12574        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12575            &mut self.0.options
12576        }
12577    }
12578
12579    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12580    ///
12581    /// # Example
12582    /// ```no_run
12583    /// # use google_cloud_discoveryengine_v1::builder;
12584    /// use builder::search_tuning_service::ListOperations;
12585    /// # tokio_test::block_on(async {
12586    /// use gax::paginator::ItemPaginator;
12587    ///
12588    /// let builder = prepare_request_builder();
12589    /// let mut items = builder.by_item();
12590    /// while let Some(result) = items.next().await {
12591    ///   let item = result?;
12592    /// }
12593    /// # gax::Result::<()>::Ok(()) });
12594    ///
12595    /// fn prepare_request_builder() -> ListOperations {
12596    ///   # panic!();
12597    ///   // ... details omitted ...
12598    /// }
12599    /// ```
12600    #[derive(Clone, Debug)]
12601    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12602
12603    impl ListOperations {
12604        pub(crate) fn new(
12605            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12606        ) -> Self {
12607            Self(RequestBuilder::new(stub))
12608        }
12609
12610        /// Sets the full request, replacing any prior values.
12611        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12612            mut self,
12613            v: V,
12614        ) -> Self {
12615            self.0.request = v.into();
12616            self
12617        }
12618
12619        /// Sets all the options, replacing any prior values.
12620        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12621            self.0.options = v.into();
12622            self
12623        }
12624
12625        /// Sends the request.
12626        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12627            (*self.0.stub)
12628                .list_operations(self.0.request, self.0.options)
12629                .await
12630                .map(gax::response::Response::into_body)
12631        }
12632
12633        /// Streams each page in the collection.
12634        pub fn by_page(
12635            self,
12636        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12637        {
12638            use std::clone::Clone;
12639            let token = self.0.request.page_token.clone();
12640            let execute = move |token: String| {
12641                let mut builder = self.clone();
12642                builder.0.request = builder.0.request.set_page_token(token);
12643                builder.send()
12644            };
12645            gax::paginator::internal::new_paginator(token, execute)
12646        }
12647
12648        /// Streams each item in the collection.
12649        pub fn by_item(
12650            self,
12651        ) -> impl gax::paginator::ItemPaginator<
12652            longrunning::model::ListOperationsResponse,
12653            gax::error::Error,
12654        > {
12655            use gax::paginator::Paginator;
12656            self.by_page().items()
12657        }
12658
12659        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12660        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12661            self.0.request.name = v.into();
12662            self
12663        }
12664
12665        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12666        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12667            self.0.request.filter = v.into();
12668            self
12669        }
12670
12671        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12672        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12673            self.0.request.page_size = v.into();
12674            self
12675        }
12676
12677        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12678        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12679            self.0.request.page_token = v.into();
12680            self
12681        }
12682
12683        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
12684        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12685            self.0.request.return_partial_success = v.into();
12686            self
12687        }
12688    }
12689
12690    #[doc(hidden)]
12691    impl gax::options::internal::RequestBuilder for ListOperations {
12692        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12693            &mut self.0.options
12694        }
12695    }
12696
12697    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
12698    ///
12699    /// # Example
12700    /// ```no_run
12701    /// # use google_cloud_discoveryengine_v1::builder;
12702    /// use builder::search_tuning_service::GetOperation;
12703    /// # tokio_test::block_on(async {
12704    ///
12705    /// let builder = prepare_request_builder();
12706    /// let response = builder.send().await?;
12707    /// # gax::Result::<()>::Ok(()) });
12708    ///
12709    /// fn prepare_request_builder() -> GetOperation {
12710    ///   # panic!();
12711    ///   // ... details omitted ...
12712    /// }
12713    /// ```
12714    #[derive(Clone, Debug)]
12715    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12716
12717    impl GetOperation {
12718        pub(crate) fn new(
12719            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12720        ) -> Self {
12721            Self(RequestBuilder::new(stub))
12722        }
12723
12724        /// Sets the full request, replacing any prior values.
12725        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12726            mut self,
12727            v: V,
12728        ) -> Self {
12729            self.0.request = v.into();
12730            self
12731        }
12732
12733        /// Sets all the options, replacing any prior values.
12734        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12735            self.0.options = v.into();
12736            self
12737        }
12738
12739        /// Sends the request.
12740        pub async fn send(self) -> Result<longrunning::model::Operation> {
12741            (*self.0.stub)
12742                .get_operation(self.0.request, self.0.options)
12743                .await
12744                .map(gax::response::Response::into_body)
12745        }
12746
12747        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12748        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12749            self.0.request.name = v.into();
12750            self
12751        }
12752    }
12753
12754    #[doc(hidden)]
12755    impl gax::options::internal::RequestBuilder for GetOperation {
12756        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12757            &mut self.0.options
12758        }
12759    }
12760
12761    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
12762    ///
12763    /// # Example
12764    /// ```no_run
12765    /// # use google_cloud_discoveryengine_v1::builder;
12766    /// use builder::search_tuning_service::CancelOperation;
12767    /// # tokio_test::block_on(async {
12768    ///
12769    /// let builder = prepare_request_builder();
12770    /// let response = builder.send().await?;
12771    /// # gax::Result::<()>::Ok(()) });
12772    ///
12773    /// fn prepare_request_builder() -> CancelOperation {
12774    ///   # panic!();
12775    ///   // ... details omitted ...
12776    /// }
12777    /// ```
12778    #[derive(Clone, Debug)]
12779    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12780
12781    impl CancelOperation {
12782        pub(crate) fn new(
12783            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12784        ) -> Self {
12785            Self(RequestBuilder::new(stub))
12786        }
12787
12788        /// Sets the full request, replacing any prior values.
12789        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12790            mut self,
12791            v: V,
12792        ) -> Self {
12793            self.0.request = v.into();
12794            self
12795        }
12796
12797        /// Sets all the options, replacing any prior values.
12798        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12799            self.0.options = v.into();
12800            self
12801        }
12802
12803        /// Sends the request.
12804        pub async fn send(self) -> Result<()> {
12805            (*self.0.stub)
12806                .cancel_operation(self.0.request, self.0.options)
12807                .await
12808                .map(gax::response::Response::into_body)
12809        }
12810
12811        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12812        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12813            self.0.request.name = v.into();
12814            self
12815        }
12816    }
12817
12818    #[doc(hidden)]
12819    impl gax::options::internal::RequestBuilder for CancelOperation {
12820        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12821            &mut self.0.options
12822        }
12823    }
12824}
12825
12826#[cfg(feature = "serving-config-service")]
12827#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12828pub mod serving_config_service {
12829    use crate::Result;
12830
12831    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
12832    ///
12833    /// ```
12834    /// # tokio_test::block_on(async {
12835    /// # use google_cloud_discoveryengine_v1::*;
12836    /// # use builder::serving_config_service::ClientBuilder;
12837    /// # use client::ServingConfigService;
12838    /// let builder : ClientBuilder = ServingConfigService::builder();
12839    /// let client = builder
12840    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12841    ///     .build().await?;
12842    /// # gax::client_builder::Result::<()>::Ok(()) });
12843    /// ```
12844    pub type ClientBuilder =
12845        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12846
12847    pub(crate) mod client {
12848        use super::super::super::client::ServingConfigService;
12849        pub struct Factory;
12850        impl gax::client_builder::internal::ClientFactory for Factory {
12851            type Client = ServingConfigService;
12852            type Credentials = gaxi::options::Credentials;
12853            async fn build(
12854                self,
12855                config: gaxi::options::ClientConfig,
12856            ) -> gax::client_builder::Result<Self::Client> {
12857                Self::Client::new(config).await
12858            }
12859        }
12860    }
12861
12862    /// Common implementation for [crate::client::ServingConfigService] request builders.
12863    #[derive(Clone, Debug)]
12864    pub(crate) struct RequestBuilder<R: std::default::Default> {
12865        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12866        request: R,
12867        options: gax::options::RequestOptions,
12868    }
12869
12870    impl<R> RequestBuilder<R>
12871    where
12872        R: std::default::Default,
12873    {
12874        pub(crate) fn new(
12875            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12876        ) -> Self {
12877            Self {
12878                stub,
12879                request: R::default(),
12880                options: gax::options::RequestOptions::default(),
12881            }
12882        }
12883    }
12884
12885    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
12886    ///
12887    /// # Example
12888    /// ```no_run
12889    /// # use google_cloud_discoveryengine_v1::builder;
12890    /// use builder::serving_config_service::UpdateServingConfig;
12891    /// # tokio_test::block_on(async {
12892    ///
12893    /// let builder = prepare_request_builder();
12894    /// let response = builder.send().await?;
12895    /// # gax::Result::<()>::Ok(()) });
12896    ///
12897    /// fn prepare_request_builder() -> UpdateServingConfig {
12898    ///   # panic!();
12899    ///   // ... details omitted ...
12900    /// }
12901    /// ```
12902    #[derive(Clone, Debug)]
12903    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12904
12905    impl UpdateServingConfig {
12906        pub(crate) fn new(
12907            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12908        ) -> Self {
12909            Self(RequestBuilder::new(stub))
12910        }
12911
12912        /// Sets the full request, replacing any prior values.
12913        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12914            mut self,
12915            v: V,
12916        ) -> Self {
12917            self.0.request = v.into();
12918            self
12919        }
12920
12921        /// Sets all the options, replacing any prior values.
12922        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12923            self.0.options = v.into();
12924            self
12925        }
12926
12927        /// Sends the request.
12928        pub async fn send(self) -> Result<crate::model::ServingConfig> {
12929            (*self.0.stub)
12930                .update_serving_config(self.0.request, self.0.options)
12931                .await
12932                .map(gax::response::Response::into_body)
12933        }
12934
12935        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12936        ///
12937        /// This is a **required** field for requests.
12938        pub fn set_serving_config<T>(mut self, v: T) -> Self
12939        where
12940            T: std::convert::Into<crate::model::ServingConfig>,
12941        {
12942            self.0.request.serving_config = std::option::Option::Some(v.into());
12943            self
12944        }
12945
12946        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12947        ///
12948        /// This is a **required** field for requests.
12949        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12950        where
12951            T: std::convert::Into<crate::model::ServingConfig>,
12952        {
12953            self.0.request.serving_config = v.map(|x| x.into());
12954            self
12955        }
12956
12957        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12958        pub fn set_update_mask<T>(mut self, v: T) -> Self
12959        where
12960            T: std::convert::Into<wkt::FieldMask>,
12961        {
12962            self.0.request.update_mask = std::option::Option::Some(v.into());
12963            self
12964        }
12965
12966        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12967        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12968        where
12969            T: std::convert::Into<wkt::FieldMask>,
12970        {
12971            self.0.request.update_mask = v.map(|x| x.into());
12972            self
12973        }
12974    }
12975
12976    #[doc(hidden)]
12977    impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12978        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12979            &mut self.0.options
12980        }
12981    }
12982
12983    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
12984    ///
12985    /// # Example
12986    /// ```no_run
12987    /// # use google_cloud_discoveryengine_v1::builder;
12988    /// use builder::serving_config_service::ListOperations;
12989    /// # tokio_test::block_on(async {
12990    /// use gax::paginator::ItemPaginator;
12991    ///
12992    /// let builder = prepare_request_builder();
12993    /// let mut items = builder.by_item();
12994    /// while let Some(result) = items.next().await {
12995    ///   let item = result?;
12996    /// }
12997    /// # gax::Result::<()>::Ok(()) });
12998    ///
12999    /// fn prepare_request_builder() -> ListOperations {
13000    ///   # panic!();
13001    ///   // ... details omitted ...
13002    /// }
13003    /// ```
13004    #[derive(Clone, Debug)]
13005    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13006
13007    impl ListOperations {
13008        pub(crate) fn new(
13009            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13010        ) -> Self {
13011            Self(RequestBuilder::new(stub))
13012        }
13013
13014        /// Sets the full request, replacing any prior values.
13015        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13016            mut self,
13017            v: V,
13018        ) -> Self {
13019            self.0.request = v.into();
13020            self
13021        }
13022
13023        /// Sets all the options, replacing any prior values.
13024        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13025            self.0.options = v.into();
13026            self
13027        }
13028
13029        /// Sends the request.
13030        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13031            (*self.0.stub)
13032                .list_operations(self.0.request, self.0.options)
13033                .await
13034                .map(gax::response::Response::into_body)
13035        }
13036
13037        /// Streams each page in the collection.
13038        pub fn by_page(
13039            self,
13040        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13041        {
13042            use std::clone::Clone;
13043            let token = self.0.request.page_token.clone();
13044            let execute = move |token: String| {
13045                let mut builder = self.clone();
13046                builder.0.request = builder.0.request.set_page_token(token);
13047                builder.send()
13048            };
13049            gax::paginator::internal::new_paginator(token, execute)
13050        }
13051
13052        /// Streams each item in the collection.
13053        pub fn by_item(
13054            self,
13055        ) -> impl gax::paginator::ItemPaginator<
13056            longrunning::model::ListOperationsResponse,
13057            gax::error::Error,
13058        > {
13059            use gax::paginator::Paginator;
13060            self.by_page().items()
13061        }
13062
13063        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
13064        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13065            self.0.request.name = v.into();
13066            self
13067        }
13068
13069        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
13070        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13071            self.0.request.filter = v.into();
13072            self
13073        }
13074
13075        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
13076        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13077            self.0.request.page_size = v.into();
13078            self
13079        }
13080
13081        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
13082        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13083            self.0.request.page_token = v.into();
13084            self
13085        }
13086
13087        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
13088        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13089            self.0.request.return_partial_success = v.into();
13090            self
13091        }
13092    }
13093
13094    #[doc(hidden)]
13095    impl gax::options::internal::RequestBuilder for ListOperations {
13096        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13097            &mut self.0.options
13098        }
13099    }
13100
13101    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
13102    ///
13103    /// # Example
13104    /// ```no_run
13105    /// # use google_cloud_discoveryengine_v1::builder;
13106    /// use builder::serving_config_service::GetOperation;
13107    /// # tokio_test::block_on(async {
13108    ///
13109    /// let builder = prepare_request_builder();
13110    /// let response = builder.send().await?;
13111    /// # gax::Result::<()>::Ok(()) });
13112    ///
13113    /// fn prepare_request_builder() -> GetOperation {
13114    ///   # panic!();
13115    ///   // ... details omitted ...
13116    /// }
13117    /// ```
13118    #[derive(Clone, Debug)]
13119    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13120
13121    impl GetOperation {
13122        pub(crate) fn new(
13123            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13124        ) -> Self {
13125            Self(RequestBuilder::new(stub))
13126        }
13127
13128        /// Sets the full request, replacing any prior values.
13129        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13130            mut self,
13131            v: V,
13132        ) -> Self {
13133            self.0.request = v.into();
13134            self
13135        }
13136
13137        /// Sets all the options, replacing any prior values.
13138        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13139            self.0.options = v.into();
13140            self
13141        }
13142
13143        /// Sends the request.
13144        pub async fn send(self) -> Result<longrunning::model::Operation> {
13145            (*self.0.stub)
13146                .get_operation(self.0.request, self.0.options)
13147                .await
13148                .map(gax::response::Response::into_body)
13149        }
13150
13151        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13152        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13153            self.0.request.name = v.into();
13154            self
13155        }
13156    }
13157
13158    #[doc(hidden)]
13159    impl gax::options::internal::RequestBuilder for GetOperation {
13160        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13161            &mut self.0.options
13162        }
13163    }
13164
13165    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13166    ///
13167    /// # Example
13168    /// ```no_run
13169    /// # use google_cloud_discoveryengine_v1::builder;
13170    /// use builder::serving_config_service::CancelOperation;
13171    /// # tokio_test::block_on(async {
13172    ///
13173    /// let builder = prepare_request_builder();
13174    /// let response = builder.send().await?;
13175    /// # gax::Result::<()>::Ok(()) });
13176    ///
13177    /// fn prepare_request_builder() -> CancelOperation {
13178    ///   # panic!();
13179    ///   // ... details omitted ...
13180    /// }
13181    /// ```
13182    #[derive(Clone, Debug)]
13183    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13184
13185    impl CancelOperation {
13186        pub(crate) fn new(
13187            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13188        ) -> Self {
13189            Self(RequestBuilder::new(stub))
13190        }
13191
13192        /// Sets the full request, replacing any prior values.
13193        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13194            mut self,
13195            v: V,
13196        ) -> Self {
13197            self.0.request = v.into();
13198            self
13199        }
13200
13201        /// Sets all the options, replacing any prior values.
13202        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13203            self.0.options = v.into();
13204            self
13205        }
13206
13207        /// Sends the request.
13208        pub async fn send(self) -> Result<()> {
13209            (*self.0.stub)
13210                .cancel_operation(self.0.request, self.0.options)
13211                .await
13212                .map(gax::response::Response::into_body)
13213        }
13214
13215        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13216        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13217            self.0.request.name = v.into();
13218            self
13219        }
13220    }
13221
13222    #[doc(hidden)]
13223    impl gax::options::internal::RequestBuilder for CancelOperation {
13224        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13225            &mut self.0.options
13226        }
13227    }
13228}
13229
13230#[cfg(feature = "session-service")]
13231#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13232pub mod session_service {
13233    use crate::Result;
13234
13235    /// A builder for [SessionService][crate::client::SessionService].
13236    ///
13237    /// ```
13238    /// # tokio_test::block_on(async {
13239    /// # use google_cloud_discoveryengine_v1::*;
13240    /// # use builder::session_service::ClientBuilder;
13241    /// # use client::SessionService;
13242    /// let builder : ClientBuilder = SessionService::builder();
13243    /// let client = builder
13244    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13245    ///     .build().await?;
13246    /// # gax::client_builder::Result::<()>::Ok(()) });
13247    /// ```
13248    pub type ClientBuilder =
13249        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13250
13251    pub(crate) mod client {
13252        use super::super::super::client::SessionService;
13253        pub struct Factory;
13254        impl gax::client_builder::internal::ClientFactory for Factory {
13255            type Client = SessionService;
13256            type Credentials = gaxi::options::Credentials;
13257            async fn build(
13258                self,
13259                config: gaxi::options::ClientConfig,
13260            ) -> gax::client_builder::Result<Self::Client> {
13261                Self::Client::new(config).await
13262            }
13263        }
13264    }
13265
13266    /// Common implementation for [crate::client::SessionService] request builders.
13267    #[derive(Clone, Debug)]
13268    pub(crate) struct RequestBuilder<R: std::default::Default> {
13269        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13270        request: R,
13271        options: gax::options::RequestOptions,
13272    }
13273
13274    impl<R> RequestBuilder<R>
13275    where
13276        R: std::default::Default,
13277    {
13278        pub(crate) fn new(
13279            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13280        ) -> Self {
13281            Self {
13282                stub,
13283                request: R::default(),
13284                options: gax::options::RequestOptions::default(),
13285            }
13286        }
13287    }
13288
13289    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13290    ///
13291    /// # Example
13292    /// ```no_run
13293    /// # use google_cloud_discoveryengine_v1::builder;
13294    /// use builder::session_service::CreateSession;
13295    /// # tokio_test::block_on(async {
13296    ///
13297    /// let builder = prepare_request_builder();
13298    /// let response = builder.send().await?;
13299    /// # gax::Result::<()>::Ok(()) });
13300    ///
13301    /// fn prepare_request_builder() -> CreateSession {
13302    ///   # panic!();
13303    ///   // ... details omitted ...
13304    /// }
13305    /// ```
13306    #[derive(Clone, Debug)]
13307    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13308
13309    impl CreateSession {
13310        pub(crate) fn new(
13311            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13312        ) -> Self {
13313            Self(RequestBuilder::new(stub))
13314        }
13315
13316        /// Sets the full request, replacing any prior values.
13317        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13318            self.0.request = v.into();
13319            self
13320        }
13321
13322        /// Sets all the options, replacing any prior values.
13323        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13324            self.0.options = v.into();
13325            self
13326        }
13327
13328        /// Sends the request.
13329        pub async fn send(self) -> Result<crate::model::Session> {
13330            (*self.0.stub)
13331                .create_session(self.0.request, self.0.options)
13332                .await
13333                .map(gax::response::Response::into_body)
13334        }
13335
13336        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13337        ///
13338        /// This is a **required** field for requests.
13339        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13340            self.0.request.parent = v.into();
13341            self
13342        }
13343
13344        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13345        ///
13346        /// This is a **required** field for requests.
13347        pub fn set_session<T>(mut self, v: T) -> Self
13348        where
13349            T: std::convert::Into<crate::model::Session>,
13350        {
13351            self.0.request.session = std::option::Option::Some(v.into());
13352            self
13353        }
13354
13355        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13356        ///
13357        /// This is a **required** field for requests.
13358        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13359        where
13360            T: std::convert::Into<crate::model::Session>,
13361        {
13362            self.0.request.session = v.map(|x| x.into());
13363            self
13364        }
13365    }
13366
13367    #[doc(hidden)]
13368    impl gax::options::internal::RequestBuilder for CreateSession {
13369        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13370            &mut self.0.options
13371        }
13372    }
13373
13374    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13375    ///
13376    /// # Example
13377    /// ```no_run
13378    /// # use google_cloud_discoveryengine_v1::builder;
13379    /// use builder::session_service::DeleteSession;
13380    /// # tokio_test::block_on(async {
13381    ///
13382    /// let builder = prepare_request_builder();
13383    /// let response = builder.send().await?;
13384    /// # gax::Result::<()>::Ok(()) });
13385    ///
13386    /// fn prepare_request_builder() -> DeleteSession {
13387    ///   # panic!();
13388    ///   // ... details omitted ...
13389    /// }
13390    /// ```
13391    #[derive(Clone, Debug)]
13392    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13393
13394    impl DeleteSession {
13395        pub(crate) fn new(
13396            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13397        ) -> Self {
13398            Self(RequestBuilder::new(stub))
13399        }
13400
13401        /// Sets the full request, replacing any prior values.
13402        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13403            self.0.request = v.into();
13404            self
13405        }
13406
13407        /// Sets all the options, replacing any prior values.
13408        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13409            self.0.options = v.into();
13410            self
13411        }
13412
13413        /// Sends the request.
13414        pub async fn send(self) -> Result<()> {
13415            (*self.0.stub)
13416                .delete_session(self.0.request, self.0.options)
13417                .await
13418                .map(gax::response::Response::into_body)
13419        }
13420
13421        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13422        ///
13423        /// This is a **required** field for requests.
13424        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13425            self.0.request.name = v.into();
13426            self
13427        }
13428    }
13429
13430    #[doc(hidden)]
13431    impl gax::options::internal::RequestBuilder for DeleteSession {
13432        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13433            &mut self.0.options
13434        }
13435    }
13436
13437    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13438    ///
13439    /// # Example
13440    /// ```no_run
13441    /// # use google_cloud_discoveryengine_v1::builder;
13442    /// use builder::session_service::UpdateSession;
13443    /// # tokio_test::block_on(async {
13444    ///
13445    /// let builder = prepare_request_builder();
13446    /// let response = builder.send().await?;
13447    /// # gax::Result::<()>::Ok(()) });
13448    ///
13449    /// fn prepare_request_builder() -> UpdateSession {
13450    ///   # panic!();
13451    ///   // ... details omitted ...
13452    /// }
13453    /// ```
13454    #[derive(Clone, Debug)]
13455    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13456
13457    impl UpdateSession {
13458        pub(crate) fn new(
13459            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13460        ) -> Self {
13461            Self(RequestBuilder::new(stub))
13462        }
13463
13464        /// Sets the full request, replacing any prior values.
13465        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13466            self.0.request = v.into();
13467            self
13468        }
13469
13470        /// Sets all the options, replacing any prior values.
13471        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13472            self.0.options = v.into();
13473            self
13474        }
13475
13476        /// Sends the request.
13477        pub async fn send(self) -> Result<crate::model::Session> {
13478            (*self.0.stub)
13479                .update_session(self.0.request, self.0.options)
13480                .await
13481                .map(gax::response::Response::into_body)
13482        }
13483
13484        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13485        ///
13486        /// This is a **required** field for requests.
13487        pub fn set_session<T>(mut self, v: T) -> Self
13488        where
13489            T: std::convert::Into<crate::model::Session>,
13490        {
13491            self.0.request.session = std::option::Option::Some(v.into());
13492            self
13493        }
13494
13495        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13496        ///
13497        /// This is a **required** field for requests.
13498        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13499        where
13500            T: std::convert::Into<crate::model::Session>,
13501        {
13502            self.0.request.session = v.map(|x| x.into());
13503            self
13504        }
13505
13506        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13507        pub fn set_update_mask<T>(mut self, v: T) -> Self
13508        where
13509            T: std::convert::Into<wkt::FieldMask>,
13510        {
13511            self.0.request.update_mask = std::option::Option::Some(v.into());
13512            self
13513        }
13514
13515        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13516        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13517        where
13518            T: std::convert::Into<wkt::FieldMask>,
13519        {
13520            self.0.request.update_mask = v.map(|x| x.into());
13521            self
13522        }
13523    }
13524
13525    #[doc(hidden)]
13526    impl gax::options::internal::RequestBuilder for UpdateSession {
13527        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13528            &mut self.0.options
13529        }
13530    }
13531
13532    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13533    ///
13534    /// # Example
13535    /// ```no_run
13536    /// # use google_cloud_discoveryengine_v1::builder;
13537    /// use builder::session_service::GetSession;
13538    /// # tokio_test::block_on(async {
13539    ///
13540    /// let builder = prepare_request_builder();
13541    /// let response = builder.send().await?;
13542    /// # gax::Result::<()>::Ok(()) });
13543    ///
13544    /// fn prepare_request_builder() -> GetSession {
13545    ///   # panic!();
13546    ///   // ... details omitted ...
13547    /// }
13548    /// ```
13549    #[derive(Clone, Debug)]
13550    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13551
13552    impl GetSession {
13553        pub(crate) fn new(
13554            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13555        ) -> Self {
13556            Self(RequestBuilder::new(stub))
13557        }
13558
13559        /// Sets the full request, replacing any prior values.
13560        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13561            self.0.request = v.into();
13562            self
13563        }
13564
13565        /// Sets all the options, replacing any prior values.
13566        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13567            self.0.options = v.into();
13568            self
13569        }
13570
13571        /// Sends the request.
13572        pub async fn send(self) -> Result<crate::model::Session> {
13573            (*self.0.stub)
13574                .get_session(self.0.request, self.0.options)
13575                .await
13576                .map(gax::response::Response::into_body)
13577        }
13578
13579        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13580        ///
13581        /// This is a **required** field for requests.
13582        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13583            self.0.request.name = v.into();
13584            self
13585        }
13586
13587        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13588        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13589            self.0.request.include_answer_details = v.into();
13590            self
13591        }
13592    }
13593
13594    #[doc(hidden)]
13595    impl gax::options::internal::RequestBuilder for GetSession {
13596        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13597            &mut self.0.options
13598        }
13599    }
13600
13601    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13602    ///
13603    /// # Example
13604    /// ```no_run
13605    /// # use google_cloud_discoveryengine_v1::builder;
13606    /// use builder::session_service::ListSessions;
13607    /// # tokio_test::block_on(async {
13608    /// use gax::paginator::ItemPaginator;
13609    ///
13610    /// let builder = prepare_request_builder();
13611    /// let mut items = builder.by_item();
13612    /// while let Some(result) = items.next().await {
13613    ///   let item = result?;
13614    /// }
13615    /// # gax::Result::<()>::Ok(()) });
13616    ///
13617    /// fn prepare_request_builder() -> ListSessions {
13618    ///   # panic!();
13619    ///   // ... details omitted ...
13620    /// }
13621    /// ```
13622    #[derive(Clone, Debug)]
13623    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13624
13625    impl ListSessions {
13626        pub(crate) fn new(
13627            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13628        ) -> Self {
13629            Self(RequestBuilder::new(stub))
13630        }
13631
13632        /// Sets the full request, replacing any prior values.
13633        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13634            self.0.request = v.into();
13635            self
13636        }
13637
13638        /// Sets all the options, replacing any prior values.
13639        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13640            self.0.options = v.into();
13641            self
13642        }
13643
13644        /// Sends the request.
13645        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13646            (*self.0.stub)
13647                .list_sessions(self.0.request, self.0.options)
13648                .await
13649                .map(gax::response::Response::into_body)
13650        }
13651
13652        /// Streams each page in the collection.
13653        pub fn by_page(
13654            self,
13655        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13656        {
13657            use std::clone::Clone;
13658            let token = self.0.request.page_token.clone();
13659            let execute = move |token: String| {
13660                let mut builder = self.clone();
13661                builder.0.request = builder.0.request.set_page_token(token);
13662                builder.send()
13663            };
13664            gax::paginator::internal::new_paginator(token, execute)
13665        }
13666
13667        /// Streams each item in the collection.
13668        pub fn by_item(
13669            self,
13670        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13671        {
13672            use gax::paginator::Paginator;
13673            self.by_page().items()
13674        }
13675
13676        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
13677        ///
13678        /// This is a **required** field for requests.
13679        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680            self.0.request.parent = v.into();
13681            self
13682        }
13683
13684        /// Sets the value of [page_size][crate::model::ListSessionsRequest::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][crate::model::ListSessionsRequest::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 [filter][crate::model::ListSessionsRequest::filter].
13697        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13698            self.0.request.filter = v.into();
13699            self
13700        }
13701
13702        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
13703        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13704            self.0.request.order_by = v.into();
13705            self
13706        }
13707    }
13708
13709    #[doc(hidden)]
13710    impl gax::options::internal::RequestBuilder for ListSessions {
13711        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13712            &mut self.0.options
13713        }
13714    }
13715
13716    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
13717    ///
13718    /// # Example
13719    /// ```no_run
13720    /// # use google_cloud_discoveryengine_v1::builder;
13721    /// use builder::session_service::ListOperations;
13722    /// # tokio_test::block_on(async {
13723    /// use gax::paginator::ItemPaginator;
13724    ///
13725    /// let builder = prepare_request_builder();
13726    /// let mut items = builder.by_item();
13727    /// while let Some(result) = items.next().await {
13728    ///   let item = result?;
13729    /// }
13730    /// # gax::Result::<()>::Ok(()) });
13731    ///
13732    /// fn prepare_request_builder() -> ListOperations {
13733    ///   # panic!();
13734    ///   // ... details omitted ...
13735    /// }
13736    /// ```
13737    #[derive(Clone, Debug)]
13738    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13739
13740    impl ListOperations {
13741        pub(crate) fn new(
13742            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13743        ) -> Self {
13744            Self(RequestBuilder::new(stub))
13745        }
13746
13747        /// Sets the full request, replacing any prior values.
13748        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13749            mut self,
13750            v: V,
13751        ) -> Self {
13752            self.0.request = v.into();
13753            self
13754        }
13755
13756        /// Sets all the options, replacing any prior values.
13757        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13758            self.0.options = v.into();
13759            self
13760        }
13761
13762        /// Sends the request.
13763        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13764            (*self.0.stub)
13765                .list_operations(self.0.request, self.0.options)
13766                .await
13767                .map(gax::response::Response::into_body)
13768        }
13769
13770        /// Streams each page in the collection.
13771        pub fn by_page(
13772            self,
13773        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13774        {
13775            use std::clone::Clone;
13776            let token = self.0.request.page_token.clone();
13777            let execute = move |token: String| {
13778                let mut builder = self.clone();
13779                builder.0.request = builder.0.request.set_page_token(token);
13780                builder.send()
13781            };
13782            gax::paginator::internal::new_paginator(token, execute)
13783        }
13784
13785        /// Streams each item in the collection.
13786        pub fn by_item(
13787            self,
13788        ) -> impl gax::paginator::ItemPaginator<
13789            longrunning::model::ListOperationsResponse,
13790            gax::error::Error,
13791        > {
13792            use gax::paginator::Paginator;
13793            self.by_page().items()
13794        }
13795
13796        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
13797        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13798            self.0.request.name = v.into();
13799            self
13800        }
13801
13802        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
13803        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13804            self.0.request.filter = v.into();
13805            self
13806        }
13807
13808        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
13809        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13810            self.0.request.page_size = v.into();
13811            self
13812        }
13813
13814        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
13815        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13816            self.0.request.page_token = v.into();
13817            self
13818        }
13819
13820        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
13821        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13822            self.0.request.return_partial_success = v.into();
13823            self
13824        }
13825    }
13826
13827    #[doc(hidden)]
13828    impl gax::options::internal::RequestBuilder for ListOperations {
13829        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13830            &mut self.0.options
13831        }
13832    }
13833
13834    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
13835    ///
13836    /// # Example
13837    /// ```no_run
13838    /// # use google_cloud_discoveryengine_v1::builder;
13839    /// use builder::session_service::GetOperation;
13840    /// # tokio_test::block_on(async {
13841    ///
13842    /// let builder = prepare_request_builder();
13843    /// let response = builder.send().await?;
13844    /// # gax::Result::<()>::Ok(()) });
13845    ///
13846    /// fn prepare_request_builder() -> GetOperation {
13847    ///   # panic!();
13848    ///   // ... details omitted ...
13849    /// }
13850    /// ```
13851    #[derive(Clone, Debug)]
13852    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13853
13854    impl GetOperation {
13855        pub(crate) fn new(
13856            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13857        ) -> Self {
13858            Self(RequestBuilder::new(stub))
13859        }
13860
13861        /// Sets the full request, replacing any prior values.
13862        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13863            mut self,
13864            v: V,
13865        ) -> Self {
13866            self.0.request = v.into();
13867            self
13868        }
13869
13870        /// Sets all the options, replacing any prior values.
13871        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13872            self.0.options = v.into();
13873            self
13874        }
13875
13876        /// Sends the request.
13877        pub async fn send(self) -> Result<longrunning::model::Operation> {
13878            (*self.0.stub)
13879                .get_operation(self.0.request, self.0.options)
13880                .await
13881                .map(gax::response::Response::into_body)
13882        }
13883
13884        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13885        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13886            self.0.request.name = v.into();
13887            self
13888        }
13889    }
13890
13891    #[doc(hidden)]
13892    impl gax::options::internal::RequestBuilder for GetOperation {
13893        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13894            &mut self.0.options
13895        }
13896    }
13897
13898    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
13899    ///
13900    /// # Example
13901    /// ```no_run
13902    /// # use google_cloud_discoveryengine_v1::builder;
13903    /// use builder::session_service::CancelOperation;
13904    /// # tokio_test::block_on(async {
13905    ///
13906    /// let builder = prepare_request_builder();
13907    /// let response = builder.send().await?;
13908    /// # gax::Result::<()>::Ok(()) });
13909    ///
13910    /// fn prepare_request_builder() -> CancelOperation {
13911    ///   # panic!();
13912    ///   // ... details omitted ...
13913    /// }
13914    /// ```
13915    #[derive(Clone, Debug)]
13916    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13917
13918    impl CancelOperation {
13919        pub(crate) fn new(
13920            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13921        ) -> Self {
13922            Self(RequestBuilder::new(stub))
13923        }
13924
13925        /// Sets the full request, replacing any prior values.
13926        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13927            mut self,
13928            v: V,
13929        ) -> Self {
13930            self.0.request = v.into();
13931            self
13932        }
13933
13934        /// Sets all the options, replacing any prior values.
13935        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13936            self.0.options = v.into();
13937            self
13938        }
13939
13940        /// Sends the request.
13941        pub async fn send(self) -> Result<()> {
13942            (*self.0.stub)
13943                .cancel_operation(self.0.request, self.0.options)
13944                .await
13945                .map(gax::response::Response::into_body)
13946        }
13947
13948        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13949        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13950            self.0.request.name = v.into();
13951            self
13952        }
13953    }
13954
13955    #[doc(hidden)]
13956    impl gax::options::internal::RequestBuilder for CancelOperation {
13957        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13958            &mut self.0.options
13959        }
13960    }
13961}
13962
13963#[cfg(feature = "site-search-engine-service")]
13964#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13965pub mod site_search_engine_service {
13966    use crate::Result;
13967
13968    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
13969    ///
13970    /// ```
13971    /// # tokio_test::block_on(async {
13972    /// # use google_cloud_discoveryengine_v1::*;
13973    /// # use builder::site_search_engine_service::ClientBuilder;
13974    /// # use client::SiteSearchEngineService;
13975    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
13976    /// let client = builder
13977    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13978    ///     .build().await?;
13979    /// # gax::client_builder::Result::<()>::Ok(()) });
13980    /// ```
13981    pub type ClientBuilder =
13982        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13983
13984    pub(crate) mod client {
13985        use super::super::super::client::SiteSearchEngineService;
13986        pub struct Factory;
13987        impl gax::client_builder::internal::ClientFactory for Factory {
13988            type Client = SiteSearchEngineService;
13989            type Credentials = gaxi::options::Credentials;
13990            async fn build(
13991                self,
13992                config: gaxi::options::ClientConfig,
13993            ) -> gax::client_builder::Result<Self::Client> {
13994                Self::Client::new(config).await
13995            }
13996        }
13997    }
13998
13999    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14000    #[derive(Clone, Debug)]
14001    pub(crate) struct RequestBuilder<R: std::default::Default> {
14002        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14003        request: R,
14004        options: gax::options::RequestOptions,
14005    }
14006
14007    impl<R> RequestBuilder<R>
14008    where
14009        R: std::default::Default,
14010    {
14011        pub(crate) fn new(
14012            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14013        ) -> Self {
14014            Self {
14015                stub,
14016                request: R::default(),
14017                options: gax::options::RequestOptions::default(),
14018            }
14019        }
14020    }
14021
14022    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
14023    ///
14024    /// # Example
14025    /// ```no_run
14026    /// # use google_cloud_discoveryengine_v1::builder;
14027    /// use builder::site_search_engine_service::GetSiteSearchEngine;
14028    /// # tokio_test::block_on(async {
14029    ///
14030    /// let builder = prepare_request_builder();
14031    /// let response = builder.send().await?;
14032    /// # gax::Result::<()>::Ok(()) });
14033    ///
14034    /// fn prepare_request_builder() -> GetSiteSearchEngine {
14035    ///   # panic!();
14036    ///   // ... details omitted ...
14037    /// }
14038    /// ```
14039    #[derive(Clone, Debug)]
14040    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14041
14042    impl GetSiteSearchEngine {
14043        pub(crate) fn new(
14044            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14045        ) -> Self {
14046            Self(RequestBuilder::new(stub))
14047        }
14048
14049        /// Sets the full request, replacing any prior values.
14050        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14051            mut self,
14052            v: V,
14053        ) -> Self {
14054            self.0.request = v.into();
14055            self
14056        }
14057
14058        /// Sets all the options, replacing any prior values.
14059        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14060            self.0.options = v.into();
14061            self
14062        }
14063
14064        /// Sends the request.
14065        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14066            (*self.0.stub)
14067                .get_site_search_engine(self.0.request, self.0.options)
14068                .await
14069                .map(gax::response::Response::into_body)
14070        }
14071
14072        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
14073        ///
14074        /// This is a **required** field for requests.
14075        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14076            self.0.request.name = v.into();
14077            self
14078        }
14079    }
14080
14081    #[doc(hidden)]
14082    impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
14083        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14084            &mut self.0.options
14085        }
14086    }
14087
14088    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
14089    ///
14090    /// # Example
14091    /// ```no_run
14092    /// # use google_cloud_discoveryengine_v1::builder;
14093    /// use builder::site_search_engine_service::CreateTargetSite;
14094    /// # tokio_test::block_on(async {
14095    /// use lro::Poller;
14096    ///
14097    /// let builder = prepare_request_builder();
14098    /// let response = builder.poller().until_done().await?;
14099    /// # gax::Result::<()>::Ok(()) });
14100    ///
14101    /// fn prepare_request_builder() -> CreateTargetSite {
14102    ///   # panic!();
14103    ///   // ... details omitted ...
14104    /// }
14105    /// ```
14106    #[derive(Clone, Debug)]
14107    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14108
14109    impl CreateTargetSite {
14110        pub(crate) fn new(
14111            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14112        ) -> Self {
14113            Self(RequestBuilder::new(stub))
14114        }
14115
14116        /// Sets the full request, replacing any prior values.
14117        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14118            mut self,
14119            v: V,
14120        ) -> Self {
14121            self.0.request = v.into();
14122            self
14123        }
14124
14125        /// Sets all the options, replacing any prior values.
14126        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14127            self.0.options = v.into();
14128            self
14129        }
14130
14131        /// Sends the request.
14132        ///
14133        /// # Long running operations
14134        ///
14135        /// This starts, but does not poll, a longrunning operation. More information
14136        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14137        pub async fn send(self) -> Result<longrunning::model::Operation> {
14138            (*self.0.stub)
14139                .create_target_site(self.0.request, self.0.options)
14140                .await
14141                .map(gax::response::Response::into_body)
14142        }
14143
14144        /// Creates a [Poller][lro::Poller] to work with `create_target_site`.
14145        pub fn poller(
14146            self,
14147        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14148        {
14149            type Operation = lro::internal::Operation<
14150                crate::model::TargetSite,
14151                crate::model::CreateTargetSiteMetadata,
14152            >;
14153            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14154            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14155
14156            let stub = self.0.stub.clone();
14157            let mut options = self.0.options.clone();
14158            options.set_retry_policy(gax::retry_policy::NeverRetry);
14159            let query = move |name| {
14160                let stub = stub.clone();
14161                let options = options.clone();
14162                async {
14163                    let op = GetOperation::new(stub)
14164                        .set_name(name)
14165                        .with_options(options)
14166                        .send()
14167                        .await?;
14168                    Ok(Operation::new(op))
14169                }
14170            };
14171
14172            let start = move || async {
14173                let op = self.send().await?;
14174                Ok(Operation::new(op))
14175            };
14176
14177            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14178        }
14179
14180        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14181        ///
14182        /// This is a **required** field for requests.
14183        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14184            self.0.request.parent = v.into();
14185            self
14186        }
14187
14188        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14189        ///
14190        /// This is a **required** field for requests.
14191        pub fn set_target_site<T>(mut self, v: T) -> Self
14192        where
14193            T: std::convert::Into<crate::model::TargetSite>,
14194        {
14195            self.0.request.target_site = std::option::Option::Some(v.into());
14196            self
14197        }
14198
14199        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14200        ///
14201        /// This is a **required** field for requests.
14202        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14203        where
14204            T: std::convert::Into<crate::model::TargetSite>,
14205        {
14206            self.0.request.target_site = v.map(|x| x.into());
14207            self
14208        }
14209    }
14210
14211    #[doc(hidden)]
14212    impl gax::options::internal::RequestBuilder for CreateTargetSite {
14213        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14214            &mut self.0.options
14215        }
14216    }
14217
14218    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14219    ///
14220    /// # Example
14221    /// ```no_run
14222    /// # use google_cloud_discoveryengine_v1::builder;
14223    /// use builder::site_search_engine_service::BatchCreateTargetSites;
14224    /// # tokio_test::block_on(async {
14225    /// use lro::Poller;
14226    ///
14227    /// let builder = prepare_request_builder();
14228    /// let response = builder.poller().until_done().await?;
14229    /// # gax::Result::<()>::Ok(()) });
14230    ///
14231    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14232    ///   # panic!();
14233    ///   // ... details omitted ...
14234    /// }
14235    /// ```
14236    #[derive(Clone, Debug)]
14237    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14238
14239    impl BatchCreateTargetSites {
14240        pub(crate) fn new(
14241            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14242        ) -> Self {
14243            Self(RequestBuilder::new(stub))
14244        }
14245
14246        /// Sets the full request, replacing any prior values.
14247        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14248            mut self,
14249            v: V,
14250        ) -> Self {
14251            self.0.request = v.into();
14252            self
14253        }
14254
14255        /// Sets all the options, replacing any prior values.
14256        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14257            self.0.options = v.into();
14258            self
14259        }
14260
14261        /// Sends the request.
14262        ///
14263        /// # Long running operations
14264        ///
14265        /// This starts, but does not poll, a longrunning operation. More information
14266        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14267        pub async fn send(self) -> Result<longrunning::model::Operation> {
14268            (*self.0.stub)
14269                .batch_create_target_sites(self.0.request, self.0.options)
14270                .await
14271                .map(gax::response::Response::into_body)
14272        }
14273
14274        /// Creates a [Poller][lro::Poller] to work with `batch_create_target_sites`.
14275        pub fn poller(
14276            self,
14277        ) -> impl lro::Poller<
14278            crate::model::BatchCreateTargetSitesResponse,
14279            crate::model::BatchCreateTargetSiteMetadata,
14280        > {
14281            type Operation = lro::internal::Operation<
14282                crate::model::BatchCreateTargetSitesResponse,
14283                crate::model::BatchCreateTargetSiteMetadata,
14284            >;
14285            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14286            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14287
14288            let stub = self.0.stub.clone();
14289            let mut options = self.0.options.clone();
14290            options.set_retry_policy(gax::retry_policy::NeverRetry);
14291            let query = move |name| {
14292                let stub = stub.clone();
14293                let options = options.clone();
14294                async {
14295                    let op = GetOperation::new(stub)
14296                        .set_name(name)
14297                        .with_options(options)
14298                        .send()
14299                        .await?;
14300                    Ok(Operation::new(op))
14301                }
14302            };
14303
14304            let start = move || async {
14305                let op = self.send().await?;
14306                Ok(Operation::new(op))
14307            };
14308
14309            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14310        }
14311
14312        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14313        ///
14314        /// This is a **required** field for requests.
14315        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14316            self.0.request.parent = v.into();
14317            self
14318        }
14319
14320        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14321        ///
14322        /// This is a **required** field for requests.
14323        pub fn set_requests<T, V>(mut self, v: T) -> Self
14324        where
14325            T: std::iter::IntoIterator<Item = V>,
14326            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14327        {
14328            use std::iter::Iterator;
14329            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14330            self
14331        }
14332    }
14333
14334    #[doc(hidden)]
14335    impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14336        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14337            &mut self.0.options
14338        }
14339    }
14340
14341    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14342    ///
14343    /// # Example
14344    /// ```no_run
14345    /// # use google_cloud_discoveryengine_v1::builder;
14346    /// use builder::site_search_engine_service::GetTargetSite;
14347    /// # tokio_test::block_on(async {
14348    ///
14349    /// let builder = prepare_request_builder();
14350    /// let response = builder.send().await?;
14351    /// # gax::Result::<()>::Ok(()) });
14352    ///
14353    /// fn prepare_request_builder() -> GetTargetSite {
14354    ///   # panic!();
14355    ///   // ... details omitted ...
14356    /// }
14357    /// ```
14358    #[derive(Clone, Debug)]
14359    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14360
14361    impl GetTargetSite {
14362        pub(crate) fn new(
14363            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14364        ) -> Self {
14365            Self(RequestBuilder::new(stub))
14366        }
14367
14368        /// Sets the full request, replacing any prior values.
14369        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14370            self.0.request = v.into();
14371            self
14372        }
14373
14374        /// Sets all the options, replacing any prior values.
14375        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14376            self.0.options = v.into();
14377            self
14378        }
14379
14380        /// Sends the request.
14381        pub async fn send(self) -> Result<crate::model::TargetSite> {
14382            (*self.0.stub)
14383                .get_target_site(self.0.request, self.0.options)
14384                .await
14385                .map(gax::response::Response::into_body)
14386        }
14387
14388        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14389        ///
14390        /// This is a **required** field for requests.
14391        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14392            self.0.request.name = v.into();
14393            self
14394        }
14395    }
14396
14397    #[doc(hidden)]
14398    impl gax::options::internal::RequestBuilder for GetTargetSite {
14399        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14400            &mut self.0.options
14401        }
14402    }
14403
14404    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14405    ///
14406    /// # Example
14407    /// ```no_run
14408    /// # use google_cloud_discoveryengine_v1::builder;
14409    /// use builder::site_search_engine_service::UpdateTargetSite;
14410    /// # tokio_test::block_on(async {
14411    /// use lro::Poller;
14412    ///
14413    /// let builder = prepare_request_builder();
14414    /// let response = builder.poller().until_done().await?;
14415    /// # gax::Result::<()>::Ok(()) });
14416    ///
14417    /// fn prepare_request_builder() -> UpdateTargetSite {
14418    ///   # panic!();
14419    ///   // ... details omitted ...
14420    /// }
14421    /// ```
14422    #[derive(Clone, Debug)]
14423    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14424
14425    impl UpdateTargetSite {
14426        pub(crate) fn new(
14427            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14428        ) -> Self {
14429            Self(RequestBuilder::new(stub))
14430        }
14431
14432        /// Sets the full request, replacing any prior values.
14433        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14434            mut self,
14435            v: V,
14436        ) -> Self {
14437            self.0.request = v.into();
14438            self
14439        }
14440
14441        /// Sets all the options, replacing any prior values.
14442        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14443            self.0.options = v.into();
14444            self
14445        }
14446
14447        /// Sends the request.
14448        ///
14449        /// # Long running operations
14450        ///
14451        /// This starts, but does not poll, a longrunning operation. More information
14452        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14453        pub async fn send(self) -> Result<longrunning::model::Operation> {
14454            (*self.0.stub)
14455                .update_target_site(self.0.request, self.0.options)
14456                .await
14457                .map(gax::response::Response::into_body)
14458        }
14459
14460        /// Creates a [Poller][lro::Poller] to work with `update_target_site`.
14461        pub fn poller(
14462            self,
14463        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14464        {
14465            type Operation = lro::internal::Operation<
14466                crate::model::TargetSite,
14467                crate::model::UpdateTargetSiteMetadata,
14468            >;
14469            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14470            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14471
14472            let stub = self.0.stub.clone();
14473            let mut options = self.0.options.clone();
14474            options.set_retry_policy(gax::retry_policy::NeverRetry);
14475            let query = move |name| {
14476                let stub = stub.clone();
14477                let options = options.clone();
14478                async {
14479                    let op = GetOperation::new(stub)
14480                        .set_name(name)
14481                        .with_options(options)
14482                        .send()
14483                        .await?;
14484                    Ok(Operation::new(op))
14485                }
14486            };
14487
14488            let start = move || async {
14489                let op = self.send().await?;
14490                Ok(Operation::new(op))
14491            };
14492
14493            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14494        }
14495
14496        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14497        ///
14498        /// This is a **required** field for requests.
14499        pub fn set_target_site<T>(mut self, v: T) -> Self
14500        where
14501            T: std::convert::Into<crate::model::TargetSite>,
14502        {
14503            self.0.request.target_site = std::option::Option::Some(v.into());
14504            self
14505        }
14506
14507        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14508        ///
14509        /// This is a **required** field for requests.
14510        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14511        where
14512            T: std::convert::Into<crate::model::TargetSite>,
14513        {
14514            self.0.request.target_site = v.map(|x| x.into());
14515            self
14516        }
14517    }
14518
14519    #[doc(hidden)]
14520    impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14521        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14522            &mut self.0.options
14523        }
14524    }
14525
14526    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14527    ///
14528    /// # Example
14529    /// ```no_run
14530    /// # use google_cloud_discoveryengine_v1::builder;
14531    /// use builder::site_search_engine_service::DeleteTargetSite;
14532    /// # tokio_test::block_on(async {
14533    /// use lro::Poller;
14534    ///
14535    /// let builder = prepare_request_builder();
14536    /// let response = builder.poller().until_done().await?;
14537    /// # gax::Result::<()>::Ok(()) });
14538    ///
14539    /// fn prepare_request_builder() -> DeleteTargetSite {
14540    ///   # panic!();
14541    ///   // ... details omitted ...
14542    /// }
14543    /// ```
14544    #[derive(Clone, Debug)]
14545    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14546
14547    impl DeleteTargetSite {
14548        pub(crate) fn new(
14549            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14550        ) -> Self {
14551            Self(RequestBuilder::new(stub))
14552        }
14553
14554        /// Sets the full request, replacing any prior values.
14555        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14556            mut self,
14557            v: V,
14558        ) -> Self {
14559            self.0.request = v.into();
14560            self
14561        }
14562
14563        /// Sets all the options, replacing any prior values.
14564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14565            self.0.options = v.into();
14566            self
14567        }
14568
14569        /// Sends the request.
14570        ///
14571        /// # Long running operations
14572        ///
14573        /// This starts, but does not poll, a longrunning operation. More information
14574        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14575        pub async fn send(self) -> Result<longrunning::model::Operation> {
14576            (*self.0.stub)
14577                .delete_target_site(self.0.request, self.0.options)
14578                .await
14579                .map(gax::response::Response::into_body)
14580        }
14581
14582        /// Creates a [Poller][lro::Poller] to work with `delete_target_site`.
14583        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14584            type Operation =
14585                lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14586            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14587            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14588
14589            let stub = self.0.stub.clone();
14590            let mut options = self.0.options.clone();
14591            options.set_retry_policy(gax::retry_policy::NeverRetry);
14592            let query = move |name| {
14593                let stub = stub.clone();
14594                let options = options.clone();
14595                async {
14596                    let op = GetOperation::new(stub)
14597                        .set_name(name)
14598                        .with_options(options)
14599                        .send()
14600                        .await?;
14601                    Ok(Operation::new(op))
14602                }
14603            };
14604
14605            let start = move || async {
14606                let op = self.send().await?;
14607                Ok(Operation::new(op))
14608            };
14609
14610            lro::internal::new_unit_response_poller(
14611                polling_error_policy,
14612                polling_backoff_policy,
14613                start,
14614                query,
14615            )
14616        }
14617
14618        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
14619        ///
14620        /// This is a **required** field for requests.
14621        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14622            self.0.request.name = v.into();
14623            self
14624        }
14625    }
14626
14627    #[doc(hidden)]
14628    impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14629        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14630            &mut self.0.options
14631        }
14632    }
14633
14634    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
14635    ///
14636    /// # Example
14637    /// ```no_run
14638    /// # use google_cloud_discoveryengine_v1::builder;
14639    /// use builder::site_search_engine_service::ListTargetSites;
14640    /// # tokio_test::block_on(async {
14641    /// use gax::paginator::ItemPaginator;
14642    ///
14643    /// let builder = prepare_request_builder();
14644    /// let mut items = builder.by_item();
14645    /// while let Some(result) = items.next().await {
14646    ///   let item = result?;
14647    /// }
14648    /// # gax::Result::<()>::Ok(()) });
14649    ///
14650    /// fn prepare_request_builder() -> ListTargetSites {
14651    ///   # panic!();
14652    ///   // ... details omitted ...
14653    /// }
14654    /// ```
14655    #[derive(Clone, Debug)]
14656    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14657
14658    impl ListTargetSites {
14659        pub(crate) fn new(
14660            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14661        ) -> Self {
14662            Self(RequestBuilder::new(stub))
14663        }
14664
14665        /// Sets the full request, replacing any prior values.
14666        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14667            self.0.request = v.into();
14668            self
14669        }
14670
14671        /// Sets all the options, replacing any prior values.
14672        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14673            self.0.options = v.into();
14674            self
14675        }
14676
14677        /// Sends the request.
14678        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14679            (*self.0.stub)
14680                .list_target_sites(self.0.request, self.0.options)
14681                .await
14682                .map(gax::response::Response::into_body)
14683        }
14684
14685        /// Streams each page in the collection.
14686        pub fn by_page(
14687            self,
14688        ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14689        {
14690            use std::clone::Clone;
14691            let token = self.0.request.page_token.clone();
14692            let execute = move |token: String| {
14693                let mut builder = self.clone();
14694                builder.0.request = builder.0.request.set_page_token(token);
14695                builder.send()
14696            };
14697            gax::paginator::internal::new_paginator(token, execute)
14698        }
14699
14700        /// Streams each item in the collection.
14701        pub fn by_item(
14702            self,
14703        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14704        {
14705            use gax::paginator::Paginator;
14706            self.by_page().items()
14707        }
14708
14709        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
14710        ///
14711        /// This is a **required** field for requests.
14712        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14713            self.0.request.parent = v.into();
14714            self
14715        }
14716
14717        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
14718        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14719            self.0.request.page_size = v.into();
14720            self
14721        }
14722
14723        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
14724        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14725            self.0.request.page_token = v.into();
14726            self
14727        }
14728    }
14729
14730    #[doc(hidden)]
14731    impl gax::options::internal::RequestBuilder for ListTargetSites {
14732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14733            &mut self.0.options
14734        }
14735    }
14736
14737    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
14738    ///
14739    /// # Example
14740    /// ```no_run
14741    /// # use google_cloud_discoveryengine_v1::builder;
14742    /// use builder::site_search_engine_service::CreateSitemap;
14743    /// # tokio_test::block_on(async {
14744    /// use lro::Poller;
14745    ///
14746    /// let builder = prepare_request_builder();
14747    /// let response = builder.poller().until_done().await?;
14748    /// # gax::Result::<()>::Ok(()) });
14749    ///
14750    /// fn prepare_request_builder() -> CreateSitemap {
14751    ///   # panic!();
14752    ///   // ... details omitted ...
14753    /// }
14754    /// ```
14755    #[derive(Clone, Debug)]
14756    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14757
14758    impl CreateSitemap {
14759        pub(crate) fn new(
14760            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14761        ) -> Self {
14762            Self(RequestBuilder::new(stub))
14763        }
14764
14765        /// Sets the full request, replacing any prior values.
14766        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14767            self.0.request = v.into();
14768            self
14769        }
14770
14771        /// Sets all the options, replacing any prior values.
14772        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14773            self.0.options = v.into();
14774            self
14775        }
14776
14777        /// Sends the request.
14778        ///
14779        /// # Long running operations
14780        ///
14781        /// This starts, but does not poll, a longrunning operation. More information
14782        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
14783        pub async fn send(self) -> Result<longrunning::model::Operation> {
14784            (*self.0.stub)
14785                .create_sitemap(self.0.request, self.0.options)
14786                .await
14787                .map(gax::response::Response::into_body)
14788        }
14789
14790        /// Creates a [Poller][lro::Poller] to work with `create_sitemap`.
14791        pub fn poller(
14792            self,
14793        ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14794            type Operation = lro::internal::Operation<
14795                crate::model::Sitemap,
14796                crate::model::CreateSitemapMetadata,
14797            >;
14798            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14799            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14800
14801            let stub = self.0.stub.clone();
14802            let mut options = self.0.options.clone();
14803            options.set_retry_policy(gax::retry_policy::NeverRetry);
14804            let query = move |name| {
14805                let stub = stub.clone();
14806                let options = options.clone();
14807                async {
14808                    let op = GetOperation::new(stub)
14809                        .set_name(name)
14810                        .with_options(options)
14811                        .send()
14812                        .await?;
14813                    Ok(Operation::new(op))
14814                }
14815            };
14816
14817            let start = move || async {
14818                let op = self.send().await?;
14819                Ok(Operation::new(op))
14820            };
14821
14822            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14823        }
14824
14825        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
14826        ///
14827        /// This is a **required** field for requests.
14828        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14829            self.0.request.parent = v.into();
14830            self
14831        }
14832
14833        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14834        ///
14835        /// This is a **required** field for requests.
14836        pub fn set_sitemap<T>(mut self, v: T) -> Self
14837        where
14838            T: std::convert::Into<crate::model::Sitemap>,
14839        {
14840            self.0.request.sitemap = std::option::Option::Some(v.into());
14841            self
14842        }
14843
14844        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14845        ///
14846        /// This is a **required** field for requests.
14847        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14848        where
14849            T: std::convert::Into<crate::model::Sitemap>,
14850        {
14851            self.0.request.sitemap = v.map(|x| x.into());
14852            self
14853        }
14854    }
14855
14856    #[doc(hidden)]
14857    impl gax::options::internal::RequestBuilder for CreateSitemap {
14858        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14859            &mut self.0.options
14860        }
14861    }
14862
14863    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
14864    ///
14865    /// # Example
14866    /// ```no_run
14867    /// # use google_cloud_discoveryengine_v1::builder;
14868    /// use builder::site_search_engine_service::DeleteSitemap;
14869    /// # tokio_test::block_on(async {
14870    /// use lro::Poller;
14871    ///
14872    /// let builder = prepare_request_builder();
14873    /// let response = builder.poller().until_done().await?;
14874    /// # gax::Result::<()>::Ok(()) });
14875    ///
14876    /// fn prepare_request_builder() -> DeleteSitemap {
14877    ///   # panic!();
14878    ///   // ... details omitted ...
14879    /// }
14880    /// ```
14881    #[derive(Clone, Debug)]
14882    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14883
14884    impl DeleteSitemap {
14885        pub(crate) fn new(
14886            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14887        ) -> Self {
14888            Self(RequestBuilder::new(stub))
14889        }
14890
14891        /// Sets the full request, replacing any prior values.
14892        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14893            self.0.request = v.into();
14894            self
14895        }
14896
14897        /// Sets all the options, replacing any prior values.
14898        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14899            self.0.options = v.into();
14900            self
14901        }
14902
14903        /// Sends the request.
14904        ///
14905        /// # Long running operations
14906        ///
14907        /// This starts, but does not poll, a longrunning operation. More information
14908        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
14909        pub async fn send(self) -> Result<longrunning::model::Operation> {
14910            (*self.0.stub)
14911                .delete_sitemap(self.0.request, self.0.options)
14912                .await
14913                .map(gax::response::Response::into_body)
14914        }
14915
14916        /// Creates a [Poller][lro::Poller] to work with `delete_sitemap`.
14917        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14918            type Operation =
14919                lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14920            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14921            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14922
14923            let stub = self.0.stub.clone();
14924            let mut options = self.0.options.clone();
14925            options.set_retry_policy(gax::retry_policy::NeverRetry);
14926            let query = move |name| {
14927                let stub = stub.clone();
14928                let options = options.clone();
14929                async {
14930                    let op = GetOperation::new(stub)
14931                        .set_name(name)
14932                        .with_options(options)
14933                        .send()
14934                        .await?;
14935                    Ok(Operation::new(op))
14936                }
14937            };
14938
14939            let start = move || async {
14940                let op = self.send().await?;
14941                Ok(Operation::new(op))
14942            };
14943
14944            lro::internal::new_unit_response_poller(
14945                polling_error_policy,
14946                polling_backoff_policy,
14947                start,
14948                query,
14949            )
14950        }
14951
14952        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
14953        ///
14954        /// This is a **required** field for requests.
14955        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14956            self.0.request.name = v.into();
14957            self
14958        }
14959    }
14960
14961    #[doc(hidden)]
14962    impl gax::options::internal::RequestBuilder for DeleteSitemap {
14963        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14964            &mut self.0.options
14965        }
14966    }
14967
14968    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
14969    ///
14970    /// # Example
14971    /// ```no_run
14972    /// # use google_cloud_discoveryengine_v1::builder;
14973    /// use builder::site_search_engine_service::FetchSitemaps;
14974    /// # tokio_test::block_on(async {
14975    ///
14976    /// let builder = prepare_request_builder();
14977    /// let response = builder.send().await?;
14978    /// # gax::Result::<()>::Ok(()) });
14979    ///
14980    /// fn prepare_request_builder() -> FetchSitemaps {
14981    ///   # panic!();
14982    ///   // ... details omitted ...
14983    /// }
14984    /// ```
14985    #[derive(Clone, Debug)]
14986    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14987
14988    impl FetchSitemaps {
14989        pub(crate) fn new(
14990            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14991        ) -> Self {
14992            Self(RequestBuilder::new(stub))
14993        }
14994
14995        /// Sets the full request, replacing any prior values.
14996        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14997            self.0.request = v.into();
14998            self
14999        }
15000
15001        /// Sets all the options, replacing any prior values.
15002        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15003            self.0.options = v.into();
15004            self
15005        }
15006
15007        /// Sends the request.
15008        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15009            (*self.0.stub)
15010                .fetch_sitemaps(self.0.request, self.0.options)
15011                .await
15012                .map(gax::response::Response::into_body)
15013        }
15014
15015        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
15016        ///
15017        /// This is a **required** field for requests.
15018        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15019            self.0.request.parent = v.into();
15020            self
15021        }
15022
15023        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15024        pub fn set_matcher<T>(mut self, v: T) -> Self
15025        where
15026            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15027        {
15028            self.0.request.matcher = std::option::Option::Some(v.into());
15029            self
15030        }
15031
15032        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15033        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15034        where
15035            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15036        {
15037            self.0.request.matcher = v.map(|x| x.into());
15038            self
15039        }
15040    }
15041
15042    #[doc(hidden)]
15043    impl gax::options::internal::RequestBuilder for FetchSitemaps {
15044        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15045            &mut self.0.options
15046        }
15047    }
15048
15049    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
15050    ///
15051    /// # Example
15052    /// ```no_run
15053    /// # use google_cloud_discoveryengine_v1::builder;
15054    /// use builder::site_search_engine_service::EnableAdvancedSiteSearch;
15055    /// # tokio_test::block_on(async {
15056    /// use lro::Poller;
15057    ///
15058    /// let builder = prepare_request_builder();
15059    /// let response = builder.poller().until_done().await?;
15060    /// # gax::Result::<()>::Ok(()) });
15061    ///
15062    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
15063    ///   # panic!();
15064    ///   // ... details omitted ...
15065    /// }
15066    /// ```
15067    #[derive(Clone, Debug)]
15068    pub struct EnableAdvancedSiteSearch(
15069        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15070    );
15071
15072    impl EnableAdvancedSiteSearch {
15073        pub(crate) fn new(
15074            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15075        ) -> Self {
15076            Self(RequestBuilder::new(stub))
15077        }
15078
15079        /// Sets the full request, replacing any prior values.
15080        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15081            mut self,
15082            v: V,
15083        ) -> Self {
15084            self.0.request = v.into();
15085            self
15086        }
15087
15088        /// Sets all the options, replacing any prior values.
15089        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15090            self.0.options = v.into();
15091            self
15092        }
15093
15094        /// Sends the request.
15095        ///
15096        /// # Long running operations
15097        ///
15098        /// This starts, but does not poll, a longrunning operation. More information
15099        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
15100        pub async fn send(self) -> Result<longrunning::model::Operation> {
15101            (*self.0.stub)
15102                .enable_advanced_site_search(self.0.request, self.0.options)
15103                .await
15104                .map(gax::response::Response::into_body)
15105        }
15106
15107        /// Creates a [Poller][lro::Poller] to work with `enable_advanced_site_search`.
15108        pub fn poller(
15109            self,
15110        ) -> impl lro::Poller<
15111            crate::model::EnableAdvancedSiteSearchResponse,
15112            crate::model::EnableAdvancedSiteSearchMetadata,
15113        > {
15114            type Operation = lro::internal::Operation<
15115                crate::model::EnableAdvancedSiteSearchResponse,
15116                crate::model::EnableAdvancedSiteSearchMetadata,
15117            >;
15118            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15119            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15120
15121            let stub = self.0.stub.clone();
15122            let mut options = self.0.options.clone();
15123            options.set_retry_policy(gax::retry_policy::NeverRetry);
15124            let query = move |name| {
15125                let stub = stub.clone();
15126                let options = options.clone();
15127                async {
15128                    let op = GetOperation::new(stub)
15129                        .set_name(name)
15130                        .with_options(options)
15131                        .send()
15132                        .await?;
15133                    Ok(Operation::new(op))
15134                }
15135            };
15136
15137            let start = move || async {
15138                let op = self.send().await?;
15139                Ok(Operation::new(op))
15140            };
15141
15142            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15143        }
15144
15145        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15146        ///
15147        /// This is a **required** field for requests.
15148        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15149            self.0.request.site_search_engine = v.into();
15150            self
15151        }
15152    }
15153
15154    #[doc(hidden)]
15155    impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15156        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15157            &mut self.0.options
15158        }
15159    }
15160
15161    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15162    ///
15163    /// # Example
15164    /// ```no_run
15165    /// # use google_cloud_discoveryengine_v1::builder;
15166    /// use builder::site_search_engine_service::DisableAdvancedSiteSearch;
15167    /// # tokio_test::block_on(async {
15168    /// use lro::Poller;
15169    ///
15170    /// let builder = prepare_request_builder();
15171    /// let response = builder.poller().until_done().await?;
15172    /// # gax::Result::<()>::Ok(()) });
15173    ///
15174    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15175    ///   # panic!();
15176    ///   // ... details omitted ...
15177    /// }
15178    /// ```
15179    #[derive(Clone, Debug)]
15180    pub struct DisableAdvancedSiteSearch(
15181        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15182    );
15183
15184    impl DisableAdvancedSiteSearch {
15185        pub(crate) fn new(
15186            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15187        ) -> Self {
15188            Self(RequestBuilder::new(stub))
15189        }
15190
15191        /// Sets the full request, replacing any prior values.
15192        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15193            mut self,
15194            v: V,
15195        ) -> Self {
15196            self.0.request = v.into();
15197            self
15198        }
15199
15200        /// Sets all the options, replacing any prior values.
15201        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15202            self.0.options = v.into();
15203            self
15204        }
15205
15206        /// Sends the request.
15207        ///
15208        /// # Long running operations
15209        ///
15210        /// This starts, but does not poll, a longrunning operation. More information
15211        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15212        pub async fn send(self) -> Result<longrunning::model::Operation> {
15213            (*self.0.stub)
15214                .disable_advanced_site_search(self.0.request, self.0.options)
15215                .await
15216                .map(gax::response::Response::into_body)
15217        }
15218
15219        /// Creates a [Poller][lro::Poller] to work with `disable_advanced_site_search`.
15220        pub fn poller(
15221            self,
15222        ) -> impl lro::Poller<
15223            crate::model::DisableAdvancedSiteSearchResponse,
15224            crate::model::DisableAdvancedSiteSearchMetadata,
15225        > {
15226            type Operation = lro::internal::Operation<
15227                crate::model::DisableAdvancedSiteSearchResponse,
15228                crate::model::DisableAdvancedSiteSearchMetadata,
15229            >;
15230            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15231            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15232
15233            let stub = self.0.stub.clone();
15234            let mut options = self.0.options.clone();
15235            options.set_retry_policy(gax::retry_policy::NeverRetry);
15236            let query = move |name| {
15237                let stub = stub.clone();
15238                let options = options.clone();
15239                async {
15240                    let op = GetOperation::new(stub)
15241                        .set_name(name)
15242                        .with_options(options)
15243                        .send()
15244                        .await?;
15245                    Ok(Operation::new(op))
15246                }
15247            };
15248
15249            let start = move || async {
15250                let op = self.send().await?;
15251                Ok(Operation::new(op))
15252            };
15253
15254            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15255        }
15256
15257        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15258        ///
15259        /// This is a **required** field for requests.
15260        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15261            self.0.request.site_search_engine = v.into();
15262            self
15263        }
15264    }
15265
15266    #[doc(hidden)]
15267    impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15268        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15269            &mut self.0.options
15270        }
15271    }
15272
15273    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15274    ///
15275    /// # Example
15276    /// ```no_run
15277    /// # use google_cloud_discoveryengine_v1::builder;
15278    /// use builder::site_search_engine_service::RecrawlUris;
15279    /// # tokio_test::block_on(async {
15280    /// use lro::Poller;
15281    ///
15282    /// let builder = prepare_request_builder();
15283    /// let response = builder.poller().until_done().await?;
15284    /// # gax::Result::<()>::Ok(()) });
15285    ///
15286    /// fn prepare_request_builder() -> RecrawlUris {
15287    ///   # panic!();
15288    ///   // ... details omitted ...
15289    /// }
15290    /// ```
15291    #[derive(Clone, Debug)]
15292    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15293
15294    impl RecrawlUris {
15295        pub(crate) fn new(
15296            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15297        ) -> Self {
15298            Self(RequestBuilder::new(stub))
15299        }
15300
15301        /// Sets the full request, replacing any prior values.
15302        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15303            self.0.request = v.into();
15304            self
15305        }
15306
15307        /// Sets all the options, replacing any prior values.
15308        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15309            self.0.options = v.into();
15310            self
15311        }
15312
15313        /// Sends the request.
15314        ///
15315        /// # Long running operations
15316        ///
15317        /// This starts, but does not poll, a longrunning operation. More information
15318        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15319        pub async fn send(self) -> Result<longrunning::model::Operation> {
15320            (*self.0.stub)
15321                .recrawl_uris(self.0.request, self.0.options)
15322                .await
15323                .map(gax::response::Response::into_body)
15324        }
15325
15326        /// Creates a [Poller][lro::Poller] to work with `recrawl_uris`.
15327        pub fn poller(
15328            self,
15329        ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15330        {
15331            type Operation = lro::internal::Operation<
15332                crate::model::RecrawlUrisResponse,
15333                crate::model::RecrawlUrisMetadata,
15334            >;
15335            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15336            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15337
15338            let stub = self.0.stub.clone();
15339            let mut options = self.0.options.clone();
15340            options.set_retry_policy(gax::retry_policy::NeverRetry);
15341            let query = move |name| {
15342                let stub = stub.clone();
15343                let options = options.clone();
15344                async {
15345                    let op = GetOperation::new(stub)
15346                        .set_name(name)
15347                        .with_options(options)
15348                        .send()
15349                        .await?;
15350                    Ok(Operation::new(op))
15351                }
15352            };
15353
15354            let start = move || async {
15355                let op = self.send().await?;
15356                Ok(Operation::new(op))
15357            };
15358
15359            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15360        }
15361
15362        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15363        ///
15364        /// This is a **required** field for requests.
15365        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15366            self.0.request.site_search_engine = v.into();
15367            self
15368        }
15369
15370        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15371        ///
15372        /// This is a **required** field for requests.
15373        pub fn set_uris<T, V>(mut self, v: T) -> Self
15374        where
15375            T: std::iter::IntoIterator<Item = V>,
15376            V: std::convert::Into<std::string::String>,
15377        {
15378            use std::iter::Iterator;
15379            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15380            self
15381        }
15382
15383        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15384        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15385            self.0.request.site_credential = v.into();
15386            self
15387        }
15388    }
15389
15390    #[doc(hidden)]
15391    impl gax::options::internal::RequestBuilder for RecrawlUris {
15392        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15393            &mut self.0.options
15394        }
15395    }
15396
15397    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15398    ///
15399    /// # Example
15400    /// ```no_run
15401    /// # use google_cloud_discoveryengine_v1::builder;
15402    /// use builder::site_search_engine_service::BatchVerifyTargetSites;
15403    /// # tokio_test::block_on(async {
15404    /// use lro::Poller;
15405    ///
15406    /// let builder = prepare_request_builder();
15407    /// let response = builder.poller().until_done().await?;
15408    /// # gax::Result::<()>::Ok(()) });
15409    ///
15410    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15411    ///   # panic!();
15412    ///   // ... details omitted ...
15413    /// }
15414    /// ```
15415    #[derive(Clone, Debug)]
15416    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15417
15418    impl BatchVerifyTargetSites {
15419        pub(crate) fn new(
15420            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15421        ) -> Self {
15422            Self(RequestBuilder::new(stub))
15423        }
15424
15425        /// Sets the full request, replacing any prior values.
15426        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15427            mut self,
15428            v: V,
15429        ) -> Self {
15430            self.0.request = v.into();
15431            self
15432        }
15433
15434        /// Sets all the options, replacing any prior values.
15435        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15436            self.0.options = v.into();
15437            self
15438        }
15439
15440        /// Sends the request.
15441        ///
15442        /// # Long running operations
15443        ///
15444        /// This starts, but does not poll, a longrunning operation. More information
15445        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15446        pub async fn send(self) -> Result<longrunning::model::Operation> {
15447            (*self.0.stub)
15448                .batch_verify_target_sites(self.0.request, self.0.options)
15449                .await
15450                .map(gax::response::Response::into_body)
15451        }
15452
15453        /// Creates a [Poller][lro::Poller] to work with `batch_verify_target_sites`.
15454        pub fn poller(
15455            self,
15456        ) -> impl lro::Poller<
15457            crate::model::BatchVerifyTargetSitesResponse,
15458            crate::model::BatchVerifyTargetSitesMetadata,
15459        > {
15460            type Operation = lro::internal::Operation<
15461                crate::model::BatchVerifyTargetSitesResponse,
15462                crate::model::BatchVerifyTargetSitesMetadata,
15463            >;
15464            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15465            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15466
15467            let stub = self.0.stub.clone();
15468            let mut options = self.0.options.clone();
15469            options.set_retry_policy(gax::retry_policy::NeverRetry);
15470            let query = move |name| {
15471                let stub = stub.clone();
15472                let options = options.clone();
15473                async {
15474                    let op = GetOperation::new(stub)
15475                        .set_name(name)
15476                        .with_options(options)
15477                        .send()
15478                        .await?;
15479                    Ok(Operation::new(op))
15480                }
15481            };
15482
15483            let start = move || async {
15484                let op = self.send().await?;
15485                Ok(Operation::new(op))
15486            };
15487
15488            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15489        }
15490
15491        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15492        ///
15493        /// This is a **required** field for requests.
15494        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15495            self.0.request.parent = v.into();
15496            self
15497        }
15498    }
15499
15500    #[doc(hidden)]
15501    impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15502        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15503            &mut self.0.options
15504        }
15505    }
15506
15507    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15508    ///
15509    /// # Example
15510    /// ```no_run
15511    /// # use google_cloud_discoveryengine_v1::builder;
15512    /// use builder::site_search_engine_service::FetchDomainVerificationStatus;
15513    /// # tokio_test::block_on(async {
15514    /// use gax::paginator::ItemPaginator;
15515    ///
15516    /// let builder = prepare_request_builder();
15517    /// let mut items = builder.by_item();
15518    /// while let Some(result) = items.next().await {
15519    ///   let item = result?;
15520    /// }
15521    /// # gax::Result::<()>::Ok(()) });
15522    ///
15523    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
15524    ///   # panic!();
15525    ///   // ... details omitted ...
15526    /// }
15527    /// ```
15528    #[derive(Clone, Debug)]
15529    pub struct FetchDomainVerificationStatus(
15530        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15531    );
15532
15533    impl FetchDomainVerificationStatus {
15534        pub(crate) fn new(
15535            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15536        ) -> Self {
15537            Self(RequestBuilder::new(stub))
15538        }
15539
15540        /// Sets the full request, replacing any prior values.
15541        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15542            mut self,
15543            v: V,
15544        ) -> Self {
15545            self.0.request = v.into();
15546            self
15547        }
15548
15549        /// Sets all the options, replacing any prior values.
15550        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15551            self.0.options = v.into();
15552            self
15553        }
15554
15555        /// Sends the request.
15556        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15557            (*self.0.stub)
15558                .fetch_domain_verification_status(self.0.request, self.0.options)
15559                .await
15560                .map(gax::response::Response::into_body)
15561        }
15562
15563        /// Streams each page in the collection.
15564        pub fn by_page(
15565            self,
15566        ) -> impl gax::paginator::Paginator<
15567            crate::model::FetchDomainVerificationStatusResponse,
15568            gax::error::Error,
15569        > {
15570            use std::clone::Clone;
15571            let token = self.0.request.page_token.clone();
15572            let execute = move |token: String| {
15573                let mut builder = self.clone();
15574                builder.0.request = builder.0.request.set_page_token(token);
15575                builder.send()
15576            };
15577            gax::paginator::internal::new_paginator(token, execute)
15578        }
15579
15580        /// Streams each item in the collection.
15581        pub fn by_item(
15582            self,
15583        ) -> impl gax::paginator::ItemPaginator<
15584            crate::model::FetchDomainVerificationStatusResponse,
15585            gax::error::Error,
15586        > {
15587            use gax::paginator::Paginator;
15588            self.by_page().items()
15589        }
15590
15591        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
15592        ///
15593        /// This is a **required** field for requests.
15594        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15595            self.0.request.site_search_engine = v.into();
15596            self
15597        }
15598
15599        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
15600        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15601            self.0.request.page_size = v.into();
15602            self
15603        }
15604
15605        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
15606        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15607            self.0.request.page_token = v.into();
15608            self
15609        }
15610    }
15611
15612    #[doc(hidden)]
15613    impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15614        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15615            &mut self.0.options
15616        }
15617    }
15618
15619    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
15620    ///
15621    /// # Example
15622    /// ```no_run
15623    /// # use google_cloud_discoveryengine_v1::builder;
15624    /// use builder::site_search_engine_service::ListOperations;
15625    /// # tokio_test::block_on(async {
15626    /// use gax::paginator::ItemPaginator;
15627    ///
15628    /// let builder = prepare_request_builder();
15629    /// let mut items = builder.by_item();
15630    /// while let Some(result) = items.next().await {
15631    ///   let item = result?;
15632    /// }
15633    /// # gax::Result::<()>::Ok(()) });
15634    ///
15635    /// fn prepare_request_builder() -> ListOperations {
15636    ///   # panic!();
15637    ///   // ... details omitted ...
15638    /// }
15639    /// ```
15640    #[derive(Clone, Debug)]
15641    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15642
15643    impl ListOperations {
15644        pub(crate) fn new(
15645            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15646        ) -> Self {
15647            Self(RequestBuilder::new(stub))
15648        }
15649
15650        /// Sets the full request, replacing any prior values.
15651        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15652            mut self,
15653            v: V,
15654        ) -> Self {
15655            self.0.request = v.into();
15656            self
15657        }
15658
15659        /// Sets all the options, replacing any prior values.
15660        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15661            self.0.options = v.into();
15662            self
15663        }
15664
15665        /// Sends the request.
15666        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15667            (*self.0.stub)
15668                .list_operations(self.0.request, self.0.options)
15669                .await
15670                .map(gax::response::Response::into_body)
15671        }
15672
15673        /// Streams each page in the collection.
15674        pub fn by_page(
15675            self,
15676        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15677        {
15678            use std::clone::Clone;
15679            let token = self.0.request.page_token.clone();
15680            let execute = move |token: String| {
15681                let mut builder = self.clone();
15682                builder.0.request = builder.0.request.set_page_token(token);
15683                builder.send()
15684            };
15685            gax::paginator::internal::new_paginator(token, execute)
15686        }
15687
15688        /// Streams each item in the collection.
15689        pub fn by_item(
15690            self,
15691        ) -> impl gax::paginator::ItemPaginator<
15692            longrunning::model::ListOperationsResponse,
15693            gax::error::Error,
15694        > {
15695            use gax::paginator::Paginator;
15696            self.by_page().items()
15697        }
15698
15699        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
15700        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15701            self.0.request.name = v.into();
15702            self
15703        }
15704
15705        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
15706        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15707            self.0.request.filter = v.into();
15708            self
15709        }
15710
15711        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
15712        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15713            self.0.request.page_size = v.into();
15714            self
15715        }
15716
15717        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
15718        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15719            self.0.request.page_token = v.into();
15720            self
15721        }
15722
15723        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
15724        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15725            self.0.request.return_partial_success = v.into();
15726            self
15727        }
15728    }
15729
15730    #[doc(hidden)]
15731    impl gax::options::internal::RequestBuilder for ListOperations {
15732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15733            &mut self.0.options
15734        }
15735    }
15736
15737    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
15738    ///
15739    /// # Example
15740    /// ```no_run
15741    /// # use google_cloud_discoveryengine_v1::builder;
15742    /// use builder::site_search_engine_service::GetOperation;
15743    /// # tokio_test::block_on(async {
15744    ///
15745    /// let builder = prepare_request_builder();
15746    /// let response = builder.send().await?;
15747    /// # gax::Result::<()>::Ok(()) });
15748    ///
15749    /// fn prepare_request_builder() -> GetOperation {
15750    ///   # panic!();
15751    ///   // ... details omitted ...
15752    /// }
15753    /// ```
15754    #[derive(Clone, Debug)]
15755    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15756
15757    impl GetOperation {
15758        pub(crate) fn new(
15759            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15760        ) -> Self {
15761            Self(RequestBuilder::new(stub))
15762        }
15763
15764        /// Sets the full request, replacing any prior values.
15765        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15766            mut self,
15767            v: V,
15768        ) -> Self {
15769            self.0.request = v.into();
15770            self
15771        }
15772
15773        /// Sets all the options, replacing any prior values.
15774        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15775            self.0.options = v.into();
15776            self
15777        }
15778
15779        /// Sends the request.
15780        pub async fn send(self) -> Result<longrunning::model::Operation> {
15781            (*self.0.stub)
15782                .get_operation(self.0.request, self.0.options)
15783                .await
15784                .map(gax::response::Response::into_body)
15785        }
15786
15787        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
15788        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15789            self.0.request.name = v.into();
15790            self
15791        }
15792    }
15793
15794    #[doc(hidden)]
15795    impl gax::options::internal::RequestBuilder for GetOperation {
15796        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15797            &mut self.0.options
15798        }
15799    }
15800
15801    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
15802    ///
15803    /// # Example
15804    /// ```no_run
15805    /// # use google_cloud_discoveryengine_v1::builder;
15806    /// use builder::site_search_engine_service::CancelOperation;
15807    /// # tokio_test::block_on(async {
15808    ///
15809    /// let builder = prepare_request_builder();
15810    /// let response = builder.send().await?;
15811    /// # gax::Result::<()>::Ok(()) });
15812    ///
15813    /// fn prepare_request_builder() -> CancelOperation {
15814    ///   # panic!();
15815    ///   // ... details omitted ...
15816    /// }
15817    /// ```
15818    #[derive(Clone, Debug)]
15819    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15820
15821    impl CancelOperation {
15822        pub(crate) fn new(
15823            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15824        ) -> Self {
15825            Self(RequestBuilder::new(stub))
15826        }
15827
15828        /// Sets the full request, replacing any prior values.
15829        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15830            mut self,
15831            v: V,
15832        ) -> Self {
15833            self.0.request = v.into();
15834            self
15835        }
15836
15837        /// Sets all the options, replacing any prior values.
15838        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15839            self.0.options = v.into();
15840            self
15841        }
15842
15843        /// Sends the request.
15844        pub async fn send(self) -> Result<()> {
15845            (*self.0.stub)
15846                .cancel_operation(self.0.request, self.0.options)
15847                .await
15848                .map(gax::response::Response::into_body)
15849        }
15850
15851        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
15852        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15853            self.0.request.name = v.into();
15854            self
15855        }
15856    }
15857
15858    #[doc(hidden)]
15859    impl gax::options::internal::RequestBuilder for CancelOperation {
15860        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15861            &mut self.0.options
15862        }
15863    }
15864}
15865
15866#[cfg(feature = "user-event-service")]
15867#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15868pub mod user_event_service {
15869    use crate::Result;
15870
15871    /// A builder for [UserEventService][crate::client::UserEventService].
15872    ///
15873    /// ```
15874    /// # tokio_test::block_on(async {
15875    /// # use google_cloud_discoveryengine_v1::*;
15876    /// # use builder::user_event_service::ClientBuilder;
15877    /// # use client::UserEventService;
15878    /// let builder : ClientBuilder = UserEventService::builder();
15879    /// let client = builder
15880    ///     .with_endpoint("https://discoveryengine.googleapis.com")
15881    ///     .build().await?;
15882    /// # gax::client_builder::Result::<()>::Ok(()) });
15883    /// ```
15884    pub type ClientBuilder =
15885        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15886
15887    pub(crate) mod client {
15888        use super::super::super::client::UserEventService;
15889        pub struct Factory;
15890        impl gax::client_builder::internal::ClientFactory for Factory {
15891            type Client = UserEventService;
15892            type Credentials = gaxi::options::Credentials;
15893            async fn build(
15894                self,
15895                config: gaxi::options::ClientConfig,
15896            ) -> gax::client_builder::Result<Self::Client> {
15897                Self::Client::new(config).await
15898            }
15899        }
15900    }
15901
15902    /// Common implementation for [crate::client::UserEventService] request builders.
15903    #[derive(Clone, Debug)]
15904    pub(crate) struct RequestBuilder<R: std::default::Default> {
15905        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15906        request: R,
15907        options: gax::options::RequestOptions,
15908    }
15909
15910    impl<R> RequestBuilder<R>
15911    where
15912        R: std::default::Default,
15913    {
15914        pub(crate) fn new(
15915            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15916        ) -> Self {
15917            Self {
15918                stub,
15919                request: R::default(),
15920                options: gax::options::RequestOptions::default(),
15921            }
15922        }
15923    }
15924
15925    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
15926    ///
15927    /// # Example
15928    /// ```no_run
15929    /// # use google_cloud_discoveryengine_v1::builder;
15930    /// use builder::user_event_service::WriteUserEvent;
15931    /// # tokio_test::block_on(async {
15932    ///
15933    /// let builder = prepare_request_builder();
15934    /// let response = builder.send().await?;
15935    /// # gax::Result::<()>::Ok(()) });
15936    ///
15937    /// fn prepare_request_builder() -> WriteUserEvent {
15938    ///   # panic!();
15939    ///   // ... details omitted ...
15940    /// }
15941    /// ```
15942    #[derive(Clone, Debug)]
15943    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15944
15945    impl WriteUserEvent {
15946        pub(crate) fn new(
15947            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15948        ) -> Self {
15949            Self(RequestBuilder::new(stub))
15950        }
15951
15952        /// Sets the full request, replacing any prior values.
15953        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15954            self.0.request = v.into();
15955            self
15956        }
15957
15958        /// Sets all the options, replacing any prior values.
15959        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15960            self.0.options = v.into();
15961            self
15962        }
15963
15964        /// Sends the request.
15965        pub async fn send(self) -> Result<crate::model::UserEvent> {
15966            (*self.0.stub)
15967                .write_user_event(self.0.request, self.0.options)
15968                .await
15969                .map(gax::response::Response::into_body)
15970        }
15971
15972        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
15973        ///
15974        /// This is a **required** field for requests.
15975        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15976            self.0.request.parent = v.into();
15977            self
15978        }
15979
15980        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15981        ///
15982        /// This is a **required** field for requests.
15983        pub fn set_user_event<T>(mut self, v: T) -> Self
15984        where
15985            T: std::convert::Into<crate::model::UserEvent>,
15986        {
15987            self.0.request.user_event = std::option::Option::Some(v.into());
15988            self
15989        }
15990
15991        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15992        ///
15993        /// This is a **required** field for requests.
15994        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15995        where
15996            T: std::convert::Into<crate::model::UserEvent>,
15997        {
15998            self.0.request.user_event = v.map(|x| x.into());
15999            self
16000        }
16001
16002        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
16003        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16004            self.0.request.write_async = v.into();
16005            self
16006        }
16007    }
16008
16009    #[doc(hidden)]
16010    impl gax::options::internal::RequestBuilder for WriteUserEvent {
16011        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16012            &mut self.0.options
16013        }
16014    }
16015
16016    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
16017    ///
16018    /// # Example
16019    /// ```no_run
16020    /// # use google_cloud_discoveryengine_v1::builder;
16021    /// use builder::user_event_service::CollectUserEvent;
16022    /// # tokio_test::block_on(async {
16023    ///
16024    /// let builder = prepare_request_builder();
16025    /// let response = builder.send().await?;
16026    /// # gax::Result::<()>::Ok(()) });
16027    ///
16028    /// fn prepare_request_builder() -> CollectUserEvent {
16029    ///   # panic!();
16030    ///   // ... details omitted ...
16031    /// }
16032    /// ```
16033    #[derive(Clone, Debug)]
16034    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16035
16036    impl CollectUserEvent {
16037        pub(crate) fn new(
16038            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16039        ) -> Self {
16040            Self(RequestBuilder::new(stub))
16041        }
16042
16043        /// Sets the full request, replacing any prior values.
16044        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16045            mut self,
16046            v: V,
16047        ) -> Self {
16048            self.0.request = v.into();
16049            self
16050        }
16051
16052        /// Sets all the options, replacing any prior values.
16053        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16054            self.0.options = v.into();
16055            self
16056        }
16057
16058        /// Sends the request.
16059        pub async fn send(self) -> Result<api::model::HttpBody> {
16060            (*self.0.stub)
16061                .collect_user_event(self.0.request, self.0.options)
16062                .await
16063                .map(gax::response::Response::into_body)
16064        }
16065
16066        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
16067        ///
16068        /// This is a **required** field for requests.
16069        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16070            self.0.request.parent = v.into();
16071            self
16072        }
16073
16074        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
16075        ///
16076        /// This is a **required** field for requests.
16077        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16078            self.0.request.user_event = v.into();
16079            self
16080        }
16081
16082        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
16083        pub fn set_uri<T>(mut self, v: T) -> Self
16084        where
16085            T: std::convert::Into<std::string::String>,
16086        {
16087            self.0.request.uri = std::option::Option::Some(v.into());
16088            self
16089        }
16090
16091        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
16092        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16093        where
16094            T: std::convert::Into<std::string::String>,
16095        {
16096            self.0.request.uri = v.map(|x| x.into());
16097            self
16098        }
16099
16100        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
16101        pub fn set_ets<T>(mut self, v: T) -> Self
16102        where
16103            T: std::convert::Into<i64>,
16104        {
16105            self.0.request.ets = std::option::Option::Some(v.into());
16106            self
16107        }
16108
16109        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
16110        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16111        where
16112            T: std::convert::Into<i64>,
16113        {
16114            self.0.request.ets = v.map(|x| x.into());
16115            self
16116        }
16117    }
16118
16119    #[doc(hidden)]
16120    impl gax::options::internal::RequestBuilder for CollectUserEvent {
16121        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16122            &mut self.0.options
16123        }
16124    }
16125
16126    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
16127    ///
16128    /// # Example
16129    /// ```no_run
16130    /// # use google_cloud_discoveryengine_v1::builder;
16131    /// use builder::user_event_service::PurgeUserEvents;
16132    /// # tokio_test::block_on(async {
16133    /// use lro::Poller;
16134    ///
16135    /// let builder = prepare_request_builder();
16136    /// let response = builder.poller().until_done().await?;
16137    /// # gax::Result::<()>::Ok(()) });
16138    ///
16139    /// fn prepare_request_builder() -> PurgeUserEvents {
16140    ///   # panic!();
16141    ///   // ... details omitted ...
16142    /// }
16143    /// ```
16144    #[derive(Clone, Debug)]
16145    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16146
16147    impl PurgeUserEvents {
16148        pub(crate) fn new(
16149            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16150        ) -> Self {
16151            Self(RequestBuilder::new(stub))
16152        }
16153
16154        /// Sets the full request, replacing any prior values.
16155        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16156            self.0.request = v.into();
16157            self
16158        }
16159
16160        /// Sets all the options, replacing any prior values.
16161        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16162            self.0.options = v.into();
16163            self
16164        }
16165
16166        /// Sends the request.
16167        ///
16168        /// # Long running operations
16169        ///
16170        /// This starts, but does not poll, a longrunning operation. More information
16171        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16172        pub async fn send(self) -> Result<longrunning::model::Operation> {
16173            (*self.0.stub)
16174                .purge_user_events(self.0.request, self.0.options)
16175                .await
16176                .map(gax::response::Response::into_body)
16177        }
16178
16179        /// Creates a [Poller][lro::Poller] to work with `purge_user_events`.
16180        pub fn poller(
16181            self,
16182        ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16183        {
16184            type Operation = lro::internal::Operation<
16185                crate::model::PurgeUserEventsResponse,
16186                crate::model::PurgeUserEventsMetadata,
16187            >;
16188            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16189            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16190
16191            let stub = self.0.stub.clone();
16192            let mut options = self.0.options.clone();
16193            options.set_retry_policy(gax::retry_policy::NeverRetry);
16194            let query = move |name| {
16195                let stub = stub.clone();
16196                let options = options.clone();
16197                async {
16198                    let op = GetOperation::new(stub)
16199                        .set_name(name)
16200                        .with_options(options)
16201                        .send()
16202                        .await?;
16203                    Ok(Operation::new(op))
16204                }
16205            };
16206
16207            let start = move || async {
16208                let op = self.send().await?;
16209                Ok(Operation::new(op))
16210            };
16211
16212            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16213        }
16214
16215        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16216        ///
16217        /// This is a **required** field for requests.
16218        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16219            self.0.request.parent = v.into();
16220            self
16221        }
16222
16223        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16224        ///
16225        /// This is a **required** field for requests.
16226        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16227            self.0.request.filter = v.into();
16228            self
16229        }
16230
16231        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16232        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16233            self.0.request.force = v.into();
16234            self
16235        }
16236    }
16237
16238    #[doc(hidden)]
16239    impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16240        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16241            &mut self.0.options
16242        }
16243    }
16244
16245    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16246    ///
16247    /// # Example
16248    /// ```no_run
16249    /// # use google_cloud_discoveryengine_v1::builder;
16250    /// use builder::user_event_service::ImportUserEvents;
16251    /// # tokio_test::block_on(async {
16252    /// use lro::Poller;
16253    ///
16254    /// let builder = prepare_request_builder();
16255    /// let response = builder.poller().until_done().await?;
16256    /// # gax::Result::<()>::Ok(()) });
16257    ///
16258    /// fn prepare_request_builder() -> ImportUserEvents {
16259    ///   # panic!();
16260    ///   // ... details omitted ...
16261    /// }
16262    /// ```
16263    #[derive(Clone, Debug)]
16264    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16265
16266    impl ImportUserEvents {
16267        pub(crate) fn new(
16268            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16269        ) -> Self {
16270            Self(RequestBuilder::new(stub))
16271        }
16272
16273        /// Sets the full request, replacing any prior values.
16274        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16275            mut self,
16276            v: V,
16277        ) -> Self {
16278            self.0.request = v.into();
16279            self
16280        }
16281
16282        /// Sets all the options, replacing any prior values.
16283        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16284            self.0.options = v.into();
16285            self
16286        }
16287
16288        /// Sends the request.
16289        ///
16290        /// # Long running operations
16291        ///
16292        /// This starts, but does not poll, a longrunning operation. More information
16293        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16294        pub async fn send(self) -> Result<longrunning::model::Operation> {
16295            (*self.0.stub)
16296                .import_user_events(self.0.request, self.0.options)
16297                .await
16298                .map(gax::response::Response::into_body)
16299        }
16300
16301        /// Creates a [Poller][lro::Poller] to work with `import_user_events`.
16302        pub fn poller(
16303            self,
16304        ) -> impl lro::Poller<
16305            crate::model::ImportUserEventsResponse,
16306            crate::model::ImportUserEventsMetadata,
16307        > {
16308            type Operation = lro::internal::Operation<
16309                crate::model::ImportUserEventsResponse,
16310                crate::model::ImportUserEventsMetadata,
16311            >;
16312            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16313            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16314
16315            let stub = self.0.stub.clone();
16316            let mut options = self.0.options.clone();
16317            options.set_retry_policy(gax::retry_policy::NeverRetry);
16318            let query = move |name| {
16319                let stub = stub.clone();
16320                let options = options.clone();
16321                async {
16322                    let op = GetOperation::new(stub)
16323                        .set_name(name)
16324                        .with_options(options)
16325                        .send()
16326                        .await?;
16327                    Ok(Operation::new(op))
16328                }
16329            };
16330
16331            let start = move || async {
16332                let op = self.send().await?;
16333                Ok(Operation::new(op))
16334            };
16335
16336            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16337        }
16338
16339        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16340        ///
16341        /// This is a **required** field for requests.
16342        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343            self.0.request.parent = v.into();
16344            self
16345        }
16346
16347        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16348        pub fn set_error_config<T>(mut self, v: T) -> Self
16349        where
16350            T: std::convert::Into<crate::model::ImportErrorConfig>,
16351        {
16352            self.0.request.error_config = std::option::Option::Some(v.into());
16353            self
16354        }
16355
16356        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16357        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16358        where
16359            T: std::convert::Into<crate::model::ImportErrorConfig>,
16360        {
16361            self.0.request.error_config = v.map(|x| x.into());
16362            self
16363        }
16364
16365        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16366        ///
16367        /// Note that all the setters affecting `source` are
16368        /// mutually exclusive.
16369        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16370            mut self,
16371            v: T,
16372        ) -> Self {
16373            self.0.request.source = v.into();
16374            self
16375        }
16376
16377        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16378        /// to hold a `InlineSource`.
16379        ///
16380        /// Note that all the setters affecting `source` are
16381        /// mutually exclusive.
16382        pub fn set_inline_source<
16383            T: std::convert::Into<
16384                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16385                >,
16386        >(
16387            mut self,
16388            v: T,
16389        ) -> Self {
16390            self.0.request = self.0.request.set_inline_source(v);
16391            self
16392        }
16393
16394        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16395        /// to hold a `GcsSource`.
16396        ///
16397        /// Note that all the setters affecting `source` are
16398        /// mutually exclusive.
16399        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16400            mut self,
16401            v: T,
16402        ) -> Self {
16403            self.0.request = self.0.request.set_gcs_source(v);
16404            self
16405        }
16406
16407        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16408        /// to hold a `BigquerySource`.
16409        ///
16410        /// Note that all the setters affecting `source` are
16411        /// mutually exclusive.
16412        pub fn set_bigquery_source<
16413            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16414        >(
16415            mut self,
16416            v: T,
16417        ) -> Self {
16418            self.0.request = self.0.request.set_bigquery_source(v);
16419            self
16420        }
16421    }
16422
16423    #[doc(hidden)]
16424    impl gax::options::internal::RequestBuilder for ImportUserEvents {
16425        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16426            &mut self.0.options
16427        }
16428    }
16429
16430    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16431    ///
16432    /// # Example
16433    /// ```no_run
16434    /// # use google_cloud_discoveryengine_v1::builder;
16435    /// use builder::user_event_service::ListOperations;
16436    /// # tokio_test::block_on(async {
16437    /// use gax::paginator::ItemPaginator;
16438    ///
16439    /// let builder = prepare_request_builder();
16440    /// let mut items = builder.by_item();
16441    /// while let Some(result) = items.next().await {
16442    ///   let item = result?;
16443    /// }
16444    /// # gax::Result::<()>::Ok(()) });
16445    ///
16446    /// fn prepare_request_builder() -> ListOperations {
16447    ///   # panic!();
16448    ///   // ... details omitted ...
16449    /// }
16450    /// ```
16451    #[derive(Clone, Debug)]
16452    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16453
16454    impl ListOperations {
16455        pub(crate) fn new(
16456            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16457        ) -> Self {
16458            Self(RequestBuilder::new(stub))
16459        }
16460
16461        /// Sets the full request, replacing any prior values.
16462        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16463            mut self,
16464            v: V,
16465        ) -> Self {
16466            self.0.request = v.into();
16467            self
16468        }
16469
16470        /// Sets all the options, replacing any prior values.
16471        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16472            self.0.options = v.into();
16473            self
16474        }
16475
16476        /// Sends the request.
16477        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16478            (*self.0.stub)
16479                .list_operations(self.0.request, self.0.options)
16480                .await
16481                .map(gax::response::Response::into_body)
16482        }
16483
16484        /// Streams each page in the collection.
16485        pub fn by_page(
16486            self,
16487        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16488        {
16489            use std::clone::Clone;
16490            let token = self.0.request.page_token.clone();
16491            let execute = move |token: String| {
16492                let mut builder = self.clone();
16493                builder.0.request = builder.0.request.set_page_token(token);
16494                builder.send()
16495            };
16496            gax::paginator::internal::new_paginator(token, execute)
16497        }
16498
16499        /// Streams each item in the collection.
16500        pub fn by_item(
16501            self,
16502        ) -> impl gax::paginator::ItemPaginator<
16503            longrunning::model::ListOperationsResponse,
16504            gax::error::Error,
16505        > {
16506            use gax::paginator::Paginator;
16507            self.by_page().items()
16508        }
16509
16510        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
16511        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16512            self.0.request.name = v.into();
16513            self
16514        }
16515
16516        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
16517        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16518            self.0.request.filter = v.into();
16519            self
16520        }
16521
16522        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
16523        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16524            self.0.request.page_size = v.into();
16525            self
16526        }
16527
16528        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
16529        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16530            self.0.request.page_token = v.into();
16531            self
16532        }
16533
16534        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
16535        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16536            self.0.request.return_partial_success = v.into();
16537            self
16538        }
16539    }
16540
16541    #[doc(hidden)]
16542    impl gax::options::internal::RequestBuilder for ListOperations {
16543        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16544            &mut self.0.options
16545        }
16546    }
16547
16548    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
16549    ///
16550    /// # Example
16551    /// ```no_run
16552    /// # use google_cloud_discoveryengine_v1::builder;
16553    /// use builder::user_event_service::GetOperation;
16554    /// # tokio_test::block_on(async {
16555    ///
16556    /// let builder = prepare_request_builder();
16557    /// let response = builder.send().await?;
16558    /// # gax::Result::<()>::Ok(()) });
16559    ///
16560    /// fn prepare_request_builder() -> GetOperation {
16561    ///   # panic!();
16562    ///   // ... details omitted ...
16563    /// }
16564    /// ```
16565    #[derive(Clone, Debug)]
16566    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16567
16568    impl GetOperation {
16569        pub(crate) fn new(
16570            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16571        ) -> Self {
16572            Self(RequestBuilder::new(stub))
16573        }
16574
16575        /// Sets the full request, replacing any prior values.
16576        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16577            mut self,
16578            v: V,
16579        ) -> Self {
16580            self.0.request = v.into();
16581            self
16582        }
16583
16584        /// Sets all the options, replacing any prior values.
16585        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16586            self.0.options = v.into();
16587            self
16588        }
16589
16590        /// Sends the request.
16591        pub async fn send(self) -> Result<longrunning::model::Operation> {
16592            (*self.0.stub)
16593                .get_operation(self.0.request, self.0.options)
16594                .await
16595                .map(gax::response::Response::into_body)
16596        }
16597
16598        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
16599        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16600            self.0.request.name = v.into();
16601            self
16602        }
16603    }
16604
16605    #[doc(hidden)]
16606    impl gax::options::internal::RequestBuilder for GetOperation {
16607        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16608            &mut self.0.options
16609        }
16610    }
16611
16612    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
16613    ///
16614    /// # Example
16615    /// ```no_run
16616    /// # use google_cloud_discoveryengine_v1::builder;
16617    /// use builder::user_event_service::CancelOperation;
16618    /// # tokio_test::block_on(async {
16619    ///
16620    /// let builder = prepare_request_builder();
16621    /// let response = builder.send().await?;
16622    /// # gax::Result::<()>::Ok(()) });
16623    ///
16624    /// fn prepare_request_builder() -> CancelOperation {
16625    ///   # panic!();
16626    ///   // ... details omitted ...
16627    /// }
16628    /// ```
16629    #[derive(Clone, Debug)]
16630    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16631
16632    impl CancelOperation {
16633        pub(crate) fn new(
16634            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16635        ) -> Self {
16636            Self(RequestBuilder::new(stub))
16637        }
16638
16639        /// Sets the full request, replacing any prior values.
16640        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16641            mut self,
16642            v: V,
16643        ) -> Self {
16644            self.0.request = v.into();
16645            self
16646        }
16647
16648        /// Sets all the options, replacing any prior values.
16649        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16650            self.0.options = v.into();
16651            self
16652        }
16653
16654        /// Sends the request.
16655        pub async fn send(self) -> Result<()> {
16656            (*self.0.stub)
16657                .cancel_operation(self.0.request, self.0.options)
16658                .await
16659                .map(gax::response::Response::into_body)
16660        }
16661
16662        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
16663        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16664            self.0.request.name = v.into();
16665            self
16666        }
16667    }
16668
16669    #[doc(hidden)]
16670    impl gax::options::internal::RequestBuilder for CancelOperation {
16671        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16672            &mut self.0.options
16673        }
16674    }
16675}
16676
16677#[cfg(feature = "user-license-service")]
16678#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16679pub mod user_license_service {
16680    use crate::Result;
16681
16682    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
16683    ///
16684    /// ```
16685    /// # tokio_test::block_on(async {
16686    /// # use google_cloud_discoveryengine_v1::*;
16687    /// # use builder::user_license_service::ClientBuilder;
16688    /// # use client::UserLicenseService;
16689    /// let builder : ClientBuilder = UserLicenseService::builder();
16690    /// let client = builder
16691    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16692    ///     .build().await?;
16693    /// # gax::client_builder::Result::<()>::Ok(()) });
16694    /// ```
16695    pub type ClientBuilder =
16696        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16697
16698    pub(crate) mod client {
16699        use super::super::super::client::UserLicenseService;
16700        pub struct Factory;
16701        impl gax::client_builder::internal::ClientFactory for Factory {
16702            type Client = UserLicenseService;
16703            type Credentials = gaxi::options::Credentials;
16704            async fn build(
16705                self,
16706                config: gaxi::options::ClientConfig,
16707            ) -> gax::client_builder::Result<Self::Client> {
16708                Self::Client::new(config).await
16709            }
16710        }
16711    }
16712
16713    /// Common implementation for [crate::client::UserLicenseService] request builders.
16714    #[derive(Clone, Debug)]
16715    pub(crate) struct RequestBuilder<R: std::default::Default> {
16716        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16717        request: R,
16718        options: gax::options::RequestOptions,
16719    }
16720
16721    impl<R> RequestBuilder<R>
16722    where
16723        R: std::default::Default,
16724    {
16725        pub(crate) fn new(
16726            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16727        ) -> Self {
16728            Self {
16729                stub,
16730                request: R::default(),
16731                options: gax::options::RequestOptions::default(),
16732            }
16733        }
16734    }
16735
16736    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
16737    ///
16738    /// # Example
16739    /// ```no_run
16740    /// # use google_cloud_discoveryengine_v1::builder;
16741    /// use builder::user_license_service::ListUserLicenses;
16742    /// # tokio_test::block_on(async {
16743    /// use gax::paginator::ItemPaginator;
16744    ///
16745    /// let builder = prepare_request_builder();
16746    /// let mut items = builder.by_item();
16747    /// while let Some(result) = items.next().await {
16748    ///   let item = result?;
16749    /// }
16750    /// # gax::Result::<()>::Ok(()) });
16751    ///
16752    /// fn prepare_request_builder() -> ListUserLicenses {
16753    ///   # panic!();
16754    ///   // ... details omitted ...
16755    /// }
16756    /// ```
16757    #[derive(Clone, Debug)]
16758    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16759
16760    impl ListUserLicenses {
16761        pub(crate) fn new(
16762            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16763        ) -> Self {
16764            Self(RequestBuilder::new(stub))
16765        }
16766
16767        /// Sets the full request, replacing any prior values.
16768        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16769            mut self,
16770            v: V,
16771        ) -> Self {
16772            self.0.request = v.into();
16773            self
16774        }
16775
16776        /// Sets all the options, replacing any prior values.
16777        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16778            self.0.options = v.into();
16779            self
16780        }
16781
16782        /// Sends the request.
16783        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16784            (*self.0.stub)
16785                .list_user_licenses(self.0.request, self.0.options)
16786                .await
16787                .map(gax::response::Response::into_body)
16788        }
16789
16790        /// Streams each page in the collection.
16791        pub fn by_page(
16792            self,
16793        ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16794        {
16795            use std::clone::Clone;
16796            let token = self.0.request.page_token.clone();
16797            let execute = move |token: String| {
16798                let mut builder = self.clone();
16799                builder.0.request = builder.0.request.set_page_token(token);
16800                builder.send()
16801            };
16802            gax::paginator::internal::new_paginator(token, execute)
16803        }
16804
16805        /// Streams each item in the collection.
16806        pub fn by_item(
16807            self,
16808        ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16809        {
16810            use gax::paginator::Paginator;
16811            self.by_page().items()
16812        }
16813
16814        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
16815        ///
16816        /// This is a **required** field for requests.
16817        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16818            self.0.request.parent = v.into();
16819            self
16820        }
16821
16822        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
16823        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16824            self.0.request.page_size = v.into();
16825            self
16826        }
16827
16828        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
16829        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16830            self.0.request.page_token = v.into();
16831            self
16832        }
16833
16834        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
16835        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16836            self.0.request.filter = v.into();
16837            self
16838        }
16839    }
16840
16841    #[doc(hidden)]
16842    impl gax::options::internal::RequestBuilder for ListUserLicenses {
16843        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16844            &mut self.0.options
16845        }
16846    }
16847
16848    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
16849    ///
16850    /// # Example
16851    /// ```no_run
16852    /// # use google_cloud_discoveryengine_v1::builder;
16853    /// use builder::user_license_service::BatchUpdateUserLicenses;
16854    /// # tokio_test::block_on(async {
16855    /// use lro::Poller;
16856    ///
16857    /// let builder = prepare_request_builder();
16858    /// let response = builder.poller().until_done().await?;
16859    /// # gax::Result::<()>::Ok(()) });
16860    ///
16861    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
16862    ///   # panic!();
16863    ///   // ... details omitted ...
16864    /// }
16865    /// ```
16866    #[derive(Clone, Debug)]
16867    pub struct BatchUpdateUserLicenses(
16868        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16869    );
16870
16871    impl BatchUpdateUserLicenses {
16872        pub(crate) fn new(
16873            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16874        ) -> Self {
16875            Self(RequestBuilder::new(stub))
16876        }
16877
16878        /// Sets the full request, replacing any prior values.
16879        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16880            mut self,
16881            v: V,
16882        ) -> Self {
16883            self.0.request = v.into();
16884            self
16885        }
16886
16887        /// Sets all the options, replacing any prior values.
16888        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16889            self.0.options = v.into();
16890            self
16891        }
16892
16893        /// Sends the request.
16894        ///
16895        /// # Long running operations
16896        ///
16897        /// This starts, but does not poll, a longrunning operation. More information
16898        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
16899        pub async fn send(self) -> Result<longrunning::model::Operation> {
16900            (*self.0.stub)
16901                .batch_update_user_licenses(self.0.request, self.0.options)
16902                .await
16903                .map(gax::response::Response::into_body)
16904        }
16905
16906        /// Creates a [Poller][lro::Poller] to work with `batch_update_user_licenses`.
16907        pub fn poller(
16908            self,
16909        ) -> impl lro::Poller<
16910            crate::model::BatchUpdateUserLicensesResponse,
16911            crate::model::BatchUpdateUserLicensesMetadata,
16912        > {
16913            type Operation = lro::internal::Operation<
16914                crate::model::BatchUpdateUserLicensesResponse,
16915                crate::model::BatchUpdateUserLicensesMetadata,
16916            >;
16917            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16918            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16919
16920            let stub = self.0.stub.clone();
16921            let mut options = self.0.options.clone();
16922            options.set_retry_policy(gax::retry_policy::NeverRetry);
16923            let query = move |name| {
16924                let stub = stub.clone();
16925                let options = options.clone();
16926                async {
16927                    let op = GetOperation::new(stub)
16928                        .set_name(name)
16929                        .with_options(options)
16930                        .send()
16931                        .await?;
16932                    Ok(Operation::new(op))
16933                }
16934            };
16935
16936            let start = move || async {
16937                let op = self.send().await?;
16938                Ok(Operation::new(op))
16939            };
16940
16941            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16942        }
16943
16944        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
16945        ///
16946        /// This is a **required** field for requests.
16947        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16948            self.0.request.parent = v.into();
16949            self
16950        }
16951
16952        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
16953        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16954            self.0.request.delete_unassigned_user_licenses = v.into();
16955            self
16956        }
16957
16958        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
16959        ///
16960        /// Note that all the setters affecting `source` are
16961        /// mutually exclusive.
16962        pub fn set_source<
16963            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16964        >(
16965            mut self,
16966            v: T,
16967        ) -> Self {
16968            self.0.request.source = v.into();
16969            self
16970        }
16971
16972        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
16973        /// to hold a `InlineSource`.
16974        ///
16975        /// Note that all the setters affecting `source` are
16976        /// mutually exclusive.
16977        pub fn set_inline_source<
16978            T: std::convert::Into<
16979                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16980                >,
16981        >(
16982            mut self,
16983            v: T,
16984        ) -> Self {
16985            self.0.request = self.0.request.set_inline_source(v);
16986            self
16987        }
16988    }
16989
16990    #[doc(hidden)]
16991    impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16992        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16993            &mut self.0.options
16994        }
16995    }
16996
16997    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
16998    ///
16999    /// # Example
17000    /// ```no_run
17001    /// # use google_cloud_discoveryengine_v1::builder;
17002    /// use builder::user_license_service::ListOperations;
17003    /// # tokio_test::block_on(async {
17004    /// use gax::paginator::ItemPaginator;
17005    ///
17006    /// let builder = prepare_request_builder();
17007    /// let mut items = builder.by_item();
17008    /// while let Some(result) = items.next().await {
17009    ///   let item = result?;
17010    /// }
17011    /// # gax::Result::<()>::Ok(()) });
17012    ///
17013    /// fn prepare_request_builder() -> ListOperations {
17014    ///   # panic!();
17015    ///   // ... details omitted ...
17016    /// }
17017    /// ```
17018    #[derive(Clone, Debug)]
17019    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
17020
17021    impl ListOperations {
17022        pub(crate) fn new(
17023            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17024        ) -> Self {
17025            Self(RequestBuilder::new(stub))
17026        }
17027
17028        /// Sets the full request, replacing any prior values.
17029        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
17030            mut self,
17031            v: V,
17032        ) -> Self {
17033            self.0.request = v.into();
17034            self
17035        }
17036
17037        /// Sets all the options, replacing any prior values.
17038        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17039            self.0.options = v.into();
17040            self
17041        }
17042
17043        /// Sends the request.
17044        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
17045            (*self.0.stub)
17046                .list_operations(self.0.request, self.0.options)
17047                .await
17048                .map(gax::response::Response::into_body)
17049        }
17050
17051        /// Streams each page in the collection.
17052        pub fn by_page(
17053            self,
17054        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
17055        {
17056            use std::clone::Clone;
17057            let token = self.0.request.page_token.clone();
17058            let execute = move |token: String| {
17059                let mut builder = self.clone();
17060                builder.0.request = builder.0.request.set_page_token(token);
17061                builder.send()
17062            };
17063            gax::paginator::internal::new_paginator(token, execute)
17064        }
17065
17066        /// Streams each item in the collection.
17067        pub fn by_item(
17068            self,
17069        ) -> impl gax::paginator::ItemPaginator<
17070            longrunning::model::ListOperationsResponse,
17071            gax::error::Error,
17072        > {
17073            use gax::paginator::Paginator;
17074            self.by_page().items()
17075        }
17076
17077        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
17078        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17079            self.0.request.name = v.into();
17080            self
17081        }
17082
17083        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
17084        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17085            self.0.request.filter = v.into();
17086            self
17087        }
17088
17089        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
17090        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17091            self.0.request.page_size = v.into();
17092            self
17093        }
17094
17095        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
17096        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17097            self.0.request.page_token = v.into();
17098            self
17099        }
17100
17101        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
17102        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17103            self.0.request.return_partial_success = v.into();
17104            self
17105        }
17106    }
17107
17108    #[doc(hidden)]
17109    impl gax::options::internal::RequestBuilder for ListOperations {
17110        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17111            &mut self.0.options
17112        }
17113    }
17114
17115    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
17116    ///
17117    /// # Example
17118    /// ```no_run
17119    /// # use google_cloud_discoveryengine_v1::builder;
17120    /// use builder::user_license_service::GetOperation;
17121    /// # tokio_test::block_on(async {
17122    ///
17123    /// let builder = prepare_request_builder();
17124    /// let response = builder.send().await?;
17125    /// # gax::Result::<()>::Ok(()) });
17126    ///
17127    /// fn prepare_request_builder() -> GetOperation {
17128    ///   # panic!();
17129    ///   // ... details omitted ...
17130    /// }
17131    /// ```
17132    #[derive(Clone, Debug)]
17133    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
17134
17135    impl GetOperation {
17136        pub(crate) fn new(
17137            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17138        ) -> Self {
17139            Self(RequestBuilder::new(stub))
17140        }
17141
17142        /// Sets the full request, replacing any prior values.
17143        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
17144            mut self,
17145            v: V,
17146        ) -> Self {
17147            self.0.request = v.into();
17148            self
17149        }
17150
17151        /// Sets all the options, replacing any prior values.
17152        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17153            self.0.options = v.into();
17154            self
17155        }
17156
17157        /// Sends the request.
17158        pub async fn send(self) -> Result<longrunning::model::Operation> {
17159            (*self.0.stub)
17160                .get_operation(self.0.request, self.0.options)
17161                .await
17162                .map(gax::response::Response::into_body)
17163        }
17164
17165        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
17166        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17167            self.0.request.name = v.into();
17168            self
17169        }
17170    }
17171
17172    #[doc(hidden)]
17173    impl gax::options::internal::RequestBuilder for GetOperation {
17174        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17175            &mut self.0.options
17176        }
17177    }
17178
17179    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17180    ///
17181    /// # Example
17182    /// ```no_run
17183    /// # use google_cloud_discoveryengine_v1::builder;
17184    /// use builder::user_license_service::CancelOperation;
17185    /// # tokio_test::block_on(async {
17186    ///
17187    /// let builder = prepare_request_builder();
17188    /// let response = builder.send().await?;
17189    /// # gax::Result::<()>::Ok(()) });
17190    ///
17191    /// fn prepare_request_builder() -> CancelOperation {
17192    ///   # panic!();
17193    ///   // ... details omitted ...
17194    /// }
17195    /// ```
17196    #[derive(Clone, Debug)]
17197    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17198
17199    impl CancelOperation {
17200        pub(crate) fn new(
17201            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17202        ) -> Self {
17203            Self(RequestBuilder::new(stub))
17204        }
17205
17206        /// Sets the full request, replacing any prior values.
17207        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17208            mut self,
17209            v: V,
17210        ) -> Self {
17211            self.0.request = v.into();
17212            self
17213        }
17214
17215        /// Sets all the options, replacing any prior values.
17216        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17217            self.0.options = v.into();
17218            self
17219        }
17220
17221        /// Sends the request.
17222        pub async fn send(self) -> Result<()> {
17223            (*self.0.stub)
17224                .cancel_operation(self.0.request, self.0.options)
17225                .await
17226                .map(gax::response::Response::into_body)
17227        }
17228
17229        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
17230        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17231            self.0.request.name = v.into();
17232            self
17233        }
17234    }
17235
17236    #[doc(hidden)]
17237    impl gax::options::internal::RequestBuilder for CancelOperation {
17238        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17239            &mut self.0.options
17240        }
17241    }
17242}