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
181    #[doc(hidden)]
182    impl gax::options::internal::RequestBuilder for ListOperations {
183        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184            &mut self.0.options
185        }
186    }
187
188    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
189    ///
190    /// # Example
191    /// ```no_run
192    /// # use google_cloud_discoveryengine_v1::builder;
193    /// use builder::assistant_service::GetOperation;
194    /// # tokio_test::block_on(async {
195    ///
196    /// let builder = prepare_request_builder();
197    /// let response = builder.send().await?;
198    /// # gax::Result::<()>::Ok(()) });
199    ///
200    /// fn prepare_request_builder() -> GetOperation {
201    ///   # panic!();
202    ///   // ... details omitted ...
203    /// }
204    /// ```
205    #[derive(Clone, Debug)]
206    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
207
208    impl GetOperation {
209        pub(crate) fn new(
210            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
211        ) -> Self {
212            Self(RequestBuilder::new(stub))
213        }
214
215        /// Sets the full request, replacing any prior values.
216        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
217            mut self,
218            v: V,
219        ) -> Self {
220            self.0.request = v.into();
221            self
222        }
223
224        /// Sets all the options, replacing any prior values.
225        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
226            self.0.options = v.into();
227            self
228        }
229
230        /// Sends the request.
231        pub async fn send(self) -> Result<longrunning::model::Operation> {
232            (*self.0.stub)
233                .get_operation(self.0.request, self.0.options)
234                .await
235                .map(gax::response::Response::into_body)
236        }
237
238        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
239        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240            self.0.request.name = v.into();
241            self
242        }
243    }
244
245    #[doc(hidden)]
246    impl gax::options::internal::RequestBuilder for GetOperation {
247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
253    ///
254    /// # Example
255    /// ```no_run
256    /// # use google_cloud_discoveryengine_v1::builder;
257    /// use builder::assistant_service::CancelOperation;
258    /// # tokio_test::block_on(async {
259    ///
260    /// let builder = prepare_request_builder();
261    /// let response = builder.send().await?;
262    /// # gax::Result::<()>::Ok(()) });
263    ///
264    /// fn prepare_request_builder() -> CancelOperation {
265    ///   # panic!();
266    ///   // ... details omitted ...
267    /// }
268    /// ```
269    #[derive(Clone, Debug)]
270    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
271
272    impl CancelOperation {
273        pub(crate) fn new(
274            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
275        ) -> Self {
276            Self(RequestBuilder::new(stub))
277        }
278
279        /// Sets the full request, replacing any prior values.
280        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
281            mut self,
282            v: V,
283        ) -> Self {
284            self.0.request = v.into();
285            self
286        }
287
288        /// Sets all the options, replacing any prior values.
289        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
290            self.0.options = v.into();
291            self
292        }
293
294        /// Sends the request.
295        pub async fn send(self) -> Result<()> {
296            (*self.0.stub)
297                .cancel_operation(self.0.request, self.0.options)
298                .await
299                .map(gax::response::Response::into_body)
300        }
301
302        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
303        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
304            self.0.request.name = v.into();
305            self
306        }
307    }
308
309    #[doc(hidden)]
310    impl gax::options::internal::RequestBuilder for CancelOperation {
311        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
312            &mut self.0.options
313        }
314    }
315}
316
317#[cfg(feature = "cmek-config-service")]
318#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
319pub mod cmek_config_service {
320    use crate::Result;
321
322    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
323    ///
324    /// ```
325    /// # tokio_test::block_on(async {
326    /// # use google_cloud_discoveryengine_v1::*;
327    /// # use builder::cmek_config_service::ClientBuilder;
328    /// # use client::CmekConfigService;
329    /// let builder : ClientBuilder = CmekConfigService::builder();
330    /// let client = builder
331    ///     .with_endpoint("https://discoveryengine.googleapis.com")
332    ///     .build().await?;
333    /// # gax::client_builder::Result::<()>::Ok(()) });
334    /// ```
335    pub type ClientBuilder =
336        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
337
338    pub(crate) mod client {
339        use super::super::super::client::CmekConfigService;
340        pub struct Factory;
341        impl gax::client_builder::internal::ClientFactory for Factory {
342            type Client = CmekConfigService;
343            type Credentials = gaxi::options::Credentials;
344            async fn build(
345                self,
346                config: gaxi::options::ClientConfig,
347            ) -> gax::client_builder::Result<Self::Client> {
348                Self::Client::new(config).await
349            }
350        }
351    }
352
353    /// Common implementation for [crate::client::CmekConfigService] request builders.
354    #[derive(Clone, Debug)]
355    pub(crate) struct RequestBuilder<R: std::default::Default> {
356        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
357        request: R,
358        options: gax::options::RequestOptions,
359    }
360
361    impl<R> RequestBuilder<R>
362    where
363        R: std::default::Default,
364    {
365        pub(crate) fn new(
366            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
367        ) -> Self {
368            Self {
369                stub,
370                request: R::default(),
371                options: gax::options::RequestOptions::default(),
372            }
373        }
374    }
375
376    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
377    ///
378    /// # Example
379    /// ```no_run
380    /// # use google_cloud_discoveryengine_v1::builder;
381    /// use builder::cmek_config_service::UpdateCmekConfig;
382    /// # tokio_test::block_on(async {
383    /// use lro::Poller;
384    ///
385    /// let builder = prepare_request_builder();
386    /// let response = builder.poller().until_done().await?;
387    /// # gax::Result::<()>::Ok(()) });
388    ///
389    /// fn prepare_request_builder() -> UpdateCmekConfig {
390    ///   # panic!();
391    ///   // ... details omitted ...
392    /// }
393    /// ```
394    #[derive(Clone, Debug)]
395    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
396
397    impl UpdateCmekConfig {
398        pub(crate) fn new(
399            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
400        ) -> Self {
401            Self(RequestBuilder::new(stub))
402        }
403
404        /// Sets the full request, replacing any prior values.
405        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
406            mut self,
407            v: V,
408        ) -> Self {
409            self.0.request = v.into();
410            self
411        }
412
413        /// Sets all the options, replacing any prior values.
414        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
415            self.0.options = v.into();
416            self
417        }
418
419        /// Sends the request.
420        ///
421        /// # Long running operations
422        ///
423        /// This starts, but does not poll, a longrunning operation. More information
424        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
425        pub async fn send(self) -> Result<longrunning::model::Operation> {
426            (*self.0.stub)
427                .update_cmek_config(self.0.request, self.0.options)
428                .await
429                .map(gax::response::Response::into_body)
430        }
431
432        /// Creates a [Poller][lro::Poller] to work with `update_cmek_config`.
433        pub fn poller(
434            self,
435        ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
436        {
437            type Operation = lro::internal::Operation<
438                crate::model::CmekConfig,
439                crate::model::UpdateCmekConfigMetadata,
440            >;
441            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
442            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
443
444            let stub = self.0.stub.clone();
445            let mut options = self.0.options.clone();
446            options.set_retry_policy(gax::retry_policy::NeverRetry);
447            let query = move |name| {
448                let stub = stub.clone();
449                let options = options.clone();
450                async {
451                    let op = GetOperation::new(stub)
452                        .set_name(name)
453                        .with_options(options)
454                        .send()
455                        .await?;
456                    Ok(Operation::new(op))
457                }
458            };
459
460            let start = move || async {
461                let op = self.send().await?;
462                Ok(Operation::new(op))
463            };
464
465            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
466        }
467
468        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
469        ///
470        /// This is a **required** field for requests.
471        pub fn set_config<T>(mut self, v: T) -> Self
472        where
473            T: std::convert::Into<crate::model::CmekConfig>,
474        {
475            self.0.request.config = std::option::Option::Some(v.into());
476            self
477        }
478
479        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
480        ///
481        /// This is a **required** field for requests.
482        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
483        where
484            T: std::convert::Into<crate::model::CmekConfig>,
485        {
486            self.0.request.config = v.map(|x| x.into());
487            self
488        }
489
490        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
491        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
492            self.0.request.set_default = v.into();
493            self
494        }
495    }
496
497    #[doc(hidden)]
498    impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
499        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
500            &mut self.0.options
501        }
502    }
503
504    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
505    ///
506    /// # Example
507    /// ```no_run
508    /// # use google_cloud_discoveryengine_v1::builder;
509    /// use builder::cmek_config_service::GetCmekConfig;
510    /// # tokio_test::block_on(async {
511    ///
512    /// let builder = prepare_request_builder();
513    /// let response = builder.send().await?;
514    /// # gax::Result::<()>::Ok(()) });
515    ///
516    /// fn prepare_request_builder() -> GetCmekConfig {
517    ///   # panic!();
518    ///   // ... details omitted ...
519    /// }
520    /// ```
521    #[derive(Clone, Debug)]
522    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
523
524    impl GetCmekConfig {
525        pub(crate) fn new(
526            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
527        ) -> Self {
528            Self(RequestBuilder::new(stub))
529        }
530
531        /// Sets the full request, replacing any prior values.
532        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
533            self.0.request = v.into();
534            self
535        }
536
537        /// Sets all the options, replacing any prior values.
538        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
539            self.0.options = v.into();
540            self
541        }
542
543        /// Sends the request.
544        pub async fn send(self) -> Result<crate::model::CmekConfig> {
545            (*self.0.stub)
546                .get_cmek_config(self.0.request, self.0.options)
547                .await
548                .map(gax::response::Response::into_body)
549        }
550
551        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
552        ///
553        /// This is a **required** field for requests.
554        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
555            self.0.request.name = v.into();
556            self
557        }
558    }
559
560    #[doc(hidden)]
561    impl gax::options::internal::RequestBuilder for GetCmekConfig {
562        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
563            &mut self.0.options
564        }
565    }
566
567    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
568    ///
569    /// # Example
570    /// ```no_run
571    /// # use google_cloud_discoveryengine_v1::builder;
572    /// use builder::cmek_config_service::ListCmekConfigs;
573    /// # tokio_test::block_on(async {
574    ///
575    /// let builder = prepare_request_builder();
576    /// let response = builder.send().await?;
577    /// # gax::Result::<()>::Ok(()) });
578    ///
579    /// fn prepare_request_builder() -> ListCmekConfigs {
580    ///   # panic!();
581    ///   // ... details omitted ...
582    /// }
583    /// ```
584    #[derive(Clone, Debug)]
585    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
586
587    impl ListCmekConfigs {
588        pub(crate) fn new(
589            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
590        ) -> Self {
591            Self(RequestBuilder::new(stub))
592        }
593
594        /// Sets the full request, replacing any prior values.
595        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
596            self.0.request = v.into();
597            self
598        }
599
600        /// Sets all the options, replacing any prior values.
601        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
602            self.0.options = v.into();
603            self
604        }
605
606        /// Sends the request.
607        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
608            (*self.0.stub)
609                .list_cmek_configs(self.0.request, self.0.options)
610                .await
611                .map(gax::response::Response::into_body)
612        }
613
614        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
615        ///
616        /// This is a **required** field for requests.
617        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
618            self.0.request.parent = v.into();
619            self
620        }
621    }
622
623    #[doc(hidden)]
624    impl gax::options::internal::RequestBuilder for ListCmekConfigs {
625        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
626            &mut self.0.options
627        }
628    }
629
630    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
631    ///
632    /// # Example
633    /// ```no_run
634    /// # use google_cloud_discoveryengine_v1::builder;
635    /// use builder::cmek_config_service::DeleteCmekConfig;
636    /// # tokio_test::block_on(async {
637    /// use lro::Poller;
638    ///
639    /// let builder = prepare_request_builder();
640    /// let response = builder.poller().until_done().await?;
641    /// # gax::Result::<()>::Ok(()) });
642    ///
643    /// fn prepare_request_builder() -> DeleteCmekConfig {
644    ///   # panic!();
645    ///   // ... details omitted ...
646    /// }
647    /// ```
648    #[derive(Clone, Debug)]
649    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
650
651    impl DeleteCmekConfig {
652        pub(crate) fn new(
653            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
654        ) -> Self {
655            Self(RequestBuilder::new(stub))
656        }
657
658        /// Sets the full request, replacing any prior values.
659        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
660            mut self,
661            v: V,
662        ) -> Self {
663            self.0.request = v.into();
664            self
665        }
666
667        /// Sets all the options, replacing any prior values.
668        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
669            self.0.options = v.into();
670            self
671        }
672
673        /// Sends the request.
674        ///
675        /// # Long running operations
676        ///
677        /// This starts, but does not poll, a longrunning operation. More information
678        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
679        pub async fn send(self) -> Result<longrunning::model::Operation> {
680            (*self.0.stub)
681                .delete_cmek_config(self.0.request, self.0.options)
682                .await
683                .map(gax::response::Response::into_body)
684        }
685
686        /// Creates a [Poller][lro::Poller] to work with `delete_cmek_config`.
687        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
688            type Operation =
689                lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
690            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
691            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
692
693            let stub = self.0.stub.clone();
694            let mut options = self.0.options.clone();
695            options.set_retry_policy(gax::retry_policy::NeverRetry);
696            let query = move |name| {
697                let stub = stub.clone();
698                let options = options.clone();
699                async {
700                    let op = GetOperation::new(stub)
701                        .set_name(name)
702                        .with_options(options)
703                        .send()
704                        .await?;
705                    Ok(Operation::new(op))
706                }
707            };
708
709            let start = move || async {
710                let op = self.send().await?;
711                Ok(Operation::new(op))
712            };
713
714            lro::internal::new_unit_response_poller(
715                polling_error_policy,
716                polling_backoff_policy,
717                start,
718                query,
719            )
720        }
721
722        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
723        ///
724        /// This is a **required** field for requests.
725        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
726            self.0.request.name = v.into();
727            self
728        }
729    }
730
731    #[doc(hidden)]
732    impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
733        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734            &mut self.0.options
735        }
736    }
737
738    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
739    ///
740    /// # Example
741    /// ```no_run
742    /// # use google_cloud_discoveryengine_v1::builder;
743    /// use builder::cmek_config_service::ListOperations;
744    /// # tokio_test::block_on(async {
745    /// use gax::paginator::ItemPaginator;
746    ///
747    /// let builder = prepare_request_builder();
748    /// let mut items = builder.by_item();
749    /// while let Some(result) = items.next().await {
750    ///   let item = result?;
751    /// }
752    /// # gax::Result::<()>::Ok(()) });
753    ///
754    /// fn prepare_request_builder() -> ListOperations {
755    ///   # panic!();
756    ///   // ... details omitted ...
757    /// }
758    /// ```
759    #[derive(Clone, Debug)]
760    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
761
762    impl ListOperations {
763        pub(crate) fn new(
764            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
765        ) -> Self {
766            Self(RequestBuilder::new(stub))
767        }
768
769        /// Sets the full request, replacing any prior values.
770        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
771            mut self,
772            v: V,
773        ) -> Self {
774            self.0.request = v.into();
775            self
776        }
777
778        /// Sets all the options, replacing any prior values.
779        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
780            self.0.options = v.into();
781            self
782        }
783
784        /// Sends the request.
785        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
786            (*self.0.stub)
787                .list_operations(self.0.request, self.0.options)
788                .await
789                .map(gax::response::Response::into_body)
790        }
791
792        /// Streams each page in the collection.
793        pub fn by_page(
794            self,
795        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
796        {
797            use std::clone::Clone;
798            let token = self.0.request.page_token.clone();
799            let execute = move |token: String| {
800                let mut builder = self.clone();
801                builder.0.request = builder.0.request.set_page_token(token);
802                builder.send()
803            };
804            gax::paginator::internal::new_paginator(token, execute)
805        }
806
807        /// Streams each item in the collection.
808        pub fn by_item(
809            self,
810        ) -> impl gax::paginator::ItemPaginator<
811            longrunning::model::ListOperationsResponse,
812            gax::error::Error,
813        > {
814            use gax::paginator::Paginator;
815            self.by_page().items()
816        }
817
818        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
819        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
820            self.0.request.name = v.into();
821            self
822        }
823
824        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
825        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
826            self.0.request.filter = v.into();
827            self
828        }
829
830        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
831        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
832            self.0.request.page_size = v.into();
833            self
834        }
835
836        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
837        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
838            self.0.request.page_token = v.into();
839            self
840        }
841    }
842
843    #[doc(hidden)]
844    impl gax::options::internal::RequestBuilder for ListOperations {
845        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
846            &mut self.0.options
847        }
848    }
849
850    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
851    ///
852    /// # Example
853    /// ```no_run
854    /// # use google_cloud_discoveryengine_v1::builder;
855    /// use builder::cmek_config_service::GetOperation;
856    /// # tokio_test::block_on(async {
857    ///
858    /// let builder = prepare_request_builder();
859    /// let response = builder.send().await?;
860    /// # gax::Result::<()>::Ok(()) });
861    ///
862    /// fn prepare_request_builder() -> GetOperation {
863    ///   # panic!();
864    ///   // ... details omitted ...
865    /// }
866    /// ```
867    #[derive(Clone, Debug)]
868    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
869
870    impl GetOperation {
871        pub(crate) fn new(
872            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
873        ) -> Self {
874            Self(RequestBuilder::new(stub))
875        }
876
877        /// Sets the full request, replacing any prior values.
878        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
879            mut self,
880            v: V,
881        ) -> Self {
882            self.0.request = v.into();
883            self
884        }
885
886        /// Sets all the options, replacing any prior values.
887        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
888            self.0.options = v.into();
889            self
890        }
891
892        /// Sends the request.
893        pub async fn send(self) -> Result<longrunning::model::Operation> {
894            (*self.0.stub)
895                .get_operation(self.0.request, self.0.options)
896                .await
897                .map(gax::response::Response::into_body)
898        }
899
900        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
901        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
902            self.0.request.name = v.into();
903            self
904        }
905    }
906
907    #[doc(hidden)]
908    impl gax::options::internal::RequestBuilder for GetOperation {
909        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
910            &mut self.0.options
911        }
912    }
913
914    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
915    ///
916    /// # Example
917    /// ```no_run
918    /// # use google_cloud_discoveryengine_v1::builder;
919    /// use builder::cmek_config_service::CancelOperation;
920    /// # tokio_test::block_on(async {
921    ///
922    /// let builder = prepare_request_builder();
923    /// let response = builder.send().await?;
924    /// # gax::Result::<()>::Ok(()) });
925    ///
926    /// fn prepare_request_builder() -> CancelOperation {
927    ///   # panic!();
928    ///   // ... details omitted ...
929    /// }
930    /// ```
931    #[derive(Clone, Debug)]
932    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
933
934    impl CancelOperation {
935        pub(crate) fn new(
936            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
937        ) -> Self {
938            Self(RequestBuilder::new(stub))
939        }
940
941        /// Sets the full request, replacing any prior values.
942        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
943            mut self,
944            v: V,
945        ) -> Self {
946            self.0.request = v.into();
947            self
948        }
949
950        /// Sets all the options, replacing any prior values.
951        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
952            self.0.options = v.into();
953            self
954        }
955
956        /// Sends the request.
957        pub async fn send(self) -> Result<()> {
958            (*self.0.stub)
959                .cancel_operation(self.0.request, self.0.options)
960                .await
961                .map(gax::response::Response::into_body)
962        }
963
964        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
965        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
966            self.0.request.name = v.into();
967            self
968        }
969    }
970
971    #[doc(hidden)]
972    impl gax::options::internal::RequestBuilder for CancelOperation {
973        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
974            &mut self.0.options
975        }
976    }
977}
978
979#[cfg(feature = "completion-service")]
980#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
981pub mod completion_service {
982    use crate::Result;
983
984    /// A builder for [CompletionService][crate::client::CompletionService].
985    ///
986    /// ```
987    /// # tokio_test::block_on(async {
988    /// # use google_cloud_discoveryengine_v1::*;
989    /// # use builder::completion_service::ClientBuilder;
990    /// # use client::CompletionService;
991    /// let builder : ClientBuilder = CompletionService::builder();
992    /// let client = builder
993    ///     .with_endpoint("https://discoveryengine.googleapis.com")
994    ///     .build().await?;
995    /// # gax::client_builder::Result::<()>::Ok(()) });
996    /// ```
997    pub type ClientBuilder =
998        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
999
1000    pub(crate) mod client {
1001        use super::super::super::client::CompletionService;
1002        pub struct Factory;
1003        impl gax::client_builder::internal::ClientFactory for Factory {
1004            type Client = CompletionService;
1005            type Credentials = gaxi::options::Credentials;
1006            async fn build(
1007                self,
1008                config: gaxi::options::ClientConfig,
1009            ) -> gax::client_builder::Result<Self::Client> {
1010                Self::Client::new(config).await
1011            }
1012        }
1013    }
1014
1015    /// Common implementation for [crate::client::CompletionService] request builders.
1016    #[derive(Clone, Debug)]
1017    pub(crate) struct RequestBuilder<R: std::default::Default> {
1018        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1019        request: R,
1020        options: gax::options::RequestOptions,
1021    }
1022
1023    impl<R> RequestBuilder<R>
1024    where
1025        R: std::default::Default,
1026    {
1027        pub(crate) fn new(
1028            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1029        ) -> Self {
1030            Self {
1031                stub,
1032                request: R::default(),
1033                options: gax::options::RequestOptions::default(),
1034            }
1035        }
1036    }
1037
1038    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1039    ///
1040    /// # Example
1041    /// ```no_run
1042    /// # use google_cloud_discoveryengine_v1::builder;
1043    /// use builder::completion_service::CompleteQuery;
1044    /// # tokio_test::block_on(async {
1045    ///
1046    /// let builder = prepare_request_builder();
1047    /// let response = builder.send().await?;
1048    /// # gax::Result::<()>::Ok(()) });
1049    ///
1050    /// fn prepare_request_builder() -> CompleteQuery {
1051    ///   # panic!();
1052    ///   // ... details omitted ...
1053    /// }
1054    /// ```
1055    #[derive(Clone, Debug)]
1056    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1057
1058    impl CompleteQuery {
1059        pub(crate) fn new(
1060            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1061        ) -> Self {
1062            Self(RequestBuilder::new(stub))
1063        }
1064
1065        /// Sets the full request, replacing any prior values.
1066        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1067            self.0.request = v.into();
1068            self
1069        }
1070
1071        /// Sets all the options, replacing any prior values.
1072        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1073            self.0.options = v.into();
1074            self
1075        }
1076
1077        /// Sends the request.
1078        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1079            (*self.0.stub)
1080                .complete_query(self.0.request, self.0.options)
1081                .await
1082                .map(gax::response::Response::into_body)
1083        }
1084
1085        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1086        ///
1087        /// This is a **required** field for requests.
1088        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1089            self.0.request.data_store = v.into();
1090            self
1091        }
1092
1093        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1094        ///
1095        /// This is a **required** field for requests.
1096        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097            self.0.request.query = v.into();
1098            self
1099        }
1100
1101        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1102        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1103            self.0.request.query_model = v.into();
1104            self
1105        }
1106
1107        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1108        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109            self.0.request.user_pseudo_id = v.into();
1110            self
1111        }
1112
1113        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1114        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1115            self.0.request.include_tail_suggestions = v.into();
1116            self
1117        }
1118    }
1119
1120    #[doc(hidden)]
1121    impl gax::options::internal::RequestBuilder for CompleteQuery {
1122        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1123            &mut self.0.options
1124        }
1125    }
1126
1127    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1128    ///
1129    /// # Example
1130    /// ```no_run
1131    /// # use google_cloud_discoveryengine_v1::builder;
1132    /// use builder::completion_service::ImportSuggestionDenyListEntries;
1133    /// # tokio_test::block_on(async {
1134    /// use lro::Poller;
1135    ///
1136    /// let builder = prepare_request_builder();
1137    /// let response = builder.poller().until_done().await?;
1138    /// # gax::Result::<()>::Ok(()) });
1139    ///
1140    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1141    ///   # panic!();
1142    ///   // ... details omitted ...
1143    /// }
1144    /// ```
1145    #[derive(Clone, Debug)]
1146    pub struct ImportSuggestionDenyListEntries(
1147        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1148    );
1149
1150    impl ImportSuggestionDenyListEntries {
1151        pub(crate) fn new(
1152            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1153        ) -> Self {
1154            Self(RequestBuilder::new(stub))
1155        }
1156
1157        /// Sets the full request, replacing any prior values.
1158        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1159            mut self,
1160            v: V,
1161        ) -> Self {
1162            self.0.request = v.into();
1163            self
1164        }
1165
1166        /// Sets all the options, replacing any prior values.
1167        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1168            self.0.options = v.into();
1169            self
1170        }
1171
1172        /// Sends the request.
1173        ///
1174        /// # Long running operations
1175        ///
1176        /// This starts, but does not poll, a longrunning operation. More information
1177        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1178        pub async fn send(self) -> Result<longrunning::model::Operation> {
1179            (*self.0.stub)
1180                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1181                .await
1182                .map(gax::response::Response::into_body)
1183        }
1184
1185        /// Creates a [Poller][lro::Poller] to work with `import_suggestion_deny_list_entries`.
1186        pub fn poller(
1187            self,
1188        ) -> impl lro::Poller<
1189            crate::model::ImportSuggestionDenyListEntriesResponse,
1190            crate::model::ImportSuggestionDenyListEntriesMetadata,
1191        > {
1192            type Operation = lro::internal::Operation<
1193                crate::model::ImportSuggestionDenyListEntriesResponse,
1194                crate::model::ImportSuggestionDenyListEntriesMetadata,
1195            >;
1196            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1197            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1198
1199            let stub = self.0.stub.clone();
1200            let mut options = self.0.options.clone();
1201            options.set_retry_policy(gax::retry_policy::NeverRetry);
1202            let query = move |name| {
1203                let stub = stub.clone();
1204                let options = options.clone();
1205                async {
1206                    let op = GetOperation::new(stub)
1207                        .set_name(name)
1208                        .with_options(options)
1209                        .send()
1210                        .await?;
1211                    Ok(Operation::new(op))
1212                }
1213            };
1214
1215            let start = move || async {
1216                let op = self.send().await?;
1217                Ok(Operation::new(op))
1218            };
1219
1220            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1221        }
1222
1223        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1224        ///
1225        /// This is a **required** field for requests.
1226        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1227            self.0.request.parent = v.into();
1228            self
1229        }
1230
1231        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1232        ///
1233        /// Note that all the setters affecting `source` are
1234        /// mutually exclusive.
1235        pub fn set_source<
1236            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1237        >(
1238            mut self,
1239            v: T,
1240        ) -> Self {
1241            self.0.request.source = v.into();
1242            self
1243        }
1244
1245        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1246        /// to hold a `InlineSource`.
1247        ///
1248        /// Note that all the setters affecting `source` are
1249        /// mutually exclusive.
1250        pub fn set_inline_source<
1251            T: std::convert::Into<
1252                    std::boxed::Box<
1253                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1254                    >,
1255                >,
1256        >(
1257            mut self,
1258            v: T,
1259        ) -> Self {
1260            self.0.request = self.0.request.set_inline_source(v);
1261            self
1262        }
1263
1264        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1265        /// to hold a `GcsSource`.
1266        ///
1267        /// Note that all the setters affecting `source` are
1268        /// mutually exclusive.
1269        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1270            mut self,
1271            v: T,
1272        ) -> Self {
1273            self.0.request = self.0.request.set_gcs_source(v);
1274            self
1275        }
1276    }
1277
1278    #[doc(hidden)]
1279    impl gax::options::internal::RequestBuilder for ImportSuggestionDenyListEntries {
1280        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1281            &mut self.0.options
1282        }
1283    }
1284
1285    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1286    ///
1287    /// # Example
1288    /// ```no_run
1289    /// # use google_cloud_discoveryengine_v1::builder;
1290    /// use builder::completion_service::PurgeSuggestionDenyListEntries;
1291    /// # tokio_test::block_on(async {
1292    /// use lro::Poller;
1293    ///
1294    /// let builder = prepare_request_builder();
1295    /// let response = builder.poller().until_done().await?;
1296    /// # gax::Result::<()>::Ok(()) });
1297    ///
1298    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1299    ///   # panic!();
1300    ///   // ... details omitted ...
1301    /// }
1302    /// ```
1303    #[derive(Clone, Debug)]
1304    pub struct PurgeSuggestionDenyListEntries(
1305        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1306    );
1307
1308    impl PurgeSuggestionDenyListEntries {
1309        pub(crate) fn new(
1310            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1311        ) -> Self {
1312            Self(RequestBuilder::new(stub))
1313        }
1314
1315        /// Sets the full request, replacing any prior values.
1316        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1317            mut self,
1318            v: V,
1319        ) -> Self {
1320            self.0.request = v.into();
1321            self
1322        }
1323
1324        /// Sets all the options, replacing any prior values.
1325        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1326            self.0.options = v.into();
1327            self
1328        }
1329
1330        /// Sends the request.
1331        ///
1332        /// # Long running operations
1333        ///
1334        /// This starts, but does not poll, a longrunning operation. More information
1335        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1336        pub async fn send(self) -> Result<longrunning::model::Operation> {
1337            (*self.0.stub)
1338                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1339                .await
1340                .map(gax::response::Response::into_body)
1341        }
1342
1343        /// Creates a [Poller][lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1344        pub fn poller(
1345            self,
1346        ) -> impl lro::Poller<
1347            crate::model::PurgeSuggestionDenyListEntriesResponse,
1348            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1349        > {
1350            type Operation = lro::internal::Operation<
1351                crate::model::PurgeSuggestionDenyListEntriesResponse,
1352                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1353            >;
1354            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1355            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1356
1357            let stub = self.0.stub.clone();
1358            let mut options = self.0.options.clone();
1359            options.set_retry_policy(gax::retry_policy::NeverRetry);
1360            let query = move |name| {
1361                let stub = stub.clone();
1362                let options = options.clone();
1363                async {
1364                    let op = GetOperation::new(stub)
1365                        .set_name(name)
1366                        .with_options(options)
1367                        .send()
1368                        .await?;
1369                    Ok(Operation::new(op))
1370                }
1371            };
1372
1373            let start = move || async {
1374                let op = self.send().await?;
1375                Ok(Operation::new(op))
1376            };
1377
1378            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1379        }
1380
1381        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1382        ///
1383        /// This is a **required** field for requests.
1384        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1385            self.0.request.parent = v.into();
1386            self
1387        }
1388    }
1389
1390    #[doc(hidden)]
1391    impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1392        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1393            &mut self.0.options
1394        }
1395    }
1396
1397    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1398    ///
1399    /// # Example
1400    /// ```no_run
1401    /// # use google_cloud_discoveryengine_v1::builder;
1402    /// use builder::completion_service::ImportCompletionSuggestions;
1403    /// # tokio_test::block_on(async {
1404    /// use lro::Poller;
1405    ///
1406    /// let builder = prepare_request_builder();
1407    /// let response = builder.poller().until_done().await?;
1408    /// # gax::Result::<()>::Ok(()) });
1409    ///
1410    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1411    ///   # panic!();
1412    ///   // ... details omitted ...
1413    /// }
1414    /// ```
1415    #[derive(Clone, Debug)]
1416    pub struct ImportCompletionSuggestions(
1417        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1418    );
1419
1420    impl ImportCompletionSuggestions {
1421        pub(crate) fn new(
1422            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1423        ) -> Self {
1424            Self(RequestBuilder::new(stub))
1425        }
1426
1427        /// Sets the full request, replacing any prior values.
1428        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1429            mut self,
1430            v: V,
1431        ) -> Self {
1432            self.0.request = v.into();
1433            self
1434        }
1435
1436        /// Sets all the options, replacing any prior values.
1437        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1438            self.0.options = v.into();
1439            self
1440        }
1441
1442        /// Sends the request.
1443        ///
1444        /// # Long running operations
1445        ///
1446        /// This starts, but does not poll, a longrunning operation. More information
1447        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1448        pub async fn send(self) -> Result<longrunning::model::Operation> {
1449            (*self.0.stub)
1450                .import_completion_suggestions(self.0.request, self.0.options)
1451                .await
1452                .map(gax::response::Response::into_body)
1453        }
1454
1455        /// Creates a [Poller][lro::Poller] to work with `import_completion_suggestions`.
1456        pub fn poller(
1457            self,
1458        ) -> impl lro::Poller<
1459            crate::model::ImportCompletionSuggestionsResponse,
1460            crate::model::ImportCompletionSuggestionsMetadata,
1461        > {
1462            type Operation = lro::internal::Operation<
1463                crate::model::ImportCompletionSuggestionsResponse,
1464                crate::model::ImportCompletionSuggestionsMetadata,
1465            >;
1466            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1467            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1468
1469            let stub = self.0.stub.clone();
1470            let mut options = self.0.options.clone();
1471            options.set_retry_policy(gax::retry_policy::NeverRetry);
1472            let query = move |name| {
1473                let stub = stub.clone();
1474                let options = options.clone();
1475                async {
1476                    let op = GetOperation::new(stub)
1477                        .set_name(name)
1478                        .with_options(options)
1479                        .send()
1480                        .await?;
1481                    Ok(Operation::new(op))
1482                }
1483            };
1484
1485            let start = move || async {
1486                let op = self.send().await?;
1487                Ok(Operation::new(op))
1488            };
1489
1490            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1491        }
1492
1493        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1494        ///
1495        /// This is a **required** field for requests.
1496        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1497            self.0.request.parent = v.into();
1498            self
1499        }
1500
1501        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1502        pub fn set_error_config<T>(mut self, v: T) -> Self
1503        where
1504            T: std::convert::Into<crate::model::ImportErrorConfig>,
1505        {
1506            self.0.request.error_config = std::option::Option::Some(v.into());
1507            self
1508        }
1509
1510        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1511        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1512        where
1513            T: std::convert::Into<crate::model::ImportErrorConfig>,
1514        {
1515            self.0.request.error_config = v.map(|x| x.into());
1516            self
1517        }
1518
1519        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1520        ///
1521        /// Note that all the setters affecting `source` are
1522        /// mutually exclusive.
1523        pub fn set_source<
1524            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1525        >(
1526            mut self,
1527            v: T,
1528        ) -> Self {
1529            self.0.request.source = v.into();
1530            self
1531        }
1532
1533        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1534        /// to hold a `InlineSource`.
1535        ///
1536        /// Note that all the setters affecting `source` are
1537        /// mutually exclusive.
1538        pub fn set_inline_source<
1539            T: std::convert::Into<
1540                    std::boxed::Box<
1541                        crate::model::import_completion_suggestions_request::InlineSource,
1542                    >,
1543                >,
1544        >(
1545            mut self,
1546            v: T,
1547        ) -> Self {
1548            self.0.request = self.0.request.set_inline_source(v);
1549            self
1550        }
1551
1552        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1553        /// to hold a `GcsSource`.
1554        ///
1555        /// Note that all the setters affecting `source` are
1556        /// mutually exclusive.
1557        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1558            mut self,
1559            v: T,
1560        ) -> Self {
1561            self.0.request = self.0.request.set_gcs_source(v);
1562            self
1563        }
1564
1565        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1566        /// to hold a `BigquerySource`.
1567        ///
1568        /// Note that all the setters affecting `source` are
1569        /// mutually exclusive.
1570        pub fn set_bigquery_source<
1571            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1572        >(
1573            mut self,
1574            v: T,
1575        ) -> Self {
1576            self.0.request = self.0.request.set_bigquery_source(v);
1577            self
1578        }
1579    }
1580
1581    #[doc(hidden)]
1582    impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1583        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1584            &mut self.0.options
1585        }
1586    }
1587
1588    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1589    ///
1590    /// # Example
1591    /// ```no_run
1592    /// # use google_cloud_discoveryengine_v1::builder;
1593    /// use builder::completion_service::PurgeCompletionSuggestions;
1594    /// # tokio_test::block_on(async {
1595    /// use lro::Poller;
1596    ///
1597    /// let builder = prepare_request_builder();
1598    /// let response = builder.poller().until_done().await?;
1599    /// # gax::Result::<()>::Ok(()) });
1600    ///
1601    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1602    ///   # panic!();
1603    ///   // ... details omitted ...
1604    /// }
1605    /// ```
1606    #[derive(Clone, Debug)]
1607    pub struct PurgeCompletionSuggestions(
1608        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1609    );
1610
1611    impl PurgeCompletionSuggestions {
1612        pub(crate) fn new(
1613            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1614        ) -> Self {
1615            Self(RequestBuilder::new(stub))
1616        }
1617
1618        /// Sets the full request, replacing any prior values.
1619        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1620            mut self,
1621            v: V,
1622        ) -> Self {
1623            self.0.request = v.into();
1624            self
1625        }
1626
1627        /// Sets all the options, replacing any prior values.
1628        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1629            self.0.options = v.into();
1630            self
1631        }
1632
1633        /// Sends the request.
1634        ///
1635        /// # Long running operations
1636        ///
1637        /// This starts, but does not poll, a longrunning operation. More information
1638        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1639        pub async fn send(self) -> Result<longrunning::model::Operation> {
1640            (*self.0.stub)
1641                .purge_completion_suggestions(self.0.request, self.0.options)
1642                .await
1643                .map(gax::response::Response::into_body)
1644        }
1645
1646        /// Creates a [Poller][lro::Poller] to work with `purge_completion_suggestions`.
1647        pub fn poller(
1648            self,
1649        ) -> impl lro::Poller<
1650            crate::model::PurgeCompletionSuggestionsResponse,
1651            crate::model::PurgeCompletionSuggestionsMetadata,
1652        > {
1653            type Operation = lro::internal::Operation<
1654                crate::model::PurgeCompletionSuggestionsResponse,
1655                crate::model::PurgeCompletionSuggestionsMetadata,
1656            >;
1657            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1658            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1659
1660            let stub = self.0.stub.clone();
1661            let mut options = self.0.options.clone();
1662            options.set_retry_policy(gax::retry_policy::NeverRetry);
1663            let query = move |name| {
1664                let stub = stub.clone();
1665                let options = options.clone();
1666                async {
1667                    let op = GetOperation::new(stub)
1668                        .set_name(name)
1669                        .with_options(options)
1670                        .send()
1671                        .await?;
1672                    Ok(Operation::new(op))
1673                }
1674            };
1675
1676            let start = move || async {
1677                let op = self.send().await?;
1678                Ok(Operation::new(op))
1679            };
1680
1681            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1682        }
1683
1684        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1685        ///
1686        /// This is a **required** field for requests.
1687        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1688            self.0.request.parent = v.into();
1689            self
1690        }
1691    }
1692
1693    #[doc(hidden)]
1694    impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1695        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1696            &mut self.0.options
1697        }
1698    }
1699
1700    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1701    ///
1702    /// # Example
1703    /// ```no_run
1704    /// # use google_cloud_discoveryengine_v1::builder;
1705    /// use builder::completion_service::ListOperations;
1706    /// # tokio_test::block_on(async {
1707    /// use gax::paginator::ItemPaginator;
1708    ///
1709    /// let builder = prepare_request_builder();
1710    /// let mut items = builder.by_item();
1711    /// while let Some(result) = items.next().await {
1712    ///   let item = result?;
1713    /// }
1714    /// # gax::Result::<()>::Ok(()) });
1715    ///
1716    /// fn prepare_request_builder() -> ListOperations {
1717    ///   # panic!();
1718    ///   // ... details omitted ...
1719    /// }
1720    /// ```
1721    #[derive(Clone, Debug)]
1722    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1723
1724    impl ListOperations {
1725        pub(crate) fn new(
1726            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1727        ) -> Self {
1728            Self(RequestBuilder::new(stub))
1729        }
1730
1731        /// Sets the full request, replacing any prior values.
1732        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1733            mut self,
1734            v: V,
1735        ) -> Self {
1736            self.0.request = v.into();
1737            self
1738        }
1739
1740        /// Sets all the options, replacing any prior values.
1741        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1742            self.0.options = v.into();
1743            self
1744        }
1745
1746        /// Sends the request.
1747        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1748            (*self.0.stub)
1749                .list_operations(self.0.request, self.0.options)
1750                .await
1751                .map(gax::response::Response::into_body)
1752        }
1753
1754        /// Streams each page in the collection.
1755        pub fn by_page(
1756            self,
1757        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1758        {
1759            use std::clone::Clone;
1760            let token = self.0.request.page_token.clone();
1761            let execute = move |token: String| {
1762                let mut builder = self.clone();
1763                builder.0.request = builder.0.request.set_page_token(token);
1764                builder.send()
1765            };
1766            gax::paginator::internal::new_paginator(token, execute)
1767        }
1768
1769        /// Streams each item in the collection.
1770        pub fn by_item(
1771            self,
1772        ) -> impl gax::paginator::ItemPaginator<
1773            longrunning::model::ListOperationsResponse,
1774            gax::error::Error,
1775        > {
1776            use gax::paginator::Paginator;
1777            self.by_page().items()
1778        }
1779
1780        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1781        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1782            self.0.request.name = v.into();
1783            self
1784        }
1785
1786        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1787        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1788            self.0.request.filter = v.into();
1789            self
1790        }
1791
1792        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1793        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1794            self.0.request.page_size = v.into();
1795            self
1796        }
1797
1798        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1799        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800            self.0.request.page_token = v.into();
1801            self
1802        }
1803    }
1804
1805    #[doc(hidden)]
1806    impl gax::options::internal::RequestBuilder for ListOperations {
1807        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1808            &mut self.0.options
1809        }
1810    }
1811
1812    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1813    ///
1814    /// # Example
1815    /// ```no_run
1816    /// # use google_cloud_discoveryengine_v1::builder;
1817    /// use builder::completion_service::GetOperation;
1818    /// # tokio_test::block_on(async {
1819    ///
1820    /// let builder = prepare_request_builder();
1821    /// let response = builder.send().await?;
1822    /// # gax::Result::<()>::Ok(()) });
1823    ///
1824    /// fn prepare_request_builder() -> GetOperation {
1825    ///   # panic!();
1826    ///   // ... details omitted ...
1827    /// }
1828    /// ```
1829    #[derive(Clone, Debug)]
1830    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1831
1832    impl GetOperation {
1833        pub(crate) fn new(
1834            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1835        ) -> Self {
1836            Self(RequestBuilder::new(stub))
1837        }
1838
1839        /// Sets the full request, replacing any prior values.
1840        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1841            mut self,
1842            v: V,
1843        ) -> Self {
1844            self.0.request = v.into();
1845            self
1846        }
1847
1848        /// Sets all the options, replacing any prior values.
1849        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1850            self.0.options = v.into();
1851            self
1852        }
1853
1854        /// Sends the request.
1855        pub async fn send(self) -> Result<longrunning::model::Operation> {
1856            (*self.0.stub)
1857                .get_operation(self.0.request, self.0.options)
1858                .await
1859                .map(gax::response::Response::into_body)
1860        }
1861
1862        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1863        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1864            self.0.request.name = v.into();
1865            self
1866        }
1867    }
1868
1869    #[doc(hidden)]
1870    impl gax::options::internal::RequestBuilder for GetOperation {
1871        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1872            &mut self.0.options
1873        }
1874    }
1875
1876    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1877    ///
1878    /// # Example
1879    /// ```no_run
1880    /// # use google_cloud_discoveryengine_v1::builder;
1881    /// use builder::completion_service::CancelOperation;
1882    /// # tokio_test::block_on(async {
1883    ///
1884    /// let builder = prepare_request_builder();
1885    /// let response = builder.send().await?;
1886    /// # gax::Result::<()>::Ok(()) });
1887    ///
1888    /// fn prepare_request_builder() -> CancelOperation {
1889    ///   # panic!();
1890    ///   // ... details omitted ...
1891    /// }
1892    /// ```
1893    #[derive(Clone, Debug)]
1894    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1895
1896    impl CancelOperation {
1897        pub(crate) fn new(
1898            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1899        ) -> Self {
1900            Self(RequestBuilder::new(stub))
1901        }
1902
1903        /// Sets the full request, replacing any prior values.
1904        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1905            mut self,
1906            v: V,
1907        ) -> Self {
1908            self.0.request = v.into();
1909            self
1910        }
1911
1912        /// Sets all the options, replacing any prior values.
1913        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1914            self.0.options = v.into();
1915            self
1916        }
1917
1918        /// Sends the request.
1919        pub async fn send(self) -> Result<()> {
1920            (*self.0.stub)
1921                .cancel_operation(self.0.request, self.0.options)
1922                .await
1923                .map(gax::response::Response::into_body)
1924        }
1925
1926        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1927        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1928            self.0.request.name = v.into();
1929            self
1930        }
1931    }
1932
1933    #[doc(hidden)]
1934    impl gax::options::internal::RequestBuilder for CancelOperation {
1935        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1936            &mut self.0.options
1937        }
1938    }
1939}
1940
1941#[cfg(feature = "control-service")]
1942#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1943pub mod control_service {
1944    use crate::Result;
1945
1946    /// A builder for [ControlService][crate::client::ControlService].
1947    ///
1948    /// ```
1949    /// # tokio_test::block_on(async {
1950    /// # use google_cloud_discoveryengine_v1::*;
1951    /// # use builder::control_service::ClientBuilder;
1952    /// # use client::ControlService;
1953    /// let builder : ClientBuilder = ControlService::builder();
1954    /// let client = builder
1955    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1956    ///     .build().await?;
1957    /// # gax::client_builder::Result::<()>::Ok(()) });
1958    /// ```
1959    pub type ClientBuilder =
1960        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1961
1962    pub(crate) mod client {
1963        use super::super::super::client::ControlService;
1964        pub struct Factory;
1965        impl gax::client_builder::internal::ClientFactory for Factory {
1966            type Client = ControlService;
1967            type Credentials = gaxi::options::Credentials;
1968            async fn build(
1969                self,
1970                config: gaxi::options::ClientConfig,
1971            ) -> gax::client_builder::Result<Self::Client> {
1972                Self::Client::new(config).await
1973            }
1974        }
1975    }
1976
1977    /// Common implementation for [crate::client::ControlService] request builders.
1978    #[derive(Clone, Debug)]
1979    pub(crate) struct RequestBuilder<R: std::default::Default> {
1980        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1981        request: R,
1982        options: gax::options::RequestOptions,
1983    }
1984
1985    impl<R> RequestBuilder<R>
1986    where
1987        R: std::default::Default,
1988    {
1989        pub(crate) fn new(
1990            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1991        ) -> Self {
1992            Self {
1993                stub,
1994                request: R::default(),
1995                options: gax::options::RequestOptions::default(),
1996            }
1997        }
1998    }
1999
2000    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2001    ///
2002    /// # Example
2003    /// ```no_run
2004    /// # use google_cloud_discoveryengine_v1::builder;
2005    /// use builder::control_service::CreateControl;
2006    /// # tokio_test::block_on(async {
2007    ///
2008    /// let builder = prepare_request_builder();
2009    /// let response = builder.send().await?;
2010    /// # gax::Result::<()>::Ok(()) });
2011    ///
2012    /// fn prepare_request_builder() -> CreateControl {
2013    ///   # panic!();
2014    ///   // ... details omitted ...
2015    /// }
2016    /// ```
2017    #[derive(Clone, Debug)]
2018    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2019
2020    impl CreateControl {
2021        pub(crate) fn new(
2022            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2023        ) -> Self {
2024            Self(RequestBuilder::new(stub))
2025        }
2026
2027        /// Sets the full request, replacing any prior values.
2028        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2029            self.0.request = v.into();
2030            self
2031        }
2032
2033        /// Sets all the options, replacing any prior values.
2034        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2035            self.0.options = v.into();
2036            self
2037        }
2038
2039        /// Sends the request.
2040        pub async fn send(self) -> Result<crate::model::Control> {
2041            (*self.0.stub)
2042                .create_control(self.0.request, self.0.options)
2043                .await
2044                .map(gax::response::Response::into_body)
2045        }
2046
2047        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2048        ///
2049        /// This is a **required** field for requests.
2050        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2051            self.0.request.parent = v.into();
2052            self
2053        }
2054
2055        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2056        ///
2057        /// This is a **required** field for requests.
2058        pub fn set_control<T>(mut self, v: T) -> Self
2059        where
2060            T: std::convert::Into<crate::model::Control>,
2061        {
2062            self.0.request.control = std::option::Option::Some(v.into());
2063            self
2064        }
2065
2066        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2067        ///
2068        /// This is a **required** field for requests.
2069        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2070        where
2071            T: std::convert::Into<crate::model::Control>,
2072        {
2073            self.0.request.control = v.map(|x| x.into());
2074            self
2075        }
2076
2077        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2078        ///
2079        /// This is a **required** field for requests.
2080        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2081            self.0.request.control_id = v.into();
2082            self
2083        }
2084    }
2085
2086    #[doc(hidden)]
2087    impl gax::options::internal::RequestBuilder for CreateControl {
2088        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2089            &mut self.0.options
2090        }
2091    }
2092
2093    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2094    ///
2095    /// # Example
2096    /// ```no_run
2097    /// # use google_cloud_discoveryengine_v1::builder;
2098    /// use builder::control_service::DeleteControl;
2099    /// # tokio_test::block_on(async {
2100    ///
2101    /// let builder = prepare_request_builder();
2102    /// let response = builder.send().await?;
2103    /// # gax::Result::<()>::Ok(()) });
2104    ///
2105    /// fn prepare_request_builder() -> DeleteControl {
2106    ///   # panic!();
2107    ///   // ... details omitted ...
2108    /// }
2109    /// ```
2110    #[derive(Clone, Debug)]
2111    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2112
2113    impl DeleteControl {
2114        pub(crate) fn new(
2115            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2116        ) -> Self {
2117            Self(RequestBuilder::new(stub))
2118        }
2119
2120        /// Sets the full request, replacing any prior values.
2121        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2122            self.0.request = v.into();
2123            self
2124        }
2125
2126        /// Sets all the options, replacing any prior values.
2127        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2128            self.0.options = v.into();
2129            self
2130        }
2131
2132        /// Sends the request.
2133        pub async fn send(self) -> Result<()> {
2134            (*self.0.stub)
2135                .delete_control(self.0.request, self.0.options)
2136                .await
2137                .map(gax::response::Response::into_body)
2138        }
2139
2140        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2141        ///
2142        /// This is a **required** field for requests.
2143        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2144            self.0.request.name = v.into();
2145            self
2146        }
2147    }
2148
2149    #[doc(hidden)]
2150    impl gax::options::internal::RequestBuilder for DeleteControl {
2151        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2152            &mut self.0.options
2153        }
2154    }
2155
2156    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2157    ///
2158    /// # Example
2159    /// ```no_run
2160    /// # use google_cloud_discoveryengine_v1::builder;
2161    /// use builder::control_service::UpdateControl;
2162    /// # tokio_test::block_on(async {
2163    ///
2164    /// let builder = prepare_request_builder();
2165    /// let response = builder.send().await?;
2166    /// # gax::Result::<()>::Ok(()) });
2167    ///
2168    /// fn prepare_request_builder() -> UpdateControl {
2169    ///   # panic!();
2170    ///   // ... details omitted ...
2171    /// }
2172    /// ```
2173    #[derive(Clone, Debug)]
2174    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2175
2176    impl UpdateControl {
2177        pub(crate) fn new(
2178            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2179        ) -> Self {
2180            Self(RequestBuilder::new(stub))
2181        }
2182
2183        /// Sets the full request, replacing any prior values.
2184        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2185            self.0.request = v.into();
2186            self
2187        }
2188
2189        /// Sets all the options, replacing any prior values.
2190        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2191            self.0.options = v.into();
2192            self
2193        }
2194
2195        /// Sends the request.
2196        pub async fn send(self) -> Result<crate::model::Control> {
2197            (*self.0.stub)
2198                .update_control(self.0.request, self.0.options)
2199                .await
2200                .map(gax::response::Response::into_body)
2201        }
2202
2203        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2204        ///
2205        /// This is a **required** field for requests.
2206        pub fn set_control<T>(mut self, v: T) -> Self
2207        where
2208            T: std::convert::Into<crate::model::Control>,
2209        {
2210            self.0.request.control = std::option::Option::Some(v.into());
2211            self
2212        }
2213
2214        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2215        ///
2216        /// This is a **required** field for requests.
2217        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2218        where
2219            T: std::convert::Into<crate::model::Control>,
2220        {
2221            self.0.request.control = v.map(|x| x.into());
2222            self
2223        }
2224
2225        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2226        pub fn set_update_mask<T>(mut self, v: T) -> Self
2227        where
2228            T: std::convert::Into<wkt::FieldMask>,
2229        {
2230            self.0.request.update_mask = std::option::Option::Some(v.into());
2231            self
2232        }
2233
2234        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2235        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2236        where
2237            T: std::convert::Into<wkt::FieldMask>,
2238        {
2239            self.0.request.update_mask = v.map(|x| x.into());
2240            self
2241        }
2242    }
2243
2244    #[doc(hidden)]
2245    impl gax::options::internal::RequestBuilder for UpdateControl {
2246        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2247            &mut self.0.options
2248        }
2249    }
2250
2251    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2252    ///
2253    /// # Example
2254    /// ```no_run
2255    /// # use google_cloud_discoveryengine_v1::builder;
2256    /// use builder::control_service::GetControl;
2257    /// # tokio_test::block_on(async {
2258    ///
2259    /// let builder = prepare_request_builder();
2260    /// let response = builder.send().await?;
2261    /// # gax::Result::<()>::Ok(()) });
2262    ///
2263    /// fn prepare_request_builder() -> GetControl {
2264    ///   # panic!();
2265    ///   // ... details omitted ...
2266    /// }
2267    /// ```
2268    #[derive(Clone, Debug)]
2269    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2270
2271    impl GetControl {
2272        pub(crate) fn new(
2273            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2274        ) -> Self {
2275            Self(RequestBuilder::new(stub))
2276        }
2277
2278        /// Sets the full request, replacing any prior values.
2279        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2280            self.0.request = v.into();
2281            self
2282        }
2283
2284        /// Sets all the options, replacing any prior values.
2285        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2286            self.0.options = v.into();
2287            self
2288        }
2289
2290        /// Sends the request.
2291        pub async fn send(self) -> Result<crate::model::Control> {
2292            (*self.0.stub)
2293                .get_control(self.0.request, self.0.options)
2294                .await
2295                .map(gax::response::Response::into_body)
2296        }
2297
2298        /// Sets the value of [name][crate::model::GetControlRequest::name].
2299        ///
2300        /// This is a **required** field for requests.
2301        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2302            self.0.request.name = v.into();
2303            self
2304        }
2305    }
2306
2307    #[doc(hidden)]
2308    impl gax::options::internal::RequestBuilder for GetControl {
2309        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2310            &mut self.0.options
2311        }
2312    }
2313
2314    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2315    ///
2316    /// # Example
2317    /// ```no_run
2318    /// # use google_cloud_discoveryengine_v1::builder;
2319    /// use builder::control_service::ListControls;
2320    /// # tokio_test::block_on(async {
2321    /// use gax::paginator::ItemPaginator;
2322    ///
2323    /// let builder = prepare_request_builder();
2324    /// let mut items = builder.by_item();
2325    /// while let Some(result) = items.next().await {
2326    ///   let item = result?;
2327    /// }
2328    /// # gax::Result::<()>::Ok(()) });
2329    ///
2330    /// fn prepare_request_builder() -> ListControls {
2331    ///   # panic!();
2332    ///   // ... details omitted ...
2333    /// }
2334    /// ```
2335    #[derive(Clone, Debug)]
2336    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2337
2338    impl ListControls {
2339        pub(crate) fn new(
2340            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2341        ) -> Self {
2342            Self(RequestBuilder::new(stub))
2343        }
2344
2345        /// Sets the full request, replacing any prior values.
2346        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2347            self.0.request = v.into();
2348            self
2349        }
2350
2351        /// Sets all the options, replacing any prior values.
2352        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2353            self.0.options = v.into();
2354            self
2355        }
2356
2357        /// Sends the request.
2358        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2359            (*self.0.stub)
2360                .list_controls(self.0.request, self.0.options)
2361                .await
2362                .map(gax::response::Response::into_body)
2363        }
2364
2365        /// Streams each page in the collection.
2366        pub fn by_page(
2367            self,
2368        ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2369        {
2370            use std::clone::Clone;
2371            let token = self.0.request.page_token.clone();
2372            let execute = move |token: String| {
2373                let mut builder = self.clone();
2374                builder.0.request = builder.0.request.set_page_token(token);
2375                builder.send()
2376            };
2377            gax::paginator::internal::new_paginator(token, execute)
2378        }
2379
2380        /// Streams each item in the collection.
2381        pub fn by_item(
2382            self,
2383        ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2384        {
2385            use gax::paginator::Paginator;
2386            self.by_page().items()
2387        }
2388
2389        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2390        ///
2391        /// This is a **required** field for requests.
2392        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2393            self.0.request.parent = v.into();
2394            self
2395        }
2396
2397        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2398        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2399            self.0.request.page_size = v.into();
2400            self
2401        }
2402
2403        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2404        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2405            self.0.request.page_token = v.into();
2406            self
2407        }
2408
2409        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2410        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2411            self.0.request.filter = v.into();
2412            self
2413        }
2414    }
2415
2416    #[doc(hidden)]
2417    impl gax::options::internal::RequestBuilder for ListControls {
2418        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2419            &mut self.0.options
2420        }
2421    }
2422
2423    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2424    ///
2425    /// # Example
2426    /// ```no_run
2427    /// # use google_cloud_discoveryengine_v1::builder;
2428    /// use builder::control_service::ListOperations;
2429    /// # tokio_test::block_on(async {
2430    /// use gax::paginator::ItemPaginator;
2431    ///
2432    /// let builder = prepare_request_builder();
2433    /// let mut items = builder.by_item();
2434    /// while let Some(result) = items.next().await {
2435    ///   let item = result?;
2436    /// }
2437    /// # gax::Result::<()>::Ok(()) });
2438    ///
2439    /// fn prepare_request_builder() -> ListOperations {
2440    ///   # panic!();
2441    ///   // ... details omitted ...
2442    /// }
2443    /// ```
2444    #[derive(Clone, Debug)]
2445    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2446
2447    impl ListOperations {
2448        pub(crate) fn new(
2449            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2450        ) -> Self {
2451            Self(RequestBuilder::new(stub))
2452        }
2453
2454        /// Sets the full request, replacing any prior values.
2455        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2456            mut self,
2457            v: V,
2458        ) -> Self {
2459            self.0.request = v.into();
2460            self
2461        }
2462
2463        /// Sets all the options, replacing any prior values.
2464        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2465            self.0.options = v.into();
2466            self
2467        }
2468
2469        /// Sends the request.
2470        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2471            (*self.0.stub)
2472                .list_operations(self.0.request, self.0.options)
2473                .await
2474                .map(gax::response::Response::into_body)
2475        }
2476
2477        /// Streams each page in the collection.
2478        pub fn by_page(
2479            self,
2480        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2481        {
2482            use std::clone::Clone;
2483            let token = self.0.request.page_token.clone();
2484            let execute = move |token: String| {
2485                let mut builder = self.clone();
2486                builder.0.request = builder.0.request.set_page_token(token);
2487                builder.send()
2488            };
2489            gax::paginator::internal::new_paginator(token, execute)
2490        }
2491
2492        /// Streams each item in the collection.
2493        pub fn by_item(
2494            self,
2495        ) -> impl gax::paginator::ItemPaginator<
2496            longrunning::model::ListOperationsResponse,
2497            gax::error::Error,
2498        > {
2499            use gax::paginator::Paginator;
2500            self.by_page().items()
2501        }
2502
2503        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2504        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505            self.0.request.name = v.into();
2506            self
2507        }
2508
2509        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2510        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2511            self.0.request.filter = v.into();
2512            self
2513        }
2514
2515        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2516        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2517            self.0.request.page_size = v.into();
2518            self
2519        }
2520
2521        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2522        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2523            self.0.request.page_token = v.into();
2524            self
2525        }
2526    }
2527
2528    #[doc(hidden)]
2529    impl gax::options::internal::RequestBuilder for ListOperations {
2530        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2531            &mut self.0.options
2532        }
2533    }
2534
2535    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2536    ///
2537    /// # Example
2538    /// ```no_run
2539    /// # use google_cloud_discoveryengine_v1::builder;
2540    /// use builder::control_service::GetOperation;
2541    /// # tokio_test::block_on(async {
2542    ///
2543    /// let builder = prepare_request_builder();
2544    /// let response = builder.send().await?;
2545    /// # gax::Result::<()>::Ok(()) });
2546    ///
2547    /// fn prepare_request_builder() -> GetOperation {
2548    ///   # panic!();
2549    ///   // ... details omitted ...
2550    /// }
2551    /// ```
2552    #[derive(Clone, Debug)]
2553    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2554
2555    impl GetOperation {
2556        pub(crate) fn new(
2557            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2558        ) -> Self {
2559            Self(RequestBuilder::new(stub))
2560        }
2561
2562        /// Sets the full request, replacing any prior values.
2563        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2564            mut self,
2565            v: V,
2566        ) -> Self {
2567            self.0.request = v.into();
2568            self
2569        }
2570
2571        /// Sets all the options, replacing any prior values.
2572        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2573            self.0.options = v.into();
2574            self
2575        }
2576
2577        /// Sends the request.
2578        pub async fn send(self) -> Result<longrunning::model::Operation> {
2579            (*self.0.stub)
2580                .get_operation(self.0.request, self.0.options)
2581                .await
2582                .map(gax::response::Response::into_body)
2583        }
2584
2585        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2586        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2587            self.0.request.name = v.into();
2588            self
2589        }
2590    }
2591
2592    #[doc(hidden)]
2593    impl gax::options::internal::RequestBuilder for GetOperation {
2594        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2595            &mut self.0.options
2596        }
2597    }
2598
2599    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2600    ///
2601    /// # Example
2602    /// ```no_run
2603    /// # use google_cloud_discoveryengine_v1::builder;
2604    /// use builder::control_service::CancelOperation;
2605    /// # tokio_test::block_on(async {
2606    ///
2607    /// let builder = prepare_request_builder();
2608    /// let response = builder.send().await?;
2609    /// # gax::Result::<()>::Ok(()) });
2610    ///
2611    /// fn prepare_request_builder() -> CancelOperation {
2612    ///   # panic!();
2613    ///   // ... details omitted ...
2614    /// }
2615    /// ```
2616    #[derive(Clone, Debug)]
2617    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2618
2619    impl CancelOperation {
2620        pub(crate) fn new(
2621            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2622        ) -> Self {
2623            Self(RequestBuilder::new(stub))
2624        }
2625
2626        /// Sets the full request, replacing any prior values.
2627        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2628            mut self,
2629            v: V,
2630        ) -> Self {
2631            self.0.request = v.into();
2632            self
2633        }
2634
2635        /// Sets all the options, replacing any prior values.
2636        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2637            self.0.options = v.into();
2638            self
2639        }
2640
2641        /// Sends the request.
2642        pub async fn send(self) -> Result<()> {
2643            (*self.0.stub)
2644                .cancel_operation(self.0.request, self.0.options)
2645                .await
2646                .map(gax::response::Response::into_body)
2647        }
2648
2649        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2650        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2651            self.0.request.name = v.into();
2652            self
2653        }
2654    }
2655
2656    #[doc(hidden)]
2657    impl gax::options::internal::RequestBuilder for CancelOperation {
2658        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2659            &mut self.0.options
2660        }
2661    }
2662}
2663
2664#[cfg(feature = "conversational-search-service")]
2665#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2666pub mod conversational_search_service {
2667    use crate::Result;
2668
2669    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2670    ///
2671    /// ```
2672    /// # tokio_test::block_on(async {
2673    /// # use google_cloud_discoveryengine_v1::*;
2674    /// # use builder::conversational_search_service::ClientBuilder;
2675    /// # use client::ConversationalSearchService;
2676    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2677    /// let client = builder
2678    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2679    ///     .build().await?;
2680    /// # gax::client_builder::Result::<()>::Ok(()) });
2681    /// ```
2682    pub type ClientBuilder =
2683        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2684
2685    pub(crate) mod client {
2686        use super::super::super::client::ConversationalSearchService;
2687        pub struct Factory;
2688        impl gax::client_builder::internal::ClientFactory for Factory {
2689            type Client = ConversationalSearchService;
2690            type Credentials = gaxi::options::Credentials;
2691            async fn build(
2692                self,
2693                config: gaxi::options::ClientConfig,
2694            ) -> gax::client_builder::Result<Self::Client> {
2695                Self::Client::new(config).await
2696            }
2697        }
2698    }
2699
2700    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2701    #[derive(Clone, Debug)]
2702    pub(crate) struct RequestBuilder<R: std::default::Default> {
2703        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2704        request: R,
2705        options: gax::options::RequestOptions,
2706    }
2707
2708    impl<R> RequestBuilder<R>
2709    where
2710        R: std::default::Default,
2711    {
2712        pub(crate) fn new(
2713            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2714        ) -> Self {
2715            Self {
2716                stub,
2717                request: R::default(),
2718                options: gax::options::RequestOptions::default(),
2719            }
2720        }
2721    }
2722
2723    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2724    ///
2725    /// # Example
2726    /// ```no_run
2727    /// # use google_cloud_discoveryengine_v1::builder;
2728    /// use builder::conversational_search_service::ConverseConversation;
2729    /// # tokio_test::block_on(async {
2730    ///
2731    /// let builder = prepare_request_builder();
2732    /// let response = builder.send().await?;
2733    /// # gax::Result::<()>::Ok(()) });
2734    ///
2735    /// fn prepare_request_builder() -> ConverseConversation {
2736    ///   # panic!();
2737    ///   // ... details omitted ...
2738    /// }
2739    /// ```
2740    #[derive(Clone, Debug)]
2741    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2742
2743    impl ConverseConversation {
2744        pub(crate) fn new(
2745            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2746        ) -> Self {
2747            Self(RequestBuilder::new(stub))
2748        }
2749
2750        /// Sets the full request, replacing any prior values.
2751        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2752            mut self,
2753            v: V,
2754        ) -> Self {
2755            self.0.request = v.into();
2756            self
2757        }
2758
2759        /// Sets all the options, replacing any prior values.
2760        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2761            self.0.options = v.into();
2762            self
2763        }
2764
2765        /// Sends the request.
2766        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2767            (*self.0.stub)
2768                .converse_conversation(self.0.request, self.0.options)
2769                .await
2770                .map(gax::response::Response::into_body)
2771        }
2772
2773        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2774        ///
2775        /// This is a **required** field for requests.
2776        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2777            self.0.request.name = v.into();
2778            self
2779        }
2780
2781        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2782        ///
2783        /// This is a **required** field for requests.
2784        pub fn set_query<T>(mut self, v: T) -> Self
2785        where
2786            T: std::convert::Into<crate::model::TextInput>,
2787        {
2788            self.0.request.query = std::option::Option::Some(v.into());
2789            self
2790        }
2791
2792        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2793        ///
2794        /// This is a **required** field for requests.
2795        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2796        where
2797            T: std::convert::Into<crate::model::TextInput>,
2798        {
2799            self.0.request.query = v.map(|x| x.into());
2800            self
2801        }
2802
2803        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2804        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2805            self.0.request.serving_config = v.into();
2806            self
2807        }
2808
2809        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2810        pub fn set_conversation<T>(mut self, v: T) -> Self
2811        where
2812            T: std::convert::Into<crate::model::Conversation>,
2813        {
2814            self.0.request.conversation = std::option::Option::Some(v.into());
2815            self
2816        }
2817
2818        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2819        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2820        where
2821            T: std::convert::Into<crate::model::Conversation>,
2822        {
2823            self.0.request.conversation = v.map(|x| x.into());
2824            self
2825        }
2826
2827        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2828        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2829            self.0.request.safe_search = v.into();
2830            self
2831        }
2832
2833        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2834        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2835        where
2836            T: std::iter::IntoIterator<Item = (K, V)>,
2837            K: std::convert::Into<std::string::String>,
2838            V: std::convert::Into<std::string::String>,
2839        {
2840            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2841            self
2842        }
2843
2844        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2845        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2846        where
2847            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2848        {
2849            self.0.request.summary_spec = std::option::Option::Some(v.into());
2850            self
2851        }
2852
2853        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2854        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2855        where
2856            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2857        {
2858            self.0.request.summary_spec = v.map(|x| x.into());
2859            self
2860        }
2861
2862        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2863        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2864            self.0.request.filter = v.into();
2865            self
2866        }
2867
2868        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2869        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2870        where
2871            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2872        {
2873            self.0.request.boost_spec = std::option::Option::Some(v.into());
2874            self
2875        }
2876
2877        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2878        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2879        where
2880            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2881        {
2882            self.0.request.boost_spec = v.map(|x| x.into());
2883            self
2884        }
2885    }
2886
2887    #[doc(hidden)]
2888    impl gax::options::internal::RequestBuilder for ConverseConversation {
2889        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2890            &mut self.0.options
2891        }
2892    }
2893
2894    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2895    ///
2896    /// # Example
2897    /// ```no_run
2898    /// # use google_cloud_discoveryengine_v1::builder;
2899    /// use builder::conversational_search_service::CreateConversation;
2900    /// # tokio_test::block_on(async {
2901    ///
2902    /// let builder = prepare_request_builder();
2903    /// let response = builder.send().await?;
2904    /// # gax::Result::<()>::Ok(()) });
2905    ///
2906    /// fn prepare_request_builder() -> CreateConversation {
2907    ///   # panic!();
2908    ///   // ... details omitted ...
2909    /// }
2910    /// ```
2911    #[derive(Clone, Debug)]
2912    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2913
2914    impl CreateConversation {
2915        pub(crate) fn new(
2916            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2917        ) -> Self {
2918            Self(RequestBuilder::new(stub))
2919        }
2920
2921        /// Sets the full request, replacing any prior values.
2922        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2923            mut self,
2924            v: V,
2925        ) -> Self {
2926            self.0.request = v.into();
2927            self
2928        }
2929
2930        /// Sets all the options, replacing any prior values.
2931        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2932            self.0.options = v.into();
2933            self
2934        }
2935
2936        /// Sends the request.
2937        pub async fn send(self) -> Result<crate::model::Conversation> {
2938            (*self.0.stub)
2939                .create_conversation(self.0.request, self.0.options)
2940                .await
2941                .map(gax::response::Response::into_body)
2942        }
2943
2944        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
2945        ///
2946        /// This is a **required** field for requests.
2947        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2948            self.0.request.parent = v.into();
2949            self
2950        }
2951
2952        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
2953        ///
2954        /// This is a **required** field for requests.
2955        pub fn set_conversation<T>(mut self, v: T) -> Self
2956        where
2957            T: std::convert::Into<crate::model::Conversation>,
2958        {
2959            self.0.request.conversation = std::option::Option::Some(v.into());
2960            self
2961        }
2962
2963        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
2964        ///
2965        /// This is a **required** field for requests.
2966        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2967        where
2968            T: std::convert::Into<crate::model::Conversation>,
2969        {
2970            self.0.request.conversation = v.map(|x| x.into());
2971            self
2972        }
2973    }
2974
2975    #[doc(hidden)]
2976    impl gax::options::internal::RequestBuilder for CreateConversation {
2977        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2978            &mut self.0.options
2979        }
2980    }
2981
2982    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
2983    ///
2984    /// # Example
2985    /// ```no_run
2986    /// # use google_cloud_discoveryengine_v1::builder;
2987    /// use builder::conversational_search_service::DeleteConversation;
2988    /// # tokio_test::block_on(async {
2989    ///
2990    /// let builder = prepare_request_builder();
2991    /// let response = builder.send().await?;
2992    /// # gax::Result::<()>::Ok(()) });
2993    ///
2994    /// fn prepare_request_builder() -> DeleteConversation {
2995    ///   # panic!();
2996    ///   // ... details omitted ...
2997    /// }
2998    /// ```
2999    #[derive(Clone, Debug)]
3000    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3001
3002    impl DeleteConversation {
3003        pub(crate) fn new(
3004            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3005        ) -> Self {
3006            Self(RequestBuilder::new(stub))
3007        }
3008
3009        /// Sets the full request, replacing any prior values.
3010        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3011            mut self,
3012            v: V,
3013        ) -> Self {
3014            self.0.request = v.into();
3015            self
3016        }
3017
3018        /// Sets all the options, replacing any prior values.
3019        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3020            self.0.options = v.into();
3021            self
3022        }
3023
3024        /// Sends the request.
3025        pub async fn send(self) -> Result<()> {
3026            (*self.0.stub)
3027                .delete_conversation(self.0.request, self.0.options)
3028                .await
3029                .map(gax::response::Response::into_body)
3030        }
3031
3032        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3033        ///
3034        /// This is a **required** field for requests.
3035        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3036            self.0.request.name = v.into();
3037            self
3038        }
3039    }
3040
3041    #[doc(hidden)]
3042    impl gax::options::internal::RequestBuilder for DeleteConversation {
3043        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3044            &mut self.0.options
3045        }
3046    }
3047
3048    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3049    ///
3050    /// # Example
3051    /// ```no_run
3052    /// # use google_cloud_discoveryengine_v1::builder;
3053    /// use builder::conversational_search_service::UpdateConversation;
3054    /// # tokio_test::block_on(async {
3055    ///
3056    /// let builder = prepare_request_builder();
3057    /// let response = builder.send().await?;
3058    /// # gax::Result::<()>::Ok(()) });
3059    ///
3060    /// fn prepare_request_builder() -> UpdateConversation {
3061    ///   # panic!();
3062    ///   // ... details omitted ...
3063    /// }
3064    /// ```
3065    #[derive(Clone, Debug)]
3066    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3067
3068    impl UpdateConversation {
3069        pub(crate) fn new(
3070            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3071        ) -> Self {
3072            Self(RequestBuilder::new(stub))
3073        }
3074
3075        /// Sets the full request, replacing any prior values.
3076        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3077            mut self,
3078            v: V,
3079        ) -> Self {
3080            self.0.request = v.into();
3081            self
3082        }
3083
3084        /// Sets all the options, replacing any prior values.
3085        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3086            self.0.options = v.into();
3087            self
3088        }
3089
3090        /// Sends the request.
3091        pub async fn send(self) -> Result<crate::model::Conversation> {
3092            (*self.0.stub)
3093                .update_conversation(self.0.request, self.0.options)
3094                .await
3095                .map(gax::response::Response::into_body)
3096        }
3097
3098        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3099        ///
3100        /// This is a **required** field for requests.
3101        pub fn set_conversation<T>(mut self, v: T) -> Self
3102        where
3103            T: std::convert::Into<crate::model::Conversation>,
3104        {
3105            self.0.request.conversation = std::option::Option::Some(v.into());
3106            self
3107        }
3108
3109        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3110        ///
3111        /// This is a **required** field for requests.
3112        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3113        where
3114            T: std::convert::Into<crate::model::Conversation>,
3115        {
3116            self.0.request.conversation = v.map(|x| x.into());
3117            self
3118        }
3119
3120        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3121        pub fn set_update_mask<T>(mut self, v: T) -> Self
3122        where
3123            T: std::convert::Into<wkt::FieldMask>,
3124        {
3125            self.0.request.update_mask = std::option::Option::Some(v.into());
3126            self
3127        }
3128
3129        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3130        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3131        where
3132            T: std::convert::Into<wkt::FieldMask>,
3133        {
3134            self.0.request.update_mask = v.map(|x| x.into());
3135            self
3136        }
3137    }
3138
3139    #[doc(hidden)]
3140    impl gax::options::internal::RequestBuilder for UpdateConversation {
3141        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3142            &mut self.0.options
3143        }
3144    }
3145
3146    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3147    ///
3148    /// # Example
3149    /// ```no_run
3150    /// # use google_cloud_discoveryengine_v1::builder;
3151    /// use builder::conversational_search_service::GetConversation;
3152    /// # tokio_test::block_on(async {
3153    ///
3154    /// let builder = prepare_request_builder();
3155    /// let response = builder.send().await?;
3156    /// # gax::Result::<()>::Ok(()) });
3157    ///
3158    /// fn prepare_request_builder() -> GetConversation {
3159    ///   # panic!();
3160    ///   // ... details omitted ...
3161    /// }
3162    /// ```
3163    #[derive(Clone, Debug)]
3164    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3165
3166    impl GetConversation {
3167        pub(crate) fn new(
3168            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3169        ) -> Self {
3170            Self(RequestBuilder::new(stub))
3171        }
3172
3173        /// Sets the full request, replacing any prior values.
3174        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3175            self.0.request = v.into();
3176            self
3177        }
3178
3179        /// Sets all the options, replacing any prior values.
3180        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3181            self.0.options = v.into();
3182            self
3183        }
3184
3185        /// Sends the request.
3186        pub async fn send(self) -> Result<crate::model::Conversation> {
3187            (*self.0.stub)
3188                .get_conversation(self.0.request, self.0.options)
3189                .await
3190                .map(gax::response::Response::into_body)
3191        }
3192
3193        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3194        ///
3195        /// This is a **required** field for requests.
3196        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3197            self.0.request.name = v.into();
3198            self
3199        }
3200    }
3201
3202    #[doc(hidden)]
3203    impl gax::options::internal::RequestBuilder for GetConversation {
3204        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3205            &mut self.0.options
3206        }
3207    }
3208
3209    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3210    ///
3211    /// # Example
3212    /// ```no_run
3213    /// # use google_cloud_discoveryengine_v1::builder;
3214    /// use builder::conversational_search_service::ListConversations;
3215    /// # tokio_test::block_on(async {
3216    /// use gax::paginator::ItemPaginator;
3217    ///
3218    /// let builder = prepare_request_builder();
3219    /// let mut items = builder.by_item();
3220    /// while let Some(result) = items.next().await {
3221    ///   let item = result?;
3222    /// }
3223    /// # gax::Result::<()>::Ok(()) });
3224    ///
3225    /// fn prepare_request_builder() -> ListConversations {
3226    ///   # panic!();
3227    ///   // ... details omitted ...
3228    /// }
3229    /// ```
3230    #[derive(Clone, Debug)]
3231    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3232
3233    impl ListConversations {
3234        pub(crate) fn new(
3235            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3236        ) -> Self {
3237            Self(RequestBuilder::new(stub))
3238        }
3239
3240        /// Sets the full request, replacing any prior values.
3241        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3242            mut self,
3243            v: V,
3244        ) -> Self {
3245            self.0.request = v.into();
3246            self
3247        }
3248
3249        /// Sets all the options, replacing any prior values.
3250        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3251            self.0.options = v.into();
3252            self
3253        }
3254
3255        /// Sends the request.
3256        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3257            (*self.0.stub)
3258                .list_conversations(self.0.request, self.0.options)
3259                .await
3260                .map(gax::response::Response::into_body)
3261        }
3262
3263        /// Streams each page in the collection.
3264        pub fn by_page(
3265            self,
3266        ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3267        {
3268            use std::clone::Clone;
3269            let token = self.0.request.page_token.clone();
3270            let execute = move |token: String| {
3271                let mut builder = self.clone();
3272                builder.0.request = builder.0.request.set_page_token(token);
3273                builder.send()
3274            };
3275            gax::paginator::internal::new_paginator(token, execute)
3276        }
3277
3278        /// Streams each item in the collection.
3279        pub fn by_item(
3280            self,
3281        ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3282        {
3283            use gax::paginator::Paginator;
3284            self.by_page().items()
3285        }
3286
3287        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3288        ///
3289        /// This is a **required** field for requests.
3290        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3291            self.0.request.parent = v.into();
3292            self
3293        }
3294
3295        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3296        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3297            self.0.request.page_size = v.into();
3298            self
3299        }
3300
3301        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3302        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3303            self.0.request.page_token = v.into();
3304            self
3305        }
3306
3307        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3308        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3309            self.0.request.filter = v.into();
3310            self
3311        }
3312
3313        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3314        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3315            self.0.request.order_by = v.into();
3316            self
3317        }
3318    }
3319
3320    #[doc(hidden)]
3321    impl gax::options::internal::RequestBuilder for ListConversations {
3322        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3323            &mut self.0.options
3324        }
3325    }
3326
3327    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3328    ///
3329    /// # Example
3330    /// ```no_run
3331    /// # use google_cloud_discoveryengine_v1::builder;
3332    /// use builder::conversational_search_service::AnswerQuery;
3333    /// # tokio_test::block_on(async {
3334    ///
3335    /// let builder = prepare_request_builder();
3336    /// let response = builder.send().await?;
3337    /// # gax::Result::<()>::Ok(()) });
3338    ///
3339    /// fn prepare_request_builder() -> AnswerQuery {
3340    ///   # panic!();
3341    ///   // ... details omitted ...
3342    /// }
3343    /// ```
3344    #[derive(Clone, Debug)]
3345    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3346
3347    impl AnswerQuery {
3348        pub(crate) fn new(
3349            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3350        ) -> Self {
3351            Self(RequestBuilder::new(stub))
3352        }
3353
3354        /// Sets the full request, replacing any prior values.
3355        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3356            self.0.request = v.into();
3357            self
3358        }
3359
3360        /// Sets all the options, replacing any prior values.
3361        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3362            self.0.options = v.into();
3363            self
3364        }
3365
3366        /// Sends the request.
3367        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3368            (*self.0.stub)
3369                .answer_query(self.0.request, self.0.options)
3370                .await
3371                .map(gax::response::Response::into_body)
3372        }
3373
3374        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3375        ///
3376        /// This is a **required** field for requests.
3377        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3378            self.0.request.serving_config = v.into();
3379            self
3380        }
3381
3382        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3383        ///
3384        /// This is a **required** field for requests.
3385        pub fn set_query<T>(mut self, v: T) -> Self
3386        where
3387            T: std::convert::Into<crate::model::Query>,
3388        {
3389            self.0.request.query = std::option::Option::Some(v.into());
3390            self
3391        }
3392
3393        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3394        ///
3395        /// This is a **required** field for requests.
3396        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3397        where
3398            T: std::convert::Into<crate::model::Query>,
3399        {
3400            self.0.request.query = v.map(|x| x.into());
3401            self
3402        }
3403
3404        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3405        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3406            self.0.request.session = v.into();
3407            self
3408        }
3409
3410        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3411        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3412        where
3413            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3414        {
3415            self.0.request.safety_spec = std::option::Option::Some(v.into());
3416            self
3417        }
3418
3419        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3420        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3421        where
3422            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3423        {
3424            self.0.request.safety_spec = v.map(|x| x.into());
3425            self
3426        }
3427
3428        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3429        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3430        where
3431            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3432        {
3433            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3434            self
3435        }
3436
3437        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3438        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3439        where
3440            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3441        {
3442            self.0.request.related_questions_spec = v.map(|x| x.into());
3443            self
3444        }
3445
3446        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3447        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3448        where
3449            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3450        {
3451            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3452            self
3453        }
3454
3455        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3456        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3457        where
3458            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3459        {
3460            self.0.request.grounding_spec = v.map(|x| x.into());
3461            self
3462        }
3463
3464        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3465        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3466        where
3467            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3468        {
3469            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3470            self
3471        }
3472
3473        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3474        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3475        where
3476            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3477        {
3478            self.0.request.answer_generation_spec = v.map(|x| x.into());
3479            self
3480        }
3481
3482        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3483        pub fn set_search_spec<T>(mut self, v: T) -> Self
3484        where
3485            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3486        {
3487            self.0.request.search_spec = std::option::Option::Some(v.into());
3488            self
3489        }
3490
3491        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3492        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3493        where
3494            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3495        {
3496            self.0.request.search_spec = v.map(|x| x.into());
3497            self
3498        }
3499
3500        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3501        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3502        where
3503            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3504        {
3505            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3506            self
3507        }
3508
3509        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3510        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3511        where
3512            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3513        {
3514            self.0.request.query_understanding_spec = v.map(|x| x.into());
3515            self
3516        }
3517
3518        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3519        #[deprecated]
3520        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3521            self.0.request.asynchronous_mode = v.into();
3522            self
3523        }
3524
3525        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3526        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3527            self.0.request.user_pseudo_id = v.into();
3528            self
3529        }
3530
3531        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3532        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3533        where
3534            T: std::iter::IntoIterator<Item = (K, V)>,
3535            K: std::convert::Into<std::string::String>,
3536            V: std::convert::Into<std::string::String>,
3537        {
3538            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3539            self
3540        }
3541
3542        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3543        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3544        where
3545            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3546        {
3547            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3548            self
3549        }
3550
3551        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3552        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3553        where
3554            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3555        {
3556            self.0.request.end_user_spec = v.map(|x| x.into());
3557            self
3558        }
3559    }
3560
3561    #[doc(hidden)]
3562    impl gax::options::internal::RequestBuilder for AnswerQuery {
3563        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3564            &mut self.0.options
3565        }
3566    }
3567
3568    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3569    ///
3570    /// # Example
3571    /// ```no_run
3572    /// # use google_cloud_discoveryengine_v1::builder;
3573    /// use builder::conversational_search_service::GetAnswer;
3574    /// # tokio_test::block_on(async {
3575    ///
3576    /// let builder = prepare_request_builder();
3577    /// let response = builder.send().await?;
3578    /// # gax::Result::<()>::Ok(()) });
3579    ///
3580    /// fn prepare_request_builder() -> GetAnswer {
3581    ///   # panic!();
3582    ///   // ... details omitted ...
3583    /// }
3584    /// ```
3585    #[derive(Clone, Debug)]
3586    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3587
3588    impl GetAnswer {
3589        pub(crate) fn new(
3590            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3591        ) -> Self {
3592            Self(RequestBuilder::new(stub))
3593        }
3594
3595        /// Sets the full request, replacing any prior values.
3596        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3597            self.0.request = v.into();
3598            self
3599        }
3600
3601        /// Sets all the options, replacing any prior values.
3602        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3603            self.0.options = v.into();
3604            self
3605        }
3606
3607        /// Sends the request.
3608        pub async fn send(self) -> Result<crate::model::Answer> {
3609            (*self.0.stub)
3610                .get_answer(self.0.request, self.0.options)
3611                .await
3612                .map(gax::response::Response::into_body)
3613        }
3614
3615        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3616        ///
3617        /// This is a **required** field for requests.
3618        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3619            self.0.request.name = v.into();
3620            self
3621        }
3622    }
3623
3624    #[doc(hidden)]
3625    impl gax::options::internal::RequestBuilder for GetAnswer {
3626        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3627            &mut self.0.options
3628        }
3629    }
3630
3631    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3632    ///
3633    /// # Example
3634    /// ```no_run
3635    /// # use google_cloud_discoveryengine_v1::builder;
3636    /// use builder::conversational_search_service::CreateSession;
3637    /// # tokio_test::block_on(async {
3638    ///
3639    /// let builder = prepare_request_builder();
3640    /// let response = builder.send().await?;
3641    /// # gax::Result::<()>::Ok(()) });
3642    ///
3643    /// fn prepare_request_builder() -> CreateSession {
3644    ///   # panic!();
3645    ///   // ... details omitted ...
3646    /// }
3647    /// ```
3648    #[derive(Clone, Debug)]
3649    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3650
3651    impl CreateSession {
3652        pub(crate) fn new(
3653            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3654        ) -> Self {
3655            Self(RequestBuilder::new(stub))
3656        }
3657
3658        /// Sets the full request, replacing any prior values.
3659        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3660            self.0.request = v.into();
3661            self
3662        }
3663
3664        /// Sets all the options, replacing any prior values.
3665        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3666            self.0.options = v.into();
3667            self
3668        }
3669
3670        /// Sends the request.
3671        pub async fn send(self) -> Result<crate::model::Session> {
3672            (*self.0.stub)
3673                .create_session(self.0.request, self.0.options)
3674                .await
3675                .map(gax::response::Response::into_body)
3676        }
3677
3678        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3679        ///
3680        /// This is a **required** field for requests.
3681        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3682            self.0.request.parent = v.into();
3683            self
3684        }
3685
3686        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3687        ///
3688        /// This is a **required** field for requests.
3689        pub fn set_session<T>(mut self, v: T) -> Self
3690        where
3691            T: std::convert::Into<crate::model::Session>,
3692        {
3693            self.0.request.session = std::option::Option::Some(v.into());
3694            self
3695        }
3696
3697        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3698        ///
3699        /// This is a **required** field for requests.
3700        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3701        where
3702            T: std::convert::Into<crate::model::Session>,
3703        {
3704            self.0.request.session = v.map(|x| x.into());
3705            self
3706        }
3707    }
3708
3709    #[doc(hidden)]
3710    impl gax::options::internal::RequestBuilder for CreateSession {
3711        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3712            &mut self.0.options
3713        }
3714    }
3715
3716    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3717    ///
3718    /// # Example
3719    /// ```no_run
3720    /// # use google_cloud_discoveryengine_v1::builder;
3721    /// use builder::conversational_search_service::DeleteSession;
3722    /// # tokio_test::block_on(async {
3723    ///
3724    /// let builder = prepare_request_builder();
3725    /// let response = builder.send().await?;
3726    /// # gax::Result::<()>::Ok(()) });
3727    ///
3728    /// fn prepare_request_builder() -> DeleteSession {
3729    ///   # panic!();
3730    ///   // ... details omitted ...
3731    /// }
3732    /// ```
3733    #[derive(Clone, Debug)]
3734    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3735
3736    impl DeleteSession {
3737        pub(crate) fn new(
3738            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3739        ) -> Self {
3740            Self(RequestBuilder::new(stub))
3741        }
3742
3743        /// Sets the full request, replacing any prior values.
3744        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3745            self.0.request = v.into();
3746            self
3747        }
3748
3749        /// Sets all the options, replacing any prior values.
3750        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3751            self.0.options = v.into();
3752            self
3753        }
3754
3755        /// Sends the request.
3756        pub async fn send(self) -> Result<()> {
3757            (*self.0.stub)
3758                .delete_session(self.0.request, self.0.options)
3759                .await
3760                .map(gax::response::Response::into_body)
3761        }
3762
3763        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3764        ///
3765        /// This is a **required** field for requests.
3766        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3767            self.0.request.name = v.into();
3768            self
3769        }
3770    }
3771
3772    #[doc(hidden)]
3773    impl gax::options::internal::RequestBuilder for DeleteSession {
3774        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3775            &mut self.0.options
3776        }
3777    }
3778
3779    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3780    ///
3781    /// # Example
3782    /// ```no_run
3783    /// # use google_cloud_discoveryengine_v1::builder;
3784    /// use builder::conversational_search_service::UpdateSession;
3785    /// # tokio_test::block_on(async {
3786    ///
3787    /// let builder = prepare_request_builder();
3788    /// let response = builder.send().await?;
3789    /// # gax::Result::<()>::Ok(()) });
3790    ///
3791    /// fn prepare_request_builder() -> UpdateSession {
3792    ///   # panic!();
3793    ///   // ... details omitted ...
3794    /// }
3795    /// ```
3796    #[derive(Clone, Debug)]
3797    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3798
3799    impl UpdateSession {
3800        pub(crate) fn new(
3801            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3802        ) -> Self {
3803            Self(RequestBuilder::new(stub))
3804        }
3805
3806        /// Sets the full request, replacing any prior values.
3807        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3808            self.0.request = v.into();
3809            self
3810        }
3811
3812        /// Sets all the options, replacing any prior values.
3813        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3814            self.0.options = v.into();
3815            self
3816        }
3817
3818        /// Sends the request.
3819        pub async fn send(self) -> Result<crate::model::Session> {
3820            (*self.0.stub)
3821                .update_session(self.0.request, self.0.options)
3822                .await
3823                .map(gax::response::Response::into_body)
3824        }
3825
3826        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3827        ///
3828        /// This is a **required** field for requests.
3829        pub fn set_session<T>(mut self, v: T) -> Self
3830        where
3831            T: std::convert::Into<crate::model::Session>,
3832        {
3833            self.0.request.session = std::option::Option::Some(v.into());
3834            self
3835        }
3836
3837        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3838        ///
3839        /// This is a **required** field for requests.
3840        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3841        where
3842            T: std::convert::Into<crate::model::Session>,
3843        {
3844            self.0.request.session = v.map(|x| x.into());
3845            self
3846        }
3847
3848        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3849        pub fn set_update_mask<T>(mut self, v: T) -> Self
3850        where
3851            T: std::convert::Into<wkt::FieldMask>,
3852        {
3853            self.0.request.update_mask = std::option::Option::Some(v.into());
3854            self
3855        }
3856
3857        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3858        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3859        where
3860            T: std::convert::Into<wkt::FieldMask>,
3861        {
3862            self.0.request.update_mask = v.map(|x| x.into());
3863            self
3864        }
3865    }
3866
3867    #[doc(hidden)]
3868    impl gax::options::internal::RequestBuilder for UpdateSession {
3869        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3870            &mut self.0.options
3871        }
3872    }
3873
3874    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3875    ///
3876    /// # Example
3877    /// ```no_run
3878    /// # use google_cloud_discoveryengine_v1::builder;
3879    /// use builder::conversational_search_service::GetSession;
3880    /// # tokio_test::block_on(async {
3881    ///
3882    /// let builder = prepare_request_builder();
3883    /// let response = builder.send().await?;
3884    /// # gax::Result::<()>::Ok(()) });
3885    ///
3886    /// fn prepare_request_builder() -> GetSession {
3887    ///   # panic!();
3888    ///   // ... details omitted ...
3889    /// }
3890    /// ```
3891    #[derive(Clone, Debug)]
3892    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3893
3894    impl GetSession {
3895        pub(crate) fn new(
3896            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3897        ) -> Self {
3898            Self(RequestBuilder::new(stub))
3899        }
3900
3901        /// Sets the full request, replacing any prior values.
3902        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3903            self.0.request = v.into();
3904            self
3905        }
3906
3907        /// Sets all the options, replacing any prior values.
3908        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3909            self.0.options = v.into();
3910            self
3911        }
3912
3913        /// Sends the request.
3914        pub async fn send(self) -> Result<crate::model::Session> {
3915            (*self.0.stub)
3916                .get_session(self.0.request, self.0.options)
3917                .await
3918                .map(gax::response::Response::into_body)
3919        }
3920
3921        /// Sets the value of [name][crate::model::GetSessionRequest::name].
3922        ///
3923        /// This is a **required** field for requests.
3924        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3925            self.0.request.name = v.into();
3926            self
3927        }
3928
3929        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
3930        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3931            self.0.request.include_answer_details = v.into();
3932            self
3933        }
3934    }
3935
3936    #[doc(hidden)]
3937    impl gax::options::internal::RequestBuilder for GetSession {
3938        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3939            &mut self.0.options
3940        }
3941    }
3942
3943    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
3944    ///
3945    /// # Example
3946    /// ```no_run
3947    /// # use google_cloud_discoveryengine_v1::builder;
3948    /// use builder::conversational_search_service::ListSessions;
3949    /// # tokio_test::block_on(async {
3950    /// use gax::paginator::ItemPaginator;
3951    ///
3952    /// let builder = prepare_request_builder();
3953    /// let mut items = builder.by_item();
3954    /// while let Some(result) = items.next().await {
3955    ///   let item = result?;
3956    /// }
3957    /// # gax::Result::<()>::Ok(()) });
3958    ///
3959    /// fn prepare_request_builder() -> ListSessions {
3960    ///   # panic!();
3961    ///   // ... details omitted ...
3962    /// }
3963    /// ```
3964    #[derive(Clone, Debug)]
3965    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3966
3967    impl ListSessions {
3968        pub(crate) fn new(
3969            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3970        ) -> Self {
3971            Self(RequestBuilder::new(stub))
3972        }
3973
3974        /// Sets the full request, replacing any prior values.
3975        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
3976            self.0.request = v.into();
3977            self
3978        }
3979
3980        /// Sets all the options, replacing any prior values.
3981        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3982            self.0.options = v.into();
3983            self
3984        }
3985
3986        /// Sends the request.
3987        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
3988            (*self.0.stub)
3989                .list_sessions(self.0.request, self.0.options)
3990                .await
3991                .map(gax::response::Response::into_body)
3992        }
3993
3994        /// Streams each page in the collection.
3995        pub fn by_page(
3996            self,
3997        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
3998        {
3999            use std::clone::Clone;
4000            let token = self.0.request.page_token.clone();
4001            let execute = move |token: String| {
4002                let mut builder = self.clone();
4003                builder.0.request = builder.0.request.set_page_token(token);
4004                builder.send()
4005            };
4006            gax::paginator::internal::new_paginator(token, execute)
4007        }
4008
4009        /// Streams each item in the collection.
4010        pub fn by_item(
4011            self,
4012        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
4013        {
4014            use gax::paginator::Paginator;
4015            self.by_page().items()
4016        }
4017
4018        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4019        ///
4020        /// This is a **required** field for requests.
4021        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4022            self.0.request.parent = v.into();
4023            self
4024        }
4025
4026        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4027        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4028            self.0.request.page_size = v.into();
4029            self
4030        }
4031
4032        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4033        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4034            self.0.request.page_token = v.into();
4035            self
4036        }
4037
4038        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4039        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4040            self.0.request.filter = v.into();
4041            self
4042        }
4043
4044        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4045        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4046            self.0.request.order_by = v.into();
4047            self
4048        }
4049    }
4050
4051    #[doc(hidden)]
4052    impl gax::options::internal::RequestBuilder for ListSessions {
4053        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4054            &mut self.0.options
4055        }
4056    }
4057
4058    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4059    ///
4060    /// # Example
4061    /// ```no_run
4062    /// # use google_cloud_discoveryengine_v1::builder;
4063    /// use builder::conversational_search_service::ListOperations;
4064    /// # tokio_test::block_on(async {
4065    /// use gax::paginator::ItemPaginator;
4066    ///
4067    /// let builder = prepare_request_builder();
4068    /// let mut items = builder.by_item();
4069    /// while let Some(result) = items.next().await {
4070    ///   let item = result?;
4071    /// }
4072    /// # gax::Result::<()>::Ok(()) });
4073    ///
4074    /// fn prepare_request_builder() -> ListOperations {
4075    ///   # panic!();
4076    ///   // ... details omitted ...
4077    /// }
4078    /// ```
4079    #[derive(Clone, Debug)]
4080    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4081
4082    impl ListOperations {
4083        pub(crate) fn new(
4084            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4085        ) -> Self {
4086            Self(RequestBuilder::new(stub))
4087        }
4088
4089        /// Sets the full request, replacing any prior values.
4090        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4091            mut self,
4092            v: V,
4093        ) -> Self {
4094            self.0.request = v.into();
4095            self
4096        }
4097
4098        /// Sets all the options, replacing any prior values.
4099        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4100            self.0.options = v.into();
4101            self
4102        }
4103
4104        /// Sends the request.
4105        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4106            (*self.0.stub)
4107                .list_operations(self.0.request, self.0.options)
4108                .await
4109                .map(gax::response::Response::into_body)
4110        }
4111
4112        /// Streams each page in the collection.
4113        pub fn by_page(
4114            self,
4115        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4116        {
4117            use std::clone::Clone;
4118            let token = self.0.request.page_token.clone();
4119            let execute = move |token: String| {
4120                let mut builder = self.clone();
4121                builder.0.request = builder.0.request.set_page_token(token);
4122                builder.send()
4123            };
4124            gax::paginator::internal::new_paginator(token, execute)
4125        }
4126
4127        /// Streams each item in the collection.
4128        pub fn by_item(
4129            self,
4130        ) -> impl gax::paginator::ItemPaginator<
4131            longrunning::model::ListOperationsResponse,
4132            gax::error::Error,
4133        > {
4134            use gax::paginator::Paginator;
4135            self.by_page().items()
4136        }
4137
4138        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4139        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4140            self.0.request.name = v.into();
4141            self
4142        }
4143
4144        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4145        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4146            self.0.request.filter = v.into();
4147            self
4148        }
4149
4150        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4151        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4152            self.0.request.page_size = v.into();
4153            self
4154        }
4155
4156        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4157        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4158            self.0.request.page_token = v.into();
4159            self
4160        }
4161    }
4162
4163    #[doc(hidden)]
4164    impl gax::options::internal::RequestBuilder for ListOperations {
4165        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4166            &mut self.0.options
4167        }
4168    }
4169
4170    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4171    ///
4172    /// # Example
4173    /// ```no_run
4174    /// # use google_cloud_discoveryengine_v1::builder;
4175    /// use builder::conversational_search_service::GetOperation;
4176    /// # tokio_test::block_on(async {
4177    ///
4178    /// let builder = prepare_request_builder();
4179    /// let response = builder.send().await?;
4180    /// # gax::Result::<()>::Ok(()) });
4181    ///
4182    /// fn prepare_request_builder() -> GetOperation {
4183    ///   # panic!();
4184    ///   // ... details omitted ...
4185    /// }
4186    /// ```
4187    #[derive(Clone, Debug)]
4188    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4189
4190    impl GetOperation {
4191        pub(crate) fn new(
4192            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4193        ) -> Self {
4194            Self(RequestBuilder::new(stub))
4195        }
4196
4197        /// Sets the full request, replacing any prior values.
4198        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4199            mut self,
4200            v: V,
4201        ) -> Self {
4202            self.0.request = v.into();
4203            self
4204        }
4205
4206        /// Sets all the options, replacing any prior values.
4207        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4208            self.0.options = v.into();
4209            self
4210        }
4211
4212        /// Sends the request.
4213        pub async fn send(self) -> Result<longrunning::model::Operation> {
4214            (*self.0.stub)
4215                .get_operation(self.0.request, self.0.options)
4216                .await
4217                .map(gax::response::Response::into_body)
4218        }
4219
4220        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4221        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4222            self.0.request.name = v.into();
4223            self
4224        }
4225    }
4226
4227    #[doc(hidden)]
4228    impl gax::options::internal::RequestBuilder for GetOperation {
4229        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4230            &mut self.0.options
4231        }
4232    }
4233
4234    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4235    ///
4236    /// # Example
4237    /// ```no_run
4238    /// # use google_cloud_discoveryengine_v1::builder;
4239    /// use builder::conversational_search_service::CancelOperation;
4240    /// # tokio_test::block_on(async {
4241    ///
4242    /// let builder = prepare_request_builder();
4243    /// let response = builder.send().await?;
4244    /// # gax::Result::<()>::Ok(()) });
4245    ///
4246    /// fn prepare_request_builder() -> CancelOperation {
4247    ///   # panic!();
4248    ///   // ... details omitted ...
4249    /// }
4250    /// ```
4251    #[derive(Clone, Debug)]
4252    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4253
4254    impl CancelOperation {
4255        pub(crate) fn new(
4256            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4257        ) -> Self {
4258            Self(RequestBuilder::new(stub))
4259        }
4260
4261        /// Sets the full request, replacing any prior values.
4262        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4263            mut self,
4264            v: V,
4265        ) -> Self {
4266            self.0.request = v.into();
4267            self
4268        }
4269
4270        /// Sets all the options, replacing any prior values.
4271        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4272            self.0.options = v.into();
4273            self
4274        }
4275
4276        /// Sends the request.
4277        pub async fn send(self) -> Result<()> {
4278            (*self.0.stub)
4279                .cancel_operation(self.0.request, self.0.options)
4280                .await
4281                .map(gax::response::Response::into_body)
4282        }
4283
4284        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4285        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4286            self.0.request.name = v.into();
4287            self
4288        }
4289    }
4290
4291    #[doc(hidden)]
4292    impl gax::options::internal::RequestBuilder for CancelOperation {
4293        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4294            &mut self.0.options
4295        }
4296    }
4297}
4298
4299#[cfg(feature = "data-store-service")]
4300#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4301pub mod data_store_service {
4302    use crate::Result;
4303
4304    /// A builder for [DataStoreService][crate::client::DataStoreService].
4305    ///
4306    /// ```
4307    /// # tokio_test::block_on(async {
4308    /// # use google_cloud_discoveryengine_v1::*;
4309    /// # use builder::data_store_service::ClientBuilder;
4310    /// # use client::DataStoreService;
4311    /// let builder : ClientBuilder = DataStoreService::builder();
4312    /// let client = builder
4313    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4314    ///     .build().await?;
4315    /// # gax::client_builder::Result::<()>::Ok(()) });
4316    /// ```
4317    pub type ClientBuilder =
4318        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4319
4320    pub(crate) mod client {
4321        use super::super::super::client::DataStoreService;
4322        pub struct Factory;
4323        impl gax::client_builder::internal::ClientFactory for Factory {
4324            type Client = DataStoreService;
4325            type Credentials = gaxi::options::Credentials;
4326            async fn build(
4327                self,
4328                config: gaxi::options::ClientConfig,
4329            ) -> gax::client_builder::Result<Self::Client> {
4330                Self::Client::new(config).await
4331            }
4332        }
4333    }
4334
4335    /// Common implementation for [crate::client::DataStoreService] request builders.
4336    #[derive(Clone, Debug)]
4337    pub(crate) struct RequestBuilder<R: std::default::Default> {
4338        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4339        request: R,
4340        options: gax::options::RequestOptions,
4341    }
4342
4343    impl<R> RequestBuilder<R>
4344    where
4345        R: std::default::Default,
4346    {
4347        pub(crate) fn new(
4348            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4349        ) -> Self {
4350            Self {
4351                stub,
4352                request: R::default(),
4353                options: gax::options::RequestOptions::default(),
4354            }
4355        }
4356    }
4357
4358    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4359    ///
4360    /// # Example
4361    /// ```no_run
4362    /// # use google_cloud_discoveryengine_v1::builder;
4363    /// use builder::data_store_service::CreateDataStore;
4364    /// # tokio_test::block_on(async {
4365    /// use lro::Poller;
4366    ///
4367    /// let builder = prepare_request_builder();
4368    /// let response = builder.poller().until_done().await?;
4369    /// # gax::Result::<()>::Ok(()) });
4370    ///
4371    /// fn prepare_request_builder() -> CreateDataStore {
4372    ///   # panic!();
4373    ///   // ... details omitted ...
4374    /// }
4375    /// ```
4376    #[derive(Clone, Debug)]
4377    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4378
4379    impl CreateDataStore {
4380        pub(crate) fn new(
4381            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4382        ) -> Self {
4383            Self(RequestBuilder::new(stub))
4384        }
4385
4386        /// Sets the full request, replacing any prior values.
4387        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4388            self.0.request = v.into();
4389            self
4390        }
4391
4392        /// Sets all the options, replacing any prior values.
4393        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4394            self.0.options = v.into();
4395            self
4396        }
4397
4398        /// Sends the request.
4399        ///
4400        /// # Long running operations
4401        ///
4402        /// This starts, but does not poll, a longrunning operation. More information
4403        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4404        pub async fn send(self) -> Result<longrunning::model::Operation> {
4405            (*self.0.stub)
4406                .create_data_store(self.0.request, self.0.options)
4407                .await
4408                .map(gax::response::Response::into_body)
4409        }
4410
4411        /// Creates a [Poller][lro::Poller] to work with `create_data_store`.
4412        pub fn poller(
4413            self,
4414        ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4415        {
4416            type Operation = lro::internal::Operation<
4417                crate::model::DataStore,
4418                crate::model::CreateDataStoreMetadata,
4419            >;
4420            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4421            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4422
4423            let stub = self.0.stub.clone();
4424            let mut options = self.0.options.clone();
4425            options.set_retry_policy(gax::retry_policy::NeverRetry);
4426            let query = move |name| {
4427                let stub = stub.clone();
4428                let options = options.clone();
4429                async {
4430                    let op = GetOperation::new(stub)
4431                        .set_name(name)
4432                        .with_options(options)
4433                        .send()
4434                        .await?;
4435                    Ok(Operation::new(op))
4436                }
4437            };
4438
4439            let start = move || async {
4440                let op = self.send().await?;
4441                Ok(Operation::new(op))
4442            };
4443
4444            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4445        }
4446
4447        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4448        ///
4449        /// This is a **required** field for requests.
4450        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4451            self.0.request.parent = v.into();
4452            self
4453        }
4454
4455        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4456        ///
4457        /// This is a **required** field for requests.
4458        pub fn set_data_store<T>(mut self, v: T) -> Self
4459        where
4460            T: std::convert::Into<crate::model::DataStore>,
4461        {
4462            self.0.request.data_store = std::option::Option::Some(v.into());
4463            self
4464        }
4465
4466        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4467        ///
4468        /// This is a **required** field for requests.
4469        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4470        where
4471            T: std::convert::Into<crate::model::DataStore>,
4472        {
4473            self.0.request.data_store = v.map(|x| x.into());
4474            self
4475        }
4476
4477        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4478        ///
4479        /// This is a **required** field for requests.
4480        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4481            self.0.request.data_store_id = v.into();
4482            self
4483        }
4484
4485        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4486        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4487            self.0.request.create_advanced_site_search = v.into();
4488            self
4489        }
4490
4491        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4492        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4493            self.0.request.skip_default_schema_creation = v.into();
4494            self
4495        }
4496
4497        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4498        ///
4499        /// Note that all the setters affecting `cmek_options` are
4500        /// mutually exclusive.
4501        pub fn set_cmek_options<
4502            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4503        >(
4504            mut self,
4505            v: T,
4506        ) -> Self {
4507            self.0.request.cmek_options = v.into();
4508            self
4509        }
4510
4511        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4512        /// to hold a `CmekConfigName`.
4513        ///
4514        /// Note that all the setters affecting `cmek_options` are
4515        /// mutually exclusive.
4516        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4517            mut self,
4518            v: T,
4519        ) -> Self {
4520            self.0.request = self.0.request.set_cmek_config_name(v);
4521            self
4522        }
4523
4524        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4525        /// to hold a `DisableCmek`.
4526        ///
4527        /// Note that all the setters affecting `cmek_options` are
4528        /// mutually exclusive.
4529        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4530            self.0.request = self.0.request.set_disable_cmek(v);
4531            self
4532        }
4533    }
4534
4535    #[doc(hidden)]
4536    impl gax::options::internal::RequestBuilder for CreateDataStore {
4537        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4538            &mut self.0.options
4539        }
4540    }
4541
4542    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4543    ///
4544    /// # Example
4545    /// ```no_run
4546    /// # use google_cloud_discoveryengine_v1::builder;
4547    /// use builder::data_store_service::GetDataStore;
4548    /// # tokio_test::block_on(async {
4549    ///
4550    /// let builder = prepare_request_builder();
4551    /// let response = builder.send().await?;
4552    /// # gax::Result::<()>::Ok(()) });
4553    ///
4554    /// fn prepare_request_builder() -> GetDataStore {
4555    ///   # panic!();
4556    ///   // ... details omitted ...
4557    /// }
4558    /// ```
4559    #[derive(Clone, Debug)]
4560    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4561
4562    impl GetDataStore {
4563        pub(crate) fn new(
4564            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4565        ) -> Self {
4566            Self(RequestBuilder::new(stub))
4567        }
4568
4569        /// Sets the full request, replacing any prior values.
4570        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4571            self.0.request = v.into();
4572            self
4573        }
4574
4575        /// Sets all the options, replacing any prior values.
4576        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4577            self.0.options = v.into();
4578            self
4579        }
4580
4581        /// Sends the request.
4582        pub async fn send(self) -> Result<crate::model::DataStore> {
4583            (*self.0.stub)
4584                .get_data_store(self.0.request, self.0.options)
4585                .await
4586                .map(gax::response::Response::into_body)
4587        }
4588
4589        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4590        ///
4591        /// This is a **required** field for requests.
4592        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4593            self.0.request.name = v.into();
4594            self
4595        }
4596    }
4597
4598    #[doc(hidden)]
4599    impl gax::options::internal::RequestBuilder for GetDataStore {
4600        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4601            &mut self.0.options
4602        }
4603    }
4604
4605    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4606    ///
4607    /// # Example
4608    /// ```no_run
4609    /// # use google_cloud_discoveryengine_v1::builder;
4610    /// use builder::data_store_service::ListDataStores;
4611    /// # tokio_test::block_on(async {
4612    /// use gax::paginator::ItemPaginator;
4613    ///
4614    /// let builder = prepare_request_builder();
4615    /// let mut items = builder.by_item();
4616    /// while let Some(result) = items.next().await {
4617    ///   let item = result?;
4618    /// }
4619    /// # gax::Result::<()>::Ok(()) });
4620    ///
4621    /// fn prepare_request_builder() -> ListDataStores {
4622    ///   # panic!();
4623    ///   // ... details omitted ...
4624    /// }
4625    /// ```
4626    #[derive(Clone, Debug)]
4627    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4628
4629    impl ListDataStores {
4630        pub(crate) fn new(
4631            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4632        ) -> Self {
4633            Self(RequestBuilder::new(stub))
4634        }
4635
4636        /// Sets the full request, replacing any prior values.
4637        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4638            self.0.request = v.into();
4639            self
4640        }
4641
4642        /// Sets all the options, replacing any prior values.
4643        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4644            self.0.options = v.into();
4645            self
4646        }
4647
4648        /// Sends the request.
4649        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4650            (*self.0.stub)
4651                .list_data_stores(self.0.request, self.0.options)
4652                .await
4653                .map(gax::response::Response::into_body)
4654        }
4655
4656        /// Streams each page in the collection.
4657        pub fn by_page(
4658            self,
4659        ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4660        {
4661            use std::clone::Clone;
4662            let token = self.0.request.page_token.clone();
4663            let execute = move |token: String| {
4664                let mut builder = self.clone();
4665                builder.0.request = builder.0.request.set_page_token(token);
4666                builder.send()
4667            };
4668            gax::paginator::internal::new_paginator(token, execute)
4669        }
4670
4671        /// Streams each item in the collection.
4672        pub fn by_item(
4673            self,
4674        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4675        {
4676            use gax::paginator::Paginator;
4677            self.by_page().items()
4678        }
4679
4680        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4681        ///
4682        /// This is a **required** field for requests.
4683        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4684            self.0.request.parent = v.into();
4685            self
4686        }
4687
4688        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4689        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4690            self.0.request.page_size = v.into();
4691            self
4692        }
4693
4694        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4695        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4696            self.0.request.page_token = v.into();
4697            self
4698        }
4699
4700        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4701        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4702            self.0.request.filter = v.into();
4703            self
4704        }
4705    }
4706
4707    #[doc(hidden)]
4708    impl gax::options::internal::RequestBuilder for ListDataStores {
4709        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4710            &mut self.0.options
4711        }
4712    }
4713
4714    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4715    ///
4716    /// # Example
4717    /// ```no_run
4718    /// # use google_cloud_discoveryengine_v1::builder;
4719    /// use builder::data_store_service::DeleteDataStore;
4720    /// # tokio_test::block_on(async {
4721    /// use lro::Poller;
4722    ///
4723    /// let builder = prepare_request_builder();
4724    /// let response = builder.poller().until_done().await?;
4725    /// # gax::Result::<()>::Ok(()) });
4726    ///
4727    /// fn prepare_request_builder() -> DeleteDataStore {
4728    ///   # panic!();
4729    ///   // ... details omitted ...
4730    /// }
4731    /// ```
4732    #[derive(Clone, Debug)]
4733    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4734
4735    impl DeleteDataStore {
4736        pub(crate) fn new(
4737            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4738        ) -> Self {
4739            Self(RequestBuilder::new(stub))
4740        }
4741
4742        /// Sets the full request, replacing any prior values.
4743        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4744            self.0.request = v.into();
4745            self
4746        }
4747
4748        /// Sets all the options, replacing any prior values.
4749        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4750            self.0.options = v.into();
4751            self
4752        }
4753
4754        /// Sends the request.
4755        ///
4756        /// # Long running operations
4757        ///
4758        /// This starts, but does not poll, a longrunning operation. More information
4759        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4760        pub async fn send(self) -> Result<longrunning::model::Operation> {
4761            (*self.0.stub)
4762                .delete_data_store(self.0.request, self.0.options)
4763                .await
4764                .map(gax::response::Response::into_body)
4765        }
4766
4767        /// Creates a [Poller][lro::Poller] to work with `delete_data_store`.
4768        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4769            type Operation =
4770                lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4771            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4772            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4773
4774            let stub = self.0.stub.clone();
4775            let mut options = self.0.options.clone();
4776            options.set_retry_policy(gax::retry_policy::NeverRetry);
4777            let query = move |name| {
4778                let stub = stub.clone();
4779                let options = options.clone();
4780                async {
4781                    let op = GetOperation::new(stub)
4782                        .set_name(name)
4783                        .with_options(options)
4784                        .send()
4785                        .await?;
4786                    Ok(Operation::new(op))
4787                }
4788            };
4789
4790            let start = move || async {
4791                let op = self.send().await?;
4792                Ok(Operation::new(op))
4793            };
4794
4795            lro::internal::new_unit_response_poller(
4796                polling_error_policy,
4797                polling_backoff_policy,
4798                start,
4799                query,
4800            )
4801        }
4802
4803        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4804        ///
4805        /// This is a **required** field for requests.
4806        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4807            self.0.request.name = v.into();
4808            self
4809        }
4810    }
4811
4812    #[doc(hidden)]
4813    impl gax::options::internal::RequestBuilder for DeleteDataStore {
4814        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4815            &mut self.0.options
4816        }
4817    }
4818
4819    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4820    ///
4821    /// # Example
4822    /// ```no_run
4823    /// # use google_cloud_discoveryengine_v1::builder;
4824    /// use builder::data_store_service::UpdateDataStore;
4825    /// # tokio_test::block_on(async {
4826    ///
4827    /// let builder = prepare_request_builder();
4828    /// let response = builder.send().await?;
4829    /// # gax::Result::<()>::Ok(()) });
4830    ///
4831    /// fn prepare_request_builder() -> UpdateDataStore {
4832    ///   # panic!();
4833    ///   // ... details omitted ...
4834    /// }
4835    /// ```
4836    #[derive(Clone, Debug)]
4837    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4838
4839    impl UpdateDataStore {
4840        pub(crate) fn new(
4841            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4842        ) -> Self {
4843            Self(RequestBuilder::new(stub))
4844        }
4845
4846        /// Sets the full request, replacing any prior values.
4847        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4848            self.0.request = v.into();
4849            self
4850        }
4851
4852        /// Sets all the options, replacing any prior values.
4853        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4854            self.0.options = v.into();
4855            self
4856        }
4857
4858        /// Sends the request.
4859        pub async fn send(self) -> Result<crate::model::DataStore> {
4860            (*self.0.stub)
4861                .update_data_store(self.0.request, self.0.options)
4862                .await
4863                .map(gax::response::Response::into_body)
4864        }
4865
4866        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4867        ///
4868        /// This is a **required** field for requests.
4869        pub fn set_data_store<T>(mut self, v: T) -> Self
4870        where
4871            T: std::convert::Into<crate::model::DataStore>,
4872        {
4873            self.0.request.data_store = std::option::Option::Some(v.into());
4874            self
4875        }
4876
4877        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4878        ///
4879        /// This is a **required** field for requests.
4880        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4881        where
4882            T: std::convert::Into<crate::model::DataStore>,
4883        {
4884            self.0.request.data_store = v.map(|x| x.into());
4885            self
4886        }
4887
4888        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4889        pub fn set_update_mask<T>(mut self, v: T) -> Self
4890        where
4891            T: std::convert::Into<wkt::FieldMask>,
4892        {
4893            self.0.request.update_mask = std::option::Option::Some(v.into());
4894            self
4895        }
4896
4897        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4898        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4899        where
4900            T: std::convert::Into<wkt::FieldMask>,
4901        {
4902            self.0.request.update_mask = v.map(|x| x.into());
4903            self
4904        }
4905    }
4906
4907    #[doc(hidden)]
4908    impl gax::options::internal::RequestBuilder for UpdateDataStore {
4909        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4910            &mut self.0.options
4911        }
4912    }
4913
4914    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
4915    ///
4916    /// # Example
4917    /// ```no_run
4918    /// # use google_cloud_discoveryengine_v1::builder;
4919    /// use builder::data_store_service::ListOperations;
4920    /// # tokio_test::block_on(async {
4921    /// use gax::paginator::ItemPaginator;
4922    ///
4923    /// let builder = prepare_request_builder();
4924    /// let mut items = builder.by_item();
4925    /// while let Some(result) = items.next().await {
4926    ///   let item = result?;
4927    /// }
4928    /// # gax::Result::<()>::Ok(()) });
4929    ///
4930    /// fn prepare_request_builder() -> ListOperations {
4931    ///   # panic!();
4932    ///   // ... details omitted ...
4933    /// }
4934    /// ```
4935    #[derive(Clone, Debug)]
4936    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4937
4938    impl ListOperations {
4939        pub(crate) fn new(
4940            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4941        ) -> Self {
4942            Self(RequestBuilder::new(stub))
4943        }
4944
4945        /// Sets the full request, replacing any prior values.
4946        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4947            mut self,
4948            v: V,
4949        ) -> Self {
4950            self.0.request = v.into();
4951            self
4952        }
4953
4954        /// Sets all the options, replacing any prior values.
4955        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4956            self.0.options = v.into();
4957            self
4958        }
4959
4960        /// Sends the request.
4961        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4962            (*self.0.stub)
4963                .list_operations(self.0.request, self.0.options)
4964                .await
4965                .map(gax::response::Response::into_body)
4966        }
4967
4968        /// Streams each page in the collection.
4969        pub fn by_page(
4970            self,
4971        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4972        {
4973            use std::clone::Clone;
4974            let token = self.0.request.page_token.clone();
4975            let execute = move |token: String| {
4976                let mut builder = self.clone();
4977                builder.0.request = builder.0.request.set_page_token(token);
4978                builder.send()
4979            };
4980            gax::paginator::internal::new_paginator(token, execute)
4981        }
4982
4983        /// Streams each item in the collection.
4984        pub fn by_item(
4985            self,
4986        ) -> impl gax::paginator::ItemPaginator<
4987            longrunning::model::ListOperationsResponse,
4988            gax::error::Error,
4989        > {
4990            use gax::paginator::Paginator;
4991            self.by_page().items()
4992        }
4993
4994        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4995        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4996            self.0.request.name = v.into();
4997            self
4998        }
4999
5000        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
5001        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5002            self.0.request.filter = v.into();
5003            self
5004        }
5005
5006        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
5007        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5008            self.0.request.page_size = v.into();
5009            self
5010        }
5011
5012        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
5013        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5014            self.0.request.page_token = v.into();
5015            self
5016        }
5017    }
5018
5019    #[doc(hidden)]
5020    impl gax::options::internal::RequestBuilder for ListOperations {
5021        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5022            &mut self.0.options
5023        }
5024    }
5025
5026    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5027    ///
5028    /// # Example
5029    /// ```no_run
5030    /// # use google_cloud_discoveryengine_v1::builder;
5031    /// use builder::data_store_service::GetOperation;
5032    /// # tokio_test::block_on(async {
5033    ///
5034    /// let builder = prepare_request_builder();
5035    /// let response = builder.send().await?;
5036    /// # gax::Result::<()>::Ok(()) });
5037    ///
5038    /// fn prepare_request_builder() -> GetOperation {
5039    ///   # panic!();
5040    ///   // ... details omitted ...
5041    /// }
5042    /// ```
5043    #[derive(Clone, Debug)]
5044    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5045
5046    impl GetOperation {
5047        pub(crate) fn new(
5048            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5049        ) -> Self {
5050            Self(RequestBuilder::new(stub))
5051        }
5052
5053        /// Sets the full request, replacing any prior values.
5054        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5055            mut self,
5056            v: V,
5057        ) -> Self {
5058            self.0.request = v.into();
5059            self
5060        }
5061
5062        /// Sets all the options, replacing any prior values.
5063        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5064            self.0.options = v.into();
5065            self
5066        }
5067
5068        /// Sends the request.
5069        pub async fn send(self) -> Result<longrunning::model::Operation> {
5070            (*self.0.stub)
5071                .get_operation(self.0.request, self.0.options)
5072                .await
5073                .map(gax::response::Response::into_body)
5074        }
5075
5076        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5077        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5078            self.0.request.name = v.into();
5079            self
5080        }
5081    }
5082
5083    #[doc(hidden)]
5084    impl gax::options::internal::RequestBuilder for GetOperation {
5085        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5086            &mut self.0.options
5087        }
5088    }
5089
5090    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5091    ///
5092    /// # Example
5093    /// ```no_run
5094    /// # use google_cloud_discoveryengine_v1::builder;
5095    /// use builder::data_store_service::CancelOperation;
5096    /// # tokio_test::block_on(async {
5097    ///
5098    /// let builder = prepare_request_builder();
5099    /// let response = builder.send().await?;
5100    /// # gax::Result::<()>::Ok(()) });
5101    ///
5102    /// fn prepare_request_builder() -> CancelOperation {
5103    ///   # panic!();
5104    ///   // ... details omitted ...
5105    /// }
5106    /// ```
5107    #[derive(Clone, Debug)]
5108    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5109
5110    impl CancelOperation {
5111        pub(crate) fn new(
5112            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5113        ) -> Self {
5114            Self(RequestBuilder::new(stub))
5115        }
5116
5117        /// Sets the full request, replacing any prior values.
5118        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5119            mut self,
5120            v: V,
5121        ) -> Self {
5122            self.0.request = v.into();
5123            self
5124        }
5125
5126        /// Sets all the options, replacing any prior values.
5127        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5128            self.0.options = v.into();
5129            self
5130        }
5131
5132        /// Sends the request.
5133        pub async fn send(self) -> Result<()> {
5134            (*self.0.stub)
5135                .cancel_operation(self.0.request, self.0.options)
5136                .await
5137                .map(gax::response::Response::into_body)
5138        }
5139
5140        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
5141        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5142            self.0.request.name = v.into();
5143            self
5144        }
5145    }
5146
5147    #[doc(hidden)]
5148    impl gax::options::internal::RequestBuilder for CancelOperation {
5149        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5150            &mut self.0.options
5151        }
5152    }
5153}
5154
5155#[cfg(feature = "document-service")]
5156#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5157pub mod document_service {
5158    use crate::Result;
5159
5160    /// A builder for [DocumentService][crate::client::DocumentService].
5161    ///
5162    /// ```
5163    /// # tokio_test::block_on(async {
5164    /// # use google_cloud_discoveryengine_v1::*;
5165    /// # use builder::document_service::ClientBuilder;
5166    /// # use client::DocumentService;
5167    /// let builder : ClientBuilder = DocumentService::builder();
5168    /// let client = builder
5169    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5170    ///     .build().await?;
5171    /// # gax::client_builder::Result::<()>::Ok(()) });
5172    /// ```
5173    pub type ClientBuilder =
5174        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5175
5176    pub(crate) mod client {
5177        use super::super::super::client::DocumentService;
5178        pub struct Factory;
5179        impl gax::client_builder::internal::ClientFactory for Factory {
5180            type Client = DocumentService;
5181            type Credentials = gaxi::options::Credentials;
5182            async fn build(
5183                self,
5184                config: gaxi::options::ClientConfig,
5185            ) -> gax::client_builder::Result<Self::Client> {
5186                Self::Client::new(config).await
5187            }
5188        }
5189    }
5190
5191    /// Common implementation for [crate::client::DocumentService] request builders.
5192    #[derive(Clone, Debug)]
5193    pub(crate) struct RequestBuilder<R: std::default::Default> {
5194        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5195        request: R,
5196        options: gax::options::RequestOptions,
5197    }
5198
5199    impl<R> RequestBuilder<R>
5200    where
5201        R: std::default::Default,
5202    {
5203        pub(crate) fn new(
5204            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5205        ) -> Self {
5206            Self {
5207                stub,
5208                request: R::default(),
5209                options: gax::options::RequestOptions::default(),
5210            }
5211        }
5212    }
5213
5214    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5215    ///
5216    /// # Example
5217    /// ```no_run
5218    /// # use google_cloud_discoveryengine_v1::builder;
5219    /// use builder::document_service::GetDocument;
5220    /// # tokio_test::block_on(async {
5221    ///
5222    /// let builder = prepare_request_builder();
5223    /// let response = builder.send().await?;
5224    /// # gax::Result::<()>::Ok(()) });
5225    ///
5226    /// fn prepare_request_builder() -> GetDocument {
5227    ///   # panic!();
5228    ///   // ... details omitted ...
5229    /// }
5230    /// ```
5231    #[derive(Clone, Debug)]
5232    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5233
5234    impl GetDocument {
5235        pub(crate) fn new(
5236            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5237        ) -> Self {
5238            Self(RequestBuilder::new(stub))
5239        }
5240
5241        /// Sets the full request, replacing any prior values.
5242        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5243            self.0.request = v.into();
5244            self
5245        }
5246
5247        /// Sets all the options, replacing any prior values.
5248        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5249            self.0.options = v.into();
5250            self
5251        }
5252
5253        /// Sends the request.
5254        pub async fn send(self) -> Result<crate::model::Document> {
5255            (*self.0.stub)
5256                .get_document(self.0.request, self.0.options)
5257                .await
5258                .map(gax::response::Response::into_body)
5259        }
5260
5261        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5262        ///
5263        /// This is a **required** field for requests.
5264        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5265            self.0.request.name = v.into();
5266            self
5267        }
5268    }
5269
5270    #[doc(hidden)]
5271    impl gax::options::internal::RequestBuilder for GetDocument {
5272        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5273            &mut self.0.options
5274        }
5275    }
5276
5277    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5278    ///
5279    /// # Example
5280    /// ```no_run
5281    /// # use google_cloud_discoveryengine_v1::builder;
5282    /// use builder::document_service::ListDocuments;
5283    /// # tokio_test::block_on(async {
5284    /// use gax::paginator::ItemPaginator;
5285    ///
5286    /// let builder = prepare_request_builder();
5287    /// let mut items = builder.by_item();
5288    /// while let Some(result) = items.next().await {
5289    ///   let item = result?;
5290    /// }
5291    /// # gax::Result::<()>::Ok(()) });
5292    ///
5293    /// fn prepare_request_builder() -> ListDocuments {
5294    ///   # panic!();
5295    ///   // ... details omitted ...
5296    /// }
5297    /// ```
5298    #[derive(Clone, Debug)]
5299    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5300
5301    impl ListDocuments {
5302        pub(crate) fn new(
5303            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5304        ) -> Self {
5305            Self(RequestBuilder::new(stub))
5306        }
5307
5308        /// Sets the full request, replacing any prior values.
5309        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5310            self.0.request = v.into();
5311            self
5312        }
5313
5314        /// Sets all the options, replacing any prior values.
5315        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5316            self.0.options = v.into();
5317            self
5318        }
5319
5320        /// Sends the request.
5321        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5322            (*self.0.stub)
5323                .list_documents(self.0.request, self.0.options)
5324                .await
5325                .map(gax::response::Response::into_body)
5326        }
5327
5328        /// Streams each page in the collection.
5329        pub fn by_page(
5330            self,
5331        ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5332        {
5333            use std::clone::Clone;
5334            let token = self.0.request.page_token.clone();
5335            let execute = move |token: String| {
5336                let mut builder = self.clone();
5337                builder.0.request = builder.0.request.set_page_token(token);
5338                builder.send()
5339            };
5340            gax::paginator::internal::new_paginator(token, execute)
5341        }
5342
5343        /// Streams each item in the collection.
5344        pub fn by_item(
5345            self,
5346        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5347        {
5348            use gax::paginator::Paginator;
5349            self.by_page().items()
5350        }
5351
5352        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5353        ///
5354        /// This is a **required** field for requests.
5355        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5356            self.0.request.parent = v.into();
5357            self
5358        }
5359
5360        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5361        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5362            self.0.request.page_size = v.into();
5363            self
5364        }
5365
5366        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5367        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5368            self.0.request.page_token = v.into();
5369            self
5370        }
5371    }
5372
5373    #[doc(hidden)]
5374    impl gax::options::internal::RequestBuilder for ListDocuments {
5375        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5376            &mut self.0.options
5377        }
5378    }
5379
5380    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5381    ///
5382    /// # Example
5383    /// ```no_run
5384    /// # use google_cloud_discoveryengine_v1::builder;
5385    /// use builder::document_service::CreateDocument;
5386    /// # tokio_test::block_on(async {
5387    ///
5388    /// let builder = prepare_request_builder();
5389    /// let response = builder.send().await?;
5390    /// # gax::Result::<()>::Ok(()) });
5391    ///
5392    /// fn prepare_request_builder() -> CreateDocument {
5393    ///   # panic!();
5394    ///   // ... details omitted ...
5395    /// }
5396    /// ```
5397    #[derive(Clone, Debug)]
5398    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5399
5400    impl CreateDocument {
5401        pub(crate) fn new(
5402            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5403        ) -> Self {
5404            Self(RequestBuilder::new(stub))
5405        }
5406
5407        /// Sets the full request, replacing any prior values.
5408        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5409            self.0.request = v.into();
5410            self
5411        }
5412
5413        /// Sets all the options, replacing any prior values.
5414        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5415            self.0.options = v.into();
5416            self
5417        }
5418
5419        /// Sends the request.
5420        pub async fn send(self) -> Result<crate::model::Document> {
5421            (*self.0.stub)
5422                .create_document(self.0.request, self.0.options)
5423                .await
5424                .map(gax::response::Response::into_body)
5425        }
5426
5427        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5428        ///
5429        /// This is a **required** field for requests.
5430        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5431            self.0.request.parent = v.into();
5432            self
5433        }
5434
5435        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5436        ///
5437        /// This is a **required** field for requests.
5438        pub fn set_document<T>(mut self, v: T) -> Self
5439        where
5440            T: std::convert::Into<crate::model::Document>,
5441        {
5442            self.0.request.document = std::option::Option::Some(v.into());
5443            self
5444        }
5445
5446        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5447        ///
5448        /// This is a **required** field for requests.
5449        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5450        where
5451            T: std::convert::Into<crate::model::Document>,
5452        {
5453            self.0.request.document = v.map(|x| x.into());
5454            self
5455        }
5456
5457        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5458        ///
5459        /// This is a **required** field for requests.
5460        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5461            self.0.request.document_id = v.into();
5462            self
5463        }
5464    }
5465
5466    #[doc(hidden)]
5467    impl gax::options::internal::RequestBuilder for CreateDocument {
5468        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5469            &mut self.0.options
5470        }
5471    }
5472
5473    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5474    ///
5475    /// # Example
5476    /// ```no_run
5477    /// # use google_cloud_discoveryengine_v1::builder;
5478    /// use builder::document_service::UpdateDocument;
5479    /// # tokio_test::block_on(async {
5480    ///
5481    /// let builder = prepare_request_builder();
5482    /// let response = builder.send().await?;
5483    /// # gax::Result::<()>::Ok(()) });
5484    ///
5485    /// fn prepare_request_builder() -> UpdateDocument {
5486    ///   # panic!();
5487    ///   // ... details omitted ...
5488    /// }
5489    /// ```
5490    #[derive(Clone, Debug)]
5491    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5492
5493    impl UpdateDocument {
5494        pub(crate) fn new(
5495            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5496        ) -> Self {
5497            Self(RequestBuilder::new(stub))
5498        }
5499
5500        /// Sets the full request, replacing any prior values.
5501        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5502            self.0.request = v.into();
5503            self
5504        }
5505
5506        /// Sets all the options, replacing any prior values.
5507        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5508            self.0.options = v.into();
5509            self
5510        }
5511
5512        /// Sends the request.
5513        pub async fn send(self) -> Result<crate::model::Document> {
5514            (*self.0.stub)
5515                .update_document(self.0.request, self.0.options)
5516                .await
5517                .map(gax::response::Response::into_body)
5518        }
5519
5520        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5521        ///
5522        /// This is a **required** field for requests.
5523        pub fn set_document<T>(mut self, v: T) -> Self
5524        where
5525            T: std::convert::Into<crate::model::Document>,
5526        {
5527            self.0.request.document = std::option::Option::Some(v.into());
5528            self
5529        }
5530
5531        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5532        ///
5533        /// This is a **required** field for requests.
5534        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5535        where
5536            T: std::convert::Into<crate::model::Document>,
5537        {
5538            self.0.request.document = v.map(|x| x.into());
5539            self
5540        }
5541
5542        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5543        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5544            self.0.request.allow_missing = v.into();
5545            self
5546        }
5547
5548        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5549        pub fn set_update_mask<T>(mut self, v: T) -> Self
5550        where
5551            T: std::convert::Into<wkt::FieldMask>,
5552        {
5553            self.0.request.update_mask = std::option::Option::Some(v.into());
5554            self
5555        }
5556
5557        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5558        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5559        where
5560            T: std::convert::Into<wkt::FieldMask>,
5561        {
5562            self.0.request.update_mask = v.map(|x| x.into());
5563            self
5564        }
5565    }
5566
5567    #[doc(hidden)]
5568    impl gax::options::internal::RequestBuilder for UpdateDocument {
5569        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5570            &mut self.0.options
5571        }
5572    }
5573
5574    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5575    ///
5576    /// # Example
5577    /// ```no_run
5578    /// # use google_cloud_discoveryengine_v1::builder;
5579    /// use builder::document_service::DeleteDocument;
5580    /// # tokio_test::block_on(async {
5581    ///
5582    /// let builder = prepare_request_builder();
5583    /// let response = builder.send().await?;
5584    /// # gax::Result::<()>::Ok(()) });
5585    ///
5586    /// fn prepare_request_builder() -> DeleteDocument {
5587    ///   # panic!();
5588    ///   // ... details omitted ...
5589    /// }
5590    /// ```
5591    #[derive(Clone, Debug)]
5592    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5593
5594    impl DeleteDocument {
5595        pub(crate) fn new(
5596            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5597        ) -> Self {
5598            Self(RequestBuilder::new(stub))
5599        }
5600
5601        /// Sets the full request, replacing any prior values.
5602        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5603            self.0.request = v.into();
5604            self
5605        }
5606
5607        /// Sets all the options, replacing any prior values.
5608        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5609            self.0.options = v.into();
5610            self
5611        }
5612
5613        /// Sends the request.
5614        pub async fn send(self) -> Result<()> {
5615            (*self.0.stub)
5616                .delete_document(self.0.request, self.0.options)
5617                .await
5618                .map(gax::response::Response::into_body)
5619        }
5620
5621        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5622        ///
5623        /// This is a **required** field for requests.
5624        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5625            self.0.request.name = v.into();
5626            self
5627        }
5628    }
5629
5630    #[doc(hidden)]
5631    impl gax::options::internal::RequestBuilder for DeleteDocument {
5632        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5633            &mut self.0.options
5634        }
5635    }
5636
5637    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5638    ///
5639    /// # Example
5640    /// ```no_run
5641    /// # use google_cloud_discoveryengine_v1::builder;
5642    /// use builder::document_service::ImportDocuments;
5643    /// # tokio_test::block_on(async {
5644    /// use lro::Poller;
5645    ///
5646    /// let builder = prepare_request_builder();
5647    /// let response = builder.poller().until_done().await?;
5648    /// # gax::Result::<()>::Ok(()) });
5649    ///
5650    /// fn prepare_request_builder() -> ImportDocuments {
5651    ///   # panic!();
5652    ///   // ... details omitted ...
5653    /// }
5654    /// ```
5655    #[derive(Clone, Debug)]
5656    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5657
5658    impl ImportDocuments {
5659        pub(crate) fn new(
5660            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5661        ) -> Self {
5662            Self(RequestBuilder::new(stub))
5663        }
5664
5665        /// Sets the full request, replacing any prior values.
5666        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5667            self.0.request = v.into();
5668            self
5669        }
5670
5671        /// Sets all the options, replacing any prior values.
5672        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5673            self.0.options = v.into();
5674            self
5675        }
5676
5677        /// Sends the request.
5678        ///
5679        /// # Long running operations
5680        ///
5681        /// This starts, but does not poll, a longrunning operation. More information
5682        /// on [import_documents][crate::client::DocumentService::import_documents].
5683        pub async fn send(self) -> Result<longrunning::model::Operation> {
5684            (*self.0.stub)
5685                .import_documents(self.0.request, self.0.options)
5686                .await
5687                .map(gax::response::Response::into_body)
5688        }
5689
5690        /// Creates a [Poller][lro::Poller] to work with `import_documents`.
5691        pub fn poller(
5692            self,
5693        ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5694        {
5695            type Operation = lro::internal::Operation<
5696                crate::model::ImportDocumentsResponse,
5697                crate::model::ImportDocumentsMetadata,
5698            >;
5699            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5700            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5701
5702            let stub = self.0.stub.clone();
5703            let mut options = self.0.options.clone();
5704            options.set_retry_policy(gax::retry_policy::NeverRetry);
5705            let query = move |name| {
5706                let stub = stub.clone();
5707                let options = options.clone();
5708                async {
5709                    let op = GetOperation::new(stub)
5710                        .set_name(name)
5711                        .with_options(options)
5712                        .send()
5713                        .await?;
5714                    Ok(Operation::new(op))
5715                }
5716            };
5717
5718            let start = move || async {
5719                let op = self.send().await?;
5720                Ok(Operation::new(op))
5721            };
5722
5723            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5724        }
5725
5726        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5727        ///
5728        /// This is a **required** field for requests.
5729        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5730            self.0.request.parent = v.into();
5731            self
5732        }
5733
5734        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5735        pub fn set_error_config<T>(mut self, v: T) -> Self
5736        where
5737            T: std::convert::Into<crate::model::ImportErrorConfig>,
5738        {
5739            self.0.request.error_config = std::option::Option::Some(v.into());
5740            self
5741        }
5742
5743        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5744        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5745        where
5746            T: std::convert::Into<crate::model::ImportErrorConfig>,
5747        {
5748            self.0.request.error_config = v.map(|x| x.into());
5749            self
5750        }
5751
5752        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5753        pub fn set_reconciliation_mode<
5754            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5755        >(
5756            mut self,
5757            v: T,
5758        ) -> Self {
5759            self.0.request.reconciliation_mode = v.into();
5760            self
5761        }
5762
5763        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5764        pub fn set_update_mask<T>(mut self, v: T) -> Self
5765        where
5766            T: std::convert::Into<wkt::FieldMask>,
5767        {
5768            self.0.request.update_mask = std::option::Option::Some(v.into());
5769            self
5770        }
5771
5772        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5773        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5774        where
5775            T: std::convert::Into<wkt::FieldMask>,
5776        {
5777            self.0.request.update_mask = v.map(|x| x.into());
5778            self
5779        }
5780
5781        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5782        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5783            self.0.request.auto_generate_ids = v.into();
5784            self
5785        }
5786
5787        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5788        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5789            self.0.request.id_field = v.into();
5790            self
5791        }
5792
5793        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5794        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5795            self.0.request.force_refresh_content = v.into();
5796            self
5797        }
5798
5799        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5800        ///
5801        /// Note that all the setters affecting `source` are
5802        /// mutually exclusive.
5803        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5804            mut self,
5805            v: T,
5806        ) -> Self {
5807            self.0.request.source = v.into();
5808            self
5809        }
5810
5811        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5812        /// to hold a `InlineSource`.
5813        ///
5814        /// Note that all the setters affecting `source` are
5815        /// mutually exclusive.
5816        pub fn set_inline_source<
5817            T: std::convert::Into<
5818                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5819                >,
5820        >(
5821            mut self,
5822            v: T,
5823        ) -> Self {
5824            self.0.request = self.0.request.set_inline_source(v);
5825            self
5826        }
5827
5828        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5829        /// to hold a `GcsSource`.
5830        ///
5831        /// Note that all the setters affecting `source` are
5832        /// mutually exclusive.
5833        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5834            mut self,
5835            v: T,
5836        ) -> Self {
5837            self.0.request = self.0.request.set_gcs_source(v);
5838            self
5839        }
5840
5841        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5842        /// to hold a `BigquerySource`.
5843        ///
5844        /// Note that all the setters affecting `source` are
5845        /// mutually exclusive.
5846        pub fn set_bigquery_source<
5847            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5848        >(
5849            mut self,
5850            v: T,
5851        ) -> Self {
5852            self.0.request = self.0.request.set_bigquery_source(v);
5853            self
5854        }
5855
5856        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5857        /// to hold a `FhirStoreSource`.
5858        ///
5859        /// Note that all the setters affecting `source` are
5860        /// mutually exclusive.
5861        pub fn set_fhir_store_source<
5862            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5863        >(
5864            mut self,
5865            v: T,
5866        ) -> Self {
5867            self.0.request = self.0.request.set_fhir_store_source(v);
5868            self
5869        }
5870
5871        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5872        /// to hold a `SpannerSource`.
5873        ///
5874        /// Note that all the setters affecting `source` are
5875        /// mutually exclusive.
5876        pub fn set_spanner_source<
5877            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5878        >(
5879            mut self,
5880            v: T,
5881        ) -> Self {
5882            self.0.request = self.0.request.set_spanner_source(v);
5883            self
5884        }
5885
5886        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5887        /// to hold a `CloudSqlSource`.
5888        ///
5889        /// Note that all the setters affecting `source` are
5890        /// mutually exclusive.
5891        pub fn set_cloud_sql_source<
5892            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5893        >(
5894            mut self,
5895            v: T,
5896        ) -> Self {
5897            self.0.request = self.0.request.set_cloud_sql_source(v);
5898            self
5899        }
5900
5901        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5902        /// to hold a `FirestoreSource`.
5903        ///
5904        /// Note that all the setters affecting `source` are
5905        /// mutually exclusive.
5906        pub fn set_firestore_source<
5907            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5908        >(
5909            mut self,
5910            v: T,
5911        ) -> Self {
5912            self.0.request = self.0.request.set_firestore_source(v);
5913            self
5914        }
5915
5916        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5917        /// to hold a `AlloyDbSource`.
5918        ///
5919        /// Note that all the setters affecting `source` are
5920        /// mutually exclusive.
5921        pub fn set_alloy_db_source<
5922            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5923        >(
5924            mut self,
5925            v: T,
5926        ) -> Self {
5927            self.0.request = self.0.request.set_alloy_db_source(v);
5928            self
5929        }
5930
5931        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5932        /// to hold a `BigtableSource`.
5933        ///
5934        /// Note that all the setters affecting `source` are
5935        /// mutually exclusive.
5936        pub fn set_bigtable_source<
5937            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5938        >(
5939            mut self,
5940            v: T,
5941        ) -> Self {
5942            self.0.request = self.0.request.set_bigtable_source(v);
5943            self
5944        }
5945    }
5946
5947    #[doc(hidden)]
5948    impl gax::options::internal::RequestBuilder for ImportDocuments {
5949        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5950            &mut self.0.options
5951        }
5952    }
5953
5954    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
5955    ///
5956    /// # Example
5957    /// ```no_run
5958    /// # use google_cloud_discoveryengine_v1::builder;
5959    /// use builder::document_service::PurgeDocuments;
5960    /// # tokio_test::block_on(async {
5961    /// use lro::Poller;
5962    ///
5963    /// let builder = prepare_request_builder();
5964    /// let response = builder.poller().until_done().await?;
5965    /// # gax::Result::<()>::Ok(()) });
5966    ///
5967    /// fn prepare_request_builder() -> PurgeDocuments {
5968    ///   # panic!();
5969    ///   // ... details omitted ...
5970    /// }
5971    /// ```
5972    #[derive(Clone, Debug)]
5973    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
5974
5975    impl PurgeDocuments {
5976        pub(crate) fn new(
5977            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5978        ) -> Self {
5979            Self(RequestBuilder::new(stub))
5980        }
5981
5982        /// Sets the full request, replacing any prior values.
5983        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
5984            self.0.request = v.into();
5985            self
5986        }
5987
5988        /// Sets all the options, replacing any prior values.
5989        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5990            self.0.options = v.into();
5991            self
5992        }
5993
5994        /// Sends the request.
5995        ///
5996        /// # Long running operations
5997        ///
5998        /// This starts, but does not poll, a longrunning operation. More information
5999        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6000        pub async fn send(self) -> Result<longrunning::model::Operation> {
6001            (*self.0.stub)
6002                .purge_documents(self.0.request, self.0.options)
6003                .await
6004                .map(gax::response::Response::into_body)
6005        }
6006
6007        /// Creates a [Poller][lro::Poller] to work with `purge_documents`.
6008        pub fn poller(
6009            self,
6010        ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
6011        {
6012            type Operation = lro::internal::Operation<
6013                crate::model::PurgeDocumentsResponse,
6014                crate::model::PurgeDocumentsMetadata,
6015            >;
6016            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6017            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6018
6019            let stub = self.0.stub.clone();
6020            let mut options = self.0.options.clone();
6021            options.set_retry_policy(gax::retry_policy::NeverRetry);
6022            let query = move |name| {
6023                let stub = stub.clone();
6024                let options = options.clone();
6025                async {
6026                    let op = GetOperation::new(stub)
6027                        .set_name(name)
6028                        .with_options(options)
6029                        .send()
6030                        .await?;
6031                    Ok(Operation::new(op))
6032                }
6033            };
6034
6035            let start = move || async {
6036                let op = self.send().await?;
6037                Ok(Operation::new(op))
6038            };
6039
6040            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6041        }
6042
6043        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6044        ///
6045        /// This is a **required** field for requests.
6046        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6047            self.0.request.parent = v.into();
6048            self
6049        }
6050
6051        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6052        ///
6053        /// This is a **required** field for requests.
6054        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6055            self.0.request.filter = v.into();
6056            self
6057        }
6058
6059        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6060        pub fn set_error_config<T>(mut self, v: T) -> Self
6061        where
6062            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6063        {
6064            self.0.request.error_config = std::option::Option::Some(v.into());
6065            self
6066        }
6067
6068        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6069        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6070        where
6071            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6072        {
6073            self.0.request.error_config = v.map(|x| x.into());
6074            self
6075        }
6076
6077        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6078        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6079            self.0.request.force = v.into();
6080            self
6081        }
6082
6083        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6084        ///
6085        /// Note that all the setters affecting `source` are
6086        /// mutually exclusive.
6087        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6088            mut self,
6089            v: T,
6090        ) -> Self {
6091            self.0.request.source = v.into();
6092            self
6093        }
6094
6095        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6096        /// to hold a `GcsSource`.
6097        ///
6098        /// Note that all the setters affecting `source` are
6099        /// mutually exclusive.
6100        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6101            mut self,
6102            v: T,
6103        ) -> Self {
6104            self.0.request = self.0.request.set_gcs_source(v);
6105            self
6106        }
6107
6108        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6109        /// to hold a `InlineSource`.
6110        ///
6111        /// Note that all the setters affecting `source` are
6112        /// mutually exclusive.
6113        pub fn set_inline_source<
6114            T: std::convert::Into<
6115                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6116                >,
6117        >(
6118            mut self,
6119            v: T,
6120        ) -> Self {
6121            self.0.request = self.0.request.set_inline_source(v);
6122            self
6123        }
6124    }
6125
6126    #[doc(hidden)]
6127    impl gax::options::internal::RequestBuilder for PurgeDocuments {
6128        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6129            &mut self.0.options
6130        }
6131    }
6132
6133    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6134    ///
6135    /// # Example
6136    /// ```no_run
6137    /// # use google_cloud_discoveryengine_v1::builder;
6138    /// use builder::document_service::BatchGetDocumentsMetadata;
6139    /// # tokio_test::block_on(async {
6140    ///
6141    /// let builder = prepare_request_builder();
6142    /// let response = builder.send().await?;
6143    /// # gax::Result::<()>::Ok(()) });
6144    ///
6145    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6146    ///   # panic!();
6147    ///   // ... details omitted ...
6148    /// }
6149    /// ```
6150    #[derive(Clone, Debug)]
6151    pub struct BatchGetDocumentsMetadata(
6152        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6153    );
6154
6155    impl BatchGetDocumentsMetadata {
6156        pub(crate) fn new(
6157            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6158        ) -> Self {
6159            Self(RequestBuilder::new(stub))
6160        }
6161
6162        /// Sets the full request, replacing any prior values.
6163        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6164            mut self,
6165            v: V,
6166        ) -> Self {
6167            self.0.request = v.into();
6168            self
6169        }
6170
6171        /// Sets all the options, replacing any prior values.
6172        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6173            self.0.options = v.into();
6174            self
6175        }
6176
6177        /// Sends the request.
6178        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6179            (*self.0.stub)
6180                .batch_get_documents_metadata(self.0.request, self.0.options)
6181                .await
6182                .map(gax::response::Response::into_body)
6183        }
6184
6185        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6186        ///
6187        /// This is a **required** field for requests.
6188        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6189            self.0.request.parent = v.into();
6190            self
6191        }
6192
6193        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6194        ///
6195        /// This is a **required** field for requests.
6196        pub fn set_matcher<T>(mut self, v: T) -> Self
6197        where
6198            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6199        {
6200            self.0.request.matcher = std::option::Option::Some(v.into());
6201            self
6202        }
6203
6204        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6205        ///
6206        /// This is a **required** field for requests.
6207        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6208        where
6209            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6210        {
6211            self.0.request.matcher = v.map(|x| x.into());
6212            self
6213        }
6214    }
6215
6216    #[doc(hidden)]
6217    impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6218        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6219            &mut self.0.options
6220        }
6221    }
6222
6223    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6224    ///
6225    /// # Example
6226    /// ```no_run
6227    /// # use google_cloud_discoveryengine_v1::builder;
6228    /// use builder::document_service::ListOperations;
6229    /// # tokio_test::block_on(async {
6230    /// use gax::paginator::ItemPaginator;
6231    ///
6232    /// let builder = prepare_request_builder();
6233    /// let mut items = builder.by_item();
6234    /// while let Some(result) = items.next().await {
6235    ///   let item = result?;
6236    /// }
6237    /// # gax::Result::<()>::Ok(()) });
6238    ///
6239    /// fn prepare_request_builder() -> ListOperations {
6240    ///   # panic!();
6241    ///   // ... details omitted ...
6242    /// }
6243    /// ```
6244    #[derive(Clone, Debug)]
6245    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6246
6247    impl ListOperations {
6248        pub(crate) fn new(
6249            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6250        ) -> Self {
6251            Self(RequestBuilder::new(stub))
6252        }
6253
6254        /// Sets the full request, replacing any prior values.
6255        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6256            mut self,
6257            v: V,
6258        ) -> Self {
6259            self.0.request = v.into();
6260            self
6261        }
6262
6263        /// Sets all the options, replacing any prior values.
6264        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6265            self.0.options = v.into();
6266            self
6267        }
6268
6269        /// Sends the request.
6270        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6271            (*self.0.stub)
6272                .list_operations(self.0.request, self.0.options)
6273                .await
6274                .map(gax::response::Response::into_body)
6275        }
6276
6277        /// Streams each page in the collection.
6278        pub fn by_page(
6279            self,
6280        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6281        {
6282            use std::clone::Clone;
6283            let token = self.0.request.page_token.clone();
6284            let execute = move |token: String| {
6285                let mut builder = self.clone();
6286                builder.0.request = builder.0.request.set_page_token(token);
6287                builder.send()
6288            };
6289            gax::paginator::internal::new_paginator(token, execute)
6290        }
6291
6292        /// Streams each item in the collection.
6293        pub fn by_item(
6294            self,
6295        ) -> impl gax::paginator::ItemPaginator<
6296            longrunning::model::ListOperationsResponse,
6297            gax::error::Error,
6298        > {
6299            use gax::paginator::Paginator;
6300            self.by_page().items()
6301        }
6302
6303        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6304        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6305            self.0.request.name = v.into();
6306            self
6307        }
6308
6309        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6310        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6311            self.0.request.filter = v.into();
6312            self
6313        }
6314
6315        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6316        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6317            self.0.request.page_size = v.into();
6318            self
6319        }
6320
6321        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6322        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6323            self.0.request.page_token = v.into();
6324            self
6325        }
6326    }
6327
6328    #[doc(hidden)]
6329    impl gax::options::internal::RequestBuilder for ListOperations {
6330        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6331            &mut self.0.options
6332        }
6333    }
6334
6335    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6336    ///
6337    /// # Example
6338    /// ```no_run
6339    /// # use google_cloud_discoveryengine_v1::builder;
6340    /// use builder::document_service::GetOperation;
6341    /// # tokio_test::block_on(async {
6342    ///
6343    /// let builder = prepare_request_builder();
6344    /// let response = builder.send().await?;
6345    /// # gax::Result::<()>::Ok(()) });
6346    ///
6347    /// fn prepare_request_builder() -> GetOperation {
6348    ///   # panic!();
6349    ///   // ... details omitted ...
6350    /// }
6351    /// ```
6352    #[derive(Clone, Debug)]
6353    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6354
6355    impl GetOperation {
6356        pub(crate) fn new(
6357            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6358        ) -> Self {
6359            Self(RequestBuilder::new(stub))
6360        }
6361
6362        /// Sets the full request, replacing any prior values.
6363        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6364            mut self,
6365            v: V,
6366        ) -> Self {
6367            self.0.request = v.into();
6368            self
6369        }
6370
6371        /// Sets all the options, replacing any prior values.
6372        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6373            self.0.options = v.into();
6374            self
6375        }
6376
6377        /// Sends the request.
6378        pub async fn send(self) -> Result<longrunning::model::Operation> {
6379            (*self.0.stub)
6380                .get_operation(self.0.request, self.0.options)
6381                .await
6382                .map(gax::response::Response::into_body)
6383        }
6384
6385        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6386        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6387            self.0.request.name = v.into();
6388            self
6389        }
6390    }
6391
6392    #[doc(hidden)]
6393    impl gax::options::internal::RequestBuilder for GetOperation {
6394        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6395            &mut self.0.options
6396        }
6397    }
6398
6399    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6400    ///
6401    /// # Example
6402    /// ```no_run
6403    /// # use google_cloud_discoveryengine_v1::builder;
6404    /// use builder::document_service::CancelOperation;
6405    /// # tokio_test::block_on(async {
6406    ///
6407    /// let builder = prepare_request_builder();
6408    /// let response = builder.send().await?;
6409    /// # gax::Result::<()>::Ok(()) });
6410    ///
6411    /// fn prepare_request_builder() -> CancelOperation {
6412    ///   # panic!();
6413    ///   // ... details omitted ...
6414    /// }
6415    /// ```
6416    #[derive(Clone, Debug)]
6417    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6418
6419    impl CancelOperation {
6420        pub(crate) fn new(
6421            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6422        ) -> Self {
6423            Self(RequestBuilder::new(stub))
6424        }
6425
6426        /// Sets the full request, replacing any prior values.
6427        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6428            mut self,
6429            v: V,
6430        ) -> Self {
6431            self.0.request = v.into();
6432            self
6433        }
6434
6435        /// Sets all the options, replacing any prior values.
6436        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6437            self.0.options = v.into();
6438            self
6439        }
6440
6441        /// Sends the request.
6442        pub async fn send(self) -> Result<()> {
6443            (*self.0.stub)
6444                .cancel_operation(self.0.request, self.0.options)
6445                .await
6446                .map(gax::response::Response::into_body)
6447        }
6448
6449        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
6450        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6451            self.0.request.name = v.into();
6452            self
6453        }
6454    }
6455
6456    #[doc(hidden)]
6457    impl gax::options::internal::RequestBuilder for CancelOperation {
6458        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6459            &mut self.0.options
6460        }
6461    }
6462}
6463
6464#[cfg(feature = "engine-service")]
6465#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6466pub mod engine_service {
6467    use crate::Result;
6468
6469    /// A builder for [EngineService][crate::client::EngineService].
6470    ///
6471    /// ```
6472    /// # tokio_test::block_on(async {
6473    /// # use google_cloud_discoveryengine_v1::*;
6474    /// # use builder::engine_service::ClientBuilder;
6475    /// # use client::EngineService;
6476    /// let builder : ClientBuilder = EngineService::builder();
6477    /// let client = builder
6478    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6479    ///     .build().await?;
6480    /// # gax::client_builder::Result::<()>::Ok(()) });
6481    /// ```
6482    pub type ClientBuilder =
6483        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6484
6485    pub(crate) mod client {
6486        use super::super::super::client::EngineService;
6487        pub struct Factory;
6488        impl gax::client_builder::internal::ClientFactory for Factory {
6489            type Client = EngineService;
6490            type Credentials = gaxi::options::Credentials;
6491            async fn build(
6492                self,
6493                config: gaxi::options::ClientConfig,
6494            ) -> gax::client_builder::Result<Self::Client> {
6495                Self::Client::new(config).await
6496            }
6497        }
6498    }
6499
6500    /// Common implementation for [crate::client::EngineService] request builders.
6501    #[derive(Clone, Debug)]
6502    pub(crate) struct RequestBuilder<R: std::default::Default> {
6503        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6504        request: R,
6505        options: gax::options::RequestOptions,
6506    }
6507
6508    impl<R> RequestBuilder<R>
6509    where
6510        R: std::default::Default,
6511    {
6512        pub(crate) fn new(
6513            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6514        ) -> Self {
6515            Self {
6516                stub,
6517                request: R::default(),
6518                options: gax::options::RequestOptions::default(),
6519            }
6520        }
6521    }
6522
6523    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6524    ///
6525    /// # Example
6526    /// ```no_run
6527    /// # use google_cloud_discoveryengine_v1::builder;
6528    /// use builder::engine_service::CreateEngine;
6529    /// # tokio_test::block_on(async {
6530    /// use lro::Poller;
6531    ///
6532    /// let builder = prepare_request_builder();
6533    /// let response = builder.poller().until_done().await?;
6534    /// # gax::Result::<()>::Ok(()) });
6535    ///
6536    /// fn prepare_request_builder() -> CreateEngine {
6537    ///   # panic!();
6538    ///   // ... details omitted ...
6539    /// }
6540    /// ```
6541    #[derive(Clone, Debug)]
6542    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6543
6544    impl CreateEngine {
6545        pub(crate) fn new(
6546            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6547        ) -> Self {
6548            Self(RequestBuilder::new(stub))
6549        }
6550
6551        /// Sets the full request, replacing any prior values.
6552        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6553            self.0.request = v.into();
6554            self
6555        }
6556
6557        /// Sets all the options, replacing any prior values.
6558        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6559            self.0.options = v.into();
6560            self
6561        }
6562
6563        /// Sends the request.
6564        ///
6565        /// # Long running operations
6566        ///
6567        /// This starts, but does not poll, a longrunning operation. More information
6568        /// on [create_engine][crate::client::EngineService::create_engine].
6569        pub async fn send(self) -> Result<longrunning::model::Operation> {
6570            (*self.0.stub)
6571                .create_engine(self.0.request, self.0.options)
6572                .await
6573                .map(gax::response::Response::into_body)
6574        }
6575
6576        /// Creates a [Poller][lro::Poller] to work with `create_engine`.
6577        pub fn poller(
6578            self,
6579        ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6580            type Operation =
6581                lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6582            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6583            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6584
6585            let stub = self.0.stub.clone();
6586            let mut options = self.0.options.clone();
6587            options.set_retry_policy(gax::retry_policy::NeverRetry);
6588            let query = move |name| {
6589                let stub = stub.clone();
6590                let options = options.clone();
6591                async {
6592                    let op = GetOperation::new(stub)
6593                        .set_name(name)
6594                        .with_options(options)
6595                        .send()
6596                        .await?;
6597                    Ok(Operation::new(op))
6598                }
6599            };
6600
6601            let start = move || async {
6602                let op = self.send().await?;
6603                Ok(Operation::new(op))
6604            };
6605
6606            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6607        }
6608
6609        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6610        ///
6611        /// This is a **required** field for requests.
6612        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6613            self.0.request.parent = v.into();
6614            self
6615        }
6616
6617        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6618        ///
6619        /// This is a **required** field for requests.
6620        pub fn set_engine<T>(mut self, v: T) -> Self
6621        where
6622            T: std::convert::Into<crate::model::Engine>,
6623        {
6624            self.0.request.engine = std::option::Option::Some(v.into());
6625            self
6626        }
6627
6628        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6629        ///
6630        /// This is a **required** field for requests.
6631        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6632        where
6633            T: std::convert::Into<crate::model::Engine>,
6634        {
6635            self.0.request.engine = v.map(|x| x.into());
6636            self
6637        }
6638
6639        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6640        ///
6641        /// This is a **required** field for requests.
6642        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6643            self.0.request.engine_id = v.into();
6644            self
6645        }
6646    }
6647
6648    #[doc(hidden)]
6649    impl gax::options::internal::RequestBuilder for CreateEngine {
6650        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6651            &mut self.0.options
6652        }
6653    }
6654
6655    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6656    ///
6657    /// # Example
6658    /// ```no_run
6659    /// # use google_cloud_discoveryengine_v1::builder;
6660    /// use builder::engine_service::DeleteEngine;
6661    /// # tokio_test::block_on(async {
6662    /// use lro::Poller;
6663    ///
6664    /// let builder = prepare_request_builder();
6665    /// let response = builder.poller().until_done().await?;
6666    /// # gax::Result::<()>::Ok(()) });
6667    ///
6668    /// fn prepare_request_builder() -> DeleteEngine {
6669    ///   # panic!();
6670    ///   // ... details omitted ...
6671    /// }
6672    /// ```
6673    #[derive(Clone, Debug)]
6674    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6675
6676    impl DeleteEngine {
6677        pub(crate) fn new(
6678            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6679        ) -> Self {
6680            Self(RequestBuilder::new(stub))
6681        }
6682
6683        /// Sets the full request, replacing any prior values.
6684        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6685            self.0.request = v.into();
6686            self
6687        }
6688
6689        /// Sets all the options, replacing any prior values.
6690        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6691            self.0.options = v.into();
6692            self
6693        }
6694
6695        /// Sends the request.
6696        ///
6697        /// # Long running operations
6698        ///
6699        /// This starts, but does not poll, a longrunning operation. More information
6700        /// on [delete_engine][crate::client::EngineService::delete_engine].
6701        pub async fn send(self) -> Result<longrunning::model::Operation> {
6702            (*self.0.stub)
6703                .delete_engine(self.0.request, self.0.options)
6704                .await
6705                .map(gax::response::Response::into_body)
6706        }
6707
6708        /// Creates a [Poller][lro::Poller] to work with `delete_engine`.
6709        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6710            type Operation =
6711                lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6712            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6713            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6714
6715            let stub = self.0.stub.clone();
6716            let mut options = self.0.options.clone();
6717            options.set_retry_policy(gax::retry_policy::NeverRetry);
6718            let query = move |name| {
6719                let stub = stub.clone();
6720                let options = options.clone();
6721                async {
6722                    let op = GetOperation::new(stub)
6723                        .set_name(name)
6724                        .with_options(options)
6725                        .send()
6726                        .await?;
6727                    Ok(Operation::new(op))
6728                }
6729            };
6730
6731            let start = move || async {
6732                let op = self.send().await?;
6733                Ok(Operation::new(op))
6734            };
6735
6736            lro::internal::new_unit_response_poller(
6737                polling_error_policy,
6738                polling_backoff_policy,
6739                start,
6740                query,
6741            )
6742        }
6743
6744        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6745        ///
6746        /// This is a **required** field for requests.
6747        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6748            self.0.request.name = v.into();
6749            self
6750        }
6751    }
6752
6753    #[doc(hidden)]
6754    impl gax::options::internal::RequestBuilder for DeleteEngine {
6755        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6756            &mut self.0.options
6757        }
6758    }
6759
6760    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6761    ///
6762    /// # Example
6763    /// ```no_run
6764    /// # use google_cloud_discoveryengine_v1::builder;
6765    /// use builder::engine_service::UpdateEngine;
6766    /// # tokio_test::block_on(async {
6767    ///
6768    /// let builder = prepare_request_builder();
6769    /// let response = builder.send().await?;
6770    /// # gax::Result::<()>::Ok(()) });
6771    ///
6772    /// fn prepare_request_builder() -> UpdateEngine {
6773    ///   # panic!();
6774    ///   // ... details omitted ...
6775    /// }
6776    /// ```
6777    #[derive(Clone, Debug)]
6778    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6779
6780    impl UpdateEngine {
6781        pub(crate) fn new(
6782            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6783        ) -> Self {
6784            Self(RequestBuilder::new(stub))
6785        }
6786
6787        /// Sets the full request, replacing any prior values.
6788        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6789            self.0.request = v.into();
6790            self
6791        }
6792
6793        /// Sets all the options, replacing any prior values.
6794        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6795            self.0.options = v.into();
6796            self
6797        }
6798
6799        /// Sends the request.
6800        pub async fn send(self) -> Result<crate::model::Engine> {
6801            (*self.0.stub)
6802                .update_engine(self.0.request, self.0.options)
6803                .await
6804                .map(gax::response::Response::into_body)
6805        }
6806
6807        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
6808        ///
6809        /// This is a **required** field for requests.
6810        pub fn set_engine<T>(mut self, v: T) -> Self
6811        where
6812            T: std::convert::Into<crate::model::Engine>,
6813        {
6814            self.0.request.engine = std::option::Option::Some(v.into());
6815            self
6816        }
6817
6818        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
6819        ///
6820        /// This is a **required** field for requests.
6821        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6822        where
6823            T: std::convert::Into<crate::model::Engine>,
6824        {
6825            self.0.request.engine = v.map(|x| x.into());
6826            self
6827        }
6828
6829        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6830        pub fn set_update_mask<T>(mut self, v: T) -> Self
6831        where
6832            T: std::convert::Into<wkt::FieldMask>,
6833        {
6834            self.0.request.update_mask = std::option::Option::Some(v.into());
6835            self
6836        }
6837
6838        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6839        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6840        where
6841            T: std::convert::Into<wkt::FieldMask>,
6842        {
6843            self.0.request.update_mask = v.map(|x| x.into());
6844            self
6845        }
6846    }
6847
6848    #[doc(hidden)]
6849    impl gax::options::internal::RequestBuilder for UpdateEngine {
6850        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6851            &mut self.0.options
6852        }
6853    }
6854
6855    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
6856    ///
6857    /// # Example
6858    /// ```no_run
6859    /// # use google_cloud_discoveryengine_v1::builder;
6860    /// use builder::engine_service::GetEngine;
6861    /// # tokio_test::block_on(async {
6862    ///
6863    /// let builder = prepare_request_builder();
6864    /// let response = builder.send().await?;
6865    /// # gax::Result::<()>::Ok(()) });
6866    ///
6867    /// fn prepare_request_builder() -> GetEngine {
6868    ///   # panic!();
6869    ///   // ... details omitted ...
6870    /// }
6871    /// ```
6872    #[derive(Clone, Debug)]
6873    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6874
6875    impl GetEngine {
6876        pub(crate) fn new(
6877            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6878        ) -> Self {
6879            Self(RequestBuilder::new(stub))
6880        }
6881
6882        /// Sets the full request, replacing any prior values.
6883        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6884            self.0.request = v.into();
6885            self
6886        }
6887
6888        /// Sets all the options, replacing any prior values.
6889        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6890            self.0.options = v.into();
6891            self
6892        }
6893
6894        /// Sends the request.
6895        pub async fn send(self) -> Result<crate::model::Engine> {
6896            (*self.0.stub)
6897                .get_engine(self.0.request, self.0.options)
6898                .await
6899                .map(gax::response::Response::into_body)
6900        }
6901
6902        /// Sets the value of [name][crate::model::GetEngineRequest::name].
6903        ///
6904        /// This is a **required** field for requests.
6905        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6906            self.0.request.name = v.into();
6907            self
6908        }
6909    }
6910
6911    #[doc(hidden)]
6912    impl gax::options::internal::RequestBuilder for GetEngine {
6913        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6914            &mut self.0.options
6915        }
6916    }
6917
6918    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
6919    ///
6920    /// # Example
6921    /// ```no_run
6922    /// # use google_cloud_discoveryengine_v1::builder;
6923    /// use builder::engine_service::ListEngines;
6924    /// # tokio_test::block_on(async {
6925    /// use gax::paginator::ItemPaginator;
6926    ///
6927    /// let builder = prepare_request_builder();
6928    /// let mut items = builder.by_item();
6929    /// while let Some(result) = items.next().await {
6930    ///   let item = result?;
6931    /// }
6932    /// # gax::Result::<()>::Ok(()) });
6933    ///
6934    /// fn prepare_request_builder() -> ListEngines {
6935    ///   # panic!();
6936    ///   // ... details omitted ...
6937    /// }
6938    /// ```
6939    #[derive(Clone, Debug)]
6940    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6941
6942    impl ListEngines {
6943        pub(crate) fn new(
6944            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6945        ) -> Self {
6946            Self(RequestBuilder::new(stub))
6947        }
6948
6949        /// Sets the full request, replacing any prior values.
6950        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6951            self.0.request = v.into();
6952            self
6953        }
6954
6955        /// Sets all the options, replacing any prior values.
6956        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6957            self.0.options = v.into();
6958            self
6959        }
6960
6961        /// Sends the request.
6962        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
6963            (*self.0.stub)
6964                .list_engines(self.0.request, self.0.options)
6965                .await
6966                .map(gax::response::Response::into_body)
6967        }
6968
6969        /// Streams each page in the collection.
6970        pub fn by_page(
6971            self,
6972        ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
6973        {
6974            use std::clone::Clone;
6975            let token = self.0.request.page_token.clone();
6976            let execute = move |token: String| {
6977                let mut builder = self.clone();
6978                builder.0.request = builder.0.request.set_page_token(token);
6979                builder.send()
6980            };
6981            gax::paginator::internal::new_paginator(token, execute)
6982        }
6983
6984        /// Streams each item in the collection.
6985        pub fn by_item(
6986            self,
6987        ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
6988        {
6989            use gax::paginator::Paginator;
6990            self.by_page().items()
6991        }
6992
6993        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
6994        ///
6995        /// This is a **required** field for requests.
6996        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6997            self.0.request.parent = v.into();
6998            self
6999        }
7000
7001        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7002        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7003            self.0.request.page_size = v.into();
7004            self
7005        }
7006
7007        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7008        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7009            self.0.request.page_token = v.into();
7010            self
7011        }
7012
7013        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7014        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7015            self.0.request.filter = v.into();
7016            self
7017        }
7018    }
7019
7020    #[doc(hidden)]
7021    impl gax::options::internal::RequestBuilder for ListEngines {
7022        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7023            &mut self.0.options
7024        }
7025    }
7026
7027    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7028    ///
7029    /// # Example
7030    /// ```no_run
7031    /// # use google_cloud_discoveryengine_v1::builder;
7032    /// use builder::engine_service::ListOperations;
7033    /// # tokio_test::block_on(async {
7034    /// use gax::paginator::ItemPaginator;
7035    ///
7036    /// let builder = prepare_request_builder();
7037    /// let mut items = builder.by_item();
7038    /// while let Some(result) = items.next().await {
7039    ///   let item = result?;
7040    /// }
7041    /// # gax::Result::<()>::Ok(()) });
7042    ///
7043    /// fn prepare_request_builder() -> ListOperations {
7044    ///   # panic!();
7045    ///   // ... details omitted ...
7046    /// }
7047    /// ```
7048    #[derive(Clone, Debug)]
7049    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7050
7051    impl ListOperations {
7052        pub(crate) fn new(
7053            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7054        ) -> Self {
7055            Self(RequestBuilder::new(stub))
7056        }
7057
7058        /// Sets the full request, replacing any prior values.
7059        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7060            mut self,
7061            v: V,
7062        ) -> Self {
7063            self.0.request = v.into();
7064            self
7065        }
7066
7067        /// Sets all the options, replacing any prior values.
7068        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7069            self.0.options = v.into();
7070            self
7071        }
7072
7073        /// Sends the request.
7074        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7075            (*self.0.stub)
7076                .list_operations(self.0.request, self.0.options)
7077                .await
7078                .map(gax::response::Response::into_body)
7079        }
7080
7081        /// Streams each page in the collection.
7082        pub fn by_page(
7083            self,
7084        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7085        {
7086            use std::clone::Clone;
7087            let token = self.0.request.page_token.clone();
7088            let execute = move |token: String| {
7089                let mut builder = self.clone();
7090                builder.0.request = builder.0.request.set_page_token(token);
7091                builder.send()
7092            };
7093            gax::paginator::internal::new_paginator(token, execute)
7094        }
7095
7096        /// Streams each item in the collection.
7097        pub fn by_item(
7098            self,
7099        ) -> impl gax::paginator::ItemPaginator<
7100            longrunning::model::ListOperationsResponse,
7101            gax::error::Error,
7102        > {
7103            use gax::paginator::Paginator;
7104            self.by_page().items()
7105        }
7106
7107        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7108        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7109            self.0.request.name = v.into();
7110            self
7111        }
7112
7113        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7114        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7115            self.0.request.filter = v.into();
7116            self
7117        }
7118
7119        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7120        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7121            self.0.request.page_size = v.into();
7122            self
7123        }
7124
7125        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7126        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7127            self.0.request.page_token = v.into();
7128            self
7129        }
7130    }
7131
7132    #[doc(hidden)]
7133    impl gax::options::internal::RequestBuilder for ListOperations {
7134        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7135            &mut self.0.options
7136        }
7137    }
7138
7139    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7140    ///
7141    /// # Example
7142    /// ```no_run
7143    /// # use google_cloud_discoveryengine_v1::builder;
7144    /// use builder::engine_service::GetOperation;
7145    /// # tokio_test::block_on(async {
7146    ///
7147    /// let builder = prepare_request_builder();
7148    /// let response = builder.send().await?;
7149    /// # gax::Result::<()>::Ok(()) });
7150    ///
7151    /// fn prepare_request_builder() -> GetOperation {
7152    ///   # panic!();
7153    ///   // ... details omitted ...
7154    /// }
7155    /// ```
7156    #[derive(Clone, Debug)]
7157    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7158
7159    impl GetOperation {
7160        pub(crate) fn new(
7161            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7162        ) -> Self {
7163            Self(RequestBuilder::new(stub))
7164        }
7165
7166        /// Sets the full request, replacing any prior values.
7167        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7168            mut self,
7169            v: V,
7170        ) -> Self {
7171            self.0.request = v.into();
7172            self
7173        }
7174
7175        /// Sets all the options, replacing any prior values.
7176        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7177            self.0.options = v.into();
7178            self
7179        }
7180
7181        /// Sends the request.
7182        pub async fn send(self) -> Result<longrunning::model::Operation> {
7183            (*self.0.stub)
7184                .get_operation(self.0.request, self.0.options)
7185                .await
7186                .map(gax::response::Response::into_body)
7187        }
7188
7189        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7190        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7191            self.0.request.name = v.into();
7192            self
7193        }
7194    }
7195
7196    #[doc(hidden)]
7197    impl gax::options::internal::RequestBuilder for GetOperation {
7198        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7199            &mut self.0.options
7200        }
7201    }
7202
7203    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7204    ///
7205    /// # Example
7206    /// ```no_run
7207    /// # use google_cloud_discoveryengine_v1::builder;
7208    /// use builder::engine_service::CancelOperation;
7209    /// # tokio_test::block_on(async {
7210    ///
7211    /// let builder = prepare_request_builder();
7212    /// let response = builder.send().await?;
7213    /// # gax::Result::<()>::Ok(()) });
7214    ///
7215    /// fn prepare_request_builder() -> CancelOperation {
7216    ///   # panic!();
7217    ///   // ... details omitted ...
7218    /// }
7219    /// ```
7220    #[derive(Clone, Debug)]
7221    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7222
7223    impl CancelOperation {
7224        pub(crate) fn new(
7225            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7226        ) -> Self {
7227            Self(RequestBuilder::new(stub))
7228        }
7229
7230        /// Sets the full request, replacing any prior values.
7231        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7232            mut self,
7233            v: V,
7234        ) -> Self {
7235            self.0.request = v.into();
7236            self
7237        }
7238
7239        /// Sets all the options, replacing any prior values.
7240        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7241            self.0.options = v.into();
7242            self
7243        }
7244
7245        /// Sends the request.
7246        pub async fn send(self) -> Result<()> {
7247            (*self.0.stub)
7248                .cancel_operation(self.0.request, self.0.options)
7249                .await
7250                .map(gax::response::Response::into_body)
7251        }
7252
7253        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7254        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7255            self.0.request.name = v.into();
7256            self
7257        }
7258    }
7259
7260    #[doc(hidden)]
7261    impl gax::options::internal::RequestBuilder for CancelOperation {
7262        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7263            &mut self.0.options
7264        }
7265    }
7266}
7267
7268#[cfg(feature = "grounded-generation-service")]
7269#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7270pub mod grounded_generation_service {
7271    use crate::Result;
7272
7273    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7274    ///
7275    /// ```
7276    /// # tokio_test::block_on(async {
7277    /// # use google_cloud_discoveryengine_v1::*;
7278    /// # use builder::grounded_generation_service::ClientBuilder;
7279    /// # use client::GroundedGenerationService;
7280    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7281    /// let client = builder
7282    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7283    ///     .build().await?;
7284    /// # gax::client_builder::Result::<()>::Ok(()) });
7285    /// ```
7286    pub type ClientBuilder =
7287        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7288
7289    pub(crate) mod client {
7290        use super::super::super::client::GroundedGenerationService;
7291        pub struct Factory;
7292        impl gax::client_builder::internal::ClientFactory for Factory {
7293            type Client = GroundedGenerationService;
7294            type Credentials = gaxi::options::Credentials;
7295            async fn build(
7296                self,
7297                config: gaxi::options::ClientConfig,
7298            ) -> gax::client_builder::Result<Self::Client> {
7299                Self::Client::new(config).await
7300            }
7301        }
7302    }
7303
7304    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7305    #[derive(Clone, Debug)]
7306    pub(crate) struct RequestBuilder<R: std::default::Default> {
7307        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7308        request: R,
7309        options: gax::options::RequestOptions,
7310    }
7311
7312    impl<R> RequestBuilder<R>
7313    where
7314        R: std::default::Default,
7315    {
7316        pub(crate) fn new(
7317            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7318        ) -> Self {
7319            Self {
7320                stub,
7321                request: R::default(),
7322                options: gax::options::RequestOptions::default(),
7323            }
7324        }
7325    }
7326
7327    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7328    ///
7329    /// # Example
7330    /// ```no_run
7331    /// # use google_cloud_discoveryengine_v1::builder;
7332    /// use builder::grounded_generation_service::GenerateGroundedContent;
7333    /// # tokio_test::block_on(async {
7334    ///
7335    /// let builder = prepare_request_builder();
7336    /// let response = builder.send().await?;
7337    /// # gax::Result::<()>::Ok(()) });
7338    ///
7339    /// fn prepare_request_builder() -> GenerateGroundedContent {
7340    ///   # panic!();
7341    ///   // ... details omitted ...
7342    /// }
7343    /// ```
7344    #[derive(Clone, Debug)]
7345    pub struct GenerateGroundedContent(
7346        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7347    );
7348
7349    impl GenerateGroundedContent {
7350        pub(crate) fn new(
7351            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7352        ) -> Self {
7353            Self(RequestBuilder::new(stub))
7354        }
7355
7356        /// Sets the full request, replacing any prior values.
7357        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7358            mut self,
7359            v: V,
7360        ) -> Self {
7361            self.0.request = v.into();
7362            self
7363        }
7364
7365        /// Sets all the options, replacing any prior values.
7366        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7367            self.0.options = v.into();
7368            self
7369        }
7370
7371        /// Sends the request.
7372        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7373            (*self.0.stub)
7374                .generate_grounded_content(self.0.request, self.0.options)
7375                .await
7376                .map(gax::response::Response::into_body)
7377        }
7378
7379        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7380        ///
7381        /// This is a **required** field for requests.
7382        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7383            self.0.request.location = v.into();
7384            self
7385        }
7386
7387        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7388        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7389        where
7390            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7391        {
7392            self.0.request.system_instruction = std::option::Option::Some(v.into());
7393            self
7394        }
7395
7396        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7397        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7398        where
7399            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7400        {
7401            self.0.request.system_instruction = v.map(|x| x.into());
7402            self
7403        }
7404
7405        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7406        pub fn set_contents<T, V>(mut self, v: T) -> Self
7407        where
7408            T: std::iter::IntoIterator<Item = V>,
7409            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7410        {
7411            use std::iter::Iterator;
7412            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7413            self
7414        }
7415
7416        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7417        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7418        where
7419            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7420        {
7421            self.0.request.generation_spec = std::option::Option::Some(v.into());
7422            self
7423        }
7424
7425        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7426        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7427        where
7428            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7429        {
7430            self.0.request.generation_spec = v.map(|x| x.into());
7431            self
7432        }
7433
7434        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7435        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7436        where
7437            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7438        {
7439            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7440            self
7441        }
7442
7443        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7444        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7445        where
7446            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7447        {
7448            self.0.request.grounding_spec = v.map(|x| x.into());
7449            self
7450        }
7451
7452        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7453        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7454        where
7455            T: std::iter::IntoIterator<Item = (K, V)>,
7456            K: std::convert::Into<std::string::String>,
7457            V: std::convert::Into<std::string::String>,
7458        {
7459            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7460            self
7461        }
7462    }
7463
7464    #[doc(hidden)]
7465    impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7466        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7467            &mut self.0.options
7468        }
7469    }
7470
7471    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7472    ///
7473    /// # Example
7474    /// ```no_run
7475    /// # use google_cloud_discoveryengine_v1::builder;
7476    /// use builder::grounded_generation_service::CheckGrounding;
7477    /// # tokio_test::block_on(async {
7478    ///
7479    /// let builder = prepare_request_builder();
7480    /// let response = builder.send().await?;
7481    /// # gax::Result::<()>::Ok(()) });
7482    ///
7483    /// fn prepare_request_builder() -> CheckGrounding {
7484    ///   # panic!();
7485    ///   // ... details omitted ...
7486    /// }
7487    /// ```
7488    #[derive(Clone, Debug)]
7489    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7490
7491    impl CheckGrounding {
7492        pub(crate) fn new(
7493            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7494        ) -> Self {
7495            Self(RequestBuilder::new(stub))
7496        }
7497
7498        /// Sets the full request, replacing any prior values.
7499        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7500            self.0.request = v.into();
7501            self
7502        }
7503
7504        /// Sets all the options, replacing any prior values.
7505        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7506            self.0.options = v.into();
7507            self
7508        }
7509
7510        /// Sends the request.
7511        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7512            (*self.0.stub)
7513                .check_grounding(self.0.request, self.0.options)
7514                .await
7515                .map(gax::response::Response::into_body)
7516        }
7517
7518        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7519        ///
7520        /// This is a **required** field for requests.
7521        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7522            self.0.request.grounding_config = v.into();
7523            self
7524        }
7525
7526        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7527        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7528            self.0.request.answer_candidate = v.into();
7529            self
7530        }
7531
7532        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7533        pub fn set_facts<T, V>(mut self, v: T) -> Self
7534        where
7535            T: std::iter::IntoIterator<Item = V>,
7536            V: std::convert::Into<crate::model::GroundingFact>,
7537        {
7538            use std::iter::Iterator;
7539            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7540            self
7541        }
7542
7543        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7544        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7545        where
7546            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7547        {
7548            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7549            self
7550        }
7551
7552        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7553        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7554        where
7555            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7556        {
7557            self.0.request.grounding_spec = v.map(|x| x.into());
7558            self
7559        }
7560
7561        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7562        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7563        where
7564            T: std::iter::IntoIterator<Item = (K, V)>,
7565            K: std::convert::Into<std::string::String>,
7566            V: std::convert::Into<std::string::String>,
7567        {
7568            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7569            self
7570        }
7571    }
7572
7573    #[doc(hidden)]
7574    impl gax::options::internal::RequestBuilder for CheckGrounding {
7575        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7576            &mut self.0.options
7577        }
7578    }
7579
7580    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7581    ///
7582    /// # Example
7583    /// ```no_run
7584    /// # use google_cloud_discoveryengine_v1::builder;
7585    /// use builder::grounded_generation_service::ListOperations;
7586    /// # tokio_test::block_on(async {
7587    /// use gax::paginator::ItemPaginator;
7588    ///
7589    /// let builder = prepare_request_builder();
7590    /// let mut items = builder.by_item();
7591    /// while let Some(result) = items.next().await {
7592    ///   let item = result?;
7593    /// }
7594    /// # gax::Result::<()>::Ok(()) });
7595    ///
7596    /// fn prepare_request_builder() -> ListOperations {
7597    ///   # panic!();
7598    ///   // ... details omitted ...
7599    /// }
7600    /// ```
7601    #[derive(Clone, Debug)]
7602    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7603
7604    impl ListOperations {
7605        pub(crate) fn new(
7606            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7607        ) -> Self {
7608            Self(RequestBuilder::new(stub))
7609        }
7610
7611        /// Sets the full request, replacing any prior values.
7612        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7613            mut self,
7614            v: V,
7615        ) -> Self {
7616            self.0.request = v.into();
7617            self
7618        }
7619
7620        /// Sets all the options, replacing any prior values.
7621        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7622            self.0.options = v.into();
7623            self
7624        }
7625
7626        /// Sends the request.
7627        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7628            (*self.0.stub)
7629                .list_operations(self.0.request, self.0.options)
7630                .await
7631                .map(gax::response::Response::into_body)
7632        }
7633
7634        /// Streams each page in the collection.
7635        pub fn by_page(
7636            self,
7637        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7638        {
7639            use std::clone::Clone;
7640            let token = self.0.request.page_token.clone();
7641            let execute = move |token: String| {
7642                let mut builder = self.clone();
7643                builder.0.request = builder.0.request.set_page_token(token);
7644                builder.send()
7645            };
7646            gax::paginator::internal::new_paginator(token, execute)
7647        }
7648
7649        /// Streams each item in the collection.
7650        pub fn by_item(
7651            self,
7652        ) -> impl gax::paginator::ItemPaginator<
7653            longrunning::model::ListOperationsResponse,
7654            gax::error::Error,
7655        > {
7656            use gax::paginator::Paginator;
7657            self.by_page().items()
7658        }
7659
7660        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7661        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7662            self.0.request.name = v.into();
7663            self
7664        }
7665
7666        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7667        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7668            self.0.request.filter = v.into();
7669            self
7670        }
7671
7672        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7673        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7674            self.0.request.page_size = v.into();
7675            self
7676        }
7677
7678        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7679        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7680            self.0.request.page_token = v.into();
7681            self
7682        }
7683    }
7684
7685    #[doc(hidden)]
7686    impl gax::options::internal::RequestBuilder for ListOperations {
7687        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7688            &mut self.0.options
7689        }
7690    }
7691
7692    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7693    ///
7694    /// # Example
7695    /// ```no_run
7696    /// # use google_cloud_discoveryengine_v1::builder;
7697    /// use builder::grounded_generation_service::GetOperation;
7698    /// # tokio_test::block_on(async {
7699    ///
7700    /// let builder = prepare_request_builder();
7701    /// let response = builder.send().await?;
7702    /// # gax::Result::<()>::Ok(()) });
7703    ///
7704    /// fn prepare_request_builder() -> GetOperation {
7705    ///   # panic!();
7706    ///   // ... details omitted ...
7707    /// }
7708    /// ```
7709    #[derive(Clone, Debug)]
7710    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7711
7712    impl GetOperation {
7713        pub(crate) fn new(
7714            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7715        ) -> Self {
7716            Self(RequestBuilder::new(stub))
7717        }
7718
7719        /// Sets the full request, replacing any prior values.
7720        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7721            mut self,
7722            v: V,
7723        ) -> Self {
7724            self.0.request = v.into();
7725            self
7726        }
7727
7728        /// Sets all the options, replacing any prior values.
7729        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7730            self.0.options = v.into();
7731            self
7732        }
7733
7734        /// Sends the request.
7735        pub async fn send(self) -> Result<longrunning::model::Operation> {
7736            (*self.0.stub)
7737                .get_operation(self.0.request, self.0.options)
7738                .await
7739                .map(gax::response::Response::into_body)
7740        }
7741
7742        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7743        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7744            self.0.request.name = v.into();
7745            self
7746        }
7747    }
7748
7749    #[doc(hidden)]
7750    impl gax::options::internal::RequestBuilder for GetOperation {
7751        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7752            &mut self.0.options
7753        }
7754    }
7755
7756    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7757    ///
7758    /// # Example
7759    /// ```no_run
7760    /// # use google_cloud_discoveryengine_v1::builder;
7761    /// use builder::grounded_generation_service::CancelOperation;
7762    /// # tokio_test::block_on(async {
7763    ///
7764    /// let builder = prepare_request_builder();
7765    /// let response = builder.send().await?;
7766    /// # gax::Result::<()>::Ok(()) });
7767    ///
7768    /// fn prepare_request_builder() -> CancelOperation {
7769    ///   # panic!();
7770    ///   // ... details omitted ...
7771    /// }
7772    /// ```
7773    #[derive(Clone, Debug)]
7774    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7775
7776    impl CancelOperation {
7777        pub(crate) fn new(
7778            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7779        ) -> Self {
7780            Self(RequestBuilder::new(stub))
7781        }
7782
7783        /// Sets the full request, replacing any prior values.
7784        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7785            mut self,
7786            v: V,
7787        ) -> Self {
7788            self.0.request = v.into();
7789            self
7790        }
7791
7792        /// Sets all the options, replacing any prior values.
7793        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7794            self.0.options = v.into();
7795            self
7796        }
7797
7798        /// Sends the request.
7799        pub async fn send(self) -> Result<()> {
7800            (*self.0.stub)
7801                .cancel_operation(self.0.request, self.0.options)
7802                .await
7803                .map(gax::response::Response::into_body)
7804        }
7805
7806        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7807        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7808            self.0.request.name = v.into();
7809            self
7810        }
7811    }
7812
7813    #[doc(hidden)]
7814    impl gax::options::internal::RequestBuilder for CancelOperation {
7815        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7816            &mut self.0.options
7817        }
7818    }
7819}
7820
7821#[cfg(feature = "identity-mapping-store-service")]
7822#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7823pub mod identity_mapping_store_service {
7824    use crate::Result;
7825
7826    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7827    ///
7828    /// ```
7829    /// # tokio_test::block_on(async {
7830    /// # use google_cloud_discoveryengine_v1::*;
7831    /// # use builder::identity_mapping_store_service::ClientBuilder;
7832    /// # use client::IdentityMappingStoreService;
7833    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
7834    /// let client = builder
7835    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7836    ///     .build().await?;
7837    /// # gax::client_builder::Result::<()>::Ok(()) });
7838    /// ```
7839    pub type ClientBuilder =
7840        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7841
7842    pub(crate) mod client {
7843        use super::super::super::client::IdentityMappingStoreService;
7844        pub struct Factory;
7845        impl gax::client_builder::internal::ClientFactory for Factory {
7846            type Client = IdentityMappingStoreService;
7847            type Credentials = gaxi::options::Credentials;
7848            async fn build(
7849                self,
7850                config: gaxi::options::ClientConfig,
7851            ) -> gax::client_builder::Result<Self::Client> {
7852                Self::Client::new(config).await
7853            }
7854        }
7855    }
7856
7857    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
7858    #[derive(Clone, Debug)]
7859    pub(crate) struct RequestBuilder<R: std::default::Default> {
7860        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7861        request: R,
7862        options: gax::options::RequestOptions,
7863    }
7864
7865    impl<R> RequestBuilder<R>
7866    where
7867        R: std::default::Default,
7868    {
7869        pub(crate) fn new(
7870            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7871        ) -> Self {
7872            Self {
7873                stub,
7874                request: R::default(),
7875                options: gax::options::RequestOptions::default(),
7876            }
7877        }
7878    }
7879
7880    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
7881    ///
7882    /// # Example
7883    /// ```no_run
7884    /// # use google_cloud_discoveryengine_v1::builder;
7885    /// use builder::identity_mapping_store_service::CreateIdentityMappingStore;
7886    /// # tokio_test::block_on(async {
7887    ///
7888    /// let builder = prepare_request_builder();
7889    /// let response = builder.send().await?;
7890    /// # gax::Result::<()>::Ok(()) });
7891    ///
7892    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
7893    ///   # panic!();
7894    ///   // ... details omitted ...
7895    /// }
7896    /// ```
7897    #[derive(Clone, Debug)]
7898    pub struct CreateIdentityMappingStore(
7899        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7900    );
7901
7902    impl CreateIdentityMappingStore {
7903        pub(crate) fn new(
7904            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7905        ) -> Self {
7906            Self(RequestBuilder::new(stub))
7907        }
7908
7909        /// Sets the full request, replacing any prior values.
7910        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7911            mut self,
7912            v: V,
7913        ) -> Self {
7914            self.0.request = v.into();
7915            self
7916        }
7917
7918        /// Sets all the options, replacing any prior values.
7919        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7920            self.0.options = v.into();
7921            self
7922        }
7923
7924        /// Sends the request.
7925        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7926            (*self.0.stub)
7927                .create_identity_mapping_store(self.0.request, self.0.options)
7928                .await
7929                .map(gax::response::Response::into_body)
7930        }
7931
7932        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
7933        ///
7934        /// This is a **required** field for requests.
7935        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7936            self.0.request.parent = v.into();
7937            self
7938        }
7939
7940        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
7941        ///
7942        /// This is a **required** field for requests.
7943        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7944            self.0.request.identity_mapping_store_id = v.into();
7945            self
7946        }
7947
7948        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
7949        ///
7950        /// This is a **required** field for requests.
7951        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
7952        where
7953            T: std::convert::Into<crate::model::IdentityMappingStore>,
7954        {
7955            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
7956            self
7957        }
7958
7959        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
7960        ///
7961        /// This is a **required** field for requests.
7962        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
7963        where
7964            T: std::convert::Into<crate::model::IdentityMappingStore>,
7965        {
7966            self.0.request.identity_mapping_store = v.map(|x| x.into());
7967            self
7968        }
7969
7970        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
7971        ///
7972        /// Note that all the setters affecting `cmek_options` are
7973        /// mutually exclusive.
7974        pub fn set_cmek_options<
7975            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
7976        >(
7977            mut self,
7978            v: T,
7979        ) -> Self {
7980            self.0.request.cmek_options = v.into();
7981            self
7982        }
7983
7984        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
7985        /// to hold a `CmekConfigName`.
7986        ///
7987        /// Note that all the setters affecting `cmek_options` are
7988        /// mutually exclusive.
7989        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
7990            mut self,
7991            v: T,
7992        ) -> Self {
7993            self.0.request = self.0.request.set_cmek_config_name(v);
7994            self
7995        }
7996
7997        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
7998        /// to hold a `DisableCmek`.
7999        ///
8000        /// Note that all the setters affecting `cmek_options` are
8001        /// mutually exclusive.
8002        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8003            self.0.request = self.0.request.set_disable_cmek(v);
8004            self
8005        }
8006    }
8007
8008    #[doc(hidden)]
8009    impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
8010        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8011            &mut self.0.options
8012        }
8013    }
8014
8015    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8016    ///
8017    /// # Example
8018    /// ```no_run
8019    /// # use google_cloud_discoveryengine_v1::builder;
8020    /// use builder::identity_mapping_store_service::GetIdentityMappingStore;
8021    /// # tokio_test::block_on(async {
8022    ///
8023    /// let builder = prepare_request_builder();
8024    /// let response = builder.send().await?;
8025    /// # gax::Result::<()>::Ok(()) });
8026    ///
8027    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8028    ///   # panic!();
8029    ///   // ... details omitted ...
8030    /// }
8031    /// ```
8032    #[derive(Clone, Debug)]
8033    pub struct GetIdentityMappingStore(
8034        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8035    );
8036
8037    impl GetIdentityMappingStore {
8038        pub(crate) fn new(
8039            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8040        ) -> Self {
8041            Self(RequestBuilder::new(stub))
8042        }
8043
8044        /// Sets the full request, replacing any prior values.
8045        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8046            mut self,
8047            v: V,
8048        ) -> Self {
8049            self.0.request = v.into();
8050            self
8051        }
8052
8053        /// Sets all the options, replacing any prior values.
8054        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8055            self.0.options = v.into();
8056            self
8057        }
8058
8059        /// Sends the request.
8060        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8061            (*self.0.stub)
8062                .get_identity_mapping_store(self.0.request, self.0.options)
8063                .await
8064                .map(gax::response::Response::into_body)
8065        }
8066
8067        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8068        ///
8069        /// This is a **required** field for requests.
8070        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8071            self.0.request.name = v.into();
8072            self
8073        }
8074    }
8075
8076    #[doc(hidden)]
8077    impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8078        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8079            &mut self.0.options
8080        }
8081    }
8082
8083    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8084    ///
8085    /// # Example
8086    /// ```no_run
8087    /// # use google_cloud_discoveryengine_v1::builder;
8088    /// use builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8089    /// # tokio_test::block_on(async {
8090    /// use lro::Poller;
8091    ///
8092    /// let builder = prepare_request_builder();
8093    /// let response = builder.poller().until_done().await?;
8094    /// # gax::Result::<()>::Ok(()) });
8095    ///
8096    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8097    ///   # panic!();
8098    ///   // ... details omitted ...
8099    /// }
8100    /// ```
8101    #[derive(Clone, Debug)]
8102    pub struct DeleteIdentityMappingStore(
8103        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8104    );
8105
8106    impl DeleteIdentityMappingStore {
8107        pub(crate) fn new(
8108            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8109        ) -> Self {
8110            Self(RequestBuilder::new(stub))
8111        }
8112
8113        /// Sets the full request, replacing any prior values.
8114        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8115            mut self,
8116            v: V,
8117        ) -> Self {
8118            self.0.request = v.into();
8119            self
8120        }
8121
8122        /// Sets all the options, replacing any prior values.
8123        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8124            self.0.options = v.into();
8125            self
8126        }
8127
8128        /// Sends the request.
8129        ///
8130        /// # Long running operations
8131        ///
8132        /// This starts, but does not poll, a longrunning operation. More information
8133        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8134        pub async fn send(self) -> Result<longrunning::model::Operation> {
8135            (*self.0.stub)
8136                .delete_identity_mapping_store(self.0.request, self.0.options)
8137                .await
8138                .map(gax::response::Response::into_body)
8139        }
8140
8141        /// Creates a [Poller][lro::Poller] to work with `delete_identity_mapping_store`.
8142        pub fn poller(
8143            self,
8144        ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8145            type Operation = lro::internal::Operation<
8146                wkt::Empty,
8147                crate::model::DeleteIdentityMappingStoreMetadata,
8148            >;
8149            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8150            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8151
8152            let stub = self.0.stub.clone();
8153            let mut options = self.0.options.clone();
8154            options.set_retry_policy(gax::retry_policy::NeverRetry);
8155            let query = move |name| {
8156                let stub = stub.clone();
8157                let options = options.clone();
8158                async {
8159                    let op = GetOperation::new(stub)
8160                        .set_name(name)
8161                        .with_options(options)
8162                        .send()
8163                        .await?;
8164                    Ok(Operation::new(op))
8165                }
8166            };
8167
8168            let start = move || async {
8169                let op = self.send().await?;
8170                Ok(Operation::new(op))
8171            };
8172
8173            lro::internal::new_unit_response_poller(
8174                polling_error_policy,
8175                polling_backoff_policy,
8176                start,
8177                query,
8178            )
8179        }
8180
8181        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8182        ///
8183        /// This is a **required** field for requests.
8184        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8185            self.0.request.name = v.into();
8186            self
8187        }
8188    }
8189
8190    #[doc(hidden)]
8191    impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8192        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8193            &mut self.0.options
8194        }
8195    }
8196
8197    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8198    ///
8199    /// # Example
8200    /// ```no_run
8201    /// # use google_cloud_discoveryengine_v1::builder;
8202    /// use builder::identity_mapping_store_service::ImportIdentityMappings;
8203    /// # tokio_test::block_on(async {
8204    /// use lro::Poller;
8205    ///
8206    /// let builder = prepare_request_builder();
8207    /// let response = builder.poller().until_done().await?;
8208    /// # gax::Result::<()>::Ok(()) });
8209    ///
8210    /// fn prepare_request_builder() -> ImportIdentityMappings {
8211    ///   # panic!();
8212    ///   // ... details omitted ...
8213    /// }
8214    /// ```
8215    #[derive(Clone, Debug)]
8216    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8217
8218    impl ImportIdentityMappings {
8219        pub(crate) fn new(
8220            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8221        ) -> Self {
8222            Self(RequestBuilder::new(stub))
8223        }
8224
8225        /// Sets the full request, replacing any prior values.
8226        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8227            mut self,
8228            v: V,
8229        ) -> Self {
8230            self.0.request = v.into();
8231            self
8232        }
8233
8234        /// Sets all the options, replacing any prior values.
8235        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8236            self.0.options = v.into();
8237            self
8238        }
8239
8240        /// Sends the request.
8241        ///
8242        /// # Long running operations
8243        ///
8244        /// This starts, but does not poll, a longrunning operation. More information
8245        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8246        pub async fn send(self) -> Result<longrunning::model::Operation> {
8247            (*self.0.stub)
8248                .import_identity_mappings(self.0.request, self.0.options)
8249                .await
8250                .map(gax::response::Response::into_body)
8251        }
8252
8253        /// Creates a [Poller][lro::Poller] to work with `import_identity_mappings`.
8254        pub fn poller(
8255            self,
8256        ) -> impl lro::Poller<
8257            crate::model::ImportIdentityMappingsResponse,
8258            crate::model::IdentityMappingEntryOperationMetadata,
8259        > {
8260            type Operation = lro::internal::Operation<
8261                crate::model::ImportIdentityMappingsResponse,
8262                crate::model::IdentityMappingEntryOperationMetadata,
8263            >;
8264            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8265            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8266
8267            let stub = self.0.stub.clone();
8268            let mut options = self.0.options.clone();
8269            options.set_retry_policy(gax::retry_policy::NeverRetry);
8270            let query = move |name| {
8271                let stub = stub.clone();
8272                let options = options.clone();
8273                async {
8274                    let op = GetOperation::new(stub)
8275                        .set_name(name)
8276                        .with_options(options)
8277                        .send()
8278                        .await?;
8279                    Ok(Operation::new(op))
8280                }
8281            };
8282
8283            let start = move || async {
8284                let op = self.send().await?;
8285                Ok(Operation::new(op))
8286            };
8287
8288            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8289        }
8290
8291        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8292        ///
8293        /// This is a **required** field for requests.
8294        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8295            self.0.request.identity_mapping_store = v.into();
8296            self
8297        }
8298
8299        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8300        ///
8301        /// Note that all the setters affecting `source` are
8302        /// mutually exclusive.
8303        pub fn set_source<
8304            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8305        >(
8306            mut self,
8307            v: T,
8308        ) -> Self {
8309            self.0.request.source = v.into();
8310            self
8311        }
8312
8313        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8314        /// to hold a `InlineSource`.
8315        ///
8316        /// Note that all the setters affecting `source` are
8317        /// mutually exclusive.
8318        pub fn set_inline_source<
8319            T: std::convert::Into<
8320                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8321                >,
8322        >(
8323            mut self,
8324            v: T,
8325        ) -> Self {
8326            self.0.request = self.0.request.set_inline_source(v);
8327            self
8328        }
8329    }
8330
8331    #[doc(hidden)]
8332    impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8333        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8334            &mut self.0.options
8335        }
8336    }
8337
8338    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8339    ///
8340    /// # Example
8341    /// ```no_run
8342    /// # use google_cloud_discoveryengine_v1::builder;
8343    /// use builder::identity_mapping_store_service::PurgeIdentityMappings;
8344    /// # tokio_test::block_on(async {
8345    /// use lro::Poller;
8346    ///
8347    /// let builder = prepare_request_builder();
8348    /// let response = builder.poller().until_done().await?;
8349    /// # gax::Result::<()>::Ok(()) });
8350    ///
8351    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8352    ///   # panic!();
8353    ///   // ... details omitted ...
8354    /// }
8355    /// ```
8356    #[derive(Clone, Debug)]
8357    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8358
8359    impl PurgeIdentityMappings {
8360        pub(crate) fn new(
8361            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8362        ) -> Self {
8363            Self(RequestBuilder::new(stub))
8364        }
8365
8366        /// Sets the full request, replacing any prior values.
8367        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8368            mut self,
8369            v: V,
8370        ) -> Self {
8371            self.0.request = v.into();
8372            self
8373        }
8374
8375        /// Sets all the options, replacing any prior values.
8376        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8377            self.0.options = v.into();
8378            self
8379        }
8380
8381        /// Sends the request.
8382        ///
8383        /// # Long running operations
8384        ///
8385        /// This starts, but does not poll, a longrunning operation. More information
8386        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8387        pub async fn send(self) -> Result<longrunning::model::Operation> {
8388            (*self.0.stub)
8389                .purge_identity_mappings(self.0.request, self.0.options)
8390                .await
8391                .map(gax::response::Response::into_body)
8392        }
8393
8394        /// Creates a [Poller][lro::Poller] to work with `purge_identity_mappings`.
8395        pub fn poller(
8396            self,
8397        ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8398            type Operation = lro::internal::Operation<
8399                wkt::Empty,
8400                crate::model::IdentityMappingEntryOperationMetadata,
8401            >;
8402            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8403            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8404
8405            let stub = self.0.stub.clone();
8406            let mut options = self.0.options.clone();
8407            options.set_retry_policy(gax::retry_policy::NeverRetry);
8408            let query = move |name| {
8409                let stub = stub.clone();
8410                let options = options.clone();
8411                async {
8412                    let op = GetOperation::new(stub)
8413                        .set_name(name)
8414                        .with_options(options)
8415                        .send()
8416                        .await?;
8417                    Ok(Operation::new(op))
8418                }
8419            };
8420
8421            let start = move || async {
8422                let op = self.send().await?;
8423                Ok(Operation::new(op))
8424            };
8425
8426            lro::internal::new_unit_response_poller(
8427                polling_error_policy,
8428                polling_backoff_policy,
8429                start,
8430                query,
8431            )
8432        }
8433
8434        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8435        ///
8436        /// This is a **required** field for requests.
8437        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8438            self.0.request.identity_mapping_store = v.into();
8439            self
8440        }
8441
8442        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8443        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8444            self.0.request.filter = v.into();
8445            self
8446        }
8447
8448        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8449        pub fn set_force<T>(mut self, v: T) -> Self
8450        where
8451            T: std::convert::Into<bool>,
8452        {
8453            self.0.request.force = std::option::Option::Some(v.into());
8454            self
8455        }
8456
8457        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8458        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8459        where
8460            T: std::convert::Into<bool>,
8461        {
8462            self.0.request.force = v.map(|x| x.into());
8463            self
8464        }
8465
8466        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8467        ///
8468        /// Note that all the setters affecting `source` are
8469        /// mutually exclusive.
8470        pub fn set_source<
8471            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8472        >(
8473            mut self,
8474            v: T,
8475        ) -> Self {
8476            self.0.request.source = v.into();
8477            self
8478        }
8479
8480        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8481        /// to hold a `InlineSource`.
8482        ///
8483        /// Note that all the setters affecting `source` are
8484        /// mutually exclusive.
8485        pub fn set_inline_source<
8486            T: std::convert::Into<
8487                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8488                >,
8489        >(
8490            mut self,
8491            v: T,
8492        ) -> Self {
8493            self.0.request = self.0.request.set_inline_source(v);
8494            self
8495        }
8496    }
8497
8498    #[doc(hidden)]
8499    impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8500        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8501            &mut self.0.options
8502        }
8503    }
8504
8505    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8506    ///
8507    /// # Example
8508    /// ```no_run
8509    /// # use google_cloud_discoveryengine_v1::builder;
8510    /// use builder::identity_mapping_store_service::ListIdentityMappings;
8511    /// # tokio_test::block_on(async {
8512    /// use gax::paginator::ItemPaginator;
8513    ///
8514    /// let builder = prepare_request_builder();
8515    /// let mut items = builder.by_item();
8516    /// while let Some(result) = items.next().await {
8517    ///   let item = result?;
8518    /// }
8519    /// # gax::Result::<()>::Ok(()) });
8520    ///
8521    /// fn prepare_request_builder() -> ListIdentityMappings {
8522    ///   # panic!();
8523    ///   // ... details omitted ...
8524    /// }
8525    /// ```
8526    #[derive(Clone, Debug)]
8527    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8528
8529    impl ListIdentityMappings {
8530        pub(crate) fn new(
8531            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8532        ) -> Self {
8533            Self(RequestBuilder::new(stub))
8534        }
8535
8536        /// Sets the full request, replacing any prior values.
8537        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8538            mut self,
8539            v: V,
8540        ) -> Self {
8541            self.0.request = v.into();
8542            self
8543        }
8544
8545        /// Sets all the options, replacing any prior values.
8546        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8547            self.0.options = v.into();
8548            self
8549        }
8550
8551        /// Sends the request.
8552        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8553            (*self.0.stub)
8554                .list_identity_mappings(self.0.request, self.0.options)
8555                .await
8556                .map(gax::response::Response::into_body)
8557        }
8558
8559        /// Streams each page in the collection.
8560        pub fn by_page(
8561            self,
8562        ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8563        {
8564            use std::clone::Clone;
8565            let token = self.0.request.page_token.clone();
8566            let execute = move |token: String| {
8567                let mut builder = self.clone();
8568                builder.0.request = builder.0.request.set_page_token(token);
8569                builder.send()
8570            };
8571            gax::paginator::internal::new_paginator(token, execute)
8572        }
8573
8574        /// Streams each item in the collection.
8575        pub fn by_item(
8576            self,
8577        ) -> impl gax::paginator::ItemPaginator<
8578            crate::model::ListIdentityMappingsResponse,
8579            gax::error::Error,
8580        > {
8581            use gax::paginator::Paginator;
8582            self.by_page().items()
8583        }
8584
8585        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8586        ///
8587        /// This is a **required** field for requests.
8588        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8589            self.0.request.identity_mapping_store = v.into();
8590            self
8591        }
8592
8593        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8594        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8595            self.0.request.page_size = v.into();
8596            self
8597        }
8598
8599        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8600        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8601            self.0.request.page_token = v.into();
8602            self
8603        }
8604    }
8605
8606    #[doc(hidden)]
8607    impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8608        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8609            &mut self.0.options
8610        }
8611    }
8612
8613    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8614    ///
8615    /// # Example
8616    /// ```no_run
8617    /// # use google_cloud_discoveryengine_v1::builder;
8618    /// use builder::identity_mapping_store_service::ListIdentityMappingStores;
8619    /// # tokio_test::block_on(async {
8620    /// use gax::paginator::ItemPaginator;
8621    ///
8622    /// let builder = prepare_request_builder();
8623    /// let mut items = builder.by_item();
8624    /// while let Some(result) = items.next().await {
8625    ///   let item = result?;
8626    /// }
8627    /// # gax::Result::<()>::Ok(()) });
8628    ///
8629    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8630    ///   # panic!();
8631    ///   // ... details omitted ...
8632    /// }
8633    /// ```
8634    #[derive(Clone, Debug)]
8635    pub struct ListIdentityMappingStores(
8636        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8637    );
8638
8639    impl ListIdentityMappingStores {
8640        pub(crate) fn new(
8641            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8642        ) -> Self {
8643            Self(RequestBuilder::new(stub))
8644        }
8645
8646        /// Sets the full request, replacing any prior values.
8647        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8648            mut self,
8649            v: V,
8650        ) -> Self {
8651            self.0.request = v.into();
8652            self
8653        }
8654
8655        /// Sets all the options, replacing any prior values.
8656        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8657            self.0.options = v.into();
8658            self
8659        }
8660
8661        /// Sends the request.
8662        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8663            (*self.0.stub)
8664                .list_identity_mapping_stores(self.0.request, self.0.options)
8665                .await
8666                .map(gax::response::Response::into_body)
8667        }
8668
8669        /// Streams each page in the collection.
8670        pub fn by_page(
8671            self,
8672        ) -> impl gax::paginator::Paginator<
8673            crate::model::ListIdentityMappingStoresResponse,
8674            gax::error::Error,
8675        > {
8676            use std::clone::Clone;
8677            let token = self.0.request.page_token.clone();
8678            let execute = move |token: String| {
8679                let mut builder = self.clone();
8680                builder.0.request = builder.0.request.set_page_token(token);
8681                builder.send()
8682            };
8683            gax::paginator::internal::new_paginator(token, execute)
8684        }
8685
8686        /// Streams each item in the collection.
8687        pub fn by_item(
8688            self,
8689        ) -> impl gax::paginator::ItemPaginator<
8690            crate::model::ListIdentityMappingStoresResponse,
8691            gax::error::Error,
8692        > {
8693            use gax::paginator::Paginator;
8694            self.by_page().items()
8695        }
8696
8697        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8698        ///
8699        /// This is a **required** field for requests.
8700        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8701            self.0.request.parent = v.into();
8702            self
8703        }
8704
8705        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8706        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8707            self.0.request.page_size = v.into();
8708            self
8709        }
8710
8711        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8712        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8713            self.0.request.page_token = v.into();
8714            self
8715        }
8716    }
8717
8718    #[doc(hidden)]
8719    impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8720        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8721            &mut self.0.options
8722        }
8723    }
8724
8725    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8726    ///
8727    /// # Example
8728    /// ```no_run
8729    /// # use google_cloud_discoveryengine_v1::builder;
8730    /// use builder::identity_mapping_store_service::ListOperations;
8731    /// # tokio_test::block_on(async {
8732    /// use gax::paginator::ItemPaginator;
8733    ///
8734    /// let builder = prepare_request_builder();
8735    /// let mut items = builder.by_item();
8736    /// while let Some(result) = items.next().await {
8737    ///   let item = result?;
8738    /// }
8739    /// # gax::Result::<()>::Ok(()) });
8740    ///
8741    /// fn prepare_request_builder() -> ListOperations {
8742    ///   # panic!();
8743    ///   // ... details omitted ...
8744    /// }
8745    /// ```
8746    #[derive(Clone, Debug)]
8747    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8748
8749    impl ListOperations {
8750        pub(crate) fn new(
8751            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8752        ) -> Self {
8753            Self(RequestBuilder::new(stub))
8754        }
8755
8756        /// Sets the full request, replacing any prior values.
8757        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8758            mut self,
8759            v: V,
8760        ) -> Self {
8761            self.0.request = v.into();
8762            self
8763        }
8764
8765        /// Sets all the options, replacing any prior values.
8766        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8767            self.0.options = v.into();
8768            self
8769        }
8770
8771        /// Sends the request.
8772        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8773            (*self.0.stub)
8774                .list_operations(self.0.request, self.0.options)
8775                .await
8776                .map(gax::response::Response::into_body)
8777        }
8778
8779        /// Streams each page in the collection.
8780        pub fn by_page(
8781            self,
8782        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8783        {
8784            use std::clone::Clone;
8785            let token = self.0.request.page_token.clone();
8786            let execute = move |token: String| {
8787                let mut builder = self.clone();
8788                builder.0.request = builder.0.request.set_page_token(token);
8789                builder.send()
8790            };
8791            gax::paginator::internal::new_paginator(token, execute)
8792        }
8793
8794        /// Streams each item in the collection.
8795        pub fn by_item(
8796            self,
8797        ) -> impl gax::paginator::ItemPaginator<
8798            longrunning::model::ListOperationsResponse,
8799            gax::error::Error,
8800        > {
8801            use gax::paginator::Paginator;
8802            self.by_page().items()
8803        }
8804
8805        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
8806        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8807            self.0.request.name = v.into();
8808            self
8809        }
8810
8811        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
8812        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8813            self.0.request.filter = v.into();
8814            self
8815        }
8816
8817        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
8818        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8819            self.0.request.page_size = v.into();
8820            self
8821        }
8822
8823        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
8824        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8825            self.0.request.page_token = v.into();
8826            self
8827        }
8828    }
8829
8830    #[doc(hidden)]
8831    impl gax::options::internal::RequestBuilder for ListOperations {
8832        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8833            &mut self.0.options
8834        }
8835    }
8836
8837    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
8838    ///
8839    /// # Example
8840    /// ```no_run
8841    /// # use google_cloud_discoveryengine_v1::builder;
8842    /// use builder::identity_mapping_store_service::GetOperation;
8843    /// # tokio_test::block_on(async {
8844    ///
8845    /// let builder = prepare_request_builder();
8846    /// let response = builder.send().await?;
8847    /// # gax::Result::<()>::Ok(()) });
8848    ///
8849    /// fn prepare_request_builder() -> GetOperation {
8850    ///   # panic!();
8851    ///   // ... details omitted ...
8852    /// }
8853    /// ```
8854    #[derive(Clone, Debug)]
8855    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8856
8857    impl GetOperation {
8858        pub(crate) fn new(
8859            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8860        ) -> Self {
8861            Self(RequestBuilder::new(stub))
8862        }
8863
8864        /// Sets the full request, replacing any prior values.
8865        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8866            mut self,
8867            v: V,
8868        ) -> Self {
8869            self.0.request = v.into();
8870            self
8871        }
8872
8873        /// Sets all the options, replacing any prior values.
8874        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8875            self.0.options = v.into();
8876            self
8877        }
8878
8879        /// Sends the request.
8880        pub async fn send(self) -> Result<longrunning::model::Operation> {
8881            (*self.0.stub)
8882                .get_operation(self.0.request, self.0.options)
8883                .await
8884                .map(gax::response::Response::into_body)
8885        }
8886
8887        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8888        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8889            self.0.request.name = v.into();
8890            self
8891        }
8892    }
8893
8894    #[doc(hidden)]
8895    impl gax::options::internal::RequestBuilder for GetOperation {
8896        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8897            &mut self.0.options
8898        }
8899    }
8900
8901    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
8902    ///
8903    /// # Example
8904    /// ```no_run
8905    /// # use google_cloud_discoveryengine_v1::builder;
8906    /// use builder::identity_mapping_store_service::CancelOperation;
8907    /// # tokio_test::block_on(async {
8908    ///
8909    /// let builder = prepare_request_builder();
8910    /// let response = builder.send().await?;
8911    /// # gax::Result::<()>::Ok(()) });
8912    ///
8913    /// fn prepare_request_builder() -> CancelOperation {
8914    ///   # panic!();
8915    ///   // ... details omitted ...
8916    /// }
8917    /// ```
8918    #[derive(Clone, Debug)]
8919    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8920
8921    impl CancelOperation {
8922        pub(crate) fn new(
8923            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8924        ) -> Self {
8925            Self(RequestBuilder::new(stub))
8926        }
8927
8928        /// Sets the full request, replacing any prior values.
8929        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8930            mut self,
8931            v: V,
8932        ) -> Self {
8933            self.0.request = v.into();
8934            self
8935        }
8936
8937        /// Sets all the options, replacing any prior values.
8938        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8939            self.0.options = v.into();
8940            self
8941        }
8942
8943        /// Sends the request.
8944        pub async fn send(self) -> Result<()> {
8945            (*self.0.stub)
8946                .cancel_operation(self.0.request, self.0.options)
8947                .await
8948                .map(gax::response::Response::into_body)
8949        }
8950
8951        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
8952        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8953            self.0.request.name = v.into();
8954            self
8955        }
8956    }
8957
8958    #[doc(hidden)]
8959    impl gax::options::internal::RequestBuilder for CancelOperation {
8960        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8961            &mut self.0.options
8962        }
8963    }
8964}
8965
8966#[cfg(feature = "project-service")]
8967#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
8968pub mod project_service {
8969    use crate::Result;
8970
8971    /// A builder for [ProjectService][crate::client::ProjectService].
8972    ///
8973    /// ```
8974    /// # tokio_test::block_on(async {
8975    /// # use google_cloud_discoveryengine_v1::*;
8976    /// # use builder::project_service::ClientBuilder;
8977    /// # use client::ProjectService;
8978    /// let builder : ClientBuilder = ProjectService::builder();
8979    /// let client = builder
8980    ///     .with_endpoint("https://discoveryengine.googleapis.com")
8981    ///     .build().await?;
8982    /// # gax::client_builder::Result::<()>::Ok(()) });
8983    /// ```
8984    pub type ClientBuilder =
8985        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8986
8987    pub(crate) mod client {
8988        use super::super::super::client::ProjectService;
8989        pub struct Factory;
8990        impl gax::client_builder::internal::ClientFactory for Factory {
8991            type Client = ProjectService;
8992            type Credentials = gaxi::options::Credentials;
8993            async fn build(
8994                self,
8995                config: gaxi::options::ClientConfig,
8996            ) -> gax::client_builder::Result<Self::Client> {
8997                Self::Client::new(config).await
8998            }
8999        }
9000    }
9001
9002    /// Common implementation for [crate::client::ProjectService] request builders.
9003    #[derive(Clone, Debug)]
9004    pub(crate) struct RequestBuilder<R: std::default::Default> {
9005        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9006        request: R,
9007        options: gax::options::RequestOptions,
9008    }
9009
9010    impl<R> RequestBuilder<R>
9011    where
9012        R: std::default::Default,
9013    {
9014        pub(crate) fn new(
9015            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9016        ) -> Self {
9017            Self {
9018                stub,
9019                request: R::default(),
9020                options: gax::options::RequestOptions::default(),
9021            }
9022        }
9023    }
9024
9025    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9026    ///
9027    /// # Example
9028    /// ```no_run
9029    /// # use google_cloud_discoveryengine_v1::builder;
9030    /// use builder::project_service::ProvisionProject;
9031    /// # tokio_test::block_on(async {
9032    /// use lro::Poller;
9033    ///
9034    /// let builder = prepare_request_builder();
9035    /// let response = builder.poller().until_done().await?;
9036    /// # gax::Result::<()>::Ok(()) });
9037    ///
9038    /// fn prepare_request_builder() -> ProvisionProject {
9039    ///   # panic!();
9040    ///   // ... details omitted ...
9041    /// }
9042    /// ```
9043    #[derive(Clone, Debug)]
9044    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9045
9046    impl ProvisionProject {
9047        pub(crate) fn new(
9048            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9049        ) -> Self {
9050            Self(RequestBuilder::new(stub))
9051        }
9052
9053        /// Sets the full request, replacing any prior values.
9054        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9055            mut self,
9056            v: V,
9057        ) -> Self {
9058            self.0.request = v.into();
9059            self
9060        }
9061
9062        /// Sets all the options, replacing any prior values.
9063        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9064            self.0.options = v.into();
9065            self
9066        }
9067
9068        /// Sends the request.
9069        ///
9070        /// # Long running operations
9071        ///
9072        /// This starts, but does not poll, a longrunning operation. More information
9073        /// on [provision_project][crate::client::ProjectService::provision_project].
9074        pub async fn send(self) -> Result<longrunning::model::Operation> {
9075            (*self.0.stub)
9076                .provision_project(self.0.request, self.0.options)
9077                .await
9078                .map(gax::response::Response::into_body)
9079        }
9080
9081        /// Creates a [Poller][lro::Poller] to work with `provision_project`.
9082        pub fn poller(
9083            self,
9084        ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9085        {
9086            type Operation = lro::internal::Operation<
9087                crate::model::Project,
9088                crate::model::ProvisionProjectMetadata,
9089            >;
9090            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9091            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9092
9093            let stub = self.0.stub.clone();
9094            let mut options = self.0.options.clone();
9095            options.set_retry_policy(gax::retry_policy::NeverRetry);
9096            let query = move |name| {
9097                let stub = stub.clone();
9098                let options = options.clone();
9099                async {
9100                    let op = GetOperation::new(stub)
9101                        .set_name(name)
9102                        .with_options(options)
9103                        .send()
9104                        .await?;
9105                    Ok(Operation::new(op))
9106                }
9107            };
9108
9109            let start = move || async {
9110                let op = self.send().await?;
9111                Ok(Operation::new(op))
9112            };
9113
9114            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9115        }
9116
9117        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9118        ///
9119        /// This is a **required** field for requests.
9120        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9121            self.0.request.name = v.into();
9122            self
9123        }
9124
9125        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9126        ///
9127        /// This is a **required** field for requests.
9128        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9129            self.0.request.accept_data_use_terms = v.into();
9130            self
9131        }
9132
9133        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9134        ///
9135        /// This is a **required** field for requests.
9136        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9137            self.0.request.data_use_terms_version = v.into();
9138            self
9139        }
9140    }
9141
9142    #[doc(hidden)]
9143    impl gax::options::internal::RequestBuilder for ProvisionProject {
9144        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9145            &mut self.0.options
9146        }
9147    }
9148
9149    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9150    ///
9151    /// # Example
9152    /// ```no_run
9153    /// # use google_cloud_discoveryengine_v1::builder;
9154    /// use builder::project_service::ListOperations;
9155    /// # tokio_test::block_on(async {
9156    /// use gax::paginator::ItemPaginator;
9157    ///
9158    /// let builder = prepare_request_builder();
9159    /// let mut items = builder.by_item();
9160    /// while let Some(result) = items.next().await {
9161    ///   let item = result?;
9162    /// }
9163    /// # gax::Result::<()>::Ok(()) });
9164    ///
9165    /// fn prepare_request_builder() -> ListOperations {
9166    ///   # panic!();
9167    ///   // ... details omitted ...
9168    /// }
9169    /// ```
9170    #[derive(Clone, Debug)]
9171    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9172
9173    impl ListOperations {
9174        pub(crate) fn new(
9175            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9176        ) -> Self {
9177            Self(RequestBuilder::new(stub))
9178        }
9179
9180        /// Sets the full request, replacing any prior values.
9181        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9182            mut self,
9183            v: V,
9184        ) -> Self {
9185            self.0.request = v.into();
9186            self
9187        }
9188
9189        /// Sets all the options, replacing any prior values.
9190        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9191            self.0.options = v.into();
9192            self
9193        }
9194
9195        /// Sends the request.
9196        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9197            (*self.0.stub)
9198                .list_operations(self.0.request, self.0.options)
9199                .await
9200                .map(gax::response::Response::into_body)
9201        }
9202
9203        /// Streams each page in the collection.
9204        pub fn by_page(
9205            self,
9206        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9207        {
9208            use std::clone::Clone;
9209            let token = self.0.request.page_token.clone();
9210            let execute = move |token: String| {
9211                let mut builder = self.clone();
9212                builder.0.request = builder.0.request.set_page_token(token);
9213                builder.send()
9214            };
9215            gax::paginator::internal::new_paginator(token, execute)
9216        }
9217
9218        /// Streams each item in the collection.
9219        pub fn by_item(
9220            self,
9221        ) -> impl gax::paginator::ItemPaginator<
9222            longrunning::model::ListOperationsResponse,
9223            gax::error::Error,
9224        > {
9225            use gax::paginator::Paginator;
9226            self.by_page().items()
9227        }
9228
9229        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9230        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9231            self.0.request.name = v.into();
9232            self
9233        }
9234
9235        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9236        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9237            self.0.request.filter = v.into();
9238            self
9239        }
9240
9241        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9242        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9243            self.0.request.page_size = v.into();
9244            self
9245        }
9246
9247        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9248        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9249            self.0.request.page_token = v.into();
9250            self
9251        }
9252    }
9253
9254    #[doc(hidden)]
9255    impl gax::options::internal::RequestBuilder for ListOperations {
9256        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9257            &mut self.0.options
9258        }
9259    }
9260
9261    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9262    ///
9263    /// # Example
9264    /// ```no_run
9265    /// # use google_cloud_discoveryengine_v1::builder;
9266    /// use builder::project_service::GetOperation;
9267    /// # tokio_test::block_on(async {
9268    ///
9269    /// let builder = prepare_request_builder();
9270    /// let response = builder.send().await?;
9271    /// # gax::Result::<()>::Ok(()) });
9272    ///
9273    /// fn prepare_request_builder() -> GetOperation {
9274    ///   # panic!();
9275    ///   // ... details omitted ...
9276    /// }
9277    /// ```
9278    #[derive(Clone, Debug)]
9279    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9280
9281    impl GetOperation {
9282        pub(crate) fn new(
9283            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9284        ) -> Self {
9285            Self(RequestBuilder::new(stub))
9286        }
9287
9288        /// Sets the full request, replacing any prior values.
9289        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9290            mut self,
9291            v: V,
9292        ) -> Self {
9293            self.0.request = v.into();
9294            self
9295        }
9296
9297        /// Sets all the options, replacing any prior values.
9298        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9299            self.0.options = v.into();
9300            self
9301        }
9302
9303        /// Sends the request.
9304        pub async fn send(self) -> Result<longrunning::model::Operation> {
9305            (*self.0.stub)
9306                .get_operation(self.0.request, self.0.options)
9307                .await
9308                .map(gax::response::Response::into_body)
9309        }
9310
9311        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9312        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9313            self.0.request.name = v.into();
9314            self
9315        }
9316    }
9317
9318    #[doc(hidden)]
9319    impl gax::options::internal::RequestBuilder for GetOperation {
9320        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9321            &mut self.0.options
9322        }
9323    }
9324
9325    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9326    ///
9327    /// # Example
9328    /// ```no_run
9329    /// # use google_cloud_discoveryengine_v1::builder;
9330    /// use builder::project_service::CancelOperation;
9331    /// # tokio_test::block_on(async {
9332    ///
9333    /// let builder = prepare_request_builder();
9334    /// let response = builder.send().await?;
9335    /// # gax::Result::<()>::Ok(()) });
9336    ///
9337    /// fn prepare_request_builder() -> CancelOperation {
9338    ///   # panic!();
9339    ///   // ... details omitted ...
9340    /// }
9341    /// ```
9342    #[derive(Clone, Debug)]
9343    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9344
9345    impl CancelOperation {
9346        pub(crate) fn new(
9347            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9348        ) -> Self {
9349            Self(RequestBuilder::new(stub))
9350        }
9351
9352        /// Sets the full request, replacing any prior values.
9353        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9354            mut self,
9355            v: V,
9356        ) -> Self {
9357            self.0.request = v.into();
9358            self
9359        }
9360
9361        /// Sets all the options, replacing any prior values.
9362        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9363            self.0.options = v.into();
9364            self
9365        }
9366
9367        /// Sends the request.
9368        pub async fn send(self) -> Result<()> {
9369            (*self.0.stub)
9370                .cancel_operation(self.0.request, self.0.options)
9371                .await
9372                .map(gax::response::Response::into_body)
9373        }
9374
9375        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9376        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9377            self.0.request.name = v.into();
9378            self
9379        }
9380    }
9381
9382    #[doc(hidden)]
9383    impl gax::options::internal::RequestBuilder for CancelOperation {
9384        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9385            &mut self.0.options
9386        }
9387    }
9388}
9389
9390#[cfg(feature = "rank-service")]
9391#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9392pub mod rank_service {
9393    use crate::Result;
9394
9395    /// A builder for [RankService][crate::client::RankService].
9396    ///
9397    /// ```
9398    /// # tokio_test::block_on(async {
9399    /// # use google_cloud_discoveryengine_v1::*;
9400    /// # use builder::rank_service::ClientBuilder;
9401    /// # use client::RankService;
9402    /// let builder : ClientBuilder = RankService::builder();
9403    /// let client = builder
9404    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9405    ///     .build().await?;
9406    /// # gax::client_builder::Result::<()>::Ok(()) });
9407    /// ```
9408    pub type ClientBuilder =
9409        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9410
9411    pub(crate) mod client {
9412        use super::super::super::client::RankService;
9413        pub struct Factory;
9414        impl gax::client_builder::internal::ClientFactory for Factory {
9415            type Client = RankService;
9416            type Credentials = gaxi::options::Credentials;
9417            async fn build(
9418                self,
9419                config: gaxi::options::ClientConfig,
9420            ) -> gax::client_builder::Result<Self::Client> {
9421                Self::Client::new(config).await
9422            }
9423        }
9424    }
9425
9426    /// Common implementation for [crate::client::RankService] request builders.
9427    #[derive(Clone, Debug)]
9428    pub(crate) struct RequestBuilder<R: std::default::Default> {
9429        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9430        request: R,
9431        options: gax::options::RequestOptions,
9432    }
9433
9434    impl<R> RequestBuilder<R>
9435    where
9436        R: std::default::Default,
9437    {
9438        pub(crate) fn new(
9439            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9440        ) -> Self {
9441            Self {
9442                stub,
9443                request: R::default(),
9444                options: gax::options::RequestOptions::default(),
9445            }
9446        }
9447    }
9448
9449    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9450    ///
9451    /// # Example
9452    /// ```no_run
9453    /// # use google_cloud_discoveryengine_v1::builder;
9454    /// use builder::rank_service::Rank;
9455    /// # tokio_test::block_on(async {
9456    ///
9457    /// let builder = prepare_request_builder();
9458    /// let response = builder.send().await?;
9459    /// # gax::Result::<()>::Ok(()) });
9460    ///
9461    /// fn prepare_request_builder() -> Rank {
9462    ///   # panic!();
9463    ///   // ... details omitted ...
9464    /// }
9465    /// ```
9466    #[derive(Clone, Debug)]
9467    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9468
9469    impl Rank {
9470        pub(crate) fn new(
9471            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9472        ) -> Self {
9473            Self(RequestBuilder::new(stub))
9474        }
9475
9476        /// Sets the full request, replacing any prior values.
9477        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9478            self.0.request = v.into();
9479            self
9480        }
9481
9482        /// Sets all the options, replacing any prior values.
9483        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9484            self.0.options = v.into();
9485            self
9486        }
9487
9488        /// Sends the request.
9489        pub async fn send(self) -> Result<crate::model::RankResponse> {
9490            (*self.0.stub)
9491                .rank(self.0.request, self.0.options)
9492                .await
9493                .map(gax::response::Response::into_body)
9494        }
9495
9496        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9497        ///
9498        /// This is a **required** field for requests.
9499        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9500            self.0.request.ranking_config = v.into();
9501            self
9502        }
9503
9504        /// Sets the value of [model][crate::model::RankRequest::model].
9505        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9506            self.0.request.model = v.into();
9507            self
9508        }
9509
9510        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9511        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9512            self.0.request.top_n = v.into();
9513            self
9514        }
9515
9516        /// Sets the value of [query][crate::model::RankRequest::query].
9517        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9518            self.0.request.query = v.into();
9519            self
9520        }
9521
9522        /// Sets the value of [records][crate::model::RankRequest::records].
9523        ///
9524        /// This is a **required** field for requests.
9525        pub fn set_records<T, V>(mut self, v: T) -> Self
9526        where
9527            T: std::iter::IntoIterator<Item = V>,
9528            V: std::convert::Into<crate::model::RankingRecord>,
9529        {
9530            use std::iter::Iterator;
9531            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9532            self
9533        }
9534
9535        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9536        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9537            self.0.request.ignore_record_details_in_response = v.into();
9538            self
9539        }
9540
9541        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9542        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9543        where
9544            T: std::iter::IntoIterator<Item = (K, V)>,
9545            K: std::convert::Into<std::string::String>,
9546            V: std::convert::Into<std::string::String>,
9547        {
9548            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9549            self
9550        }
9551    }
9552
9553    #[doc(hidden)]
9554    impl gax::options::internal::RequestBuilder for Rank {
9555        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9556            &mut self.0.options
9557        }
9558    }
9559
9560    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9561    ///
9562    /// # Example
9563    /// ```no_run
9564    /// # use google_cloud_discoveryengine_v1::builder;
9565    /// use builder::rank_service::ListOperations;
9566    /// # tokio_test::block_on(async {
9567    /// use gax::paginator::ItemPaginator;
9568    ///
9569    /// let builder = prepare_request_builder();
9570    /// let mut items = builder.by_item();
9571    /// while let Some(result) = items.next().await {
9572    ///   let item = result?;
9573    /// }
9574    /// # gax::Result::<()>::Ok(()) });
9575    ///
9576    /// fn prepare_request_builder() -> ListOperations {
9577    ///   # panic!();
9578    ///   // ... details omitted ...
9579    /// }
9580    /// ```
9581    #[derive(Clone, Debug)]
9582    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9583
9584    impl ListOperations {
9585        pub(crate) fn new(
9586            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9587        ) -> Self {
9588            Self(RequestBuilder::new(stub))
9589        }
9590
9591        /// Sets the full request, replacing any prior values.
9592        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9593            mut self,
9594            v: V,
9595        ) -> Self {
9596            self.0.request = v.into();
9597            self
9598        }
9599
9600        /// Sets all the options, replacing any prior values.
9601        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9602            self.0.options = v.into();
9603            self
9604        }
9605
9606        /// Sends the request.
9607        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9608            (*self.0.stub)
9609                .list_operations(self.0.request, self.0.options)
9610                .await
9611                .map(gax::response::Response::into_body)
9612        }
9613
9614        /// Streams each page in the collection.
9615        pub fn by_page(
9616            self,
9617        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9618        {
9619            use std::clone::Clone;
9620            let token = self.0.request.page_token.clone();
9621            let execute = move |token: String| {
9622                let mut builder = self.clone();
9623                builder.0.request = builder.0.request.set_page_token(token);
9624                builder.send()
9625            };
9626            gax::paginator::internal::new_paginator(token, execute)
9627        }
9628
9629        /// Streams each item in the collection.
9630        pub fn by_item(
9631            self,
9632        ) -> impl gax::paginator::ItemPaginator<
9633            longrunning::model::ListOperationsResponse,
9634            gax::error::Error,
9635        > {
9636            use gax::paginator::Paginator;
9637            self.by_page().items()
9638        }
9639
9640        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9641        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9642            self.0.request.name = v.into();
9643            self
9644        }
9645
9646        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9647        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9648            self.0.request.filter = v.into();
9649            self
9650        }
9651
9652        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9653        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9654            self.0.request.page_size = v.into();
9655            self
9656        }
9657
9658        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9659        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9660            self.0.request.page_token = v.into();
9661            self
9662        }
9663    }
9664
9665    #[doc(hidden)]
9666    impl gax::options::internal::RequestBuilder for ListOperations {
9667        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9668            &mut self.0.options
9669        }
9670    }
9671
9672    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9673    ///
9674    /// # Example
9675    /// ```no_run
9676    /// # use google_cloud_discoveryengine_v1::builder;
9677    /// use builder::rank_service::GetOperation;
9678    /// # tokio_test::block_on(async {
9679    ///
9680    /// let builder = prepare_request_builder();
9681    /// let response = builder.send().await?;
9682    /// # gax::Result::<()>::Ok(()) });
9683    ///
9684    /// fn prepare_request_builder() -> GetOperation {
9685    ///   # panic!();
9686    ///   // ... details omitted ...
9687    /// }
9688    /// ```
9689    #[derive(Clone, Debug)]
9690    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9691
9692    impl GetOperation {
9693        pub(crate) fn new(
9694            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9695        ) -> Self {
9696            Self(RequestBuilder::new(stub))
9697        }
9698
9699        /// Sets the full request, replacing any prior values.
9700        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9701            mut self,
9702            v: V,
9703        ) -> Self {
9704            self.0.request = v.into();
9705            self
9706        }
9707
9708        /// Sets all the options, replacing any prior values.
9709        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9710            self.0.options = v.into();
9711            self
9712        }
9713
9714        /// Sends the request.
9715        pub async fn send(self) -> Result<longrunning::model::Operation> {
9716            (*self.0.stub)
9717                .get_operation(self.0.request, self.0.options)
9718                .await
9719                .map(gax::response::Response::into_body)
9720        }
9721
9722        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9723        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9724            self.0.request.name = v.into();
9725            self
9726        }
9727    }
9728
9729    #[doc(hidden)]
9730    impl gax::options::internal::RequestBuilder for GetOperation {
9731        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9732            &mut self.0.options
9733        }
9734    }
9735
9736    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
9737    ///
9738    /// # Example
9739    /// ```no_run
9740    /// # use google_cloud_discoveryengine_v1::builder;
9741    /// use builder::rank_service::CancelOperation;
9742    /// # tokio_test::block_on(async {
9743    ///
9744    /// let builder = prepare_request_builder();
9745    /// let response = builder.send().await?;
9746    /// # gax::Result::<()>::Ok(()) });
9747    ///
9748    /// fn prepare_request_builder() -> CancelOperation {
9749    ///   # panic!();
9750    ///   // ... details omitted ...
9751    /// }
9752    /// ```
9753    #[derive(Clone, Debug)]
9754    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9755
9756    impl CancelOperation {
9757        pub(crate) fn new(
9758            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9759        ) -> Self {
9760            Self(RequestBuilder::new(stub))
9761        }
9762
9763        /// Sets the full request, replacing any prior values.
9764        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9765            mut self,
9766            v: V,
9767        ) -> Self {
9768            self.0.request = v.into();
9769            self
9770        }
9771
9772        /// Sets all the options, replacing any prior values.
9773        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9774            self.0.options = v.into();
9775            self
9776        }
9777
9778        /// Sends the request.
9779        pub async fn send(self) -> Result<()> {
9780            (*self.0.stub)
9781                .cancel_operation(self.0.request, self.0.options)
9782                .await
9783                .map(gax::response::Response::into_body)
9784        }
9785
9786        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9787        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9788            self.0.request.name = v.into();
9789            self
9790        }
9791    }
9792
9793    #[doc(hidden)]
9794    impl gax::options::internal::RequestBuilder for CancelOperation {
9795        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9796            &mut self.0.options
9797        }
9798    }
9799}
9800
9801#[cfg(feature = "recommendation-service")]
9802#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9803pub mod recommendation_service {
9804    use crate::Result;
9805
9806    /// A builder for [RecommendationService][crate::client::RecommendationService].
9807    ///
9808    /// ```
9809    /// # tokio_test::block_on(async {
9810    /// # use google_cloud_discoveryengine_v1::*;
9811    /// # use builder::recommendation_service::ClientBuilder;
9812    /// # use client::RecommendationService;
9813    /// let builder : ClientBuilder = RecommendationService::builder();
9814    /// let client = builder
9815    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9816    ///     .build().await?;
9817    /// # gax::client_builder::Result::<()>::Ok(()) });
9818    /// ```
9819    pub type ClientBuilder =
9820        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9821
9822    pub(crate) mod client {
9823        use super::super::super::client::RecommendationService;
9824        pub struct Factory;
9825        impl gax::client_builder::internal::ClientFactory for Factory {
9826            type Client = RecommendationService;
9827            type Credentials = gaxi::options::Credentials;
9828            async fn build(
9829                self,
9830                config: gaxi::options::ClientConfig,
9831            ) -> gax::client_builder::Result<Self::Client> {
9832                Self::Client::new(config).await
9833            }
9834        }
9835    }
9836
9837    /// Common implementation for [crate::client::RecommendationService] request builders.
9838    #[derive(Clone, Debug)]
9839    pub(crate) struct RequestBuilder<R: std::default::Default> {
9840        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9841        request: R,
9842        options: gax::options::RequestOptions,
9843    }
9844
9845    impl<R> RequestBuilder<R>
9846    where
9847        R: std::default::Default,
9848    {
9849        pub(crate) fn new(
9850            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9851        ) -> Self {
9852            Self {
9853                stub,
9854                request: R::default(),
9855                options: gax::options::RequestOptions::default(),
9856            }
9857        }
9858    }
9859
9860    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
9861    ///
9862    /// # Example
9863    /// ```no_run
9864    /// # use google_cloud_discoveryengine_v1::builder;
9865    /// use builder::recommendation_service::Recommend;
9866    /// # tokio_test::block_on(async {
9867    ///
9868    /// let builder = prepare_request_builder();
9869    /// let response = builder.send().await?;
9870    /// # gax::Result::<()>::Ok(()) });
9871    ///
9872    /// fn prepare_request_builder() -> Recommend {
9873    ///   # panic!();
9874    ///   // ... details omitted ...
9875    /// }
9876    /// ```
9877    #[derive(Clone, Debug)]
9878    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9879
9880    impl Recommend {
9881        pub(crate) fn new(
9882            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9883        ) -> Self {
9884            Self(RequestBuilder::new(stub))
9885        }
9886
9887        /// Sets the full request, replacing any prior values.
9888        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9889            self.0.request = v.into();
9890            self
9891        }
9892
9893        /// Sets all the options, replacing any prior values.
9894        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9895            self.0.options = v.into();
9896            self
9897        }
9898
9899        /// Sends the request.
9900        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9901            (*self.0.stub)
9902                .recommend(self.0.request, self.0.options)
9903                .await
9904                .map(gax::response::Response::into_body)
9905        }
9906
9907        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
9908        ///
9909        /// This is a **required** field for requests.
9910        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9911            self.0.request.serving_config = v.into();
9912            self
9913        }
9914
9915        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
9916        ///
9917        /// This is a **required** field for requests.
9918        pub fn set_user_event<T>(mut self, v: T) -> Self
9919        where
9920            T: std::convert::Into<crate::model::UserEvent>,
9921        {
9922            self.0.request.user_event = std::option::Option::Some(v.into());
9923            self
9924        }
9925
9926        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
9927        ///
9928        /// This is a **required** field for requests.
9929        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
9930        where
9931            T: std::convert::Into<crate::model::UserEvent>,
9932        {
9933            self.0.request.user_event = v.map(|x| x.into());
9934            self
9935        }
9936
9937        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
9938        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9939            self.0.request.page_size = v.into();
9940            self
9941        }
9942
9943        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
9944        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9945            self.0.request.filter = v.into();
9946            self
9947        }
9948
9949        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
9950        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
9951            self.0.request.validate_only = v.into();
9952            self
9953        }
9954
9955        /// Sets the value of [params][crate::model::RecommendRequest::params].
9956        pub fn set_params<T, K, V>(mut self, v: T) -> Self
9957        where
9958            T: std::iter::IntoIterator<Item = (K, V)>,
9959            K: std::convert::Into<std::string::String>,
9960            V: std::convert::Into<wkt::Value>,
9961        {
9962            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9963            self
9964        }
9965
9966        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
9967        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9968        where
9969            T: std::iter::IntoIterator<Item = (K, V)>,
9970            K: std::convert::Into<std::string::String>,
9971            V: std::convert::Into<std::string::String>,
9972        {
9973            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9974            self
9975        }
9976    }
9977
9978    #[doc(hidden)]
9979    impl gax::options::internal::RequestBuilder for Recommend {
9980        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9981            &mut self.0.options
9982        }
9983    }
9984
9985    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
9986    ///
9987    /// # Example
9988    /// ```no_run
9989    /// # use google_cloud_discoveryengine_v1::builder;
9990    /// use builder::recommendation_service::ListOperations;
9991    /// # tokio_test::block_on(async {
9992    /// use gax::paginator::ItemPaginator;
9993    ///
9994    /// let builder = prepare_request_builder();
9995    /// let mut items = builder.by_item();
9996    /// while let Some(result) = items.next().await {
9997    ///   let item = result?;
9998    /// }
9999    /// # gax::Result::<()>::Ok(()) });
10000    ///
10001    /// fn prepare_request_builder() -> ListOperations {
10002    ///   # panic!();
10003    ///   // ... details omitted ...
10004    /// }
10005    /// ```
10006    #[derive(Clone, Debug)]
10007    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10008
10009    impl ListOperations {
10010        pub(crate) fn new(
10011            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10012        ) -> Self {
10013            Self(RequestBuilder::new(stub))
10014        }
10015
10016        /// Sets the full request, replacing any prior values.
10017        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10018            mut self,
10019            v: V,
10020        ) -> Self {
10021            self.0.request = v.into();
10022            self
10023        }
10024
10025        /// Sets all the options, replacing any prior values.
10026        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10027            self.0.options = v.into();
10028            self
10029        }
10030
10031        /// Sends the request.
10032        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10033            (*self.0.stub)
10034                .list_operations(self.0.request, self.0.options)
10035                .await
10036                .map(gax::response::Response::into_body)
10037        }
10038
10039        /// Streams each page in the collection.
10040        pub fn by_page(
10041            self,
10042        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10043        {
10044            use std::clone::Clone;
10045            let token = self.0.request.page_token.clone();
10046            let execute = move |token: String| {
10047                let mut builder = self.clone();
10048                builder.0.request = builder.0.request.set_page_token(token);
10049                builder.send()
10050            };
10051            gax::paginator::internal::new_paginator(token, execute)
10052        }
10053
10054        /// Streams each item in the collection.
10055        pub fn by_item(
10056            self,
10057        ) -> impl gax::paginator::ItemPaginator<
10058            longrunning::model::ListOperationsResponse,
10059            gax::error::Error,
10060        > {
10061            use gax::paginator::Paginator;
10062            self.by_page().items()
10063        }
10064
10065        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10066        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10067            self.0.request.name = v.into();
10068            self
10069        }
10070
10071        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10072        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10073            self.0.request.filter = v.into();
10074            self
10075        }
10076
10077        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10078        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10079            self.0.request.page_size = v.into();
10080            self
10081        }
10082
10083        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10084        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10085            self.0.request.page_token = v.into();
10086            self
10087        }
10088    }
10089
10090    #[doc(hidden)]
10091    impl gax::options::internal::RequestBuilder for ListOperations {
10092        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10093            &mut self.0.options
10094        }
10095    }
10096
10097    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10098    ///
10099    /// # Example
10100    /// ```no_run
10101    /// # use google_cloud_discoveryengine_v1::builder;
10102    /// use builder::recommendation_service::GetOperation;
10103    /// # tokio_test::block_on(async {
10104    ///
10105    /// let builder = prepare_request_builder();
10106    /// let response = builder.send().await?;
10107    /// # gax::Result::<()>::Ok(()) });
10108    ///
10109    /// fn prepare_request_builder() -> GetOperation {
10110    ///   # panic!();
10111    ///   // ... details omitted ...
10112    /// }
10113    /// ```
10114    #[derive(Clone, Debug)]
10115    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10116
10117    impl GetOperation {
10118        pub(crate) fn new(
10119            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10120        ) -> Self {
10121            Self(RequestBuilder::new(stub))
10122        }
10123
10124        /// Sets the full request, replacing any prior values.
10125        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10126            mut self,
10127            v: V,
10128        ) -> Self {
10129            self.0.request = v.into();
10130            self
10131        }
10132
10133        /// Sets all the options, replacing any prior values.
10134        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10135            self.0.options = v.into();
10136            self
10137        }
10138
10139        /// Sends the request.
10140        pub async fn send(self) -> Result<longrunning::model::Operation> {
10141            (*self.0.stub)
10142                .get_operation(self.0.request, self.0.options)
10143                .await
10144                .map(gax::response::Response::into_body)
10145        }
10146
10147        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
10148        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10149            self.0.request.name = v.into();
10150            self
10151        }
10152    }
10153
10154    #[doc(hidden)]
10155    impl gax::options::internal::RequestBuilder for GetOperation {
10156        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10157            &mut self.0.options
10158        }
10159    }
10160
10161    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10162    ///
10163    /// # Example
10164    /// ```no_run
10165    /// # use google_cloud_discoveryengine_v1::builder;
10166    /// use builder::recommendation_service::CancelOperation;
10167    /// # tokio_test::block_on(async {
10168    ///
10169    /// let builder = prepare_request_builder();
10170    /// let response = builder.send().await?;
10171    /// # gax::Result::<()>::Ok(()) });
10172    ///
10173    /// fn prepare_request_builder() -> CancelOperation {
10174    ///   # panic!();
10175    ///   // ... details omitted ...
10176    /// }
10177    /// ```
10178    #[derive(Clone, Debug)]
10179    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10180
10181    impl CancelOperation {
10182        pub(crate) fn new(
10183            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10184        ) -> Self {
10185            Self(RequestBuilder::new(stub))
10186        }
10187
10188        /// Sets the full request, replacing any prior values.
10189        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10190            mut self,
10191            v: V,
10192        ) -> Self {
10193            self.0.request = v.into();
10194            self
10195        }
10196
10197        /// Sets all the options, replacing any prior values.
10198        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10199            self.0.options = v.into();
10200            self
10201        }
10202
10203        /// Sends the request.
10204        pub async fn send(self) -> Result<()> {
10205            (*self.0.stub)
10206                .cancel_operation(self.0.request, self.0.options)
10207                .await
10208                .map(gax::response::Response::into_body)
10209        }
10210
10211        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
10212        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10213            self.0.request.name = v.into();
10214            self
10215        }
10216    }
10217
10218    #[doc(hidden)]
10219    impl gax::options::internal::RequestBuilder for CancelOperation {
10220        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10221            &mut self.0.options
10222        }
10223    }
10224}
10225
10226#[cfg(feature = "schema-service")]
10227#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10228pub mod schema_service {
10229    use crate::Result;
10230
10231    /// A builder for [SchemaService][crate::client::SchemaService].
10232    ///
10233    /// ```
10234    /// # tokio_test::block_on(async {
10235    /// # use google_cloud_discoveryengine_v1::*;
10236    /// # use builder::schema_service::ClientBuilder;
10237    /// # use client::SchemaService;
10238    /// let builder : ClientBuilder = SchemaService::builder();
10239    /// let client = builder
10240    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10241    ///     .build().await?;
10242    /// # gax::client_builder::Result::<()>::Ok(()) });
10243    /// ```
10244    pub type ClientBuilder =
10245        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10246
10247    pub(crate) mod client {
10248        use super::super::super::client::SchemaService;
10249        pub struct Factory;
10250        impl gax::client_builder::internal::ClientFactory for Factory {
10251            type Client = SchemaService;
10252            type Credentials = gaxi::options::Credentials;
10253            async fn build(
10254                self,
10255                config: gaxi::options::ClientConfig,
10256            ) -> gax::client_builder::Result<Self::Client> {
10257                Self::Client::new(config).await
10258            }
10259        }
10260    }
10261
10262    /// Common implementation for [crate::client::SchemaService] request builders.
10263    #[derive(Clone, Debug)]
10264    pub(crate) struct RequestBuilder<R: std::default::Default> {
10265        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10266        request: R,
10267        options: gax::options::RequestOptions,
10268    }
10269
10270    impl<R> RequestBuilder<R>
10271    where
10272        R: std::default::Default,
10273    {
10274        pub(crate) fn new(
10275            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10276        ) -> Self {
10277            Self {
10278                stub,
10279                request: R::default(),
10280                options: gax::options::RequestOptions::default(),
10281            }
10282        }
10283    }
10284
10285    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10286    ///
10287    /// # Example
10288    /// ```no_run
10289    /// # use google_cloud_discoveryengine_v1::builder;
10290    /// use builder::schema_service::GetSchema;
10291    /// # tokio_test::block_on(async {
10292    ///
10293    /// let builder = prepare_request_builder();
10294    /// let response = builder.send().await?;
10295    /// # gax::Result::<()>::Ok(()) });
10296    ///
10297    /// fn prepare_request_builder() -> GetSchema {
10298    ///   # panic!();
10299    ///   // ... details omitted ...
10300    /// }
10301    /// ```
10302    #[derive(Clone, Debug)]
10303    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10304
10305    impl GetSchema {
10306        pub(crate) fn new(
10307            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10308        ) -> Self {
10309            Self(RequestBuilder::new(stub))
10310        }
10311
10312        /// Sets the full request, replacing any prior values.
10313        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10314            self.0.request = v.into();
10315            self
10316        }
10317
10318        /// Sets all the options, replacing any prior values.
10319        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10320            self.0.options = v.into();
10321            self
10322        }
10323
10324        /// Sends the request.
10325        pub async fn send(self) -> Result<crate::model::Schema> {
10326            (*self.0.stub)
10327                .get_schema(self.0.request, self.0.options)
10328                .await
10329                .map(gax::response::Response::into_body)
10330        }
10331
10332        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10333        ///
10334        /// This is a **required** field for requests.
10335        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10336            self.0.request.name = v.into();
10337            self
10338        }
10339    }
10340
10341    #[doc(hidden)]
10342    impl gax::options::internal::RequestBuilder for GetSchema {
10343        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10344            &mut self.0.options
10345        }
10346    }
10347
10348    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10349    ///
10350    /// # Example
10351    /// ```no_run
10352    /// # use google_cloud_discoveryengine_v1::builder;
10353    /// use builder::schema_service::ListSchemas;
10354    /// # tokio_test::block_on(async {
10355    /// use gax::paginator::ItemPaginator;
10356    ///
10357    /// let builder = prepare_request_builder();
10358    /// let mut items = builder.by_item();
10359    /// while let Some(result) = items.next().await {
10360    ///   let item = result?;
10361    /// }
10362    /// # gax::Result::<()>::Ok(()) });
10363    ///
10364    /// fn prepare_request_builder() -> ListSchemas {
10365    ///   # panic!();
10366    ///   // ... details omitted ...
10367    /// }
10368    /// ```
10369    #[derive(Clone, Debug)]
10370    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10371
10372    impl ListSchemas {
10373        pub(crate) fn new(
10374            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10375        ) -> Self {
10376            Self(RequestBuilder::new(stub))
10377        }
10378
10379        /// Sets the full request, replacing any prior values.
10380        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10381            self.0.request = v.into();
10382            self
10383        }
10384
10385        /// Sets all the options, replacing any prior values.
10386        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10387            self.0.options = v.into();
10388            self
10389        }
10390
10391        /// Sends the request.
10392        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10393            (*self.0.stub)
10394                .list_schemas(self.0.request, self.0.options)
10395                .await
10396                .map(gax::response::Response::into_body)
10397        }
10398
10399        /// Streams each page in the collection.
10400        pub fn by_page(
10401            self,
10402        ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10403        {
10404            use std::clone::Clone;
10405            let token = self.0.request.page_token.clone();
10406            let execute = move |token: String| {
10407                let mut builder = self.clone();
10408                builder.0.request = builder.0.request.set_page_token(token);
10409                builder.send()
10410            };
10411            gax::paginator::internal::new_paginator(token, execute)
10412        }
10413
10414        /// Streams each item in the collection.
10415        pub fn by_item(
10416            self,
10417        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10418        {
10419            use gax::paginator::Paginator;
10420            self.by_page().items()
10421        }
10422
10423        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10424        ///
10425        /// This is a **required** field for requests.
10426        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10427            self.0.request.parent = v.into();
10428            self
10429        }
10430
10431        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10432        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10433            self.0.request.page_size = v.into();
10434            self
10435        }
10436
10437        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10438        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10439            self.0.request.page_token = v.into();
10440            self
10441        }
10442    }
10443
10444    #[doc(hidden)]
10445    impl gax::options::internal::RequestBuilder for ListSchemas {
10446        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10447            &mut self.0.options
10448        }
10449    }
10450
10451    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10452    ///
10453    /// # Example
10454    /// ```no_run
10455    /// # use google_cloud_discoveryengine_v1::builder;
10456    /// use builder::schema_service::CreateSchema;
10457    /// # tokio_test::block_on(async {
10458    /// use lro::Poller;
10459    ///
10460    /// let builder = prepare_request_builder();
10461    /// let response = builder.poller().until_done().await?;
10462    /// # gax::Result::<()>::Ok(()) });
10463    ///
10464    /// fn prepare_request_builder() -> CreateSchema {
10465    ///   # panic!();
10466    ///   // ... details omitted ...
10467    /// }
10468    /// ```
10469    #[derive(Clone, Debug)]
10470    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10471
10472    impl CreateSchema {
10473        pub(crate) fn new(
10474            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10475        ) -> Self {
10476            Self(RequestBuilder::new(stub))
10477        }
10478
10479        /// Sets the full request, replacing any prior values.
10480        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10481            self.0.request = v.into();
10482            self
10483        }
10484
10485        /// Sets all the options, replacing any prior values.
10486        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10487            self.0.options = v.into();
10488            self
10489        }
10490
10491        /// Sends the request.
10492        ///
10493        /// # Long running operations
10494        ///
10495        /// This starts, but does not poll, a longrunning operation. More information
10496        /// on [create_schema][crate::client::SchemaService::create_schema].
10497        pub async fn send(self) -> Result<longrunning::model::Operation> {
10498            (*self.0.stub)
10499                .create_schema(self.0.request, self.0.options)
10500                .await
10501                .map(gax::response::Response::into_body)
10502        }
10503
10504        /// Creates a [Poller][lro::Poller] to work with `create_schema`.
10505        pub fn poller(
10506            self,
10507        ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10508            type Operation =
10509                lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10510            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10511            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10512
10513            let stub = self.0.stub.clone();
10514            let mut options = self.0.options.clone();
10515            options.set_retry_policy(gax::retry_policy::NeverRetry);
10516            let query = move |name| {
10517                let stub = stub.clone();
10518                let options = options.clone();
10519                async {
10520                    let op = GetOperation::new(stub)
10521                        .set_name(name)
10522                        .with_options(options)
10523                        .send()
10524                        .await?;
10525                    Ok(Operation::new(op))
10526                }
10527            };
10528
10529            let start = move || async {
10530                let op = self.send().await?;
10531                Ok(Operation::new(op))
10532            };
10533
10534            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10535        }
10536
10537        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10538        ///
10539        /// This is a **required** field for requests.
10540        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10541            self.0.request.parent = v.into();
10542            self
10543        }
10544
10545        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10546        ///
10547        /// This is a **required** field for requests.
10548        pub fn set_schema<T>(mut self, v: T) -> Self
10549        where
10550            T: std::convert::Into<crate::model::Schema>,
10551        {
10552            self.0.request.schema = std::option::Option::Some(v.into());
10553            self
10554        }
10555
10556        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10557        ///
10558        /// This is a **required** field for requests.
10559        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10560        where
10561            T: std::convert::Into<crate::model::Schema>,
10562        {
10563            self.0.request.schema = v.map(|x| x.into());
10564            self
10565        }
10566
10567        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10568        ///
10569        /// This is a **required** field for requests.
10570        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10571            self.0.request.schema_id = v.into();
10572            self
10573        }
10574    }
10575
10576    #[doc(hidden)]
10577    impl gax::options::internal::RequestBuilder for CreateSchema {
10578        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10579            &mut self.0.options
10580        }
10581    }
10582
10583    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10584    ///
10585    /// # Example
10586    /// ```no_run
10587    /// # use google_cloud_discoveryengine_v1::builder;
10588    /// use builder::schema_service::UpdateSchema;
10589    /// # tokio_test::block_on(async {
10590    /// use lro::Poller;
10591    ///
10592    /// let builder = prepare_request_builder();
10593    /// let response = builder.poller().until_done().await?;
10594    /// # gax::Result::<()>::Ok(()) });
10595    ///
10596    /// fn prepare_request_builder() -> UpdateSchema {
10597    ///   # panic!();
10598    ///   // ... details omitted ...
10599    /// }
10600    /// ```
10601    #[derive(Clone, Debug)]
10602    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10603
10604    impl UpdateSchema {
10605        pub(crate) fn new(
10606            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10607        ) -> Self {
10608            Self(RequestBuilder::new(stub))
10609        }
10610
10611        /// Sets the full request, replacing any prior values.
10612        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10613            self.0.request = v.into();
10614            self
10615        }
10616
10617        /// Sets all the options, replacing any prior values.
10618        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10619            self.0.options = v.into();
10620            self
10621        }
10622
10623        /// Sends the request.
10624        ///
10625        /// # Long running operations
10626        ///
10627        /// This starts, but does not poll, a longrunning operation. More information
10628        /// on [update_schema][crate::client::SchemaService::update_schema].
10629        pub async fn send(self) -> Result<longrunning::model::Operation> {
10630            (*self.0.stub)
10631                .update_schema(self.0.request, self.0.options)
10632                .await
10633                .map(gax::response::Response::into_body)
10634        }
10635
10636        /// Creates a [Poller][lro::Poller] to work with `update_schema`.
10637        pub fn poller(
10638            self,
10639        ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10640            type Operation =
10641                lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10642            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10643            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10644
10645            let stub = self.0.stub.clone();
10646            let mut options = self.0.options.clone();
10647            options.set_retry_policy(gax::retry_policy::NeverRetry);
10648            let query = move |name| {
10649                let stub = stub.clone();
10650                let options = options.clone();
10651                async {
10652                    let op = GetOperation::new(stub)
10653                        .set_name(name)
10654                        .with_options(options)
10655                        .send()
10656                        .await?;
10657                    Ok(Operation::new(op))
10658                }
10659            };
10660
10661            let start = move || async {
10662                let op = self.send().await?;
10663                Ok(Operation::new(op))
10664            };
10665
10666            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10667        }
10668
10669        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10670        ///
10671        /// This is a **required** field for requests.
10672        pub fn set_schema<T>(mut self, v: T) -> Self
10673        where
10674            T: std::convert::Into<crate::model::Schema>,
10675        {
10676            self.0.request.schema = std::option::Option::Some(v.into());
10677            self
10678        }
10679
10680        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10681        ///
10682        /// This is a **required** field for requests.
10683        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10684        where
10685            T: std::convert::Into<crate::model::Schema>,
10686        {
10687            self.0.request.schema = v.map(|x| x.into());
10688            self
10689        }
10690
10691        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
10692        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10693            self.0.request.allow_missing = v.into();
10694            self
10695        }
10696    }
10697
10698    #[doc(hidden)]
10699    impl gax::options::internal::RequestBuilder for UpdateSchema {
10700        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10701            &mut self.0.options
10702        }
10703    }
10704
10705    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
10706    ///
10707    /// # Example
10708    /// ```no_run
10709    /// # use google_cloud_discoveryengine_v1::builder;
10710    /// use builder::schema_service::DeleteSchema;
10711    /// # tokio_test::block_on(async {
10712    /// use lro::Poller;
10713    ///
10714    /// let builder = prepare_request_builder();
10715    /// let response = builder.poller().until_done().await?;
10716    /// # gax::Result::<()>::Ok(()) });
10717    ///
10718    /// fn prepare_request_builder() -> DeleteSchema {
10719    ///   # panic!();
10720    ///   // ... details omitted ...
10721    /// }
10722    /// ```
10723    #[derive(Clone, Debug)]
10724    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10725
10726    impl DeleteSchema {
10727        pub(crate) fn new(
10728            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10729        ) -> Self {
10730            Self(RequestBuilder::new(stub))
10731        }
10732
10733        /// Sets the full request, replacing any prior values.
10734        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10735            self.0.request = v.into();
10736            self
10737        }
10738
10739        /// Sets all the options, replacing any prior values.
10740        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10741            self.0.options = v.into();
10742            self
10743        }
10744
10745        /// Sends the request.
10746        ///
10747        /// # Long running operations
10748        ///
10749        /// This starts, but does not poll, a longrunning operation. More information
10750        /// on [delete_schema][crate::client::SchemaService::delete_schema].
10751        pub async fn send(self) -> Result<longrunning::model::Operation> {
10752            (*self.0.stub)
10753                .delete_schema(self.0.request, self.0.options)
10754                .await
10755                .map(gax::response::Response::into_body)
10756        }
10757
10758        /// Creates a [Poller][lro::Poller] to work with `delete_schema`.
10759        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10760            type Operation =
10761                lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10762            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10763            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10764
10765            let stub = self.0.stub.clone();
10766            let mut options = self.0.options.clone();
10767            options.set_retry_policy(gax::retry_policy::NeverRetry);
10768            let query = move |name| {
10769                let stub = stub.clone();
10770                let options = options.clone();
10771                async {
10772                    let op = GetOperation::new(stub)
10773                        .set_name(name)
10774                        .with_options(options)
10775                        .send()
10776                        .await?;
10777                    Ok(Operation::new(op))
10778                }
10779            };
10780
10781            let start = move || async {
10782                let op = self.send().await?;
10783                Ok(Operation::new(op))
10784            };
10785
10786            lro::internal::new_unit_response_poller(
10787                polling_error_policy,
10788                polling_backoff_policy,
10789                start,
10790                query,
10791            )
10792        }
10793
10794        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
10795        ///
10796        /// This is a **required** field for requests.
10797        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10798            self.0.request.name = v.into();
10799            self
10800        }
10801    }
10802
10803    #[doc(hidden)]
10804    impl gax::options::internal::RequestBuilder for DeleteSchema {
10805        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10806            &mut self.0.options
10807        }
10808    }
10809
10810    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
10811    ///
10812    /// # Example
10813    /// ```no_run
10814    /// # use google_cloud_discoveryengine_v1::builder;
10815    /// use builder::schema_service::ListOperations;
10816    /// # tokio_test::block_on(async {
10817    /// use gax::paginator::ItemPaginator;
10818    ///
10819    /// let builder = prepare_request_builder();
10820    /// let mut items = builder.by_item();
10821    /// while let Some(result) = items.next().await {
10822    ///   let item = result?;
10823    /// }
10824    /// # gax::Result::<()>::Ok(()) });
10825    ///
10826    /// fn prepare_request_builder() -> ListOperations {
10827    ///   # panic!();
10828    ///   // ... details omitted ...
10829    /// }
10830    /// ```
10831    #[derive(Clone, Debug)]
10832    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10833
10834    impl ListOperations {
10835        pub(crate) fn new(
10836            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10837        ) -> Self {
10838            Self(RequestBuilder::new(stub))
10839        }
10840
10841        /// Sets the full request, replacing any prior values.
10842        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10843            mut self,
10844            v: V,
10845        ) -> Self {
10846            self.0.request = v.into();
10847            self
10848        }
10849
10850        /// Sets all the options, replacing any prior values.
10851        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10852            self.0.options = v.into();
10853            self
10854        }
10855
10856        /// Sends the request.
10857        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10858            (*self.0.stub)
10859                .list_operations(self.0.request, self.0.options)
10860                .await
10861                .map(gax::response::Response::into_body)
10862        }
10863
10864        /// Streams each page in the collection.
10865        pub fn by_page(
10866            self,
10867        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10868        {
10869            use std::clone::Clone;
10870            let token = self.0.request.page_token.clone();
10871            let execute = move |token: String| {
10872                let mut builder = self.clone();
10873                builder.0.request = builder.0.request.set_page_token(token);
10874                builder.send()
10875            };
10876            gax::paginator::internal::new_paginator(token, execute)
10877        }
10878
10879        /// Streams each item in the collection.
10880        pub fn by_item(
10881            self,
10882        ) -> impl gax::paginator::ItemPaginator<
10883            longrunning::model::ListOperationsResponse,
10884            gax::error::Error,
10885        > {
10886            use gax::paginator::Paginator;
10887            self.by_page().items()
10888        }
10889
10890        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10891        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10892            self.0.request.name = v.into();
10893            self
10894        }
10895
10896        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10897        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10898            self.0.request.filter = v.into();
10899            self
10900        }
10901
10902        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10903        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10904            self.0.request.page_size = v.into();
10905            self
10906        }
10907
10908        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10909        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10910            self.0.request.page_token = v.into();
10911            self
10912        }
10913    }
10914
10915    #[doc(hidden)]
10916    impl gax::options::internal::RequestBuilder for ListOperations {
10917        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10918            &mut self.0.options
10919        }
10920    }
10921
10922    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
10923    ///
10924    /// # Example
10925    /// ```no_run
10926    /// # use google_cloud_discoveryengine_v1::builder;
10927    /// use builder::schema_service::GetOperation;
10928    /// # tokio_test::block_on(async {
10929    ///
10930    /// let builder = prepare_request_builder();
10931    /// let response = builder.send().await?;
10932    /// # gax::Result::<()>::Ok(()) });
10933    ///
10934    /// fn prepare_request_builder() -> GetOperation {
10935    ///   # panic!();
10936    ///   // ... details omitted ...
10937    /// }
10938    /// ```
10939    #[derive(Clone, Debug)]
10940    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10941
10942    impl GetOperation {
10943        pub(crate) fn new(
10944            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10945        ) -> Self {
10946            Self(RequestBuilder::new(stub))
10947        }
10948
10949        /// Sets the full request, replacing any prior values.
10950        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10951            mut self,
10952            v: V,
10953        ) -> Self {
10954            self.0.request = v.into();
10955            self
10956        }
10957
10958        /// Sets all the options, replacing any prior values.
10959        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10960            self.0.options = v.into();
10961            self
10962        }
10963
10964        /// Sends the request.
10965        pub async fn send(self) -> Result<longrunning::model::Operation> {
10966            (*self.0.stub)
10967                .get_operation(self.0.request, self.0.options)
10968                .await
10969                .map(gax::response::Response::into_body)
10970        }
10971
10972        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
10973        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10974            self.0.request.name = v.into();
10975            self
10976        }
10977    }
10978
10979    #[doc(hidden)]
10980    impl gax::options::internal::RequestBuilder for GetOperation {
10981        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10982            &mut self.0.options
10983        }
10984    }
10985
10986    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
10987    ///
10988    /// # Example
10989    /// ```no_run
10990    /// # use google_cloud_discoveryengine_v1::builder;
10991    /// use builder::schema_service::CancelOperation;
10992    /// # tokio_test::block_on(async {
10993    ///
10994    /// let builder = prepare_request_builder();
10995    /// let response = builder.send().await?;
10996    /// # gax::Result::<()>::Ok(()) });
10997    ///
10998    /// fn prepare_request_builder() -> CancelOperation {
10999    ///   # panic!();
11000    ///   // ... details omitted ...
11001    /// }
11002    /// ```
11003    #[derive(Clone, Debug)]
11004    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11005
11006    impl CancelOperation {
11007        pub(crate) fn new(
11008            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11009        ) -> Self {
11010            Self(RequestBuilder::new(stub))
11011        }
11012
11013        /// Sets the full request, replacing any prior values.
11014        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11015            mut self,
11016            v: V,
11017        ) -> Self {
11018            self.0.request = v.into();
11019            self
11020        }
11021
11022        /// Sets all the options, replacing any prior values.
11023        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11024            self.0.options = v.into();
11025            self
11026        }
11027
11028        /// Sends the request.
11029        pub async fn send(self) -> Result<()> {
11030            (*self.0.stub)
11031                .cancel_operation(self.0.request, self.0.options)
11032                .await
11033                .map(gax::response::Response::into_body)
11034        }
11035
11036        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
11037        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11038            self.0.request.name = v.into();
11039            self
11040        }
11041    }
11042
11043    #[doc(hidden)]
11044    impl gax::options::internal::RequestBuilder for CancelOperation {
11045        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11046            &mut self.0.options
11047        }
11048    }
11049}
11050
11051#[cfg(feature = "search-service")]
11052#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11053pub mod search_service {
11054    use crate::Result;
11055
11056    /// A builder for [SearchService][crate::client::SearchService].
11057    ///
11058    /// ```
11059    /// # tokio_test::block_on(async {
11060    /// # use google_cloud_discoveryengine_v1::*;
11061    /// # use builder::search_service::ClientBuilder;
11062    /// # use client::SearchService;
11063    /// let builder : ClientBuilder = SearchService::builder();
11064    /// let client = builder
11065    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11066    ///     .build().await?;
11067    /// # gax::client_builder::Result::<()>::Ok(()) });
11068    /// ```
11069    pub type ClientBuilder =
11070        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11071
11072    pub(crate) mod client {
11073        use super::super::super::client::SearchService;
11074        pub struct Factory;
11075        impl gax::client_builder::internal::ClientFactory for Factory {
11076            type Client = SearchService;
11077            type Credentials = gaxi::options::Credentials;
11078            async fn build(
11079                self,
11080                config: gaxi::options::ClientConfig,
11081            ) -> gax::client_builder::Result<Self::Client> {
11082                Self::Client::new(config).await
11083            }
11084        }
11085    }
11086
11087    /// Common implementation for [crate::client::SearchService] request builders.
11088    #[derive(Clone, Debug)]
11089    pub(crate) struct RequestBuilder<R: std::default::Default> {
11090        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11091        request: R,
11092        options: gax::options::RequestOptions,
11093    }
11094
11095    impl<R> RequestBuilder<R>
11096    where
11097        R: std::default::Default,
11098    {
11099        pub(crate) fn new(
11100            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11101        ) -> Self {
11102            Self {
11103                stub,
11104                request: R::default(),
11105                options: gax::options::RequestOptions::default(),
11106            }
11107        }
11108    }
11109
11110    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11111    ///
11112    /// # Example
11113    /// ```no_run
11114    /// # use google_cloud_discoveryengine_v1::builder;
11115    /// use builder::search_service::Search;
11116    /// # tokio_test::block_on(async {
11117    /// use gax::paginator::ItemPaginator;
11118    ///
11119    /// let builder = prepare_request_builder();
11120    /// let mut items = builder.by_item();
11121    /// while let Some(result) = items.next().await {
11122    ///   let item = result?;
11123    /// }
11124    /// # gax::Result::<()>::Ok(()) });
11125    ///
11126    /// fn prepare_request_builder() -> Search {
11127    ///   # panic!();
11128    ///   // ... details omitted ...
11129    /// }
11130    /// ```
11131    #[derive(Clone, Debug)]
11132    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11133
11134    impl Search {
11135        pub(crate) fn new(
11136            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11137        ) -> Self {
11138            Self(RequestBuilder::new(stub))
11139        }
11140
11141        /// Sets the full request, replacing any prior values.
11142        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11143            self.0.request = v.into();
11144            self
11145        }
11146
11147        /// Sets all the options, replacing any prior values.
11148        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11149            self.0.options = v.into();
11150            self
11151        }
11152
11153        /// Sends the request.
11154        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11155            (*self.0.stub)
11156                .search(self.0.request, self.0.options)
11157                .await
11158                .map(gax::response::Response::into_body)
11159        }
11160
11161        /// Streams each page in the collection.
11162        pub fn by_page(
11163            self,
11164        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11165        {
11166            use std::clone::Clone;
11167            let token = self.0.request.page_token.clone();
11168            let execute = move |token: String| {
11169                let mut builder = self.clone();
11170                builder.0.request = builder.0.request.set_page_token(token);
11171                builder.send()
11172            };
11173            gax::paginator::internal::new_paginator(token, execute)
11174        }
11175
11176        /// Streams each item in the collection.
11177        pub fn by_item(
11178            self,
11179        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11180        {
11181            use gax::paginator::Paginator;
11182            self.by_page().items()
11183        }
11184
11185        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11186        ///
11187        /// This is a **required** field for requests.
11188        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11189            self.0.request.serving_config = v.into();
11190            self
11191        }
11192
11193        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11194        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11195            self.0.request.branch = v.into();
11196            self
11197        }
11198
11199        /// Sets the value of [query][crate::model::SearchRequest::query].
11200        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11201            self.0.request.query = v.into();
11202            self
11203        }
11204
11205        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11206        pub fn set_image_query<T>(mut self, v: T) -> Self
11207        where
11208            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11209        {
11210            self.0.request.image_query = std::option::Option::Some(v.into());
11211            self
11212        }
11213
11214        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11215        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11216        where
11217            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11218        {
11219            self.0.request.image_query = v.map(|x| x.into());
11220            self
11221        }
11222
11223        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11224        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11225            self.0.request.page_size = v.into();
11226            self
11227        }
11228
11229        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11230        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11231            self.0.request.page_token = v.into();
11232            self
11233        }
11234
11235        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11236        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11237            self.0.request.offset = v.into();
11238            self
11239        }
11240
11241        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11242        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11243            self.0.request.one_box_page_size = v.into();
11244            self
11245        }
11246
11247        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11248        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11249        where
11250            T: std::iter::IntoIterator<Item = V>,
11251            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11252        {
11253            use std::iter::Iterator;
11254            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11255            self
11256        }
11257
11258        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11259        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11260            self.0.request.filter = v.into();
11261            self
11262        }
11263
11264        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11265        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11266            self.0.request.canonical_filter = v.into();
11267            self
11268        }
11269
11270        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11271        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11272            self.0.request.order_by = v.into();
11273            self
11274        }
11275
11276        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11277        pub fn set_user_info<T>(mut self, v: T) -> Self
11278        where
11279            T: std::convert::Into<crate::model::UserInfo>,
11280        {
11281            self.0.request.user_info = std::option::Option::Some(v.into());
11282            self
11283        }
11284
11285        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11286        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11287        where
11288            T: std::convert::Into<crate::model::UserInfo>,
11289        {
11290            self.0.request.user_info = v.map(|x| x.into());
11291            self
11292        }
11293
11294        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11295        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11296            self.0.request.language_code = v.into();
11297            self
11298        }
11299
11300        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11301        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11302        where
11303            T: std::iter::IntoIterator<Item = V>,
11304            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11305        {
11306            use std::iter::Iterator;
11307            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11308            self
11309        }
11310
11311        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11312        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11313        where
11314            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11315        {
11316            self.0.request.boost_spec = std::option::Option::Some(v.into());
11317            self
11318        }
11319
11320        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11321        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11322        where
11323            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11324        {
11325            self.0.request.boost_spec = v.map(|x| x.into());
11326            self
11327        }
11328
11329        /// Sets the value of [params][crate::model::SearchRequest::params].
11330        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11331        where
11332            T: std::iter::IntoIterator<Item = (K, V)>,
11333            K: std::convert::Into<std::string::String>,
11334            V: std::convert::Into<wkt::Value>,
11335        {
11336            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11337            self
11338        }
11339
11340        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11341        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11342        where
11343            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11344        {
11345            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11346            self
11347        }
11348
11349        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11350        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11351        where
11352            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11353        {
11354            self.0.request.query_expansion_spec = v.map(|x| x.into());
11355            self
11356        }
11357
11358        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11359        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11360        where
11361            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11362        {
11363            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11364            self
11365        }
11366
11367        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11368        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11369        where
11370            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11371        {
11372            self.0.request.spell_correction_spec = v.map(|x| x.into());
11373            self
11374        }
11375
11376        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11377        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11378            self.0.request.user_pseudo_id = v.into();
11379            self
11380        }
11381
11382        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11383        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11384        where
11385            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11386        {
11387            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11388            self
11389        }
11390
11391        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11392        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11393        where
11394            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11395        {
11396            self.0.request.content_search_spec = v.map(|x| x.into());
11397            self
11398        }
11399
11400        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11401        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11402            self.0.request.safe_search = v.into();
11403            self
11404        }
11405
11406        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11407        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11408        where
11409            T: std::iter::IntoIterator<Item = (K, V)>,
11410            K: std::convert::Into<std::string::String>,
11411            V: std::convert::Into<std::string::String>,
11412        {
11413            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11414            self
11415        }
11416
11417        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11418        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11419        where
11420            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11421        {
11422            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11423            self
11424        }
11425
11426        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11427        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11428        where
11429            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11430        {
11431            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11432            self
11433        }
11434
11435        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11436        pub fn set_display_spec<T>(mut self, v: T) -> Self
11437        where
11438            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11439        {
11440            self.0.request.display_spec = std::option::Option::Some(v.into());
11441            self
11442        }
11443
11444        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11445        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11446        where
11447            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11448        {
11449            self.0.request.display_spec = v.map(|x| x.into());
11450            self
11451        }
11452
11453        /// Sets the value of [session][crate::model::SearchRequest::session].
11454        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11455            self.0.request.session = v.into();
11456            self
11457        }
11458
11459        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11460        pub fn set_session_spec<T>(mut self, v: T) -> Self
11461        where
11462            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11463        {
11464            self.0.request.session_spec = std::option::Option::Some(v.into());
11465            self
11466        }
11467
11468        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11469        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11470        where
11471            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11472        {
11473            self.0.request.session_spec = v.map(|x| x.into());
11474            self
11475        }
11476
11477        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11478        pub fn set_relevance_threshold<
11479            T: Into<crate::model::search_request::RelevanceThreshold>,
11480        >(
11481            mut self,
11482            v: T,
11483        ) -> Self {
11484            self.0.request.relevance_threshold = v.into();
11485            self
11486        }
11487
11488        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11489        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11490        where
11491            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11492        {
11493            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11494            self
11495        }
11496
11497        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11498        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11499        where
11500            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11501        {
11502            self.0.request.relevance_score_spec = v.map(|x| x.into());
11503            self
11504        }
11505    }
11506
11507    #[doc(hidden)]
11508    impl gax::options::internal::RequestBuilder for Search {
11509        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11510            &mut self.0.options
11511        }
11512    }
11513
11514    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11515    ///
11516    /// # Example
11517    /// ```no_run
11518    /// # use google_cloud_discoveryengine_v1::builder;
11519    /// use builder::search_service::SearchLite;
11520    /// # tokio_test::block_on(async {
11521    /// use gax::paginator::ItemPaginator;
11522    ///
11523    /// let builder = prepare_request_builder();
11524    /// let mut items = builder.by_item();
11525    /// while let Some(result) = items.next().await {
11526    ///   let item = result?;
11527    /// }
11528    /// # gax::Result::<()>::Ok(()) });
11529    ///
11530    /// fn prepare_request_builder() -> SearchLite {
11531    ///   # panic!();
11532    ///   // ... details omitted ...
11533    /// }
11534    /// ```
11535    #[derive(Clone, Debug)]
11536    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11537
11538    impl SearchLite {
11539        pub(crate) fn new(
11540            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11541        ) -> Self {
11542            Self(RequestBuilder::new(stub))
11543        }
11544
11545        /// Sets the full request, replacing any prior values.
11546        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11547            self.0.request = v.into();
11548            self
11549        }
11550
11551        /// Sets all the options, replacing any prior values.
11552        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11553            self.0.options = v.into();
11554            self
11555        }
11556
11557        /// Sends the request.
11558        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11559            (*self.0.stub)
11560                .search_lite(self.0.request, self.0.options)
11561                .await
11562                .map(gax::response::Response::into_body)
11563        }
11564
11565        /// Streams each page in the collection.
11566        pub fn by_page(
11567            self,
11568        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11569        {
11570            use std::clone::Clone;
11571            let token = self.0.request.page_token.clone();
11572            let execute = move |token: String| {
11573                let mut builder = self.clone();
11574                builder.0.request = builder.0.request.set_page_token(token);
11575                builder.send()
11576            };
11577            gax::paginator::internal::new_paginator(token, execute)
11578        }
11579
11580        /// Streams each item in the collection.
11581        pub fn by_item(
11582            self,
11583        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11584        {
11585            use gax::paginator::Paginator;
11586            self.by_page().items()
11587        }
11588
11589        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11590        ///
11591        /// This is a **required** field for requests.
11592        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11593            self.0.request.serving_config = v.into();
11594            self
11595        }
11596
11597        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11598        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11599            self.0.request.branch = v.into();
11600            self
11601        }
11602
11603        /// Sets the value of [query][crate::model::SearchRequest::query].
11604        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11605            self.0.request.query = v.into();
11606            self
11607        }
11608
11609        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11610        pub fn set_image_query<T>(mut self, v: T) -> Self
11611        where
11612            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11613        {
11614            self.0.request.image_query = std::option::Option::Some(v.into());
11615            self
11616        }
11617
11618        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11619        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11620        where
11621            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11622        {
11623            self.0.request.image_query = v.map(|x| x.into());
11624            self
11625        }
11626
11627        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11628        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11629            self.0.request.page_size = v.into();
11630            self
11631        }
11632
11633        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11634        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11635            self.0.request.page_token = v.into();
11636            self
11637        }
11638
11639        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11640        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11641            self.0.request.offset = v.into();
11642            self
11643        }
11644
11645        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11646        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11647            self.0.request.one_box_page_size = v.into();
11648            self
11649        }
11650
11651        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11652        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11653        where
11654            T: std::iter::IntoIterator<Item = V>,
11655            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11656        {
11657            use std::iter::Iterator;
11658            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11659            self
11660        }
11661
11662        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11663        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11664            self.0.request.filter = v.into();
11665            self
11666        }
11667
11668        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11669        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11670            self.0.request.canonical_filter = v.into();
11671            self
11672        }
11673
11674        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11675        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11676            self.0.request.order_by = v.into();
11677            self
11678        }
11679
11680        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11681        pub fn set_user_info<T>(mut self, v: T) -> Self
11682        where
11683            T: std::convert::Into<crate::model::UserInfo>,
11684        {
11685            self.0.request.user_info = std::option::Option::Some(v.into());
11686            self
11687        }
11688
11689        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11690        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11691        where
11692            T: std::convert::Into<crate::model::UserInfo>,
11693        {
11694            self.0.request.user_info = v.map(|x| x.into());
11695            self
11696        }
11697
11698        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11699        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11700            self.0.request.language_code = v.into();
11701            self
11702        }
11703
11704        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11705        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11706        where
11707            T: std::iter::IntoIterator<Item = V>,
11708            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11709        {
11710            use std::iter::Iterator;
11711            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11712            self
11713        }
11714
11715        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11716        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11717        where
11718            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11719        {
11720            self.0.request.boost_spec = std::option::Option::Some(v.into());
11721            self
11722        }
11723
11724        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11725        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11726        where
11727            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11728        {
11729            self.0.request.boost_spec = v.map(|x| x.into());
11730            self
11731        }
11732
11733        /// Sets the value of [params][crate::model::SearchRequest::params].
11734        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11735        where
11736            T: std::iter::IntoIterator<Item = (K, V)>,
11737            K: std::convert::Into<std::string::String>,
11738            V: std::convert::Into<wkt::Value>,
11739        {
11740            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11741            self
11742        }
11743
11744        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11745        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11746        where
11747            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11748        {
11749            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11750            self
11751        }
11752
11753        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11754        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11755        where
11756            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11757        {
11758            self.0.request.query_expansion_spec = v.map(|x| x.into());
11759            self
11760        }
11761
11762        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11763        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11764        where
11765            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11766        {
11767            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11768            self
11769        }
11770
11771        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11772        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11773        where
11774            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11775        {
11776            self.0.request.spell_correction_spec = v.map(|x| x.into());
11777            self
11778        }
11779
11780        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11781        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11782            self.0.request.user_pseudo_id = v.into();
11783            self
11784        }
11785
11786        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11787        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11788        where
11789            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11790        {
11791            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11792            self
11793        }
11794
11795        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11796        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11797        where
11798            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11799        {
11800            self.0.request.content_search_spec = v.map(|x| x.into());
11801            self
11802        }
11803
11804        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11805        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11806            self.0.request.safe_search = v.into();
11807            self
11808        }
11809
11810        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11811        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11812        where
11813            T: std::iter::IntoIterator<Item = (K, V)>,
11814            K: std::convert::Into<std::string::String>,
11815            V: std::convert::Into<std::string::String>,
11816        {
11817            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11818            self
11819        }
11820
11821        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11822        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11823        where
11824            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11825        {
11826            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11827            self
11828        }
11829
11830        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11831        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11832        where
11833            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11834        {
11835            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11836            self
11837        }
11838
11839        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11840        pub fn set_display_spec<T>(mut self, v: T) -> Self
11841        where
11842            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11843        {
11844            self.0.request.display_spec = std::option::Option::Some(v.into());
11845            self
11846        }
11847
11848        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11849        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11850        where
11851            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11852        {
11853            self.0.request.display_spec = v.map(|x| x.into());
11854            self
11855        }
11856
11857        /// Sets the value of [session][crate::model::SearchRequest::session].
11858        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11859            self.0.request.session = v.into();
11860            self
11861        }
11862
11863        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11864        pub fn set_session_spec<T>(mut self, v: T) -> Self
11865        where
11866            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11867        {
11868            self.0.request.session_spec = std::option::Option::Some(v.into());
11869            self
11870        }
11871
11872        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11873        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11874        where
11875            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11876        {
11877            self.0.request.session_spec = v.map(|x| x.into());
11878            self
11879        }
11880
11881        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11882        pub fn set_relevance_threshold<
11883            T: Into<crate::model::search_request::RelevanceThreshold>,
11884        >(
11885            mut self,
11886            v: T,
11887        ) -> Self {
11888            self.0.request.relevance_threshold = v.into();
11889            self
11890        }
11891
11892        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11893        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11894        where
11895            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11896        {
11897            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11898            self
11899        }
11900
11901        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11902        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11903        where
11904            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11905        {
11906            self.0.request.relevance_score_spec = v.map(|x| x.into());
11907            self
11908        }
11909    }
11910
11911    #[doc(hidden)]
11912    impl gax::options::internal::RequestBuilder for SearchLite {
11913        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11914            &mut self.0.options
11915        }
11916    }
11917
11918    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
11919    ///
11920    /// # Example
11921    /// ```no_run
11922    /// # use google_cloud_discoveryengine_v1::builder;
11923    /// use builder::search_service::ListOperations;
11924    /// # tokio_test::block_on(async {
11925    /// use gax::paginator::ItemPaginator;
11926    ///
11927    /// let builder = prepare_request_builder();
11928    /// let mut items = builder.by_item();
11929    /// while let Some(result) = items.next().await {
11930    ///   let item = result?;
11931    /// }
11932    /// # gax::Result::<()>::Ok(()) });
11933    ///
11934    /// fn prepare_request_builder() -> ListOperations {
11935    ///   # panic!();
11936    ///   // ... details omitted ...
11937    /// }
11938    /// ```
11939    #[derive(Clone, Debug)]
11940    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11941
11942    impl ListOperations {
11943        pub(crate) fn new(
11944            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11945        ) -> Self {
11946            Self(RequestBuilder::new(stub))
11947        }
11948
11949        /// Sets the full request, replacing any prior values.
11950        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11951            mut self,
11952            v: V,
11953        ) -> Self {
11954            self.0.request = v.into();
11955            self
11956        }
11957
11958        /// Sets all the options, replacing any prior values.
11959        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11960            self.0.options = v.into();
11961            self
11962        }
11963
11964        /// Sends the request.
11965        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11966            (*self.0.stub)
11967                .list_operations(self.0.request, self.0.options)
11968                .await
11969                .map(gax::response::Response::into_body)
11970        }
11971
11972        /// Streams each page in the collection.
11973        pub fn by_page(
11974            self,
11975        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11976        {
11977            use std::clone::Clone;
11978            let token = self.0.request.page_token.clone();
11979            let execute = move |token: String| {
11980                let mut builder = self.clone();
11981                builder.0.request = builder.0.request.set_page_token(token);
11982                builder.send()
11983            };
11984            gax::paginator::internal::new_paginator(token, execute)
11985        }
11986
11987        /// Streams each item in the collection.
11988        pub fn by_item(
11989            self,
11990        ) -> impl gax::paginator::ItemPaginator<
11991            longrunning::model::ListOperationsResponse,
11992            gax::error::Error,
11993        > {
11994            use gax::paginator::Paginator;
11995            self.by_page().items()
11996        }
11997
11998        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
11999        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12000            self.0.request.name = v.into();
12001            self
12002        }
12003
12004        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12005        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12006            self.0.request.filter = v.into();
12007            self
12008        }
12009
12010        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12011        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12012            self.0.request.page_size = v.into();
12013            self
12014        }
12015
12016        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12017        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12018            self.0.request.page_token = v.into();
12019            self
12020        }
12021    }
12022
12023    #[doc(hidden)]
12024    impl gax::options::internal::RequestBuilder for ListOperations {
12025        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12026            &mut self.0.options
12027        }
12028    }
12029
12030    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12031    ///
12032    /// # Example
12033    /// ```no_run
12034    /// # use google_cloud_discoveryengine_v1::builder;
12035    /// use builder::search_service::GetOperation;
12036    /// # tokio_test::block_on(async {
12037    ///
12038    /// let builder = prepare_request_builder();
12039    /// let response = builder.send().await?;
12040    /// # gax::Result::<()>::Ok(()) });
12041    ///
12042    /// fn prepare_request_builder() -> GetOperation {
12043    ///   # panic!();
12044    ///   // ... details omitted ...
12045    /// }
12046    /// ```
12047    #[derive(Clone, Debug)]
12048    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12049
12050    impl GetOperation {
12051        pub(crate) fn new(
12052            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12053        ) -> Self {
12054            Self(RequestBuilder::new(stub))
12055        }
12056
12057        /// Sets the full request, replacing any prior values.
12058        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12059            mut self,
12060            v: V,
12061        ) -> Self {
12062            self.0.request = v.into();
12063            self
12064        }
12065
12066        /// Sets all the options, replacing any prior values.
12067        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12068            self.0.options = v.into();
12069            self
12070        }
12071
12072        /// Sends the request.
12073        pub async fn send(self) -> Result<longrunning::model::Operation> {
12074            (*self.0.stub)
12075                .get_operation(self.0.request, self.0.options)
12076                .await
12077                .map(gax::response::Response::into_body)
12078        }
12079
12080        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12081        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12082            self.0.request.name = v.into();
12083            self
12084        }
12085    }
12086
12087    #[doc(hidden)]
12088    impl gax::options::internal::RequestBuilder for GetOperation {
12089        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12090            &mut self.0.options
12091        }
12092    }
12093
12094    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12095    ///
12096    /// # Example
12097    /// ```no_run
12098    /// # use google_cloud_discoveryengine_v1::builder;
12099    /// use builder::search_service::CancelOperation;
12100    /// # tokio_test::block_on(async {
12101    ///
12102    /// let builder = prepare_request_builder();
12103    /// let response = builder.send().await?;
12104    /// # gax::Result::<()>::Ok(()) });
12105    ///
12106    /// fn prepare_request_builder() -> CancelOperation {
12107    ///   # panic!();
12108    ///   // ... details omitted ...
12109    /// }
12110    /// ```
12111    #[derive(Clone, Debug)]
12112    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12113
12114    impl CancelOperation {
12115        pub(crate) fn new(
12116            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12117        ) -> Self {
12118            Self(RequestBuilder::new(stub))
12119        }
12120
12121        /// Sets the full request, replacing any prior values.
12122        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12123            mut self,
12124            v: V,
12125        ) -> Self {
12126            self.0.request = v.into();
12127            self
12128        }
12129
12130        /// Sets all the options, replacing any prior values.
12131        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12132            self.0.options = v.into();
12133            self
12134        }
12135
12136        /// Sends the request.
12137        pub async fn send(self) -> Result<()> {
12138            (*self.0.stub)
12139                .cancel_operation(self.0.request, self.0.options)
12140                .await
12141                .map(gax::response::Response::into_body)
12142        }
12143
12144        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12145        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12146            self.0.request.name = v.into();
12147            self
12148        }
12149    }
12150
12151    #[doc(hidden)]
12152    impl gax::options::internal::RequestBuilder for CancelOperation {
12153        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12154            &mut self.0.options
12155        }
12156    }
12157}
12158
12159#[cfg(feature = "search-tuning-service")]
12160#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12161pub mod search_tuning_service {
12162    use crate::Result;
12163
12164    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12165    ///
12166    /// ```
12167    /// # tokio_test::block_on(async {
12168    /// # use google_cloud_discoveryengine_v1::*;
12169    /// # use builder::search_tuning_service::ClientBuilder;
12170    /// # use client::SearchTuningService;
12171    /// let builder : ClientBuilder = SearchTuningService::builder();
12172    /// let client = builder
12173    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12174    ///     .build().await?;
12175    /// # gax::client_builder::Result::<()>::Ok(()) });
12176    /// ```
12177    pub type ClientBuilder =
12178        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12179
12180    pub(crate) mod client {
12181        use super::super::super::client::SearchTuningService;
12182        pub struct Factory;
12183        impl gax::client_builder::internal::ClientFactory for Factory {
12184            type Client = SearchTuningService;
12185            type Credentials = gaxi::options::Credentials;
12186            async fn build(
12187                self,
12188                config: gaxi::options::ClientConfig,
12189            ) -> gax::client_builder::Result<Self::Client> {
12190                Self::Client::new(config).await
12191            }
12192        }
12193    }
12194
12195    /// Common implementation for [crate::client::SearchTuningService] request builders.
12196    #[derive(Clone, Debug)]
12197    pub(crate) struct RequestBuilder<R: std::default::Default> {
12198        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12199        request: R,
12200        options: gax::options::RequestOptions,
12201    }
12202
12203    impl<R> RequestBuilder<R>
12204    where
12205        R: std::default::Default,
12206    {
12207        pub(crate) fn new(
12208            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12209        ) -> Self {
12210            Self {
12211                stub,
12212                request: R::default(),
12213                options: gax::options::RequestOptions::default(),
12214            }
12215        }
12216    }
12217
12218    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12219    ///
12220    /// # Example
12221    /// ```no_run
12222    /// # use google_cloud_discoveryengine_v1::builder;
12223    /// use builder::search_tuning_service::TrainCustomModel;
12224    /// # tokio_test::block_on(async {
12225    /// use lro::Poller;
12226    ///
12227    /// let builder = prepare_request_builder();
12228    /// let response = builder.poller().until_done().await?;
12229    /// # gax::Result::<()>::Ok(()) });
12230    ///
12231    /// fn prepare_request_builder() -> TrainCustomModel {
12232    ///   # panic!();
12233    ///   // ... details omitted ...
12234    /// }
12235    /// ```
12236    #[derive(Clone, Debug)]
12237    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12238
12239    impl TrainCustomModel {
12240        pub(crate) fn new(
12241            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12242        ) -> Self {
12243            Self(RequestBuilder::new(stub))
12244        }
12245
12246        /// Sets the full request, replacing any prior values.
12247        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12248            mut self,
12249            v: V,
12250        ) -> Self {
12251            self.0.request = v.into();
12252            self
12253        }
12254
12255        /// Sets all the options, replacing any prior values.
12256        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12257            self.0.options = v.into();
12258            self
12259        }
12260
12261        /// Sends the request.
12262        ///
12263        /// # Long running operations
12264        ///
12265        /// This starts, but does not poll, a longrunning operation. More information
12266        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12267        pub async fn send(self) -> Result<longrunning::model::Operation> {
12268            (*self.0.stub)
12269                .train_custom_model(self.0.request, self.0.options)
12270                .await
12271                .map(gax::response::Response::into_body)
12272        }
12273
12274        /// Creates a [Poller][lro::Poller] to work with `train_custom_model`.
12275        pub fn poller(
12276            self,
12277        ) -> impl lro::Poller<
12278            crate::model::TrainCustomModelResponse,
12279            crate::model::TrainCustomModelMetadata,
12280        > {
12281            type Operation = lro::internal::Operation<
12282                crate::model::TrainCustomModelResponse,
12283                crate::model::TrainCustomModelMetadata,
12284            >;
12285            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12286            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12287
12288            let stub = self.0.stub.clone();
12289            let mut options = self.0.options.clone();
12290            options.set_retry_policy(gax::retry_policy::NeverRetry);
12291            let query = move |name| {
12292                let stub = stub.clone();
12293                let options = options.clone();
12294                async {
12295                    let op = GetOperation::new(stub)
12296                        .set_name(name)
12297                        .with_options(options)
12298                        .send()
12299                        .await?;
12300                    Ok(Operation::new(op))
12301                }
12302            };
12303
12304            let start = move || async {
12305                let op = self.send().await?;
12306                Ok(Operation::new(op))
12307            };
12308
12309            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12310        }
12311
12312        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12313        ///
12314        /// This is a **required** field for requests.
12315        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12316            self.0.request.data_store = v.into();
12317            self
12318        }
12319
12320        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12321        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12322            self.0.request.model_type = v.into();
12323            self
12324        }
12325
12326        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12327        pub fn set_error_config<T>(mut self, v: T) -> Self
12328        where
12329            T: std::convert::Into<crate::model::ImportErrorConfig>,
12330        {
12331            self.0.request.error_config = std::option::Option::Some(v.into());
12332            self
12333        }
12334
12335        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12336        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12337        where
12338            T: std::convert::Into<crate::model::ImportErrorConfig>,
12339        {
12340            self.0.request.error_config = v.map(|x| x.into());
12341            self
12342        }
12343
12344        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12345        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12346            self.0.request.model_id = v.into();
12347            self
12348        }
12349
12350        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12351        ///
12352        /// Note that all the setters affecting `training_input` are
12353        /// mutually exclusive.
12354        pub fn set_training_input<
12355            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12356        >(
12357            mut self,
12358            v: T,
12359        ) -> Self {
12360            self.0.request.training_input = v.into();
12361            self
12362        }
12363
12364        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12365        /// to hold a `GcsTrainingInput`.
12366        ///
12367        /// Note that all the setters affecting `training_input` are
12368        /// mutually exclusive.
12369        pub fn set_gcs_training_input<
12370            T: std::convert::Into<
12371                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12372                >,
12373        >(
12374            mut self,
12375            v: T,
12376        ) -> Self {
12377            self.0.request = self.0.request.set_gcs_training_input(v);
12378            self
12379        }
12380    }
12381
12382    #[doc(hidden)]
12383    impl gax::options::internal::RequestBuilder for TrainCustomModel {
12384        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12385            &mut self.0.options
12386        }
12387    }
12388
12389    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12390    ///
12391    /// # Example
12392    /// ```no_run
12393    /// # use google_cloud_discoveryengine_v1::builder;
12394    /// use builder::search_tuning_service::ListCustomModels;
12395    /// # tokio_test::block_on(async {
12396    ///
12397    /// let builder = prepare_request_builder();
12398    /// let response = builder.send().await?;
12399    /// # gax::Result::<()>::Ok(()) });
12400    ///
12401    /// fn prepare_request_builder() -> ListCustomModels {
12402    ///   # panic!();
12403    ///   // ... details omitted ...
12404    /// }
12405    /// ```
12406    #[derive(Clone, Debug)]
12407    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12408
12409    impl ListCustomModels {
12410        pub(crate) fn new(
12411            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12412        ) -> Self {
12413            Self(RequestBuilder::new(stub))
12414        }
12415
12416        /// Sets the full request, replacing any prior values.
12417        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12418            mut self,
12419            v: V,
12420        ) -> Self {
12421            self.0.request = v.into();
12422            self
12423        }
12424
12425        /// Sets all the options, replacing any prior values.
12426        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12427            self.0.options = v.into();
12428            self
12429        }
12430
12431        /// Sends the request.
12432        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12433            (*self.0.stub)
12434                .list_custom_models(self.0.request, self.0.options)
12435                .await
12436                .map(gax::response::Response::into_body)
12437        }
12438
12439        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12440        ///
12441        /// This is a **required** field for requests.
12442        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12443            self.0.request.data_store = v.into();
12444            self
12445        }
12446    }
12447
12448    #[doc(hidden)]
12449    impl gax::options::internal::RequestBuilder for ListCustomModels {
12450        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12451            &mut self.0.options
12452        }
12453    }
12454
12455    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12456    ///
12457    /// # Example
12458    /// ```no_run
12459    /// # use google_cloud_discoveryengine_v1::builder;
12460    /// use builder::search_tuning_service::ListOperations;
12461    /// # tokio_test::block_on(async {
12462    /// use gax::paginator::ItemPaginator;
12463    ///
12464    /// let builder = prepare_request_builder();
12465    /// let mut items = builder.by_item();
12466    /// while let Some(result) = items.next().await {
12467    ///   let item = result?;
12468    /// }
12469    /// # gax::Result::<()>::Ok(()) });
12470    ///
12471    /// fn prepare_request_builder() -> ListOperations {
12472    ///   # panic!();
12473    ///   // ... details omitted ...
12474    /// }
12475    /// ```
12476    #[derive(Clone, Debug)]
12477    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12478
12479    impl ListOperations {
12480        pub(crate) fn new(
12481            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12482        ) -> Self {
12483            Self(RequestBuilder::new(stub))
12484        }
12485
12486        /// Sets the full request, replacing any prior values.
12487        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12488            mut self,
12489            v: V,
12490        ) -> Self {
12491            self.0.request = v.into();
12492            self
12493        }
12494
12495        /// Sets all the options, replacing any prior values.
12496        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12497            self.0.options = v.into();
12498            self
12499        }
12500
12501        /// Sends the request.
12502        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12503            (*self.0.stub)
12504                .list_operations(self.0.request, self.0.options)
12505                .await
12506                .map(gax::response::Response::into_body)
12507        }
12508
12509        /// Streams each page in the collection.
12510        pub fn by_page(
12511            self,
12512        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12513        {
12514            use std::clone::Clone;
12515            let token = self.0.request.page_token.clone();
12516            let execute = move |token: String| {
12517                let mut builder = self.clone();
12518                builder.0.request = builder.0.request.set_page_token(token);
12519                builder.send()
12520            };
12521            gax::paginator::internal::new_paginator(token, execute)
12522        }
12523
12524        /// Streams each item in the collection.
12525        pub fn by_item(
12526            self,
12527        ) -> impl gax::paginator::ItemPaginator<
12528            longrunning::model::ListOperationsResponse,
12529            gax::error::Error,
12530        > {
12531            use gax::paginator::Paginator;
12532            self.by_page().items()
12533        }
12534
12535        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12536        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12537            self.0.request.name = v.into();
12538            self
12539        }
12540
12541        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12542        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12543            self.0.request.filter = v.into();
12544            self
12545        }
12546
12547        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12548        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12549            self.0.request.page_size = v.into();
12550            self
12551        }
12552
12553        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12554        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12555            self.0.request.page_token = v.into();
12556            self
12557        }
12558    }
12559
12560    #[doc(hidden)]
12561    impl gax::options::internal::RequestBuilder for ListOperations {
12562        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12563            &mut self.0.options
12564        }
12565    }
12566
12567    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
12568    ///
12569    /// # Example
12570    /// ```no_run
12571    /// # use google_cloud_discoveryengine_v1::builder;
12572    /// use builder::search_tuning_service::GetOperation;
12573    /// # tokio_test::block_on(async {
12574    ///
12575    /// let builder = prepare_request_builder();
12576    /// let response = builder.send().await?;
12577    /// # gax::Result::<()>::Ok(()) });
12578    ///
12579    /// fn prepare_request_builder() -> GetOperation {
12580    ///   # panic!();
12581    ///   // ... details omitted ...
12582    /// }
12583    /// ```
12584    #[derive(Clone, Debug)]
12585    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12586
12587    impl GetOperation {
12588        pub(crate) fn new(
12589            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12590        ) -> Self {
12591            Self(RequestBuilder::new(stub))
12592        }
12593
12594        /// Sets the full request, replacing any prior values.
12595        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12596            mut self,
12597            v: V,
12598        ) -> Self {
12599            self.0.request = v.into();
12600            self
12601        }
12602
12603        /// Sets all the options, replacing any prior values.
12604        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12605            self.0.options = v.into();
12606            self
12607        }
12608
12609        /// Sends the request.
12610        pub async fn send(self) -> Result<longrunning::model::Operation> {
12611            (*self.0.stub)
12612                .get_operation(self.0.request, self.0.options)
12613                .await
12614                .map(gax::response::Response::into_body)
12615        }
12616
12617        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12618        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12619            self.0.request.name = v.into();
12620            self
12621        }
12622    }
12623
12624    #[doc(hidden)]
12625    impl gax::options::internal::RequestBuilder for GetOperation {
12626        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12627            &mut self.0.options
12628        }
12629    }
12630
12631    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
12632    ///
12633    /// # Example
12634    /// ```no_run
12635    /// # use google_cloud_discoveryengine_v1::builder;
12636    /// use builder::search_tuning_service::CancelOperation;
12637    /// # tokio_test::block_on(async {
12638    ///
12639    /// let builder = prepare_request_builder();
12640    /// let response = builder.send().await?;
12641    /// # gax::Result::<()>::Ok(()) });
12642    ///
12643    /// fn prepare_request_builder() -> CancelOperation {
12644    ///   # panic!();
12645    ///   // ... details omitted ...
12646    /// }
12647    /// ```
12648    #[derive(Clone, Debug)]
12649    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12650
12651    impl CancelOperation {
12652        pub(crate) fn new(
12653            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12654        ) -> Self {
12655            Self(RequestBuilder::new(stub))
12656        }
12657
12658        /// Sets the full request, replacing any prior values.
12659        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12660            mut self,
12661            v: V,
12662        ) -> Self {
12663            self.0.request = v.into();
12664            self
12665        }
12666
12667        /// Sets all the options, replacing any prior values.
12668        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12669            self.0.options = v.into();
12670            self
12671        }
12672
12673        /// Sends the request.
12674        pub async fn send(self) -> Result<()> {
12675            (*self.0.stub)
12676                .cancel_operation(self.0.request, self.0.options)
12677                .await
12678                .map(gax::response::Response::into_body)
12679        }
12680
12681        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12682        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12683            self.0.request.name = v.into();
12684            self
12685        }
12686    }
12687
12688    #[doc(hidden)]
12689    impl gax::options::internal::RequestBuilder for CancelOperation {
12690        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12691            &mut self.0.options
12692        }
12693    }
12694}
12695
12696#[cfg(feature = "serving-config-service")]
12697#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12698pub mod serving_config_service {
12699    use crate::Result;
12700
12701    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
12702    ///
12703    /// ```
12704    /// # tokio_test::block_on(async {
12705    /// # use google_cloud_discoveryengine_v1::*;
12706    /// # use builder::serving_config_service::ClientBuilder;
12707    /// # use client::ServingConfigService;
12708    /// let builder : ClientBuilder = ServingConfigService::builder();
12709    /// let client = builder
12710    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12711    ///     .build().await?;
12712    /// # gax::client_builder::Result::<()>::Ok(()) });
12713    /// ```
12714    pub type ClientBuilder =
12715        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12716
12717    pub(crate) mod client {
12718        use super::super::super::client::ServingConfigService;
12719        pub struct Factory;
12720        impl gax::client_builder::internal::ClientFactory for Factory {
12721            type Client = ServingConfigService;
12722            type Credentials = gaxi::options::Credentials;
12723            async fn build(
12724                self,
12725                config: gaxi::options::ClientConfig,
12726            ) -> gax::client_builder::Result<Self::Client> {
12727                Self::Client::new(config).await
12728            }
12729        }
12730    }
12731
12732    /// Common implementation for [crate::client::ServingConfigService] request builders.
12733    #[derive(Clone, Debug)]
12734    pub(crate) struct RequestBuilder<R: std::default::Default> {
12735        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12736        request: R,
12737        options: gax::options::RequestOptions,
12738    }
12739
12740    impl<R> RequestBuilder<R>
12741    where
12742        R: std::default::Default,
12743    {
12744        pub(crate) fn new(
12745            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12746        ) -> Self {
12747            Self {
12748                stub,
12749                request: R::default(),
12750                options: gax::options::RequestOptions::default(),
12751            }
12752        }
12753    }
12754
12755    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
12756    ///
12757    /// # Example
12758    /// ```no_run
12759    /// # use google_cloud_discoveryengine_v1::builder;
12760    /// use builder::serving_config_service::UpdateServingConfig;
12761    /// # tokio_test::block_on(async {
12762    ///
12763    /// let builder = prepare_request_builder();
12764    /// let response = builder.send().await?;
12765    /// # gax::Result::<()>::Ok(()) });
12766    ///
12767    /// fn prepare_request_builder() -> UpdateServingConfig {
12768    ///   # panic!();
12769    ///   // ... details omitted ...
12770    /// }
12771    /// ```
12772    #[derive(Clone, Debug)]
12773    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12774
12775    impl UpdateServingConfig {
12776        pub(crate) fn new(
12777            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12778        ) -> Self {
12779            Self(RequestBuilder::new(stub))
12780        }
12781
12782        /// Sets the full request, replacing any prior values.
12783        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12784            mut self,
12785            v: V,
12786        ) -> Self {
12787            self.0.request = v.into();
12788            self
12789        }
12790
12791        /// Sets all the options, replacing any prior values.
12792        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12793            self.0.options = v.into();
12794            self
12795        }
12796
12797        /// Sends the request.
12798        pub async fn send(self) -> Result<crate::model::ServingConfig> {
12799            (*self.0.stub)
12800                .update_serving_config(self.0.request, self.0.options)
12801                .await
12802                .map(gax::response::Response::into_body)
12803        }
12804
12805        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12806        ///
12807        /// This is a **required** field for requests.
12808        pub fn set_serving_config<T>(mut self, v: T) -> Self
12809        where
12810            T: std::convert::Into<crate::model::ServingConfig>,
12811        {
12812            self.0.request.serving_config = std::option::Option::Some(v.into());
12813            self
12814        }
12815
12816        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12817        ///
12818        /// This is a **required** field for requests.
12819        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12820        where
12821            T: std::convert::Into<crate::model::ServingConfig>,
12822        {
12823            self.0.request.serving_config = v.map(|x| x.into());
12824            self
12825        }
12826
12827        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12828        pub fn set_update_mask<T>(mut self, v: T) -> Self
12829        where
12830            T: std::convert::Into<wkt::FieldMask>,
12831        {
12832            self.0.request.update_mask = std::option::Option::Some(v.into());
12833            self
12834        }
12835
12836        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12837        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12838        where
12839            T: std::convert::Into<wkt::FieldMask>,
12840        {
12841            self.0.request.update_mask = v.map(|x| x.into());
12842            self
12843        }
12844    }
12845
12846    #[doc(hidden)]
12847    impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12848        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12849            &mut self.0.options
12850        }
12851    }
12852
12853    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
12854    ///
12855    /// # Example
12856    /// ```no_run
12857    /// # use google_cloud_discoveryengine_v1::builder;
12858    /// use builder::serving_config_service::ListOperations;
12859    /// # tokio_test::block_on(async {
12860    /// use gax::paginator::ItemPaginator;
12861    ///
12862    /// let builder = prepare_request_builder();
12863    /// let mut items = builder.by_item();
12864    /// while let Some(result) = items.next().await {
12865    ///   let item = result?;
12866    /// }
12867    /// # gax::Result::<()>::Ok(()) });
12868    ///
12869    /// fn prepare_request_builder() -> ListOperations {
12870    ///   # panic!();
12871    ///   // ... details omitted ...
12872    /// }
12873    /// ```
12874    #[derive(Clone, Debug)]
12875    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12876
12877    impl ListOperations {
12878        pub(crate) fn new(
12879            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12880        ) -> Self {
12881            Self(RequestBuilder::new(stub))
12882        }
12883
12884        /// Sets the full request, replacing any prior values.
12885        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12886            mut self,
12887            v: V,
12888        ) -> Self {
12889            self.0.request = v.into();
12890            self
12891        }
12892
12893        /// Sets all the options, replacing any prior values.
12894        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12895            self.0.options = v.into();
12896            self
12897        }
12898
12899        /// Sends the request.
12900        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12901            (*self.0.stub)
12902                .list_operations(self.0.request, self.0.options)
12903                .await
12904                .map(gax::response::Response::into_body)
12905        }
12906
12907        /// Streams each page in the collection.
12908        pub fn by_page(
12909            self,
12910        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12911        {
12912            use std::clone::Clone;
12913            let token = self.0.request.page_token.clone();
12914            let execute = move |token: String| {
12915                let mut builder = self.clone();
12916                builder.0.request = builder.0.request.set_page_token(token);
12917                builder.send()
12918            };
12919            gax::paginator::internal::new_paginator(token, execute)
12920        }
12921
12922        /// Streams each item in the collection.
12923        pub fn by_item(
12924            self,
12925        ) -> impl gax::paginator::ItemPaginator<
12926            longrunning::model::ListOperationsResponse,
12927            gax::error::Error,
12928        > {
12929            use gax::paginator::Paginator;
12930            self.by_page().items()
12931        }
12932
12933        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12934        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12935            self.0.request.name = v.into();
12936            self
12937        }
12938
12939        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12940        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12941            self.0.request.filter = v.into();
12942            self
12943        }
12944
12945        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12946        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12947            self.0.request.page_size = v.into();
12948            self
12949        }
12950
12951        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12952        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12953            self.0.request.page_token = v.into();
12954            self
12955        }
12956    }
12957
12958    #[doc(hidden)]
12959    impl gax::options::internal::RequestBuilder for ListOperations {
12960        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12961            &mut self.0.options
12962        }
12963    }
12964
12965    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
12966    ///
12967    /// # Example
12968    /// ```no_run
12969    /// # use google_cloud_discoveryengine_v1::builder;
12970    /// use builder::serving_config_service::GetOperation;
12971    /// # tokio_test::block_on(async {
12972    ///
12973    /// let builder = prepare_request_builder();
12974    /// let response = builder.send().await?;
12975    /// # gax::Result::<()>::Ok(()) });
12976    ///
12977    /// fn prepare_request_builder() -> GetOperation {
12978    ///   # panic!();
12979    ///   // ... details omitted ...
12980    /// }
12981    /// ```
12982    #[derive(Clone, Debug)]
12983    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12984
12985    impl GetOperation {
12986        pub(crate) fn new(
12987            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12988        ) -> Self {
12989            Self(RequestBuilder::new(stub))
12990        }
12991
12992        /// Sets the full request, replacing any prior values.
12993        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12994            mut self,
12995            v: V,
12996        ) -> Self {
12997            self.0.request = v.into();
12998            self
12999        }
13000
13001        /// Sets all the options, replacing any prior values.
13002        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13003            self.0.options = v.into();
13004            self
13005        }
13006
13007        /// Sends the request.
13008        pub async fn send(self) -> Result<longrunning::model::Operation> {
13009            (*self.0.stub)
13010                .get_operation(self.0.request, self.0.options)
13011                .await
13012                .map(gax::response::Response::into_body)
13013        }
13014
13015        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13016        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13017            self.0.request.name = v.into();
13018            self
13019        }
13020    }
13021
13022    #[doc(hidden)]
13023    impl gax::options::internal::RequestBuilder for GetOperation {
13024        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13025            &mut self.0.options
13026        }
13027    }
13028
13029    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13030    ///
13031    /// # Example
13032    /// ```no_run
13033    /// # use google_cloud_discoveryengine_v1::builder;
13034    /// use builder::serving_config_service::CancelOperation;
13035    /// # tokio_test::block_on(async {
13036    ///
13037    /// let builder = prepare_request_builder();
13038    /// let response = builder.send().await?;
13039    /// # gax::Result::<()>::Ok(()) });
13040    ///
13041    /// fn prepare_request_builder() -> CancelOperation {
13042    ///   # panic!();
13043    ///   // ... details omitted ...
13044    /// }
13045    /// ```
13046    #[derive(Clone, Debug)]
13047    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13048
13049    impl CancelOperation {
13050        pub(crate) fn new(
13051            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13052        ) -> Self {
13053            Self(RequestBuilder::new(stub))
13054        }
13055
13056        /// Sets the full request, replacing any prior values.
13057        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13058            mut self,
13059            v: V,
13060        ) -> Self {
13061            self.0.request = v.into();
13062            self
13063        }
13064
13065        /// Sets all the options, replacing any prior values.
13066        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13067            self.0.options = v.into();
13068            self
13069        }
13070
13071        /// Sends the request.
13072        pub async fn send(self) -> Result<()> {
13073            (*self.0.stub)
13074                .cancel_operation(self.0.request, self.0.options)
13075                .await
13076                .map(gax::response::Response::into_body)
13077        }
13078
13079        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13080        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13081            self.0.request.name = v.into();
13082            self
13083        }
13084    }
13085
13086    #[doc(hidden)]
13087    impl gax::options::internal::RequestBuilder for CancelOperation {
13088        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13089            &mut self.0.options
13090        }
13091    }
13092}
13093
13094#[cfg(feature = "session-service")]
13095#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13096pub mod session_service {
13097    use crate::Result;
13098
13099    /// A builder for [SessionService][crate::client::SessionService].
13100    ///
13101    /// ```
13102    /// # tokio_test::block_on(async {
13103    /// # use google_cloud_discoveryengine_v1::*;
13104    /// # use builder::session_service::ClientBuilder;
13105    /// # use client::SessionService;
13106    /// let builder : ClientBuilder = SessionService::builder();
13107    /// let client = builder
13108    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13109    ///     .build().await?;
13110    /// # gax::client_builder::Result::<()>::Ok(()) });
13111    /// ```
13112    pub type ClientBuilder =
13113        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13114
13115    pub(crate) mod client {
13116        use super::super::super::client::SessionService;
13117        pub struct Factory;
13118        impl gax::client_builder::internal::ClientFactory for Factory {
13119            type Client = SessionService;
13120            type Credentials = gaxi::options::Credentials;
13121            async fn build(
13122                self,
13123                config: gaxi::options::ClientConfig,
13124            ) -> gax::client_builder::Result<Self::Client> {
13125                Self::Client::new(config).await
13126            }
13127        }
13128    }
13129
13130    /// Common implementation for [crate::client::SessionService] request builders.
13131    #[derive(Clone, Debug)]
13132    pub(crate) struct RequestBuilder<R: std::default::Default> {
13133        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13134        request: R,
13135        options: gax::options::RequestOptions,
13136    }
13137
13138    impl<R> RequestBuilder<R>
13139    where
13140        R: std::default::Default,
13141    {
13142        pub(crate) fn new(
13143            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13144        ) -> Self {
13145            Self {
13146                stub,
13147                request: R::default(),
13148                options: gax::options::RequestOptions::default(),
13149            }
13150        }
13151    }
13152
13153    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13154    ///
13155    /// # Example
13156    /// ```no_run
13157    /// # use google_cloud_discoveryengine_v1::builder;
13158    /// use builder::session_service::CreateSession;
13159    /// # tokio_test::block_on(async {
13160    ///
13161    /// let builder = prepare_request_builder();
13162    /// let response = builder.send().await?;
13163    /// # gax::Result::<()>::Ok(()) });
13164    ///
13165    /// fn prepare_request_builder() -> CreateSession {
13166    ///   # panic!();
13167    ///   // ... details omitted ...
13168    /// }
13169    /// ```
13170    #[derive(Clone, Debug)]
13171    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13172
13173    impl CreateSession {
13174        pub(crate) fn new(
13175            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13176        ) -> Self {
13177            Self(RequestBuilder::new(stub))
13178        }
13179
13180        /// Sets the full request, replacing any prior values.
13181        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13182            self.0.request = v.into();
13183            self
13184        }
13185
13186        /// Sets all the options, replacing any prior values.
13187        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13188            self.0.options = v.into();
13189            self
13190        }
13191
13192        /// Sends the request.
13193        pub async fn send(self) -> Result<crate::model::Session> {
13194            (*self.0.stub)
13195                .create_session(self.0.request, self.0.options)
13196                .await
13197                .map(gax::response::Response::into_body)
13198        }
13199
13200        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13201        ///
13202        /// This is a **required** field for requests.
13203        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13204            self.0.request.parent = v.into();
13205            self
13206        }
13207
13208        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13209        ///
13210        /// This is a **required** field for requests.
13211        pub fn set_session<T>(mut self, v: T) -> Self
13212        where
13213            T: std::convert::Into<crate::model::Session>,
13214        {
13215            self.0.request.session = std::option::Option::Some(v.into());
13216            self
13217        }
13218
13219        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13220        ///
13221        /// This is a **required** field for requests.
13222        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13223        where
13224            T: std::convert::Into<crate::model::Session>,
13225        {
13226            self.0.request.session = v.map(|x| x.into());
13227            self
13228        }
13229    }
13230
13231    #[doc(hidden)]
13232    impl gax::options::internal::RequestBuilder for CreateSession {
13233        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13234            &mut self.0.options
13235        }
13236    }
13237
13238    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13239    ///
13240    /// # Example
13241    /// ```no_run
13242    /// # use google_cloud_discoveryengine_v1::builder;
13243    /// use builder::session_service::DeleteSession;
13244    /// # tokio_test::block_on(async {
13245    ///
13246    /// let builder = prepare_request_builder();
13247    /// let response = builder.send().await?;
13248    /// # gax::Result::<()>::Ok(()) });
13249    ///
13250    /// fn prepare_request_builder() -> DeleteSession {
13251    ///   # panic!();
13252    ///   // ... details omitted ...
13253    /// }
13254    /// ```
13255    #[derive(Clone, Debug)]
13256    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13257
13258    impl DeleteSession {
13259        pub(crate) fn new(
13260            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13261        ) -> Self {
13262            Self(RequestBuilder::new(stub))
13263        }
13264
13265        /// Sets the full request, replacing any prior values.
13266        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13267            self.0.request = v.into();
13268            self
13269        }
13270
13271        /// Sets all the options, replacing any prior values.
13272        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13273            self.0.options = v.into();
13274            self
13275        }
13276
13277        /// Sends the request.
13278        pub async fn send(self) -> Result<()> {
13279            (*self.0.stub)
13280                .delete_session(self.0.request, self.0.options)
13281                .await
13282                .map(gax::response::Response::into_body)
13283        }
13284
13285        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13286        ///
13287        /// This is a **required** field for requests.
13288        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13289            self.0.request.name = v.into();
13290            self
13291        }
13292    }
13293
13294    #[doc(hidden)]
13295    impl gax::options::internal::RequestBuilder for DeleteSession {
13296        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13297            &mut self.0.options
13298        }
13299    }
13300
13301    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13302    ///
13303    /// # Example
13304    /// ```no_run
13305    /// # use google_cloud_discoveryengine_v1::builder;
13306    /// use builder::session_service::UpdateSession;
13307    /// # tokio_test::block_on(async {
13308    ///
13309    /// let builder = prepare_request_builder();
13310    /// let response = builder.send().await?;
13311    /// # gax::Result::<()>::Ok(()) });
13312    ///
13313    /// fn prepare_request_builder() -> UpdateSession {
13314    ///   # panic!();
13315    ///   // ... details omitted ...
13316    /// }
13317    /// ```
13318    #[derive(Clone, Debug)]
13319    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13320
13321    impl UpdateSession {
13322        pub(crate) fn new(
13323            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13324        ) -> Self {
13325            Self(RequestBuilder::new(stub))
13326        }
13327
13328        /// Sets the full request, replacing any prior values.
13329        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13330            self.0.request = v.into();
13331            self
13332        }
13333
13334        /// Sets all the options, replacing any prior values.
13335        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13336            self.0.options = v.into();
13337            self
13338        }
13339
13340        /// Sends the request.
13341        pub async fn send(self) -> Result<crate::model::Session> {
13342            (*self.0.stub)
13343                .update_session(self.0.request, self.0.options)
13344                .await
13345                .map(gax::response::Response::into_body)
13346        }
13347
13348        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13349        ///
13350        /// This is a **required** field for requests.
13351        pub fn set_session<T>(mut self, v: T) -> Self
13352        where
13353            T: std::convert::Into<crate::model::Session>,
13354        {
13355            self.0.request.session = std::option::Option::Some(v.into());
13356            self
13357        }
13358
13359        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13360        ///
13361        /// This is a **required** field for requests.
13362        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13363        where
13364            T: std::convert::Into<crate::model::Session>,
13365        {
13366            self.0.request.session = v.map(|x| x.into());
13367            self
13368        }
13369
13370        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13371        pub fn set_update_mask<T>(mut self, v: T) -> Self
13372        where
13373            T: std::convert::Into<wkt::FieldMask>,
13374        {
13375            self.0.request.update_mask = std::option::Option::Some(v.into());
13376            self
13377        }
13378
13379        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13380        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13381        where
13382            T: std::convert::Into<wkt::FieldMask>,
13383        {
13384            self.0.request.update_mask = v.map(|x| x.into());
13385            self
13386        }
13387    }
13388
13389    #[doc(hidden)]
13390    impl gax::options::internal::RequestBuilder for UpdateSession {
13391        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13392            &mut self.0.options
13393        }
13394    }
13395
13396    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13397    ///
13398    /// # Example
13399    /// ```no_run
13400    /// # use google_cloud_discoveryengine_v1::builder;
13401    /// use builder::session_service::GetSession;
13402    /// # tokio_test::block_on(async {
13403    ///
13404    /// let builder = prepare_request_builder();
13405    /// let response = builder.send().await?;
13406    /// # gax::Result::<()>::Ok(()) });
13407    ///
13408    /// fn prepare_request_builder() -> GetSession {
13409    ///   # panic!();
13410    ///   // ... details omitted ...
13411    /// }
13412    /// ```
13413    #[derive(Clone, Debug)]
13414    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13415
13416    impl GetSession {
13417        pub(crate) fn new(
13418            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13419        ) -> Self {
13420            Self(RequestBuilder::new(stub))
13421        }
13422
13423        /// Sets the full request, replacing any prior values.
13424        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13425            self.0.request = v.into();
13426            self
13427        }
13428
13429        /// Sets all the options, replacing any prior values.
13430        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13431            self.0.options = v.into();
13432            self
13433        }
13434
13435        /// Sends the request.
13436        pub async fn send(self) -> Result<crate::model::Session> {
13437            (*self.0.stub)
13438                .get_session(self.0.request, self.0.options)
13439                .await
13440                .map(gax::response::Response::into_body)
13441        }
13442
13443        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13444        ///
13445        /// This is a **required** field for requests.
13446        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13447            self.0.request.name = v.into();
13448            self
13449        }
13450
13451        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13452        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13453            self.0.request.include_answer_details = v.into();
13454            self
13455        }
13456    }
13457
13458    #[doc(hidden)]
13459    impl gax::options::internal::RequestBuilder for GetSession {
13460        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13461            &mut self.0.options
13462        }
13463    }
13464
13465    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13466    ///
13467    /// # Example
13468    /// ```no_run
13469    /// # use google_cloud_discoveryengine_v1::builder;
13470    /// use builder::session_service::ListSessions;
13471    /// # tokio_test::block_on(async {
13472    /// use gax::paginator::ItemPaginator;
13473    ///
13474    /// let builder = prepare_request_builder();
13475    /// let mut items = builder.by_item();
13476    /// while let Some(result) = items.next().await {
13477    ///   let item = result?;
13478    /// }
13479    /// # gax::Result::<()>::Ok(()) });
13480    ///
13481    /// fn prepare_request_builder() -> ListSessions {
13482    ///   # panic!();
13483    ///   // ... details omitted ...
13484    /// }
13485    /// ```
13486    #[derive(Clone, Debug)]
13487    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13488
13489    impl ListSessions {
13490        pub(crate) fn new(
13491            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13492        ) -> Self {
13493            Self(RequestBuilder::new(stub))
13494        }
13495
13496        /// Sets the full request, replacing any prior values.
13497        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13498            self.0.request = v.into();
13499            self
13500        }
13501
13502        /// Sets all the options, replacing any prior values.
13503        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13504            self.0.options = v.into();
13505            self
13506        }
13507
13508        /// Sends the request.
13509        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13510            (*self.0.stub)
13511                .list_sessions(self.0.request, self.0.options)
13512                .await
13513                .map(gax::response::Response::into_body)
13514        }
13515
13516        /// Streams each page in the collection.
13517        pub fn by_page(
13518            self,
13519        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13520        {
13521            use std::clone::Clone;
13522            let token = self.0.request.page_token.clone();
13523            let execute = move |token: String| {
13524                let mut builder = self.clone();
13525                builder.0.request = builder.0.request.set_page_token(token);
13526                builder.send()
13527            };
13528            gax::paginator::internal::new_paginator(token, execute)
13529        }
13530
13531        /// Streams each item in the collection.
13532        pub fn by_item(
13533            self,
13534        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13535        {
13536            use gax::paginator::Paginator;
13537            self.by_page().items()
13538        }
13539
13540        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
13541        ///
13542        /// This is a **required** field for requests.
13543        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13544            self.0.request.parent = v.into();
13545            self
13546        }
13547
13548        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
13549        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13550            self.0.request.page_size = v.into();
13551            self
13552        }
13553
13554        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
13555        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13556            self.0.request.page_token = v.into();
13557            self
13558        }
13559
13560        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
13561        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13562            self.0.request.filter = v.into();
13563            self
13564        }
13565
13566        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
13567        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13568            self.0.request.order_by = v.into();
13569            self
13570        }
13571    }
13572
13573    #[doc(hidden)]
13574    impl gax::options::internal::RequestBuilder for ListSessions {
13575        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13576            &mut self.0.options
13577        }
13578    }
13579
13580    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
13581    ///
13582    /// # Example
13583    /// ```no_run
13584    /// # use google_cloud_discoveryengine_v1::builder;
13585    /// use builder::session_service::ListOperations;
13586    /// # tokio_test::block_on(async {
13587    /// use gax::paginator::ItemPaginator;
13588    ///
13589    /// let builder = prepare_request_builder();
13590    /// let mut items = builder.by_item();
13591    /// while let Some(result) = items.next().await {
13592    ///   let item = result?;
13593    /// }
13594    /// # gax::Result::<()>::Ok(()) });
13595    ///
13596    /// fn prepare_request_builder() -> ListOperations {
13597    ///   # panic!();
13598    ///   // ... details omitted ...
13599    /// }
13600    /// ```
13601    #[derive(Clone, Debug)]
13602    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13603
13604    impl ListOperations {
13605        pub(crate) fn new(
13606            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13607        ) -> Self {
13608            Self(RequestBuilder::new(stub))
13609        }
13610
13611        /// Sets the full request, replacing any prior values.
13612        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13613            mut self,
13614            v: V,
13615        ) -> Self {
13616            self.0.request = v.into();
13617            self
13618        }
13619
13620        /// Sets all the options, replacing any prior values.
13621        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13622            self.0.options = v.into();
13623            self
13624        }
13625
13626        /// Sends the request.
13627        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13628            (*self.0.stub)
13629                .list_operations(self.0.request, self.0.options)
13630                .await
13631                .map(gax::response::Response::into_body)
13632        }
13633
13634        /// Streams each page in the collection.
13635        pub fn by_page(
13636            self,
13637        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13638        {
13639            use std::clone::Clone;
13640            let token = self.0.request.page_token.clone();
13641            let execute = move |token: String| {
13642                let mut builder = self.clone();
13643                builder.0.request = builder.0.request.set_page_token(token);
13644                builder.send()
13645            };
13646            gax::paginator::internal::new_paginator(token, execute)
13647        }
13648
13649        /// Streams each item in the collection.
13650        pub fn by_item(
13651            self,
13652        ) -> impl gax::paginator::ItemPaginator<
13653            longrunning::model::ListOperationsResponse,
13654            gax::error::Error,
13655        > {
13656            use gax::paginator::Paginator;
13657            self.by_page().items()
13658        }
13659
13660        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
13661        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13662            self.0.request.name = v.into();
13663            self
13664        }
13665
13666        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
13667        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13668            self.0.request.filter = v.into();
13669            self
13670        }
13671
13672        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
13673        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13674            self.0.request.page_size = v.into();
13675            self
13676        }
13677
13678        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
13679        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680            self.0.request.page_token = v.into();
13681            self
13682        }
13683    }
13684
13685    #[doc(hidden)]
13686    impl gax::options::internal::RequestBuilder for ListOperations {
13687        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13688            &mut self.0.options
13689        }
13690    }
13691
13692    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
13693    ///
13694    /// # Example
13695    /// ```no_run
13696    /// # use google_cloud_discoveryengine_v1::builder;
13697    /// use builder::session_service::GetOperation;
13698    /// # tokio_test::block_on(async {
13699    ///
13700    /// let builder = prepare_request_builder();
13701    /// let response = builder.send().await?;
13702    /// # gax::Result::<()>::Ok(()) });
13703    ///
13704    /// fn prepare_request_builder() -> GetOperation {
13705    ///   # panic!();
13706    ///   // ... details omitted ...
13707    /// }
13708    /// ```
13709    #[derive(Clone, Debug)]
13710    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13711
13712    impl GetOperation {
13713        pub(crate) fn new(
13714            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13715        ) -> Self {
13716            Self(RequestBuilder::new(stub))
13717        }
13718
13719        /// Sets the full request, replacing any prior values.
13720        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13721            mut self,
13722            v: V,
13723        ) -> Self {
13724            self.0.request = v.into();
13725            self
13726        }
13727
13728        /// Sets all the options, replacing any prior values.
13729        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13730            self.0.options = v.into();
13731            self
13732        }
13733
13734        /// Sends the request.
13735        pub async fn send(self) -> Result<longrunning::model::Operation> {
13736            (*self.0.stub)
13737                .get_operation(self.0.request, self.0.options)
13738                .await
13739                .map(gax::response::Response::into_body)
13740        }
13741
13742        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13743        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13744            self.0.request.name = v.into();
13745            self
13746        }
13747    }
13748
13749    #[doc(hidden)]
13750    impl gax::options::internal::RequestBuilder for GetOperation {
13751        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13752            &mut self.0.options
13753        }
13754    }
13755
13756    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
13757    ///
13758    /// # Example
13759    /// ```no_run
13760    /// # use google_cloud_discoveryengine_v1::builder;
13761    /// use builder::session_service::CancelOperation;
13762    /// # tokio_test::block_on(async {
13763    ///
13764    /// let builder = prepare_request_builder();
13765    /// let response = builder.send().await?;
13766    /// # gax::Result::<()>::Ok(()) });
13767    ///
13768    /// fn prepare_request_builder() -> CancelOperation {
13769    ///   # panic!();
13770    ///   // ... details omitted ...
13771    /// }
13772    /// ```
13773    #[derive(Clone, Debug)]
13774    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13775
13776    impl CancelOperation {
13777        pub(crate) fn new(
13778            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13779        ) -> Self {
13780            Self(RequestBuilder::new(stub))
13781        }
13782
13783        /// Sets the full request, replacing any prior values.
13784        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13785            mut self,
13786            v: V,
13787        ) -> Self {
13788            self.0.request = v.into();
13789            self
13790        }
13791
13792        /// Sets all the options, replacing any prior values.
13793        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13794            self.0.options = v.into();
13795            self
13796        }
13797
13798        /// Sends the request.
13799        pub async fn send(self) -> Result<()> {
13800            (*self.0.stub)
13801                .cancel_operation(self.0.request, self.0.options)
13802                .await
13803                .map(gax::response::Response::into_body)
13804        }
13805
13806        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13807        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13808            self.0.request.name = v.into();
13809            self
13810        }
13811    }
13812
13813    #[doc(hidden)]
13814    impl gax::options::internal::RequestBuilder for CancelOperation {
13815        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13816            &mut self.0.options
13817        }
13818    }
13819}
13820
13821#[cfg(feature = "site-search-engine-service")]
13822#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13823pub mod site_search_engine_service {
13824    use crate::Result;
13825
13826    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
13827    ///
13828    /// ```
13829    /// # tokio_test::block_on(async {
13830    /// # use google_cloud_discoveryengine_v1::*;
13831    /// # use builder::site_search_engine_service::ClientBuilder;
13832    /// # use client::SiteSearchEngineService;
13833    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
13834    /// let client = builder
13835    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13836    ///     .build().await?;
13837    /// # gax::client_builder::Result::<()>::Ok(()) });
13838    /// ```
13839    pub type ClientBuilder =
13840        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13841
13842    pub(crate) mod client {
13843        use super::super::super::client::SiteSearchEngineService;
13844        pub struct Factory;
13845        impl gax::client_builder::internal::ClientFactory for Factory {
13846            type Client = SiteSearchEngineService;
13847            type Credentials = gaxi::options::Credentials;
13848            async fn build(
13849                self,
13850                config: gaxi::options::ClientConfig,
13851            ) -> gax::client_builder::Result<Self::Client> {
13852                Self::Client::new(config).await
13853            }
13854        }
13855    }
13856
13857    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
13858    #[derive(Clone, Debug)]
13859    pub(crate) struct RequestBuilder<R: std::default::Default> {
13860        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13861        request: R,
13862        options: gax::options::RequestOptions,
13863    }
13864
13865    impl<R> RequestBuilder<R>
13866    where
13867        R: std::default::Default,
13868    {
13869        pub(crate) fn new(
13870            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13871        ) -> Self {
13872            Self {
13873                stub,
13874                request: R::default(),
13875                options: gax::options::RequestOptions::default(),
13876            }
13877        }
13878    }
13879
13880    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
13881    ///
13882    /// # Example
13883    /// ```no_run
13884    /// # use google_cloud_discoveryengine_v1::builder;
13885    /// use builder::site_search_engine_service::GetSiteSearchEngine;
13886    /// # tokio_test::block_on(async {
13887    ///
13888    /// let builder = prepare_request_builder();
13889    /// let response = builder.send().await?;
13890    /// # gax::Result::<()>::Ok(()) });
13891    ///
13892    /// fn prepare_request_builder() -> GetSiteSearchEngine {
13893    ///   # panic!();
13894    ///   // ... details omitted ...
13895    /// }
13896    /// ```
13897    #[derive(Clone, Debug)]
13898    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
13899
13900    impl GetSiteSearchEngine {
13901        pub(crate) fn new(
13902            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13903        ) -> Self {
13904            Self(RequestBuilder::new(stub))
13905        }
13906
13907        /// Sets the full request, replacing any prior values.
13908        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
13909            mut self,
13910            v: V,
13911        ) -> Self {
13912            self.0.request = v.into();
13913            self
13914        }
13915
13916        /// Sets all the options, replacing any prior values.
13917        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13918            self.0.options = v.into();
13919            self
13920        }
13921
13922        /// Sends the request.
13923        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
13924            (*self.0.stub)
13925                .get_site_search_engine(self.0.request, self.0.options)
13926                .await
13927                .map(gax::response::Response::into_body)
13928        }
13929
13930        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
13931        ///
13932        /// This is a **required** field for requests.
13933        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13934            self.0.request.name = v.into();
13935            self
13936        }
13937    }
13938
13939    #[doc(hidden)]
13940    impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
13941        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13942            &mut self.0.options
13943        }
13944    }
13945
13946    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
13947    ///
13948    /// # Example
13949    /// ```no_run
13950    /// # use google_cloud_discoveryengine_v1::builder;
13951    /// use builder::site_search_engine_service::CreateTargetSite;
13952    /// # tokio_test::block_on(async {
13953    /// use lro::Poller;
13954    ///
13955    /// let builder = prepare_request_builder();
13956    /// let response = builder.poller().until_done().await?;
13957    /// # gax::Result::<()>::Ok(()) });
13958    ///
13959    /// fn prepare_request_builder() -> CreateTargetSite {
13960    ///   # panic!();
13961    ///   // ... details omitted ...
13962    /// }
13963    /// ```
13964    #[derive(Clone, Debug)]
13965    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
13966
13967    impl CreateTargetSite {
13968        pub(crate) fn new(
13969            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13970        ) -> Self {
13971            Self(RequestBuilder::new(stub))
13972        }
13973
13974        /// Sets the full request, replacing any prior values.
13975        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
13976            mut self,
13977            v: V,
13978        ) -> Self {
13979            self.0.request = v.into();
13980            self
13981        }
13982
13983        /// Sets all the options, replacing any prior values.
13984        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13985            self.0.options = v.into();
13986            self
13987        }
13988
13989        /// Sends the request.
13990        ///
13991        /// # Long running operations
13992        ///
13993        /// This starts, but does not poll, a longrunning operation. More information
13994        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
13995        pub async fn send(self) -> Result<longrunning::model::Operation> {
13996            (*self.0.stub)
13997                .create_target_site(self.0.request, self.0.options)
13998                .await
13999                .map(gax::response::Response::into_body)
14000        }
14001
14002        /// Creates a [Poller][lro::Poller] to work with `create_target_site`.
14003        pub fn poller(
14004            self,
14005        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14006        {
14007            type Operation = lro::internal::Operation<
14008                crate::model::TargetSite,
14009                crate::model::CreateTargetSiteMetadata,
14010            >;
14011            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14012            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14013
14014            let stub = self.0.stub.clone();
14015            let mut options = self.0.options.clone();
14016            options.set_retry_policy(gax::retry_policy::NeverRetry);
14017            let query = move |name| {
14018                let stub = stub.clone();
14019                let options = options.clone();
14020                async {
14021                    let op = GetOperation::new(stub)
14022                        .set_name(name)
14023                        .with_options(options)
14024                        .send()
14025                        .await?;
14026                    Ok(Operation::new(op))
14027                }
14028            };
14029
14030            let start = move || async {
14031                let op = self.send().await?;
14032                Ok(Operation::new(op))
14033            };
14034
14035            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14036        }
14037
14038        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14039        ///
14040        /// This is a **required** field for requests.
14041        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14042            self.0.request.parent = v.into();
14043            self
14044        }
14045
14046        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14047        ///
14048        /// This is a **required** field for requests.
14049        pub fn set_target_site<T>(mut self, v: T) -> Self
14050        where
14051            T: std::convert::Into<crate::model::TargetSite>,
14052        {
14053            self.0.request.target_site = std::option::Option::Some(v.into());
14054            self
14055        }
14056
14057        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14058        ///
14059        /// This is a **required** field for requests.
14060        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14061        where
14062            T: std::convert::Into<crate::model::TargetSite>,
14063        {
14064            self.0.request.target_site = v.map(|x| x.into());
14065            self
14066        }
14067    }
14068
14069    #[doc(hidden)]
14070    impl gax::options::internal::RequestBuilder for CreateTargetSite {
14071        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14072            &mut self.0.options
14073        }
14074    }
14075
14076    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14077    ///
14078    /// # Example
14079    /// ```no_run
14080    /// # use google_cloud_discoveryengine_v1::builder;
14081    /// use builder::site_search_engine_service::BatchCreateTargetSites;
14082    /// # tokio_test::block_on(async {
14083    /// use lro::Poller;
14084    ///
14085    /// let builder = prepare_request_builder();
14086    /// let response = builder.poller().until_done().await?;
14087    /// # gax::Result::<()>::Ok(()) });
14088    ///
14089    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14090    ///   # panic!();
14091    ///   // ... details omitted ...
14092    /// }
14093    /// ```
14094    #[derive(Clone, Debug)]
14095    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14096
14097    impl BatchCreateTargetSites {
14098        pub(crate) fn new(
14099            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14100        ) -> Self {
14101            Self(RequestBuilder::new(stub))
14102        }
14103
14104        /// Sets the full request, replacing any prior values.
14105        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14106            mut self,
14107            v: V,
14108        ) -> Self {
14109            self.0.request = v.into();
14110            self
14111        }
14112
14113        /// Sets all the options, replacing any prior values.
14114        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14115            self.0.options = v.into();
14116            self
14117        }
14118
14119        /// Sends the request.
14120        ///
14121        /// # Long running operations
14122        ///
14123        /// This starts, but does not poll, a longrunning operation. More information
14124        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14125        pub async fn send(self) -> Result<longrunning::model::Operation> {
14126            (*self.0.stub)
14127                .batch_create_target_sites(self.0.request, self.0.options)
14128                .await
14129                .map(gax::response::Response::into_body)
14130        }
14131
14132        /// Creates a [Poller][lro::Poller] to work with `batch_create_target_sites`.
14133        pub fn poller(
14134            self,
14135        ) -> impl lro::Poller<
14136            crate::model::BatchCreateTargetSitesResponse,
14137            crate::model::BatchCreateTargetSiteMetadata,
14138        > {
14139            type Operation = lro::internal::Operation<
14140                crate::model::BatchCreateTargetSitesResponse,
14141                crate::model::BatchCreateTargetSiteMetadata,
14142            >;
14143            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14144            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14145
14146            let stub = self.0.stub.clone();
14147            let mut options = self.0.options.clone();
14148            options.set_retry_policy(gax::retry_policy::NeverRetry);
14149            let query = move |name| {
14150                let stub = stub.clone();
14151                let options = options.clone();
14152                async {
14153                    let op = GetOperation::new(stub)
14154                        .set_name(name)
14155                        .with_options(options)
14156                        .send()
14157                        .await?;
14158                    Ok(Operation::new(op))
14159                }
14160            };
14161
14162            let start = move || async {
14163                let op = self.send().await?;
14164                Ok(Operation::new(op))
14165            };
14166
14167            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14168        }
14169
14170        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14171        ///
14172        /// This is a **required** field for requests.
14173        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14174            self.0.request.parent = v.into();
14175            self
14176        }
14177
14178        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14179        ///
14180        /// This is a **required** field for requests.
14181        pub fn set_requests<T, V>(mut self, v: T) -> Self
14182        where
14183            T: std::iter::IntoIterator<Item = V>,
14184            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14185        {
14186            use std::iter::Iterator;
14187            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14188            self
14189        }
14190    }
14191
14192    #[doc(hidden)]
14193    impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14194        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14195            &mut self.0.options
14196        }
14197    }
14198
14199    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14200    ///
14201    /// # Example
14202    /// ```no_run
14203    /// # use google_cloud_discoveryengine_v1::builder;
14204    /// use builder::site_search_engine_service::GetTargetSite;
14205    /// # tokio_test::block_on(async {
14206    ///
14207    /// let builder = prepare_request_builder();
14208    /// let response = builder.send().await?;
14209    /// # gax::Result::<()>::Ok(()) });
14210    ///
14211    /// fn prepare_request_builder() -> GetTargetSite {
14212    ///   # panic!();
14213    ///   // ... details omitted ...
14214    /// }
14215    /// ```
14216    #[derive(Clone, Debug)]
14217    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14218
14219    impl GetTargetSite {
14220        pub(crate) fn new(
14221            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14222        ) -> Self {
14223            Self(RequestBuilder::new(stub))
14224        }
14225
14226        /// Sets the full request, replacing any prior values.
14227        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14228            self.0.request = v.into();
14229            self
14230        }
14231
14232        /// Sets all the options, replacing any prior values.
14233        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14234            self.0.options = v.into();
14235            self
14236        }
14237
14238        /// Sends the request.
14239        pub async fn send(self) -> Result<crate::model::TargetSite> {
14240            (*self.0.stub)
14241                .get_target_site(self.0.request, self.0.options)
14242                .await
14243                .map(gax::response::Response::into_body)
14244        }
14245
14246        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14247        ///
14248        /// This is a **required** field for requests.
14249        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14250            self.0.request.name = v.into();
14251            self
14252        }
14253    }
14254
14255    #[doc(hidden)]
14256    impl gax::options::internal::RequestBuilder for GetTargetSite {
14257        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14258            &mut self.0.options
14259        }
14260    }
14261
14262    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14263    ///
14264    /// # Example
14265    /// ```no_run
14266    /// # use google_cloud_discoveryengine_v1::builder;
14267    /// use builder::site_search_engine_service::UpdateTargetSite;
14268    /// # tokio_test::block_on(async {
14269    /// use lro::Poller;
14270    ///
14271    /// let builder = prepare_request_builder();
14272    /// let response = builder.poller().until_done().await?;
14273    /// # gax::Result::<()>::Ok(()) });
14274    ///
14275    /// fn prepare_request_builder() -> UpdateTargetSite {
14276    ///   # panic!();
14277    ///   // ... details omitted ...
14278    /// }
14279    /// ```
14280    #[derive(Clone, Debug)]
14281    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14282
14283    impl UpdateTargetSite {
14284        pub(crate) fn new(
14285            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14286        ) -> Self {
14287            Self(RequestBuilder::new(stub))
14288        }
14289
14290        /// Sets the full request, replacing any prior values.
14291        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14292            mut self,
14293            v: V,
14294        ) -> Self {
14295            self.0.request = v.into();
14296            self
14297        }
14298
14299        /// Sets all the options, replacing any prior values.
14300        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14301            self.0.options = v.into();
14302            self
14303        }
14304
14305        /// Sends the request.
14306        ///
14307        /// # Long running operations
14308        ///
14309        /// This starts, but does not poll, a longrunning operation. More information
14310        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14311        pub async fn send(self) -> Result<longrunning::model::Operation> {
14312            (*self.0.stub)
14313                .update_target_site(self.0.request, self.0.options)
14314                .await
14315                .map(gax::response::Response::into_body)
14316        }
14317
14318        /// Creates a [Poller][lro::Poller] to work with `update_target_site`.
14319        pub fn poller(
14320            self,
14321        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14322        {
14323            type Operation = lro::internal::Operation<
14324                crate::model::TargetSite,
14325                crate::model::UpdateTargetSiteMetadata,
14326            >;
14327            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14328            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14329
14330            let stub = self.0.stub.clone();
14331            let mut options = self.0.options.clone();
14332            options.set_retry_policy(gax::retry_policy::NeverRetry);
14333            let query = move |name| {
14334                let stub = stub.clone();
14335                let options = options.clone();
14336                async {
14337                    let op = GetOperation::new(stub)
14338                        .set_name(name)
14339                        .with_options(options)
14340                        .send()
14341                        .await?;
14342                    Ok(Operation::new(op))
14343                }
14344            };
14345
14346            let start = move || async {
14347                let op = self.send().await?;
14348                Ok(Operation::new(op))
14349            };
14350
14351            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14352        }
14353
14354        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14355        ///
14356        /// This is a **required** field for requests.
14357        pub fn set_target_site<T>(mut self, v: T) -> Self
14358        where
14359            T: std::convert::Into<crate::model::TargetSite>,
14360        {
14361            self.0.request.target_site = std::option::Option::Some(v.into());
14362            self
14363        }
14364
14365        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14366        ///
14367        /// This is a **required** field for requests.
14368        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14369        where
14370            T: std::convert::Into<crate::model::TargetSite>,
14371        {
14372            self.0.request.target_site = v.map(|x| x.into());
14373            self
14374        }
14375    }
14376
14377    #[doc(hidden)]
14378    impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14379        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14380            &mut self.0.options
14381        }
14382    }
14383
14384    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14385    ///
14386    /// # Example
14387    /// ```no_run
14388    /// # use google_cloud_discoveryengine_v1::builder;
14389    /// use builder::site_search_engine_service::DeleteTargetSite;
14390    /// # tokio_test::block_on(async {
14391    /// use lro::Poller;
14392    ///
14393    /// let builder = prepare_request_builder();
14394    /// let response = builder.poller().until_done().await?;
14395    /// # gax::Result::<()>::Ok(()) });
14396    ///
14397    /// fn prepare_request_builder() -> DeleteTargetSite {
14398    ///   # panic!();
14399    ///   // ... details omitted ...
14400    /// }
14401    /// ```
14402    #[derive(Clone, Debug)]
14403    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14404
14405    impl DeleteTargetSite {
14406        pub(crate) fn new(
14407            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14408        ) -> Self {
14409            Self(RequestBuilder::new(stub))
14410        }
14411
14412        /// Sets the full request, replacing any prior values.
14413        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14414            mut self,
14415            v: V,
14416        ) -> Self {
14417            self.0.request = v.into();
14418            self
14419        }
14420
14421        /// Sets all the options, replacing any prior values.
14422        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14423            self.0.options = v.into();
14424            self
14425        }
14426
14427        /// Sends the request.
14428        ///
14429        /// # Long running operations
14430        ///
14431        /// This starts, but does not poll, a longrunning operation. More information
14432        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14433        pub async fn send(self) -> Result<longrunning::model::Operation> {
14434            (*self.0.stub)
14435                .delete_target_site(self.0.request, self.0.options)
14436                .await
14437                .map(gax::response::Response::into_body)
14438        }
14439
14440        /// Creates a [Poller][lro::Poller] to work with `delete_target_site`.
14441        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14442            type Operation =
14443                lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14444            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14445            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14446
14447            let stub = self.0.stub.clone();
14448            let mut options = self.0.options.clone();
14449            options.set_retry_policy(gax::retry_policy::NeverRetry);
14450            let query = move |name| {
14451                let stub = stub.clone();
14452                let options = options.clone();
14453                async {
14454                    let op = GetOperation::new(stub)
14455                        .set_name(name)
14456                        .with_options(options)
14457                        .send()
14458                        .await?;
14459                    Ok(Operation::new(op))
14460                }
14461            };
14462
14463            let start = move || async {
14464                let op = self.send().await?;
14465                Ok(Operation::new(op))
14466            };
14467
14468            lro::internal::new_unit_response_poller(
14469                polling_error_policy,
14470                polling_backoff_policy,
14471                start,
14472                query,
14473            )
14474        }
14475
14476        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
14477        ///
14478        /// This is a **required** field for requests.
14479        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14480            self.0.request.name = v.into();
14481            self
14482        }
14483    }
14484
14485    #[doc(hidden)]
14486    impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14487        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14488            &mut self.0.options
14489        }
14490    }
14491
14492    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
14493    ///
14494    /// # Example
14495    /// ```no_run
14496    /// # use google_cloud_discoveryengine_v1::builder;
14497    /// use builder::site_search_engine_service::ListTargetSites;
14498    /// # tokio_test::block_on(async {
14499    /// use gax::paginator::ItemPaginator;
14500    ///
14501    /// let builder = prepare_request_builder();
14502    /// let mut items = builder.by_item();
14503    /// while let Some(result) = items.next().await {
14504    ///   let item = result?;
14505    /// }
14506    /// # gax::Result::<()>::Ok(()) });
14507    ///
14508    /// fn prepare_request_builder() -> ListTargetSites {
14509    ///   # panic!();
14510    ///   // ... details omitted ...
14511    /// }
14512    /// ```
14513    #[derive(Clone, Debug)]
14514    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14515
14516    impl ListTargetSites {
14517        pub(crate) fn new(
14518            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14519        ) -> Self {
14520            Self(RequestBuilder::new(stub))
14521        }
14522
14523        /// Sets the full request, replacing any prior values.
14524        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14525            self.0.request = v.into();
14526            self
14527        }
14528
14529        /// Sets all the options, replacing any prior values.
14530        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14531            self.0.options = v.into();
14532            self
14533        }
14534
14535        /// Sends the request.
14536        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14537            (*self.0.stub)
14538                .list_target_sites(self.0.request, self.0.options)
14539                .await
14540                .map(gax::response::Response::into_body)
14541        }
14542
14543        /// Streams each page in the collection.
14544        pub fn by_page(
14545            self,
14546        ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14547        {
14548            use std::clone::Clone;
14549            let token = self.0.request.page_token.clone();
14550            let execute = move |token: String| {
14551                let mut builder = self.clone();
14552                builder.0.request = builder.0.request.set_page_token(token);
14553                builder.send()
14554            };
14555            gax::paginator::internal::new_paginator(token, execute)
14556        }
14557
14558        /// Streams each item in the collection.
14559        pub fn by_item(
14560            self,
14561        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14562        {
14563            use gax::paginator::Paginator;
14564            self.by_page().items()
14565        }
14566
14567        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
14568        ///
14569        /// This is a **required** field for requests.
14570        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14571            self.0.request.parent = v.into();
14572            self
14573        }
14574
14575        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
14576        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14577            self.0.request.page_size = v.into();
14578            self
14579        }
14580
14581        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
14582        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14583            self.0.request.page_token = v.into();
14584            self
14585        }
14586    }
14587
14588    #[doc(hidden)]
14589    impl gax::options::internal::RequestBuilder for ListTargetSites {
14590        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14591            &mut self.0.options
14592        }
14593    }
14594
14595    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
14596    ///
14597    /// # Example
14598    /// ```no_run
14599    /// # use google_cloud_discoveryengine_v1::builder;
14600    /// use builder::site_search_engine_service::CreateSitemap;
14601    /// # tokio_test::block_on(async {
14602    /// use lro::Poller;
14603    ///
14604    /// let builder = prepare_request_builder();
14605    /// let response = builder.poller().until_done().await?;
14606    /// # gax::Result::<()>::Ok(()) });
14607    ///
14608    /// fn prepare_request_builder() -> CreateSitemap {
14609    ///   # panic!();
14610    ///   // ... details omitted ...
14611    /// }
14612    /// ```
14613    #[derive(Clone, Debug)]
14614    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14615
14616    impl CreateSitemap {
14617        pub(crate) fn new(
14618            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14619        ) -> Self {
14620            Self(RequestBuilder::new(stub))
14621        }
14622
14623        /// Sets the full request, replacing any prior values.
14624        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14625            self.0.request = v.into();
14626            self
14627        }
14628
14629        /// Sets all the options, replacing any prior values.
14630        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14631            self.0.options = v.into();
14632            self
14633        }
14634
14635        /// Sends the request.
14636        ///
14637        /// # Long running operations
14638        ///
14639        /// This starts, but does not poll, a longrunning operation. More information
14640        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
14641        pub async fn send(self) -> Result<longrunning::model::Operation> {
14642            (*self.0.stub)
14643                .create_sitemap(self.0.request, self.0.options)
14644                .await
14645                .map(gax::response::Response::into_body)
14646        }
14647
14648        /// Creates a [Poller][lro::Poller] to work with `create_sitemap`.
14649        pub fn poller(
14650            self,
14651        ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14652            type Operation = lro::internal::Operation<
14653                crate::model::Sitemap,
14654                crate::model::CreateSitemapMetadata,
14655            >;
14656            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14657            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14658
14659            let stub = self.0.stub.clone();
14660            let mut options = self.0.options.clone();
14661            options.set_retry_policy(gax::retry_policy::NeverRetry);
14662            let query = move |name| {
14663                let stub = stub.clone();
14664                let options = options.clone();
14665                async {
14666                    let op = GetOperation::new(stub)
14667                        .set_name(name)
14668                        .with_options(options)
14669                        .send()
14670                        .await?;
14671                    Ok(Operation::new(op))
14672                }
14673            };
14674
14675            let start = move || async {
14676                let op = self.send().await?;
14677                Ok(Operation::new(op))
14678            };
14679
14680            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14681        }
14682
14683        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
14684        ///
14685        /// This is a **required** field for requests.
14686        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14687            self.0.request.parent = v.into();
14688            self
14689        }
14690
14691        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14692        ///
14693        /// This is a **required** field for requests.
14694        pub fn set_sitemap<T>(mut self, v: T) -> Self
14695        where
14696            T: std::convert::Into<crate::model::Sitemap>,
14697        {
14698            self.0.request.sitemap = std::option::Option::Some(v.into());
14699            self
14700        }
14701
14702        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14703        ///
14704        /// This is a **required** field for requests.
14705        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14706        where
14707            T: std::convert::Into<crate::model::Sitemap>,
14708        {
14709            self.0.request.sitemap = v.map(|x| x.into());
14710            self
14711        }
14712    }
14713
14714    #[doc(hidden)]
14715    impl gax::options::internal::RequestBuilder for CreateSitemap {
14716        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14717            &mut self.0.options
14718        }
14719    }
14720
14721    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
14722    ///
14723    /// # Example
14724    /// ```no_run
14725    /// # use google_cloud_discoveryengine_v1::builder;
14726    /// use builder::site_search_engine_service::DeleteSitemap;
14727    /// # tokio_test::block_on(async {
14728    /// use lro::Poller;
14729    ///
14730    /// let builder = prepare_request_builder();
14731    /// let response = builder.poller().until_done().await?;
14732    /// # gax::Result::<()>::Ok(()) });
14733    ///
14734    /// fn prepare_request_builder() -> DeleteSitemap {
14735    ///   # panic!();
14736    ///   // ... details omitted ...
14737    /// }
14738    /// ```
14739    #[derive(Clone, Debug)]
14740    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14741
14742    impl DeleteSitemap {
14743        pub(crate) fn new(
14744            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14745        ) -> Self {
14746            Self(RequestBuilder::new(stub))
14747        }
14748
14749        /// Sets the full request, replacing any prior values.
14750        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14751            self.0.request = v.into();
14752            self
14753        }
14754
14755        /// Sets all the options, replacing any prior values.
14756        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14757            self.0.options = v.into();
14758            self
14759        }
14760
14761        /// Sends the request.
14762        ///
14763        /// # Long running operations
14764        ///
14765        /// This starts, but does not poll, a longrunning operation. More information
14766        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
14767        pub async fn send(self) -> Result<longrunning::model::Operation> {
14768            (*self.0.stub)
14769                .delete_sitemap(self.0.request, self.0.options)
14770                .await
14771                .map(gax::response::Response::into_body)
14772        }
14773
14774        /// Creates a [Poller][lro::Poller] to work with `delete_sitemap`.
14775        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14776            type Operation =
14777                lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14778            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14779            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14780
14781            let stub = self.0.stub.clone();
14782            let mut options = self.0.options.clone();
14783            options.set_retry_policy(gax::retry_policy::NeverRetry);
14784            let query = move |name| {
14785                let stub = stub.clone();
14786                let options = options.clone();
14787                async {
14788                    let op = GetOperation::new(stub)
14789                        .set_name(name)
14790                        .with_options(options)
14791                        .send()
14792                        .await?;
14793                    Ok(Operation::new(op))
14794                }
14795            };
14796
14797            let start = move || async {
14798                let op = self.send().await?;
14799                Ok(Operation::new(op))
14800            };
14801
14802            lro::internal::new_unit_response_poller(
14803                polling_error_policy,
14804                polling_backoff_policy,
14805                start,
14806                query,
14807            )
14808        }
14809
14810        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
14811        ///
14812        /// This is a **required** field for requests.
14813        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14814            self.0.request.name = v.into();
14815            self
14816        }
14817    }
14818
14819    #[doc(hidden)]
14820    impl gax::options::internal::RequestBuilder for DeleteSitemap {
14821        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14822            &mut self.0.options
14823        }
14824    }
14825
14826    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
14827    ///
14828    /// # Example
14829    /// ```no_run
14830    /// # use google_cloud_discoveryengine_v1::builder;
14831    /// use builder::site_search_engine_service::FetchSitemaps;
14832    /// # tokio_test::block_on(async {
14833    ///
14834    /// let builder = prepare_request_builder();
14835    /// let response = builder.send().await?;
14836    /// # gax::Result::<()>::Ok(()) });
14837    ///
14838    /// fn prepare_request_builder() -> FetchSitemaps {
14839    ///   # panic!();
14840    ///   // ... details omitted ...
14841    /// }
14842    /// ```
14843    #[derive(Clone, Debug)]
14844    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14845
14846    impl FetchSitemaps {
14847        pub(crate) fn new(
14848            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14849        ) -> Self {
14850            Self(RequestBuilder::new(stub))
14851        }
14852
14853        /// Sets the full request, replacing any prior values.
14854        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14855            self.0.request = v.into();
14856            self
14857        }
14858
14859        /// Sets all the options, replacing any prior values.
14860        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14861            self.0.options = v.into();
14862            self
14863        }
14864
14865        /// Sends the request.
14866        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
14867            (*self.0.stub)
14868                .fetch_sitemaps(self.0.request, self.0.options)
14869                .await
14870                .map(gax::response::Response::into_body)
14871        }
14872
14873        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
14874        ///
14875        /// This is a **required** field for requests.
14876        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14877            self.0.request.parent = v.into();
14878            self
14879        }
14880
14881        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
14882        pub fn set_matcher<T>(mut self, v: T) -> Self
14883        where
14884            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14885        {
14886            self.0.request.matcher = std::option::Option::Some(v.into());
14887            self
14888        }
14889
14890        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
14891        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
14892        where
14893            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14894        {
14895            self.0.request.matcher = v.map(|x| x.into());
14896            self
14897        }
14898    }
14899
14900    #[doc(hidden)]
14901    impl gax::options::internal::RequestBuilder for FetchSitemaps {
14902        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14903            &mut self.0.options
14904        }
14905    }
14906
14907    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
14908    ///
14909    /// # Example
14910    /// ```no_run
14911    /// # use google_cloud_discoveryengine_v1::builder;
14912    /// use builder::site_search_engine_service::EnableAdvancedSiteSearch;
14913    /// # tokio_test::block_on(async {
14914    /// use lro::Poller;
14915    ///
14916    /// let builder = prepare_request_builder();
14917    /// let response = builder.poller().until_done().await?;
14918    /// # gax::Result::<()>::Ok(()) });
14919    ///
14920    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
14921    ///   # panic!();
14922    ///   // ... details omitted ...
14923    /// }
14924    /// ```
14925    #[derive(Clone, Debug)]
14926    pub struct EnableAdvancedSiteSearch(
14927        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
14928    );
14929
14930    impl EnableAdvancedSiteSearch {
14931        pub(crate) fn new(
14932            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14933        ) -> Self {
14934            Self(RequestBuilder::new(stub))
14935        }
14936
14937        /// Sets the full request, replacing any prior values.
14938        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
14939            mut self,
14940            v: V,
14941        ) -> Self {
14942            self.0.request = v.into();
14943            self
14944        }
14945
14946        /// Sets all the options, replacing any prior values.
14947        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14948            self.0.options = v.into();
14949            self
14950        }
14951
14952        /// Sends the request.
14953        ///
14954        /// # Long running operations
14955        ///
14956        /// This starts, but does not poll, a longrunning operation. More information
14957        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
14958        pub async fn send(self) -> Result<longrunning::model::Operation> {
14959            (*self.0.stub)
14960                .enable_advanced_site_search(self.0.request, self.0.options)
14961                .await
14962                .map(gax::response::Response::into_body)
14963        }
14964
14965        /// Creates a [Poller][lro::Poller] to work with `enable_advanced_site_search`.
14966        pub fn poller(
14967            self,
14968        ) -> impl lro::Poller<
14969            crate::model::EnableAdvancedSiteSearchResponse,
14970            crate::model::EnableAdvancedSiteSearchMetadata,
14971        > {
14972            type Operation = lro::internal::Operation<
14973                crate::model::EnableAdvancedSiteSearchResponse,
14974                crate::model::EnableAdvancedSiteSearchMetadata,
14975            >;
14976            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14977            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14978
14979            let stub = self.0.stub.clone();
14980            let mut options = self.0.options.clone();
14981            options.set_retry_policy(gax::retry_policy::NeverRetry);
14982            let query = move |name| {
14983                let stub = stub.clone();
14984                let options = options.clone();
14985                async {
14986                    let op = GetOperation::new(stub)
14987                        .set_name(name)
14988                        .with_options(options)
14989                        .send()
14990                        .await?;
14991                    Ok(Operation::new(op))
14992                }
14993            };
14994
14995            let start = move || async {
14996                let op = self.send().await?;
14997                Ok(Operation::new(op))
14998            };
14999
15000            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15001        }
15002
15003        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15004        ///
15005        /// This is a **required** field for requests.
15006        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15007            self.0.request.site_search_engine = v.into();
15008            self
15009        }
15010    }
15011
15012    #[doc(hidden)]
15013    impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15014        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15015            &mut self.0.options
15016        }
15017    }
15018
15019    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15020    ///
15021    /// # Example
15022    /// ```no_run
15023    /// # use google_cloud_discoveryengine_v1::builder;
15024    /// use builder::site_search_engine_service::DisableAdvancedSiteSearch;
15025    /// # tokio_test::block_on(async {
15026    /// use lro::Poller;
15027    ///
15028    /// let builder = prepare_request_builder();
15029    /// let response = builder.poller().until_done().await?;
15030    /// # gax::Result::<()>::Ok(()) });
15031    ///
15032    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15033    ///   # panic!();
15034    ///   // ... details omitted ...
15035    /// }
15036    /// ```
15037    #[derive(Clone, Debug)]
15038    pub struct DisableAdvancedSiteSearch(
15039        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15040    );
15041
15042    impl DisableAdvancedSiteSearch {
15043        pub(crate) fn new(
15044            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15045        ) -> Self {
15046            Self(RequestBuilder::new(stub))
15047        }
15048
15049        /// Sets the full request, replacing any prior values.
15050        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15051            mut self,
15052            v: V,
15053        ) -> Self {
15054            self.0.request = v.into();
15055            self
15056        }
15057
15058        /// Sets all the options, replacing any prior values.
15059        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15060            self.0.options = v.into();
15061            self
15062        }
15063
15064        /// Sends the request.
15065        ///
15066        /// # Long running operations
15067        ///
15068        /// This starts, but does not poll, a longrunning operation. More information
15069        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15070        pub async fn send(self) -> Result<longrunning::model::Operation> {
15071            (*self.0.stub)
15072                .disable_advanced_site_search(self.0.request, self.0.options)
15073                .await
15074                .map(gax::response::Response::into_body)
15075        }
15076
15077        /// Creates a [Poller][lro::Poller] to work with `disable_advanced_site_search`.
15078        pub fn poller(
15079            self,
15080        ) -> impl lro::Poller<
15081            crate::model::DisableAdvancedSiteSearchResponse,
15082            crate::model::DisableAdvancedSiteSearchMetadata,
15083        > {
15084            type Operation = lro::internal::Operation<
15085                crate::model::DisableAdvancedSiteSearchResponse,
15086                crate::model::DisableAdvancedSiteSearchMetadata,
15087            >;
15088            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15089            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15090
15091            let stub = self.0.stub.clone();
15092            let mut options = self.0.options.clone();
15093            options.set_retry_policy(gax::retry_policy::NeverRetry);
15094            let query = move |name| {
15095                let stub = stub.clone();
15096                let options = options.clone();
15097                async {
15098                    let op = GetOperation::new(stub)
15099                        .set_name(name)
15100                        .with_options(options)
15101                        .send()
15102                        .await?;
15103                    Ok(Operation::new(op))
15104                }
15105            };
15106
15107            let start = move || async {
15108                let op = self.send().await?;
15109                Ok(Operation::new(op))
15110            };
15111
15112            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15113        }
15114
15115        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15116        ///
15117        /// This is a **required** field for requests.
15118        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15119            self.0.request.site_search_engine = v.into();
15120            self
15121        }
15122    }
15123
15124    #[doc(hidden)]
15125    impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15126        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15127            &mut self.0.options
15128        }
15129    }
15130
15131    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15132    ///
15133    /// # Example
15134    /// ```no_run
15135    /// # use google_cloud_discoveryengine_v1::builder;
15136    /// use builder::site_search_engine_service::RecrawlUris;
15137    /// # tokio_test::block_on(async {
15138    /// use lro::Poller;
15139    ///
15140    /// let builder = prepare_request_builder();
15141    /// let response = builder.poller().until_done().await?;
15142    /// # gax::Result::<()>::Ok(()) });
15143    ///
15144    /// fn prepare_request_builder() -> RecrawlUris {
15145    ///   # panic!();
15146    ///   // ... details omitted ...
15147    /// }
15148    /// ```
15149    #[derive(Clone, Debug)]
15150    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15151
15152    impl RecrawlUris {
15153        pub(crate) fn new(
15154            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15155        ) -> Self {
15156            Self(RequestBuilder::new(stub))
15157        }
15158
15159        /// Sets the full request, replacing any prior values.
15160        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15161            self.0.request = v.into();
15162            self
15163        }
15164
15165        /// Sets all the options, replacing any prior values.
15166        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15167            self.0.options = v.into();
15168            self
15169        }
15170
15171        /// Sends the request.
15172        ///
15173        /// # Long running operations
15174        ///
15175        /// This starts, but does not poll, a longrunning operation. More information
15176        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15177        pub async fn send(self) -> Result<longrunning::model::Operation> {
15178            (*self.0.stub)
15179                .recrawl_uris(self.0.request, self.0.options)
15180                .await
15181                .map(gax::response::Response::into_body)
15182        }
15183
15184        /// Creates a [Poller][lro::Poller] to work with `recrawl_uris`.
15185        pub fn poller(
15186            self,
15187        ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15188        {
15189            type Operation = lro::internal::Operation<
15190                crate::model::RecrawlUrisResponse,
15191                crate::model::RecrawlUrisMetadata,
15192            >;
15193            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15194            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15195
15196            let stub = self.0.stub.clone();
15197            let mut options = self.0.options.clone();
15198            options.set_retry_policy(gax::retry_policy::NeverRetry);
15199            let query = move |name| {
15200                let stub = stub.clone();
15201                let options = options.clone();
15202                async {
15203                    let op = GetOperation::new(stub)
15204                        .set_name(name)
15205                        .with_options(options)
15206                        .send()
15207                        .await?;
15208                    Ok(Operation::new(op))
15209                }
15210            };
15211
15212            let start = move || async {
15213                let op = self.send().await?;
15214                Ok(Operation::new(op))
15215            };
15216
15217            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15218        }
15219
15220        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15221        ///
15222        /// This is a **required** field for requests.
15223        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15224            self.0.request.site_search_engine = v.into();
15225            self
15226        }
15227
15228        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15229        ///
15230        /// This is a **required** field for requests.
15231        pub fn set_uris<T, V>(mut self, v: T) -> Self
15232        where
15233            T: std::iter::IntoIterator<Item = V>,
15234            V: std::convert::Into<std::string::String>,
15235        {
15236            use std::iter::Iterator;
15237            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15238            self
15239        }
15240
15241        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15242        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15243            self.0.request.site_credential = v.into();
15244            self
15245        }
15246    }
15247
15248    #[doc(hidden)]
15249    impl gax::options::internal::RequestBuilder for RecrawlUris {
15250        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15251            &mut self.0.options
15252        }
15253    }
15254
15255    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15256    ///
15257    /// # Example
15258    /// ```no_run
15259    /// # use google_cloud_discoveryengine_v1::builder;
15260    /// use builder::site_search_engine_service::BatchVerifyTargetSites;
15261    /// # tokio_test::block_on(async {
15262    /// use lro::Poller;
15263    ///
15264    /// let builder = prepare_request_builder();
15265    /// let response = builder.poller().until_done().await?;
15266    /// # gax::Result::<()>::Ok(()) });
15267    ///
15268    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15269    ///   # panic!();
15270    ///   // ... details omitted ...
15271    /// }
15272    /// ```
15273    #[derive(Clone, Debug)]
15274    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15275
15276    impl BatchVerifyTargetSites {
15277        pub(crate) fn new(
15278            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15279        ) -> Self {
15280            Self(RequestBuilder::new(stub))
15281        }
15282
15283        /// Sets the full request, replacing any prior values.
15284        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15285            mut self,
15286            v: V,
15287        ) -> Self {
15288            self.0.request = v.into();
15289            self
15290        }
15291
15292        /// Sets all the options, replacing any prior values.
15293        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15294            self.0.options = v.into();
15295            self
15296        }
15297
15298        /// Sends the request.
15299        ///
15300        /// # Long running operations
15301        ///
15302        /// This starts, but does not poll, a longrunning operation. More information
15303        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15304        pub async fn send(self) -> Result<longrunning::model::Operation> {
15305            (*self.0.stub)
15306                .batch_verify_target_sites(self.0.request, self.0.options)
15307                .await
15308                .map(gax::response::Response::into_body)
15309        }
15310
15311        /// Creates a [Poller][lro::Poller] to work with `batch_verify_target_sites`.
15312        pub fn poller(
15313            self,
15314        ) -> impl lro::Poller<
15315            crate::model::BatchVerifyTargetSitesResponse,
15316            crate::model::BatchVerifyTargetSitesMetadata,
15317        > {
15318            type Operation = lro::internal::Operation<
15319                crate::model::BatchVerifyTargetSitesResponse,
15320                crate::model::BatchVerifyTargetSitesMetadata,
15321            >;
15322            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15323            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15324
15325            let stub = self.0.stub.clone();
15326            let mut options = self.0.options.clone();
15327            options.set_retry_policy(gax::retry_policy::NeverRetry);
15328            let query = move |name| {
15329                let stub = stub.clone();
15330                let options = options.clone();
15331                async {
15332                    let op = GetOperation::new(stub)
15333                        .set_name(name)
15334                        .with_options(options)
15335                        .send()
15336                        .await?;
15337                    Ok(Operation::new(op))
15338                }
15339            };
15340
15341            let start = move || async {
15342                let op = self.send().await?;
15343                Ok(Operation::new(op))
15344            };
15345
15346            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15347        }
15348
15349        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15350        ///
15351        /// This is a **required** field for requests.
15352        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15353            self.0.request.parent = v.into();
15354            self
15355        }
15356    }
15357
15358    #[doc(hidden)]
15359    impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15360        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15361            &mut self.0.options
15362        }
15363    }
15364
15365    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15366    ///
15367    /// # Example
15368    /// ```no_run
15369    /// # use google_cloud_discoveryengine_v1::builder;
15370    /// use builder::site_search_engine_service::FetchDomainVerificationStatus;
15371    /// # tokio_test::block_on(async {
15372    /// use gax::paginator::ItemPaginator;
15373    ///
15374    /// let builder = prepare_request_builder();
15375    /// let mut items = builder.by_item();
15376    /// while let Some(result) = items.next().await {
15377    ///   let item = result?;
15378    /// }
15379    /// # gax::Result::<()>::Ok(()) });
15380    ///
15381    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
15382    ///   # panic!();
15383    ///   // ... details omitted ...
15384    /// }
15385    /// ```
15386    #[derive(Clone, Debug)]
15387    pub struct FetchDomainVerificationStatus(
15388        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15389    );
15390
15391    impl FetchDomainVerificationStatus {
15392        pub(crate) fn new(
15393            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15394        ) -> Self {
15395            Self(RequestBuilder::new(stub))
15396        }
15397
15398        /// Sets the full request, replacing any prior values.
15399        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15400            mut self,
15401            v: V,
15402        ) -> Self {
15403            self.0.request = v.into();
15404            self
15405        }
15406
15407        /// Sets all the options, replacing any prior values.
15408        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15409            self.0.options = v.into();
15410            self
15411        }
15412
15413        /// Sends the request.
15414        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15415            (*self.0.stub)
15416                .fetch_domain_verification_status(self.0.request, self.0.options)
15417                .await
15418                .map(gax::response::Response::into_body)
15419        }
15420
15421        /// Streams each page in the collection.
15422        pub fn by_page(
15423            self,
15424        ) -> impl gax::paginator::Paginator<
15425            crate::model::FetchDomainVerificationStatusResponse,
15426            gax::error::Error,
15427        > {
15428            use std::clone::Clone;
15429            let token = self.0.request.page_token.clone();
15430            let execute = move |token: String| {
15431                let mut builder = self.clone();
15432                builder.0.request = builder.0.request.set_page_token(token);
15433                builder.send()
15434            };
15435            gax::paginator::internal::new_paginator(token, execute)
15436        }
15437
15438        /// Streams each item in the collection.
15439        pub fn by_item(
15440            self,
15441        ) -> impl gax::paginator::ItemPaginator<
15442            crate::model::FetchDomainVerificationStatusResponse,
15443            gax::error::Error,
15444        > {
15445            use gax::paginator::Paginator;
15446            self.by_page().items()
15447        }
15448
15449        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
15450        ///
15451        /// This is a **required** field for requests.
15452        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15453            self.0.request.site_search_engine = v.into();
15454            self
15455        }
15456
15457        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
15458        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15459            self.0.request.page_size = v.into();
15460            self
15461        }
15462
15463        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
15464        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15465            self.0.request.page_token = v.into();
15466            self
15467        }
15468    }
15469
15470    #[doc(hidden)]
15471    impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15472        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15473            &mut self.0.options
15474        }
15475    }
15476
15477    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
15478    ///
15479    /// # Example
15480    /// ```no_run
15481    /// # use google_cloud_discoveryengine_v1::builder;
15482    /// use builder::site_search_engine_service::ListOperations;
15483    /// # tokio_test::block_on(async {
15484    /// use gax::paginator::ItemPaginator;
15485    ///
15486    /// let builder = prepare_request_builder();
15487    /// let mut items = builder.by_item();
15488    /// while let Some(result) = items.next().await {
15489    ///   let item = result?;
15490    /// }
15491    /// # gax::Result::<()>::Ok(()) });
15492    ///
15493    /// fn prepare_request_builder() -> ListOperations {
15494    ///   # panic!();
15495    ///   // ... details omitted ...
15496    /// }
15497    /// ```
15498    #[derive(Clone, Debug)]
15499    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15500
15501    impl ListOperations {
15502        pub(crate) fn new(
15503            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15504        ) -> Self {
15505            Self(RequestBuilder::new(stub))
15506        }
15507
15508        /// Sets the full request, replacing any prior values.
15509        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15510            mut self,
15511            v: V,
15512        ) -> Self {
15513            self.0.request = v.into();
15514            self
15515        }
15516
15517        /// Sets all the options, replacing any prior values.
15518        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15519            self.0.options = v.into();
15520            self
15521        }
15522
15523        /// Sends the request.
15524        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15525            (*self.0.stub)
15526                .list_operations(self.0.request, self.0.options)
15527                .await
15528                .map(gax::response::Response::into_body)
15529        }
15530
15531        /// Streams each page in the collection.
15532        pub fn by_page(
15533            self,
15534        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15535        {
15536            use std::clone::Clone;
15537            let token = self.0.request.page_token.clone();
15538            let execute = move |token: String| {
15539                let mut builder = self.clone();
15540                builder.0.request = builder.0.request.set_page_token(token);
15541                builder.send()
15542            };
15543            gax::paginator::internal::new_paginator(token, execute)
15544        }
15545
15546        /// Streams each item in the collection.
15547        pub fn by_item(
15548            self,
15549        ) -> impl gax::paginator::ItemPaginator<
15550            longrunning::model::ListOperationsResponse,
15551            gax::error::Error,
15552        > {
15553            use gax::paginator::Paginator;
15554            self.by_page().items()
15555        }
15556
15557        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
15558        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15559            self.0.request.name = v.into();
15560            self
15561        }
15562
15563        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
15564        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15565            self.0.request.filter = v.into();
15566            self
15567        }
15568
15569        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
15570        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15571            self.0.request.page_size = v.into();
15572            self
15573        }
15574
15575        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
15576        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15577            self.0.request.page_token = v.into();
15578            self
15579        }
15580    }
15581
15582    #[doc(hidden)]
15583    impl gax::options::internal::RequestBuilder for ListOperations {
15584        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15585            &mut self.0.options
15586        }
15587    }
15588
15589    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
15590    ///
15591    /// # Example
15592    /// ```no_run
15593    /// # use google_cloud_discoveryengine_v1::builder;
15594    /// use builder::site_search_engine_service::GetOperation;
15595    /// # tokio_test::block_on(async {
15596    ///
15597    /// let builder = prepare_request_builder();
15598    /// let response = builder.send().await?;
15599    /// # gax::Result::<()>::Ok(()) });
15600    ///
15601    /// fn prepare_request_builder() -> GetOperation {
15602    ///   # panic!();
15603    ///   // ... details omitted ...
15604    /// }
15605    /// ```
15606    #[derive(Clone, Debug)]
15607    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15608
15609    impl GetOperation {
15610        pub(crate) fn new(
15611            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15612        ) -> Self {
15613            Self(RequestBuilder::new(stub))
15614        }
15615
15616        /// Sets the full request, replacing any prior values.
15617        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15618            mut self,
15619            v: V,
15620        ) -> Self {
15621            self.0.request = v.into();
15622            self
15623        }
15624
15625        /// Sets all the options, replacing any prior values.
15626        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15627            self.0.options = v.into();
15628            self
15629        }
15630
15631        /// Sends the request.
15632        pub async fn send(self) -> Result<longrunning::model::Operation> {
15633            (*self.0.stub)
15634                .get_operation(self.0.request, self.0.options)
15635                .await
15636                .map(gax::response::Response::into_body)
15637        }
15638
15639        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
15640        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15641            self.0.request.name = v.into();
15642            self
15643        }
15644    }
15645
15646    #[doc(hidden)]
15647    impl gax::options::internal::RequestBuilder for GetOperation {
15648        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15649            &mut self.0.options
15650        }
15651    }
15652
15653    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
15654    ///
15655    /// # Example
15656    /// ```no_run
15657    /// # use google_cloud_discoveryengine_v1::builder;
15658    /// use builder::site_search_engine_service::CancelOperation;
15659    /// # tokio_test::block_on(async {
15660    ///
15661    /// let builder = prepare_request_builder();
15662    /// let response = builder.send().await?;
15663    /// # gax::Result::<()>::Ok(()) });
15664    ///
15665    /// fn prepare_request_builder() -> CancelOperation {
15666    ///   # panic!();
15667    ///   // ... details omitted ...
15668    /// }
15669    /// ```
15670    #[derive(Clone, Debug)]
15671    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15672
15673    impl CancelOperation {
15674        pub(crate) fn new(
15675            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15676        ) -> Self {
15677            Self(RequestBuilder::new(stub))
15678        }
15679
15680        /// Sets the full request, replacing any prior values.
15681        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15682            mut self,
15683            v: V,
15684        ) -> Self {
15685            self.0.request = v.into();
15686            self
15687        }
15688
15689        /// Sets all the options, replacing any prior values.
15690        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15691            self.0.options = v.into();
15692            self
15693        }
15694
15695        /// Sends the request.
15696        pub async fn send(self) -> Result<()> {
15697            (*self.0.stub)
15698                .cancel_operation(self.0.request, self.0.options)
15699                .await
15700                .map(gax::response::Response::into_body)
15701        }
15702
15703        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
15704        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15705            self.0.request.name = v.into();
15706            self
15707        }
15708    }
15709
15710    #[doc(hidden)]
15711    impl gax::options::internal::RequestBuilder for CancelOperation {
15712        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15713            &mut self.0.options
15714        }
15715    }
15716}
15717
15718#[cfg(feature = "user-event-service")]
15719#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15720pub mod user_event_service {
15721    use crate::Result;
15722
15723    /// A builder for [UserEventService][crate::client::UserEventService].
15724    ///
15725    /// ```
15726    /// # tokio_test::block_on(async {
15727    /// # use google_cloud_discoveryengine_v1::*;
15728    /// # use builder::user_event_service::ClientBuilder;
15729    /// # use client::UserEventService;
15730    /// let builder : ClientBuilder = UserEventService::builder();
15731    /// let client = builder
15732    ///     .with_endpoint("https://discoveryengine.googleapis.com")
15733    ///     .build().await?;
15734    /// # gax::client_builder::Result::<()>::Ok(()) });
15735    /// ```
15736    pub type ClientBuilder =
15737        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15738
15739    pub(crate) mod client {
15740        use super::super::super::client::UserEventService;
15741        pub struct Factory;
15742        impl gax::client_builder::internal::ClientFactory for Factory {
15743            type Client = UserEventService;
15744            type Credentials = gaxi::options::Credentials;
15745            async fn build(
15746                self,
15747                config: gaxi::options::ClientConfig,
15748            ) -> gax::client_builder::Result<Self::Client> {
15749                Self::Client::new(config).await
15750            }
15751        }
15752    }
15753
15754    /// Common implementation for [crate::client::UserEventService] request builders.
15755    #[derive(Clone, Debug)]
15756    pub(crate) struct RequestBuilder<R: std::default::Default> {
15757        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15758        request: R,
15759        options: gax::options::RequestOptions,
15760    }
15761
15762    impl<R> RequestBuilder<R>
15763    where
15764        R: std::default::Default,
15765    {
15766        pub(crate) fn new(
15767            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15768        ) -> Self {
15769            Self {
15770                stub,
15771                request: R::default(),
15772                options: gax::options::RequestOptions::default(),
15773            }
15774        }
15775    }
15776
15777    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
15778    ///
15779    /// # Example
15780    /// ```no_run
15781    /// # use google_cloud_discoveryengine_v1::builder;
15782    /// use builder::user_event_service::WriteUserEvent;
15783    /// # tokio_test::block_on(async {
15784    ///
15785    /// let builder = prepare_request_builder();
15786    /// let response = builder.send().await?;
15787    /// # gax::Result::<()>::Ok(()) });
15788    ///
15789    /// fn prepare_request_builder() -> WriteUserEvent {
15790    ///   # panic!();
15791    ///   // ... details omitted ...
15792    /// }
15793    /// ```
15794    #[derive(Clone, Debug)]
15795    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15796
15797    impl WriteUserEvent {
15798        pub(crate) fn new(
15799            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15800        ) -> Self {
15801            Self(RequestBuilder::new(stub))
15802        }
15803
15804        /// Sets the full request, replacing any prior values.
15805        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15806            self.0.request = v.into();
15807            self
15808        }
15809
15810        /// Sets all the options, replacing any prior values.
15811        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15812            self.0.options = v.into();
15813            self
15814        }
15815
15816        /// Sends the request.
15817        pub async fn send(self) -> Result<crate::model::UserEvent> {
15818            (*self.0.stub)
15819                .write_user_event(self.0.request, self.0.options)
15820                .await
15821                .map(gax::response::Response::into_body)
15822        }
15823
15824        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
15825        ///
15826        /// This is a **required** field for requests.
15827        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15828            self.0.request.parent = v.into();
15829            self
15830        }
15831
15832        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15833        ///
15834        /// This is a **required** field for requests.
15835        pub fn set_user_event<T>(mut self, v: T) -> Self
15836        where
15837            T: std::convert::Into<crate::model::UserEvent>,
15838        {
15839            self.0.request.user_event = std::option::Option::Some(v.into());
15840            self
15841        }
15842
15843        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15844        ///
15845        /// This is a **required** field for requests.
15846        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15847        where
15848            T: std::convert::Into<crate::model::UserEvent>,
15849        {
15850            self.0.request.user_event = v.map(|x| x.into());
15851            self
15852        }
15853
15854        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
15855        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
15856            self.0.request.write_async = v.into();
15857            self
15858        }
15859    }
15860
15861    #[doc(hidden)]
15862    impl gax::options::internal::RequestBuilder for WriteUserEvent {
15863        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15864            &mut self.0.options
15865        }
15866    }
15867
15868    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
15869    ///
15870    /// # Example
15871    /// ```no_run
15872    /// # use google_cloud_discoveryengine_v1::builder;
15873    /// use builder::user_event_service::CollectUserEvent;
15874    /// # tokio_test::block_on(async {
15875    ///
15876    /// let builder = prepare_request_builder();
15877    /// let response = builder.send().await?;
15878    /// # gax::Result::<()>::Ok(()) });
15879    ///
15880    /// fn prepare_request_builder() -> CollectUserEvent {
15881    ///   # panic!();
15882    ///   // ... details omitted ...
15883    /// }
15884    /// ```
15885    #[derive(Clone, Debug)]
15886    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
15887
15888    impl CollectUserEvent {
15889        pub(crate) fn new(
15890            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15891        ) -> Self {
15892            Self(RequestBuilder::new(stub))
15893        }
15894
15895        /// Sets the full request, replacing any prior values.
15896        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
15897            mut self,
15898            v: V,
15899        ) -> Self {
15900            self.0.request = v.into();
15901            self
15902        }
15903
15904        /// Sets all the options, replacing any prior values.
15905        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15906            self.0.options = v.into();
15907            self
15908        }
15909
15910        /// Sends the request.
15911        pub async fn send(self) -> Result<api::model::HttpBody> {
15912            (*self.0.stub)
15913                .collect_user_event(self.0.request, self.0.options)
15914                .await
15915                .map(gax::response::Response::into_body)
15916        }
15917
15918        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
15919        ///
15920        /// This is a **required** field for requests.
15921        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15922            self.0.request.parent = v.into();
15923            self
15924        }
15925
15926        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
15927        ///
15928        /// This is a **required** field for requests.
15929        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
15930            self.0.request.user_event = v.into();
15931            self
15932        }
15933
15934        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
15935        pub fn set_uri<T>(mut self, v: T) -> Self
15936        where
15937            T: std::convert::Into<std::string::String>,
15938        {
15939            self.0.request.uri = std::option::Option::Some(v.into());
15940            self
15941        }
15942
15943        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
15944        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
15945        where
15946            T: std::convert::Into<std::string::String>,
15947        {
15948            self.0.request.uri = v.map(|x| x.into());
15949            self
15950        }
15951
15952        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
15953        pub fn set_ets<T>(mut self, v: T) -> Self
15954        where
15955            T: std::convert::Into<i64>,
15956        {
15957            self.0.request.ets = std::option::Option::Some(v.into());
15958            self
15959        }
15960
15961        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
15962        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
15963        where
15964            T: std::convert::Into<i64>,
15965        {
15966            self.0.request.ets = v.map(|x| x.into());
15967            self
15968        }
15969    }
15970
15971    #[doc(hidden)]
15972    impl gax::options::internal::RequestBuilder for CollectUserEvent {
15973        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15974            &mut self.0.options
15975        }
15976    }
15977
15978    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
15979    ///
15980    /// # Example
15981    /// ```no_run
15982    /// # use google_cloud_discoveryengine_v1::builder;
15983    /// use builder::user_event_service::PurgeUserEvents;
15984    /// # tokio_test::block_on(async {
15985    /// use lro::Poller;
15986    ///
15987    /// let builder = prepare_request_builder();
15988    /// let response = builder.poller().until_done().await?;
15989    /// # gax::Result::<()>::Ok(()) });
15990    ///
15991    /// fn prepare_request_builder() -> PurgeUserEvents {
15992    ///   # panic!();
15993    ///   // ... details omitted ...
15994    /// }
15995    /// ```
15996    #[derive(Clone, Debug)]
15997    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
15998
15999    impl PurgeUserEvents {
16000        pub(crate) fn new(
16001            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16002        ) -> Self {
16003            Self(RequestBuilder::new(stub))
16004        }
16005
16006        /// Sets the full request, replacing any prior values.
16007        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16008            self.0.request = v.into();
16009            self
16010        }
16011
16012        /// Sets all the options, replacing any prior values.
16013        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16014            self.0.options = v.into();
16015            self
16016        }
16017
16018        /// Sends the request.
16019        ///
16020        /// # Long running operations
16021        ///
16022        /// This starts, but does not poll, a longrunning operation. More information
16023        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16024        pub async fn send(self) -> Result<longrunning::model::Operation> {
16025            (*self.0.stub)
16026                .purge_user_events(self.0.request, self.0.options)
16027                .await
16028                .map(gax::response::Response::into_body)
16029        }
16030
16031        /// Creates a [Poller][lro::Poller] to work with `purge_user_events`.
16032        pub fn poller(
16033            self,
16034        ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16035        {
16036            type Operation = lro::internal::Operation<
16037                crate::model::PurgeUserEventsResponse,
16038                crate::model::PurgeUserEventsMetadata,
16039            >;
16040            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16041            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16042
16043            let stub = self.0.stub.clone();
16044            let mut options = self.0.options.clone();
16045            options.set_retry_policy(gax::retry_policy::NeverRetry);
16046            let query = move |name| {
16047                let stub = stub.clone();
16048                let options = options.clone();
16049                async {
16050                    let op = GetOperation::new(stub)
16051                        .set_name(name)
16052                        .with_options(options)
16053                        .send()
16054                        .await?;
16055                    Ok(Operation::new(op))
16056                }
16057            };
16058
16059            let start = move || async {
16060                let op = self.send().await?;
16061                Ok(Operation::new(op))
16062            };
16063
16064            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16065        }
16066
16067        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16068        ///
16069        /// This is a **required** field for requests.
16070        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16071            self.0.request.parent = v.into();
16072            self
16073        }
16074
16075        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16076        ///
16077        /// This is a **required** field for requests.
16078        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16079            self.0.request.filter = v.into();
16080            self
16081        }
16082
16083        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16084        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16085            self.0.request.force = v.into();
16086            self
16087        }
16088    }
16089
16090    #[doc(hidden)]
16091    impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16092        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16093            &mut self.0.options
16094        }
16095    }
16096
16097    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16098    ///
16099    /// # Example
16100    /// ```no_run
16101    /// # use google_cloud_discoveryengine_v1::builder;
16102    /// use builder::user_event_service::ImportUserEvents;
16103    /// # tokio_test::block_on(async {
16104    /// use lro::Poller;
16105    ///
16106    /// let builder = prepare_request_builder();
16107    /// let response = builder.poller().until_done().await?;
16108    /// # gax::Result::<()>::Ok(()) });
16109    ///
16110    /// fn prepare_request_builder() -> ImportUserEvents {
16111    ///   # panic!();
16112    ///   // ... details omitted ...
16113    /// }
16114    /// ```
16115    #[derive(Clone, Debug)]
16116    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16117
16118    impl ImportUserEvents {
16119        pub(crate) fn new(
16120            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16121        ) -> Self {
16122            Self(RequestBuilder::new(stub))
16123        }
16124
16125        /// Sets the full request, replacing any prior values.
16126        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16127            mut self,
16128            v: V,
16129        ) -> Self {
16130            self.0.request = v.into();
16131            self
16132        }
16133
16134        /// Sets all the options, replacing any prior values.
16135        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16136            self.0.options = v.into();
16137            self
16138        }
16139
16140        /// Sends the request.
16141        ///
16142        /// # Long running operations
16143        ///
16144        /// This starts, but does not poll, a longrunning operation. More information
16145        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16146        pub async fn send(self) -> Result<longrunning::model::Operation> {
16147            (*self.0.stub)
16148                .import_user_events(self.0.request, self.0.options)
16149                .await
16150                .map(gax::response::Response::into_body)
16151        }
16152
16153        /// Creates a [Poller][lro::Poller] to work with `import_user_events`.
16154        pub fn poller(
16155            self,
16156        ) -> impl lro::Poller<
16157            crate::model::ImportUserEventsResponse,
16158            crate::model::ImportUserEventsMetadata,
16159        > {
16160            type Operation = lro::internal::Operation<
16161                crate::model::ImportUserEventsResponse,
16162                crate::model::ImportUserEventsMetadata,
16163            >;
16164            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16165            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16166
16167            let stub = self.0.stub.clone();
16168            let mut options = self.0.options.clone();
16169            options.set_retry_policy(gax::retry_policy::NeverRetry);
16170            let query = move |name| {
16171                let stub = stub.clone();
16172                let options = options.clone();
16173                async {
16174                    let op = GetOperation::new(stub)
16175                        .set_name(name)
16176                        .with_options(options)
16177                        .send()
16178                        .await?;
16179                    Ok(Operation::new(op))
16180                }
16181            };
16182
16183            let start = move || async {
16184                let op = self.send().await?;
16185                Ok(Operation::new(op))
16186            };
16187
16188            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16189        }
16190
16191        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16192        ///
16193        /// This is a **required** field for requests.
16194        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16195            self.0.request.parent = v.into();
16196            self
16197        }
16198
16199        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16200        pub fn set_error_config<T>(mut self, v: T) -> Self
16201        where
16202            T: std::convert::Into<crate::model::ImportErrorConfig>,
16203        {
16204            self.0.request.error_config = std::option::Option::Some(v.into());
16205            self
16206        }
16207
16208        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16209        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16210        where
16211            T: std::convert::Into<crate::model::ImportErrorConfig>,
16212        {
16213            self.0.request.error_config = v.map(|x| x.into());
16214            self
16215        }
16216
16217        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16218        ///
16219        /// Note that all the setters affecting `source` are
16220        /// mutually exclusive.
16221        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16222            mut self,
16223            v: T,
16224        ) -> Self {
16225            self.0.request.source = v.into();
16226            self
16227        }
16228
16229        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16230        /// to hold a `InlineSource`.
16231        ///
16232        /// Note that all the setters affecting `source` are
16233        /// mutually exclusive.
16234        pub fn set_inline_source<
16235            T: std::convert::Into<
16236                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16237                >,
16238        >(
16239            mut self,
16240            v: T,
16241        ) -> Self {
16242            self.0.request = self.0.request.set_inline_source(v);
16243            self
16244        }
16245
16246        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16247        /// to hold a `GcsSource`.
16248        ///
16249        /// Note that all the setters affecting `source` are
16250        /// mutually exclusive.
16251        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16252            mut self,
16253            v: T,
16254        ) -> Self {
16255            self.0.request = self.0.request.set_gcs_source(v);
16256            self
16257        }
16258
16259        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16260        /// to hold a `BigquerySource`.
16261        ///
16262        /// Note that all the setters affecting `source` are
16263        /// mutually exclusive.
16264        pub fn set_bigquery_source<
16265            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16266        >(
16267            mut self,
16268            v: T,
16269        ) -> Self {
16270            self.0.request = self.0.request.set_bigquery_source(v);
16271            self
16272        }
16273    }
16274
16275    #[doc(hidden)]
16276    impl gax::options::internal::RequestBuilder for ImportUserEvents {
16277        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16278            &mut self.0.options
16279        }
16280    }
16281
16282    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16283    ///
16284    /// # Example
16285    /// ```no_run
16286    /// # use google_cloud_discoveryengine_v1::builder;
16287    /// use builder::user_event_service::ListOperations;
16288    /// # tokio_test::block_on(async {
16289    /// use gax::paginator::ItemPaginator;
16290    ///
16291    /// let builder = prepare_request_builder();
16292    /// let mut items = builder.by_item();
16293    /// while let Some(result) = items.next().await {
16294    ///   let item = result?;
16295    /// }
16296    /// # gax::Result::<()>::Ok(()) });
16297    ///
16298    /// fn prepare_request_builder() -> ListOperations {
16299    ///   # panic!();
16300    ///   // ... details omitted ...
16301    /// }
16302    /// ```
16303    #[derive(Clone, Debug)]
16304    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16305
16306    impl ListOperations {
16307        pub(crate) fn new(
16308            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16309        ) -> Self {
16310            Self(RequestBuilder::new(stub))
16311        }
16312
16313        /// Sets the full request, replacing any prior values.
16314        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16315            mut self,
16316            v: V,
16317        ) -> Self {
16318            self.0.request = v.into();
16319            self
16320        }
16321
16322        /// Sets all the options, replacing any prior values.
16323        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16324            self.0.options = v.into();
16325            self
16326        }
16327
16328        /// Sends the request.
16329        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16330            (*self.0.stub)
16331                .list_operations(self.0.request, self.0.options)
16332                .await
16333                .map(gax::response::Response::into_body)
16334        }
16335
16336        /// Streams each page in the collection.
16337        pub fn by_page(
16338            self,
16339        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16340        {
16341            use std::clone::Clone;
16342            let token = self.0.request.page_token.clone();
16343            let execute = move |token: String| {
16344                let mut builder = self.clone();
16345                builder.0.request = builder.0.request.set_page_token(token);
16346                builder.send()
16347            };
16348            gax::paginator::internal::new_paginator(token, execute)
16349        }
16350
16351        /// Streams each item in the collection.
16352        pub fn by_item(
16353            self,
16354        ) -> impl gax::paginator::ItemPaginator<
16355            longrunning::model::ListOperationsResponse,
16356            gax::error::Error,
16357        > {
16358            use gax::paginator::Paginator;
16359            self.by_page().items()
16360        }
16361
16362        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
16363        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16364            self.0.request.name = v.into();
16365            self
16366        }
16367
16368        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
16369        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16370            self.0.request.filter = v.into();
16371            self
16372        }
16373
16374        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
16375        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16376            self.0.request.page_size = v.into();
16377            self
16378        }
16379
16380        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
16381        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16382            self.0.request.page_token = v.into();
16383            self
16384        }
16385    }
16386
16387    #[doc(hidden)]
16388    impl gax::options::internal::RequestBuilder for ListOperations {
16389        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16390            &mut self.0.options
16391        }
16392    }
16393
16394    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
16395    ///
16396    /// # Example
16397    /// ```no_run
16398    /// # use google_cloud_discoveryengine_v1::builder;
16399    /// use builder::user_event_service::GetOperation;
16400    /// # tokio_test::block_on(async {
16401    ///
16402    /// let builder = prepare_request_builder();
16403    /// let response = builder.send().await?;
16404    /// # gax::Result::<()>::Ok(()) });
16405    ///
16406    /// fn prepare_request_builder() -> GetOperation {
16407    ///   # panic!();
16408    ///   // ... details omitted ...
16409    /// }
16410    /// ```
16411    #[derive(Clone, Debug)]
16412    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16413
16414    impl GetOperation {
16415        pub(crate) fn new(
16416            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16417        ) -> Self {
16418            Self(RequestBuilder::new(stub))
16419        }
16420
16421        /// Sets the full request, replacing any prior values.
16422        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16423            mut self,
16424            v: V,
16425        ) -> Self {
16426            self.0.request = v.into();
16427            self
16428        }
16429
16430        /// Sets all the options, replacing any prior values.
16431        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16432            self.0.options = v.into();
16433            self
16434        }
16435
16436        /// Sends the request.
16437        pub async fn send(self) -> Result<longrunning::model::Operation> {
16438            (*self.0.stub)
16439                .get_operation(self.0.request, self.0.options)
16440                .await
16441                .map(gax::response::Response::into_body)
16442        }
16443
16444        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
16445        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16446            self.0.request.name = v.into();
16447            self
16448        }
16449    }
16450
16451    #[doc(hidden)]
16452    impl gax::options::internal::RequestBuilder for GetOperation {
16453        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16454            &mut self.0.options
16455        }
16456    }
16457
16458    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
16459    ///
16460    /// # Example
16461    /// ```no_run
16462    /// # use google_cloud_discoveryengine_v1::builder;
16463    /// use builder::user_event_service::CancelOperation;
16464    /// # tokio_test::block_on(async {
16465    ///
16466    /// let builder = prepare_request_builder();
16467    /// let response = builder.send().await?;
16468    /// # gax::Result::<()>::Ok(()) });
16469    ///
16470    /// fn prepare_request_builder() -> CancelOperation {
16471    ///   # panic!();
16472    ///   // ... details omitted ...
16473    /// }
16474    /// ```
16475    #[derive(Clone, Debug)]
16476    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16477
16478    impl CancelOperation {
16479        pub(crate) fn new(
16480            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16481        ) -> Self {
16482            Self(RequestBuilder::new(stub))
16483        }
16484
16485        /// Sets the full request, replacing any prior values.
16486        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16487            mut self,
16488            v: V,
16489        ) -> Self {
16490            self.0.request = v.into();
16491            self
16492        }
16493
16494        /// Sets all the options, replacing any prior values.
16495        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16496            self.0.options = v.into();
16497            self
16498        }
16499
16500        /// Sends the request.
16501        pub async fn send(self) -> Result<()> {
16502            (*self.0.stub)
16503                .cancel_operation(self.0.request, self.0.options)
16504                .await
16505                .map(gax::response::Response::into_body)
16506        }
16507
16508        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
16509        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16510            self.0.request.name = v.into();
16511            self
16512        }
16513    }
16514
16515    #[doc(hidden)]
16516    impl gax::options::internal::RequestBuilder for CancelOperation {
16517        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16518            &mut self.0.options
16519        }
16520    }
16521}
16522
16523#[cfg(feature = "user-license-service")]
16524#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16525pub mod user_license_service {
16526    use crate::Result;
16527
16528    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
16529    ///
16530    /// ```
16531    /// # tokio_test::block_on(async {
16532    /// # use google_cloud_discoveryengine_v1::*;
16533    /// # use builder::user_license_service::ClientBuilder;
16534    /// # use client::UserLicenseService;
16535    /// let builder : ClientBuilder = UserLicenseService::builder();
16536    /// let client = builder
16537    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16538    ///     .build().await?;
16539    /// # gax::client_builder::Result::<()>::Ok(()) });
16540    /// ```
16541    pub type ClientBuilder =
16542        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16543
16544    pub(crate) mod client {
16545        use super::super::super::client::UserLicenseService;
16546        pub struct Factory;
16547        impl gax::client_builder::internal::ClientFactory for Factory {
16548            type Client = UserLicenseService;
16549            type Credentials = gaxi::options::Credentials;
16550            async fn build(
16551                self,
16552                config: gaxi::options::ClientConfig,
16553            ) -> gax::client_builder::Result<Self::Client> {
16554                Self::Client::new(config).await
16555            }
16556        }
16557    }
16558
16559    /// Common implementation for [crate::client::UserLicenseService] request builders.
16560    #[derive(Clone, Debug)]
16561    pub(crate) struct RequestBuilder<R: std::default::Default> {
16562        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16563        request: R,
16564        options: gax::options::RequestOptions,
16565    }
16566
16567    impl<R> RequestBuilder<R>
16568    where
16569        R: std::default::Default,
16570    {
16571        pub(crate) fn new(
16572            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16573        ) -> Self {
16574            Self {
16575                stub,
16576                request: R::default(),
16577                options: gax::options::RequestOptions::default(),
16578            }
16579        }
16580    }
16581
16582    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
16583    ///
16584    /// # Example
16585    /// ```no_run
16586    /// # use google_cloud_discoveryengine_v1::builder;
16587    /// use builder::user_license_service::ListUserLicenses;
16588    /// # tokio_test::block_on(async {
16589    /// use gax::paginator::ItemPaginator;
16590    ///
16591    /// let builder = prepare_request_builder();
16592    /// let mut items = builder.by_item();
16593    /// while let Some(result) = items.next().await {
16594    ///   let item = result?;
16595    /// }
16596    /// # gax::Result::<()>::Ok(()) });
16597    ///
16598    /// fn prepare_request_builder() -> ListUserLicenses {
16599    ///   # panic!();
16600    ///   // ... details omitted ...
16601    /// }
16602    /// ```
16603    #[derive(Clone, Debug)]
16604    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16605
16606    impl ListUserLicenses {
16607        pub(crate) fn new(
16608            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16609        ) -> Self {
16610            Self(RequestBuilder::new(stub))
16611        }
16612
16613        /// Sets the full request, replacing any prior values.
16614        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16615            mut self,
16616            v: V,
16617        ) -> Self {
16618            self.0.request = v.into();
16619            self
16620        }
16621
16622        /// Sets all the options, replacing any prior values.
16623        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16624            self.0.options = v.into();
16625            self
16626        }
16627
16628        /// Sends the request.
16629        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16630            (*self.0.stub)
16631                .list_user_licenses(self.0.request, self.0.options)
16632                .await
16633                .map(gax::response::Response::into_body)
16634        }
16635
16636        /// Streams each page in the collection.
16637        pub fn by_page(
16638            self,
16639        ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16640        {
16641            use std::clone::Clone;
16642            let token = self.0.request.page_token.clone();
16643            let execute = move |token: String| {
16644                let mut builder = self.clone();
16645                builder.0.request = builder.0.request.set_page_token(token);
16646                builder.send()
16647            };
16648            gax::paginator::internal::new_paginator(token, execute)
16649        }
16650
16651        /// Streams each item in the collection.
16652        pub fn by_item(
16653            self,
16654        ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16655        {
16656            use gax::paginator::Paginator;
16657            self.by_page().items()
16658        }
16659
16660        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
16661        ///
16662        /// This is a **required** field for requests.
16663        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16664            self.0.request.parent = v.into();
16665            self
16666        }
16667
16668        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
16669        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16670            self.0.request.page_size = v.into();
16671            self
16672        }
16673
16674        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
16675        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16676            self.0.request.page_token = v.into();
16677            self
16678        }
16679
16680        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
16681        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16682            self.0.request.filter = v.into();
16683            self
16684        }
16685    }
16686
16687    #[doc(hidden)]
16688    impl gax::options::internal::RequestBuilder for ListUserLicenses {
16689        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16690            &mut self.0.options
16691        }
16692    }
16693
16694    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
16695    ///
16696    /// # Example
16697    /// ```no_run
16698    /// # use google_cloud_discoveryengine_v1::builder;
16699    /// use builder::user_license_service::BatchUpdateUserLicenses;
16700    /// # tokio_test::block_on(async {
16701    /// use lro::Poller;
16702    ///
16703    /// let builder = prepare_request_builder();
16704    /// let response = builder.poller().until_done().await?;
16705    /// # gax::Result::<()>::Ok(()) });
16706    ///
16707    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
16708    ///   # panic!();
16709    ///   // ... details omitted ...
16710    /// }
16711    /// ```
16712    #[derive(Clone, Debug)]
16713    pub struct BatchUpdateUserLicenses(
16714        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16715    );
16716
16717    impl BatchUpdateUserLicenses {
16718        pub(crate) fn new(
16719            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16720        ) -> Self {
16721            Self(RequestBuilder::new(stub))
16722        }
16723
16724        /// Sets the full request, replacing any prior values.
16725        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16726            mut self,
16727            v: V,
16728        ) -> Self {
16729            self.0.request = v.into();
16730            self
16731        }
16732
16733        /// Sets all the options, replacing any prior values.
16734        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16735            self.0.options = v.into();
16736            self
16737        }
16738
16739        /// Sends the request.
16740        ///
16741        /// # Long running operations
16742        ///
16743        /// This starts, but does not poll, a longrunning operation. More information
16744        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
16745        pub async fn send(self) -> Result<longrunning::model::Operation> {
16746            (*self.0.stub)
16747                .batch_update_user_licenses(self.0.request, self.0.options)
16748                .await
16749                .map(gax::response::Response::into_body)
16750        }
16751
16752        /// Creates a [Poller][lro::Poller] to work with `batch_update_user_licenses`.
16753        pub fn poller(
16754            self,
16755        ) -> impl lro::Poller<
16756            crate::model::BatchUpdateUserLicensesResponse,
16757            crate::model::BatchUpdateUserLicensesMetadata,
16758        > {
16759            type Operation = lro::internal::Operation<
16760                crate::model::BatchUpdateUserLicensesResponse,
16761                crate::model::BatchUpdateUserLicensesMetadata,
16762            >;
16763            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16764            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16765
16766            let stub = self.0.stub.clone();
16767            let mut options = self.0.options.clone();
16768            options.set_retry_policy(gax::retry_policy::NeverRetry);
16769            let query = move |name| {
16770                let stub = stub.clone();
16771                let options = options.clone();
16772                async {
16773                    let op = GetOperation::new(stub)
16774                        .set_name(name)
16775                        .with_options(options)
16776                        .send()
16777                        .await?;
16778                    Ok(Operation::new(op))
16779                }
16780            };
16781
16782            let start = move || async {
16783                let op = self.send().await?;
16784                Ok(Operation::new(op))
16785            };
16786
16787            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16788        }
16789
16790        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
16791        ///
16792        /// This is a **required** field for requests.
16793        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16794            self.0.request.parent = v.into();
16795            self
16796        }
16797
16798        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
16799        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16800            self.0.request.delete_unassigned_user_licenses = v.into();
16801            self
16802        }
16803
16804        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
16805        ///
16806        /// Note that all the setters affecting `source` are
16807        /// mutually exclusive.
16808        pub fn set_source<
16809            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16810        >(
16811            mut self,
16812            v: T,
16813        ) -> Self {
16814            self.0.request.source = v.into();
16815            self
16816        }
16817
16818        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
16819        /// to hold a `InlineSource`.
16820        ///
16821        /// Note that all the setters affecting `source` are
16822        /// mutually exclusive.
16823        pub fn set_inline_source<
16824            T: std::convert::Into<
16825                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16826                >,
16827        >(
16828            mut self,
16829            v: T,
16830        ) -> Self {
16831            self.0.request = self.0.request.set_inline_source(v);
16832            self
16833        }
16834    }
16835
16836    #[doc(hidden)]
16837    impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16838        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16839            &mut self.0.options
16840        }
16841    }
16842
16843    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
16844    ///
16845    /// # Example
16846    /// ```no_run
16847    /// # use google_cloud_discoveryengine_v1::builder;
16848    /// use builder::user_license_service::ListOperations;
16849    /// # tokio_test::block_on(async {
16850    /// use gax::paginator::ItemPaginator;
16851    ///
16852    /// let builder = prepare_request_builder();
16853    /// let mut items = builder.by_item();
16854    /// while let Some(result) = items.next().await {
16855    ///   let item = result?;
16856    /// }
16857    /// # gax::Result::<()>::Ok(()) });
16858    ///
16859    /// fn prepare_request_builder() -> ListOperations {
16860    ///   # panic!();
16861    ///   // ... details omitted ...
16862    /// }
16863    /// ```
16864    #[derive(Clone, Debug)]
16865    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16866
16867    impl ListOperations {
16868        pub(crate) fn new(
16869            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16870        ) -> Self {
16871            Self(RequestBuilder::new(stub))
16872        }
16873
16874        /// Sets the full request, replacing any prior values.
16875        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16876            mut self,
16877            v: V,
16878        ) -> Self {
16879            self.0.request = v.into();
16880            self
16881        }
16882
16883        /// Sets all the options, replacing any prior values.
16884        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16885            self.0.options = v.into();
16886            self
16887        }
16888
16889        /// Sends the request.
16890        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16891            (*self.0.stub)
16892                .list_operations(self.0.request, self.0.options)
16893                .await
16894                .map(gax::response::Response::into_body)
16895        }
16896
16897        /// Streams each page in the collection.
16898        pub fn by_page(
16899            self,
16900        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16901        {
16902            use std::clone::Clone;
16903            let token = self.0.request.page_token.clone();
16904            let execute = move |token: String| {
16905                let mut builder = self.clone();
16906                builder.0.request = builder.0.request.set_page_token(token);
16907                builder.send()
16908            };
16909            gax::paginator::internal::new_paginator(token, execute)
16910        }
16911
16912        /// Streams each item in the collection.
16913        pub fn by_item(
16914            self,
16915        ) -> impl gax::paginator::ItemPaginator<
16916            longrunning::model::ListOperationsResponse,
16917            gax::error::Error,
16918        > {
16919            use gax::paginator::Paginator;
16920            self.by_page().items()
16921        }
16922
16923        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
16924        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16925            self.0.request.name = v.into();
16926            self
16927        }
16928
16929        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
16930        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16931            self.0.request.filter = v.into();
16932            self
16933        }
16934
16935        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
16936        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16937            self.0.request.page_size = v.into();
16938            self
16939        }
16940
16941        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
16942        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16943            self.0.request.page_token = v.into();
16944            self
16945        }
16946    }
16947
16948    #[doc(hidden)]
16949    impl gax::options::internal::RequestBuilder for ListOperations {
16950        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16951            &mut self.0.options
16952        }
16953    }
16954
16955    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
16956    ///
16957    /// # Example
16958    /// ```no_run
16959    /// # use google_cloud_discoveryengine_v1::builder;
16960    /// use builder::user_license_service::GetOperation;
16961    /// # tokio_test::block_on(async {
16962    ///
16963    /// let builder = prepare_request_builder();
16964    /// let response = builder.send().await?;
16965    /// # gax::Result::<()>::Ok(()) });
16966    ///
16967    /// fn prepare_request_builder() -> GetOperation {
16968    ///   # panic!();
16969    ///   // ... details omitted ...
16970    /// }
16971    /// ```
16972    #[derive(Clone, Debug)]
16973    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16974
16975    impl GetOperation {
16976        pub(crate) fn new(
16977            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16978        ) -> Self {
16979            Self(RequestBuilder::new(stub))
16980        }
16981
16982        /// Sets the full request, replacing any prior values.
16983        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16984            mut self,
16985            v: V,
16986        ) -> Self {
16987            self.0.request = v.into();
16988            self
16989        }
16990
16991        /// Sets all the options, replacing any prior values.
16992        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16993            self.0.options = v.into();
16994            self
16995        }
16996
16997        /// Sends the request.
16998        pub async fn send(self) -> Result<longrunning::model::Operation> {
16999            (*self.0.stub)
17000                .get_operation(self.0.request, self.0.options)
17001                .await
17002                .map(gax::response::Response::into_body)
17003        }
17004
17005        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
17006        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17007            self.0.request.name = v.into();
17008            self
17009        }
17010    }
17011
17012    #[doc(hidden)]
17013    impl gax::options::internal::RequestBuilder for GetOperation {
17014        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17015            &mut self.0.options
17016        }
17017    }
17018
17019    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17020    ///
17021    /// # Example
17022    /// ```no_run
17023    /// # use google_cloud_discoveryengine_v1::builder;
17024    /// use builder::user_license_service::CancelOperation;
17025    /// # tokio_test::block_on(async {
17026    ///
17027    /// let builder = prepare_request_builder();
17028    /// let response = builder.send().await?;
17029    /// # gax::Result::<()>::Ok(()) });
17030    ///
17031    /// fn prepare_request_builder() -> CancelOperation {
17032    ///   # panic!();
17033    ///   // ... details omitted ...
17034    /// }
17035    /// ```
17036    #[derive(Clone, Debug)]
17037    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17038
17039    impl CancelOperation {
17040        pub(crate) fn new(
17041            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17042        ) -> Self {
17043            Self(RequestBuilder::new(stub))
17044        }
17045
17046        /// Sets the full request, replacing any prior values.
17047        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17048            mut self,
17049            v: V,
17050        ) -> Self {
17051            self.0.request = v.into();
17052            self
17053        }
17054
17055        /// Sets all the options, replacing any prior values.
17056        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17057            self.0.options = v.into();
17058            self
17059        }
17060
17061        /// Sends the request.
17062        pub async fn send(self) -> Result<()> {
17063            (*self.0.stub)
17064                .cancel_operation(self.0.request, self.0.options)
17065                .await
17066                .map(gax::response::Response::into_body)
17067        }
17068
17069        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
17070        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17071            self.0.request.name = v.into();
17072            self
17073        }
17074    }
17075
17076    #[doc(hidden)]
17077    impl gax::options::internal::RequestBuilder for CancelOperation {
17078        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17079            &mut self.0.options
17080        }
17081    }
17082}