Skip to main content

google_cloud_discoveryengine_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17/// Request and client builders for [AssistantService][crate::client::AssistantService].
18#[cfg(feature = "assistant-service")]
19#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
20pub mod assistant_service {
21    use crate::Result;
22
23    /// A builder for [AssistantService][crate::client::AssistantService].
24    ///
25    /// ```
26    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
27    /// # use google_cloud_discoveryengine_v1::*;
28    /// # use builder::assistant_service::ClientBuilder;
29    /// # use client::AssistantService;
30    /// let builder : ClientBuilder = AssistantService::builder();
31    /// let client = builder
32    ///     .with_endpoint("https://discoveryengine.googleapis.com")
33    ///     .build().await?;
34    /// # Ok(()) }
35    /// ```
36    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38    pub(crate) mod client {
39        use super::super::super::client::AssistantService;
40        pub struct Factory;
41        impl crate::ClientFactory for Factory {
42            type Client = AssistantService;
43            type Credentials = gaxi::options::Credentials;
44            async fn build(
45                self,
46                config: gaxi::options::ClientConfig,
47            ) -> crate::ClientBuilderResult<Self::Client> {
48                Self::Client::new(config).await
49            }
50        }
51    }
52
53    /// Common implementation for [crate::client::AssistantService] request builders.
54    #[derive(Clone, Debug)]
55    pub(crate) struct RequestBuilder<R: std::default::Default> {
56        stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57        request: R,
58        options: crate::RequestOptions,
59    }
60
61    impl<R> RequestBuilder<R>
62    where
63        R: std::default::Default,
64    {
65        pub(crate) fn new(
66            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67        ) -> Self {
68            Self {
69                stub,
70                request: R::default(),
71                options: crate::RequestOptions::default(),
72            }
73        }
74    }
75
76    /// The request builder for [AssistantService::stream_assist][crate::client::AssistantService::stream_assist] calls.
77    ///
78    /// # Example
79    /// ```
80    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::StreamAssist;
81    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
82    /// let builder = prepare_request_builder();
83    /// let mut resp_stream = builder.send().await?;
84    /// while let Some(response) = resp_stream.next().await {
85    ///     let response = response?;
86    ///     println!("response {:?}", response);
87    /// }
88    /// # Ok(()) }
89    ///
90    /// fn prepare_request_builder() -> StreamAssist {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct StreamAssist(RequestBuilder<crate::model::StreamAssistRequest>);
97
98    impl StreamAssist {
99        pub(crate) fn new(
100            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
101        ) -> Self {
102            Self(RequestBuilder::new(stub))
103        }
104
105        /// Sets the full request, replacing any prior values.
106        pub fn with_request<V: Into<crate::model::StreamAssistRequest>>(mut self, v: V) -> Self {
107            self.0.request = v.into();
108            self
109        }
110
111        /// Sets all the options, replacing any prior values.
112        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
113            self.0.options = v.into();
114            self
115        }
116
117        /// Initiates the server stream.
118        pub async fn send(
119            self,
120        ) -> Result<google_cloud_gax::streaming::ResponseStream<crate::model::StreamAssistResponse>>
121        {
122            (*self.0.stub)
123                .stream_assist(self.0.request, self.0.options)
124                .await
125        }
126
127        /// Sets the value of [name][crate::model::StreamAssistRequest::name].
128        ///
129        /// This is a **required** field for requests.
130        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
131            self.0.request.name = v.into();
132            self
133        }
134
135        /// Sets the value of [query][crate::model::StreamAssistRequest::query].
136        pub fn set_query<T>(mut self, v: T) -> Self
137        where
138            T: std::convert::Into<crate::model::Query>,
139        {
140            self.0.request.query = std::option::Option::Some(v.into());
141            self
142        }
143
144        /// Sets or clears the value of [query][crate::model::StreamAssistRequest::query].
145        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
146        where
147            T: std::convert::Into<crate::model::Query>,
148        {
149            self.0.request.query = v.map(|x| x.into());
150            self
151        }
152
153        /// Sets the value of [session][crate::model::StreamAssistRequest::session].
154        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
155            self.0.request.session = v.into();
156            self
157        }
158
159        /// Sets the value of [user_metadata][crate::model::StreamAssistRequest::user_metadata].
160        pub fn set_user_metadata<T>(mut self, v: T) -> Self
161        where
162            T: std::convert::Into<crate::model::AssistUserMetadata>,
163        {
164            self.0.request.user_metadata = std::option::Option::Some(v.into());
165            self
166        }
167
168        /// Sets or clears the value of [user_metadata][crate::model::StreamAssistRequest::user_metadata].
169        pub fn set_or_clear_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
170        where
171            T: std::convert::Into<crate::model::AssistUserMetadata>,
172        {
173            self.0.request.user_metadata = v.map(|x| x.into());
174            self
175        }
176
177        /// Sets the value of [agents_spec][crate::model::StreamAssistRequest::agents_spec].
178        pub fn set_agents_spec<T>(mut self, v: T) -> Self
179        where
180            T: std::convert::Into<crate::model::stream_assist_request::AgentsSpec>,
181        {
182            self.0.request.agents_spec = std::option::Option::Some(v.into());
183            self
184        }
185
186        /// Sets or clears the value of [agents_spec][crate::model::StreamAssistRequest::agents_spec].
187        pub fn set_or_clear_agents_spec<T>(mut self, v: std::option::Option<T>) -> Self
188        where
189            T: std::convert::Into<crate::model::stream_assist_request::AgentsSpec>,
190        {
191            self.0.request.agents_spec = v.map(|x| x.into());
192            self
193        }
194
195        /// Sets the value of [tools_spec][crate::model::StreamAssistRequest::tools_spec].
196        pub fn set_tools_spec<T>(mut self, v: T) -> Self
197        where
198            T: std::convert::Into<crate::model::stream_assist_request::ToolsSpec>,
199        {
200            self.0.request.tools_spec = std::option::Option::Some(v.into());
201            self
202        }
203
204        /// Sets or clears the value of [tools_spec][crate::model::StreamAssistRequest::tools_spec].
205        pub fn set_or_clear_tools_spec<T>(mut self, v: std::option::Option<T>) -> Self
206        where
207            T: std::convert::Into<crate::model::stream_assist_request::ToolsSpec>,
208        {
209            self.0.request.tools_spec = v.map(|x| x.into());
210            self
211        }
212
213        /// Sets the value of [generation_spec][crate::model::StreamAssistRequest::generation_spec].
214        pub fn set_generation_spec<T>(mut self, v: T) -> Self
215        where
216            T: std::convert::Into<crate::model::stream_assist_request::GenerationSpec>,
217        {
218            self.0.request.generation_spec = std::option::Option::Some(v.into());
219            self
220        }
221
222        /// Sets or clears the value of [generation_spec][crate::model::StreamAssistRequest::generation_spec].
223        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
224        where
225            T: std::convert::Into<crate::model::stream_assist_request::GenerationSpec>,
226        {
227            self.0.request.generation_spec = v.map(|x| x.into());
228            self
229        }
230    }
231
232    #[doc(hidden)]
233    impl crate::RequestBuilder for StreamAssist {
234        fn request_options(&mut self) -> &mut crate::RequestOptions {
235            &mut self.0.options
236        }
237    }
238
239    /// The request builder for [AssistantService::list_operations][crate::client::AssistantService::list_operations] calls.
240    ///
241    /// # Example
242    /// ```
243    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::ListOperations;
244    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
245    /// use google_cloud_gax::paginator::ItemPaginator;
246    ///
247    /// let builder = prepare_request_builder();
248    /// let mut items = builder.by_item();
249    /// while let Some(result) = items.next().await {
250    ///   let item = result?;
251    /// }
252    /// # Ok(()) }
253    ///
254    /// fn prepare_request_builder() -> ListOperations {
255    ///   # panic!();
256    ///   // ... details omitted ...
257    /// }
258    /// ```
259    #[derive(Clone, Debug)]
260    pub struct ListOperations(
261        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
262    );
263
264    impl ListOperations {
265        pub(crate) fn new(
266            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
267        ) -> Self {
268            Self(RequestBuilder::new(stub))
269        }
270
271        /// Sets the full request, replacing any prior values.
272        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
273            mut self,
274            v: V,
275        ) -> Self {
276            self.0.request = v.into();
277            self
278        }
279
280        /// Sets all the options, replacing any prior values.
281        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
282            self.0.options = v.into();
283            self
284        }
285
286        /// Sends the request.
287        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
288            (*self.0.stub)
289                .list_operations(self.0.request, self.0.options)
290                .await
291                .map(crate::Response::into_body)
292        }
293
294        /// Streams each page in the collection.
295        pub fn by_page(
296            self,
297        ) -> impl google_cloud_gax::paginator::Paginator<
298            google_cloud_longrunning::model::ListOperationsResponse,
299            crate::Error,
300        > {
301            use std::clone::Clone;
302            let token = self.0.request.page_token.clone();
303            let execute = move |token: String| {
304                let mut builder = self.clone();
305                builder.0.request = builder.0.request.set_page_token(token);
306                builder.send()
307            };
308            google_cloud_gax::paginator::internal::new_paginator(token, execute)
309        }
310
311        /// Streams each item in the collection.
312        pub fn by_item(
313            self,
314        ) -> impl google_cloud_gax::paginator::ItemPaginator<
315            google_cloud_longrunning::model::ListOperationsResponse,
316            crate::Error,
317        > {
318            use google_cloud_gax::paginator::Paginator;
319            self.by_page().items()
320        }
321
322        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
323        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
324            self.0.request.name = v.into();
325            self
326        }
327
328        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
329        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
330            self.0.request.filter = v.into();
331            self
332        }
333
334        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
335        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
336            self.0.request.page_size = v.into();
337            self
338        }
339
340        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
341        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
342            self.0.request.page_token = v.into();
343            self
344        }
345
346        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
347        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
348            self.0.request.return_partial_success = v.into();
349            self
350        }
351    }
352
353    #[doc(hidden)]
354    impl crate::RequestBuilder for ListOperations {
355        fn request_options(&mut self) -> &mut crate::RequestOptions {
356            &mut self.0.options
357        }
358    }
359
360    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
361    ///
362    /// # Example
363    /// ```
364    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::GetOperation;
365    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
366    ///
367    /// let builder = prepare_request_builder();
368    /// let response = builder.send().await?;
369    /// # Ok(()) }
370    ///
371    /// fn prepare_request_builder() -> GetOperation {
372    ///   # panic!();
373    ///   // ... details omitted ...
374    /// }
375    /// ```
376    #[derive(Clone, Debug)]
377    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
378
379    impl GetOperation {
380        pub(crate) fn new(
381            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
382        ) -> Self {
383            Self(RequestBuilder::new(stub))
384        }
385
386        /// Sets the full request, replacing any prior values.
387        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
388            mut self,
389            v: V,
390        ) -> Self {
391            self.0.request = v.into();
392            self
393        }
394
395        /// Sets all the options, replacing any prior values.
396        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
397            self.0.options = v.into();
398            self
399        }
400
401        /// Sends the request.
402        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
403            (*self.0.stub)
404                .get_operation(self.0.request, self.0.options)
405                .await
406                .map(crate::Response::into_body)
407        }
408
409        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
410        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
411            self.0.request.name = v.into();
412            self
413        }
414    }
415
416    #[doc(hidden)]
417    impl crate::RequestBuilder for GetOperation {
418        fn request_options(&mut self) -> &mut crate::RequestOptions {
419            &mut self.0.options
420        }
421    }
422
423    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
424    ///
425    /// # Example
426    /// ```
427    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::CancelOperation;
428    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
429    ///
430    /// let builder = prepare_request_builder();
431    /// let response = builder.send().await?;
432    /// # Ok(()) }
433    ///
434    /// fn prepare_request_builder() -> CancelOperation {
435    ///   # panic!();
436    ///   // ... details omitted ...
437    /// }
438    /// ```
439    #[derive(Clone, Debug)]
440    pub struct CancelOperation(
441        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
442    );
443
444    impl CancelOperation {
445        pub(crate) fn new(
446            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
447        ) -> Self {
448            Self(RequestBuilder::new(stub))
449        }
450
451        /// Sets the full request, replacing any prior values.
452        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
453            mut self,
454            v: V,
455        ) -> Self {
456            self.0.request = v.into();
457            self
458        }
459
460        /// Sets all the options, replacing any prior values.
461        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
462            self.0.options = v.into();
463            self
464        }
465
466        /// Sends the request.
467        pub async fn send(self) -> Result<()> {
468            (*self.0.stub)
469                .cancel_operation(self.0.request, self.0.options)
470                .await
471                .map(crate::Response::into_body)
472        }
473
474        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
475        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
476            self.0.request.name = v.into();
477            self
478        }
479    }
480
481    #[doc(hidden)]
482    impl crate::RequestBuilder for CancelOperation {
483        fn request_options(&mut self) -> &mut crate::RequestOptions {
484            &mut self.0.options
485        }
486    }
487}
488
489/// Request and client builders for [CmekConfigService][crate::client::CmekConfigService].
490#[cfg(feature = "cmek-config-service")]
491#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
492pub mod cmek_config_service {
493    use crate::Result;
494
495    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
496    ///
497    /// ```
498    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
499    /// # use google_cloud_discoveryengine_v1::*;
500    /// # use builder::cmek_config_service::ClientBuilder;
501    /// # use client::CmekConfigService;
502    /// let builder : ClientBuilder = CmekConfigService::builder();
503    /// let client = builder
504    ///     .with_endpoint("https://discoveryengine.googleapis.com")
505    ///     .build().await?;
506    /// # Ok(()) }
507    /// ```
508    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
509
510    pub(crate) mod client {
511        use super::super::super::client::CmekConfigService;
512        pub struct Factory;
513        impl crate::ClientFactory for Factory {
514            type Client = CmekConfigService;
515            type Credentials = gaxi::options::Credentials;
516            async fn build(
517                self,
518                config: gaxi::options::ClientConfig,
519            ) -> crate::ClientBuilderResult<Self::Client> {
520                Self::Client::new(config).await
521            }
522        }
523    }
524
525    /// Common implementation for [crate::client::CmekConfigService] request builders.
526    #[derive(Clone, Debug)]
527    pub(crate) struct RequestBuilder<R: std::default::Default> {
528        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
529        request: R,
530        options: crate::RequestOptions,
531    }
532
533    impl<R> RequestBuilder<R>
534    where
535        R: std::default::Default,
536    {
537        pub(crate) fn new(
538            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
539        ) -> Self {
540            Self {
541                stub,
542                request: R::default(),
543                options: crate::RequestOptions::default(),
544            }
545        }
546    }
547
548    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
549    ///
550    /// # Example
551    /// ```
552    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::UpdateCmekConfig;
553    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
554    /// use google_cloud_lro::Poller;
555    ///
556    /// let builder = prepare_request_builder();
557    /// let response = builder.poller().until_done().await?;
558    /// # Ok(()) }
559    ///
560    /// fn prepare_request_builder() -> UpdateCmekConfig {
561    ///   # panic!();
562    ///   // ... details omitted ...
563    /// }
564    /// ```
565    #[derive(Clone, Debug)]
566    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
567
568    impl UpdateCmekConfig {
569        pub(crate) fn new(
570            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
571        ) -> Self {
572            Self(RequestBuilder::new(stub))
573        }
574
575        /// Sets the full request, replacing any prior values.
576        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
577            mut self,
578            v: V,
579        ) -> Self {
580            self.0.request = v.into();
581            self
582        }
583
584        /// Sets all the options, replacing any prior values.
585        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
586            self.0.options = v.into();
587            self
588        }
589
590        /// Sends the request.
591        ///
592        /// # Long running operations
593        ///
594        /// This starts, but does not poll, a longrunning operation. More information
595        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
596        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
597            (*self.0.stub)
598                .update_cmek_config(self.0.request, self.0.options)
599                .await
600                .map(crate::Response::into_body)
601        }
602
603        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_cmek_config`.
604        pub fn poller(
605            self,
606        ) -> impl google_cloud_lro::Poller<
607            crate::model::CmekConfig,
608            crate::model::UpdateCmekConfigMetadata,
609        > {
610            type Operation = google_cloud_lro::internal::Operation<
611                crate::model::CmekConfig,
612                crate::model::UpdateCmekConfigMetadata,
613            >;
614            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
615            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
616            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
617            if let Some(ref mut details) = poller_options.tracing {
618                details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::update_cmek_config::until_done";
619            }
620
621            let stub = self.0.stub.clone();
622            let mut options = self.0.options.clone();
623            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
624            let query = move |name| {
625                let stub = stub.clone();
626                let options = options.clone();
627                async {
628                    let op = GetOperation::new(stub)
629                        .set_name(name)
630                        .with_options(options)
631                        .send()
632                        .await?;
633                    Ok(Operation::new(op))
634                }
635            };
636
637            let start = move || async {
638                let op = self.send().await?;
639                Ok(Operation::new(op))
640            };
641
642            use google_cloud_lro::internal::PollerExt;
643            {
644                google_cloud_lro::internal::new_poller(
645                    polling_error_policy,
646                    polling_backoff_policy,
647                    start,
648                    query,
649                )
650            }
651            .with_options(poller_options)
652        }
653
654        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
655        ///
656        /// This is a **required** field for requests.
657        pub fn set_config<T>(mut self, v: T) -> Self
658        where
659            T: std::convert::Into<crate::model::CmekConfig>,
660        {
661            self.0.request.config = std::option::Option::Some(v.into());
662            self
663        }
664
665        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
666        ///
667        /// This is a **required** field for requests.
668        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
669        where
670            T: std::convert::Into<crate::model::CmekConfig>,
671        {
672            self.0.request.config = v.map(|x| x.into());
673            self
674        }
675
676        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
677        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
678            self.0.request.set_default = v.into();
679            self
680        }
681    }
682
683    #[doc(hidden)]
684    impl crate::RequestBuilder for UpdateCmekConfig {
685        fn request_options(&mut self) -> &mut crate::RequestOptions {
686            &mut self.0.options
687        }
688    }
689
690    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
691    ///
692    /// # Example
693    /// ```
694    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetCmekConfig;
695    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
696    ///
697    /// let builder = prepare_request_builder();
698    /// let response = builder.send().await?;
699    /// # Ok(()) }
700    ///
701    /// fn prepare_request_builder() -> GetCmekConfig {
702    ///   # panic!();
703    ///   // ... details omitted ...
704    /// }
705    /// ```
706    #[derive(Clone, Debug)]
707    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
708
709    impl GetCmekConfig {
710        pub(crate) fn new(
711            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
712        ) -> Self {
713            Self(RequestBuilder::new(stub))
714        }
715
716        /// Sets the full request, replacing any prior values.
717        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
718            self.0.request = v.into();
719            self
720        }
721
722        /// Sets all the options, replacing any prior values.
723        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
724            self.0.options = v.into();
725            self
726        }
727
728        /// Sends the request.
729        pub async fn send(self) -> Result<crate::model::CmekConfig> {
730            (*self.0.stub)
731                .get_cmek_config(self.0.request, self.0.options)
732                .await
733                .map(crate::Response::into_body)
734        }
735
736        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
737        ///
738        /// This is a **required** field for requests.
739        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
740            self.0.request.name = v.into();
741            self
742        }
743    }
744
745    #[doc(hidden)]
746    impl crate::RequestBuilder for GetCmekConfig {
747        fn request_options(&mut self) -> &mut crate::RequestOptions {
748            &mut self.0.options
749        }
750    }
751
752    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
753    ///
754    /// # Example
755    /// ```
756    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListCmekConfigs;
757    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
758    ///
759    /// let builder = prepare_request_builder();
760    /// let response = builder.send().await?;
761    /// # Ok(()) }
762    ///
763    /// fn prepare_request_builder() -> ListCmekConfigs {
764    ///   # panic!();
765    ///   // ... details omitted ...
766    /// }
767    /// ```
768    #[derive(Clone, Debug)]
769    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
770
771    impl ListCmekConfigs {
772        pub(crate) fn new(
773            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
774        ) -> Self {
775            Self(RequestBuilder::new(stub))
776        }
777
778        /// Sets the full request, replacing any prior values.
779        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
780            self.0.request = v.into();
781            self
782        }
783
784        /// Sets all the options, replacing any prior values.
785        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
786            self.0.options = v.into();
787            self
788        }
789
790        /// Sends the request.
791        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
792            (*self.0.stub)
793                .list_cmek_configs(self.0.request, self.0.options)
794                .await
795                .map(crate::Response::into_body)
796        }
797
798        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
799        ///
800        /// This is a **required** field for requests.
801        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
802            self.0.request.parent = v.into();
803            self
804        }
805    }
806
807    #[doc(hidden)]
808    impl crate::RequestBuilder for ListCmekConfigs {
809        fn request_options(&mut self) -> &mut crate::RequestOptions {
810            &mut self.0.options
811        }
812    }
813
814    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
815    ///
816    /// # Example
817    /// ```
818    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::DeleteCmekConfig;
819    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
820    /// use google_cloud_lro::Poller;
821    ///
822    /// let builder = prepare_request_builder();
823    /// let response = builder.poller().until_done().await?;
824    /// # Ok(()) }
825    ///
826    /// fn prepare_request_builder() -> DeleteCmekConfig {
827    ///   # panic!();
828    ///   // ... details omitted ...
829    /// }
830    /// ```
831    #[derive(Clone, Debug)]
832    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
833
834    impl DeleteCmekConfig {
835        pub(crate) fn new(
836            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
837        ) -> Self {
838            Self(RequestBuilder::new(stub))
839        }
840
841        /// Sets the full request, replacing any prior values.
842        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
843            mut self,
844            v: V,
845        ) -> Self {
846            self.0.request = v.into();
847            self
848        }
849
850        /// Sets all the options, replacing any prior values.
851        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
852            self.0.options = v.into();
853            self
854        }
855
856        /// Sends the request.
857        ///
858        /// # Long running operations
859        ///
860        /// This starts, but does not poll, a longrunning operation. More information
861        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
862        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
863            (*self.0.stub)
864                .delete_cmek_config(self.0.request, self.0.options)
865                .await
866                .map(crate::Response::into_body)
867        }
868
869        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_cmek_config`.
870        pub fn poller(
871            self,
872        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
873            type Operation = google_cloud_lro::internal::Operation<
874                wkt::Empty,
875                crate::model::DeleteCmekConfigMetadata,
876            >;
877            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
878            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
879            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
880            if let Some(ref mut details) = poller_options.tracing {
881                details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::delete_cmek_config::until_done";
882            }
883
884            let stub = self.0.stub.clone();
885            let mut options = self.0.options.clone();
886            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
887            let query = move |name| {
888                let stub = stub.clone();
889                let options = options.clone();
890                async {
891                    let op = GetOperation::new(stub)
892                        .set_name(name)
893                        .with_options(options)
894                        .send()
895                        .await?;
896                    Ok(Operation::new(op))
897                }
898            };
899
900            let start = move || async {
901                let op = self.send().await?;
902                Ok(Operation::new(op))
903            };
904
905            use google_cloud_lro::internal::PollerExt;
906            {
907                google_cloud_lro::internal::new_unit_response_poller(
908                    polling_error_policy,
909                    polling_backoff_policy,
910                    start,
911                    query,
912                )
913            }
914            .with_options(poller_options)
915        }
916
917        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
918        ///
919        /// This is a **required** field for requests.
920        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
921            self.0.request.name = v.into();
922            self
923        }
924    }
925
926    #[doc(hidden)]
927    impl crate::RequestBuilder for DeleteCmekConfig {
928        fn request_options(&mut self) -> &mut crate::RequestOptions {
929            &mut self.0.options
930        }
931    }
932
933    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
934    ///
935    /// # Example
936    /// ```
937    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListOperations;
938    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
939    /// use google_cloud_gax::paginator::ItemPaginator;
940    ///
941    /// let builder = prepare_request_builder();
942    /// let mut items = builder.by_item();
943    /// while let Some(result) = items.next().await {
944    ///   let item = result?;
945    /// }
946    /// # Ok(()) }
947    ///
948    /// fn prepare_request_builder() -> ListOperations {
949    ///   # panic!();
950    ///   // ... details omitted ...
951    /// }
952    /// ```
953    #[derive(Clone, Debug)]
954    pub struct ListOperations(
955        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
956    );
957
958    impl ListOperations {
959        pub(crate) fn new(
960            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
961        ) -> Self {
962            Self(RequestBuilder::new(stub))
963        }
964
965        /// Sets the full request, replacing any prior values.
966        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
967            mut self,
968            v: V,
969        ) -> Self {
970            self.0.request = v.into();
971            self
972        }
973
974        /// Sets all the options, replacing any prior values.
975        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
976            self.0.options = v.into();
977            self
978        }
979
980        /// Sends the request.
981        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
982            (*self.0.stub)
983                .list_operations(self.0.request, self.0.options)
984                .await
985                .map(crate::Response::into_body)
986        }
987
988        /// Streams each page in the collection.
989        pub fn by_page(
990            self,
991        ) -> impl google_cloud_gax::paginator::Paginator<
992            google_cloud_longrunning::model::ListOperationsResponse,
993            crate::Error,
994        > {
995            use std::clone::Clone;
996            let token = self.0.request.page_token.clone();
997            let execute = move |token: String| {
998                let mut builder = self.clone();
999                builder.0.request = builder.0.request.set_page_token(token);
1000                builder.send()
1001            };
1002            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1003        }
1004
1005        /// Streams each item in the collection.
1006        pub fn by_item(
1007            self,
1008        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1009            google_cloud_longrunning::model::ListOperationsResponse,
1010            crate::Error,
1011        > {
1012            use google_cloud_gax::paginator::Paginator;
1013            self.by_page().items()
1014        }
1015
1016        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1017        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1018            self.0.request.name = v.into();
1019            self
1020        }
1021
1022        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1023        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1024            self.0.request.filter = v.into();
1025            self
1026        }
1027
1028        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1029        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1030            self.0.request.page_size = v.into();
1031            self
1032        }
1033
1034        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1035        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1036            self.0.request.page_token = v.into();
1037            self
1038        }
1039
1040        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1041        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1042            self.0.request.return_partial_success = v.into();
1043            self
1044        }
1045    }
1046
1047    #[doc(hidden)]
1048    impl crate::RequestBuilder for ListOperations {
1049        fn request_options(&mut self) -> &mut crate::RequestOptions {
1050            &mut self.0.options
1051        }
1052    }
1053
1054    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
1055    ///
1056    /// # Example
1057    /// ```
1058    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetOperation;
1059    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1060    ///
1061    /// let builder = prepare_request_builder();
1062    /// let response = builder.send().await?;
1063    /// # Ok(()) }
1064    ///
1065    /// fn prepare_request_builder() -> GetOperation {
1066    ///   # panic!();
1067    ///   // ... details omitted ...
1068    /// }
1069    /// ```
1070    #[derive(Clone, Debug)]
1071    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1072
1073    impl GetOperation {
1074        pub(crate) fn new(
1075            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
1076        ) -> Self {
1077            Self(RequestBuilder::new(stub))
1078        }
1079
1080        /// Sets the full request, replacing any prior values.
1081        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1082            mut self,
1083            v: V,
1084        ) -> Self {
1085            self.0.request = v.into();
1086            self
1087        }
1088
1089        /// Sets all the options, replacing any prior values.
1090        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1091            self.0.options = v.into();
1092            self
1093        }
1094
1095        /// Sends the request.
1096        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1097            (*self.0.stub)
1098                .get_operation(self.0.request, self.0.options)
1099                .await
1100                .map(crate::Response::into_body)
1101        }
1102
1103        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1104        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1105            self.0.request.name = v.into();
1106            self
1107        }
1108    }
1109
1110    #[doc(hidden)]
1111    impl crate::RequestBuilder for GetOperation {
1112        fn request_options(&mut self) -> &mut crate::RequestOptions {
1113            &mut self.0.options
1114        }
1115    }
1116
1117    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
1118    ///
1119    /// # Example
1120    /// ```
1121    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::CancelOperation;
1122    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1123    ///
1124    /// let builder = prepare_request_builder();
1125    /// let response = builder.send().await?;
1126    /// # Ok(()) }
1127    ///
1128    /// fn prepare_request_builder() -> CancelOperation {
1129    ///   # panic!();
1130    ///   // ... details omitted ...
1131    /// }
1132    /// ```
1133    #[derive(Clone, Debug)]
1134    pub struct CancelOperation(
1135        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1136    );
1137
1138    impl CancelOperation {
1139        pub(crate) fn new(
1140            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
1141        ) -> Self {
1142            Self(RequestBuilder::new(stub))
1143        }
1144
1145        /// Sets the full request, replacing any prior values.
1146        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1147            mut self,
1148            v: V,
1149        ) -> Self {
1150            self.0.request = v.into();
1151            self
1152        }
1153
1154        /// Sets all the options, replacing any prior values.
1155        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1156            self.0.options = v.into();
1157            self
1158        }
1159
1160        /// Sends the request.
1161        pub async fn send(self) -> Result<()> {
1162            (*self.0.stub)
1163                .cancel_operation(self.0.request, self.0.options)
1164                .await
1165                .map(crate::Response::into_body)
1166        }
1167
1168        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1169        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170            self.0.request.name = v.into();
1171            self
1172        }
1173    }
1174
1175    #[doc(hidden)]
1176    impl crate::RequestBuilder for CancelOperation {
1177        fn request_options(&mut self) -> &mut crate::RequestOptions {
1178            &mut self.0.options
1179        }
1180    }
1181}
1182
1183/// Request and client builders for [CompletionService][crate::client::CompletionService].
1184#[cfg(feature = "completion-service")]
1185#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1186pub mod completion_service {
1187    use crate::Result;
1188
1189    /// A builder for [CompletionService][crate::client::CompletionService].
1190    ///
1191    /// ```
1192    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1193    /// # use google_cloud_discoveryengine_v1::*;
1194    /// # use builder::completion_service::ClientBuilder;
1195    /// # use client::CompletionService;
1196    /// let builder : ClientBuilder = CompletionService::builder();
1197    /// let client = builder
1198    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1199    ///     .build().await?;
1200    /// # Ok(()) }
1201    /// ```
1202    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1203
1204    pub(crate) mod client {
1205        use super::super::super::client::CompletionService;
1206        pub struct Factory;
1207        impl crate::ClientFactory for Factory {
1208            type Client = CompletionService;
1209            type Credentials = gaxi::options::Credentials;
1210            async fn build(
1211                self,
1212                config: gaxi::options::ClientConfig,
1213            ) -> crate::ClientBuilderResult<Self::Client> {
1214                Self::Client::new(config).await
1215            }
1216        }
1217    }
1218
1219    /// Common implementation for [crate::client::CompletionService] request builders.
1220    #[derive(Clone, Debug)]
1221    pub(crate) struct RequestBuilder<R: std::default::Default> {
1222        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1223        request: R,
1224        options: crate::RequestOptions,
1225    }
1226
1227    impl<R> RequestBuilder<R>
1228    where
1229        R: std::default::Default,
1230    {
1231        pub(crate) fn new(
1232            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1233        ) -> Self {
1234            Self {
1235                stub,
1236                request: R::default(),
1237                options: crate::RequestOptions::default(),
1238            }
1239        }
1240    }
1241
1242    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1243    ///
1244    /// # Example
1245    /// ```
1246    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CompleteQuery;
1247    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1248    ///
1249    /// let builder = prepare_request_builder();
1250    /// let response = builder.send().await?;
1251    /// # Ok(()) }
1252    ///
1253    /// fn prepare_request_builder() -> CompleteQuery {
1254    ///   # panic!();
1255    ///   // ... details omitted ...
1256    /// }
1257    /// ```
1258    #[derive(Clone, Debug)]
1259    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1260
1261    impl CompleteQuery {
1262        pub(crate) fn new(
1263            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1264        ) -> Self {
1265            Self(RequestBuilder::new(stub))
1266        }
1267
1268        /// Sets the full request, replacing any prior values.
1269        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1270            self.0.request = v.into();
1271            self
1272        }
1273
1274        /// Sets all the options, replacing any prior values.
1275        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1276            self.0.options = v.into();
1277            self
1278        }
1279
1280        /// Sends the request.
1281        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1282            (*self.0.stub)
1283                .complete_query(self.0.request, self.0.options)
1284                .await
1285                .map(crate::Response::into_body)
1286        }
1287
1288        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1289        ///
1290        /// This is a **required** field for requests.
1291        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1292            self.0.request.data_store = v.into();
1293            self
1294        }
1295
1296        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1297        ///
1298        /// This is a **required** field for requests.
1299        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1300            self.0.request.query = v.into();
1301            self
1302        }
1303
1304        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1305        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1306            self.0.request.query_model = v.into();
1307            self
1308        }
1309
1310        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1311        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1312            self.0.request.user_pseudo_id = v.into();
1313            self
1314        }
1315
1316        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1317        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1318            self.0.request.include_tail_suggestions = v.into();
1319            self
1320        }
1321    }
1322
1323    #[doc(hidden)]
1324    impl crate::RequestBuilder for CompleteQuery {
1325        fn request_options(&mut self) -> &mut crate::RequestOptions {
1326            &mut self.0.options
1327        }
1328    }
1329
1330    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1331    ///
1332    /// # Example
1333    /// ```
1334    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportSuggestionDenyListEntries;
1335    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1336    /// use google_cloud_lro::Poller;
1337    ///
1338    /// let builder = prepare_request_builder();
1339    /// let response = builder.poller().until_done().await?;
1340    /// # Ok(()) }
1341    ///
1342    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1343    ///   # panic!();
1344    ///   // ... details omitted ...
1345    /// }
1346    /// ```
1347    #[derive(Clone, Debug)]
1348    pub struct ImportSuggestionDenyListEntries(
1349        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1350    );
1351
1352    impl ImportSuggestionDenyListEntries {
1353        pub(crate) fn new(
1354            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1355        ) -> Self {
1356            Self(RequestBuilder::new(stub))
1357        }
1358
1359        /// Sets the full request, replacing any prior values.
1360        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1361            mut self,
1362            v: V,
1363        ) -> Self {
1364            self.0.request = v.into();
1365            self
1366        }
1367
1368        /// Sets all the options, replacing any prior values.
1369        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1370            self.0.options = v.into();
1371            self
1372        }
1373
1374        /// Sends the request.
1375        ///
1376        /// # Long running operations
1377        ///
1378        /// This starts, but does not poll, a longrunning operation. More information
1379        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1380        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1381            (*self.0.stub)
1382                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1383                .await
1384                .map(crate::Response::into_body)
1385        }
1386
1387        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_suggestion_deny_list_entries`.
1388        pub fn poller(
1389            self,
1390        ) -> impl google_cloud_lro::Poller<
1391            crate::model::ImportSuggestionDenyListEntriesResponse,
1392            crate::model::ImportSuggestionDenyListEntriesMetadata,
1393        > {
1394            type Operation = google_cloud_lro::internal::Operation<
1395                crate::model::ImportSuggestionDenyListEntriesResponse,
1396                crate::model::ImportSuggestionDenyListEntriesMetadata,
1397            >;
1398            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1399            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1400            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1401            if let Some(ref mut details) = poller_options.tracing {
1402                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_suggestion_deny_list_entries::until_done";
1403            }
1404
1405            let stub = self.0.stub.clone();
1406            let mut options = self.0.options.clone();
1407            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1408            let query = move |name| {
1409                let stub = stub.clone();
1410                let options = options.clone();
1411                async {
1412                    let op = GetOperation::new(stub)
1413                        .set_name(name)
1414                        .with_options(options)
1415                        .send()
1416                        .await?;
1417                    Ok(Operation::new(op))
1418                }
1419            };
1420
1421            let start = move || async {
1422                let op = self.send().await?;
1423                Ok(Operation::new(op))
1424            };
1425
1426            use google_cloud_lro::internal::PollerExt;
1427            {
1428                google_cloud_lro::internal::new_poller(
1429                    polling_error_policy,
1430                    polling_backoff_policy,
1431                    start,
1432                    query,
1433                )
1434            }
1435            .with_options(poller_options)
1436        }
1437
1438        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1439        ///
1440        /// This is a **required** field for requests.
1441        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1442            self.0.request.parent = v.into();
1443            self
1444        }
1445
1446        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1447        ///
1448        /// Note that all the setters affecting `source` are
1449        /// mutually exclusive.
1450        pub fn set_source<
1451            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1452        >(
1453            mut self,
1454            v: T,
1455        ) -> Self {
1456            self.0.request.source = v.into();
1457            self
1458        }
1459
1460        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1461        /// to hold a `InlineSource`.
1462        ///
1463        /// Note that all the setters affecting `source` are
1464        /// mutually exclusive.
1465        pub fn set_inline_source<
1466            T: std::convert::Into<
1467                    std::boxed::Box<
1468                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1469                    >,
1470                >,
1471        >(
1472            mut self,
1473            v: T,
1474        ) -> Self {
1475            self.0.request = self.0.request.set_inline_source(v);
1476            self
1477        }
1478
1479        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1480        /// to hold a `GcsSource`.
1481        ///
1482        /// Note that all the setters affecting `source` are
1483        /// mutually exclusive.
1484        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1485            mut self,
1486            v: T,
1487        ) -> Self {
1488            self.0.request = self.0.request.set_gcs_source(v);
1489            self
1490        }
1491    }
1492
1493    #[doc(hidden)]
1494    impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1495        fn request_options(&mut self) -> &mut crate::RequestOptions {
1496            &mut self.0.options
1497        }
1498    }
1499
1500    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1501    ///
1502    /// # Example
1503    /// ```
1504    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeSuggestionDenyListEntries;
1505    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1506    /// use google_cloud_lro::Poller;
1507    ///
1508    /// let builder = prepare_request_builder();
1509    /// let response = builder.poller().until_done().await?;
1510    /// # Ok(()) }
1511    ///
1512    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1513    ///   # panic!();
1514    ///   // ... details omitted ...
1515    /// }
1516    /// ```
1517    #[derive(Clone, Debug)]
1518    pub struct PurgeSuggestionDenyListEntries(
1519        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1520    );
1521
1522    impl PurgeSuggestionDenyListEntries {
1523        pub(crate) fn new(
1524            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1525        ) -> Self {
1526            Self(RequestBuilder::new(stub))
1527        }
1528
1529        /// Sets the full request, replacing any prior values.
1530        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1531            mut self,
1532            v: V,
1533        ) -> Self {
1534            self.0.request = v.into();
1535            self
1536        }
1537
1538        /// Sets all the options, replacing any prior values.
1539        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1540            self.0.options = v.into();
1541            self
1542        }
1543
1544        /// Sends the request.
1545        ///
1546        /// # Long running operations
1547        ///
1548        /// This starts, but does not poll, a longrunning operation. More information
1549        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1550        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1551            (*self.0.stub)
1552                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1553                .await
1554                .map(crate::Response::into_body)
1555        }
1556
1557        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1558        pub fn poller(
1559            self,
1560        ) -> impl google_cloud_lro::Poller<
1561            crate::model::PurgeSuggestionDenyListEntriesResponse,
1562            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1563        > {
1564            type Operation = google_cloud_lro::internal::Operation<
1565                crate::model::PurgeSuggestionDenyListEntriesResponse,
1566                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1567            >;
1568            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1569            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1570            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1571            if let Some(ref mut details) = poller_options.tracing {
1572                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_suggestion_deny_list_entries::until_done";
1573            }
1574
1575            let stub = self.0.stub.clone();
1576            let mut options = self.0.options.clone();
1577            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1578            let query = move |name| {
1579                let stub = stub.clone();
1580                let options = options.clone();
1581                async {
1582                    let op = GetOperation::new(stub)
1583                        .set_name(name)
1584                        .with_options(options)
1585                        .send()
1586                        .await?;
1587                    Ok(Operation::new(op))
1588                }
1589            };
1590
1591            let start = move || async {
1592                let op = self.send().await?;
1593                Ok(Operation::new(op))
1594            };
1595
1596            use google_cloud_lro::internal::PollerExt;
1597            {
1598                google_cloud_lro::internal::new_poller(
1599                    polling_error_policy,
1600                    polling_backoff_policy,
1601                    start,
1602                    query,
1603                )
1604            }
1605            .with_options(poller_options)
1606        }
1607
1608        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1609        ///
1610        /// This is a **required** field for requests.
1611        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1612            self.0.request.parent = v.into();
1613            self
1614        }
1615    }
1616
1617    #[doc(hidden)]
1618    impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1619        fn request_options(&mut self) -> &mut crate::RequestOptions {
1620            &mut self.0.options
1621        }
1622    }
1623
1624    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1625    ///
1626    /// # Example
1627    /// ```
1628    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportCompletionSuggestions;
1629    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1630    /// use google_cloud_lro::Poller;
1631    ///
1632    /// let builder = prepare_request_builder();
1633    /// let response = builder.poller().until_done().await?;
1634    /// # Ok(()) }
1635    ///
1636    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1637    ///   # panic!();
1638    ///   // ... details omitted ...
1639    /// }
1640    /// ```
1641    #[derive(Clone, Debug)]
1642    pub struct ImportCompletionSuggestions(
1643        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1644    );
1645
1646    impl ImportCompletionSuggestions {
1647        pub(crate) fn new(
1648            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1649        ) -> Self {
1650            Self(RequestBuilder::new(stub))
1651        }
1652
1653        /// Sets the full request, replacing any prior values.
1654        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1655            mut self,
1656            v: V,
1657        ) -> Self {
1658            self.0.request = v.into();
1659            self
1660        }
1661
1662        /// Sets all the options, replacing any prior values.
1663        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1664            self.0.options = v.into();
1665            self
1666        }
1667
1668        /// Sends the request.
1669        ///
1670        /// # Long running operations
1671        ///
1672        /// This starts, but does not poll, a longrunning operation. More information
1673        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1674        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1675            (*self.0.stub)
1676                .import_completion_suggestions(self.0.request, self.0.options)
1677                .await
1678                .map(crate::Response::into_body)
1679        }
1680
1681        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_completion_suggestions`.
1682        pub fn poller(
1683            self,
1684        ) -> impl google_cloud_lro::Poller<
1685            crate::model::ImportCompletionSuggestionsResponse,
1686            crate::model::ImportCompletionSuggestionsMetadata,
1687        > {
1688            type Operation = google_cloud_lro::internal::Operation<
1689                crate::model::ImportCompletionSuggestionsResponse,
1690                crate::model::ImportCompletionSuggestionsMetadata,
1691            >;
1692            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1693            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1694            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1695            if let Some(ref mut details) = poller_options.tracing {
1696                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_completion_suggestions::until_done";
1697            }
1698
1699            let stub = self.0.stub.clone();
1700            let mut options = self.0.options.clone();
1701            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1702            let query = move |name| {
1703                let stub = stub.clone();
1704                let options = options.clone();
1705                async {
1706                    let op = GetOperation::new(stub)
1707                        .set_name(name)
1708                        .with_options(options)
1709                        .send()
1710                        .await?;
1711                    Ok(Operation::new(op))
1712                }
1713            };
1714
1715            let start = move || async {
1716                let op = self.send().await?;
1717                Ok(Operation::new(op))
1718            };
1719
1720            use google_cloud_lro::internal::PollerExt;
1721            {
1722                google_cloud_lro::internal::new_poller(
1723                    polling_error_policy,
1724                    polling_backoff_policy,
1725                    start,
1726                    query,
1727                )
1728            }
1729            .with_options(poller_options)
1730        }
1731
1732        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1733        ///
1734        /// This is a **required** field for requests.
1735        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1736            self.0.request.parent = v.into();
1737            self
1738        }
1739
1740        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1741        pub fn set_error_config<T>(mut self, v: T) -> Self
1742        where
1743            T: std::convert::Into<crate::model::ImportErrorConfig>,
1744        {
1745            self.0.request.error_config = std::option::Option::Some(v.into());
1746            self
1747        }
1748
1749        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1750        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1751        where
1752            T: std::convert::Into<crate::model::ImportErrorConfig>,
1753        {
1754            self.0.request.error_config = v.map(|x| x.into());
1755            self
1756        }
1757
1758        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1759        ///
1760        /// Note that all the setters affecting `source` are
1761        /// mutually exclusive.
1762        pub fn set_source<
1763            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1764        >(
1765            mut self,
1766            v: T,
1767        ) -> Self {
1768            self.0.request.source = v.into();
1769            self
1770        }
1771
1772        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1773        /// to hold a `InlineSource`.
1774        ///
1775        /// Note that all the setters affecting `source` are
1776        /// mutually exclusive.
1777        pub fn set_inline_source<
1778            T: std::convert::Into<
1779                    std::boxed::Box<
1780                        crate::model::import_completion_suggestions_request::InlineSource,
1781                    >,
1782                >,
1783        >(
1784            mut self,
1785            v: T,
1786        ) -> Self {
1787            self.0.request = self.0.request.set_inline_source(v);
1788            self
1789        }
1790
1791        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1792        /// to hold a `GcsSource`.
1793        ///
1794        /// Note that all the setters affecting `source` are
1795        /// mutually exclusive.
1796        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1797            mut self,
1798            v: T,
1799        ) -> Self {
1800            self.0.request = self.0.request.set_gcs_source(v);
1801            self
1802        }
1803
1804        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1805        /// to hold a `BigquerySource`.
1806        ///
1807        /// Note that all the setters affecting `source` are
1808        /// mutually exclusive.
1809        pub fn set_bigquery_source<
1810            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1811        >(
1812            mut self,
1813            v: T,
1814        ) -> Self {
1815            self.0.request = self.0.request.set_bigquery_source(v);
1816            self
1817        }
1818    }
1819
1820    #[doc(hidden)]
1821    impl crate::RequestBuilder for ImportCompletionSuggestions {
1822        fn request_options(&mut self) -> &mut crate::RequestOptions {
1823            &mut self.0.options
1824        }
1825    }
1826
1827    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1828    ///
1829    /// # Example
1830    /// ```
1831    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeCompletionSuggestions;
1832    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1833    /// use google_cloud_lro::Poller;
1834    ///
1835    /// let builder = prepare_request_builder();
1836    /// let response = builder.poller().until_done().await?;
1837    /// # Ok(()) }
1838    ///
1839    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1840    ///   # panic!();
1841    ///   // ... details omitted ...
1842    /// }
1843    /// ```
1844    #[derive(Clone, Debug)]
1845    pub struct PurgeCompletionSuggestions(
1846        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1847    );
1848
1849    impl PurgeCompletionSuggestions {
1850        pub(crate) fn new(
1851            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1852        ) -> Self {
1853            Self(RequestBuilder::new(stub))
1854        }
1855
1856        /// Sets the full request, replacing any prior values.
1857        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1858            mut self,
1859            v: V,
1860        ) -> Self {
1861            self.0.request = v.into();
1862            self
1863        }
1864
1865        /// Sets all the options, replacing any prior values.
1866        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1867            self.0.options = v.into();
1868            self
1869        }
1870
1871        /// Sends the request.
1872        ///
1873        /// # Long running operations
1874        ///
1875        /// This starts, but does not poll, a longrunning operation. More information
1876        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1877        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1878            (*self.0.stub)
1879                .purge_completion_suggestions(self.0.request, self.0.options)
1880                .await
1881                .map(crate::Response::into_body)
1882        }
1883
1884        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_completion_suggestions`.
1885        pub fn poller(
1886            self,
1887        ) -> impl google_cloud_lro::Poller<
1888            crate::model::PurgeCompletionSuggestionsResponse,
1889            crate::model::PurgeCompletionSuggestionsMetadata,
1890        > {
1891            type Operation = google_cloud_lro::internal::Operation<
1892                crate::model::PurgeCompletionSuggestionsResponse,
1893                crate::model::PurgeCompletionSuggestionsMetadata,
1894            >;
1895            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1896            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1897            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1898            if let Some(ref mut details) = poller_options.tracing {
1899                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_completion_suggestions::until_done";
1900            }
1901
1902            let stub = self.0.stub.clone();
1903            let mut options = self.0.options.clone();
1904            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1905            let query = move |name| {
1906                let stub = stub.clone();
1907                let options = options.clone();
1908                async {
1909                    let op = GetOperation::new(stub)
1910                        .set_name(name)
1911                        .with_options(options)
1912                        .send()
1913                        .await?;
1914                    Ok(Operation::new(op))
1915                }
1916            };
1917
1918            let start = move || async {
1919                let op = self.send().await?;
1920                Ok(Operation::new(op))
1921            };
1922
1923            use google_cloud_lro::internal::PollerExt;
1924            {
1925                google_cloud_lro::internal::new_poller(
1926                    polling_error_policy,
1927                    polling_backoff_policy,
1928                    start,
1929                    query,
1930                )
1931            }
1932            .with_options(poller_options)
1933        }
1934
1935        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1936        ///
1937        /// This is a **required** field for requests.
1938        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1939            self.0.request.parent = v.into();
1940            self
1941        }
1942    }
1943
1944    #[doc(hidden)]
1945    impl crate::RequestBuilder for PurgeCompletionSuggestions {
1946        fn request_options(&mut self) -> &mut crate::RequestOptions {
1947            &mut self.0.options
1948        }
1949    }
1950
1951    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1952    ///
1953    /// # Example
1954    /// ```
1955    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ListOperations;
1956    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1957    /// use google_cloud_gax::paginator::ItemPaginator;
1958    ///
1959    /// let builder = prepare_request_builder();
1960    /// let mut items = builder.by_item();
1961    /// while let Some(result) = items.next().await {
1962    ///   let item = result?;
1963    /// }
1964    /// # Ok(()) }
1965    ///
1966    /// fn prepare_request_builder() -> ListOperations {
1967    ///   # panic!();
1968    ///   // ... details omitted ...
1969    /// }
1970    /// ```
1971    #[derive(Clone, Debug)]
1972    pub struct ListOperations(
1973        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1974    );
1975
1976    impl ListOperations {
1977        pub(crate) fn new(
1978            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1979        ) -> Self {
1980            Self(RequestBuilder::new(stub))
1981        }
1982
1983        /// Sets the full request, replacing any prior values.
1984        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1985            mut self,
1986            v: V,
1987        ) -> Self {
1988            self.0.request = v.into();
1989            self
1990        }
1991
1992        /// Sets all the options, replacing any prior values.
1993        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1994            self.0.options = v.into();
1995            self
1996        }
1997
1998        /// Sends the request.
1999        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2000            (*self.0.stub)
2001                .list_operations(self.0.request, self.0.options)
2002                .await
2003                .map(crate::Response::into_body)
2004        }
2005
2006        /// Streams each page in the collection.
2007        pub fn by_page(
2008            self,
2009        ) -> impl google_cloud_gax::paginator::Paginator<
2010            google_cloud_longrunning::model::ListOperationsResponse,
2011            crate::Error,
2012        > {
2013            use std::clone::Clone;
2014            let token = self.0.request.page_token.clone();
2015            let execute = move |token: String| {
2016                let mut builder = self.clone();
2017                builder.0.request = builder.0.request.set_page_token(token);
2018                builder.send()
2019            };
2020            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2021        }
2022
2023        /// Streams each item in the collection.
2024        pub fn by_item(
2025            self,
2026        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2027            google_cloud_longrunning::model::ListOperationsResponse,
2028            crate::Error,
2029        > {
2030            use google_cloud_gax::paginator::Paginator;
2031            self.by_page().items()
2032        }
2033
2034        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2035        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2036            self.0.request.name = v.into();
2037            self
2038        }
2039
2040        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2041        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2042            self.0.request.filter = v.into();
2043            self
2044        }
2045
2046        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2047        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2048            self.0.request.page_size = v.into();
2049            self
2050        }
2051
2052        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2053        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2054            self.0.request.page_token = v.into();
2055            self
2056        }
2057
2058        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2059        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2060            self.0.request.return_partial_success = v.into();
2061            self
2062        }
2063    }
2064
2065    #[doc(hidden)]
2066    impl crate::RequestBuilder for ListOperations {
2067        fn request_options(&mut self) -> &mut crate::RequestOptions {
2068            &mut self.0.options
2069        }
2070    }
2071
2072    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
2073    ///
2074    /// # Example
2075    /// ```
2076    /// # use google_cloud_discoveryengine_v1::builder::completion_service::GetOperation;
2077    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2078    ///
2079    /// let builder = prepare_request_builder();
2080    /// let response = builder.send().await?;
2081    /// # Ok(()) }
2082    ///
2083    /// fn prepare_request_builder() -> GetOperation {
2084    ///   # panic!();
2085    ///   // ... details omitted ...
2086    /// }
2087    /// ```
2088    #[derive(Clone, Debug)]
2089    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2090
2091    impl GetOperation {
2092        pub(crate) fn new(
2093            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2094        ) -> Self {
2095            Self(RequestBuilder::new(stub))
2096        }
2097
2098        /// Sets the full request, replacing any prior values.
2099        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2100            mut self,
2101            v: V,
2102        ) -> Self {
2103            self.0.request = v.into();
2104            self
2105        }
2106
2107        /// Sets all the options, replacing any prior values.
2108        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2109            self.0.options = v.into();
2110            self
2111        }
2112
2113        /// Sends the request.
2114        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2115            (*self.0.stub)
2116                .get_operation(self.0.request, self.0.options)
2117                .await
2118                .map(crate::Response::into_body)
2119        }
2120
2121        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2123            self.0.request.name = v.into();
2124            self
2125        }
2126    }
2127
2128    #[doc(hidden)]
2129    impl crate::RequestBuilder for GetOperation {
2130        fn request_options(&mut self) -> &mut crate::RequestOptions {
2131            &mut self.0.options
2132        }
2133    }
2134
2135    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
2136    ///
2137    /// # Example
2138    /// ```
2139    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CancelOperation;
2140    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2141    ///
2142    /// let builder = prepare_request_builder();
2143    /// let response = builder.send().await?;
2144    /// # Ok(()) }
2145    ///
2146    /// fn prepare_request_builder() -> CancelOperation {
2147    ///   # panic!();
2148    ///   // ... details omitted ...
2149    /// }
2150    /// ```
2151    #[derive(Clone, Debug)]
2152    pub struct CancelOperation(
2153        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2154    );
2155
2156    impl CancelOperation {
2157        pub(crate) fn new(
2158            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2159        ) -> Self {
2160            Self(RequestBuilder::new(stub))
2161        }
2162
2163        /// Sets the full request, replacing any prior values.
2164        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2165            mut self,
2166            v: V,
2167        ) -> Self {
2168            self.0.request = v.into();
2169            self
2170        }
2171
2172        /// Sets all the options, replacing any prior values.
2173        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2174            self.0.options = v.into();
2175            self
2176        }
2177
2178        /// Sends the request.
2179        pub async fn send(self) -> Result<()> {
2180            (*self.0.stub)
2181                .cancel_operation(self.0.request, self.0.options)
2182                .await
2183                .map(crate::Response::into_body)
2184        }
2185
2186        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2187        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2188            self.0.request.name = v.into();
2189            self
2190        }
2191    }
2192
2193    #[doc(hidden)]
2194    impl crate::RequestBuilder for CancelOperation {
2195        fn request_options(&mut self) -> &mut crate::RequestOptions {
2196            &mut self.0.options
2197        }
2198    }
2199}
2200
2201/// Request and client builders for [ControlService][crate::client::ControlService].
2202#[cfg(feature = "control-service")]
2203#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
2204pub mod control_service {
2205    use crate::Result;
2206
2207    /// A builder for [ControlService][crate::client::ControlService].
2208    ///
2209    /// ```
2210    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2211    /// # use google_cloud_discoveryengine_v1::*;
2212    /// # use builder::control_service::ClientBuilder;
2213    /// # use client::ControlService;
2214    /// let builder : ClientBuilder = ControlService::builder();
2215    /// let client = builder
2216    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2217    ///     .build().await?;
2218    /// # Ok(()) }
2219    /// ```
2220    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2221
2222    pub(crate) mod client {
2223        use super::super::super::client::ControlService;
2224        pub struct Factory;
2225        impl crate::ClientFactory for Factory {
2226            type Client = ControlService;
2227            type Credentials = gaxi::options::Credentials;
2228            async fn build(
2229                self,
2230                config: gaxi::options::ClientConfig,
2231            ) -> crate::ClientBuilderResult<Self::Client> {
2232                Self::Client::new(config).await
2233            }
2234        }
2235    }
2236
2237    /// Common implementation for [crate::client::ControlService] request builders.
2238    #[derive(Clone, Debug)]
2239    pub(crate) struct RequestBuilder<R: std::default::Default> {
2240        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2241        request: R,
2242        options: crate::RequestOptions,
2243    }
2244
2245    impl<R> RequestBuilder<R>
2246    where
2247        R: std::default::Default,
2248    {
2249        pub(crate) fn new(
2250            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2251        ) -> Self {
2252            Self {
2253                stub,
2254                request: R::default(),
2255                options: crate::RequestOptions::default(),
2256            }
2257        }
2258    }
2259
2260    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2261    ///
2262    /// # Example
2263    /// ```
2264    /// # use google_cloud_discoveryengine_v1::builder::control_service::CreateControl;
2265    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2266    ///
2267    /// let builder = prepare_request_builder();
2268    /// let response = builder.send().await?;
2269    /// # Ok(()) }
2270    ///
2271    /// fn prepare_request_builder() -> CreateControl {
2272    ///   # panic!();
2273    ///   // ... details omitted ...
2274    /// }
2275    /// ```
2276    #[derive(Clone, Debug)]
2277    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2278
2279    impl CreateControl {
2280        pub(crate) fn new(
2281            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2282        ) -> Self {
2283            Self(RequestBuilder::new(stub))
2284        }
2285
2286        /// Sets the full request, replacing any prior values.
2287        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2288            self.0.request = v.into();
2289            self
2290        }
2291
2292        /// Sets all the options, replacing any prior values.
2293        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2294            self.0.options = v.into();
2295            self
2296        }
2297
2298        /// Sends the request.
2299        pub async fn send(self) -> Result<crate::model::Control> {
2300            (*self.0.stub)
2301                .create_control(self.0.request, self.0.options)
2302                .await
2303                .map(crate::Response::into_body)
2304        }
2305
2306        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2307        ///
2308        /// This is a **required** field for requests.
2309        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2310            self.0.request.parent = v.into();
2311            self
2312        }
2313
2314        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2315        ///
2316        /// This is a **required** field for requests.
2317        pub fn set_control<T>(mut self, v: T) -> Self
2318        where
2319            T: std::convert::Into<crate::model::Control>,
2320        {
2321            self.0.request.control = std::option::Option::Some(v.into());
2322            self
2323        }
2324
2325        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2326        ///
2327        /// This is a **required** field for requests.
2328        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2329        where
2330            T: std::convert::Into<crate::model::Control>,
2331        {
2332            self.0.request.control = v.map(|x| x.into());
2333            self
2334        }
2335
2336        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2337        ///
2338        /// This is a **required** field for requests.
2339        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2340            self.0.request.control_id = v.into();
2341            self
2342        }
2343    }
2344
2345    #[doc(hidden)]
2346    impl crate::RequestBuilder for CreateControl {
2347        fn request_options(&mut self) -> &mut crate::RequestOptions {
2348            &mut self.0.options
2349        }
2350    }
2351
2352    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2353    ///
2354    /// # Example
2355    /// ```
2356    /// # use google_cloud_discoveryengine_v1::builder::control_service::DeleteControl;
2357    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2358    ///
2359    /// let builder = prepare_request_builder();
2360    /// let response = builder.send().await?;
2361    /// # Ok(()) }
2362    ///
2363    /// fn prepare_request_builder() -> DeleteControl {
2364    ///   # panic!();
2365    ///   // ... details omitted ...
2366    /// }
2367    /// ```
2368    #[derive(Clone, Debug)]
2369    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2370
2371    impl DeleteControl {
2372        pub(crate) fn new(
2373            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2374        ) -> Self {
2375            Self(RequestBuilder::new(stub))
2376        }
2377
2378        /// Sets the full request, replacing any prior values.
2379        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2380            self.0.request = v.into();
2381            self
2382        }
2383
2384        /// Sets all the options, replacing any prior values.
2385        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2386            self.0.options = v.into();
2387            self
2388        }
2389
2390        /// Sends the request.
2391        pub async fn send(self) -> Result<()> {
2392            (*self.0.stub)
2393                .delete_control(self.0.request, self.0.options)
2394                .await
2395                .map(crate::Response::into_body)
2396        }
2397
2398        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2399        ///
2400        /// This is a **required** field for requests.
2401        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2402            self.0.request.name = v.into();
2403            self
2404        }
2405    }
2406
2407    #[doc(hidden)]
2408    impl crate::RequestBuilder for DeleteControl {
2409        fn request_options(&mut self) -> &mut crate::RequestOptions {
2410            &mut self.0.options
2411        }
2412    }
2413
2414    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2415    ///
2416    /// # Example
2417    /// ```
2418    /// # use google_cloud_discoveryengine_v1::builder::control_service::UpdateControl;
2419    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2420    ///
2421    /// let builder = prepare_request_builder();
2422    /// let response = builder.send().await?;
2423    /// # Ok(()) }
2424    ///
2425    /// fn prepare_request_builder() -> UpdateControl {
2426    ///   # panic!();
2427    ///   // ... details omitted ...
2428    /// }
2429    /// ```
2430    #[derive(Clone, Debug)]
2431    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2432
2433    impl UpdateControl {
2434        pub(crate) fn new(
2435            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2436        ) -> Self {
2437            Self(RequestBuilder::new(stub))
2438        }
2439
2440        /// Sets the full request, replacing any prior values.
2441        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2442            self.0.request = v.into();
2443            self
2444        }
2445
2446        /// Sets all the options, replacing any prior values.
2447        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2448            self.0.options = v.into();
2449            self
2450        }
2451
2452        /// Sends the request.
2453        pub async fn send(self) -> Result<crate::model::Control> {
2454            (*self.0.stub)
2455                .update_control(self.0.request, self.0.options)
2456                .await
2457                .map(crate::Response::into_body)
2458        }
2459
2460        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2461        ///
2462        /// This is a **required** field for requests.
2463        pub fn set_control<T>(mut self, v: T) -> Self
2464        where
2465            T: std::convert::Into<crate::model::Control>,
2466        {
2467            self.0.request.control = std::option::Option::Some(v.into());
2468            self
2469        }
2470
2471        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2472        ///
2473        /// This is a **required** field for requests.
2474        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2475        where
2476            T: std::convert::Into<crate::model::Control>,
2477        {
2478            self.0.request.control = v.map(|x| x.into());
2479            self
2480        }
2481
2482        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2483        pub fn set_update_mask<T>(mut self, v: T) -> Self
2484        where
2485            T: std::convert::Into<wkt::FieldMask>,
2486        {
2487            self.0.request.update_mask = std::option::Option::Some(v.into());
2488            self
2489        }
2490
2491        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2492        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2493        where
2494            T: std::convert::Into<wkt::FieldMask>,
2495        {
2496            self.0.request.update_mask = v.map(|x| x.into());
2497            self
2498        }
2499    }
2500
2501    #[doc(hidden)]
2502    impl crate::RequestBuilder for UpdateControl {
2503        fn request_options(&mut self) -> &mut crate::RequestOptions {
2504            &mut self.0.options
2505        }
2506    }
2507
2508    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2509    ///
2510    /// # Example
2511    /// ```
2512    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetControl;
2513    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2514    ///
2515    /// let builder = prepare_request_builder();
2516    /// let response = builder.send().await?;
2517    /// # Ok(()) }
2518    ///
2519    /// fn prepare_request_builder() -> GetControl {
2520    ///   # panic!();
2521    ///   // ... details omitted ...
2522    /// }
2523    /// ```
2524    #[derive(Clone, Debug)]
2525    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2526
2527    impl GetControl {
2528        pub(crate) fn new(
2529            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2530        ) -> Self {
2531            Self(RequestBuilder::new(stub))
2532        }
2533
2534        /// Sets the full request, replacing any prior values.
2535        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2536            self.0.request = v.into();
2537            self
2538        }
2539
2540        /// Sets all the options, replacing any prior values.
2541        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2542            self.0.options = v.into();
2543            self
2544        }
2545
2546        /// Sends the request.
2547        pub async fn send(self) -> Result<crate::model::Control> {
2548            (*self.0.stub)
2549                .get_control(self.0.request, self.0.options)
2550                .await
2551                .map(crate::Response::into_body)
2552        }
2553
2554        /// Sets the value of [name][crate::model::GetControlRequest::name].
2555        ///
2556        /// This is a **required** field for requests.
2557        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2558            self.0.request.name = v.into();
2559            self
2560        }
2561    }
2562
2563    #[doc(hidden)]
2564    impl crate::RequestBuilder for GetControl {
2565        fn request_options(&mut self) -> &mut crate::RequestOptions {
2566            &mut self.0.options
2567        }
2568    }
2569
2570    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2571    ///
2572    /// # Example
2573    /// ```
2574    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListControls;
2575    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2576    /// use google_cloud_gax::paginator::ItemPaginator;
2577    ///
2578    /// let builder = prepare_request_builder();
2579    /// let mut items = builder.by_item();
2580    /// while let Some(result) = items.next().await {
2581    ///   let item = result?;
2582    /// }
2583    /// # Ok(()) }
2584    ///
2585    /// fn prepare_request_builder() -> ListControls {
2586    ///   # panic!();
2587    ///   // ... details omitted ...
2588    /// }
2589    /// ```
2590    #[derive(Clone, Debug)]
2591    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2592
2593    impl ListControls {
2594        pub(crate) fn new(
2595            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2596        ) -> Self {
2597            Self(RequestBuilder::new(stub))
2598        }
2599
2600        /// Sets the full request, replacing any prior values.
2601        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2602            self.0.request = v.into();
2603            self
2604        }
2605
2606        /// Sets all the options, replacing any prior values.
2607        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2608            self.0.options = v.into();
2609            self
2610        }
2611
2612        /// Sends the request.
2613        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2614            (*self.0.stub)
2615                .list_controls(self.0.request, self.0.options)
2616                .await
2617                .map(crate::Response::into_body)
2618        }
2619
2620        /// Streams each page in the collection.
2621        pub fn by_page(
2622            self,
2623        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2624        {
2625            use std::clone::Clone;
2626            let token = self.0.request.page_token.clone();
2627            let execute = move |token: String| {
2628                let mut builder = self.clone();
2629                builder.0.request = builder.0.request.set_page_token(token);
2630                builder.send()
2631            };
2632            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2633        }
2634
2635        /// Streams each item in the collection.
2636        pub fn by_item(
2637            self,
2638        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2639            crate::model::ListControlsResponse,
2640            crate::Error,
2641        > {
2642            use google_cloud_gax::paginator::Paginator;
2643            self.by_page().items()
2644        }
2645
2646        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2647        ///
2648        /// This is a **required** field for requests.
2649        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2650            self.0.request.parent = v.into();
2651            self
2652        }
2653
2654        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2655        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2656            self.0.request.page_size = v.into();
2657            self
2658        }
2659
2660        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2661        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2662            self.0.request.page_token = v.into();
2663            self
2664        }
2665
2666        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2667        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2668            self.0.request.filter = v.into();
2669            self
2670        }
2671    }
2672
2673    #[doc(hidden)]
2674    impl crate::RequestBuilder for ListControls {
2675        fn request_options(&mut self) -> &mut crate::RequestOptions {
2676            &mut self.0.options
2677        }
2678    }
2679
2680    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2681    ///
2682    /// # Example
2683    /// ```
2684    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListOperations;
2685    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2686    /// use google_cloud_gax::paginator::ItemPaginator;
2687    ///
2688    /// let builder = prepare_request_builder();
2689    /// let mut items = builder.by_item();
2690    /// while let Some(result) = items.next().await {
2691    ///   let item = result?;
2692    /// }
2693    /// # Ok(()) }
2694    ///
2695    /// fn prepare_request_builder() -> ListOperations {
2696    ///   # panic!();
2697    ///   // ... details omitted ...
2698    /// }
2699    /// ```
2700    #[derive(Clone, Debug)]
2701    pub struct ListOperations(
2702        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2703    );
2704
2705    impl ListOperations {
2706        pub(crate) fn new(
2707            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2708        ) -> Self {
2709            Self(RequestBuilder::new(stub))
2710        }
2711
2712        /// Sets the full request, replacing any prior values.
2713        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2714            mut self,
2715            v: V,
2716        ) -> Self {
2717            self.0.request = v.into();
2718            self
2719        }
2720
2721        /// Sets all the options, replacing any prior values.
2722        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2723            self.0.options = v.into();
2724            self
2725        }
2726
2727        /// Sends the request.
2728        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2729            (*self.0.stub)
2730                .list_operations(self.0.request, self.0.options)
2731                .await
2732                .map(crate::Response::into_body)
2733        }
2734
2735        /// Streams each page in the collection.
2736        pub fn by_page(
2737            self,
2738        ) -> impl google_cloud_gax::paginator::Paginator<
2739            google_cloud_longrunning::model::ListOperationsResponse,
2740            crate::Error,
2741        > {
2742            use std::clone::Clone;
2743            let token = self.0.request.page_token.clone();
2744            let execute = move |token: String| {
2745                let mut builder = self.clone();
2746                builder.0.request = builder.0.request.set_page_token(token);
2747                builder.send()
2748            };
2749            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2750        }
2751
2752        /// Streams each item in the collection.
2753        pub fn by_item(
2754            self,
2755        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2756            google_cloud_longrunning::model::ListOperationsResponse,
2757            crate::Error,
2758        > {
2759            use google_cloud_gax::paginator::Paginator;
2760            self.by_page().items()
2761        }
2762
2763        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2764        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2765            self.0.request.name = v.into();
2766            self
2767        }
2768
2769        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2770        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2771            self.0.request.filter = v.into();
2772            self
2773        }
2774
2775        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2776        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2777            self.0.request.page_size = v.into();
2778            self
2779        }
2780
2781        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2782        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2783            self.0.request.page_token = v.into();
2784            self
2785        }
2786
2787        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2788        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2789            self.0.request.return_partial_success = v.into();
2790            self
2791        }
2792    }
2793
2794    #[doc(hidden)]
2795    impl crate::RequestBuilder for ListOperations {
2796        fn request_options(&mut self) -> &mut crate::RequestOptions {
2797            &mut self.0.options
2798        }
2799    }
2800
2801    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2802    ///
2803    /// # Example
2804    /// ```
2805    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetOperation;
2806    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2807    ///
2808    /// let builder = prepare_request_builder();
2809    /// let response = builder.send().await?;
2810    /// # Ok(()) }
2811    ///
2812    /// fn prepare_request_builder() -> GetOperation {
2813    ///   # panic!();
2814    ///   // ... details omitted ...
2815    /// }
2816    /// ```
2817    #[derive(Clone, Debug)]
2818    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2819
2820    impl GetOperation {
2821        pub(crate) fn new(
2822            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2823        ) -> Self {
2824            Self(RequestBuilder::new(stub))
2825        }
2826
2827        /// Sets the full request, replacing any prior values.
2828        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2829            mut self,
2830            v: V,
2831        ) -> Self {
2832            self.0.request = v.into();
2833            self
2834        }
2835
2836        /// Sets all the options, replacing any prior values.
2837        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2838            self.0.options = v.into();
2839            self
2840        }
2841
2842        /// Sends the request.
2843        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2844            (*self.0.stub)
2845                .get_operation(self.0.request, self.0.options)
2846                .await
2847                .map(crate::Response::into_body)
2848        }
2849
2850        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2851        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2852            self.0.request.name = v.into();
2853            self
2854        }
2855    }
2856
2857    #[doc(hidden)]
2858    impl crate::RequestBuilder for GetOperation {
2859        fn request_options(&mut self) -> &mut crate::RequestOptions {
2860            &mut self.0.options
2861        }
2862    }
2863
2864    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2865    ///
2866    /// # Example
2867    /// ```
2868    /// # use google_cloud_discoveryengine_v1::builder::control_service::CancelOperation;
2869    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2870    ///
2871    /// let builder = prepare_request_builder();
2872    /// let response = builder.send().await?;
2873    /// # Ok(()) }
2874    ///
2875    /// fn prepare_request_builder() -> CancelOperation {
2876    ///   # panic!();
2877    ///   // ... details omitted ...
2878    /// }
2879    /// ```
2880    #[derive(Clone, Debug)]
2881    pub struct CancelOperation(
2882        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2883    );
2884
2885    impl CancelOperation {
2886        pub(crate) fn new(
2887            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2888        ) -> Self {
2889            Self(RequestBuilder::new(stub))
2890        }
2891
2892        /// Sets the full request, replacing any prior values.
2893        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2894            mut self,
2895            v: V,
2896        ) -> Self {
2897            self.0.request = v.into();
2898            self
2899        }
2900
2901        /// Sets all the options, replacing any prior values.
2902        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2903            self.0.options = v.into();
2904            self
2905        }
2906
2907        /// Sends the request.
2908        pub async fn send(self) -> Result<()> {
2909            (*self.0.stub)
2910                .cancel_operation(self.0.request, self.0.options)
2911                .await
2912                .map(crate::Response::into_body)
2913        }
2914
2915        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2916        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2917            self.0.request.name = v.into();
2918            self
2919        }
2920    }
2921
2922    #[doc(hidden)]
2923    impl crate::RequestBuilder for CancelOperation {
2924        fn request_options(&mut self) -> &mut crate::RequestOptions {
2925            &mut self.0.options
2926        }
2927    }
2928}
2929
2930/// Request and client builders for [ConversationalSearchService][crate::client::ConversationalSearchService].
2931#[cfg(feature = "conversational-search-service")]
2932#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2933pub mod conversational_search_service {
2934    use crate::Result;
2935
2936    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2937    ///
2938    /// ```
2939    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2940    /// # use google_cloud_discoveryengine_v1::*;
2941    /// # use builder::conversational_search_service::ClientBuilder;
2942    /// # use client::ConversationalSearchService;
2943    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2944    /// let client = builder
2945    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2946    ///     .build().await?;
2947    /// # Ok(()) }
2948    /// ```
2949    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2950
2951    pub(crate) mod client {
2952        use super::super::super::client::ConversationalSearchService;
2953        pub struct Factory;
2954        impl crate::ClientFactory for Factory {
2955            type Client = ConversationalSearchService;
2956            type Credentials = gaxi::options::Credentials;
2957            async fn build(
2958                self,
2959                config: gaxi::options::ClientConfig,
2960            ) -> crate::ClientBuilderResult<Self::Client> {
2961                Self::Client::new(config).await
2962            }
2963        }
2964    }
2965
2966    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2967    #[derive(Clone, Debug)]
2968    pub(crate) struct RequestBuilder<R: std::default::Default> {
2969        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2970        request: R,
2971        options: crate::RequestOptions,
2972    }
2973
2974    impl<R> RequestBuilder<R>
2975    where
2976        R: std::default::Default,
2977    {
2978        pub(crate) fn new(
2979            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2980        ) -> Self {
2981            Self {
2982                stub,
2983                request: R::default(),
2984                options: crate::RequestOptions::default(),
2985            }
2986        }
2987    }
2988
2989    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2990    ///
2991    /// # Example
2992    /// ```
2993    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ConverseConversation;
2994    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2995    ///
2996    /// let builder = prepare_request_builder();
2997    /// let response = builder.send().await?;
2998    /// # Ok(()) }
2999    ///
3000    /// fn prepare_request_builder() -> ConverseConversation {
3001    ///   # panic!();
3002    ///   // ... details omitted ...
3003    /// }
3004    /// ```
3005    #[derive(Clone, Debug)]
3006    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
3007
3008    impl ConverseConversation {
3009        pub(crate) fn new(
3010            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3011        ) -> Self {
3012            Self(RequestBuilder::new(stub))
3013        }
3014
3015        /// Sets the full request, replacing any prior values.
3016        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
3017            mut self,
3018            v: V,
3019        ) -> Self {
3020            self.0.request = v.into();
3021            self
3022        }
3023
3024        /// Sets all the options, replacing any prior values.
3025        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3026            self.0.options = v.into();
3027            self
3028        }
3029
3030        /// Sends the request.
3031        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
3032            (*self.0.stub)
3033                .converse_conversation(self.0.request, self.0.options)
3034                .await
3035                .map(crate::Response::into_body)
3036        }
3037
3038        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
3039        ///
3040        /// This is a **required** field for requests.
3041        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3042            self.0.request.name = v.into();
3043            self
3044        }
3045
3046        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
3047        ///
3048        /// This is a **required** field for requests.
3049        pub fn set_query<T>(mut self, v: T) -> Self
3050        where
3051            T: std::convert::Into<crate::model::TextInput>,
3052        {
3053            self.0.request.query = std::option::Option::Some(v.into());
3054            self
3055        }
3056
3057        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
3058        ///
3059        /// This is a **required** field for requests.
3060        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3061        where
3062            T: std::convert::Into<crate::model::TextInput>,
3063        {
3064            self.0.request.query = v.map(|x| x.into());
3065            self
3066        }
3067
3068        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
3069        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3070            self.0.request.serving_config = v.into();
3071            self
3072        }
3073
3074        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
3075        pub fn set_conversation<T>(mut self, v: T) -> Self
3076        where
3077            T: std::convert::Into<crate::model::Conversation>,
3078        {
3079            self.0.request.conversation = std::option::Option::Some(v.into());
3080            self
3081        }
3082
3083        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
3084        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3085        where
3086            T: std::convert::Into<crate::model::Conversation>,
3087        {
3088            self.0.request.conversation = v.map(|x| x.into());
3089            self
3090        }
3091
3092        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
3093        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
3094            self.0.request.safe_search = v.into();
3095            self
3096        }
3097
3098        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
3099        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3100        where
3101            T: std::iter::IntoIterator<Item = (K, V)>,
3102            K: std::convert::Into<std::string::String>,
3103            V: std::convert::Into<std::string::String>,
3104        {
3105            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3106            self
3107        }
3108
3109        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
3110        pub fn set_summary_spec<T>(mut self, v: T) -> Self
3111        where
3112            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
3113        {
3114            self.0.request.summary_spec = std::option::Option::Some(v.into());
3115            self
3116        }
3117
3118        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
3119        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
3120        where
3121            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
3122        {
3123            self.0.request.summary_spec = v.map(|x| x.into());
3124            self
3125        }
3126
3127        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
3128        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3129            self.0.request.filter = v.into();
3130            self
3131        }
3132
3133        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
3134        pub fn set_boost_spec<T>(mut self, v: T) -> Self
3135        where
3136            T: std::convert::Into<crate::model::search_request::BoostSpec>,
3137        {
3138            self.0.request.boost_spec = std::option::Option::Some(v.into());
3139            self
3140        }
3141
3142        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
3143        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
3144        where
3145            T: std::convert::Into<crate::model::search_request::BoostSpec>,
3146        {
3147            self.0.request.boost_spec = v.map(|x| x.into());
3148            self
3149        }
3150    }
3151
3152    #[doc(hidden)]
3153    impl crate::RequestBuilder for ConverseConversation {
3154        fn request_options(&mut self) -> &mut crate::RequestOptions {
3155            &mut self.0.options
3156        }
3157    }
3158
3159    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
3160    ///
3161    /// # Example
3162    /// ```
3163    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateConversation;
3164    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3165    ///
3166    /// let builder = prepare_request_builder();
3167    /// let response = builder.send().await?;
3168    /// # Ok(()) }
3169    ///
3170    /// fn prepare_request_builder() -> CreateConversation {
3171    ///   # panic!();
3172    ///   // ... details omitted ...
3173    /// }
3174    /// ```
3175    #[derive(Clone, Debug)]
3176    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3177
3178    impl CreateConversation {
3179        pub(crate) fn new(
3180            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3181        ) -> Self {
3182            Self(RequestBuilder::new(stub))
3183        }
3184
3185        /// Sets the full request, replacing any prior values.
3186        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3187            mut self,
3188            v: V,
3189        ) -> Self {
3190            self.0.request = v.into();
3191            self
3192        }
3193
3194        /// Sets all the options, replacing any prior values.
3195        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3196            self.0.options = v.into();
3197            self
3198        }
3199
3200        /// Sends the request.
3201        pub async fn send(self) -> Result<crate::model::Conversation> {
3202            (*self.0.stub)
3203                .create_conversation(self.0.request, self.0.options)
3204                .await
3205                .map(crate::Response::into_body)
3206        }
3207
3208        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
3209        ///
3210        /// This is a **required** field for requests.
3211        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3212            self.0.request.parent = v.into();
3213            self
3214        }
3215
3216        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
3217        ///
3218        /// This is a **required** field for requests.
3219        pub fn set_conversation<T>(mut self, v: T) -> Self
3220        where
3221            T: std::convert::Into<crate::model::Conversation>,
3222        {
3223            self.0.request.conversation = std::option::Option::Some(v.into());
3224            self
3225        }
3226
3227        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
3228        ///
3229        /// This is a **required** field for requests.
3230        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3231        where
3232            T: std::convert::Into<crate::model::Conversation>,
3233        {
3234            self.0.request.conversation = v.map(|x| x.into());
3235            self
3236        }
3237    }
3238
3239    #[doc(hidden)]
3240    impl crate::RequestBuilder for CreateConversation {
3241        fn request_options(&mut self) -> &mut crate::RequestOptions {
3242            &mut self.0.options
3243        }
3244    }
3245
3246    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
3247    ///
3248    /// # Example
3249    /// ```
3250    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteConversation;
3251    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3252    ///
3253    /// let builder = prepare_request_builder();
3254    /// let response = builder.send().await?;
3255    /// # Ok(()) }
3256    ///
3257    /// fn prepare_request_builder() -> DeleteConversation {
3258    ///   # panic!();
3259    ///   // ... details omitted ...
3260    /// }
3261    /// ```
3262    #[derive(Clone, Debug)]
3263    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3264
3265    impl DeleteConversation {
3266        pub(crate) fn new(
3267            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3268        ) -> Self {
3269            Self(RequestBuilder::new(stub))
3270        }
3271
3272        /// Sets the full request, replacing any prior values.
3273        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3274            mut self,
3275            v: V,
3276        ) -> Self {
3277            self.0.request = v.into();
3278            self
3279        }
3280
3281        /// Sets all the options, replacing any prior values.
3282        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3283            self.0.options = v.into();
3284            self
3285        }
3286
3287        /// Sends the request.
3288        pub async fn send(self) -> Result<()> {
3289            (*self.0.stub)
3290                .delete_conversation(self.0.request, self.0.options)
3291                .await
3292                .map(crate::Response::into_body)
3293        }
3294
3295        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3296        ///
3297        /// This is a **required** field for requests.
3298        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3299            self.0.request.name = v.into();
3300            self
3301        }
3302    }
3303
3304    #[doc(hidden)]
3305    impl crate::RequestBuilder for DeleteConversation {
3306        fn request_options(&mut self) -> &mut crate::RequestOptions {
3307            &mut self.0.options
3308        }
3309    }
3310
3311    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3312    ///
3313    /// # Example
3314    /// ```
3315    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateConversation;
3316    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3317    ///
3318    /// let builder = prepare_request_builder();
3319    /// let response = builder.send().await?;
3320    /// # Ok(()) }
3321    ///
3322    /// fn prepare_request_builder() -> UpdateConversation {
3323    ///   # panic!();
3324    ///   // ... details omitted ...
3325    /// }
3326    /// ```
3327    #[derive(Clone, Debug)]
3328    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3329
3330    impl UpdateConversation {
3331        pub(crate) fn new(
3332            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3333        ) -> Self {
3334            Self(RequestBuilder::new(stub))
3335        }
3336
3337        /// Sets the full request, replacing any prior values.
3338        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3339            mut self,
3340            v: V,
3341        ) -> Self {
3342            self.0.request = v.into();
3343            self
3344        }
3345
3346        /// Sets all the options, replacing any prior values.
3347        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3348            self.0.options = v.into();
3349            self
3350        }
3351
3352        /// Sends the request.
3353        pub async fn send(self) -> Result<crate::model::Conversation> {
3354            (*self.0.stub)
3355                .update_conversation(self.0.request, self.0.options)
3356                .await
3357                .map(crate::Response::into_body)
3358        }
3359
3360        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3361        ///
3362        /// This is a **required** field for requests.
3363        pub fn set_conversation<T>(mut self, v: T) -> Self
3364        where
3365            T: std::convert::Into<crate::model::Conversation>,
3366        {
3367            self.0.request.conversation = std::option::Option::Some(v.into());
3368            self
3369        }
3370
3371        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3372        ///
3373        /// This is a **required** field for requests.
3374        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3375        where
3376            T: std::convert::Into<crate::model::Conversation>,
3377        {
3378            self.0.request.conversation = v.map(|x| x.into());
3379            self
3380        }
3381
3382        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3383        pub fn set_update_mask<T>(mut self, v: T) -> Self
3384        where
3385            T: std::convert::Into<wkt::FieldMask>,
3386        {
3387            self.0.request.update_mask = std::option::Option::Some(v.into());
3388            self
3389        }
3390
3391        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3392        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3393        where
3394            T: std::convert::Into<wkt::FieldMask>,
3395        {
3396            self.0.request.update_mask = v.map(|x| x.into());
3397            self
3398        }
3399    }
3400
3401    #[doc(hidden)]
3402    impl crate::RequestBuilder for UpdateConversation {
3403        fn request_options(&mut self) -> &mut crate::RequestOptions {
3404            &mut self.0.options
3405        }
3406    }
3407
3408    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3409    ///
3410    /// # Example
3411    /// ```
3412    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetConversation;
3413    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3414    ///
3415    /// let builder = prepare_request_builder();
3416    /// let response = builder.send().await?;
3417    /// # Ok(()) }
3418    ///
3419    /// fn prepare_request_builder() -> GetConversation {
3420    ///   # panic!();
3421    ///   // ... details omitted ...
3422    /// }
3423    /// ```
3424    #[derive(Clone, Debug)]
3425    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3426
3427    impl GetConversation {
3428        pub(crate) fn new(
3429            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3430        ) -> Self {
3431            Self(RequestBuilder::new(stub))
3432        }
3433
3434        /// Sets the full request, replacing any prior values.
3435        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3436            self.0.request = v.into();
3437            self
3438        }
3439
3440        /// Sets all the options, replacing any prior values.
3441        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3442            self.0.options = v.into();
3443            self
3444        }
3445
3446        /// Sends the request.
3447        pub async fn send(self) -> Result<crate::model::Conversation> {
3448            (*self.0.stub)
3449                .get_conversation(self.0.request, self.0.options)
3450                .await
3451                .map(crate::Response::into_body)
3452        }
3453
3454        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3455        ///
3456        /// This is a **required** field for requests.
3457        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3458            self.0.request.name = v.into();
3459            self
3460        }
3461    }
3462
3463    #[doc(hidden)]
3464    impl crate::RequestBuilder for GetConversation {
3465        fn request_options(&mut self) -> &mut crate::RequestOptions {
3466            &mut self.0.options
3467        }
3468    }
3469
3470    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3471    ///
3472    /// # Example
3473    /// ```
3474    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListConversations;
3475    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3476    /// use google_cloud_gax::paginator::ItemPaginator;
3477    ///
3478    /// let builder = prepare_request_builder();
3479    /// let mut items = builder.by_item();
3480    /// while let Some(result) = items.next().await {
3481    ///   let item = result?;
3482    /// }
3483    /// # Ok(()) }
3484    ///
3485    /// fn prepare_request_builder() -> ListConversations {
3486    ///   # panic!();
3487    ///   // ... details omitted ...
3488    /// }
3489    /// ```
3490    #[derive(Clone, Debug)]
3491    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3492
3493    impl ListConversations {
3494        pub(crate) fn new(
3495            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3496        ) -> Self {
3497            Self(RequestBuilder::new(stub))
3498        }
3499
3500        /// Sets the full request, replacing any prior values.
3501        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3502            mut self,
3503            v: V,
3504        ) -> Self {
3505            self.0.request = v.into();
3506            self
3507        }
3508
3509        /// Sets all the options, replacing any prior values.
3510        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3511            self.0.options = v.into();
3512            self
3513        }
3514
3515        /// Sends the request.
3516        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3517            (*self.0.stub)
3518                .list_conversations(self.0.request, self.0.options)
3519                .await
3520                .map(crate::Response::into_body)
3521        }
3522
3523        /// Streams each page in the collection.
3524        pub fn by_page(
3525            self,
3526        ) -> impl google_cloud_gax::paginator::Paginator<
3527            crate::model::ListConversationsResponse,
3528            crate::Error,
3529        > {
3530            use std::clone::Clone;
3531            let token = self.0.request.page_token.clone();
3532            let execute = move |token: String| {
3533                let mut builder = self.clone();
3534                builder.0.request = builder.0.request.set_page_token(token);
3535                builder.send()
3536            };
3537            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3538        }
3539
3540        /// Streams each item in the collection.
3541        pub fn by_item(
3542            self,
3543        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3544            crate::model::ListConversationsResponse,
3545            crate::Error,
3546        > {
3547            use google_cloud_gax::paginator::Paginator;
3548            self.by_page().items()
3549        }
3550
3551        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3552        ///
3553        /// This is a **required** field for requests.
3554        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3555            self.0.request.parent = v.into();
3556            self
3557        }
3558
3559        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3560        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3561            self.0.request.page_size = v.into();
3562            self
3563        }
3564
3565        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3566        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3567            self.0.request.page_token = v.into();
3568            self
3569        }
3570
3571        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3572        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3573            self.0.request.filter = v.into();
3574            self
3575        }
3576
3577        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3578        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579            self.0.request.order_by = v.into();
3580            self
3581        }
3582    }
3583
3584    #[doc(hidden)]
3585    impl crate::RequestBuilder for ListConversations {
3586        fn request_options(&mut self) -> &mut crate::RequestOptions {
3587            &mut self.0.options
3588        }
3589    }
3590
3591    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3592    ///
3593    /// # Example
3594    /// ```
3595    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::AnswerQuery;
3596    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3597    ///
3598    /// let builder = prepare_request_builder();
3599    /// let response = builder.send().await?;
3600    /// # Ok(()) }
3601    ///
3602    /// fn prepare_request_builder() -> AnswerQuery {
3603    ///   # panic!();
3604    ///   // ... details omitted ...
3605    /// }
3606    /// ```
3607    #[derive(Clone, Debug)]
3608    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3609
3610    impl AnswerQuery {
3611        pub(crate) fn new(
3612            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3613        ) -> Self {
3614            Self(RequestBuilder::new(stub))
3615        }
3616
3617        /// Sets the full request, replacing any prior values.
3618        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3619            self.0.request = v.into();
3620            self
3621        }
3622
3623        /// Sets all the options, replacing any prior values.
3624        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3625            self.0.options = v.into();
3626            self
3627        }
3628
3629        /// Sends the request.
3630        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3631            (*self.0.stub)
3632                .answer_query(self.0.request, self.0.options)
3633                .await
3634                .map(crate::Response::into_body)
3635        }
3636
3637        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3638        ///
3639        /// This is a **required** field for requests.
3640        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3641            self.0.request.serving_config = v.into();
3642            self
3643        }
3644
3645        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3646        ///
3647        /// This is a **required** field for requests.
3648        pub fn set_query<T>(mut self, v: T) -> Self
3649        where
3650            T: std::convert::Into<crate::model::Query>,
3651        {
3652            self.0.request.query = std::option::Option::Some(v.into());
3653            self
3654        }
3655
3656        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3657        ///
3658        /// This is a **required** field for requests.
3659        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3660        where
3661            T: std::convert::Into<crate::model::Query>,
3662        {
3663            self.0.request.query = v.map(|x| x.into());
3664            self
3665        }
3666
3667        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3668        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3669            self.0.request.session = v.into();
3670            self
3671        }
3672
3673        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3674        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3675        where
3676            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3677        {
3678            self.0.request.safety_spec = std::option::Option::Some(v.into());
3679            self
3680        }
3681
3682        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3683        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3684        where
3685            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3686        {
3687            self.0.request.safety_spec = v.map(|x| x.into());
3688            self
3689        }
3690
3691        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3692        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3693        where
3694            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3695        {
3696            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3697            self
3698        }
3699
3700        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3701        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3702        where
3703            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3704        {
3705            self.0.request.related_questions_spec = v.map(|x| x.into());
3706            self
3707        }
3708
3709        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3710        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3711        where
3712            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3713        {
3714            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3715            self
3716        }
3717
3718        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3719        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3720        where
3721            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3722        {
3723            self.0.request.grounding_spec = v.map(|x| x.into());
3724            self
3725        }
3726
3727        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3728        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3729        where
3730            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3731        {
3732            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3733            self
3734        }
3735
3736        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3737        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3738        where
3739            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3740        {
3741            self.0.request.answer_generation_spec = v.map(|x| x.into());
3742            self
3743        }
3744
3745        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3746        pub fn set_search_spec<T>(mut self, v: T) -> Self
3747        where
3748            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3749        {
3750            self.0.request.search_spec = std::option::Option::Some(v.into());
3751            self
3752        }
3753
3754        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3755        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3756        where
3757            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3758        {
3759            self.0.request.search_spec = v.map(|x| x.into());
3760            self
3761        }
3762
3763        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3764        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3765        where
3766            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3767        {
3768            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3769            self
3770        }
3771
3772        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3773        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3774        where
3775            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3776        {
3777            self.0.request.query_understanding_spec = v.map(|x| x.into());
3778            self
3779        }
3780
3781        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3782        #[deprecated]
3783        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3784            self.0.request.asynchronous_mode = v.into();
3785            self
3786        }
3787
3788        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3789        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3790            self.0.request.user_pseudo_id = v.into();
3791            self
3792        }
3793
3794        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3795        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3796        where
3797            T: std::iter::IntoIterator<Item = (K, V)>,
3798            K: std::convert::Into<std::string::String>,
3799            V: std::convert::Into<std::string::String>,
3800        {
3801            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3802            self
3803        }
3804
3805        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3806        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3807        where
3808            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3809        {
3810            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3811            self
3812        }
3813
3814        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3815        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3816        where
3817            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3818        {
3819            self.0.request.end_user_spec = v.map(|x| x.into());
3820            self
3821        }
3822    }
3823
3824    #[doc(hidden)]
3825    impl crate::RequestBuilder for AnswerQuery {
3826        fn request_options(&mut self) -> &mut crate::RequestOptions {
3827            &mut self.0.options
3828        }
3829    }
3830
3831    /// The request builder for [ConversationalSearchService::stream_answer_query][crate::client::ConversationalSearchService::stream_answer_query] calls.
3832    ///
3833    /// # Example
3834    /// ```
3835    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::StreamAnswerQuery;
3836    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3837    /// let builder = prepare_request_builder();
3838    /// let mut resp_stream = builder.send().await?;
3839    /// while let Some(response) = resp_stream.next().await {
3840    ///     let response = response?;
3841    ///     println!("response {:?}", response);
3842    /// }
3843    /// # Ok(()) }
3844    ///
3845    /// fn prepare_request_builder() -> StreamAnswerQuery {
3846    ///   # panic!();
3847    ///   // ... details omitted ...
3848    /// }
3849    /// ```
3850    #[derive(Clone, Debug)]
3851    pub struct StreamAnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3852
3853    impl StreamAnswerQuery {
3854        pub(crate) fn new(
3855            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3856        ) -> Self {
3857            Self(RequestBuilder::new(stub))
3858        }
3859
3860        /// Sets the full request, replacing any prior values.
3861        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3862            self.0.request = v.into();
3863            self
3864        }
3865
3866        /// Sets all the options, replacing any prior values.
3867        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3868            self.0.options = v.into();
3869            self
3870        }
3871
3872        /// Initiates the server stream.
3873        pub async fn send(
3874            self,
3875        ) -> Result<google_cloud_gax::streaming::ResponseStream<crate::model::AnswerQueryResponse>>
3876        {
3877            (*self.0.stub)
3878                .stream_answer_query(self.0.request, self.0.options)
3879                .await
3880        }
3881
3882        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3883        ///
3884        /// This is a **required** field for requests.
3885        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3886            self.0.request.serving_config = v.into();
3887            self
3888        }
3889
3890        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3891        ///
3892        /// This is a **required** field for requests.
3893        pub fn set_query<T>(mut self, v: T) -> Self
3894        where
3895            T: std::convert::Into<crate::model::Query>,
3896        {
3897            self.0.request.query = std::option::Option::Some(v.into());
3898            self
3899        }
3900
3901        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3902        ///
3903        /// This is a **required** field for requests.
3904        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3905        where
3906            T: std::convert::Into<crate::model::Query>,
3907        {
3908            self.0.request.query = v.map(|x| x.into());
3909            self
3910        }
3911
3912        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3913        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3914            self.0.request.session = v.into();
3915            self
3916        }
3917
3918        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3919        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3920        where
3921            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3922        {
3923            self.0.request.safety_spec = std::option::Option::Some(v.into());
3924            self
3925        }
3926
3927        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3928        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3929        where
3930            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3931        {
3932            self.0.request.safety_spec = v.map(|x| x.into());
3933            self
3934        }
3935
3936        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3937        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3938        where
3939            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3940        {
3941            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3942            self
3943        }
3944
3945        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3946        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3947        where
3948            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3949        {
3950            self.0.request.related_questions_spec = v.map(|x| x.into());
3951            self
3952        }
3953
3954        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3955        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3956        where
3957            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3958        {
3959            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3960            self
3961        }
3962
3963        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3964        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3965        where
3966            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3967        {
3968            self.0.request.grounding_spec = v.map(|x| x.into());
3969            self
3970        }
3971
3972        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3973        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3974        where
3975            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3976        {
3977            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3978            self
3979        }
3980
3981        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3982        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3983        where
3984            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3985        {
3986            self.0.request.answer_generation_spec = v.map(|x| x.into());
3987            self
3988        }
3989
3990        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3991        pub fn set_search_spec<T>(mut self, v: T) -> Self
3992        where
3993            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3994        {
3995            self.0.request.search_spec = std::option::Option::Some(v.into());
3996            self
3997        }
3998
3999        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
4000        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
4001        where
4002            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
4003        {
4004            self.0.request.search_spec = v.map(|x| x.into());
4005            self
4006        }
4007
4008        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
4009        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
4010        where
4011            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
4012        {
4013            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
4014            self
4015        }
4016
4017        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
4018        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
4019        where
4020            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
4021        {
4022            self.0.request.query_understanding_spec = v.map(|x| x.into());
4023            self
4024        }
4025
4026        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
4027        #[deprecated]
4028        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
4029            self.0.request.asynchronous_mode = v.into();
4030            self
4031        }
4032
4033        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
4034        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4035            self.0.request.user_pseudo_id = v.into();
4036            self
4037        }
4038
4039        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
4040        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
4041        where
4042            T: std::iter::IntoIterator<Item = (K, V)>,
4043            K: std::convert::Into<std::string::String>,
4044            V: std::convert::Into<std::string::String>,
4045        {
4046            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4047            self
4048        }
4049
4050        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
4051        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
4052        where
4053            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
4054        {
4055            self.0.request.end_user_spec = std::option::Option::Some(v.into());
4056            self
4057        }
4058
4059        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
4060        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
4061        where
4062            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
4063        {
4064            self.0.request.end_user_spec = v.map(|x| x.into());
4065            self
4066        }
4067    }
4068
4069    #[doc(hidden)]
4070    impl crate::RequestBuilder for StreamAnswerQuery {
4071        fn request_options(&mut self) -> &mut crate::RequestOptions {
4072            &mut self.0.options
4073        }
4074    }
4075
4076    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
4077    ///
4078    /// # Example
4079    /// ```
4080    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetAnswer;
4081    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4082    ///
4083    /// let builder = prepare_request_builder();
4084    /// let response = builder.send().await?;
4085    /// # Ok(()) }
4086    ///
4087    /// fn prepare_request_builder() -> GetAnswer {
4088    ///   # panic!();
4089    ///   // ... details omitted ...
4090    /// }
4091    /// ```
4092    #[derive(Clone, Debug)]
4093    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
4094
4095    impl GetAnswer {
4096        pub(crate) fn new(
4097            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4098        ) -> Self {
4099            Self(RequestBuilder::new(stub))
4100        }
4101
4102        /// Sets the full request, replacing any prior values.
4103        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
4104            self.0.request = v.into();
4105            self
4106        }
4107
4108        /// Sets all the options, replacing any prior values.
4109        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4110            self.0.options = v.into();
4111            self
4112        }
4113
4114        /// Sends the request.
4115        pub async fn send(self) -> Result<crate::model::Answer> {
4116            (*self.0.stub)
4117                .get_answer(self.0.request, self.0.options)
4118                .await
4119                .map(crate::Response::into_body)
4120        }
4121
4122        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
4123        ///
4124        /// This is a **required** field for requests.
4125        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4126            self.0.request.name = v.into();
4127            self
4128        }
4129    }
4130
4131    #[doc(hidden)]
4132    impl crate::RequestBuilder for GetAnswer {
4133        fn request_options(&mut self) -> &mut crate::RequestOptions {
4134            &mut self.0.options
4135        }
4136    }
4137
4138    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
4139    ///
4140    /// # Example
4141    /// ```
4142    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateSession;
4143    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4144    ///
4145    /// let builder = prepare_request_builder();
4146    /// let response = builder.send().await?;
4147    /// # Ok(()) }
4148    ///
4149    /// fn prepare_request_builder() -> CreateSession {
4150    ///   # panic!();
4151    ///   // ... details omitted ...
4152    /// }
4153    /// ```
4154    #[derive(Clone, Debug)]
4155    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
4156
4157    impl CreateSession {
4158        pub(crate) fn new(
4159            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4160        ) -> Self {
4161            Self(RequestBuilder::new(stub))
4162        }
4163
4164        /// Sets the full request, replacing any prior values.
4165        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
4166            self.0.request = v.into();
4167            self
4168        }
4169
4170        /// Sets all the options, replacing any prior values.
4171        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4172            self.0.options = v.into();
4173            self
4174        }
4175
4176        /// Sends the request.
4177        pub async fn send(self) -> Result<crate::model::Session> {
4178            (*self.0.stub)
4179                .create_session(self.0.request, self.0.options)
4180                .await
4181                .map(crate::Response::into_body)
4182        }
4183
4184        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
4185        ///
4186        /// This is a **required** field for requests.
4187        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4188            self.0.request.parent = v.into();
4189            self
4190        }
4191
4192        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
4193        ///
4194        /// This is a **required** field for requests.
4195        pub fn set_session<T>(mut self, v: T) -> Self
4196        where
4197            T: std::convert::Into<crate::model::Session>,
4198        {
4199            self.0.request.session = std::option::Option::Some(v.into());
4200            self
4201        }
4202
4203        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
4204        ///
4205        /// This is a **required** field for requests.
4206        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
4207        where
4208            T: std::convert::Into<crate::model::Session>,
4209        {
4210            self.0.request.session = v.map(|x| x.into());
4211            self
4212        }
4213    }
4214
4215    #[doc(hidden)]
4216    impl crate::RequestBuilder for CreateSession {
4217        fn request_options(&mut self) -> &mut crate::RequestOptions {
4218            &mut self.0.options
4219        }
4220    }
4221
4222    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
4223    ///
4224    /// # Example
4225    /// ```
4226    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteSession;
4227    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4228    ///
4229    /// let builder = prepare_request_builder();
4230    /// let response = builder.send().await?;
4231    /// # Ok(()) }
4232    ///
4233    /// fn prepare_request_builder() -> DeleteSession {
4234    ///   # panic!();
4235    ///   // ... details omitted ...
4236    /// }
4237    /// ```
4238    #[derive(Clone, Debug)]
4239    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
4240
4241    impl DeleteSession {
4242        pub(crate) fn new(
4243            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4244        ) -> Self {
4245            Self(RequestBuilder::new(stub))
4246        }
4247
4248        /// Sets the full request, replacing any prior values.
4249        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
4250            self.0.request = v.into();
4251            self
4252        }
4253
4254        /// Sets all the options, replacing any prior values.
4255        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4256            self.0.options = v.into();
4257            self
4258        }
4259
4260        /// Sends the request.
4261        pub async fn send(self) -> Result<()> {
4262            (*self.0.stub)
4263                .delete_session(self.0.request, self.0.options)
4264                .await
4265                .map(crate::Response::into_body)
4266        }
4267
4268        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
4269        ///
4270        /// This is a **required** field for requests.
4271        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4272            self.0.request.name = v.into();
4273            self
4274        }
4275    }
4276
4277    #[doc(hidden)]
4278    impl crate::RequestBuilder for DeleteSession {
4279        fn request_options(&mut self) -> &mut crate::RequestOptions {
4280            &mut self.0.options
4281        }
4282    }
4283
4284    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
4285    ///
4286    /// # Example
4287    /// ```
4288    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateSession;
4289    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4290    ///
4291    /// let builder = prepare_request_builder();
4292    /// let response = builder.send().await?;
4293    /// # Ok(()) }
4294    ///
4295    /// fn prepare_request_builder() -> UpdateSession {
4296    ///   # panic!();
4297    ///   // ... details omitted ...
4298    /// }
4299    /// ```
4300    #[derive(Clone, Debug)]
4301    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
4302
4303    impl UpdateSession {
4304        pub(crate) fn new(
4305            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4306        ) -> Self {
4307            Self(RequestBuilder::new(stub))
4308        }
4309
4310        /// Sets the full request, replacing any prior values.
4311        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
4312            self.0.request = v.into();
4313            self
4314        }
4315
4316        /// Sets all the options, replacing any prior values.
4317        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4318            self.0.options = v.into();
4319            self
4320        }
4321
4322        /// Sends the request.
4323        pub async fn send(self) -> Result<crate::model::Session> {
4324            (*self.0.stub)
4325                .update_session(self.0.request, self.0.options)
4326                .await
4327                .map(crate::Response::into_body)
4328        }
4329
4330        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
4331        ///
4332        /// This is a **required** field for requests.
4333        pub fn set_session<T>(mut self, v: T) -> Self
4334        where
4335            T: std::convert::Into<crate::model::Session>,
4336        {
4337            self.0.request.session = std::option::Option::Some(v.into());
4338            self
4339        }
4340
4341        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
4342        ///
4343        /// This is a **required** field for requests.
4344        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
4345        where
4346            T: std::convert::Into<crate::model::Session>,
4347        {
4348            self.0.request.session = v.map(|x| x.into());
4349            self
4350        }
4351
4352        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
4353        pub fn set_update_mask<T>(mut self, v: T) -> Self
4354        where
4355            T: std::convert::Into<wkt::FieldMask>,
4356        {
4357            self.0.request.update_mask = std::option::Option::Some(v.into());
4358            self
4359        }
4360
4361        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
4362        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4363        where
4364            T: std::convert::Into<wkt::FieldMask>,
4365        {
4366            self.0.request.update_mask = v.map(|x| x.into());
4367            self
4368        }
4369    }
4370
4371    #[doc(hidden)]
4372    impl crate::RequestBuilder for UpdateSession {
4373        fn request_options(&mut self) -> &mut crate::RequestOptions {
4374            &mut self.0.options
4375        }
4376    }
4377
4378    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
4379    ///
4380    /// # Example
4381    /// ```
4382    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetSession;
4383    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4384    ///
4385    /// let builder = prepare_request_builder();
4386    /// let response = builder.send().await?;
4387    /// # Ok(()) }
4388    ///
4389    /// fn prepare_request_builder() -> GetSession {
4390    ///   # panic!();
4391    ///   // ... details omitted ...
4392    /// }
4393    /// ```
4394    #[derive(Clone, Debug)]
4395    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
4396
4397    impl GetSession {
4398        pub(crate) fn new(
4399            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4400        ) -> Self {
4401            Self(RequestBuilder::new(stub))
4402        }
4403
4404        /// Sets the full request, replacing any prior values.
4405        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
4406            self.0.request = v.into();
4407            self
4408        }
4409
4410        /// Sets all the options, replacing any prior values.
4411        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4412            self.0.options = v.into();
4413            self
4414        }
4415
4416        /// Sends the request.
4417        pub async fn send(self) -> Result<crate::model::Session> {
4418            (*self.0.stub)
4419                .get_session(self.0.request, self.0.options)
4420                .await
4421                .map(crate::Response::into_body)
4422        }
4423
4424        /// Sets the value of [name][crate::model::GetSessionRequest::name].
4425        ///
4426        /// This is a **required** field for requests.
4427        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4428            self.0.request.name = v.into();
4429            self
4430        }
4431
4432        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
4433        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
4434            self.0.request.include_answer_details = v.into();
4435            self
4436        }
4437    }
4438
4439    #[doc(hidden)]
4440    impl crate::RequestBuilder for GetSession {
4441        fn request_options(&mut self) -> &mut crate::RequestOptions {
4442            &mut self.0.options
4443        }
4444    }
4445
4446    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
4447    ///
4448    /// # Example
4449    /// ```
4450    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListSessions;
4451    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4452    /// use google_cloud_gax::paginator::ItemPaginator;
4453    ///
4454    /// let builder = prepare_request_builder();
4455    /// let mut items = builder.by_item();
4456    /// while let Some(result) = items.next().await {
4457    ///   let item = result?;
4458    /// }
4459    /// # Ok(()) }
4460    ///
4461    /// fn prepare_request_builder() -> ListSessions {
4462    ///   # panic!();
4463    ///   // ... details omitted ...
4464    /// }
4465    /// ```
4466    #[derive(Clone, Debug)]
4467    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4468
4469    impl ListSessions {
4470        pub(crate) fn new(
4471            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4472        ) -> Self {
4473            Self(RequestBuilder::new(stub))
4474        }
4475
4476        /// Sets the full request, replacing any prior values.
4477        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4478            self.0.request = v.into();
4479            self
4480        }
4481
4482        /// Sets all the options, replacing any prior values.
4483        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4484            self.0.options = v.into();
4485            self
4486        }
4487
4488        /// Sends the request.
4489        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4490            (*self.0.stub)
4491                .list_sessions(self.0.request, self.0.options)
4492                .await
4493                .map(crate::Response::into_body)
4494        }
4495
4496        /// Streams each page in the collection.
4497        pub fn by_page(
4498            self,
4499        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4500        {
4501            use std::clone::Clone;
4502            let token = self.0.request.page_token.clone();
4503            let execute = move |token: String| {
4504                let mut builder = self.clone();
4505                builder.0.request = builder.0.request.set_page_token(token);
4506                builder.send()
4507            };
4508            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4509        }
4510
4511        /// Streams each item in the collection.
4512        pub fn by_item(
4513            self,
4514        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4515            crate::model::ListSessionsResponse,
4516            crate::Error,
4517        > {
4518            use google_cloud_gax::paginator::Paginator;
4519            self.by_page().items()
4520        }
4521
4522        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4523        ///
4524        /// This is a **required** field for requests.
4525        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4526            self.0.request.parent = v.into();
4527            self
4528        }
4529
4530        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4531        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4532            self.0.request.page_size = v.into();
4533            self
4534        }
4535
4536        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4537        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4538            self.0.request.page_token = v.into();
4539            self
4540        }
4541
4542        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4543        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4544            self.0.request.filter = v.into();
4545            self
4546        }
4547
4548        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4549        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4550            self.0.request.order_by = v.into();
4551            self
4552        }
4553    }
4554
4555    #[doc(hidden)]
4556    impl crate::RequestBuilder for ListSessions {
4557        fn request_options(&mut self) -> &mut crate::RequestOptions {
4558            &mut self.0.options
4559        }
4560    }
4561
4562    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4563    ///
4564    /// # Example
4565    /// ```
4566    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListOperations;
4567    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4568    /// use google_cloud_gax::paginator::ItemPaginator;
4569    ///
4570    /// let builder = prepare_request_builder();
4571    /// let mut items = builder.by_item();
4572    /// while let Some(result) = items.next().await {
4573    ///   let item = result?;
4574    /// }
4575    /// # Ok(()) }
4576    ///
4577    /// fn prepare_request_builder() -> ListOperations {
4578    ///   # panic!();
4579    ///   // ... details omitted ...
4580    /// }
4581    /// ```
4582    #[derive(Clone, Debug)]
4583    pub struct ListOperations(
4584        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4585    );
4586
4587    impl ListOperations {
4588        pub(crate) fn new(
4589            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4590        ) -> Self {
4591            Self(RequestBuilder::new(stub))
4592        }
4593
4594        /// Sets the full request, replacing any prior values.
4595        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4596            mut self,
4597            v: V,
4598        ) -> Self {
4599            self.0.request = v.into();
4600            self
4601        }
4602
4603        /// Sets all the options, replacing any prior values.
4604        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4605            self.0.options = v.into();
4606            self
4607        }
4608
4609        /// Sends the request.
4610        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4611            (*self.0.stub)
4612                .list_operations(self.0.request, self.0.options)
4613                .await
4614                .map(crate::Response::into_body)
4615        }
4616
4617        /// Streams each page in the collection.
4618        pub fn by_page(
4619            self,
4620        ) -> impl google_cloud_gax::paginator::Paginator<
4621            google_cloud_longrunning::model::ListOperationsResponse,
4622            crate::Error,
4623        > {
4624            use std::clone::Clone;
4625            let token = self.0.request.page_token.clone();
4626            let execute = move |token: String| {
4627                let mut builder = self.clone();
4628                builder.0.request = builder.0.request.set_page_token(token);
4629                builder.send()
4630            };
4631            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4632        }
4633
4634        /// Streams each item in the collection.
4635        pub fn by_item(
4636            self,
4637        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4638            google_cloud_longrunning::model::ListOperationsResponse,
4639            crate::Error,
4640        > {
4641            use google_cloud_gax::paginator::Paginator;
4642            self.by_page().items()
4643        }
4644
4645        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
4646        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4647            self.0.request.name = v.into();
4648            self
4649        }
4650
4651        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
4652        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4653            self.0.request.filter = v.into();
4654            self
4655        }
4656
4657        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
4658        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4659            self.0.request.page_size = v.into();
4660            self
4661        }
4662
4663        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
4664        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4665            self.0.request.page_token = v.into();
4666            self
4667        }
4668
4669        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
4670        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4671            self.0.request.return_partial_success = v.into();
4672            self
4673        }
4674    }
4675
4676    #[doc(hidden)]
4677    impl crate::RequestBuilder for ListOperations {
4678        fn request_options(&mut self) -> &mut crate::RequestOptions {
4679            &mut self.0.options
4680        }
4681    }
4682
4683    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4684    ///
4685    /// # Example
4686    /// ```
4687    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetOperation;
4688    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4689    ///
4690    /// let builder = prepare_request_builder();
4691    /// let response = builder.send().await?;
4692    /// # Ok(()) }
4693    ///
4694    /// fn prepare_request_builder() -> GetOperation {
4695    ///   # panic!();
4696    ///   // ... details omitted ...
4697    /// }
4698    /// ```
4699    #[derive(Clone, Debug)]
4700    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4701
4702    impl GetOperation {
4703        pub(crate) fn new(
4704            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4705        ) -> Self {
4706            Self(RequestBuilder::new(stub))
4707        }
4708
4709        /// Sets the full request, replacing any prior values.
4710        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4711            mut self,
4712            v: V,
4713        ) -> Self {
4714            self.0.request = v.into();
4715            self
4716        }
4717
4718        /// Sets all the options, replacing any prior values.
4719        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4720            self.0.options = v.into();
4721            self
4722        }
4723
4724        /// Sends the request.
4725        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4726            (*self.0.stub)
4727                .get_operation(self.0.request, self.0.options)
4728                .await
4729                .map(crate::Response::into_body)
4730        }
4731
4732        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4733        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4734            self.0.request.name = v.into();
4735            self
4736        }
4737    }
4738
4739    #[doc(hidden)]
4740    impl crate::RequestBuilder for GetOperation {
4741        fn request_options(&mut self) -> &mut crate::RequestOptions {
4742            &mut self.0.options
4743        }
4744    }
4745
4746    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4747    ///
4748    /// # Example
4749    /// ```
4750    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CancelOperation;
4751    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4752    ///
4753    /// let builder = prepare_request_builder();
4754    /// let response = builder.send().await?;
4755    /// # Ok(()) }
4756    ///
4757    /// fn prepare_request_builder() -> CancelOperation {
4758    ///   # panic!();
4759    ///   // ... details omitted ...
4760    /// }
4761    /// ```
4762    #[derive(Clone, Debug)]
4763    pub struct CancelOperation(
4764        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4765    );
4766
4767    impl CancelOperation {
4768        pub(crate) fn new(
4769            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4770        ) -> Self {
4771            Self(RequestBuilder::new(stub))
4772        }
4773
4774        /// Sets the full request, replacing any prior values.
4775        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4776            mut self,
4777            v: V,
4778        ) -> Self {
4779            self.0.request = v.into();
4780            self
4781        }
4782
4783        /// Sets all the options, replacing any prior values.
4784        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4785            self.0.options = v.into();
4786            self
4787        }
4788
4789        /// Sends the request.
4790        pub async fn send(self) -> Result<()> {
4791            (*self.0.stub)
4792                .cancel_operation(self.0.request, self.0.options)
4793                .await
4794                .map(crate::Response::into_body)
4795        }
4796
4797        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
4798        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4799            self.0.request.name = v.into();
4800            self
4801        }
4802    }
4803
4804    #[doc(hidden)]
4805    impl crate::RequestBuilder for CancelOperation {
4806        fn request_options(&mut self) -> &mut crate::RequestOptions {
4807            &mut self.0.options
4808        }
4809    }
4810}
4811
4812/// Request and client builders for [DataStoreService][crate::client::DataStoreService].
4813#[cfg(feature = "data-store-service")]
4814#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4815pub mod data_store_service {
4816    use crate::Result;
4817
4818    /// A builder for [DataStoreService][crate::client::DataStoreService].
4819    ///
4820    /// ```
4821    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4822    /// # use google_cloud_discoveryengine_v1::*;
4823    /// # use builder::data_store_service::ClientBuilder;
4824    /// # use client::DataStoreService;
4825    /// let builder : ClientBuilder = DataStoreService::builder();
4826    /// let client = builder
4827    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4828    ///     .build().await?;
4829    /// # Ok(()) }
4830    /// ```
4831    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4832
4833    pub(crate) mod client {
4834        use super::super::super::client::DataStoreService;
4835        pub struct Factory;
4836        impl crate::ClientFactory for Factory {
4837            type Client = DataStoreService;
4838            type Credentials = gaxi::options::Credentials;
4839            async fn build(
4840                self,
4841                config: gaxi::options::ClientConfig,
4842            ) -> crate::ClientBuilderResult<Self::Client> {
4843                Self::Client::new(config).await
4844            }
4845        }
4846    }
4847
4848    /// Common implementation for [crate::client::DataStoreService] request builders.
4849    #[derive(Clone, Debug)]
4850    pub(crate) struct RequestBuilder<R: std::default::Default> {
4851        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4852        request: R,
4853        options: crate::RequestOptions,
4854    }
4855
4856    impl<R> RequestBuilder<R>
4857    where
4858        R: std::default::Default,
4859    {
4860        pub(crate) fn new(
4861            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4862        ) -> Self {
4863            Self {
4864                stub,
4865                request: R::default(),
4866                options: crate::RequestOptions::default(),
4867            }
4868        }
4869    }
4870
4871    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4872    ///
4873    /// # Example
4874    /// ```
4875    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CreateDataStore;
4876    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4877    /// use google_cloud_lro::Poller;
4878    ///
4879    /// let builder = prepare_request_builder();
4880    /// let response = builder.poller().until_done().await?;
4881    /// # Ok(()) }
4882    ///
4883    /// fn prepare_request_builder() -> CreateDataStore {
4884    ///   # panic!();
4885    ///   // ... details omitted ...
4886    /// }
4887    /// ```
4888    #[derive(Clone, Debug)]
4889    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4890
4891    impl CreateDataStore {
4892        pub(crate) fn new(
4893            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4894        ) -> Self {
4895            Self(RequestBuilder::new(stub))
4896        }
4897
4898        /// Sets the full request, replacing any prior values.
4899        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4900            self.0.request = v.into();
4901            self
4902        }
4903
4904        /// Sets all the options, replacing any prior values.
4905        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4906            self.0.options = v.into();
4907            self
4908        }
4909
4910        /// Sends the request.
4911        ///
4912        /// # Long running operations
4913        ///
4914        /// This starts, but does not poll, a longrunning operation. More information
4915        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4916        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4917            (*self.0.stub)
4918                .create_data_store(self.0.request, self.0.options)
4919                .await
4920                .map(crate::Response::into_body)
4921        }
4922
4923        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_data_store`.
4924        pub fn poller(
4925            self,
4926        ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4927        {
4928            type Operation = google_cloud_lro::internal::Operation<
4929                crate::model::DataStore,
4930                crate::model::CreateDataStoreMetadata,
4931            >;
4932            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4933            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4934            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4935            if let Some(ref mut details) = poller_options.tracing {
4936                details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::create_data_store::until_done";
4937            }
4938
4939            let stub = self.0.stub.clone();
4940            let mut options = self.0.options.clone();
4941            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4942            let query = move |name| {
4943                let stub = stub.clone();
4944                let options = options.clone();
4945                async {
4946                    let op = GetOperation::new(stub)
4947                        .set_name(name)
4948                        .with_options(options)
4949                        .send()
4950                        .await?;
4951                    Ok(Operation::new(op))
4952                }
4953            };
4954
4955            let start = move || async {
4956                let op = self.send().await?;
4957                Ok(Operation::new(op))
4958            };
4959
4960            use google_cloud_lro::internal::PollerExt;
4961            {
4962                google_cloud_lro::internal::new_poller(
4963                    polling_error_policy,
4964                    polling_backoff_policy,
4965                    start,
4966                    query,
4967                )
4968            }
4969            .with_options(poller_options)
4970        }
4971
4972        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4973        ///
4974        /// This is a **required** field for requests.
4975        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4976            self.0.request.parent = v.into();
4977            self
4978        }
4979
4980        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4981        ///
4982        /// This is a **required** field for requests.
4983        pub fn set_data_store<T>(mut self, v: T) -> Self
4984        where
4985            T: std::convert::Into<crate::model::DataStore>,
4986        {
4987            self.0.request.data_store = std::option::Option::Some(v.into());
4988            self
4989        }
4990
4991        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4992        ///
4993        /// This is a **required** field for requests.
4994        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4995        where
4996            T: std::convert::Into<crate::model::DataStore>,
4997        {
4998            self.0.request.data_store = v.map(|x| x.into());
4999            self
5000        }
5001
5002        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
5003        ///
5004        /// This is a **required** field for requests.
5005        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5006            self.0.request.data_store_id = v.into();
5007            self
5008        }
5009
5010        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
5011        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
5012            self.0.request.create_advanced_site_search = v.into();
5013            self
5014        }
5015
5016        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
5017        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
5018            self.0.request.skip_default_schema_creation = v.into();
5019            self
5020        }
5021
5022        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
5023        ///
5024        /// Note that all the setters affecting `cmek_options` are
5025        /// mutually exclusive.
5026        pub fn set_cmek_options<
5027            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
5028        >(
5029            mut self,
5030            v: T,
5031        ) -> Self {
5032            self.0.request.cmek_options = v.into();
5033            self
5034        }
5035
5036        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
5037        /// to hold a `CmekConfigName`.
5038        ///
5039        /// Note that all the setters affecting `cmek_options` are
5040        /// mutually exclusive.
5041        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
5042            mut self,
5043            v: T,
5044        ) -> Self {
5045            self.0.request = self.0.request.set_cmek_config_name(v);
5046            self
5047        }
5048
5049        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
5050        /// to hold a `DisableCmek`.
5051        ///
5052        /// Note that all the setters affecting `cmek_options` are
5053        /// mutually exclusive.
5054        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5055            self.0.request = self.0.request.set_disable_cmek(v);
5056            self
5057        }
5058    }
5059
5060    #[doc(hidden)]
5061    impl crate::RequestBuilder for CreateDataStore {
5062        fn request_options(&mut self) -> &mut crate::RequestOptions {
5063            &mut self.0.options
5064        }
5065    }
5066
5067    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
5068    ///
5069    /// # Example
5070    /// ```
5071    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetDataStore;
5072    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5073    ///
5074    /// let builder = prepare_request_builder();
5075    /// let response = builder.send().await?;
5076    /// # Ok(()) }
5077    ///
5078    /// fn prepare_request_builder() -> GetDataStore {
5079    ///   # panic!();
5080    ///   // ... details omitted ...
5081    /// }
5082    /// ```
5083    #[derive(Clone, Debug)]
5084    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
5085
5086    impl GetDataStore {
5087        pub(crate) fn new(
5088            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5089        ) -> Self {
5090            Self(RequestBuilder::new(stub))
5091        }
5092
5093        /// Sets the full request, replacing any prior values.
5094        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
5095            self.0.request = v.into();
5096            self
5097        }
5098
5099        /// Sets all the options, replacing any prior values.
5100        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5101            self.0.options = v.into();
5102            self
5103        }
5104
5105        /// Sends the request.
5106        pub async fn send(self) -> Result<crate::model::DataStore> {
5107            (*self.0.stub)
5108                .get_data_store(self.0.request, self.0.options)
5109                .await
5110                .map(crate::Response::into_body)
5111        }
5112
5113        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
5114        ///
5115        /// This is a **required** field for requests.
5116        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5117            self.0.request.name = v.into();
5118            self
5119        }
5120    }
5121
5122    #[doc(hidden)]
5123    impl crate::RequestBuilder for GetDataStore {
5124        fn request_options(&mut self) -> &mut crate::RequestOptions {
5125            &mut self.0.options
5126        }
5127    }
5128
5129    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
5130    ///
5131    /// # Example
5132    /// ```
5133    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListDataStores;
5134    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5135    /// use google_cloud_gax::paginator::ItemPaginator;
5136    ///
5137    /// let builder = prepare_request_builder();
5138    /// let mut items = builder.by_item();
5139    /// while let Some(result) = items.next().await {
5140    ///   let item = result?;
5141    /// }
5142    /// # Ok(()) }
5143    ///
5144    /// fn prepare_request_builder() -> ListDataStores {
5145    ///   # panic!();
5146    ///   // ... details omitted ...
5147    /// }
5148    /// ```
5149    #[derive(Clone, Debug)]
5150    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
5151
5152    impl ListDataStores {
5153        pub(crate) fn new(
5154            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5155        ) -> Self {
5156            Self(RequestBuilder::new(stub))
5157        }
5158
5159        /// Sets the full request, replacing any prior values.
5160        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
5161            self.0.request = v.into();
5162            self
5163        }
5164
5165        /// Sets all the options, replacing any prior values.
5166        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5167            self.0.options = v.into();
5168            self
5169        }
5170
5171        /// Sends the request.
5172        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
5173            (*self.0.stub)
5174                .list_data_stores(self.0.request, self.0.options)
5175                .await
5176                .map(crate::Response::into_body)
5177        }
5178
5179        /// Streams each page in the collection.
5180        pub fn by_page(
5181            self,
5182        ) -> impl google_cloud_gax::paginator::Paginator<
5183            crate::model::ListDataStoresResponse,
5184            crate::Error,
5185        > {
5186            use std::clone::Clone;
5187            let token = self.0.request.page_token.clone();
5188            let execute = move |token: String| {
5189                let mut builder = self.clone();
5190                builder.0.request = builder.0.request.set_page_token(token);
5191                builder.send()
5192            };
5193            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5194        }
5195
5196        /// Streams each item in the collection.
5197        pub fn by_item(
5198            self,
5199        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5200            crate::model::ListDataStoresResponse,
5201            crate::Error,
5202        > {
5203            use google_cloud_gax::paginator::Paginator;
5204            self.by_page().items()
5205        }
5206
5207        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
5208        ///
5209        /// This is a **required** field for requests.
5210        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5211            self.0.request.parent = v.into();
5212            self
5213        }
5214
5215        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
5216        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5217            self.0.request.page_size = v.into();
5218            self
5219        }
5220
5221        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
5222        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5223            self.0.request.page_token = v.into();
5224            self
5225        }
5226
5227        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
5228        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5229            self.0.request.filter = v.into();
5230            self
5231        }
5232    }
5233
5234    #[doc(hidden)]
5235    impl crate::RequestBuilder for ListDataStores {
5236        fn request_options(&mut self) -> &mut crate::RequestOptions {
5237            &mut self.0.options
5238        }
5239    }
5240
5241    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
5242    ///
5243    /// # Example
5244    /// ```
5245    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::DeleteDataStore;
5246    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5247    /// use google_cloud_lro::Poller;
5248    ///
5249    /// let builder = prepare_request_builder();
5250    /// let response = builder.poller().until_done().await?;
5251    /// # Ok(()) }
5252    ///
5253    /// fn prepare_request_builder() -> DeleteDataStore {
5254    ///   # panic!();
5255    ///   // ... details omitted ...
5256    /// }
5257    /// ```
5258    #[derive(Clone, Debug)]
5259    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
5260
5261    impl DeleteDataStore {
5262        pub(crate) fn new(
5263            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5264        ) -> Self {
5265            Self(RequestBuilder::new(stub))
5266        }
5267
5268        /// Sets the full request, replacing any prior values.
5269        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
5270            self.0.request = v.into();
5271            self
5272        }
5273
5274        /// Sets all the options, replacing any prior values.
5275        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5276            self.0.options = v.into();
5277            self
5278        }
5279
5280        /// Sends the request.
5281        ///
5282        /// # Long running operations
5283        ///
5284        /// This starts, but does not poll, a longrunning operation. More information
5285        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
5286        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5287            (*self.0.stub)
5288                .delete_data_store(self.0.request, self.0.options)
5289                .await
5290                .map(crate::Response::into_body)
5291        }
5292
5293        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_data_store`.
5294        pub fn poller(
5295            self,
5296        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
5297            type Operation = google_cloud_lro::internal::Operation<
5298                wkt::Empty,
5299                crate::model::DeleteDataStoreMetadata,
5300            >;
5301            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5302            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5303            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5304            if let Some(ref mut details) = poller_options.tracing {
5305                details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::delete_data_store::until_done";
5306            }
5307
5308            let stub = self.0.stub.clone();
5309            let mut options = self.0.options.clone();
5310            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5311            let query = move |name| {
5312                let stub = stub.clone();
5313                let options = options.clone();
5314                async {
5315                    let op = GetOperation::new(stub)
5316                        .set_name(name)
5317                        .with_options(options)
5318                        .send()
5319                        .await?;
5320                    Ok(Operation::new(op))
5321                }
5322            };
5323
5324            let start = move || async {
5325                let op = self.send().await?;
5326                Ok(Operation::new(op))
5327            };
5328
5329            use google_cloud_lro::internal::PollerExt;
5330            {
5331                google_cloud_lro::internal::new_unit_response_poller(
5332                    polling_error_policy,
5333                    polling_backoff_policy,
5334                    start,
5335                    query,
5336                )
5337            }
5338            .with_options(poller_options)
5339        }
5340
5341        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
5342        ///
5343        /// This is a **required** field for requests.
5344        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5345            self.0.request.name = v.into();
5346            self
5347        }
5348    }
5349
5350    #[doc(hidden)]
5351    impl crate::RequestBuilder for DeleteDataStore {
5352        fn request_options(&mut self) -> &mut crate::RequestOptions {
5353            &mut self.0.options
5354        }
5355    }
5356
5357    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
5358    ///
5359    /// # Example
5360    /// ```
5361    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::UpdateDataStore;
5362    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5363    ///
5364    /// let builder = prepare_request_builder();
5365    /// let response = builder.send().await?;
5366    /// # Ok(()) }
5367    ///
5368    /// fn prepare_request_builder() -> UpdateDataStore {
5369    ///   # panic!();
5370    ///   // ... details omitted ...
5371    /// }
5372    /// ```
5373    #[derive(Clone, Debug)]
5374    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
5375
5376    impl UpdateDataStore {
5377        pub(crate) fn new(
5378            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5379        ) -> Self {
5380            Self(RequestBuilder::new(stub))
5381        }
5382
5383        /// Sets the full request, replacing any prior values.
5384        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
5385            self.0.request = v.into();
5386            self
5387        }
5388
5389        /// Sets all the options, replacing any prior values.
5390        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5391            self.0.options = v.into();
5392            self
5393        }
5394
5395        /// Sends the request.
5396        pub async fn send(self) -> Result<crate::model::DataStore> {
5397            (*self.0.stub)
5398                .update_data_store(self.0.request, self.0.options)
5399                .await
5400                .map(crate::Response::into_body)
5401        }
5402
5403        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
5404        ///
5405        /// This is a **required** field for requests.
5406        pub fn set_data_store<T>(mut self, v: T) -> Self
5407        where
5408            T: std::convert::Into<crate::model::DataStore>,
5409        {
5410            self.0.request.data_store = std::option::Option::Some(v.into());
5411            self
5412        }
5413
5414        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
5415        ///
5416        /// This is a **required** field for requests.
5417        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
5418        where
5419            T: std::convert::Into<crate::model::DataStore>,
5420        {
5421            self.0.request.data_store = v.map(|x| x.into());
5422            self
5423        }
5424
5425        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
5426        pub fn set_update_mask<T>(mut self, v: T) -> Self
5427        where
5428            T: std::convert::Into<wkt::FieldMask>,
5429        {
5430            self.0.request.update_mask = std::option::Option::Some(v.into());
5431            self
5432        }
5433
5434        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
5435        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5436        where
5437            T: std::convert::Into<wkt::FieldMask>,
5438        {
5439            self.0.request.update_mask = v.map(|x| x.into());
5440            self
5441        }
5442    }
5443
5444    #[doc(hidden)]
5445    impl crate::RequestBuilder for UpdateDataStore {
5446        fn request_options(&mut self) -> &mut crate::RequestOptions {
5447            &mut self.0.options
5448        }
5449    }
5450
5451    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
5452    ///
5453    /// # Example
5454    /// ```
5455    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListOperations;
5456    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5457    /// use google_cloud_gax::paginator::ItemPaginator;
5458    ///
5459    /// let builder = prepare_request_builder();
5460    /// let mut items = builder.by_item();
5461    /// while let Some(result) = items.next().await {
5462    ///   let item = result?;
5463    /// }
5464    /// # Ok(()) }
5465    ///
5466    /// fn prepare_request_builder() -> ListOperations {
5467    ///   # panic!();
5468    ///   // ... details omitted ...
5469    /// }
5470    /// ```
5471    #[derive(Clone, Debug)]
5472    pub struct ListOperations(
5473        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5474    );
5475
5476    impl ListOperations {
5477        pub(crate) fn new(
5478            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5479        ) -> Self {
5480            Self(RequestBuilder::new(stub))
5481        }
5482
5483        /// Sets the full request, replacing any prior values.
5484        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5485            mut self,
5486            v: V,
5487        ) -> Self {
5488            self.0.request = v.into();
5489            self
5490        }
5491
5492        /// Sets all the options, replacing any prior values.
5493        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5494            self.0.options = v.into();
5495            self
5496        }
5497
5498        /// Sends the request.
5499        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5500            (*self.0.stub)
5501                .list_operations(self.0.request, self.0.options)
5502                .await
5503                .map(crate::Response::into_body)
5504        }
5505
5506        /// Streams each page in the collection.
5507        pub fn by_page(
5508            self,
5509        ) -> impl google_cloud_gax::paginator::Paginator<
5510            google_cloud_longrunning::model::ListOperationsResponse,
5511            crate::Error,
5512        > {
5513            use std::clone::Clone;
5514            let token = self.0.request.page_token.clone();
5515            let execute = move |token: String| {
5516                let mut builder = self.clone();
5517                builder.0.request = builder.0.request.set_page_token(token);
5518                builder.send()
5519            };
5520            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5521        }
5522
5523        /// Streams each item in the collection.
5524        pub fn by_item(
5525            self,
5526        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5527            google_cloud_longrunning::model::ListOperationsResponse,
5528            crate::Error,
5529        > {
5530            use google_cloud_gax::paginator::Paginator;
5531            self.by_page().items()
5532        }
5533
5534        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
5535        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5536            self.0.request.name = v.into();
5537            self
5538        }
5539
5540        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
5541        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5542            self.0.request.filter = v.into();
5543            self
5544        }
5545
5546        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
5547        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5548            self.0.request.page_size = v.into();
5549            self
5550        }
5551
5552        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
5553        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5554            self.0.request.page_token = v.into();
5555            self
5556        }
5557
5558        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
5559        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5560            self.0.request.return_partial_success = v.into();
5561            self
5562        }
5563    }
5564
5565    #[doc(hidden)]
5566    impl crate::RequestBuilder for ListOperations {
5567        fn request_options(&mut self) -> &mut crate::RequestOptions {
5568            &mut self.0.options
5569        }
5570    }
5571
5572    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5573    ///
5574    /// # Example
5575    /// ```
5576    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetOperation;
5577    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5578    ///
5579    /// let builder = prepare_request_builder();
5580    /// let response = builder.send().await?;
5581    /// # Ok(()) }
5582    ///
5583    /// fn prepare_request_builder() -> GetOperation {
5584    ///   # panic!();
5585    ///   // ... details omitted ...
5586    /// }
5587    /// ```
5588    #[derive(Clone, Debug)]
5589    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5590
5591    impl GetOperation {
5592        pub(crate) fn new(
5593            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5594        ) -> Self {
5595            Self(RequestBuilder::new(stub))
5596        }
5597
5598        /// Sets the full request, replacing any prior values.
5599        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5600            mut self,
5601            v: V,
5602        ) -> 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<crate::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<google_cloud_longrunning::model::Operation> {
5615            (*self.0.stub)
5616                .get_operation(self.0.request, self.0.options)
5617                .await
5618                .map(crate::Response::into_body)
5619        }
5620
5621        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
5622        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5623            self.0.request.name = v.into();
5624            self
5625        }
5626    }
5627
5628    #[doc(hidden)]
5629    impl crate::RequestBuilder for GetOperation {
5630        fn request_options(&mut self) -> &mut crate::RequestOptions {
5631            &mut self.0.options
5632        }
5633    }
5634
5635    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5636    ///
5637    /// # Example
5638    /// ```
5639    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CancelOperation;
5640    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5641    ///
5642    /// let builder = prepare_request_builder();
5643    /// let response = builder.send().await?;
5644    /// # Ok(()) }
5645    ///
5646    /// fn prepare_request_builder() -> CancelOperation {
5647    ///   # panic!();
5648    ///   // ... details omitted ...
5649    /// }
5650    /// ```
5651    #[derive(Clone, Debug)]
5652    pub struct CancelOperation(
5653        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5654    );
5655
5656    impl CancelOperation {
5657        pub(crate) fn new(
5658            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5659        ) -> Self {
5660            Self(RequestBuilder::new(stub))
5661        }
5662
5663        /// Sets the full request, replacing any prior values.
5664        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5665            mut self,
5666            v: V,
5667        ) -> Self {
5668            self.0.request = v.into();
5669            self
5670        }
5671
5672        /// Sets all the options, replacing any prior values.
5673        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5674            self.0.options = v.into();
5675            self
5676        }
5677
5678        /// Sends the request.
5679        pub async fn send(self) -> Result<()> {
5680            (*self.0.stub)
5681                .cancel_operation(self.0.request, self.0.options)
5682                .await
5683                .map(crate::Response::into_body)
5684        }
5685
5686        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
5687        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5688            self.0.request.name = v.into();
5689            self
5690        }
5691    }
5692
5693    #[doc(hidden)]
5694    impl crate::RequestBuilder for CancelOperation {
5695        fn request_options(&mut self) -> &mut crate::RequestOptions {
5696            &mut self.0.options
5697        }
5698    }
5699}
5700
5701/// Request and client builders for [DocumentService][crate::client::DocumentService].
5702#[cfg(feature = "document-service")]
5703#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5704pub mod document_service {
5705    use crate::Result;
5706
5707    /// A builder for [DocumentService][crate::client::DocumentService].
5708    ///
5709    /// ```
5710    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5711    /// # use google_cloud_discoveryengine_v1::*;
5712    /// # use builder::document_service::ClientBuilder;
5713    /// # use client::DocumentService;
5714    /// let builder : ClientBuilder = DocumentService::builder();
5715    /// let client = builder
5716    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5717    ///     .build().await?;
5718    /// # Ok(()) }
5719    /// ```
5720    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5721
5722    pub(crate) mod client {
5723        use super::super::super::client::DocumentService;
5724        pub struct Factory;
5725        impl crate::ClientFactory for Factory {
5726            type Client = DocumentService;
5727            type Credentials = gaxi::options::Credentials;
5728            async fn build(
5729                self,
5730                config: gaxi::options::ClientConfig,
5731            ) -> crate::ClientBuilderResult<Self::Client> {
5732                Self::Client::new(config).await
5733            }
5734        }
5735    }
5736
5737    /// Common implementation for [crate::client::DocumentService] request builders.
5738    #[derive(Clone, Debug)]
5739    pub(crate) struct RequestBuilder<R: std::default::Default> {
5740        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5741        request: R,
5742        options: crate::RequestOptions,
5743    }
5744
5745    impl<R> RequestBuilder<R>
5746    where
5747        R: std::default::Default,
5748    {
5749        pub(crate) fn new(
5750            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5751        ) -> Self {
5752            Self {
5753                stub,
5754                request: R::default(),
5755                options: crate::RequestOptions::default(),
5756            }
5757        }
5758    }
5759
5760    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5761    ///
5762    /// # Example
5763    /// ```
5764    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetDocument;
5765    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5766    ///
5767    /// let builder = prepare_request_builder();
5768    /// let response = builder.send().await?;
5769    /// # Ok(()) }
5770    ///
5771    /// fn prepare_request_builder() -> GetDocument {
5772    ///   # panic!();
5773    ///   // ... details omitted ...
5774    /// }
5775    /// ```
5776    #[derive(Clone, Debug)]
5777    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5778
5779    impl GetDocument {
5780        pub(crate) fn new(
5781            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5782        ) -> Self {
5783            Self(RequestBuilder::new(stub))
5784        }
5785
5786        /// Sets the full request, replacing any prior values.
5787        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5788            self.0.request = v.into();
5789            self
5790        }
5791
5792        /// Sets all the options, replacing any prior values.
5793        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5794            self.0.options = v.into();
5795            self
5796        }
5797
5798        /// Sends the request.
5799        pub async fn send(self) -> Result<crate::model::Document> {
5800            (*self.0.stub)
5801                .get_document(self.0.request, self.0.options)
5802                .await
5803                .map(crate::Response::into_body)
5804        }
5805
5806        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5807        ///
5808        /// This is a **required** field for requests.
5809        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5810            self.0.request.name = v.into();
5811            self
5812        }
5813    }
5814
5815    #[doc(hidden)]
5816    impl crate::RequestBuilder for GetDocument {
5817        fn request_options(&mut self) -> &mut crate::RequestOptions {
5818            &mut self.0.options
5819        }
5820    }
5821
5822    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5823    ///
5824    /// # Example
5825    /// ```
5826    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListDocuments;
5827    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5828    /// use google_cloud_gax::paginator::ItemPaginator;
5829    ///
5830    /// let builder = prepare_request_builder();
5831    /// let mut items = builder.by_item();
5832    /// while let Some(result) = items.next().await {
5833    ///   let item = result?;
5834    /// }
5835    /// # Ok(()) }
5836    ///
5837    /// fn prepare_request_builder() -> ListDocuments {
5838    ///   # panic!();
5839    ///   // ... details omitted ...
5840    /// }
5841    /// ```
5842    #[derive(Clone, Debug)]
5843    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5844
5845    impl ListDocuments {
5846        pub(crate) fn new(
5847            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5848        ) -> Self {
5849            Self(RequestBuilder::new(stub))
5850        }
5851
5852        /// Sets the full request, replacing any prior values.
5853        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5854            self.0.request = v.into();
5855            self
5856        }
5857
5858        /// Sets all the options, replacing any prior values.
5859        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5860            self.0.options = v.into();
5861            self
5862        }
5863
5864        /// Sends the request.
5865        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5866            (*self.0.stub)
5867                .list_documents(self.0.request, self.0.options)
5868                .await
5869                .map(crate::Response::into_body)
5870        }
5871
5872        /// Streams each page in the collection.
5873        pub fn by_page(
5874            self,
5875        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5876        {
5877            use std::clone::Clone;
5878            let token = self.0.request.page_token.clone();
5879            let execute = move |token: String| {
5880                let mut builder = self.clone();
5881                builder.0.request = builder.0.request.set_page_token(token);
5882                builder.send()
5883            };
5884            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5885        }
5886
5887        /// Streams each item in the collection.
5888        pub fn by_item(
5889            self,
5890        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5891            crate::model::ListDocumentsResponse,
5892            crate::Error,
5893        > {
5894            use google_cloud_gax::paginator::Paginator;
5895            self.by_page().items()
5896        }
5897
5898        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5899        ///
5900        /// This is a **required** field for requests.
5901        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5902            self.0.request.parent = v.into();
5903            self
5904        }
5905
5906        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5907        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5908            self.0.request.page_size = v.into();
5909            self
5910        }
5911
5912        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5913        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5914            self.0.request.page_token = v.into();
5915            self
5916        }
5917    }
5918
5919    #[doc(hidden)]
5920    impl crate::RequestBuilder for ListDocuments {
5921        fn request_options(&mut self) -> &mut crate::RequestOptions {
5922            &mut self.0.options
5923        }
5924    }
5925
5926    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5927    ///
5928    /// # Example
5929    /// ```
5930    /// # use google_cloud_discoveryengine_v1::builder::document_service::CreateDocument;
5931    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5932    ///
5933    /// let builder = prepare_request_builder();
5934    /// let response = builder.send().await?;
5935    /// # Ok(()) }
5936    ///
5937    /// fn prepare_request_builder() -> CreateDocument {
5938    ///   # panic!();
5939    ///   // ... details omitted ...
5940    /// }
5941    /// ```
5942    #[derive(Clone, Debug)]
5943    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5944
5945    impl CreateDocument {
5946        pub(crate) fn new(
5947            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5948        ) -> Self {
5949            Self(RequestBuilder::new(stub))
5950        }
5951
5952        /// Sets the full request, replacing any prior values.
5953        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5954            self.0.request = v.into();
5955            self
5956        }
5957
5958        /// Sets all the options, replacing any prior values.
5959        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5960            self.0.options = v.into();
5961            self
5962        }
5963
5964        /// Sends the request.
5965        pub async fn send(self) -> Result<crate::model::Document> {
5966            (*self.0.stub)
5967                .create_document(self.0.request, self.0.options)
5968                .await
5969                .map(crate::Response::into_body)
5970        }
5971
5972        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5973        ///
5974        /// This is a **required** field for requests.
5975        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5976            self.0.request.parent = v.into();
5977            self
5978        }
5979
5980        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5981        ///
5982        /// This is a **required** field for requests.
5983        pub fn set_document<T>(mut self, v: T) -> Self
5984        where
5985            T: std::convert::Into<crate::model::Document>,
5986        {
5987            self.0.request.document = std::option::Option::Some(v.into());
5988            self
5989        }
5990
5991        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5992        ///
5993        /// This is a **required** field for requests.
5994        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5995        where
5996            T: std::convert::Into<crate::model::Document>,
5997        {
5998            self.0.request.document = v.map(|x| x.into());
5999            self
6000        }
6001
6002        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
6003        ///
6004        /// This is a **required** field for requests.
6005        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6006            self.0.request.document_id = v.into();
6007            self
6008        }
6009    }
6010
6011    #[doc(hidden)]
6012    impl crate::RequestBuilder for CreateDocument {
6013        fn request_options(&mut self) -> &mut crate::RequestOptions {
6014            &mut self.0.options
6015        }
6016    }
6017
6018    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
6019    ///
6020    /// # Example
6021    /// ```
6022    /// # use google_cloud_discoveryengine_v1::builder::document_service::UpdateDocument;
6023    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6024    ///
6025    /// let builder = prepare_request_builder();
6026    /// let response = builder.send().await?;
6027    /// # Ok(()) }
6028    ///
6029    /// fn prepare_request_builder() -> UpdateDocument {
6030    ///   # panic!();
6031    ///   // ... details omitted ...
6032    /// }
6033    /// ```
6034    #[derive(Clone, Debug)]
6035    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
6036
6037    impl UpdateDocument {
6038        pub(crate) fn new(
6039            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6040        ) -> Self {
6041            Self(RequestBuilder::new(stub))
6042        }
6043
6044        /// Sets the full request, replacing any prior values.
6045        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
6046            self.0.request = v.into();
6047            self
6048        }
6049
6050        /// Sets all the options, replacing any prior values.
6051        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6052            self.0.options = v.into();
6053            self
6054        }
6055
6056        /// Sends the request.
6057        pub async fn send(self) -> Result<crate::model::Document> {
6058            (*self.0.stub)
6059                .update_document(self.0.request, self.0.options)
6060                .await
6061                .map(crate::Response::into_body)
6062        }
6063
6064        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
6065        ///
6066        /// This is a **required** field for requests.
6067        pub fn set_document<T>(mut self, v: T) -> Self
6068        where
6069            T: std::convert::Into<crate::model::Document>,
6070        {
6071            self.0.request.document = std::option::Option::Some(v.into());
6072            self
6073        }
6074
6075        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
6076        ///
6077        /// This is a **required** field for requests.
6078        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
6079        where
6080            T: std::convert::Into<crate::model::Document>,
6081        {
6082            self.0.request.document = v.map(|x| x.into());
6083            self
6084        }
6085
6086        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
6087        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6088            self.0.request.allow_missing = v.into();
6089            self
6090        }
6091
6092        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
6093        pub fn set_update_mask<T>(mut self, v: T) -> Self
6094        where
6095            T: std::convert::Into<wkt::FieldMask>,
6096        {
6097            self.0.request.update_mask = std::option::Option::Some(v.into());
6098            self
6099        }
6100
6101        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
6102        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6103        where
6104            T: std::convert::Into<wkt::FieldMask>,
6105        {
6106            self.0.request.update_mask = v.map(|x| x.into());
6107            self
6108        }
6109    }
6110
6111    #[doc(hidden)]
6112    impl crate::RequestBuilder for UpdateDocument {
6113        fn request_options(&mut self) -> &mut crate::RequestOptions {
6114            &mut self.0.options
6115        }
6116    }
6117
6118    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
6119    ///
6120    /// # Example
6121    /// ```
6122    /// # use google_cloud_discoveryengine_v1::builder::document_service::DeleteDocument;
6123    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6124    ///
6125    /// let builder = prepare_request_builder();
6126    /// let response = builder.send().await?;
6127    /// # Ok(()) }
6128    ///
6129    /// fn prepare_request_builder() -> DeleteDocument {
6130    ///   # panic!();
6131    ///   // ... details omitted ...
6132    /// }
6133    /// ```
6134    #[derive(Clone, Debug)]
6135    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
6136
6137    impl DeleteDocument {
6138        pub(crate) fn new(
6139            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6140        ) -> Self {
6141            Self(RequestBuilder::new(stub))
6142        }
6143
6144        /// Sets the full request, replacing any prior values.
6145        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
6146            self.0.request = v.into();
6147            self
6148        }
6149
6150        /// Sets all the options, replacing any prior values.
6151        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6152            self.0.options = v.into();
6153            self
6154        }
6155
6156        /// Sends the request.
6157        pub async fn send(self) -> Result<()> {
6158            (*self.0.stub)
6159                .delete_document(self.0.request, self.0.options)
6160                .await
6161                .map(crate::Response::into_body)
6162        }
6163
6164        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
6165        ///
6166        /// This is a **required** field for requests.
6167        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6168            self.0.request.name = v.into();
6169            self
6170        }
6171    }
6172
6173    #[doc(hidden)]
6174    impl crate::RequestBuilder for DeleteDocument {
6175        fn request_options(&mut self) -> &mut crate::RequestOptions {
6176            &mut self.0.options
6177        }
6178    }
6179
6180    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
6181    ///
6182    /// # Example
6183    /// ```
6184    /// # use google_cloud_discoveryengine_v1::builder::document_service::ImportDocuments;
6185    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6186    /// use google_cloud_lro::Poller;
6187    ///
6188    /// let builder = prepare_request_builder();
6189    /// let response = builder.poller().until_done().await?;
6190    /// # Ok(()) }
6191    ///
6192    /// fn prepare_request_builder() -> ImportDocuments {
6193    ///   # panic!();
6194    ///   // ... details omitted ...
6195    /// }
6196    /// ```
6197    #[derive(Clone, Debug)]
6198    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
6199
6200    impl ImportDocuments {
6201        pub(crate) fn new(
6202            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6203        ) -> Self {
6204            Self(RequestBuilder::new(stub))
6205        }
6206
6207        /// Sets the full request, replacing any prior values.
6208        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
6209            self.0.request = v.into();
6210            self
6211        }
6212
6213        /// Sets all the options, replacing any prior values.
6214        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6215            self.0.options = v.into();
6216            self
6217        }
6218
6219        /// Sends the request.
6220        ///
6221        /// # Long running operations
6222        ///
6223        /// This starts, but does not poll, a longrunning operation. More information
6224        /// on [import_documents][crate::client::DocumentService::import_documents].
6225        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6226            (*self.0.stub)
6227                .import_documents(self.0.request, self.0.options)
6228                .await
6229                .map(crate::Response::into_body)
6230        }
6231
6232        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_documents`.
6233        pub fn poller(
6234            self,
6235        ) -> impl google_cloud_lro::Poller<
6236            crate::model::ImportDocumentsResponse,
6237            crate::model::ImportDocumentsMetadata,
6238        > {
6239            type Operation = google_cloud_lro::internal::Operation<
6240                crate::model::ImportDocumentsResponse,
6241                crate::model::ImportDocumentsMetadata,
6242            >;
6243            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6244            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6245            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6246            if let Some(ref mut details) = poller_options.tracing {
6247                details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::import_documents::until_done";
6248            }
6249
6250            let stub = self.0.stub.clone();
6251            let mut options = self.0.options.clone();
6252            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6253            let query = move |name| {
6254                let stub = stub.clone();
6255                let options = options.clone();
6256                async {
6257                    let op = GetOperation::new(stub)
6258                        .set_name(name)
6259                        .with_options(options)
6260                        .send()
6261                        .await?;
6262                    Ok(Operation::new(op))
6263                }
6264            };
6265
6266            let start = move || async {
6267                let op = self.send().await?;
6268                Ok(Operation::new(op))
6269            };
6270
6271            use google_cloud_lro::internal::PollerExt;
6272            {
6273                google_cloud_lro::internal::new_poller(
6274                    polling_error_policy,
6275                    polling_backoff_policy,
6276                    start,
6277                    query,
6278                )
6279            }
6280            .with_options(poller_options)
6281        }
6282
6283        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
6284        ///
6285        /// This is a **required** field for requests.
6286        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6287            self.0.request.parent = v.into();
6288            self
6289        }
6290
6291        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
6292        pub fn set_error_config<T>(mut self, v: T) -> Self
6293        where
6294            T: std::convert::Into<crate::model::ImportErrorConfig>,
6295        {
6296            self.0.request.error_config = std::option::Option::Some(v.into());
6297            self
6298        }
6299
6300        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
6301        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6302        where
6303            T: std::convert::Into<crate::model::ImportErrorConfig>,
6304        {
6305            self.0.request.error_config = v.map(|x| x.into());
6306            self
6307        }
6308
6309        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
6310        pub fn set_reconciliation_mode<
6311            T: Into<crate::model::import_documents_request::ReconciliationMode>,
6312        >(
6313            mut self,
6314            v: T,
6315        ) -> Self {
6316            self.0.request.reconciliation_mode = v.into();
6317            self
6318        }
6319
6320        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
6321        pub fn set_update_mask<T>(mut self, v: T) -> Self
6322        where
6323            T: std::convert::Into<wkt::FieldMask>,
6324        {
6325            self.0.request.update_mask = std::option::Option::Some(v.into());
6326            self
6327        }
6328
6329        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
6330        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6331        where
6332            T: std::convert::Into<wkt::FieldMask>,
6333        {
6334            self.0.request.update_mask = v.map(|x| x.into());
6335            self
6336        }
6337
6338        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
6339        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
6340            self.0.request.auto_generate_ids = v.into();
6341            self
6342        }
6343
6344        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
6345        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
6346            self.0.request.id_field = v.into();
6347            self
6348        }
6349
6350        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
6351        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
6352            self.0.request.force_refresh_content = v.into();
6353            self
6354        }
6355
6356        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
6357        ///
6358        /// Note that all the setters affecting `source` are
6359        /// mutually exclusive.
6360        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
6361            mut self,
6362            v: T,
6363        ) -> Self {
6364            self.0.request.source = v.into();
6365            self
6366        }
6367
6368        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6369        /// to hold a `InlineSource`.
6370        ///
6371        /// Note that all the setters affecting `source` are
6372        /// mutually exclusive.
6373        pub fn set_inline_source<
6374            T: std::convert::Into<
6375                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
6376                >,
6377        >(
6378            mut self,
6379            v: T,
6380        ) -> Self {
6381            self.0.request = self.0.request.set_inline_source(v);
6382            self
6383        }
6384
6385        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6386        /// to hold a `GcsSource`.
6387        ///
6388        /// Note that all the setters affecting `source` are
6389        /// mutually exclusive.
6390        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6391            mut self,
6392            v: T,
6393        ) -> Self {
6394            self.0.request = self.0.request.set_gcs_source(v);
6395            self
6396        }
6397
6398        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6399        /// to hold a `BigquerySource`.
6400        ///
6401        /// Note that all the setters affecting `source` are
6402        /// mutually exclusive.
6403        pub fn set_bigquery_source<
6404            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
6405        >(
6406            mut self,
6407            v: T,
6408        ) -> Self {
6409            self.0.request = self.0.request.set_bigquery_source(v);
6410            self
6411        }
6412
6413        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6414        /// to hold a `FhirStoreSource`.
6415        ///
6416        /// Note that all the setters affecting `source` are
6417        /// mutually exclusive.
6418        pub fn set_fhir_store_source<
6419            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
6420        >(
6421            mut self,
6422            v: T,
6423        ) -> Self {
6424            self.0.request = self.0.request.set_fhir_store_source(v);
6425            self
6426        }
6427
6428        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6429        /// to hold a `SpannerSource`.
6430        ///
6431        /// Note that all the setters affecting `source` are
6432        /// mutually exclusive.
6433        pub fn set_spanner_source<
6434            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
6435        >(
6436            mut self,
6437            v: T,
6438        ) -> Self {
6439            self.0.request = self.0.request.set_spanner_source(v);
6440            self
6441        }
6442
6443        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6444        /// to hold a `CloudSqlSource`.
6445        ///
6446        /// Note that all the setters affecting `source` are
6447        /// mutually exclusive.
6448        pub fn set_cloud_sql_source<
6449            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
6450        >(
6451            mut self,
6452            v: T,
6453        ) -> Self {
6454            self.0.request = self.0.request.set_cloud_sql_source(v);
6455            self
6456        }
6457
6458        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6459        /// to hold a `FirestoreSource`.
6460        ///
6461        /// Note that all the setters affecting `source` are
6462        /// mutually exclusive.
6463        pub fn set_firestore_source<
6464            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
6465        >(
6466            mut self,
6467            v: T,
6468        ) -> Self {
6469            self.0.request = self.0.request.set_firestore_source(v);
6470            self
6471        }
6472
6473        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6474        /// to hold a `AlloyDbSource`.
6475        ///
6476        /// Note that all the setters affecting `source` are
6477        /// mutually exclusive.
6478        pub fn set_alloy_db_source<
6479            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6480        >(
6481            mut self,
6482            v: T,
6483        ) -> Self {
6484            self.0.request = self.0.request.set_alloy_db_source(v);
6485            self
6486        }
6487
6488        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6489        /// to hold a `BigtableSource`.
6490        ///
6491        /// Note that all the setters affecting `source` are
6492        /// mutually exclusive.
6493        pub fn set_bigtable_source<
6494            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6495        >(
6496            mut self,
6497            v: T,
6498        ) -> Self {
6499            self.0.request = self.0.request.set_bigtable_source(v);
6500            self
6501        }
6502    }
6503
6504    #[doc(hidden)]
6505    impl crate::RequestBuilder for ImportDocuments {
6506        fn request_options(&mut self) -> &mut crate::RequestOptions {
6507            &mut self.0.options
6508        }
6509    }
6510
6511    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
6512    ///
6513    /// # Example
6514    /// ```
6515    /// # use google_cloud_discoveryengine_v1::builder::document_service::PurgeDocuments;
6516    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6517    /// use google_cloud_lro::Poller;
6518    ///
6519    /// let builder = prepare_request_builder();
6520    /// let response = builder.poller().until_done().await?;
6521    /// # Ok(()) }
6522    ///
6523    /// fn prepare_request_builder() -> PurgeDocuments {
6524    ///   # panic!();
6525    ///   // ... details omitted ...
6526    /// }
6527    /// ```
6528    #[derive(Clone, Debug)]
6529    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6530
6531    impl PurgeDocuments {
6532        pub(crate) fn new(
6533            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6534        ) -> Self {
6535            Self(RequestBuilder::new(stub))
6536        }
6537
6538        /// Sets the full request, replacing any prior values.
6539        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6540            self.0.request = v.into();
6541            self
6542        }
6543
6544        /// Sets all the options, replacing any prior values.
6545        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6546            self.0.options = v.into();
6547            self
6548        }
6549
6550        /// Sends the request.
6551        ///
6552        /// # Long running operations
6553        ///
6554        /// This starts, but does not poll, a longrunning operation. More information
6555        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6556        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6557            (*self.0.stub)
6558                .purge_documents(self.0.request, self.0.options)
6559                .await
6560                .map(crate::Response::into_body)
6561        }
6562
6563        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_documents`.
6564        pub fn poller(
6565            self,
6566        ) -> impl google_cloud_lro::Poller<
6567            crate::model::PurgeDocumentsResponse,
6568            crate::model::PurgeDocumentsMetadata,
6569        > {
6570            type Operation = google_cloud_lro::internal::Operation<
6571                crate::model::PurgeDocumentsResponse,
6572                crate::model::PurgeDocumentsMetadata,
6573            >;
6574            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6575            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6576            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6577            if let Some(ref mut details) = poller_options.tracing {
6578                details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::purge_documents::until_done";
6579            }
6580
6581            let stub = self.0.stub.clone();
6582            let mut options = self.0.options.clone();
6583            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6584            let query = move |name| {
6585                let stub = stub.clone();
6586                let options = options.clone();
6587                async {
6588                    let op = GetOperation::new(stub)
6589                        .set_name(name)
6590                        .with_options(options)
6591                        .send()
6592                        .await?;
6593                    Ok(Operation::new(op))
6594                }
6595            };
6596
6597            let start = move || async {
6598                let op = self.send().await?;
6599                Ok(Operation::new(op))
6600            };
6601
6602            use google_cloud_lro::internal::PollerExt;
6603            {
6604                google_cloud_lro::internal::new_poller(
6605                    polling_error_policy,
6606                    polling_backoff_policy,
6607                    start,
6608                    query,
6609                )
6610            }
6611            .with_options(poller_options)
6612        }
6613
6614        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6615        ///
6616        /// This is a **required** field for requests.
6617        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6618            self.0.request.parent = v.into();
6619            self
6620        }
6621
6622        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6623        ///
6624        /// This is a **required** field for requests.
6625        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6626            self.0.request.filter = v.into();
6627            self
6628        }
6629
6630        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6631        pub fn set_error_config<T>(mut self, v: T) -> Self
6632        where
6633            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6634        {
6635            self.0.request.error_config = std::option::Option::Some(v.into());
6636            self
6637        }
6638
6639        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6640        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6641        where
6642            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6643        {
6644            self.0.request.error_config = v.map(|x| x.into());
6645            self
6646        }
6647
6648        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6649        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6650            self.0.request.force = v.into();
6651            self
6652        }
6653
6654        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6655        ///
6656        /// Note that all the setters affecting `source` are
6657        /// mutually exclusive.
6658        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6659            mut self,
6660            v: T,
6661        ) -> Self {
6662            self.0.request.source = v.into();
6663            self
6664        }
6665
6666        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6667        /// to hold a `GcsSource`.
6668        ///
6669        /// Note that all the setters affecting `source` are
6670        /// mutually exclusive.
6671        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6672            mut self,
6673            v: T,
6674        ) -> Self {
6675            self.0.request = self.0.request.set_gcs_source(v);
6676            self
6677        }
6678
6679        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6680        /// to hold a `InlineSource`.
6681        ///
6682        /// Note that all the setters affecting `source` are
6683        /// mutually exclusive.
6684        pub fn set_inline_source<
6685            T: std::convert::Into<
6686                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6687                >,
6688        >(
6689            mut self,
6690            v: T,
6691        ) -> Self {
6692            self.0.request = self.0.request.set_inline_source(v);
6693            self
6694        }
6695    }
6696
6697    #[doc(hidden)]
6698    impl crate::RequestBuilder for PurgeDocuments {
6699        fn request_options(&mut self) -> &mut crate::RequestOptions {
6700            &mut self.0.options
6701        }
6702    }
6703
6704    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6705    ///
6706    /// # Example
6707    /// ```
6708    /// # use google_cloud_discoveryengine_v1::builder::document_service::BatchGetDocumentsMetadata;
6709    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6710    ///
6711    /// let builder = prepare_request_builder();
6712    /// let response = builder.send().await?;
6713    /// # Ok(()) }
6714    ///
6715    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6716    ///   # panic!();
6717    ///   // ... details omitted ...
6718    /// }
6719    /// ```
6720    #[derive(Clone, Debug)]
6721    pub struct BatchGetDocumentsMetadata(
6722        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6723    );
6724
6725    impl BatchGetDocumentsMetadata {
6726        pub(crate) fn new(
6727            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6728        ) -> Self {
6729            Self(RequestBuilder::new(stub))
6730        }
6731
6732        /// Sets the full request, replacing any prior values.
6733        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6734            mut self,
6735            v: V,
6736        ) -> Self {
6737            self.0.request = v.into();
6738            self
6739        }
6740
6741        /// Sets all the options, replacing any prior values.
6742        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6743            self.0.options = v.into();
6744            self
6745        }
6746
6747        /// Sends the request.
6748        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6749            (*self.0.stub)
6750                .batch_get_documents_metadata(self.0.request, self.0.options)
6751                .await
6752                .map(crate::Response::into_body)
6753        }
6754
6755        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6756        ///
6757        /// This is a **required** field for requests.
6758        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6759            self.0.request.parent = v.into();
6760            self
6761        }
6762
6763        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6764        ///
6765        /// This is a **required** field for requests.
6766        pub fn set_matcher<T>(mut self, v: T) -> Self
6767        where
6768            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6769        {
6770            self.0.request.matcher = std::option::Option::Some(v.into());
6771            self
6772        }
6773
6774        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6775        ///
6776        /// This is a **required** field for requests.
6777        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6778        where
6779            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6780        {
6781            self.0.request.matcher = v.map(|x| x.into());
6782            self
6783        }
6784    }
6785
6786    #[doc(hidden)]
6787    impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6788        fn request_options(&mut self) -> &mut crate::RequestOptions {
6789            &mut self.0.options
6790        }
6791    }
6792
6793    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6794    ///
6795    /// # Example
6796    /// ```
6797    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListOperations;
6798    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6799    /// use google_cloud_gax::paginator::ItemPaginator;
6800    ///
6801    /// let builder = prepare_request_builder();
6802    /// let mut items = builder.by_item();
6803    /// while let Some(result) = items.next().await {
6804    ///   let item = result?;
6805    /// }
6806    /// # Ok(()) }
6807    ///
6808    /// fn prepare_request_builder() -> ListOperations {
6809    ///   # panic!();
6810    ///   // ... details omitted ...
6811    /// }
6812    /// ```
6813    #[derive(Clone, Debug)]
6814    pub struct ListOperations(
6815        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6816    );
6817
6818    impl ListOperations {
6819        pub(crate) fn new(
6820            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6821        ) -> Self {
6822            Self(RequestBuilder::new(stub))
6823        }
6824
6825        /// Sets the full request, replacing any prior values.
6826        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6827            mut self,
6828            v: V,
6829        ) -> Self {
6830            self.0.request = v.into();
6831            self
6832        }
6833
6834        /// Sets all the options, replacing any prior values.
6835        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6836            self.0.options = v.into();
6837            self
6838        }
6839
6840        /// Sends the request.
6841        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6842            (*self.0.stub)
6843                .list_operations(self.0.request, self.0.options)
6844                .await
6845                .map(crate::Response::into_body)
6846        }
6847
6848        /// Streams each page in the collection.
6849        pub fn by_page(
6850            self,
6851        ) -> impl google_cloud_gax::paginator::Paginator<
6852            google_cloud_longrunning::model::ListOperationsResponse,
6853            crate::Error,
6854        > {
6855            use std::clone::Clone;
6856            let token = self.0.request.page_token.clone();
6857            let execute = move |token: String| {
6858                let mut builder = self.clone();
6859                builder.0.request = builder.0.request.set_page_token(token);
6860                builder.send()
6861            };
6862            google_cloud_gax::paginator::internal::new_paginator(token, execute)
6863        }
6864
6865        /// Streams each item in the collection.
6866        pub fn by_item(
6867            self,
6868        ) -> impl google_cloud_gax::paginator::ItemPaginator<
6869            google_cloud_longrunning::model::ListOperationsResponse,
6870            crate::Error,
6871        > {
6872            use google_cloud_gax::paginator::Paginator;
6873            self.by_page().items()
6874        }
6875
6876        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
6877        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6878            self.0.request.name = v.into();
6879            self
6880        }
6881
6882        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
6883        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6884            self.0.request.filter = v.into();
6885            self
6886        }
6887
6888        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
6889        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6890            self.0.request.page_size = v.into();
6891            self
6892        }
6893
6894        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
6895        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6896            self.0.request.page_token = v.into();
6897            self
6898        }
6899
6900        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
6901        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6902            self.0.request.return_partial_success = v.into();
6903            self
6904        }
6905    }
6906
6907    #[doc(hidden)]
6908    impl crate::RequestBuilder for ListOperations {
6909        fn request_options(&mut self) -> &mut crate::RequestOptions {
6910            &mut self.0.options
6911        }
6912    }
6913
6914    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6915    ///
6916    /// # Example
6917    /// ```
6918    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetOperation;
6919    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6920    ///
6921    /// let builder = prepare_request_builder();
6922    /// let response = builder.send().await?;
6923    /// # Ok(()) }
6924    ///
6925    /// fn prepare_request_builder() -> GetOperation {
6926    ///   # panic!();
6927    ///   // ... details omitted ...
6928    /// }
6929    /// ```
6930    #[derive(Clone, Debug)]
6931    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6932
6933    impl GetOperation {
6934        pub(crate) fn new(
6935            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6936        ) -> Self {
6937            Self(RequestBuilder::new(stub))
6938        }
6939
6940        /// Sets the full request, replacing any prior values.
6941        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6942            mut self,
6943            v: V,
6944        ) -> Self {
6945            self.0.request = v.into();
6946            self
6947        }
6948
6949        /// Sets all the options, replacing any prior values.
6950        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6951            self.0.options = v.into();
6952            self
6953        }
6954
6955        /// Sends the request.
6956        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6957            (*self.0.stub)
6958                .get_operation(self.0.request, self.0.options)
6959                .await
6960                .map(crate::Response::into_body)
6961        }
6962
6963        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
6964        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6965            self.0.request.name = v.into();
6966            self
6967        }
6968    }
6969
6970    #[doc(hidden)]
6971    impl crate::RequestBuilder for GetOperation {
6972        fn request_options(&mut self) -> &mut crate::RequestOptions {
6973            &mut self.0.options
6974        }
6975    }
6976
6977    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6978    ///
6979    /// # Example
6980    /// ```
6981    /// # use google_cloud_discoveryengine_v1::builder::document_service::CancelOperation;
6982    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6983    ///
6984    /// let builder = prepare_request_builder();
6985    /// let response = builder.send().await?;
6986    /// # Ok(()) }
6987    ///
6988    /// fn prepare_request_builder() -> CancelOperation {
6989    ///   # panic!();
6990    ///   // ... details omitted ...
6991    /// }
6992    /// ```
6993    #[derive(Clone, Debug)]
6994    pub struct CancelOperation(
6995        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6996    );
6997
6998    impl CancelOperation {
6999        pub(crate) fn new(
7000            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
7001        ) -> Self {
7002            Self(RequestBuilder::new(stub))
7003        }
7004
7005        /// Sets the full request, replacing any prior values.
7006        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7007            mut self,
7008            v: V,
7009        ) -> Self {
7010            self.0.request = v.into();
7011            self
7012        }
7013
7014        /// Sets all the options, replacing any prior values.
7015        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7016            self.0.options = v.into();
7017            self
7018        }
7019
7020        /// Sends the request.
7021        pub async fn send(self) -> Result<()> {
7022            (*self.0.stub)
7023                .cancel_operation(self.0.request, self.0.options)
7024                .await
7025                .map(crate::Response::into_body)
7026        }
7027
7028        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7029        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7030            self.0.request.name = v.into();
7031            self
7032        }
7033    }
7034
7035    #[doc(hidden)]
7036    impl crate::RequestBuilder for CancelOperation {
7037        fn request_options(&mut self) -> &mut crate::RequestOptions {
7038            &mut self.0.options
7039        }
7040    }
7041}
7042
7043/// Request and client builders for [EngineService][crate::client::EngineService].
7044#[cfg(feature = "engine-service")]
7045#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
7046pub mod engine_service {
7047    use crate::Result;
7048
7049    /// A builder for [EngineService][crate::client::EngineService].
7050    ///
7051    /// ```
7052    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7053    /// # use google_cloud_discoveryengine_v1::*;
7054    /// # use builder::engine_service::ClientBuilder;
7055    /// # use client::EngineService;
7056    /// let builder : ClientBuilder = EngineService::builder();
7057    /// let client = builder
7058    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7059    ///     .build().await?;
7060    /// # Ok(()) }
7061    /// ```
7062    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7063
7064    pub(crate) mod client {
7065        use super::super::super::client::EngineService;
7066        pub struct Factory;
7067        impl crate::ClientFactory for Factory {
7068            type Client = EngineService;
7069            type Credentials = gaxi::options::Credentials;
7070            async fn build(
7071                self,
7072                config: gaxi::options::ClientConfig,
7073            ) -> crate::ClientBuilderResult<Self::Client> {
7074                Self::Client::new(config).await
7075            }
7076        }
7077    }
7078
7079    /// Common implementation for [crate::client::EngineService] request builders.
7080    #[derive(Clone, Debug)]
7081    pub(crate) struct RequestBuilder<R: std::default::Default> {
7082        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7083        request: R,
7084        options: crate::RequestOptions,
7085    }
7086
7087    impl<R> RequestBuilder<R>
7088    where
7089        R: std::default::Default,
7090    {
7091        pub(crate) fn new(
7092            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7093        ) -> Self {
7094            Self {
7095                stub,
7096                request: R::default(),
7097                options: crate::RequestOptions::default(),
7098            }
7099        }
7100    }
7101
7102    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
7103    ///
7104    /// # Example
7105    /// ```
7106    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CreateEngine;
7107    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7108    /// use google_cloud_lro::Poller;
7109    ///
7110    /// let builder = prepare_request_builder();
7111    /// let response = builder.poller().until_done().await?;
7112    /// # Ok(()) }
7113    ///
7114    /// fn prepare_request_builder() -> CreateEngine {
7115    ///   # panic!();
7116    ///   // ... details omitted ...
7117    /// }
7118    /// ```
7119    #[derive(Clone, Debug)]
7120    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
7121
7122    impl CreateEngine {
7123        pub(crate) fn new(
7124            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7125        ) -> Self {
7126            Self(RequestBuilder::new(stub))
7127        }
7128
7129        /// Sets the full request, replacing any prior values.
7130        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
7131            self.0.request = v.into();
7132            self
7133        }
7134
7135        /// Sets all the options, replacing any prior values.
7136        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7137            self.0.options = v.into();
7138            self
7139        }
7140
7141        /// Sends the request.
7142        ///
7143        /// # Long running operations
7144        ///
7145        /// This starts, but does not poll, a longrunning operation. More information
7146        /// on [create_engine][crate::client::EngineService::create_engine].
7147        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7148            (*self.0.stub)
7149                .create_engine(self.0.request, self.0.options)
7150                .await
7151                .map(crate::Response::into_body)
7152        }
7153
7154        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_engine`.
7155        pub fn poller(
7156            self,
7157        ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
7158        {
7159            type Operation = google_cloud_lro::internal::Operation<
7160                crate::model::Engine,
7161                crate::model::CreateEngineMetadata,
7162            >;
7163            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7164            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7165            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7166            if let Some(ref mut details) = poller_options.tracing {
7167                details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::create_engine::until_done";
7168            }
7169
7170            let stub = self.0.stub.clone();
7171            let mut options = self.0.options.clone();
7172            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7173            let query = move |name| {
7174                let stub = stub.clone();
7175                let options = options.clone();
7176                async {
7177                    let op = GetOperation::new(stub)
7178                        .set_name(name)
7179                        .with_options(options)
7180                        .send()
7181                        .await?;
7182                    Ok(Operation::new(op))
7183                }
7184            };
7185
7186            let start = move || async {
7187                let op = self.send().await?;
7188                Ok(Operation::new(op))
7189            };
7190
7191            use google_cloud_lro::internal::PollerExt;
7192            {
7193                google_cloud_lro::internal::new_poller(
7194                    polling_error_policy,
7195                    polling_backoff_policy,
7196                    start,
7197                    query,
7198                )
7199            }
7200            .with_options(poller_options)
7201        }
7202
7203        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
7204        ///
7205        /// This is a **required** field for requests.
7206        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7207            self.0.request.parent = v.into();
7208            self
7209        }
7210
7211        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
7212        ///
7213        /// This is a **required** field for requests.
7214        pub fn set_engine<T>(mut self, v: T) -> Self
7215        where
7216            T: std::convert::Into<crate::model::Engine>,
7217        {
7218            self.0.request.engine = std::option::Option::Some(v.into());
7219            self
7220        }
7221
7222        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
7223        ///
7224        /// This is a **required** field for requests.
7225        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7226        where
7227            T: std::convert::Into<crate::model::Engine>,
7228        {
7229            self.0.request.engine = v.map(|x| x.into());
7230            self
7231        }
7232
7233        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
7234        ///
7235        /// This is a **required** field for requests.
7236        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7237            self.0.request.engine_id = v.into();
7238            self
7239        }
7240    }
7241
7242    #[doc(hidden)]
7243    impl crate::RequestBuilder for CreateEngine {
7244        fn request_options(&mut self) -> &mut crate::RequestOptions {
7245            &mut self.0.options
7246        }
7247    }
7248
7249    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
7250    ///
7251    /// # Example
7252    /// ```
7253    /// # use google_cloud_discoveryengine_v1::builder::engine_service::DeleteEngine;
7254    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7255    /// use google_cloud_lro::Poller;
7256    ///
7257    /// let builder = prepare_request_builder();
7258    /// let response = builder.poller().until_done().await?;
7259    /// # Ok(()) }
7260    ///
7261    /// fn prepare_request_builder() -> DeleteEngine {
7262    ///   # panic!();
7263    ///   // ... details omitted ...
7264    /// }
7265    /// ```
7266    #[derive(Clone, Debug)]
7267    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
7268
7269    impl DeleteEngine {
7270        pub(crate) fn new(
7271            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7272        ) -> Self {
7273            Self(RequestBuilder::new(stub))
7274        }
7275
7276        /// Sets the full request, replacing any prior values.
7277        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
7278            self.0.request = v.into();
7279            self
7280        }
7281
7282        /// Sets all the options, replacing any prior values.
7283        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7284            self.0.options = v.into();
7285            self
7286        }
7287
7288        /// Sends the request.
7289        ///
7290        /// # Long running operations
7291        ///
7292        /// This starts, but does not poll, a longrunning operation. More information
7293        /// on [delete_engine][crate::client::EngineService::delete_engine].
7294        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7295            (*self.0.stub)
7296                .delete_engine(self.0.request, self.0.options)
7297                .await
7298                .map(crate::Response::into_body)
7299        }
7300
7301        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_engine`.
7302        pub fn poller(
7303            self,
7304        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
7305            type Operation = google_cloud_lro::internal::Operation<
7306                wkt::Empty,
7307                crate::model::DeleteEngineMetadata,
7308            >;
7309            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7310            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7311            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7312            if let Some(ref mut details) = poller_options.tracing {
7313                details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::delete_engine::until_done";
7314            }
7315
7316            let stub = self.0.stub.clone();
7317            let mut options = self.0.options.clone();
7318            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7319            let query = move |name| {
7320                let stub = stub.clone();
7321                let options = options.clone();
7322                async {
7323                    let op = GetOperation::new(stub)
7324                        .set_name(name)
7325                        .with_options(options)
7326                        .send()
7327                        .await?;
7328                    Ok(Operation::new(op))
7329                }
7330            };
7331
7332            let start = move || async {
7333                let op = self.send().await?;
7334                Ok(Operation::new(op))
7335            };
7336
7337            use google_cloud_lro::internal::PollerExt;
7338            {
7339                google_cloud_lro::internal::new_unit_response_poller(
7340                    polling_error_policy,
7341                    polling_backoff_policy,
7342                    start,
7343                    query,
7344                )
7345            }
7346            .with_options(poller_options)
7347        }
7348
7349        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
7350        ///
7351        /// This is a **required** field for requests.
7352        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7353            self.0.request.name = v.into();
7354            self
7355        }
7356    }
7357
7358    #[doc(hidden)]
7359    impl crate::RequestBuilder for DeleteEngine {
7360        fn request_options(&mut self) -> &mut crate::RequestOptions {
7361            &mut self.0.options
7362        }
7363    }
7364
7365    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
7366    ///
7367    /// # Example
7368    /// ```
7369    /// # use google_cloud_discoveryengine_v1::builder::engine_service::UpdateEngine;
7370    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7371    ///
7372    /// let builder = prepare_request_builder();
7373    /// let response = builder.send().await?;
7374    /// # Ok(()) }
7375    ///
7376    /// fn prepare_request_builder() -> UpdateEngine {
7377    ///   # panic!();
7378    ///   // ... details omitted ...
7379    /// }
7380    /// ```
7381    #[derive(Clone, Debug)]
7382    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
7383
7384    impl UpdateEngine {
7385        pub(crate) fn new(
7386            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7387        ) -> Self {
7388            Self(RequestBuilder::new(stub))
7389        }
7390
7391        /// Sets the full request, replacing any prior values.
7392        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
7393            self.0.request = v.into();
7394            self
7395        }
7396
7397        /// Sets all the options, replacing any prior values.
7398        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7399            self.0.options = v.into();
7400            self
7401        }
7402
7403        /// Sends the request.
7404        pub async fn send(self) -> Result<crate::model::Engine> {
7405            (*self.0.stub)
7406                .update_engine(self.0.request, self.0.options)
7407                .await
7408                .map(crate::Response::into_body)
7409        }
7410
7411        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
7412        ///
7413        /// This is a **required** field for requests.
7414        pub fn set_engine<T>(mut self, v: T) -> Self
7415        where
7416            T: std::convert::Into<crate::model::Engine>,
7417        {
7418            self.0.request.engine = std::option::Option::Some(v.into());
7419            self
7420        }
7421
7422        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
7423        ///
7424        /// This is a **required** field for requests.
7425        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7426        where
7427            T: std::convert::Into<crate::model::Engine>,
7428        {
7429            self.0.request.engine = v.map(|x| x.into());
7430            self
7431        }
7432
7433        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
7434        pub fn set_update_mask<T>(mut self, v: T) -> Self
7435        where
7436            T: std::convert::Into<wkt::FieldMask>,
7437        {
7438            self.0.request.update_mask = std::option::Option::Some(v.into());
7439            self
7440        }
7441
7442        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
7443        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7444        where
7445            T: std::convert::Into<wkt::FieldMask>,
7446        {
7447            self.0.request.update_mask = v.map(|x| x.into());
7448            self
7449        }
7450    }
7451
7452    #[doc(hidden)]
7453    impl crate::RequestBuilder for UpdateEngine {
7454        fn request_options(&mut self) -> &mut crate::RequestOptions {
7455            &mut self.0.options
7456        }
7457    }
7458
7459    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
7460    ///
7461    /// # Example
7462    /// ```
7463    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetEngine;
7464    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7465    ///
7466    /// let builder = prepare_request_builder();
7467    /// let response = builder.send().await?;
7468    /// # Ok(()) }
7469    ///
7470    /// fn prepare_request_builder() -> GetEngine {
7471    ///   # panic!();
7472    ///   // ... details omitted ...
7473    /// }
7474    /// ```
7475    #[derive(Clone, Debug)]
7476    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
7477
7478    impl GetEngine {
7479        pub(crate) fn new(
7480            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7481        ) -> Self {
7482            Self(RequestBuilder::new(stub))
7483        }
7484
7485        /// Sets the full request, replacing any prior values.
7486        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
7487            self.0.request = v.into();
7488            self
7489        }
7490
7491        /// Sets all the options, replacing any prior values.
7492        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7493            self.0.options = v.into();
7494            self
7495        }
7496
7497        /// Sends the request.
7498        pub async fn send(self) -> Result<crate::model::Engine> {
7499            (*self.0.stub)
7500                .get_engine(self.0.request, self.0.options)
7501                .await
7502                .map(crate::Response::into_body)
7503        }
7504
7505        /// Sets the value of [name][crate::model::GetEngineRequest::name].
7506        ///
7507        /// This is a **required** field for requests.
7508        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7509            self.0.request.name = v.into();
7510            self
7511        }
7512    }
7513
7514    #[doc(hidden)]
7515    impl crate::RequestBuilder for GetEngine {
7516        fn request_options(&mut self) -> &mut crate::RequestOptions {
7517            &mut self.0.options
7518        }
7519    }
7520
7521    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
7522    ///
7523    /// # Example
7524    /// ```
7525    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListEngines;
7526    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7527    /// use google_cloud_gax::paginator::ItemPaginator;
7528    ///
7529    /// let builder = prepare_request_builder();
7530    /// let mut items = builder.by_item();
7531    /// while let Some(result) = items.next().await {
7532    ///   let item = result?;
7533    /// }
7534    /// # Ok(()) }
7535    ///
7536    /// fn prepare_request_builder() -> ListEngines {
7537    ///   # panic!();
7538    ///   // ... details omitted ...
7539    /// }
7540    /// ```
7541    #[derive(Clone, Debug)]
7542    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7543
7544    impl ListEngines {
7545        pub(crate) fn new(
7546            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7547        ) -> Self {
7548            Self(RequestBuilder::new(stub))
7549        }
7550
7551        /// Sets the full request, replacing any prior values.
7552        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7553            self.0.request = v.into();
7554            self
7555        }
7556
7557        /// Sets all the options, replacing any prior values.
7558        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7559            self.0.options = v.into();
7560            self
7561        }
7562
7563        /// Sends the request.
7564        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7565            (*self.0.stub)
7566                .list_engines(self.0.request, self.0.options)
7567                .await
7568                .map(crate::Response::into_body)
7569        }
7570
7571        /// Streams each page in the collection.
7572        pub fn by_page(
7573            self,
7574        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7575        {
7576            use std::clone::Clone;
7577            let token = self.0.request.page_token.clone();
7578            let execute = move |token: String| {
7579                let mut builder = self.clone();
7580                builder.0.request = builder.0.request.set_page_token(token);
7581                builder.send()
7582            };
7583            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7584        }
7585
7586        /// Streams each item in the collection.
7587        pub fn by_item(
7588            self,
7589        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7590            crate::model::ListEnginesResponse,
7591            crate::Error,
7592        > {
7593            use google_cloud_gax::paginator::Paginator;
7594            self.by_page().items()
7595        }
7596
7597        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
7598        ///
7599        /// This is a **required** field for requests.
7600        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7601            self.0.request.parent = v.into();
7602            self
7603        }
7604
7605        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7606        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7607            self.0.request.page_size = v.into();
7608            self
7609        }
7610
7611        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7612        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7613            self.0.request.page_token = v.into();
7614            self
7615        }
7616
7617        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7618        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7619            self.0.request.filter = v.into();
7620            self
7621        }
7622    }
7623
7624    #[doc(hidden)]
7625    impl crate::RequestBuilder for ListEngines {
7626        fn request_options(&mut self) -> &mut crate::RequestOptions {
7627            &mut self.0.options
7628        }
7629    }
7630
7631    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7632    ///
7633    /// # Example
7634    /// ```
7635    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListOperations;
7636    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7637    /// use google_cloud_gax::paginator::ItemPaginator;
7638    ///
7639    /// let builder = prepare_request_builder();
7640    /// let mut items = builder.by_item();
7641    /// while let Some(result) = items.next().await {
7642    ///   let item = result?;
7643    /// }
7644    /// # Ok(()) }
7645    ///
7646    /// fn prepare_request_builder() -> ListOperations {
7647    ///   # panic!();
7648    ///   // ... details omitted ...
7649    /// }
7650    /// ```
7651    #[derive(Clone, Debug)]
7652    pub struct ListOperations(
7653        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7654    );
7655
7656    impl ListOperations {
7657        pub(crate) fn new(
7658            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7659        ) -> Self {
7660            Self(RequestBuilder::new(stub))
7661        }
7662
7663        /// Sets the full request, replacing any prior values.
7664        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7665            mut self,
7666            v: V,
7667        ) -> Self {
7668            self.0.request = v.into();
7669            self
7670        }
7671
7672        /// Sets all the options, replacing any prior values.
7673        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7674            self.0.options = v.into();
7675            self
7676        }
7677
7678        /// Sends the request.
7679        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7680            (*self.0.stub)
7681                .list_operations(self.0.request, self.0.options)
7682                .await
7683                .map(crate::Response::into_body)
7684        }
7685
7686        /// Streams each page in the collection.
7687        pub fn by_page(
7688            self,
7689        ) -> impl google_cloud_gax::paginator::Paginator<
7690            google_cloud_longrunning::model::ListOperationsResponse,
7691            crate::Error,
7692        > {
7693            use std::clone::Clone;
7694            let token = self.0.request.page_token.clone();
7695            let execute = move |token: String| {
7696                let mut builder = self.clone();
7697                builder.0.request = builder.0.request.set_page_token(token);
7698                builder.send()
7699            };
7700            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7701        }
7702
7703        /// Streams each item in the collection.
7704        pub fn by_item(
7705            self,
7706        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7707            google_cloud_longrunning::model::ListOperationsResponse,
7708            crate::Error,
7709        > {
7710            use google_cloud_gax::paginator::Paginator;
7711            self.by_page().items()
7712        }
7713
7714        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7715        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7716            self.0.request.name = v.into();
7717            self
7718        }
7719
7720        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7721        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7722            self.0.request.filter = v.into();
7723            self
7724        }
7725
7726        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7727        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7728            self.0.request.page_size = v.into();
7729            self
7730        }
7731
7732        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7733        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7734            self.0.request.page_token = v.into();
7735            self
7736        }
7737
7738        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7739        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7740            self.0.request.return_partial_success = v.into();
7741            self
7742        }
7743    }
7744
7745    #[doc(hidden)]
7746    impl crate::RequestBuilder for ListOperations {
7747        fn request_options(&mut self) -> &mut crate::RequestOptions {
7748            &mut self.0.options
7749        }
7750    }
7751
7752    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7753    ///
7754    /// # Example
7755    /// ```
7756    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetOperation;
7757    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7758    ///
7759    /// let builder = prepare_request_builder();
7760    /// let response = builder.send().await?;
7761    /// # Ok(()) }
7762    ///
7763    /// fn prepare_request_builder() -> GetOperation {
7764    ///   # panic!();
7765    ///   // ... details omitted ...
7766    /// }
7767    /// ```
7768    #[derive(Clone, Debug)]
7769    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7770
7771    impl GetOperation {
7772        pub(crate) fn new(
7773            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7774        ) -> Self {
7775            Self(RequestBuilder::new(stub))
7776        }
7777
7778        /// Sets the full request, replacing any prior values.
7779        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7780            mut self,
7781            v: V,
7782        ) -> Self {
7783            self.0.request = v.into();
7784            self
7785        }
7786
7787        /// Sets all the options, replacing any prior values.
7788        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7789            self.0.options = v.into();
7790            self
7791        }
7792
7793        /// Sends the request.
7794        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7795            (*self.0.stub)
7796                .get_operation(self.0.request, self.0.options)
7797                .await
7798                .map(crate::Response::into_body)
7799        }
7800
7801        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7802        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7803            self.0.request.name = v.into();
7804            self
7805        }
7806    }
7807
7808    #[doc(hidden)]
7809    impl crate::RequestBuilder for GetOperation {
7810        fn request_options(&mut self) -> &mut crate::RequestOptions {
7811            &mut self.0.options
7812        }
7813    }
7814
7815    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7816    ///
7817    /// # Example
7818    /// ```
7819    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CancelOperation;
7820    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7821    ///
7822    /// let builder = prepare_request_builder();
7823    /// let response = builder.send().await?;
7824    /// # Ok(()) }
7825    ///
7826    /// fn prepare_request_builder() -> CancelOperation {
7827    ///   # panic!();
7828    ///   // ... details omitted ...
7829    /// }
7830    /// ```
7831    #[derive(Clone, Debug)]
7832    pub struct CancelOperation(
7833        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7834    );
7835
7836    impl CancelOperation {
7837        pub(crate) fn new(
7838            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7839        ) -> Self {
7840            Self(RequestBuilder::new(stub))
7841        }
7842
7843        /// Sets the full request, replacing any prior values.
7844        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7845            mut self,
7846            v: V,
7847        ) -> Self {
7848            self.0.request = v.into();
7849            self
7850        }
7851
7852        /// Sets all the options, replacing any prior values.
7853        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7854            self.0.options = v.into();
7855            self
7856        }
7857
7858        /// Sends the request.
7859        pub async fn send(self) -> Result<()> {
7860            (*self.0.stub)
7861                .cancel_operation(self.0.request, self.0.options)
7862                .await
7863                .map(crate::Response::into_body)
7864        }
7865
7866        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7868            self.0.request.name = v.into();
7869            self
7870        }
7871    }
7872
7873    #[doc(hidden)]
7874    impl crate::RequestBuilder for CancelOperation {
7875        fn request_options(&mut self) -> &mut crate::RequestOptions {
7876            &mut self.0.options
7877        }
7878    }
7879}
7880
7881/// Request and client builders for [GroundedGenerationService][crate::client::GroundedGenerationService].
7882#[cfg(feature = "grounded-generation-service")]
7883#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7884pub mod grounded_generation_service {
7885    use crate::Result;
7886
7887    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7888    ///
7889    /// ```
7890    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7891    /// # use google_cloud_discoveryengine_v1::*;
7892    /// # use builder::grounded_generation_service::ClientBuilder;
7893    /// # use client::GroundedGenerationService;
7894    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7895    /// let client = builder
7896    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7897    ///     .build().await?;
7898    /// # Ok(()) }
7899    /// ```
7900    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7901
7902    pub(crate) mod client {
7903        use super::super::super::client::GroundedGenerationService;
7904        pub struct Factory;
7905        impl crate::ClientFactory for Factory {
7906            type Client = GroundedGenerationService;
7907            type Credentials = gaxi::options::Credentials;
7908            async fn build(
7909                self,
7910                config: gaxi::options::ClientConfig,
7911            ) -> crate::ClientBuilderResult<Self::Client> {
7912                Self::Client::new(config).await
7913            }
7914        }
7915    }
7916
7917    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7918    #[derive(Clone, Debug)]
7919    pub(crate) struct RequestBuilder<R: std::default::Default> {
7920        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7921        request: R,
7922        options: crate::RequestOptions,
7923    }
7924
7925    impl<R> RequestBuilder<R>
7926    where
7927        R: std::default::Default,
7928    {
7929        pub(crate) fn new(
7930            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7931        ) -> Self {
7932            Self {
7933                stub,
7934                request: R::default(),
7935                options: crate::RequestOptions::default(),
7936            }
7937        }
7938    }
7939
7940    /// Common implementation for [crate::client::GroundedGenerationService] bidi stream builders.
7941    #[derive(Clone, Debug)]
7942    pub(crate) struct BidiStreamBuilder {
7943        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7944        options: crate::RequestOptions,
7945    }
7946
7947    impl BidiStreamBuilder {
7948        pub(crate) fn new(
7949            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7950        ) -> Self {
7951            Self {
7952                stub,
7953                options: crate::RequestOptions::default(),
7954            }
7955        }
7956    }
7957
7958    /// The request builder for [GroundedGenerationService::stream_generate_grounded_content][crate::client::GroundedGenerationService::stream_generate_grounded_content] calls.
7959    ///
7960    /// # Example
7961    /// ```
7962    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::StreamGenerateGroundedContent;
7963    /// # use google_cloud_discoveryengine_v1::model::GenerateGroundedContentRequest;
7964    /// # async fn sample() -> anyhow::Result<()> {
7965    /// let builder = prepare_request_builder();
7966    /// let (sender, mut resp_stream) = builder.build();
7967    ///
7968    /// sender.send(GenerateGroundedContentRequest::default()).await?;
7969    /// drop(sender); // Half-close the stream
7970    ///
7971    /// while let Some(response) = resp_stream.next().await {
7972    ///     let response = response?;
7973    ///     println!("response {:?}", response);
7974    /// }
7975    /// # Ok(()) }
7976    ///
7977    /// fn prepare_request_builder() -> StreamGenerateGroundedContent {
7978    ///   # panic!();
7979    ///   // ... details omitted ...
7980    /// }
7981    /// ```
7982    #[derive(Clone, Debug)]
7983    pub struct StreamGenerateGroundedContent(BidiStreamBuilder);
7984
7985    impl StreamGenerateGroundedContent {
7986        pub(crate) fn new(
7987            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7988        ) -> Self {
7989            Self(BidiStreamBuilder::new(stub))
7990        }
7991
7992        /// Sets all the options, replacing any prior values.
7993        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7994            self.0.options = v.into();
7995            self
7996        }
7997
7998        /// Initiates the bidirectional stream.
7999        pub fn build(
8000            self,
8001        ) -> (
8002            google_cloud_gax::streaming::RequestSender<
8003                crate::model::GenerateGroundedContentRequest,
8004            >,
8005            google_cloud_gax::streaming::ResponseStream<
8006                crate::model::GenerateGroundedContentResponse,
8007            >,
8008        ) {
8009            (*self.0.stub).stream_generate_grounded_content(self.0.options)
8010        }
8011    }
8012
8013    #[doc(hidden)]
8014    impl crate::RequestBuilder for StreamGenerateGroundedContent {
8015        fn request_options(&mut self) -> &mut crate::RequestOptions {
8016            &mut self.0.options
8017        }
8018    }
8019
8020    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
8021    ///
8022    /// # Example
8023    /// ```
8024    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GenerateGroundedContent;
8025    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8026    ///
8027    /// let builder = prepare_request_builder();
8028    /// let response = builder.send().await?;
8029    /// # Ok(()) }
8030    ///
8031    /// fn prepare_request_builder() -> GenerateGroundedContent {
8032    ///   # panic!();
8033    ///   // ... details omitted ...
8034    /// }
8035    /// ```
8036    #[derive(Clone, Debug)]
8037    pub struct GenerateGroundedContent(
8038        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
8039    );
8040
8041    impl GenerateGroundedContent {
8042        pub(crate) fn new(
8043            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8044        ) -> Self {
8045            Self(RequestBuilder::new(stub))
8046        }
8047
8048        /// Sets the full request, replacing any prior values.
8049        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
8050            mut self,
8051            v: V,
8052        ) -> Self {
8053            self.0.request = v.into();
8054            self
8055        }
8056
8057        /// Sets all the options, replacing any prior values.
8058        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8059            self.0.options = v.into();
8060            self
8061        }
8062
8063        /// Sends the request.
8064        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
8065            (*self.0.stub)
8066                .generate_grounded_content(self.0.request, self.0.options)
8067                .await
8068                .map(crate::Response::into_body)
8069        }
8070
8071        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
8072        ///
8073        /// This is a **required** field for requests.
8074        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
8075            self.0.request.location = v.into();
8076            self
8077        }
8078
8079        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
8080        pub fn set_system_instruction<T>(mut self, v: T) -> Self
8081        where
8082            T: std::convert::Into<crate::model::GroundedGenerationContent>,
8083        {
8084            self.0.request.system_instruction = std::option::Option::Some(v.into());
8085            self
8086        }
8087
8088        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
8089        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
8090        where
8091            T: std::convert::Into<crate::model::GroundedGenerationContent>,
8092        {
8093            self.0.request.system_instruction = v.map(|x| x.into());
8094            self
8095        }
8096
8097        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
8098        pub fn set_contents<T, V>(mut self, v: T) -> Self
8099        where
8100            T: std::iter::IntoIterator<Item = V>,
8101            V: std::convert::Into<crate::model::GroundedGenerationContent>,
8102        {
8103            use std::iter::Iterator;
8104            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
8105            self
8106        }
8107
8108        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
8109        pub fn set_generation_spec<T>(mut self, v: T) -> Self
8110        where
8111            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
8112        {
8113            self.0.request.generation_spec = std::option::Option::Some(v.into());
8114            self
8115        }
8116
8117        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
8118        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
8119        where
8120            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
8121        {
8122            self.0.request.generation_spec = v.map(|x| x.into());
8123            self
8124        }
8125
8126        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
8127        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
8128        where
8129            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
8130        {
8131            self.0.request.grounding_spec = std::option::Option::Some(v.into());
8132            self
8133        }
8134
8135        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
8136        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
8137        where
8138            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
8139        {
8140            self.0.request.grounding_spec = v.map(|x| x.into());
8141            self
8142        }
8143
8144        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
8145        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8146        where
8147            T: std::iter::IntoIterator<Item = (K, V)>,
8148            K: std::convert::Into<std::string::String>,
8149            V: std::convert::Into<std::string::String>,
8150        {
8151            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8152            self
8153        }
8154    }
8155
8156    #[doc(hidden)]
8157    impl crate::RequestBuilder for GenerateGroundedContent {
8158        fn request_options(&mut self) -> &mut crate::RequestOptions {
8159            &mut self.0.options
8160        }
8161    }
8162
8163    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
8164    ///
8165    /// # Example
8166    /// ```
8167    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CheckGrounding;
8168    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8169    ///
8170    /// let builder = prepare_request_builder();
8171    /// let response = builder.send().await?;
8172    /// # Ok(()) }
8173    ///
8174    /// fn prepare_request_builder() -> CheckGrounding {
8175    ///   # panic!();
8176    ///   // ... details omitted ...
8177    /// }
8178    /// ```
8179    #[derive(Clone, Debug)]
8180    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
8181
8182    impl CheckGrounding {
8183        pub(crate) fn new(
8184            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8185        ) -> Self {
8186            Self(RequestBuilder::new(stub))
8187        }
8188
8189        /// Sets the full request, replacing any prior values.
8190        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
8191            self.0.request = v.into();
8192            self
8193        }
8194
8195        /// Sets all the options, replacing any prior values.
8196        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8197            self.0.options = v.into();
8198            self
8199        }
8200
8201        /// Sends the request.
8202        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
8203            (*self.0.stub)
8204                .check_grounding(self.0.request, self.0.options)
8205                .await
8206                .map(crate::Response::into_body)
8207        }
8208
8209        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
8210        ///
8211        /// This is a **required** field for requests.
8212        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
8213            self.0.request.grounding_config = v.into();
8214            self
8215        }
8216
8217        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
8218        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
8219            self.0.request.answer_candidate = v.into();
8220            self
8221        }
8222
8223        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
8224        pub fn set_facts<T, V>(mut self, v: T) -> Self
8225        where
8226            T: std::iter::IntoIterator<Item = V>,
8227            V: std::convert::Into<crate::model::GroundingFact>,
8228        {
8229            use std::iter::Iterator;
8230            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
8231            self
8232        }
8233
8234        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
8235        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
8236        where
8237            T: std::convert::Into<crate::model::CheckGroundingSpec>,
8238        {
8239            self.0.request.grounding_spec = std::option::Option::Some(v.into());
8240            self
8241        }
8242
8243        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
8244        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
8245        where
8246            T: std::convert::Into<crate::model::CheckGroundingSpec>,
8247        {
8248            self.0.request.grounding_spec = v.map(|x| x.into());
8249            self
8250        }
8251
8252        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
8253        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8254        where
8255            T: std::iter::IntoIterator<Item = (K, V)>,
8256            K: std::convert::Into<std::string::String>,
8257            V: std::convert::Into<std::string::String>,
8258        {
8259            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8260            self
8261        }
8262    }
8263
8264    #[doc(hidden)]
8265    impl crate::RequestBuilder for CheckGrounding {
8266        fn request_options(&mut self) -> &mut crate::RequestOptions {
8267            &mut self.0.options
8268        }
8269    }
8270
8271    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
8272    ///
8273    /// # Example
8274    /// ```
8275    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::ListOperations;
8276    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8277    /// use google_cloud_gax::paginator::ItemPaginator;
8278    ///
8279    /// let builder = prepare_request_builder();
8280    /// let mut items = builder.by_item();
8281    /// while let Some(result) = items.next().await {
8282    ///   let item = result?;
8283    /// }
8284    /// # Ok(()) }
8285    ///
8286    /// fn prepare_request_builder() -> ListOperations {
8287    ///   # panic!();
8288    ///   // ... details omitted ...
8289    /// }
8290    /// ```
8291    #[derive(Clone, Debug)]
8292    pub struct ListOperations(
8293        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8294    );
8295
8296    impl ListOperations {
8297        pub(crate) fn new(
8298            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8299        ) -> Self {
8300            Self(RequestBuilder::new(stub))
8301        }
8302
8303        /// Sets the full request, replacing any prior values.
8304        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8305            mut self,
8306            v: V,
8307        ) -> Self {
8308            self.0.request = v.into();
8309            self
8310        }
8311
8312        /// Sets all the options, replacing any prior values.
8313        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8314            self.0.options = v.into();
8315            self
8316        }
8317
8318        /// Sends the request.
8319        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8320            (*self.0.stub)
8321                .list_operations(self.0.request, self.0.options)
8322                .await
8323                .map(crate::Response::into_body)
8324        }
8325
8326        /// Streams each page in the collection.
8327        pub fn by_page(
8328            self,
8329        ) -> impl google_cloud_gax::paginator::Paginator<
8330            google_cloud_longrunning::model::ListOperationsResponse,
8331            crate::Error,
8332        > {
8333            use std::clone::Clone;
8334            let token = self.0.request.page_token.clone();
8335            let execute = move |token: String| {
8336                let mut builder = self.clone();
8337                builder.0.request = builder.0.request.set_page_token(token);
8338                builder.send()
8339            };
8340            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8341        }
8342
8343        /// Streams each item in the collection.
8344        pub fn by_item(
8345            self,
8346        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8347            google_cloud_longrunning::model::ListOperationsResponse,
8348            crate::Error,
8349        > {
8350            use google_cloud_gax::paginator::Paginator;
8351            self.by_page().items()
8352        }
8353
8354        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
8355        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8356            self.0.request.name = v.into();
8357            self
8358        }
8359
8360        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
8361        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8362            self.0.request.filter = v.into();
8363            self
8364        }
8365
8366        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
8367        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8368            self.0.request.page_size = v.into();
8369            self
8370        }
8371
8372        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
8373        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8374            self.0.request.page_token = v.into();
8375            self
8376        }
8377
8378        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
8379        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8380            self.0.request.return_partial_success = v.into();
8381            self
8382        }
8383    }
8384
8385    #[doc(hidden)]
8386    impl crate::RequestBuilder for ListOperations {
8387        fn request_options(&mut self) -> &mut crate::RequestOptions {
8388            &mut self.0.options
8389        }
8390    }
8391
8392    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
8393    ///
8394    /// # Example
8395    /// ```
8396    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GetOperation;
8397    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8398    ///
8399    /// let builder = prepare_request_builder();
8400    /// let response = builder.send().await?;
8401    /// # Ok(()) }
8402    ///
8403    /// fn prepare_request_builder() -> GetOperation {
8404    ///   # panic!();
8405    ///   // ... details omitted ...
8406    /// }
8407    /// ```
8408    #[derive(Clone, Debug)]
8409    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8410
8411    impl GetOperation {
8412        pub(crate) fn new(
8413            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8414        ) -> Self {
8415            Self(RequestBuilder::new(stub))
8416        }
8417
8418        /// Sets the full request, replacing any prior values.
8419        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8420            mut self,
8421            v: V,
8422        ) -> Self {
8423            self.0.request = v.into();
8424            self
8425        }
8426
8427        /// Sets all the options, replacing any prior values.
8428        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8429            self.0.options = v.into();
8430            self
8431        }
8432
8433        /// Sends the request.
8434        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8435            (*self.0.stub)
8436                .get_operation(self.0.request, self.0.options)
8437                .await
8438                .map(crate::Response::into_body)
8439        }
8440
8441        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
8442        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8443            self.0.request.name = v.into();
8444            self
8445        }
8446    }
8447
8448    #[doc(hidden)]
8449    impl crate::RequestBuilder for GetOperation {
8450        fn request_options(&mut self) -> &mut crate::RequestOptions {
8451            &mut self.0.options
8452        }
8453    }
8454
8455    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
8456    ///
8457    /// # Example
8458    /// ```
8459    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CancelOperation;
8460    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8461    ///
8462    /// let builder = prepare_request_builder();
8463    /// let response = builder.send().await?;
8464    /// # Ok(()) }
8465    ///
8466    /// fn prepare_request_builder() -> CancelOperation {
8467    ///   # panic!();
8468    ///   // ... details omitted ...
8469    /// }
8470    /// ```
8471    #[derive(Clone, Debug)]
8472    pub struct CancelOperation(
8473        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8474    );
8475
8476    impl CancelOperation {
8477        pub(crate) fn new(
8478            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8479        ) -> Self {
8480            Self(RequestBuilder::new(stub))
8481        }
8482
8483        /// Sets the full request, replacing any prior values.
8484        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8485            mut self,
8486            v: V,
8487        ) -> Self {
8488            self.0.request = v.into();
8489            self
8490        }
8491
8492        /// Sets all the options, replacing any prior values.
8493        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8494            self.0.options = v.into();
8495            self
8496        }
8497
8498        /// Sends the request.
8499        pub async fn send(self) -> Result<()> {
8500            (*self.0.stub)
8501                .cancel_operation(self.0.request, self.0.options)
8502                .await
8503                .map(crate::Response::into_body)
8504        }
8505
8506        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
8507        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8508            self.0.request.name = v.into();
8509            self
8510        }
8511    }
8512
8513    #[doc(hidden)]
8514    impl crate::RequestBuilder for CancelOperation {
8515        fn request_options(&mut self) -> &mut crate::RequestOptions {
8516            &mut self.0.options
8517        }
8518    }
8519}
8520
8521/// Request and client builders for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
8522#[cfg(feature = "identity-mapping-store-service")]
8523#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
8524pub mod identity_mapping_store_service {
8525    use crate::Result;
8526
8527    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
8528    ///
8529    /// ```
8530    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8531    /// # use google_cloud_discoveryengine_v1::*;
8532    /// # use builder::identity_mapping_store_service::ClientBuilder;
8533    /// # use client::IdentityMappingStoreService;
8534    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
8535    /// let client = builder
8536    ///     .with_endpoint("https://discoveryengine.googleapis.com")
8537    ///     .build().await?;
8538    /// # Ok(()) }
8539    /// ```
8540    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8541
8542    pub(crate) mod client {
8543        use super::super::super::client::IdentityMappingStoreService;
8544        pub struct Factory;
8545        impl crate::ClientFactory for Factory {
8546            type Client = IdentityMappingStoreService;
8547            type Credentials = gaxi::options::Credentials;
8548            async fn build(
8549                self,
8550                config: gaxi::options::ClientConfig,
8551            ) -> crate::ClientBuilderResult<Self::Client> {
8552                Self::Client::new(config).await
8553            }
8554        }
8555    }
8556
8557    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
8558    #[derive(Clone, Debug)]
8559    pub(crate) struct RequestBuilder<R: std::default::Default> {
8560        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8561        request: R,
8562        options: crate::RequestOptions,
8563    }
8564
8565    impl<R> RequestBuilder<R>
8566    where
8567        R: std::default::Default,
8568    {
8569        pub(crate) fn new(
8570            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8571        ) -> Self {
8572            Self {
8573                stub,
8574                request: R::default(),
8575                options: crate::RequestOptions::default(),
8576            }
8577        }
8578    }
8579
8580    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
8581    ///
8582    /// # Example
8583    /// ```
8584    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CreateIdentityMappingStore;
8585    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8586    ///
8587    /// let builder = prepare_request_builder();
8588    /// let response = builder.send().await?;
8589    /// # Ok(()) }
8590    ///
8591    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
8592    ///   # panic!();
8593    ///   // ... details omitted ...
8594    /// }
8595    /// ```
8596    #[derive(Clone, Debug)]
8597    pub struct CreateIdentityMappingStore(
8598        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8599    );
8600
8601    impl CreateIdentityMappingStore {
8602        pub(crate) fn new(
8603            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8604        ) -> Self {
8605            Self(RequestBuilder::new(stub))
8606        }
8607
8608        /// Sets the full request, replacing any prior values.
8609        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8610            mut self,
8611            v: V,
8612        ) -> Self {
8613            self.0.request = v.into();
8614            self
8615        }
8616
8617        /// Sets all the options, replacing any prior values.
8618        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8619            self.0.options = v.into();
8620            self
8621        }
8622
8623        /// Sends the request.
8624        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8625            (*self.0.stub)
8626                .create_identity_mapping_store(self.0.request, self.0.options)
8627                .await
8628                .map(crate::Response::into_body)
8629        }
8630
8631        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
8632        ///
8633        /// This is a **required** field for requests.
8634        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8635            self.0.request.parent = v.into();
8636            self
8637        }
8638
8639        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
8640        ///
8641        /// This is a **required** field for requests.
8642        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8643            self.0.request.identity_mapping_store_id = v.into();
8644            self
8645        }
8646
8647        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8648        ///
8649        /// This is a **required** field for requests.
8650        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8651        where
8652            T: std::convert::Into<crate::model::IdentityMappingStore>,
8653        {
8654            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8655            self
8656        }
8657
8658        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8659        ///
8660        /// This is a **required** field for requests.
8661        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8662        where
8663            T: std::convert::Into<crate::model::IdentityMappingStore>,
8664        {
8665            self.0.request.identity_mapping_store = v.map(|x| x.into());
8666            self
8667        }
8668
8669        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
8670        ///
8671        /// Note that all the setters affecting `cmek_options` are
8672        /// mutually exclusive.
8673        pub fn set_cmek_options<
8674            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8675        >(
8676            mut self,
8677            v: T,
8678        ) -> Self {
8679            self.0.request.cmek_options = v.into();
8680            self
8681        }
8682
8683        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8684        /// to hold a `CmekConfigName`.
8685        ///
8686        /// Note that all the setters affecting `cmek_options` are
8687        /// mutually exclusive.
8688        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8689            mut self,
8690            v: T,
8691        ) -> Self {
8692            self.0.request = self.0.request.set_cmek_config_name(v);
8693            self
8694        }
8695
8696        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8697        /// to hold a `DisableCmek`.
8698        ///
8699        /// Note that all the setters affecting `cmek_options` are
8700        /// mutually exclusive.
8701        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8702            self.0.request = self.0.request.set_disable_cmek(v);
8703            self
8704        }
8705    }
8706
8707    #[doc(hidden)]
8708    impl crate::RequestBuilder for CreateIdentityMappingStore {
8709        fn request_options(&mut self) -> &mut crate::RequestOptions {
8710            &mut self.0.options
8711        }
8712    }
8713
8714    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8715    ///
8716    /// # Example
8717    /// ```
8718    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetIdentityMappingStore;
8719    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8720    ///
8721    /// let builder = prepare_request_builder();
8722    /// let response = builder.send().await?;
8723    /// # Ok(()) }
8724    ///
8725    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8726    ///   # panic!();
8727    ///   // ... details omitted ...
8728    /// }
8729    /// ```
8730    #[derive(Clone, Debug)]
8731    pub struct GetIdentityMappingStore(
8732        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8733    );
8734
8735    impl GetIdentityMappingStore {
8736        pub(crate) fn new(
8737            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8738        ) -> Self {
8739            Self(RequestBuilder::new(stub))
8740        }
8741
8742        /// Sets the full request, replacing any prior values.
8743        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8744            mut self,
8745            v: V,
8746        ) -> Self {
8747            self.0.request = v.into();
8748            self
8749        }
8750
8751        /// Sets all the options, replacing any prior values.
8752        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8753            self.0.options = v.into();
8754            self
8755        }
8756
8757        /// Sends the request.
8758        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8759            (*self.0.stub)
8760                .get_identity_mapping_store(self.0.request, self.0.options)
8761                .await
8762                .map(crate::Response::into_body)
8763        }
8764
8765        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8766        ///
8767        /// This is a **required** field for requests.
8768        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8769            self.0.request.name = v.into();
8770            self
8771        }
8772    }
8773
8774    #[doc(hidden)]
8775    impl crate::RequestBuilder for GetIdentityMappingStore {
8776        fn request_options(&mut self) -> &mut crate::RequestOptions {
8777            &mut self.0.options
8778        }
8779    }
8780
8781    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8782    ///
8783    /// # Example
8784    /// ```
8785    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8786    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8787    /// use google_cloud_lro::Poller;
8788    ///
8789    /// let builder = prepare_request_builder();
8790    /// let response = builder.poller().until_done().await?;
8791    /// # Ok(()) }
8792    ///
8793    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8794    ///   # panic!();
8795    ///   // ... details omitted ...
8796    /// }
8797    /// ```
8798    #[derive(Clone, Debug)]
8799    pub struct DeleteIdentityMappingStore(
8800        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8801    );
8802
8803    impl DeleteIdentityMappingStore {
8804        pub(crate) fn new(
8805            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8806        ) -> Self {
8807            Self(RequestBuilder::new(stub))
8808        }
8809
8810        /// Sets the full request, replacing any prior values.
8811        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8812            mut self,
8813            v: V,
8814        ) -> Self {
8815            self.0.request = v.into();
8816            self
8817        }
8818
8819        /// Sets all the options, replacing any prior values.
8820        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8821            self.0.options = v.into();
8822            self
8823        }
8824
8825        /// Sends the request.
8826        ///
8827        /// # Long running operations
8828        ///
8829        /// This starts, but does not poll, a longrunning operation. More information
8830        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8831        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8832            (*self.0.stub)
8833                .delete_identity_mapping_store(self.0.request, self.0.options)
8834                .await
8835                .map(crate::Response::into_body)
8836        }
8837
8838        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_identity_mapping_store`.
8839        pub fn poller(
8840            self,
8841        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8842        {
8843            type Operation = google_cloud_lro::internal::Operation<
8844                wkt::Empty,
8845                crate::model::DeleteIdentityMappingStoreMetadata,
8846            >;
8847            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8848            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8849            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8850            if let Some(ref mut details) = poller_options.tracing {
8851                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::delete_identity_mapping_store::until_done";
8852            }
8853
8854            let stub = self.0.stub.clone();
8855            let mut options = self.0.options.clone();
8856            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8857            let query = move |name| {
8858                let stub = stub.clone();
8859                let options = options.clone();
8860                async {
8861                    let op = GetOperation::new(stub)
8862                        .set_name(name)
8863                        .with_options(options)
8864                        .send()
8865                        .await?;
8866                    Ok(Operation::new(op))
8867                }
8868            };
8869
8870            let start = move || async {
8871                let op = self.send().await?;
8872                Ok(Operation::new(op))
8873            };
8874
8875            use google_cloud_lro::internal::PollerExt;
8876            {
8877                google_cloud_lro::internal::new_unit_response_poller(
8878                    polling_error_policy,
8879                    polling_backoff_policy,
8880                    start,
8881                    query,
8882                )
8883            }
8884            .with_options(poller_options)
8885        }
8886
8887        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8888        ///
8889        /// This is a **required** field for requests.
8890        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8891            self.0.request.name = v.into();
8892            self
8893        }
8894    }
8895
8896    #[doc(hidden)]
8897    impl crate::RequestBuilder for DeleteIdentityMappingStore {
8898        fn request_options(&mut self) -> &mut crate::RequestOptions {
8899            &mut self.0.options
8900        }
8901    }
8902
8903    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8904    ///
8905    /// # Example
8906    /// ```
8907    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ImportIdentityMappings;
8908    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8909    /// use google_cloud_lro::Poller;
8910    ///
8911    /// let builder = prepare_request_builder();
8912    /// let response = builder.poller().until_done().await?;
8913    /// # Ok(()) }
8914    ///
8915    /// fn prepare_request_builder() -> ImportIdentityMappings {
8916    ///   # panic!();
8917    ///   // ... details omitted ...
8918    /// }
8919    /// ```
8920    #[derive(Clone, Debug)]
8921    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8922
8923    impl ImportIdentityMappings {
8924        pub(crate) fn new(
8925            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8926        ) -> Self {
8927            Self(RequestBuilder::new(stub))
8928        }
8929
8930        /// Sets the full request, replacing any prior values.
8931        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8932            mut self,
8933            v: V,
8934        ) -> Self {
8935            self.0.request = v.into();
8936            self
8937        }
8938
8939        /// Sets all the options, replacing any prior values.
8940        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8941            self.0.options = v.into();
8942            self
8943        }
8944
8945        /// Sends the request.
8946        ///
8947        /// # Long running operations
8948        ///
8949        /// This starts, but does not poll, a longrunning operation. More information
8950        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8951        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8952            (*self.0.stub)
8953                .import_identity_mappings(self.0.request, self.0.options)
8954                .await
8955                .map(crate::Response::into_body)
8956        }
8957
8958        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_identity_mappings`.
8959        pub fn poller(
8960            self,
8961        ) -> impl google_cloud_lro::Poller<
8962            crate::model::ImportIdentityMappingsResponse,
8963            crate::model::IdentityMappingEntryOperationMetadata,
8964        > {
8965            type Operation = google_cloud_lro::internal::Operation<
8966                crate::model::ImportIdentityMappingsResponse,
8967                crate::model::IdentityMappingEntryOperationMetadata,
8968            >;
8969            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8970            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8971            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8972            if let Some(ref mut details) = poller_options.tracing {
8973                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::import_identity_mappings::until_done";
8974            }
8975
8976            let stub = self.0.stub.clone();
8977            let mut options = self.0.options.clone();
8978            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8979            let query = move |name| {
8980                let stub = stub.clone();
8981                let options = options.clone();
8982                async {
8983                    let op = GetOperation::new(stub)
8984                        .set_name(name)
8985                        .with_options(options)
8986                        .send()
8987                        .await?;
8988                    Ok(Operation::new(op))
8989                }
8990            };
8991
8992            let start = move || async {
8993                let op = self.send().await?;
8994                Ok(Operation::new(op))
8995            };
8996
8997            use google_cloud_lro::internal::PollerExt;
8998            {
8999                google_cloud_lro::internal::new_poller(
9000                    polling_error_policy,
9001                    polling_backoff_policy,
9002                    start,
9003                    query,
9004                )
9005            }
9006            .with_options(poller_options)
9007        }
9008
9009        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
9010        ///
9011        /// This is a **required** field for requests.
9012        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9013            self.0.request.identity_mapping_store = v.into();
9014            self
9015        }
9016
9017        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
9018        ///
9019        /// Note that all the setters affecting `source` are
9020        /// mutually exclusive.
9021        pub fn set_source<
9022            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
9023        >(
9024            mut self,
9025            v: T,
9026        ) -> Self {
9027            self.0.request.source = v.into();
9028            self
9029        }
9030
9031        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
9032        /// to hold a `InlineSource`.
9033        ///
9034        /// Note that all the setters affecting `source` are
9035        /// mutually exclusive.
9036        pub fn set_inline_source<
9037            T: std::convert::Into<
9038                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
9039                >,
9040        >(
9041            mut self,
9042            v: T,
9043        ) -> Self {
9044            self.0.request = self.0.request.set_inline_source(v);
9045            self
9046        }
9047    }
9048
9049    #[doc(hidden)]
9050    impl crate::RequestBuilder for ImportIdentityMappings {
9051        fn request_options(&mut self) -> &mut crate::RequestOptions {
9052            &mut self.0.options
9053        }
9054    }
9055
9056    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
9057    ///
9058    /// # Example
9059    /// ```
9060    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::PurgeIdentityMappings;
9061    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9062    /// use google_cloud_lro::Poller;
9063    ///
9064    /// let builder = prepare_request_builder();
9065    /// let response = builder.poller().until_done().await?;
9066    /// # Ok(()) }
9067    ///
9068    /// fn prepare_request_builder() -> PurgeIdentityMappings {
9069    ///   # panic!();
9070    ///   // ... details omitted ...
9071    /// }
9072    /// ```
9073    #[derive(Clone, Debug)]
9074    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
9075
9076    impl PurgeIdentityMappings {
9077        pub(crate) fn new(
9078            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9079        ) -> Self {
9080            Self(RequestBuilder::new(stub))
9081        }
9082
9083        /// Sets the full request, replacing any prior values.
9084        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
9085            mut self,
9086            v: V,
9087        ) -> Self {
9088            self.0.request = v.into();
9089            self
9090        }
9091
9092        /// Sets all the options, replacing any prior values.
9093        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9094            self.0.options = v.into();
9095            self
9096        }
9097
9098        /// Sends the request.
9099        ///
9100        /// # Long running operations
9101        ///
9102        /// This starts, but does not poll, a longrunning operation. More information
9103        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
9104        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9105            (*self.0.stub)
9106                .purge_identity_mappings(self.0.request, self.0.options)
9107                .await
9108                .map(crate::Response::into_body)
9109        }
9110
9111        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_identity_mappings`.
9112        pub fn poller(
9113            self,
9114        ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
9115        {
9116            type Operation = google_cloud_lro::internal::Operation<
9117                wkt::Empty,
9118                crate::model::IdentityMappingEntryOperationMetadata,
9119            >;
9120            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9121            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9122            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9123            if let Some(ref mut details) = poller_options.tracing {
9124                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::purge_identity_mappings::until_done";
9125            }
9126
9127            let stub = self.0.stub.clone();
9128            let mut options = self.0.options.clone();
9129            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9130            let query = move |name| {
9131                let stub = stub.clone();
9132                let options = options.clone();
9133                async {
9134                    let op = GetOperation::new(stub)
9135                        .set_name(name)
9136                        .with_options(options)
9137                        .send()
9138                        .await?;
9139                    Ok(Operation::new(op))
9140                }
9141            };
9142
9143            let start = move || async {
9144                let op = self.send().await?;
9145                Ok(Operation::new(op))
9146            };
9147
9148            use google_cloud_lro::internal::PollerExt;
9149            {
9150                google_cloud_lro::internal::new_unit_response_poller(
9151                    polling_error_policy,
9152                    polling_backoff_policy,
9153                    start,
9154                    query,
9155                )
9156            }
9157            .with_options(poller_options)
9158        }
9159
9160        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
9161        ///
9162        /// This is a **required** field for requests.
9163        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9164            self.0.request.identity_mapping_store = v.into();
9165            self
9166        }
9167
9168        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
9169        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9170            self.0.request.filter = v.into();
9171            self
9172        }
9173
9174        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
9175        pub fn set_force<T>(mut self, v: T) -> Self
9176        where
9177            T: std::convert::Into<bool>,
9178        {
9179            self.0.request.force = std::option::Option::Some(v.into());
9180            self
9181        }
9182
9183        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
9184        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
9185        where
9186            T: std::convert::Into<bool>,
9187        {
9188            self.0.request.force = v.map(|x| x.into());
9189            self
9190        }
9191
9192        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
9193        ///
9194        /// Note that all the setters affecting `source` are
9195        /// mutually exclusive.
9196        pub fn set_source<
9197            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
9198        >(
9199            mut self,
9200            v: T,
9201        ) -> Self {
9202            self.0.request.source = v.into();
9203            self
9204        }
9205
9206        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
9207        /// to hold a `InlineSource`.
9208        ///
9209        /// Note that all the setters affecting `source` are
9210        /// mutually exclusive.
9211        pub fn set_inline_source<
9212            T: std::convert::Into<
9213                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
9214                >,
9215        >(
9216            mut self,
9217            v: T,
9218        ) -> Self {
9219            self.0.request = self.0.request.set_inline_source(v);
9220            self
9221        }
9222    }
9223
9224    #[doc(hidden)]
9225    impl crate::RequestBuilder for PurgeIdentityMappings {
9226        fn request_options(&mut self) -> &mut crate::RequestOptions {
9227            &mut self.0.options
9228        }
9229    }
9230
9231    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
9232    ///
9233    /// # Example
9234    /// ```
9235    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappings;
9236    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9237    /// use google_cloud_gax::paginator::ItemPaginator;
9238    ///
9239    /// let builder = prepare_request_builder();
9240    /// let mut items = builder.by_item();
9241    /// while let Some(result) = items.next().await {
9242    ///   let item = result?;
9243    /// }
9244    /// # Ok(()) }
9245    ///
9246    /// fn prepare_request_builder() -> ListIdentityMappings {
9247    ///   # panic!();
9248    ///   // ... details omitted ...
9249    /// }
9250    /// ```
9251    #[derive(Clone, Debug)]
9252    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
9253
9254    impl ListIdentityMappings {
9255        pub(crate) fn new(
9256            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9257        ) -> Self {
9258            Self(RequestBuilder::new(stub))
9259        }
9260
9261        /// Sets the full request, replacing any prior values.
9262        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
9263            mut self,
9264            v: V,
9265        ) -> Self {
9266            self.0.request = v.into();
9267            self
9268        }
9269
9270        /// Sets all the options, replacing any prior values.
9271        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9272            self.0.options = v.into();
9273            self
9274        }
9275
9276        /// Sends the request.
9277        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
9278            (*self.0.stub)
9279                .list_identity_mappings(self.0.request, self.0.options)
9280                .await
9281                .map(crate::Response::into_body)
9282        }
9283
9284        /// Streams each page in the collection.
9285        pub fn by_page(
9286            self,
9287        ) -> impl google_cloud_gax::paginator::Paginator<
9288            crate::model::ListIdentityMappingsResponse,
9289            crate::Error,
9290        > {
9291            use std::clone::Clone;
9292            let token = self.0.request.page_token.clone();
9293            let execute = move |token: String| {
9294                let mut builder = self.clone();
9295                builder.0.request = builder.0.request.set_page_token(token);
9296                builder.send()
9297            };
9298            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9299        }
9300
9301        /// Streams each item in the collection.
9302        pub fn by_item(
9303            self,
9304        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9305            crate::model::ListIdentityMappingsResponse,
9306            crate::Error,
9307        > {
9308            use google_cloud_gax::paginator::Paginator;
9309            self.by_page().items()
9310        }
9311
9312        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
9313        ///
9314        /// This is a **required** field for requests.
9315        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9316            self.0.request.identity_mapping_store = v.into();
9317            self
9318        }
9319
9320        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
9321        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9322            self.0.request.page_size = v.into();
9323            self
9324        }
9325
9326        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
9327        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9328            self.0.request.page_token = v.into();
9329            self
9330        }
9331    }
9332
9333    #[doc(hidden)]
9334    impl crate::RequestBuilder for ListIdentityMappings {
9335        fn request_options(&mut self) -> &mut crate::RequestOptions {
9336            &mut self.0.options
9337        }
9338    }
9339
9340    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
9341    ///
9342    /// # Example
9343    /// ```
9344    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappingStores;
9345    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9346    /// use google_cloud_gax::paginator::ItemPaginator;
9347    ///
9348    /// let builder = prepare_request_builder();
9349    /// let mut items = builder.by_item();
9350    /// while let Some(result) = items.next().await {
9351    ///   let item = result?;
9352    /// }
9353    /// # Ok(()) }
9354    ///
9355    /// fn prepare_request_builder() -> ListIdentityMappingStores {
9356    ///   # panic!();
9357    ///   // ... details omitted ...
9358    /// }
9359    /// ```
9360    #[derive(Clone, Debug)]
9361    pub struct ListIdentityMappingStores(
9362        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
9363    );
9364
9365    impl ListIdentityMappingStores {
9366        pub(crate) fn new(
9367            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9368        ) -> Self {
9369            Self(RequestBuilder::new(stub))
9370        }
9371
9372        /// Sets the full request, replacing any prior values.
9373        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
9374            mut self,
9375            v: V,
9376        ) -> Self {
9377            self.0.request = v.into();
9378            self
9379        }
9380
9381        /// Sets all the options, replacing any prior values.
9382        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9383            self.0.options = v.into();
9384            self
9385        }
9386
9387        /// Sends the request.
9388        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
9389            (*self.0.stub)
9390                .list_identity_mapping_stores(self.0.request, self.0.options)
9391                .await
9392                .map(crate::Response::into_body)
9393        }
9394
9395        /// Streams each page in the collection.
9396        pub fn by_page(
9397            self,
9398        ) -> impl google_cloud_gax::paginator::Paginator<
9399            crate::model::ListIdentityMappingStoresResponse,
9400            crate::Error,
9401        > {
9402            use std::clone::Clone;
9403            let token = self.0.request.page_token.clone();
9404            let execute = move |token: String| {
9405                let mut builder = self.clone();
9406                builder.0.request = builder.0.request.set_page_token(token);
9407                builder.send()
9408            };
9409            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9410        }
9411
9412        /// Streams each item in the collection.
9413        pub fn by_item(
9414            self,
9415        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9416            crate::model::ListIdentityMappingStoresResponse,
9417            crate::Error,
9418        > {
9419            use google_cloud_gax::paginator::Paginator;
9420            self.by_page().items()
9421        }
9422
9423        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
9424        ///
9425        /// This is a **required** field for requests.
9426        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9427            self.0.request.parent = v.into();
9428            self
9429        }
9430
9431        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
9432        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9433            self.0.request.page_size = v.into();
9434            self
9435        }
9436
9437        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
9438        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9439            self.0.request.page_token = v.into();
9440            self
9441        }
9442    }
9443
9444    #[doc(hidden)]
9445    impl crate::RequestBuilder for ListIdentityMappingStores {
9446        fn request_options(&mut self) -> &mut crate::RequestOptions {
9447            &mut self.0.options
9448        }
9449    }
9450
9451    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
9452    ///
9453    /// # Example
9454    /// ```
9455    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListOperations;
9456    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9457    /// use google_cloud_gax::paginator::ItemPaginator;
9458    ///
9459    /// let builder = prepare_request_builder();
9460    /// let mut items = builder.by_item();
9461    /// while let Some(result) = items.next().await {
9462    ///   let item = result?;
9463    /// }
9464    /// # Ok(()) }
9465    ///
9466    /// fn prepare_request_builder() -> ListOperations {
9467    ///   # panic!();
9468    ///   // ... details omitted ...
9469    /// }
9470    /// ```
9471    #[derive(Clone, Debug)]
9472    pub struct ListOperations(
9473        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9474    );
9475
9476    impl ListOperations {
9477        pub(crate) fn new(
9478            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9479        ) -> Self {
9480            Self(RequestBuilder::new(stub))
9481        }
9482
9483        /// Sets the full request, replacing any prior values.
9484        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9485            mut self,
9486            v: V,
9487        ) -> Self {
9488            self.0.request = v.into();
9489            self
9490        }
9491
9492        /// Sets all the options, replacing any prior values.
9493        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9494            self.0.options = v.into();
9495            self
9496        }
9497
9498        /// Sends the request.
9499        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9500            (*self.0.stub)
9501                .list_operations(self.0.request, self.0.options)
9502                .await
9503                .map(crate::Response::into_body)
9504        }
9505
9506        /// Streams each page in the collection.
9507        pub fn by_page(
9508            self,
9509        ) -> impl google_cloud_gax::paginator::Paginator<
9510            google_cloud_longrunning::model::ListOperationsResponse,
9511            crate::Error,
9512        > {
9513            use std::clone::Clone;
9514            let token = self.0.request.page_token.clone();
9515            let execute = move |token: String| {
9516                let mut builder = self.clone();
9517                builder.0.request = builder.0.request.set_page_token(token);
9518                builder.send()
9519            };
9520            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9521        }
9522
9523        /// Streams each item in the collection.
9524        pub fn by_item(
9525            self,
9526        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9527            google_cloud_longrunning::model::ListOperationsResponse,
9528            crate::Error,
9529        > {
9530            use google_cloud_gax::paginator::Paginator;
9531            self.by_page().items()
9532        }
9533
9534        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9535        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9536            self.0.request.name = v.into();
9537            self
9538        }
9539
9540        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9541        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9542            self.0.request.filter = v.into();
9543            self
9544        }
9545
9546        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9547        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9548            self.0.request.page_size = v.into();
9549            self
9550        }
9551
9552        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9553        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9554            self.0.request.page_token = v.into();
9555            self
9556        }
9557
9558        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9559        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9560            self.0.request.return_partial_success = v.into();
9561            self
9562        }
9563    }
9564
9565    #[doc(hidden)]
9566    impl crate::RequestBuilder for ListOperations {
9567        fn request_options(&mut self) -> &mut crate::RequestOptions {
9568            &mut self.0.options
9569        }
9570    }
9571
9572    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
9573    ///
9574    /// # Example
9575    /// ```
9576    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetOperation;
9577    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9578    ///
9579    /// let builder = prepare_request_builder();
9580    /// let response = builder.send().await?;
9581    /// # Ok(()) }
9582    ///
9583    /// fn prepare_request_builder() -> GetOperation {
9584    ///   # panic!();
9585    ///   // ... details omitted ...
9586    /// }
9587    /// ```
9588    #[derive(Clone, Debug)]
9589    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9590
9591    impl GetOperation {
9592        pub(crate) fn new(
9593            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9594        ) -> Self {
9595            Self(RequestBuilder::new(stub))
9596        }
9597
9598        /// Sets the full request, replacing any prior values.
9599        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9600            mut self,
9601            v: V,
9602        ) -> Self {
9603            self.0.request = v.into();
9604            self
9605        }
9606
9607        /// Sets all the options, replacing any prior values.
9608        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9609            self.0.options = v.into();
9610            self
9611        }
9612
9613        /// Sends the request.
9614        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9615            (*self.0.stub)
9616                .get_operation(self.0.request, self.0.options)
9617                .await
9618                .map(crate::Response::into_body)
9619        }
9620
9621        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9622        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9623            self.0.request.name = v.into();
9624            self
9625        }
9626    }
9627
9628    #[doc(hidden)]
9629    impl crate::RequestBuilder for GetOperation {
9630        fn request_options(&mut self) -> &mut crate::RequestOptions {
9631            &mut self.0.options
9632        }
9633    }
9634
9635    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
9636    ///
9637    /// # Example
9638    /// ```
9639    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CancelOperation;
9640    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9641    ///
9642    /// let builder = prepare_request_builder();
9643    /// let response = builder.send().await?;
9644    /// # Ok(()) }
9645    ///
9646    /// fn prepare_request_builder() -> CancelOperation {
9647    ///   # panic!();
9648    ///   // ... details omitted ...
9649    /// }
9650    /// ```
9651    #[derive(Clone, Debug)]
9652    pub struct CancelOperation(
9653        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9654    );
9655
9656    impl CancelOperation {
9657        pub(crate) fn new(
9658            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9659        ) -> Self {
9660            Self(RequestBuilder::new(stub))
9661        }
9662
9663        /// Sets the full request, replacing any prior values.
9664        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9665            mut self,
9666            v: V,
9667        ) -> Self {
9668            self.0.request = v.into();
9669            self
9670        }
9671
9672        /// Sets all the options, replacing any prior values.
9673        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9674            self.0.options = v.into();
9675            self
9676        }
9677
9678        /// Sends the request.
9679        pub async fn send(self) -> Result<()> {
9680            (*self.0.stub)
9681                .cancel_operation(self.0.request, self.0.options)
9682                .await
9683                .map(crate::Response::into_body)
9684        }
9685
9686        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9687        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9688            self.0.request.name = v.into();
9689            self
9690        }
9691    }
9692
9693    #[doc(hidden)]
9694    impl crate::RequestBuilder for CancelOperation {
9695        fn request_options(&mut self) -> &mut crate::RequestOptions {
9696            &mut self.0.options
9697        }
9698    }
9699}
9700
9701/// Request and client builders for [ProjectService][crate::client::ProjectService].
9702#[cfg(feature = "project-service")]
9703#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9704pub mod project_service {
9705    use crate::Result;
9706
9707    /// A builder for [ProjectService][crate::client::ProjectService].
9708    ///
9709    /// ```
9710    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9711    /// # use google_cloud_discoveryengine_v1::*;
9712    /// # use builder::project_service::ClientBuilder;
9713    /// # use client::ProjectService;
9714    /// let builder : ClientBuilder = ProjectService::builder();
9715    /// let client = builder
9716    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9717    ///     .build().await?;
9718    /// # Ok(()) }
9719    /// ```
9720    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9721
9722    pub(crate) mod client {
9723        use super::super::super::client::ProjectService;
9724        pub struct Factory;
9725        impl crate::ClientFactory for Factory {
9726            type Client = ProjectService;
9727            type Credentials = gaxi::options::Credentials;
9728            async fn build(
9729                self,
9730                config: gaxi::options::ClientConfig,
9731            ) -> crate::ClientBuilderResult<Self::Client> {
9732                Self::Client::new(config).await
9733            }
9734        }
9735    }
9736
9737    /// Common implementation for [crate::client::ProjectService] request builders.
9738    #[derive(Clone, Debug)]
9739    pub(crate) struct RequestBuilder<R: std::default::Default> {
9740        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9741        request: R,
9742        options: crate::RequestOptions,
9743    }
9744
9745    impl<R> RequestBuilder<R>
9746    where
9747        R: std::default::Default,
9748    {
9749        pub(crate) fn new(
9750            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9751        ) -> Self {
9752            Self {
9753                stub,
9754                request: R::default(),
9755                options: crate::RequestOptions::default(),
9756            }
9757        }
9758    }
9759
9760    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9761    ///
9762    /// # Example
9763    /// ```
9764    /// # use google_cloud_discoveryengine_v1::builder::project_service::ProvisionProject;
9765    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9766    /// use google_cloud_lro::Poller;
9767    ///
9768    /// let builder = prepare_request_builder();
9769    /// let response = builder.poller().until_done().await?;
9770    /// # Ok(()) }
9771    ///
9772    /// fn prepare_request_builder() -> ProvisionProject {
9773    ///   # panic!();
9774    ///   // ... details omitted ...
9775    /// }
9776    /// ```
9777    #[derive(Clone, Debug)]
9778    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9779
9780    impl ProvisionProject {
9781        pub(crate) fn new(
9782            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9783        ) -> Self {
9784            Self(RequestBuilder::new(stub))
9785        }
9786
9787        /// Sets the full request, replacing any prior values.
9788        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9789            mut self,
9790            v: V,
9791        ) -> Self {
9792            self.0.request = v.into();
9793            self
9794        }
9795
9796        /// Sets all the options, replacing any prior values.
9797        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9798            self.0.options = v.into();
9799            self
9800        }
9801
9802        /// Sends the request.
9803        ///
9804        /// # Long running operations
9805        ///
9806        /// This starts, but does not poll, a longrunning operation. More information
9807        /// on [provision_project][crate::client::ProjectService::provision_project].
9808        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9809            (*self.0.stub)
9810                .provision_project(self.0.request, self.0.options)
9811                .await
9812                .map(crate::Response::into_body)
9813        }
9814
9815        /// Creates a [Poller][google_cloud_lro::Poller] to work with `provision_project`.
9816        pub fn poller(
9817            self,
9818        ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9819        {
9820            type Operation = google_cloud_lro::internal::Operation<
9821                crate::model::Project,
9822                crate::model::ProvisionProjectMetadata,
9823            >;
9824            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9825            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9826            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9827            if let Some(ref mut details) = poller_options.tracing {
9828                details.method_name = "google_cloud_discoveryengine_v1::client::ProjectService::provision_project::until_done";
9829            }
9830
9831            let stub = self.0.stub.clone();
9832            let mut options = self.0.options.clone();
9833            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9834            let query = move |name| {
9835                let stub = stub.clone();
9836                let options = options.clone();
9837                async {
9838                    let op = GetOperation::new(stub)
9839                        .set_name(name)
9840                        .with_options(options)
9841                        .send()
9842                        .await?;
9843                    Ok(Operation::new(op))
9844                }
9845            };
9846
9847            let start = move || async {
9848                let op = self.send().await?;
9849                Ok(Operation::new(op))
9850            };
9851
9852            use google_cloud_lro::internal::PollerExt;
9853            {
9854                google_cloud_lro::internal::new_poller(
9855                    polling_error_policy,
9856                    polling_backoff_policy,
9857                    start,
9858                    query,
9859                )
9860            }
9861            .with_options(poller_options)
9862        }
9863
9864        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9865        ///
9866        /// This is a **required** field for requests.
9867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9868            self.0.request.name = v.into();
9869            self
9870        }
9871
9872        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9873        ///
9874        /// This is a **required** field for requests.
9875        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9876            self.0.request.accept_data_use_terms = v.into();
9877            self
9878        }
9879
9880        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9881        ///
9882        /// This is a **required** field for requests.
9883        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9884            self.0.request.data_use_terms_version = v.into();
9885            self
9886        }
9887    }
9888
9889    #[doc(hidden)]
9890    impl crate::RequestBuilder for ProvisionProject {
9891        fn request_options(&mut self) -> &mut crate::RequestOptions {
9892            &mut self.0.options
9893        }
9894    }
9895
9896    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9897    ///
9898    /// # Example
9899    /// ```
9900    /// # use google_cloud_discoveryengine_v1::builder::project_service::ListOperations;
9901    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9902    /// use google_cloud_gax::paginator::ItemPaginator;
9903    ///
9904    /// let builder = prepare_request_builder();
9905    /// let mut items = builder.by_item();
9906    /// while let Some(result) = items.next().await {
9907    ///   let item = result?;
9908    /// }
9909    /// # Ok(()) }
9910    ///
9911    /// fn prepare_request_builder() -> ListOperations {
9912    ///   # panic!();
9913    ///   // ... details omitted ...
9914    /// }
9915    /// ```
9916    #[derive(Clone, Debug)]
9917    pub struct ListOperations(
9918        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9919    );
9920
9921    impl ListOperations {
9922        pub(crate) fn new(
9923            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9924        ) -> Self {
9925            Self(RequestBuilder::new(stub))
9926        }
9927
9928        /// Sets the full request, replacing any prior values.
9929        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9930            mut self,
9931            v: V,
9932        ) -> Self {
9933            self.0.request = v.into();
9934            self
9935        }
9936
9937        /// Sets all the options, replacing any prior values.
9938        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9939            self.0.options = v.into();
9940            self
9941        }
9942
9943        /// Sends the request.
9944        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9945            (*self.0.stub)
9946                .list_operations(self.0.request, self.0.options)
9947                .await
9948                .map(crate::Response::into_body)
9949        }
9950
9951        /// Streams each page in the collection.
9952        pub fn by_page(
9953            self,
9954        ) -> impl google_cloud_gax::paginator::Paginator<
9955            google_cloud_longrunning::model::ListOperationsResponse,
9956            crate::Error,
9957        > {
9958            use std::clone::Clone;
9959            let token = self.0.request.page_token.clone();
9960            let execute = move |token: String| {
9961                let mut builder = self.clone();
9962                builder.0.request = builder.0.request.set_page_token(token);
9963                builder.send()
9964            };
9965            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9966        }
9967
9968        /// Streams each item in the collection.
9969        pub fn by_item(
9970            self,
9971        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9972            google_cloud_longrunning::model::ListOperationsResponse,
9973            crate::Error,
9974        > {
9975            use google_cloud_gax::paginator::Paginator;
9976            self.by_page().items()
9977        }
9978
9979        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9980        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9981            self.0.request.name = v.into();
9982            self
9983        }
9984
9985        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9986        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9987            self.0.request.filter = v.into();
9988            self
9989        }
9990
9991        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9992        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9993            self.0.request.page_size = v.into();
9994            self
9995        }
9996
9997        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9998        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9999            self.0.request.page_token = v.into();
10000            self
10001        }
10002
10003        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10004        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10005            self.0.request.return_partial_success = v.into();
10006            self
10007        }
10008    }
10009
10010    #[doc(hidden)]
10011    impl crate::RequestBuilder for ListOperations {
10012        fn request_options(&mut self) -> &mut crate::RequestOptions {
10013            &mut self.0.options
10014        }
10015    }
10016
10017    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
10018    ///
10019    /// # Example
10020    /// ```
10021    /// # use google_cloud_discoveryengine_v1::builder::project_service::GetOperation;
10022    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10023    ///
10024    /// let builder = prepare_request_builder();
10025    /// let response = builder.send().await?;
10026    /// # Ok(()) }
10027    ///
10028    /// fn prepare_request_builder() -> GetOperation {
10029    ///   # panic!();
10030    ///   // ... details omitted ...
10031    /// }
10032    /// ```
10033    #[derive(Clone, Debug)]
10034    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10035
10036    impl GetOperation {
10037        pub(crate) fn new(
10038            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
10039        ) -> Self {
10040            Self(RequestBuilder::new(stub))
10041        }
10042
10043        /// Sets the full request, replacing any prior values.
10044        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10045            mut self,
10046            v: V,
10047        ) -> Self {
10048            self.0.request = v.into();
10049            self
10050        }
10051
10052        /// Sets all the options, replacing any prior values.
10053        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10054            self.0.options = v.into();
10055            self
10056        }
10057
10058        /// Sends the request.
10059        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10060            (*self.0.stub)
10061                .get_operation(self.0.request, self.0.options)
10062                .await
10063                .map(crate::Response::into_body)
10064        }
10065
10066        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10067        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10068            self.0.request.name = v.into();
10069            self
10070        }
10071    }
10072
10073    #[doc(hidden)]
10074    impl crate::RequestBuilder for GetOperation {
10075        fn request_options(&mut self) -> &mut crate::RequestOptions {
10076            &mut self.0.options
10077        }
10078    }
10079
10080    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
10081    ///
10082    /// # Example
10083    /// ```
10084    /// # use google_cloud_discoveryengine_v1::builder::project_service::CancelOperation;
10085    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10086    ///
10087    /// let builder = prepare_request_builder();
10088    /// let response = builder.send().await?;
10089    /// # Ok(()) }
10090    ///
10091    /// fn prepare_request_builder() -> CancelOperation {
10092    ///   # panic!();
10093    ///   // ... details omitted ...
10094    /// }
10095    /// ```
10096    #[derive(Clone, Debug)]
10097    pub struct CancelOperation(
10098        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10099    );
10100
10101    impl CancelOperation {
10102        pub(crate) fn new(
10103            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
10104        ) -> Self {
10105            Self(RequestBuilder::new(stub))
10106        }
10107
10108        /// Sets the full request, replacing any prior values.
10109        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10110            mut self,
10111            v: V,
10112        ) -> Self {
10113            self.0.request = v.into();
10114            self
10115        }
10116
10117        /// Sets all the options, replacing any prior values.
10118        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10119            self.0.options = v.into();
10120            self
10121        }
10122
10123        /// Sends the request.
10124        pub async fn send(self) -> Result<()> {
10125            (*self.0.stub)
10126                .cancel_operation(self.0.request, self.0.options)
10127                .await
10128                .map(crate::Response::into_body)
10129        }
10130
10131        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10132        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10133            self.0.request.name = v.into();
10134            self
10135        }
10136    }
10137
10138    #[doc(hidden)]
10139    impl crate::RequestBuilder for CancelOperation {
10140        fn request_options(&mut self) -> &mut crate::RequestOptions {
10141            &mut self.0.options
10142        }
10143    }
10144}
10145
10146/// Request and client builders for [RankService][crate::client::RankService].
10147#[cfg(feature = "rank-service")]
10148#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
10149pub mod rank_service {
10150    use crate::Result;
10151
10152    /// A builder for [RankService][crate::client::RankService].
10153    ///
10154    /// ```
10155    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10156    /// # use google_cloud_discoveryengine_v1::*;
10157    /// # use builder::rank_service::ClientBuilder;
10158    /// # use client::RankService;
10159    /// let builder : ClientBuilder = RankService::builder();
10160    /// let client = builder
10161    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10162    ///     .build().await?;
10163    /// # Ok(()) }
10164    /// ```
10165    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10166
10167    pub(crate) mod client {
10168        use super::super::super::client::RankService;
10169        pub struct Factory;
10170        impl crate::ClientFactory for Factory {
10171            type Client = RankService;
10172            type Credentials = gaxi::options::Credentials;
10173            async fn build(
10174                self,
10175                config: gaxi::options::ClientConfig,
10176            ) -> crate::ClientBuilderResult<Self::Client> {
10177                Self::Client::new(config).await
10178            }
10179        }
10180    }
10181
10182    /// Common implementation for [crate::client::RankService] request builders.
10183    #[derive(Clone, Debug)]
10184    pub(crate) struct RequestBuilder<R: std::default::Default> {
10185        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10186        request: R,
10187        options: crate::RequestOptions,
10188    }
10189
10190    impl<R> RequestBuilder<R>
10191    where
10192        R: std::default::Default,
10193    {
10194        pub(crate) fn new(
10195            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10196        ) -> Self {
10197            Self {
10198                stub,
10199                request: R::default(),
10200                options: crate::RequestOptions::default(),
10201            }
10202        }
10203    }
10204
10205    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
10206    ///
10207    /// # Example
10208    /// ```
10209    /// # use google_cloud_discoveryengine_v1::builder::rank_service::Rank;
10210    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10211    ///
10212    /// let builder = prepare_request_builder();
10213    /// let response = builder.send().await?;
10214    /// # Ok(()) }
10215    ///
10216    /// fn prepare_request_builder() -> Rank {
10217    ///   # panic!();
10218    ///   // ... details omitted ...
10219    /// }
10220    /// ```
10221    #[derive(Clone, Debug)]
10222    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
10223
10224    impl Rank {
10225        pub(crate) fn new(
10226            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10227        ) -> Self {
10228            Self(RequestBuilder::new(stub))
10229        }
10230
10231        /// Sets the full request, replacing any prior values.
10232        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
10233            self.0.request = v.into();
10234            self
10235        }
10236
10237        /// Sets all the options, replacing any prior values.
10238        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10239            self.0.options = v.into();
10240            self
10241        }
10242
10243        /// Sends the request.
10244        pub async fn send(self) -> Result<crate::model::RankResponse> {
10245            (*self.0.stub)
10246                .rank(self.0.request, self.0.options)
10247                .await
10248                .map(crate::Response::into_body)
10249        }
10250
10251        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
10252        ///
10253        /// This is a **required** field for requests.
10254        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10255            self.0.request.ranking_config = v.into();
10256            self
10257        }
10258
10259        /// Sets the value of [model][crate::model::RankRequest::model].
10260        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
10261            self.0.request.model = v.into();
10262            self
10263        }
10264
10265        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
10266        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
10267            self.0.request.top_n = v.into();
10268            self
10269        }
10270
10271        /// Sets the value of [query][crate::model::RankRequest::query].
10272        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
10273            self.0.request.query = v.into();
10274            self
10275        }
10276
10277        /// Sets the value of [records][crate::model::RankRequest::records].
10278        ///
10279        /// This is a **required** field for requests.
10280        pub fn set_records<T, V>(mut self, v: T) -> Self
10281        where
10282            T: std::iter::IntoIterator<Item = V>,
10283            V: std::convert::Into<crate::model::RankingRecord>,
10284        {
10285            use std::iter::Iterator;
10286            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
10287            self
10288        }
10289
10290        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
10291        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
10292            self.0.request.ignore_record_details_in_response = v.into();
10293            self
10294        }
10295
10296        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
10297        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10298        where
10299            T: std::iter::IntoIterator<Item = (K, V)>,
10300            K: std::convert::Into<std::string::String>,
10301            V: std::convert::Into<std::string::String>,
10302        {
10303            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10304            self
10305        }
10306    }
10307
10308    #[doc(hidden)]
10309    impl crate::RequestBuilder for Rank {
10310        fn request_options(&mut self) -> &mut crate::RequestOptions {
10311            &mut self.0.options
10312        }
10313    }
10314
10315    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
10316    ///
10317    /// # Example
10318    /// ```
10319    /// # use google_cloud_discoveryengine_v1::builder::rank_service::ListOperations;
10320    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10321    /// use google_cloud_gax::paginator::ItemPaginator;
10322    ///
10323    /// let builder = prepare_request_builder();
10324    /// let mut items = builder.by_item();
10325    /// while let Some(result) = items.next().await {
10326    ///   let item = result?;
10327    /// }
10328    /// # Ok(()) }
10329    ///
10330    /// fn prepare_request_builder() -> ListOperations {
10331    ///   # panic!();
10332    ///   // ... details omitted ...
10333    /// }
10334    /// ```
10335    #[derive(Clone, Debug)]
10336    pub struct ListOperations(
10337        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10338    );
10339
10340    impl ListOperations {
10341        pub(crate) fn new(
10342            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10343        ) -> Self {
10344            Self(RequestBuilder::new(stub))
10345        }
10346
10347        /// Sets the full request, replacing any prior values.
10348        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10349            mut self,
10350            v: V,
10351        ) -> Self {
10352            self.0.request = v.into();
10353            self
10354        }
10355
10356        /// Sets all the options, replacing any prior values.
10357        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10358            self.0.options = v.into();
10359            self
10360        }
10361
10362        /// Sends the request.
10363        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10364            (*self.0.stub)
10365                .list_operations(self.0.request, self.0.options)
10366                .await
10367                .map(crate::Response::into_body)
10368        }
10369
10370        /// Streams each page in the collection.
10371        pub fn by_page(
10372            self,
10373        ) -> impl google_cloud_gax::paginator::Paginator<
10374            google_cloud_longrunning::model::ListOperationsResponse,
10375            crate::Error,
10376        > {
10377            use std::clone::Clone;
10378            let token = self.0.request.page_token.clone();
10379            let execute = move |token: String| {
10380                let mut builder = self.clone();
10381                builder.0.request = builder.0.request.set_page_token(token);
10382                builder.send()
10383            };
10384            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10385        }
10386
10387        /// Streams each item in the collection.
10388        pub fn by_item(
10389            self,
10390        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10391            google_cloud_longrunning::model::ListOperationsResponse,
10392            crate::Error,
10393        > {
10394            use google_cloud_gax::paginator::Paginator;
10395            self.by_page().items()
10396        }
10397
10398        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
10399        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10400            self.0.request.name = v.into();
10401            self
10402        }
10403
10404        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
10405        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10406            self.0.request.filter = v.into();
10407            self
10408        }
10409
10410        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
10411        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10412            self.0.request.page_size = v.into();
10413            self
10414        }
10415
10416        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
10417        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10418            self.0.request.page_token = v.into();
10419            self
10420        }
10421
10422        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10423        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10424            self.0.request.return_partial_success = v.into();
10425            self
10426        }
10427    }
10428
10429    #[doc(hidden)]
10430    impl crate::RequestBuilder for ListOperations {
10431        fn request_options(&mut self) -> &mut crate::RequestOptions {
10432            &mut self.0.options
10433        }
10434    }
10435
10436    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
10437    ///
10438    /// # Example
10439    /// ```
10440    /// # use google_cloud_discoveryengine_v1::builder::rank_service::GetOperation;
10441    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10442    ///
10443    /// let builder = prepare_request_builder();
10444    /// let response = builder.send().await?;
10445    /// # Ok(()) }
10446    ///
10447    /// fn prepare_request_builder() -> GetOperation {
10448    ///   # panic!();
10449    ///   // ... details omitted ...
10450    /// }
10451    /// ```
10452    #[derive(Clone, Debug)]
10453    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10454
10455    impl GetOperation {
10456        pub(crate) fn new(
10457            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10458        ) -> Self {
10459            Self(RequestBuilder::new(stub))
10460        }
10461
10462        /// Sets the full request, replacing any prior values.
10463        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10464            mut self,
10465            v: V,
10466        ) -> Self {
10467            self.0.request = v.into();
10468            self
10469        }
10470
10471        /// Sets all the options, replacing any prior values.
10472        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10473            self.0.options = v.into();
10474            self
10475        }
10476
10477        /// Sends the request.
10478        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10479            (*self.0.stub)
10480                .get_operation(self.0.request, self.0.options)
10481                .await
10482                .map(crate::Response::into_body)
10483        }
10484
10485        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10486        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10487            self.0.request.name = v.into();
10488            self
10489        }
10490    }
10491
10492    #[doc(hidden)]
10493    impl crate::RequestBuilder for GetOperation {
10494        fn request_options(&mut self) -> &mut crate::RequestOptions {
10495            &mut self.0.options
10496        }
10497    }
10498
10499    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
10500    ///
10501    /// # Example
10502    /// ```
10503    /// # use google_cloud_discoveryengine_v1::builder::rank_service::CancelOperation;
10504    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10505    ///
10506    /// let builder = prepare_request_builder();
10507    /// let response = builder.send().await?;
10508    /// # Ok(()) }
10509    ///
10510    /// fn prepare_request_builder() -> CancelOperation {
10511    ///   # panic!();
10512    ///   // ... details omitted ...
10513    /// }
10514    /// ```
10515    #[derive(Clone, Debug)]
10516    pub struct CancelOperation(
10517        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10518    );
10519
10520    impl CancelOperation {
10521        pub(crate) fn new(
10522            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10523        ) -> Self {
10524            Self(RequestBuilder::new(stub))
10525        }
10526
10527        /// Sets the full request, replacing any prior values.
10528        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10529            mut self,
10530            v: V,
10531        ) -> Self {
10532            self.0.request = v.into();
10533            self
10534        }
10535
10536        /// Sets all the options, replacing any prior values.
10537        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10538            self.0.options = v.into();
10539            self
10540        }
10541
10542        /// Sends the request.
10543        pub async fn send(self) -> Result<()> {
10544            (*self.0.stub)
10545                .cancel_operation(self.0.request, self.0.options)
10546                .await
10547                .map(crate::Response::into_body)
10548        }
10549
10550        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10551        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10552            self.0.request.name = v.into();
10553            self
10554        }
10555    }
10556
10557    #[doc(hidden)]
10558    impl crate::RequestBuilder for CancelOperation {
10559        fn request_options(&mut self) -> &mut crate::RequestOptions {
10560            &mut self.0.options
10561        }
10562    }
10563}
10564
10565/// Request and client builders for [RecommendationService][crate::client::RecommendationService].
10566#[cfg(feature = "recommendation-service")]
10567#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
10568pub mod recommendation_service {
10569    use crate::Result;
10570
10571    /// A builder for [RecommendationService][crate::client::RecommendationService].
10572    ///
10573    /// ```
10574    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10575    /// # use google_cloud_discoveryengine_v1::*;
10576    /// # use builder::recommendation_service::ClientBuilder;
10577    /// # use client::RecommendationService;
10578    /// let builder : ClientBuilder = RecommendationService::builder();
10579    /// let client = builder
10580    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10581    ///     .build().await?;
10582    /// # Ok(()) }
10583    /// ```
10584    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10585
10586    pub(crate) mod client {
10587        use super::super::super::client::RecommendationService;
10588        pub struct Factory;
10589        impl crate::ClientFactory for Factory {
10590            type Client = RecommendationService;
10591            type Credentials = gaxi::options::Credentials;
10592            async fn build(
10593                self,
10594                config: gaxi::options::ClientConfig,
10595            ) -> crate::ClientBuilderResult<Self::Client> {
10596                Self::Client::new(config).await
10597            }
10598        }
10599    }
10600
10601    /// Common implementation for [crate::client::RecommendationService] request builders.
10602    #[derive(Clone, Debug)]
10603    pub(crate) struct RequestBuilder<R: std::default::Default> {
10604        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10605        request: R,
10606        options: crate::RequestOptions,
10607    }
10608
10609    impl<R> RequestBuilder<R>
10610    where
10611        R: std::default::Default,
10612    {
10613        pub(crate) fn new(
10614            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10615        ) -> Self {
10616            Self {
10617                stub,
10618                request: R::default(),
10619                options: crate::RequestOptions::default(),
10620            }
10621        }
10622    }
10623
10624    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
10625    ///
10626    /// # Example
10627    /// ```
10628    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::Recommend;
10629    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10630    ///
10631    /// let builder = prepare_request_builder();
10632    /// let response = builder.send().await?;
10633    /// # Ok(()) }
10634    ///
10635    /// fn prepare_request_builder() -> Recommend {
10636    ///   # panic!();
10637    ///   // ... details omitted ...
10638    /// }
10639    /// ```
10640    #[derive(Clone, Debug)]
10641    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10642
10643    impl Recommend {
10644        pub(crate) fn new(
10645            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10646        ) -> Self {
10647            Self(RequestBuilder::new(stub))
10648        }
10649
10650        /// Sets the full request, replacing any prior values.
10651        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10652            self.0.request = v.into();
10653            self
10654        }
10655
10656        /// Sets all the options, replacing any prior values.
10657        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10658            self.0.options = v.into();
10659            self
10660        }
10661
10662        /// Sends the request.
10663        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10664            (*self.0.stub)
10665                .recommend(self.0.request, self.0.options)
10666                .await
10667                .map(crate::Response::into_body)
10668        }
10669
10670        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
10671        ///
10672        /// This is a **required** field for requests.
10673        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10674            self.0.request.serving_config = v.into();
10675            self
10676        }
10677
10678        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
10679        ///
10680        /// This is a **required** field for requests.
10681        pub fn set_user_event<T>(mut self, v: T) -> Self
10682        where
10683            T: std::convert::Into<crate::model::UserEvent>,
10684        {
10685            self.0.request.user_event = std::option::Option::Some(v.into());
10686            self
10687        }
10688
10689        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
10690        ///
10691        /// This is a **required** field for requests.
10692        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10693        where
10694            T: std::convert::Into<crate::model::UserEvent>,
10695        {
10696            self.0.request.user_event = v.map(|x| x.into());
10697            self
10698        }
10699
10700        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
10701        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10702            self.0.request.page_size = v.into();
10703            self
10704        }
10705
10706        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
10707        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10708            self.0.request.filter = v.into();
10709            self
10710        }
10711
10712        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
10713        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10714            self.0.request.validate_only = v.into();
10715            self
10716        }
10717
10718        /// Sets the value of [params][crate::model::RecommendRequest::params].
10719        pub fn set_params<T, K, V>(mut self, v: T) -> Self
10720        where
10721            T: std::iter::IntoIterator<Item = (K, V)>,
10722            K: std::convert::Into<std::string::String>,
10723            V: std::convert::Into<wkt::Value>,
10724        {
10725            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10726            self
10727        }
10728
10729        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
10730        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10731        where
10732            T: std::iter::IntoIterator<Item = (K, V)>,
10733            K: std::convert::Into<std::string::String>,
10734            V: std::convert::Into<std::string::String>,
10735        {
10736            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10737            self
10738        }
10739    }
10740
10741    #[doc(hidden)]
10742    impl crate::RequestBuilder for Recommend {
10743        fn request_options(&mut self) -> &mut crate::RequestOptions {
10744            &mut self.0.options
10745        }
10746    }
10747
10748    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
10749    ///
10750    /// # Example
10751    /// ```
10752    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::ListOperations;
10753    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10754    /// use google_cloud_gax::paginator::ItemPaginator;
10755    ///
10756    /// let builder = prepare_request_builder();
10757    /// let mut items = builder.by_item();
10758    /// while let Some(result) = items.next().await {
10759    ///   let item = result?;
10760    /// }
10761    /// # Ok(()) }
10762    ///
10763    /// fn prepare_request_builder() -> ListOperations {
10764    ///   # panic!();
10765    ///   // ... details omitted ...
10766    /// }
10767    /// ```
10768    #[derive(Clone, Debug)]
10769    pub struct ListOperations(
10770        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10771    );
10772
10773    impl ListOperations {
10774        pub(crate) fn new(
10775            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10776        ) -> Self {
10777            Self(RequestBuilder::new(stub))
10778        }
10779
10780        /// Sets the full request, replacing any prior values.
10781        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10782            mut self,
10783            v: V,
10784        ) -> Self {
10785            self.0.request = v.into();
10786            self
10787        }
10788
10789        /// Sets all the options, replacing any prior values.
10790        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10791            self.0.options = v.into();
10792            self
10793        }
10794
10795        /// Sends the request.
10796        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10797            (*self.0.stub)
10798                .list_operations(self.0.request, self.0.options)
10799                .await
10800                .map(crate::Response::into_body)
10801        }
10802
10803        /// Streams each page in the collection.
10804        pub fn by_page(
10805            self,
10806        ) -> impl google_cloud_gax::paginator::Paginator<
10807            google_cloud_longrunning::model::ListOperationsResponse,
10808            crate::Error,
10809        > {
10810            use std::clone::Clone;
10811            let token = self.0.request.page_token.clone();
10812            let execute = move |token: String| {
10813                let mut builder = self.clone();
10814                builder.0.request = builder.0.request.set_page_token(token);
10815                builder.send()
10816            };
10817            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10818        }
10819
10820        /// Streams each item in the collection.
10821        pub fn by_item(
10822            self,
10823        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10824            google_cloud_longrunning::model::ListOperationsResponse,
10825            crate::Error,
10826        > {
10827            use google_cloud_gax::paginator::Paginator;
10828            self.by_page().items()
10829        }
10830
10831        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
10832        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10833            self.0.request.name = v.into();
10834            self
10835        }
10836
10837        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
10838        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10839            self.0.request.filter = v.into();
10840            self
10841        }
10842
10843        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
10844        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10845            self.0.request.page_size = v.into();
10846            self
10847        }
10848
10849        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
10850        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10851            self.0.request.page_token = v.into();
10852            self
10853        }
10854
10855        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10856        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10857            self.0.request.return_partial_success = v.into();
10858            self
10859        }
10860    }
10861
10862    #[doc(hidden)]
10863    impl crate::RequestBuilder for ListOperations {
10864        fn request_options(&mut self) -> &mut crate::RequestOptions {
10865            &mut self.0.options
10866        }
10867    }
10868
10869    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10870    ///
10871    /// # Example
10872    /// ```
10873    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::GetOperation;
10874    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10875    ///
10876    /// let builder = prepare_request_builder();
10877    /// let response = builder.send().await?;
10878    /// # Ok(()) }
10879    ///
10880    /// fn prepare_request_builder() -> GetOperation {
10881    ///   # panic!();
10882    ///   // ... details omitted ...
10883    /// }
10884    /// ```
10885    #[derive(Clone, Debug)]
10886    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10887
10888    impl GetOperation {
10889        pub(crate) fn new(
10890            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10891        ) -> Self {
10892            Self(RequestBuilder::new(stub))
10893        }
10894
10895        /// Sets the full request, replacing any prior values.
10896        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10897            mut self,
10898            v: V,
10899        ) -> Self {
10900            self.0.request = v.into();
10901            self
10902        }
10903
10904        /// Sets all the options, replacing any prior values.
10905        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10906            self.0.options = v.into();
10907            self
10908        }
10909
10910        /// Sends the request.
10911        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10912            (*self.0.stub)
10913                .get_operation(self.0.request, self.0.options)
10914                .await
10915                .map(crate::Response::into_body)
10916        }
10917
10918        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10919        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10920            self.0.request.name = v.into();
10921            self
10922        }
10923    }
10924
10925    #[doc(hidden)]
10926    impl crate::RequestBuilder for GetOperation {
10927        fn request_options(&mut self) -> &mut crate::RequestOptions {
10928            &mut self.0.options
10929        }
10930    }
10931
10932    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10933    ///
10934    /// # Example
10935    /// ```
10936    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::CancelOperation;
10937    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10938    ///
10939    /// let builder = prepare_request_builder();
10940    /// let response = builder.send().await?;
10941    /// # Ok(()) }
10942    ///
10943    /// fn prepare_request_builder() -> CancelOperation {
10944    ///   # panic!();
10945    ///   // ... details omitted ...
10946    /// }
10947    /// ```
10948    #[derive(Clone, Debug)]
10949    pub struct CancelOperation(
10950        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10951    );
10952
10953    impl CancelOperation {
10954        pub(crate) fn new(
10955            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10956        ) -> Self {
10957            Self(RequestBuilder::new(stub))
10958        }
10959
10960        /// Sets the full request, replacing any prior values.
10961        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10962            mut self,
10963            v: V,
10964        ) -> Self {
10965            self.0.request = v.into();
10966            self
10967        }
10968
10969        /// Sets all the options, replacing any prior values.
10970        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10971            self.0.options = v.into();
10972            self
10973        }
10974
10975        /// Sends the request.
10976        pub async fn send(self) -> Result<()> {
10977            (*self.0.stub)
10978                .cancel_operation(self.0.request, self.0.options)
10979                .await
10980                .map(crate::Response::into_body)
10981        }
10982
10983        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10984        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10985            self.0.request.name = v.into();
10986            self
10987        }
10988    }
10989
10990    #[doc(hidden)]
10991    impl crate::RequestBuilder for CancelOperation {
10992        fn request_options(&mut self) -> &mut crate::RequestOptions {
10993            &mut self.0.options
10994        }
10995    }
10996}
10997
10998/// Request and client builders for [SchemaService][crate::client::SchemaService].
10999#[cfg(feature = "schema-service")]
11000#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
11001pub mod schema_service {
11002    use crate::Result;
11003
11004    /// A builder for [SchemaService][crate::client::SchemaService].
11005    ///
11006    /// ```
11007    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11008    /// # use google_cloud_discoveryengine_v1::*;
11009    /// # use builder::schema_service::ClientBuilder;
11010    /// # use client::SchemaService;
11011    /// let builder : ClientBuilder = SchemaService::builder();
11012    /// let client = builder
11013    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11014    ///     .build().await?;
11015    /// # Ok(()) }
11016    /// ```
11017    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11018
11019    pub(crate) mod client {
11020        use super::super::super::client::SchemaService;
11021        pub struct Factory;
11022        impl crate::ClientFactory for Factory {
11023            type Client = SchemaService;
11024            type Credentials = gaxi::options::Credentials;
11025            async fn build(
11026                self,
11027                config: gaxi::options::ClientConfig,
11028            ) -> crate::ClientBuilderResult<Self::Client> {
11029                Self::Client::new(config).await
11030            }
11031        }
11032    }
11033
11034    /// Common implementation for [crate::client::SchemaService] request builders.
11035    #[derive(Clone, Debug)]
11036    pub(crate) struct RequestBuilder<R: std::default::Default> {
11037        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11038        request: R,
11039        options: crate::RequestOptions,
11040    }
11041
11042    impl<R> RequestBuilder<R>
11043    where
11044        R: std::default::Default,
11045    {
11046        pub(crate) fn new(
11047            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11048        ) -> Self {
11049            Self {
11050                stub,
11051                request: R::default(),
11052                options: crate::RequestOptions::default(),
11053            }
11054        }
11055    }
11056
11057    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
11058    ///
11059    /// # Example
11060    /// ```
11061    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetSchema;
11062    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11063    ///
11064    /// let builder = prepare_request_builder();
11065    /// let response = builder.send().await?;
11066    /// # Ok(()) }
11067    ///
11068    /// fn prepare_request_builder() -> GetSchema {
11069    ///   # panic!();
11070    ///   // ... details omitted ...
11071    /// }
11072    /// ```
11073    #[derive(Clone, Debug)]
11074    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
11075
11076    impl GetSchema {
11077        pub(crate) fn new(
11078            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11079        ) -> Self {
11080            Self(RequestBuilder::new(stub))
11081        }
11082
11083        /// Sets the full request, replacing any prior values.
11084        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
11085            self.0.request = v.into();
11086            self
11087        }
11088
11089        /// Sets all the options, replacing any prior values.
11090        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11091            self.0.options = v.into();
11092            self
11093        }
11094
11095        /// Sends the request.
11096        pub async fn send(self) -> Result<crate::model::Schema> {
11097            (*self.0.stub)
11098                .get_schema(self.0.request, self.0.options)
11099                .await
11100                .map(crate::Response::into_body)
11101        }
11102
11103        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
11104        ///
11105        /// This is a **required** field for requests.
11106        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11107            self.0.request.name = v.into();
11108            self
11109        }
11110    }
11111
11112    #[doc(hidden)]
11113    impl crate::RequestBuilder for GetSchema {
11114        fn request_options(&mut self) -> &mut crate::RequestOptions {
11115            &mut self.0.options
11116        }
11117    }
11118
11119    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
11120    ///
11121    /// # Example
11122    /// ```
11123    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListSchemas;
11124    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11125    /// use google_cloud_gax::paginator::ItemPaginator;
11126    ///
11127    /// let builder = prepare_request_builder();
11128    /// let mut items = builder.by_item();
11129    /// while let Some(result) = items.next().await {
11130    ///   let item = result?;
11131    /// }
11132    /// # Ok(()) }
11133    ///
11134    /// fn prepare_request_builder() -> ListSchemas {
11135    ///   # panic!();
11136    ///   // ... details omitted ...
11137    /// }
11138    /// ```
11139    #[derive(Clone, Debug)]
11140    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
11141
11142    impl ListSchemas {
11143        pub(crate) fn new(
11144            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11145        ) -> Self {
11146            Self(RequestBuilder::new(stub))
11147        }
11148
11149        /// Sets the full request, replacing any prior values.
11150        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
11151            self.0.request = v.into();
11152            self
11153        }
11154
11155        /// Sets all the options, replacing any prior values.
11156        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11157            self.0.options = v.into();
11158            self
11159        }
11160
11161        /// Sends the request.
11162        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
11163            (*self.0.stub)
11164                .list_schemas(self.0.request, self.0.options)
11165                .await
11166                .map(crate::Response::into_body)
11167        }
11168
11169        /// Streams each page in the collection.
11170        pub fn by_page(
11171            self,
11172        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
11173        {
11174            use std::clone::Clone;
11175            let token = self.0.request.page_token.clone();
11176            let execute = move |token: String| {
11177                let mut builder = self.clone();
11178                builder.0.request = builder.0.request.set_page_token(token);
11179                builder.send()
11180            };
11181            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11182        }
11183
11184        /// Streams each item in the collection.
11185        pub fn by_item(
11186            self,
11187        ) -> impl google_cloud_gax::paginator::ItemPaginator<
11188            crate::model::ListSchemasResponse,
11189            crate::Error,
11190        > {
11191            use google_cloud_gax::paginator::Paginator;
11192            self.by_page().items()
11193        }
11194
11195        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
11196        ///
11197        /// This is a **required** field for requests.
11198        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11199            self.0.request.parent = v.into();
11200            self
11201        }
11202
11203        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
11204        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11205            self.0.request.page_size = v.into();
11206            self
11207        }
11208
11209        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
11210        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11211            self.0.request.page_token = v.into();
11212            self
11213        }
11214    }
11215
11216    #[doc(hidden)]
11217    impl crate::RequestBuilder for ListSchemas {
11218        fn request_options(&mut self) -> &mut crate::RequestOptions {
11219            &mut self.0.options
11220        }
11221    }
11222
11223    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
11224    ///
11225    /// # Example
11226    /// ```
11227    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CreateSchema;
11228    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11229    /// use google_cloud_lro::Poller;
11230    ///
11231    /// let builder = prepare_request_builder();
11232    /// let response = builder.poller().until_done().await?;
11233    /// # Ok(()) }
11234    ///
11235    /// fn prepare_request_builder() -> CreateSchema {
11236    ///   # panic!();
11237    ///   // ... details omitted ...
11238    /// }
11239    /// ```
11240    #[derive(Clone, Debug)]
11241    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
11242
11243    impl CreateSchema {
11244        pub(crate) fn new(
11245            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11246        ) -> Self {
11247            Self(RequestBuilder::new(stub))
11248        }
11249
11250        /// Sets the full request, replacing any prior values.
11251        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
11252            self.0.request = v.into();
11253            self
11254        }
11255
11256        /// Sets all the options, replacing any prior values.
11257        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11258            self.0.options = v.into();
11259            self
11260        }
11261
11262        /// Sends the request.
11263        ///
11264        /// # Long running operations
11265        ///
11266        /// This starts, but does not poll, a longrunning operation. More information
11267        /// on [create_schema][crate::client::SchemaService::create_schema].
11268        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11269            (*self.0.stub)
11270                .create_schema(self.0.request, self.0.options)
11271                .await
11272                .map(crate::Response::into_body)
11273        }
11274
11275        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_schema`.
11276        pub fn poller(
11277            self,
11278        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
11279        {
11280            type Operation = google_cloud_lro::internal::Operation<
11281                crate::model::Schema,
11282                crate::model::CreateSchemaMetadata,
11283            >;
11284            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11285            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11286            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11287            if let Some(ref mut details) = poller_options.tracing {
11288                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::create_schema::until_done";
11289            }
11290
11291            let stub = self.0.stub.clone();
11292            let mut options = self.0.options.clone();
11293            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11294            let query = move |name| {
11295                let stub = stub.clone();
11296                let options = options.clone();
11297                async {
11298                    let op = GetOperation::new(stub)
11299                        .set_name(name)
11300                        .with_options(options)
11301                        .send()
11302                        .await?;
11303                    Ok(Operation::new(op))
11304                }
11305            };
11306
11307            let start = move || async {
11308                let op = self.send().await?;
11309                Ok(Operation::new(op))
11310            };
11311
11312            use google_cloud_lro::internal::PollerExt;
11313            {
11314                google_cloud_lro::internal::new_poller(
11315                    polling_error_policy,
11316                    polling_backoff_policy,
11317                    start,
11318                    query,
11319                )
11320            }
11321            .with_options(poller_options)
11322        }
11323
11324        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
11325        ///
11326        /// This is a **required** field for requests.
11327        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11328            self.0.request.parent = v.into();
11329            self
11330        }
11331
11332        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
11333        ///
11334        /// This is a **required** field for requests.
11335        pub fn set_schema<T>(mut self, v: T) -> Self
11336        where
11337            T: std::convert::Into<crate::model::Schema>,
11338        {
11339            self.0.request.schema = std::option::Option::Some(v.into());
11340            self
11341        }
11342
11343        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
11344        ///
11345        /// This is a **required** field for requests.
11346        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
11347        where
11348            T: std::convert::Into<crate::model::Schema>,
11349        {
11350            self.0.request.schema = v.map(|x| x.into());
11351            self
11352        }
11353
11354        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
11355        ///
11356        /// This is a **required** field for requests.
11357        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11358            self.0.request.schema_id = v.into();
11359            self
11360        }
11361    }
11362
11363    #[doc(hidden)]
11364    impl crate::RequestBuilder for CreateSchema {
11365        fn request_options(&mut self) -> &mut crate::RequestOptions {
11366            &mut self.0.options
11367        }
11368    }
11369
11370    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
11371    ///
11372    /// # Example
11373    /// ```
11374    /// # use google_cloud_discoveryengine_v1::builder::schema_service::UpdateSchema;
11375    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11376    /// use google_cloud_lro::Poller;
11377    ///
11378    /// let builder = prepare_request_builder();
11379    /// let response = builder.poller().until_done().await?;
11380    /// # Ok(()) }
11381    ///
11382    /// fn prepare_request_builder() -> UpdateSchema {
11383    ///   # panic!();
11384    ///   // ... details omitted ...
11385    /// }
11386    /// ```
11387    #[derive(Clone, Debug)]
11388    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
11389
11390    impl UpdateSchema {
11391        pub(crate) fn new(
11392            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11393        ) -> Self {
11394            Self(RequestBuilder::new(stub))
11395        }
11396
11397        /// Sets the full request, replacing any prior values.
11398        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
11399            self.0.request = v.into();
11400            self
11401        }
11402
11403        /// Sets all the options, replacing any prior values.
11404        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11405            self.0.options = v.into();
11406            self
11407        }
11408
11409        /// Sends the request.
11410        ///
11411        /// # Long running operations
11412        ///
11413        /// This starts, but does not poll, a longrunning operation. More information
11414        /// on [update_schema][crate::client::SchemaService::update_schema].
11415        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11416            (*self.0.stub)
11417                .update_schema(self.0.request, self.0.options)
11418                .await
11419                .map(crate::Response::into_body)
11420        }
11421
11422        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_schema`.
11423        pub fn poller(
11424            self,
11425        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
11426        {
11427            type Operation = google_cloud_lro::internal::Operation<
11428                crate::model::Schema,
11429                crate::model::UpdateSchemaMetadata,
11430            >;
11431            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11432            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11433            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11434            if let Some(ref mut details) = poller_options.tracing {
11435                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::update_schema::until_done";
11436            }
11437
11438            let stub = self.0.stub.clone();
11439            let mut options = self.0.options.clone();
11440            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11441            let query = move |name| {
11442                let stub = stub.clone();
11443                let options = options.clone();
11444                async {
11445                    let op = GetOperation::new(stub)
11446                        .set_name(name)
11447                        .with_options(options)
11448                        .send()
11449                        .await?;
11450                    Ok(Operation::new(op))
11451                }
11452            };
11453
11454            let start = move || async {
11455                let op = self.send().await?;
11456                Ok(Operation::new(op))
11457            };
11458
11459            use google_cloud_lro::internal::PollerExt;
11460            {
11461                google_cloud_lro::internal::new_poller(
11462                    polling_error_policy,
11463                    polling_backoff_policy,
11464                    start,
11465                    query,
11466                )
11467            }
11468            .with_options(poller_options)
11469        }
11470
11471        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
11472        ///
11473        /// This is a **required** field for requests.
11474        pub fn set_schema<T>(mut self, v: T) -> Self
11475        where
11476            T: std::convert::Into<crate::model::Schema>,
11477        {
11478            self.0.request.schema = std::option::Option::Some(v.into());
11479            self
11480        }
11481
11482        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
11483        ///
11484        /// This is a **required** field for requests.
11485        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
11486        where
11487            T: std::convert::Into<crate::model::Schema>,
11488        {
11489            self.0.request.schema = v.map(|x| x.into());
11490            self
11491        }
11492
11493        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
11494        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
11495            self.0.request.allow_missing = v.into();
11496            self
11497        }
11498    }
11499
11500    #[doc(hidden)]
11501    impl crate::RequestBuilder for UpdateSchema {
11502        fn request_options(&mut self) -> &mut crate::RequestOptions {
11503            &mut self.0.options
11504        }
11505    }
11506
11507    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
11508    ///
11509    /// # Example
11510    /// ```
11511    /// # use google_cloud_discoveryengine_v1::builder::schema_service::DeleteSchema;
11512    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11513    /// use google_cloud_lro::Poller;
11514    ///
11515    /// let builder = prepare_request_builder();
11516    /// let response = builder.poller().until_done().await?;
11517    /// # Ok(()) }
11518    ///
11519    /// fn prepare_request_builder() -> DeleteSchema {
11520    ///   # panic!();
11521    ///   // ... details omitted ...
11522    /// }
11523    /// ```
11524    #[derive(Clone, Debug)]
11525    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
11526
11527    impl DeleteSchema {
11528        pub(crate) fn new(
11529            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11530        ) -> Self {
11531            Self(RequestBuilder::new(stub))
11532        }
11533
11534        /// Sets the full request, replacing any prior values.
11535        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
11536            self.0.request = v.into();
11537            self
11538        }
11539
11540        /// Sets all the options, replacing any prior values.
11541        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11542            self.0.options = v.into();
11543            self
11544        }
11545
11546        /// Sends the request.
11547        ///
11548        /// # Long running operations
11549        ///
11550        /// This starts, but does not poll, a longrunning operation. More information
11551        /// on [delete_schema][crate::client::SchemaService::delete_schema].
11552        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11553            (*self.0.stub)
11554                .delete_schema(self.0.request, self.0.options)
11555                .await
11556                .map(crate::Response::into_body)
11557        }
11558
11559        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_schema`.
11560        pub fn poller(
11561            self,
11562        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
11563            type Operation = google_cloud_lro::internal::Operation<
11564                wkt::Empty,
11565                crate::model::DeleteSchemaMetadata,
11566            >;
11567            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11568            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11569            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11570            if let Some(ref mut details) = poller_options.tracing {
11571                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::delete_schema::until_done";
11572            }
11573
11574            let stub = self.0.stub.clone();
11575            let mut options = self.0.options.clone();
11576            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11577            let query = move |name| {
11578                let stub = stub.clone();
11579                let options = options.clone();
11580                async {
11581                    let op = GetOperation::new(stub)
11582                        .set_name(name)
11583                        .with_options(options)
11584                        .send()
11585                        .await?;
11586                    Ok(Operation::new(op))
11587                }
11588            };
11589
11590            let start = move || async {
11591                let op = self.send().await?;
11592                Ok(Operation::new(op))
11593            };
11594
11595            use google_cloud_lro::internal::PollerExt;
11596            {
11597                google_cloud_lro::internal::new_unit_response_poller(
11598                    polling_error_policy,
11599                    polling_backoff_policy,
11600                    start,
11601                    query,
11602                )
11603            }
11604            .with_options(poller_options)
11605        }
11606
11607        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
11608        ///
11609        /// This is a **required** field for requests.
11610        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11611            self.0.request.name = v.into();
11612            self
11613        }
11614    }
11615
11616    #[doc(hidden)]
11617    impl crate::RequestBuilder for DeleteSchema {
11618        fn request_options(&mut self) -> &mut crate::RequestOptions {
11619            &mut self.0.options
11620        }
11621    }
11622
11623    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
11624    ///
11625    /// # Example
11626    /// ```
11627    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListOperations;
11628    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11629    /// use google_cloud_gax::paginator::ItemPaginator;
11630    ///
11631    /// let builder = prepare_request_builder();
11632    /// let mut items = builder.by_item();
11633    /// while let Some(result) = items.next().await {
11634    ///   let item = result?;
11635    /// }
11636    /// # Ok(()) }
11637    ///
11638    /// fn prepare_request_builder() -> ListOperations {
11639    ///   # panic!();
11640    ///   // ... details omitted ...
11641    /// }
11642    /// ```
11643    #[derive(Clone, Debug)]
11644    pub struct ListOperations(
11645        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11646    );
11647
11648    impl ListOperations {
11649        pub(crate) fn new(
11650            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11651        ) -> Self {
11652            Self(RequestBuilder::new(stub))
11653        }
11654
11655        /// Sets the full request, replacing any prior values.
11656        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11657            mut self,
11658            v: V,
11659        ) -> Self {
11660            self.0.request = v.into();
11661            self
11662        }
11663
11664        /// Sets all the options, replacing any prior values.
11665        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11666            self.0.options = v.into();
11667            self
11668        }
11669
11670        /// Sends the request.
11671        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11672            (*self.0.stub)
11673                .list_operations(self.0.request, self.0.options)
11674                .await
11675                .map(crate::Response::into_body)
11676        }
11677
11678        /// Streams each page in the collection.
11679        pub fn by_page(
11680            self,
11681        ) -> impl google_cloud_gax::paginator::Paginator<
11682            google_cloud_longrunning::model::ListOperationsResponse,
11683            crate::Error,
11684        > {
11685            use std::clone::Clone;
11686            let token = self.0.request.page_token.clone();
11687            let execute = move |token: String| {
11688                let mut builder = self.clone();
11689                builder.0.request = builder.0.request.set_page_token(token);
11690                builder.send()
11691            };
11692            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11693        }
11694
11695        /// Streams each item in the collection.
11696        pub fn by_item(
11697            self,
11698        ) -> impl google_cloud_gax::paginator::ItemPaginator<
11699            google_cloud_longrunning::model::ListOperationsResponse,
11700            crate::Error,
11701        > {
11702            use google_cloud_gax::paginator::Paginator;
11703            self.by_page().items()
11704        }
11705
11706        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
11707        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11708            self.0.request.name = v.into();
11709            self
11710        }
11711
11712        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
11713        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11714            self.0.request.filter = v.into();
11715            self
11716        }
11717
11718        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
11719        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11720            self.0.request.page_size = v.into();
11721            self
11722        }
11723
11724        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
11725        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11726            self.0.request.page_token = v.into();
11727            self
11728        }
11729
11730        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
11731        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11732            self.0.request.return_partial_success = v.into();
11733            self
11734        }
11735    }
11736
11737    #[doc(hidden)]
11738    impl crate::RequestBuilder for ListOperations {
11739        fn request_options(&mut self) -> &mut crate::RequestOptions {
11740            &mut self.0.options
11741        }
11742    }
11743
11744    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
11745    ///
11746    /// # Example
11747    /// ```
11748    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetOperation;
11749    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11750    ///
11751    /// let builder = prepare_request_builder();
11752    /// let response = builder.send().await?;
11753    /// # Ok(()) }
11754    ///
11755    /// fn prepare_request_builder() -> GetOperation {
11756    ///   # panic!();
11757    ///   // ... details omitted ...
11758    /// }
11759    /// ```
11760    #[derive(Clone, Debug)]
11761    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11762
11763    impl GetOperation {
11764        pub(crate) fn new(
11765            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11766        ) -> Self {
11767            Self(RequestBuilder::new(stub))
11768        }
11769
11770        /// Sets the full request, replacing any prior values.
11771        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11772            mut self,
11773            v: V,
11774        ) -> Self {
11775            self.0.request = v.into();
11776            self
11777        }
11778
11779        /// Sets all the options, replacing any prior values.
11780        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11781            self.0.options = v.into();
11782            self
11783        }
11784
11785        /// Sends the request.
11786        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11787            (*self.0.stub)
11788                .get_operation(self.0.request, self.0.options)
11789                .await
11790                .map(crate::Response::into_body)
11791        }
11792
11793        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
11794        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11795            self.0.request.name = v.into();
11796            self
11797        }
11798    }
11799
11800    #[doc(hidden)]
11801    impl crate::RequestBuilder for GetOperation {
11802        fn request_options(&mut self) -> &mut crate::RequestOptions {
11803            &mut self.0.options
11804        }
11805    }
11806
11807    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
11808    ///
11809    /// # Example
11810    /// ```
11811    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CancelOperation;
11812    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11813    ///
11814    /// let builder = prepare_request_builder();
11815    /// let response = builder.send().await?;
11816    /// # Ok(()) }
11817    ///
11818    /// fn prepare_request_builder() -> CancelOperation {
11819    ///   # panic!();
11820    ///   // ... details omitted ...
11821    /// }
11822    /// ```
11823    #[derive(Clone, Debug)]
11824    pub struct CancelOperation(
11825        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11826    );
11827
11828    impl CancelOperation {
11829        pub(crate) fn new(
11830            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11831        ) -> Self {
11832            Self(RequestBuilder::new(stub))
11833        }
11834
11835        /// Sets the full request, replacing any prior values.
11836        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11837            mut self,
11838            v: V,
11839        ) -> Self {
11840            self.0.request = v.into();
11841            self
11842        }
11843
11844        /// Sets all the options, replacing any prior values.
11845        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11846            self.0.options = v.into();
11847            self
11848        }
11849
11850        /// Sends the request.
11851        pub async fn send(self) -> Result<()> {
11852            (*self.0.stub)
11853                .cancel_operation(self.0.request, self.0.options)
11854                .await
11855                .map(crate::Response::into_body)
11856        }
11857
11858        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
11859        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11860            self.0.request.name = v.into();
11861            self
11862        }
11863    }
11864
11865    #[doc(hidden)]
11866    impl crate::RequestBuilder for CancelOperation {
11867        fn request_options(&mut self) -> &mut crate::RequestOptions {
11868            &mut self.0.options
11869        }
11870    }
11871}
11872
11873/// Request and client builders for [SearchService][crate::client::SearchService].
11874#[cfg(feature = "search-service")]
11875#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11876pub mod search_service {
11877    use crate::Result;
11878
11879    /// A builder for [SearchService][crate::client::SearchService].
11880    ///
11881    /// ```
11882    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11883    /// # use google_cloud_discoveryengine_v1::*;
11884    /// # use builder::search_service::ClientBuilder;
11885    /// # use client::SearchService;
11886    /// let builder : ClientBuilder = SearchService::builder();
11887    /// let client = builder
11888    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11889    ///     .build().await?;
11890    /// # Ok(()) }
11891    /// ```
11892    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11893
11894    pub(crate) mod client {
11895        use super::super::super::client::SearchService;
11896        pub struct Factory;
11897        impl crate::ClientFactory for Factory {
11898            type Client = SearchService;
11899            type Credentials = gaxi::options::Credentials;
11900            async fn build(
11901                self,
11902                config: gaxi::options::ClientConfig,
11903            ) -> crate::ClientBuilderResult<Self::Client> {
11904                Self::Client::new(config).await
11905            }
11906        }
11907    }
11908
11909    /// Common implementation for [crate::client::SearchService] request builders.
11910    #[derive(Clone, Debug)]
11911    pub(crate) struct RequestBuilder<R: std::default::Default> {
11912        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11913        request: R,
11914        options: crate::RequestOptions,
11915    }
11916
11917    impl<R> RequestBuilder<R>
11918    where
11919        R: std::default::Default,
11920    {
11921        pub(crate) fn new(
11922            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11923        ) -> Self {
11924            Self {
11925                stub,
11926                request: R::default(),
11927                options: crate::RequestOptions::default(),
11928            }
11929        }
11930    }
11931
11932    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11933    ///
11934    /// # Example
11935    /// ```
11936    /// # use google_cloud_discoveryengine_v1::builder::search_service::Search;
11937    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11938    /// use google_cloud_gax::paginator::ItemPaginator;
11939    ///
11940    /// let builder = prepare_request_builder();
11941    /// let mut items = builder.by_item();
11942    /// while let Some(result) = items.next().await {
11943    ///   let item = result?;
11944    /// }
11945    /// # Ok(()) }
11946    ///
11947    /// fn prepare_request_builder() -> Search {
11948    ///   # panic!();
11949    ///   // ... details omitted ...
11950    /// }
11951    /// ```
11952    #[derive(Clone, Debug)]
11953    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11954
11955    impl Search {
11956        pub(crate) fn new(
11957            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11958        ) -> Self {
11959            Self(RequestBuilder::new(stub))
11960        }
11961
11962        /// Sets the full request, replacing any prior values.
11963        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11964            self.0.request = v.into();
11965            self
11966        }
11967
11968        /// Sets all the options, replacing any prior values.
11969        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11970            self.0.options = v.into();
11971            self
11972        }
11973
11974        /// Sends the request.
11975        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11976            (*self.0.stub)
11977                .search(self.0.request, self.0.options)
11978                .await
11979                .map(crate::Response::into_body)
11980        }
11981
11982        /// Streams each page in the collection.
11983        pub fn by_page(
11984            self,
11985        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11986        {
11987            use std::clone::Clone;
11988            let token = self.0.request.page_token.clone();
11989            let execute = move |token: String| {
11990                let mut builder = self.clone();
11991                builder.0.request = builder.0.request.set_page_token(token);
11992                builder.send()
11993            };
11994            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11995        }
11996
11997        /// Streams each item in the collection.
11998        pub fn by_item(
11999            self,
12000        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
12001        {
12002            use google_cloud_gax::paginator::Paginator;
12003            self.by_page().items()
12004        }
12005
12006        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
12007        ///
12008        /// This is a **required** field for requests.
12009        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12010            self.0.request.serving_config = v.into();
12011            self
12012        }
12013
12014        /// Sets the value of [branch][crate::model::SearchRequest::branch].
12015        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12016            self.0.request.branch = v.into();
12017            self
12018        }
12019
12020        /// Sets the value of [query][crate::model::SearchRequest::query].
12021        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12022            self.0.request.query = v.into();
12023            self
12024        }
12025
12026        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
12027        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12028        where
12029            T: std::iter::IntoIterator<Item = V>,
12030            V: std::convert::Into<std::string::String>,
12031        {
12032            use std::iter::Iterator;
12033            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12034            self
12035        }
12036
12037        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
12038        pub fn set_image_query<T>(mut self, v: T) -> Self
12039        where
12040            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12041        {
12042            self.0.request.image_query = std::option::Option::Some(v.into());
12043            self
12044        }
12045
12046        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
12047        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12048        where
12049            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12050        {
12051            self.0.request.image_query = v.map(|x| x.into());
12052            self
12053        }
12054
12055        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
12056        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12057            self.0.request.page_size = v.into();
12058            self
12059        }
12060
12061        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
12062        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12063            self.0.request.page_token = v.into();
12064            self
12065        }
12066
12067        /// Sets the value of [offset][crate::model::SearchRequest::offset].
12068        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12069            self.0.request.offset = v.into();
12070            self
12071        }
12072
12073        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
12074        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12075            self.0.request.one_box_page_size = v.into();
12076            self
12077        }
12078
12079        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
12080        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12081        where
12082            T: std::iter::IntoIterator<Item = V>,
12083            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12084        {
12085            use std::iter::Iterator;
12086            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12087            self
12088        }
12089
12090        /// Sets the value of [num_results_per_data_store][crate::model::SearchRequest::num_results_per_data_store].
12091        pub fn set_num_results_per_data_store<T: Into<i32>>(mut self, v: T) -> Self {
12092            self.0.request.num_results_per_data_store = v.into();
12093            self
12094        }
12095
12096        /// Sets the value of [filter][crate::model::SearchRequest::filter].
12097        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12098            self.0.request.filter = v.into();
12099            self
12100        }
12101
12102        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
12103        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12104            self.0.request.canonical_filter = v.into();
12105            self
12106        }
12107
12108        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
12109        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12110            self.0.request.order_by = v.into();
12111            self
12112        }
12113
12114        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
12115        pub fn set_user_info<T>(mut self, v: T) -> Self
12116        where
12117            T: std::convert::Into<crate::model::UserInfo>,
12118        {
12119            self.0.request.user_info = std::option::Option::Some(v.into());
12120            self
12121        }
12122
12123        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
12124        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12125        where
12126            T: std::convert::Into<crate::model::UserInfo>,
12127        {
12128            self.0.request.user_info = v.map(|x| x.into());
12129            self
12130        }
12131
12132        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
12133        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12134            self.0.request.language_code = v.into();
12135            self
12136        }
12137
12138        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
12139        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12140        where
12141            T: std::iter::IntoIterator<Item = V>,
12142            V: std::convert::Into<crate::model::search_request::FacetSpec>,
12143        {
12144            use std::iter::Iterator;
12145            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12146            self
12147        }
12148
12149        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12150        pub fn set_boost_spec<T>(mut self, v: T) -> Self
12151        where
12152            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12153        {
12154            self.0.request.boost_spec = std::option::Option::Some(v.into());
12155            self
12156        }
12157
12158        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12159        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12160        where
12161            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12162        {
12163            self.0.request.boost_spec = v.map(|x| x.into());
12164            self
12165        }
12166
12167        /// Sets the value of [params][crate::model::SearchRequest::params].
12168        pub fn set_params<T, K, V>(mut self, v: T) -> Self
12169        where
12170            T: std::iter::IntoIterator<Item = (K, V)>,
12171            K: std::convert::Into<std::string::String>,
12172            V: std::convert::Into<wkt::Value>,
12173        {
12174            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12175            self
12176        }
12177
12178        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12179        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12180        where
12181            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12182        {
12183            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12184            self
12185        }
12186
12187        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12188        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12189        where
12190            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12191        {
12192            self.0.request.query_expansion_spec = v.map(|x| x.into());
12193            self
12194        }
12195
12196        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12197        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12198        where
12199            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12200        {
12201            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12202            self
12203        }
12204
12205        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12206        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12207        where
12208            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12209        {
12210            self.0.request.spell_correction_spec = v.map(|x| x.into());
12211            self
12212        }
12213
12214        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12215        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12216            self.0.request.user_pseudo_id = v.into();
12217            self
12218        }
12219
12220        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12221        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12222        where
12223            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12224        {
12225            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12226            self
12227        }
12228
12229        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12230        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12231        where
12232            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12233        {
12234            self.0.request.content_search_spec = v.map(|x| x.into());
12235            self
12236        }
12237
12238        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12239        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12240            self.0.request.ranking_expression = v.into();
12241            self
12242        }
12243
12244        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12245        pub fn set_ranking_expression_backend<
12246            T: Into<crate::model::search_request::RankingExpressionBackend>,
12247        >(
12248            mut self,
12249            v: T,
12250        ) -> Self {
12251            self.0.request.ranking_expression_backend = v.into();
12252            self
12253        }
12254
12255        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12256        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12257            self.0.request.safe_search = v.into();
12258            self
12259        }
12260
12261        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12262        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12263        where
12264            T: std::iter::IntoIterator<Item = (K, V)>,
12265            K: std::convert::Into<std::string::String>,
12266            V: std::convert::Into<std::string::String>,
12267        {
12268            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12269            self
12270        }
12271
12272        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12273        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12274        where
12275            T: std::convert::Into<
12276                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12277                >,
12278        {
12279            self.0.request.natural_language_query_understanding_spec =
12280                std::option::Option::Some(v.into());
12281            self
12282        }
12283
12284        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12285        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12286            mut self,
12287            v: std::option::Option<T>,
12288        ) -> Self
12289        where
12290            T: std::convert::Into<
12291                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12292                >,
12293        {
12294            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12295            self
12296        }
12297
12298        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12299        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12300        where
12301            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12302        {
12303            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12304            self
12305        }
12306
12307        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12308        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12309        where
12310            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12311        {
12312            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12313            self
12314        }
12315
12316        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12317        pub fn set_display_spec<T>(mut self, v: T) -> Self
12318        where
12319            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12320        {
12321            self.0.request.display_spec = std::option::Option::Some(v.into());
12322            self
12323        }
12324
12325        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12326        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12327        where
12328            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12329        {
12330            self.0.request.display_spec = v.map(|x| x.into());
12331            self
12332        }
12333
12334        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12335        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12336        where
12337            T: std::iter::IntoIterator<Item = V>,
12338            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12339        {
12340            use std::iter::Iterator;
12341            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12342            self
12343        }
12344
12345        /// Sets the value of [session][crate::model::SearchRequest::session].
12346        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12347            self.0.request.session = v.into();
12348            self
12349        }
12350
12351        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12352        pub fn set_session_spec<T>(mut self, v: T) -> Self
12353        where
12354            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12355        {
12356            self.0.request.session_spec = std::option::Option::Some(v.into());
12357            self
12358        }
12359
12360        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12361        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12362        where
12363            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12364        {
12365            self.0.request.session_spec = v.map(|x| x.into());
12366            self
12367        }
12368
12369        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12370        pub fn set_relevance_threshold<
12371            T: Into<crate::model::search_request::RelevanceThreshold>,
12372        >(
12373            mut self,
12374            v: T,
12375        ) -> Self {
12376            self.0.request.relevance_threshold = v.into();
12377            self
12378        }
12379
12380        /// Sets the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12381        pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12382        where
12383            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12384        {
12385            self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12386            self
12387        }
12388
12389        /// Sets or clears the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12390        pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12391        where
12392            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12393        {
12394            self.0.request.relevance_filter_spec = v.map(|x| x.into());
12395            self
12396        }
12397
12398        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12399        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12400        where
12401            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12402        {
12403            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12404            self
12405        }
12406
12407        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12408        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12409        where
12410            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12411        {
12412            self.0.request.relevance_score_spec = v.map(|x| x.into());
12413            self
12414        }
12415
12416        /// Sets the value of [search_addon_spec][crate::model::SearchRequest::search_addon_spec].
12417        pub fn set_search_addon_spec<T>(mut self, v: T) -> Self
12418        where
12419            T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12420        {
12421            self.0.request.search_addon_spec = std::option::Option::Some(v.into());
12422            self
12423        }
12424
12425        /// Sets or clears the value of [search_addon_spec][crate::model::SearchRequest::search_addon_spec].
12426        pub fn set_or_clear_search_addon_spec<T>(mut self, v: std::option::Option<T>) -> Self
12427        where
12428            T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12429        {
12430            self.0.request.search_addon_spec = v.map(|x| x.into());
12431            self
12432        }
12433
12434        /// Sets the value of [custom_ranking_params][crate::model::SearchRequest::custom_ranking_params].
12435        pub fn set_custom_ranking_params<T>(mut self, v: T) -> Self
12436        where
12437            T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12438        {
12439            self.0.request.custom_ranking_params = std::option::Option::Some(v.into());
12440            self
12441        }
12442
12443        /// Sets or clears the value of [custom_ranking_params][crate::model::SearchRequest::custom_ranking_params].
12444        pub fn set_or_clear_custom_ranking_params<T>(mut self, v: std::option::Option<T>) -> Self
12445        where
12446            T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12447        {
12448            self.0.request.custom_ranking_params = v.map(|x| x.into());
12449            self
12450        }
12451
12452        /// Sets the value of [entity][crate::model::SearchRequest::entity].
12453        pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
12454            self.0.request.entity = v.into();
12455            self
12456        }
12457    }
12458
12459    #[doc(hidden)]
12460    impl crate::RequestBuilder for Search {
12461        fn request_options(&mut self) -> &mut crate::RequestOptions {
12462            &mut self.0.options
12463        }
12464    }
12465
12466    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
12467    ///
12468    /// # Example
12469    /// ```
12470    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
12471    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12472    /// use google_cloud_gax::paginator::ItemPaginator;
12473    ///
12474    /// let builder = prepare_request_builder();
12475    /// let mut items = builder.by_item();
12476    /// while let Some(result) = items.next().await {
12477    ///   let item = result?;
12478    /// }
12479    /// # Ok(()) }
12480    ///
12481    /// fn prepare_request_builder() -> SearchLite {
12482    ///   # panic!();
12483    ///   // ... details omitted ...
12484    /// }
12485    /// ```
12486    #[derive(Clone, Debug)]
12487    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
12488
12489    impl SearchLite {
12490        pub(crate) fn new(
12491            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12492        ) -> Self {
12493            Self(RequestBuilder::new(stub))
12494        }
12495
12496        /// Sets the full request, replacing any prior values.
12497        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
12498            self.0.request = v.into();
12499            self
12500        }
12501
12502        /// Sets all the options, replacing any prior values.
12503        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12504            self.0.options = v.into();
12505            self
12506        }
12507
12508        /// Sends the request.
12509        pub async fn send(self) -> Result<crate::model::SearchResponse> {
12510            (*self.0.stub)
12511                .search_lite(self.0.request, self.0.options)
12512                .await
12513                .map(crate::Response::into_body)
12514        }
12515
12516        /// Streams each page in the collection.
12517        pub fn by_page(
12518            self,
12519        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
12520        {
12521            use std::clone::Clone;
12522            let token = self.0.request.page_token.clone();
12523            let execute = move |token: String| {
12524                let mut builder = self.clone();
12525                builder.0.request = builder.0.request.set_page_token(token);
12526                builder.send()
12527            };
12528            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12529        }
12530
12531        /// Streams each item in the collection.
12532        pub fn by_item(
12533            self,
12534        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
12535        {
12536            use google_cloud_gax::paginator::Paginator;
12537            self.by_page().items()
12538        }
12539
12540        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
12541        ///
12542        /// This is a **required** field for requests.
12543        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12544            self.0.request.serving_config = v.into();
12545            self
12546        }
12547
12548        /// Sets the value of [branch][crate::model::SearchRequest::branch].
12549        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12550            self.0.request.branch = v.into();
12551            self
12552        }
12553
12554        /// Sets the value of [query][crate::model::SearchRequest::query].
12555        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12556            self.0.request.query = v.into();
12557            self
12558        }
12559
12560        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
12561        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12562        where
12563            T: std::iter::IntoIterator<Item = V>,
12564            V: std::convert::Into<std::string::String>,
12565        {
12566            use std::iter::Iterator;
12567            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12568            self
12569        }
12570
12571        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
12572        pub fn set_image_query<T>(mut self, v: T) -> Self
12573        where
12574            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12575        {
12576            self.0.request.image_query = std::option::Option::Some(v.into());
12577            self
12578        }
12579
12580        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
12581        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12582        where
12583            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12584        {
12585            self.0.request.image_query = v.map(|x| x.into());
12586            self
12587        }
12588
12589        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
12590        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12591            self.0.request.page_size = v.into();
12592            self
12593        }
12594
12595        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
12596        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12597            self.0.request.page_token = v.into();
12598            self
12599        }
12600
12601        /// Sets the value of [offset][crate::model::SearchRequest::offset].
12602        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12603            self.0.request.offset = v.into();
12604            self
12605        }
12606
12607        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
12608        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12609            self.0.request.one_box_page_size = v.into();
12610            self
12611        }
12612
12613        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
12614        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12615        where
12616            T: std::iter::IntoIterator<Item = V>,
12617            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12618        {
12619            use std::iter::Iterator;
12620            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12621            self
12622        }
12623
12624        /// Sets the value of [num_results_per_data_store][crate::model::SearchRequest::num_results_per_data_store].
12625        pub fn set_num_results_per_data_store<T: Into<i32>>(mut self, v: T) -> Self {
12626            self.0.request.num_results_per_data_store = v.into();
12627            self
12628        }
12629
12630        /// Sets the value of [filter][crate::model::SearchRequest::filter].
12631        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12632            self.0.request.filter = v.into();
12633            self
12634        }
12635
12636        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
12637        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12638            self.0.request.canonical_filter = v.into();
12639            self
12640        }
12641
12642        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
12643        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12644            self.0.request.order_by = v.into();
12645            self
12646        }
12647
12648        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
12649        pub fn set_user_info<T>(mut self, v: T) -> Self
12650        where
12651            T: std::convert::Into<crate::model::UserInfo>,
12652        {
12653            self.0.request.user_info = std::option::Option::Some(v.into());
12654            self
12655        }
12656
12657        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
12658        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12659        where
12660            T: std::convert::Into<crate::model::UserInfo>,
12661        {
12662            self.0.request.user_info = v.map(|x| x.into());
12663            self
12664        }
12665
12666        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
12667        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12668            self.0.request.language_code = v.into();
12669            self
12670        }
12671
12672        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
12673        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12674        where
12675            T: std::iter::IntoIterator<Item = V>,
12676            V: std::convert::Into<crate::model::search_request::FacetSpec>,
12677        {
12678            use std::iter::Iterator;
12679            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12680            self
12681        }
12682
12683        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12684        pub fn set_boost_spec<T>(mut self, v: T) -> Self
12685        where
12686            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12687        {
12688            self.0.request.boost_spec = std::option::Option::Some(v.into());
12689            self
12690        }
12691
12692        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12693        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12694        where
12695            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12696        {
12697            self.0.request.boost_spec = v.map(|x| x.into());
12698            self
12699        }
12700
12701        /// Sets the value of [params][crate::model::SearchRequest::params].
12702        pub fn set_params<T, K, V>(mut self, v: T) -> Self
12703        where
12704            T: std::iter::IntoIterator<Item = (K, V)>,
12705            K: std::convert::Into<std::string::String>,
12706            V: std::convert::Into<wkt::Value>,
12707        {
12708            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12709            self
12710        }
12711
12712        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12713        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12714        where
12715            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12716        {
12717            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12718            self
12719        }
12720
12721        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12722        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12723        where
12724            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12725        {
12726            self.0.request.query_expansion_spec = v.map(|x| x.into());
12727            self
12728        }
12729
12730        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12731        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12732        where
12733            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12734        {
12735            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12736            self
12737        }
12738
12739        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12740        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12741        where
12742            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12743        {
12744            self.0.request.spell_correction_spec = v.map(|x| x.into());
12745            self
12746        }
12747
12748        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12749        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12750            self.0.request.user_pseudo_id = v.into();
12751            self
12752        }
12753
12754        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12755        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12756        where
12757            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12758        {
12759            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12760            self
12761        }
12762
12763        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12764        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12765        where
12766            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12767        {
12768            self.0.request.content_search_spec = v.map(|x| x.into());
12769            self
12770        }
12771
12772        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12773        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12774            self.0.request.ranking_expression = v.into();
12775            self
12776        }
12777
12778        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12779        pub fn set_ranking_expression_backend<
12780            T: Into<crate::model::search_request::RankingExpressionBackend>,
12781        >(
12782            mut self,
12783            v: T,
12784        ) -> Self {
12785            self.0.request.ranking_expression_backend = v.into();
12786            self
12787        }
12788
12789        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12790        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12791            self.0.request.safe_search = v.into();
12792            self
12793        }
12794
12795        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12796        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12797        where
12798            T: std::iter::IntoIterator<Item = (K, V)>,
12799            K: std::convert::Into<std::string::String>,
12800            V: std::convert::Into<std::string::String>,
12801        {
12802            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12803            self
12804        }
12805
12806        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12807        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12808        where
12809            T: std::convert::Into<
12810                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12811                >,
12812        {
12813            self.0.request.natural_language_query_understanding_spec =
12814                std::option::Option::Some(v.into());
12815            self
12816        }
12817
12818        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12819        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12820            mut self,
12821            v: std::option::Option<T>,
12822        ) -> Self
12823        where
12824            T: std::convert::Into<
12825                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12826                >,
12827        {
12828            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12829            self
12830        }
12831
12832        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12833        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12834        where
12835            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12836        {
12837            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12838            self
12839        }
12840
12841        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12842        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12843        where
12844            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12845        {
12846            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12847            self
12848        }
12849
12850        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12851        pub fn set_display_spec<T>(mut self, v: T) -> Self
12852        where
12853            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12854        {
12855            self.0.request.display_spec = std::option::Option::Some(v.into());
12856            self
12857        }
12858
12859        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12860        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12861        where
12862            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12863        {
12864            self.0.request.display_spec = v.map(|x| x.into());
12865            self
12866        }
12867
12868        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12869        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12870        where
12871            T: std::iter::IntoIterator<Item = V>,
12872            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12873        {
12874            use std::iter::Iterator;
12875            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12876            self
12877        }
12878
12879        /// Sets the value of [session][crate::model::SearchRequest::session].
12880        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12881            self.0.request.session = v.into();
12882            self
12883        }
12884
12885        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12886        pub fn set_session_spec<T>(mut self, v: T) -> Self
12887        where
12888            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12889        {
12890            self.0.request.session_spec = std::option::Option::Some(v.into());
12891            self
12892        }
12893
12894        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12895        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12896        where
12897            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12898        {
12899            self.0.request.session_spec = v.map(|x| x.into());
12900            self
12901        }
12902
12903        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12904        pub fn set_relevance_threshold<
12905            T: Into<crate::model::search_request::RelevanceThreshold>,
12906        >(
12907            mut self,
12908            v: T,
12909        ) -> Self {
12910            self.0.request.relevance_threshold = v.into();
12911            self
12912        }
12913
12914        /// Sets the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12915        pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12916        where
12917            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12918        {
12919            self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12920            self
12921        }
12922
12923        /// Sets or clears the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12924        pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12925        where
12926            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12927        {
12928            self.0.request.relevance_filter_spec = v.map(|x| x.into());
12929            self
12930        }
12931
12932        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12933        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12934        where
12935            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12936        {
12937            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12938            self
12939        }
12940
12941        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12942        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12943        where
12944            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12945        {
12946            self.0.request.relevance_score_spec = v.map(|x| x.into());
12947            self
12948        }
12949
12950        /// Sets the value of [search_addon_spec][crate::model::SearchRequest::search_addon_spec].
12951        pub fn set_search_addon_spec<T>(mut self, v: T) -> Self
12952        where
12953            T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12954        {
12955            self.0.request.search_addon_spec = std::option::Option::Some(v.into());
12956            self
12957        }
12958
12959        /// Sets or clears the value of [search_addon_spec][crate::model::SearchRequest::search_addon_spec].
12960        pub fn set_or_clear_search_addon_spec<T>(mut self, v: std::option::Option<T>) -> Self
12961        where
12962            T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12963        {
12964            self.0.request.search_addon_spec = v.map(|x| x.into());
12965            self
12966        }
12967
12968        /// Sets the value of [custom_ranking_params][crate::model::SearchRequest::custom_ranking_params].
12969        pub fn set_custom_ranking_params<T>(mut self, v: T) -> Self
12970        where
12971            T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12972        {
12973            self.0.request.custom_ranking_params = std::option::Option::Some(v.into());
12974            self
12975        }
12976
12977        /// Sets or clears the value of [custom_ranking_params][crate::model::SearchRequest::custom_ranking_params].
12978        pub fn set_or_clear_custom_ranking_params<T>(mut self, v: std::option::Option<T>) -> Self
12979        where
12980            T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12981        {
12982            self.0.request.custom_ranking_params = v.map(|x| x.into());
12983            self
12984        }
12985
12986        /// Sets the value of [entity][crate::model::SearchRequest::entity].
12987        pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
12988            self.0.request.entity = v.into();
12989            self
12990        }
12991    }
12992
12993    #[doc(hidden)]
12994    impl crate::RequestBuilder for SearchLite {
12995        fn request_options(&mut self) -> &mut crate::RequestOptions {
12996            &mut self.0.options
12997        }
12998    }
12999
13000    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
13001    ///
13002    /// # Example
13003    /// ```
13004    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
13005    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13006    /// use google_cloud_gax::paginator::ItemPaginator;
13007    ///
13008    /// let builder = prepare_request_builder();
13009    /// let mut items = builder.by_item();
13010    /// while let Some(result) = items.next().await {
13011    ///   let item = result?;
13012    /// }
13013    /// # Ok(()) }
13014    ///
13015    /// fn prepare_request_builder() -> ListOperations {
13016    ///   # panic!();
13017    ///   // ... details omitted ...
13018    /// }
13019    /// ```
13020    #[derive(Clone, Debug)]
13021    pub struct ListOperations(
13022        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13023    );
13024
13025    impl ListOperations {
13026        pub(crate) fn new(
13027            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13028        ) -> Self {
13029            Self(RequestBuilder::new(stub))
13030        }
13031
13032        /// Sets the full request, replacing any prior values.
13033        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13034            mut self,
13035            v: V,
13036        ) -> Self {
13037            self.0.request = v.into();
13038            self
13039        }
13040
13041        /// Sets all the options, replacing any prior values.
13042        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13043            self.0.options = v.into();
13044            self
13045        }
13046
13047        /// Sends the request.
13048        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13049            (*self.0.stub)
13050                .list_operations(self.0.request, self.0.options)
13051                .await
13052                .map(crate::Response::into_body)
13053        }
13054
13055        /// Streams each page in the collection.
13056        pub fn by_page(
13057            self,
13058        ) -> impl google_cloud_gax::paginator::Paginator<
13059            google_cloud_longrunning::model::ListOperationsResponse,
13060            crate::Error,
13061        > {
13062            use std::clone::Clone;
13063            let token = self.0.request.page_token.clone();
13064            let execute = move |token: String| {
13065                let mut builder = self.clone();
13066                builder.0.request = builder.0.request.set_page_token(token);
13067                builder.send()
13068            };
13069            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13070        }
13071
13072        /// Streams each item in the collection.
13073        pub fn by_item(
13074            self,
13075        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13076            google_cloud_longrunning::model::ListOperationsResponse,
13077            crate::Error,
13078        > {
13079            use google_cloud_gax::paginator::Paginator;
13080            self.by_page().items()
13081        }
13082
13083        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13084        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13085            self.0.request.name = v.into();
13086            self
13087        }
13088
13089        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13090        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13091            self.0.request.filter = v.into();
13092            self
13093        }
13094
13095        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13096        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13097            self.0.request.page_size = v.into();
13098            self
13099        }
13100
13101        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13102        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13103            self.0.request.page_token = v.into();
13104            self
13105        }
13106
13107        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13108        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13109            self.0.request.return_partial_success = v.into();
13110            self
13111        }
13112    }
13113
13114    #[doc(hidden)]
13115    impl crate::RequestBuilder for ListOperations {
13116        fn request_options(&mut self) -> &mut crate::RequestOptions {
13117            &mut self.0.options
13118        }
13119    }
13120
13121    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
13122    ///
13123    /// # Example
13124    /// ```
13125    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
13126    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13127    ///
13128    /// let builder = prepare_request_builder();
13129    /// let response = builder.send().await?;
13130    /// # Ok(()) }
13131    ///
13132    /// fn prepare_request_builder() -> GetOperation {
13133    ///   # panic!();
13134    ///   // ... details omitted ...
13135    /// }
13136    /// ```
13137    #[derive(Clone, Debug)]
13138    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13139
13140    impl GetOperation {
13141        pub(crate) fn new(
13142            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13143        ) -> Self {
13144            Self(RequestBuilder::new(stub))
13145        }
13146
13147        /// Sets the full request, replacing any prior values.
13148        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13149            mut self,
13150            v: V,
13151        ) -> Self {
13152            self.0.request = v.into();
13153            self
13154        }
13155
13156        /// Sets all the options, replacing any prior values.
13157        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13158            self.0.options = v.into();
13159            self
13160        }
13161
13162        /// Sends the request.
13163        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13164            (*self.0.stub)
13165                .get_operation(self.0.request, self.0.options)
13166                .await
13167                .map(crate::Response::into_body)
13168        }
13169
13170        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13171        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13172            self.0.request.name = v.into();
13173            self
13174        }
13175    }
13176
13177    #[doc(hidden)]
13178    impl crate::RequestBuilder for GetOperation {
13179        fn request_options(&mut self) -> &mut crate::RequestOptions {
13180            &mut self.0.options
13181        }
13182    }
13183
13184    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
13185    ///
13186    /// # Example
13187    /// ```
13188    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
13189    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13190    ///
13191    /// let builder = prepare_request_builder();
13192    /// let response = builder.send().await?;
13193    /// # Ok(()) }
13194    ///
13195    /// fn prepare_request_builder() -> CancelOperation {
13196    ///   # panic!();
13197    ///   // ... details omitted ...
13198    /// }
13199    /// ```
13200    #[derive(Clone, Debug)]
13201    pub struct CancelOperation(
13202        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13203    );
13204
13205    impl CancelOperation {
13206        pub(crate) fn new(
13207            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13208        ) -> Self {
13209            Self(RequestBuilder::new(stub))
13210        }
13211
13212        /// Sets the full request, replacing any prior values.
13213        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13214            mut self,
13215            v: V,
13216        ) -> Self {
13217            self.0.request = v.into();
13218            self
13219        }
13220
13221        /// Sets all the options, replacing any prior values.
13222        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13223            self.0.options = v.into();
13224            self
13225        }
13226
13227        /// Sends the request.
13228        pub async fn send(self) -> Result<()> {
13229            (*self.0.stub)
13230                .cancel_operation(self.0.request, self.0.options)
13231                .await
13232                .map(crate::Response::into_body)
13233        }
13234
13235        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13236        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13237            self.0.request.name = v.into();
13238            self
13239        }
13240    }
13241
13242    #[doc(hidden)]
13243    impl crate::RequestBuilder for CancelOperation {
13244        fn request_options(&mut self) -> &mut crate::RequestOptions {
13245            &mut self.0.options
13246        }
13247    }
13248}
13249
13250/// Request and client builders for [SearchTuningService][crate::client::SearchTuningService].
13251#[cfg(feature = "search-tuning-service")]
13252#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
13253pub mod search_tuning_service {
13254    use crate::Result;
13255
13256    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
13257    ///
13258    /// ```
13259    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13260    /// # use google_cloud_discoveryengine_v1::*;
13261    /// # use builder::search_tuning_service::ClientBuilder;
13262    /// # use client::SearchTuningService;
13263    /// let builder : ClientBuilder = SearchTuningService::builder();
13264    /// let client = builder
13265    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13266    ///     .build().await?;
13267    /// # Ok(()) }
13268    /// ```
13269    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13270
13271    pub(crate) mod client {
13272        use super::super::super::client::SearchTuningService;
13273        pub struct Factory;
13274        impl crate::ClientFactory for Factory {
13275            type Client = SearchTuningService;
13276            type Credentials = gaxi::options::Credentials;
13277            async fn build(
13278                self,
13279                config: gaxi::options::ClientConfig,
13280            ) -> crate::ClientBuilderResult<Self::Client> {
13281                Self::Client::new(config).await
13282            }
13283        }
13284    }
13285
13286    /// Common implementation for [crate::client::SearchTuningService] request builders.
13287    #[derive(Clone, Debug)]
13288    pub(crate) struct RequestBuilder<R: std::default::Default> {
13289        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13290        request: R,
13291        options: crate::RequestOptions,
13292    }
13293
13294    impl<R> RequestBuilder<R>
13295    where
13296        R: std::default::Default,
13297    {
13298        pub(crate) fn new(
13299            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13300        ) -> Self {
13301            Self {
13302                stub,
13303                request: R::default(),
13304                options: crate::RequestOptions::default(),
13305            }
13306        }
13307    }
13308
13309    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
13310    ///
13311    /// # Example
13312    /// ```
13313    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
13314    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13315    /// use google_cloud_lro::Poller;
13316    ///
13317    /// let builder = prepare_request_builder();
13318    /// let response = builder.poller().until_done().await?;
13319    /// # Ok(()) }
13320    ///
13321    /// fn prepare_request_builder() -> TrainCustomModel {
13322    ///   # panic!();
13323    ///   // ... details omitted ...
13324    /// }
13325    /// ```
13326    #[derive(Clone, Debug)]
13327    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
13328
13329    impl TrainCustomModel {
13330        pub(crate) fn new(
13331            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13332        ) -> Self {
13333            Self(RequestBuilder::new(stub))
13334        }
13335
13336        /// Sets the full request, replacing any prior values.
13337        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
13338            mut self,
13339            v: V,
13340        ) -> Self {
13341            self.0.request = v.into();
13342            self
13343        }
13344
13345        /// Sets all the options, replacing any prior values.
13346        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13347            self.0.options = v.into();
13348            self
13349        }
13350
13351        /// Sends the request.
13352        ///
13353        /// # Long running operations
13354        ///
13355        /// This starts, but does not poll, a longrunning operation. More information
13356        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
13357        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13358            (*self.0.stub)
13359                .train_custom_model(self.0.request, self.0.options)
13360                .await
13361                .map(crate::Response::into_body)
13362        }
13363
13364        /// Creates a [Poller][google_cloud_lro::Poller] to work with `train_custom_model`.
13365        pub fn poller(
13366            self,
13367        ) -> impl google_cloud_lro::Poller<
13368            crate::model::TrainCustomModelResponse,
13369            crate::model::TrainCustomModelMetadata,
13370        > {
13371            type Operation = google_cloud_lro::internal::Operation<
13372                crate::model::TrainCustomModelResponse,
13373                crate::model::TrainCustomModelMetadata,
13374            >;
13375            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
13376            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
13377            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
13378            if let Some(ref mut details) = poller_options.tracing {
13379                details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
13380            }
13381
13382            let stub = self.0.stub.clone();
13383            let mut options = self.0.options.clone();
13384            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
13385            let query = move |name| {
13386                let stub = stub.clone();
13387                let options = options.clone();
13388                async {
13389                    let op = GetOperation::new(stub)
13390                        .set_name(name)
13391                        .with_options(options)
13392                        .send()
13393                        .await?;
13394                    Ok(Operation::new(op))
13395                }
13396            };
13397
13398            let start = move || async {
13399                let op = self.send().await?;
13400                Ok(Operation::new(op))
13401            };
13402
13403            use google_cloud_lro::internal::PollerExt;
13404            {
13405                google_cloud_lro::internal::new_poller(
13406                    polling_error_policy,
13407                    polling_backoff_policy,
13408                    start,
13409                    query,
13410                )
13411            }
13412            .with_options(poller_options)
13413        }
13414
13415        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
13416        ///
13417        /// This is a **required** field for requests.
13418        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
13419            self.0.request.data_store = v.into();
13420            self
13421        }
13422
13423        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
13424        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
13425            self.0.request.model_type = v.into();
13426            self
13427        }
13428
13429        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
13430        pub fn set_error_config<T>(mut self, v: T) -> Self
13431        where
13432            T: std::convert::Into<crate::model::ImportErrorConfig>,
13433        {
13434            self.0.request.error_config = std::option::Option::Some(v.into());
13435            self
13436        }
13437
13438        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
13439        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
13440        where
13441            T: std::convert::Into<crate::model::ImportErrorConfig>,
13442        {
13443            self.0.request.error_config = v.map(|x| x.into());
13444            self
13445        }
13446
13447        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
13448        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13449            self.0.request.model_id = v.into();
13450            self
13451        }
13452
13453        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
13454        ///
13455        /// Note that all the setters affecting `training_input` are
13456        /// mutually exclusive.
13457        pub fn set_training_input<
13458            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
13459        >(
13460            mut self,
13461            v: T,
13462        ) -> Self {
13463            self.0.request.training_input = v.into();
13464            self
13465        }
13466
13467        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
13468        /// to hold a `GcsTrainingInput`.
13469        ///
13470        /// Note that all the setters affecting `training_input` are
13471        /// mutually exclusive.
13472        pub fn set_gcs_training_input<
13473            T: std::convert::Into<
13474                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
13475                >,
13476        >(
13477            mut self,
13478            v: T,
13479        ) -> Self {
13480            self.0.request = self.0.request.set_gcs_training_input(v);
13481            self
13482        }
13483    }
13484
13485    #[doc(hidden)]
13486    impl crate::RequestBuilder for TrainCustomModel {
13487        fn request_options(&mut self) -> &mut crate::RequestOptions {
13488            &mut self.0.options
13489        }
13490    }
13491
13492    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
13493    ///
13494    /// # Example
13495    /// ```
13496    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
13497    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13498    ///
13499    /// let builder = prepare_request_builder();
13500    /// let response = builder.send().await?;
13501    /// # Ok(()) }
13502    ///
13503    /// fn prepare_request_builder() -> ListCustomModels {
13504    ///   # panic!();
13505    ///   // ... details omitted ...
13506    /// }
13507    /// ```
13508    #[derive(Clone, Debug)]
13509    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
13510
13511    impl ListCustomModels {
13512        pub(crate) fn new(
13513            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13514        ) -> Self {
13515            Self(RequestBuilder::new(stub))
13516        }
13517
13518        /// Sets the full request, replacing any prior values.
13519        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
13520            mut self,
13521            v: V,
13522        ) -> Self {
13523            self.0.request = v.into();
13524            self
13525        }
13526
13527        /// Sets all the options, replacing any prior values.
13528        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13529            self.0.options = v.into();
13530            self
13531        }
13532
13533        /// Sends the request.
13534        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
13535            (*self.0.stub)
13536                .list_custom_models(self.0.request, self.0.options)
13537                .await
13538                .map(crate::Response::into_body)
13539        }
13540
13541        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
13542        ///
13543        /// This is a **required** field for requests.
13544        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
13545            self.0.request.data_store = v.into();
13546            self
13547        }
13548    }
13549
13550    #[doc(hidden)]
13551    impl crate::RequestBuilder for ListCustomModels {
13552        fn request_options(&mut self) -> &mut crate::RequestOptions {
13553            &mut self.0.options
13554        }
13555    }
13556
13557    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
13558    ///
13559    /// # Example
13560    /// ```
13561    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
13562    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13563    /// use google_cloud_gax::paginator::ItemPaginator;
13564    ///
13565    /// let builder = prepare_request_builder();
13566    /// let mut items = builder.by_item();
13567    /// while let Some(result) = items.next().await {
13568    ///   let item = result?;
13569    /// }
13570    /// # Ok(()) }
13571    ///
13572    /// fn prepare_request_builder() -> ListOperations {
13573    ///   # panic!();
13574    ///   // ... details omitted ...
13575    /// }
13576    /// ```
13577    #[derive(Clone, Debug)]
13578    pub struct ListOperations(
13579        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13580    );
13581
13582    impl ListOperations {
13583        pub(crate) fn new(
13584            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13585        ) -> Self {
13586            Self(RequestBuilder::new(stub))
13587        }
13588
13589        /// Sets the full request, replacing any prior values.
13590        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13591            mut self,
13592            v: V,
13593        ) -> Self {
13594            self.0.request = v.into();
13595            self
13596        }
13597
13598        /// Sets all the options, replacing any prior values.
13599        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13600            self.0.options = v.into();
13601            self
13602        }
13603
13604        /// Sends the request.
13605        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13606            (*self.0.stub)
13607                .list_operations(self.0.request, self.0.options)
13608                .await
13609                .map(crate::Response::into_body)
13610        }
13611
13612        /// Streams each page in the collection.
13613        pub fn by_page(
13614            self,
13615        ) -> impl google_cloud_gax::paginator::Paginator<
13616            google_cloud_longrunning::model::ListOperationsResponse,
13617            crate::Error,
13618        > {
13619            use std::clone::Clone;
13620            let token = self.0.request.page_token.clone();
13621            let execute = move |token: String| {
13622                let mut builder = self.clone();
13623                builder.0.request = builder.0.request.set_page_token(token);
13624                builder.send()
13625            };
13626            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13627        }
13628
13629        /// Streams each item in the collection.
13630        pub fn by_item(
13631            self,
13632        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13633            google_cloud_longrunning::model::ListOperationsResponse,
13634            crate::Error,
13635        > {
13636            use google_cloud_gax::paginator::Paginator;
13637            self.by_page().items()
13638        }
13639
13640        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13641        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13642            self.0.request.name = v.into();
13643            self
13644        }
13645
13646        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13647        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13648            self.0.request.filter = v.into();
13649            self
13650        }
13651
13652        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13653        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13654            self.0.request.page_size = v.into();
13655            self
13656        }
13657
13658        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13659        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13660            self.0.request.page_token = v.into();
13661            self
13662        }
13663
13664        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13665        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13666            self.0.request.return_partial_success = v.into();
13667            self
13668        }
13669    }
13670
13671    #[doc(hidden)]
13672    impl crate::RequestBuilder for ListOperations {
13673        fn request_options(&mut self) -> &mut crate::RequestOptions {
13674            &mut self.0.options
13675        }
13676    }
13677
13678    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
13679    ///
13680    /// # Example
13681    /// ```
13682    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
13683    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13684    ///
13685    /// let builder = prepare_request_builder();
13686    /// let response = builder.send().await?;
13687    /// # Ok(()) }
13688    ///
13689    /// fn prepare_request_builder() -> GetOperation {
13690    ///   # panic!();
13691    ///   // ... details omitted ...
13692    /// }
13693    /// ```
13694    #[derive(Clone, Debug)]
13695    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13696
13697    impl GetOperation {
13698        pub(crate) fn new(
13699            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13700        ) -> Self {
13701            Self(RequestBuilder::new(stub))
13702        }
13703
13704        /// Sets the full request, replacing any prior values.
13705        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13706            mut self,
13707            v: V,
13708        ) -> Self {
13709            self.0.request = v.into();
13710            self
13711        }
13712
13713        /// Sets all the options, replacing any prior values.
13714        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13715            self.0.options = v.into();
13716            self
13717        }
13718
13719        /// Sends the request.
13720        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13721            (*self.0.stub)
13722                .get_operation(self.0.request, self.0.options)
13723                .await
13724                .map(crate::Response::into_body)
13725        }
13726
13727        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13728        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13729            self.0.request.name = v.into();
13730            self
13731        }
13732    }
13733
13734    #[doc(hidden)]
13735    impl crate::RequestBuilder for GetOperation {
13736        fn request_options(&mut self) -> &mut crate::RequestOptions {
13737            &mut self.0.options
13738        }
13739    }
13740
13741    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
13742    ///
13743    /// # Example
13744    /// ```
13745    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
13746    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13747    ///
13748    /// let builder = prepare_request_builder();
13749    /// let response = builder.send().await?;
13750    /// # Ok(()) }
13751    ///
13752    /// fn prepare_request_builder() -> CancelOperation {
13753    ///   # panic!();
13754    ///   // ... details omitted ...
13755    /// }
13756    /// ```
13757    #[derive(Clone, Debug)]
13758    pub struct CancelOperation(
13759        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13760    );
13761
13762    impl CancelOperation {
13763        pub(crate) fn new(
13764            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13765        ) -> Self {
13766            Self(RequestBuilder::new(stub))
13767        }
13768
13769        /// Sets the full request, replacing any prior values.
13770        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13771            mut self,
13772            v: V,
13773        ) -> Self {
13774            self.0.request = v.into();
13775            self
13776        }
13777
13778        /// Sets all the options, replacing any prior values.
13779        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13780            self.0.options = v.into();
13781            self
13782        }
13783
13784        /// Sends the request.
13785        pub async fn send(self) -> Result<()> {
13786            (*self.0.stub)
13787                .cancel_operation(self.0.request, self.0.options)
13788                .await
13789                .map(crate::Response::into_body)
13790        }
13791
13792        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13793        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13794            self.0.request.name = v.into();
13795            self
13796        }
13797    }
13798
13799    #[doc(hidden)]
13800    impl crate::RequestBuilder for CancelOperation {
13801        fn request_options(&mut self) -> &mut crate::RequestOptions {
13802            &mut self.0.options
13803        }
13804    }
13805}
13806
13807/// Request and client builders for [ServingConfigService][crate::client::ServingConfigService].
13808#[cfg(feature = "serving-config-service")]
13809#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13810pub mod serving_config_service {
13811    use crate::Result;
13812
13813    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
13814    ///
13815    /// ```
13816    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13817    /// # use google_cloud_discoveryengine_v1::*;
13818    /// # use builder::serving_config_service::ClientBuilder;
13819    /// # use client::ServingConfigService;
13820    /// let builder : ClientBuilder = ServingConfigService::builder();
13821    /// let client = builder
13822    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13823    ///     .build().await?;
13824    /// # Ok(()) }
13825    /// ```
13826    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13827
13828    pub(crate) mod client {
13829        use super::super::super::client::ServingConfigService;
13830        pub struct Factory;
13831        impl crate::ClientFactory for Factory {
13832            type Client = ServingConfigService;
13833            type Credentials = gaxi::options::Credentials;
13834            async fn build(
13835                self,
13836                config: gaxi::options::ClientConfig,
13837            ) -> crate::ClientBuilderResult<Self::Client> {
13838                Self::Client::new(config).await
13839            }
13840        }
13841    }
13842
13843    /// Common implementation for [crate::client::ServingConfigService] request builders.
13844    #[derive(Clone, Debug)]
13845    pub(crate) struct RequestBuilder<R: std::default::Default> {
13846        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13847        request: R,
13848        options: crate::RequestOptions,
13849    }
13850
13851    impl<R> RequestBuilder<R>
13852    where
13853        R: std::default::Default,
13854    {
13855        pub(crate) fn new(
13856            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13857        ) -> Self {
13858            Self {
13859                stub,
13860                request: R::default(),
13861                options: crate::RequestOptions::default(),
13862            }
13863        }
13864    }
13865
13866    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
13867    ///
13868    /// # Example
13869    /// ```
13870    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
13871    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13872    ///
13873    /// let builder = prepare_request_builder();
13874    /// let response = builder.send().await?;
13875    /// # Ok(()) }
13876    ///
13877    /// fn prepare_request_builder() -> UpdateServingConfig {
13878    ///   # panic!();
13879    ///   // ... details omitted ...
13880    /// }
13881    /// ```
13882    #[derive(Clone, Debug)]
13883    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13884
13885    impl UpdateServingConfig {
13886        pub(crate) fn new(
13887            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13888        ) -> Self {
13889            Self(RequestBuilder::new(stub))
13890        }
13891
13892        /// Sets the full request, replacing any prior values.
13893        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13894            mut self,
13895            v: V,
13896        ) -> Self {
13897            self.0.request = v.into();
13898            self
13899        }
13900
13901        /// Sets all the options, replacing any prior values.
13902        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13903            self.0.options = v.into();
13904            self
13905        }
13906
13907        /// Sends the request.
13908        pub async fn send(self) -> Result<crate::model::ServingConfig> {
13909            (*self.0.stub)
13910                .update_serving_config(self.0.request, self.0.options)
13911                .await
13912                .map(crate::Response::into_body)
13913        }
13914
13915        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13916        ///
13917        /// This is a **required** field for requests.
13918        pub fn set_serving_config<T>(mut self, v: T) -> Self
13919        where
13920            T: std::convert::Into<crate::model::ServingConfig>,
13921        {
13922            self.0.request.serving_config = std::option::Option::Some(v.into());
13923            self
13924        }
13925
13926        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13927        ///
13928        /// This is a **required** field for requests.
13929        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13930        where
13931            T: std::convert::Into<crate::model::ServingConfig>,
13932        {
13933            self.0.request.serving_config = v.map(|x| x.into());
13934            self
13935        }
13936
13937        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13938        pub fn set_update_mask<T>(mut self, v: T) -> Self
13939        where
13940            T: std::convert::Into<wkt::FieldMask>,
13941        {
13942            self.0.request.update_mask = std::option::Option::Some(v.into());
13943            self
13944        }
13945
13946        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13947        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13948        where
13949            T: std::convert::Into<wkt::FieldMask>,
13950        {
13951            self.0.request.update_mask = v.map(|x| x.into());
13952            self
13953        }
13954    }
13955
13956    #[doc(hidden)]
13957    impl crate::RequestBuilder for UpdateServingConfig {
13958        fn request_options(&mut self) -> &mut crate::RequestOptions {
13959            &mut self.0.options
13960        }
13961    }
13962
13963    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
13964    ///
13965    /// # Example
13966    /// ```
13967    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
13968    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13969    /// use google_cloud_gax::paginator::ItemPaginator;
13970    ///
13971    /// let builder = prepare_request_builder();
13972    /// let mut items = builder.by_item();
13973    /// while let Some(result) = items.next().await {
13974    ///   let item = result?;
13975    /// }
13976    /// # Ok(()) }
13977    ///
13978    /// fn prepare_request_builder() -> ListOperations {
13979    ///   # panic!();
13980    ///   // ... details omitted ...
13981    /// }
13982    /// ```
13983    #[derive(Clone, Debug)]
13984    pub struct ListOperations(
13985        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13986    );
13987
13988    impl ListOperations {
13989        pub(crate) fn new(
13990            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13991        ) -> Self {
13992            Self(RequestBuilder::new(stub))
13993        }
13994
13995        /// Sets the full request, replacing any prior values.
13996        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13997            mut self,
13998            v: V,
13999        ) -> Self {
14000            self.0.request = v.into();
14001            self
14002        }
14003
14004        /// Sets all the options, replacing any prior values.
14005        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14006            self.0.options = v.into();
14007            self
14008        }
14009
14010        /// Sends the request.
14011        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14012            (*self.0.stub)
14013                .list_operations(self.0.request, self.0.options)
14014                .await
14015                .map(crate::Response::into_body)
14016        }
14017
14018        /// Streams each page in the collection.
14019        pub fn by_page(
14020            self,
14021        ) -> impl google_cloud_gax::paginator::Paginator<
14022            google_cloud_longrunning::model::ListOperationsResponse,
14023            crate::Error,
14024        > {
14025            use std::clone::Clone;
14026            let token = self.0.request.page_token.clone();
14027            let execute = move |token: String| {
14028                let mut builder = self.clone();
14029                builder.0.request = builder.0.request.set_page_token(token);
14030                builder.send()
14031            };
14032            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14033        }
14034
14035        /// Streams each item in the collection.
14036        pub fn by_item(
14037            self,
14038        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14039            google_cloud_longrunning::model::ListOperationsResponse,
14040            crate::Error,
14041        > {
14042            use google_cloud_gax::paginator::Paginator;
14043            self.by_page().items()
14044        }
14045
14046        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
14047        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14048            self.0.request.name = v.into();
14049            self
14050        }
14051
14052        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
14053        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14054            self.0.request.filter = v.into();
14055            self
14056        }
14057
14058        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
14059        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14060            self.0.request.page_size = v.into();
14061            self
14062        }
14063
14064        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14065        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14066            self.0.request.page_token = v.into();
14067            self
14068        }
14069
14070        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14071        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14072            self.0.request.return_partial_success = v.into();
14073            self
14074        }
14075    }
14076
14077    #[doc(hidden)]
14078    impl crate::RequestBuilder for ListOperations {
14079        fn request_options(&mut self) -> &mut crate::RequestOptions {
14080            &mut self.0.options
14081        }
14082    }
14083
14084    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
14085    ///
14086    /// # Example
14087    /// ```
14088    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
14089    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14090    ///
14091    /// let builder = prepare_request_builder();
14092    /// let response = builder.send().await?;
14093    /// # Ok(()) }
14094    ///
14095    /// fn prepare_request_builder() -> GetOperation {
14096    ///   # panic!();
14097    ///   // ... details omitted ...
14098    /// }
14099    /// ```
14100    #[derive(Clone, Debug)]
14101    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14102
14103    impl GetOperation {
14104        pub(crate) fn new(
14105            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
14106        ) -> Self {
14107            Self(RequestBuilder::new(stub))
14108        }
14109
14110        /// Sets the full request, replacing any prior values.
14111        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14112            mut self,
14113            v: V,
14114        ) -> Self {
14115            self.0.request = v.into();
14116            self
14117        }
14118
14119        /// Sets all the options, replacing any prior values.
14120        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14121            self.0.options = v.into();
14122            self
14123        }
14124
14125        /// Sends the request.
14126        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14127            (*self.0.stub)
14128                .get_operation(self.0.request, self.0.options)
14129                .await
14130                .map(crate::Response::into_body)
14131        }
14132
14133        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14134        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14135            self.0.request.name = v.into();
14136            self
14137        }
14138    }
14139
14140    #[doc(hidden)]
14141    impl crate::RequestBuilder for GetOperation {
14142        fn request_options(&mut self) -> &mut crate::RequestOptions {
14143            &mut self.0.options
14144        }
14145    }
14146
14147    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
14148    ///
14149    /// # Example
14150    /// ```
14151    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
14152    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14153    ///
14154    /// let builder = prepare_request_builder();
14155    /// let response = builder.send().await?;
14156    /// # Ok(()) }
14157    ///
14158    /// fn prepare_request_builder() -> CancelOperation {
14159    ///   # panic!();
14160    ///   // ... details omitted ...
14161    /// }
14162    /// ```
14163    #[derive(Clone, Debug)]
14164    pub struct CancelOperation(
14165        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14166    );
14167
14168    impl CancelOperation {
14169        pub(crate) fn new(
14170            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
14171        ) -> Self {
14172            Self(RequestBuilder::new(stub))
14173        }
14174
14175        /// Sets the full request, replacing any prior values.
14176        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14177            mut self,
14178            v: V,
14179        ) -> Self {
14180            self.0.request = v.into();
14181            self
14182        }
14183
14184        /// Sets all the options, replacing any prior values.
14185        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14186            self.0.options = v.into();
14187            self
14188        }
14189
14190        /// Sends the request.
14191        pub async fn send(self) -> Result<()> {
14192            (*self.0.stub)
14193                .cancel_operation(self.0.request, self.0.options)
14194                .await
14195                .map(crate::Response::into_body)
14196        }
14197
14198        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14199        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14200            self.0.request.name = v.into();
14201            self
14202        }
14203    }
14204
14205    #[doc(hidden)]
14206    impl crate::RequestBuilder for CancelOperation {
14207        fn request_options(&mut self) -> &mut crate::RequestOptions {
14208            &mut self.0.options
14209        }
14210    }
14211}
14212
14213/// Request and client builders for [SessionService][crate::client::SessionService].
14214#[cfg(feature = "session-service")]
14215#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
14216pub mod session_service {
14217    use crate::Result;
14218
14219    /// A builder for [SessionService][crate::client::SessionService].
14220    ///
14221    /// ```
14222    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14223    /// # use google_cloud_discoveryengine_v1::*;
14224    /// # use builder::session_service::ClientBuilder;
14225    /// # use client::SessionService;
14226    /// let builder : ClientBuilder = SessionService::builder();
14227    /// let client = builder
14228    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14229    ///     .build().await?;
14230    /// # Ok(()) }
14231    /// ```
14232    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14233
14234    pub(crate) mod client {
14235        use super::super::super::client::SessionService;
14236        pub struct Factory;
14237        impl crate::ClientFactory for Factory {
14238            type Client = SessionService;
14239            type Credentials = gaxi::options::Credentials;
14240            async fn build(
14241                self,
14242                config: gaxi::options::ClientConfig,
14243            ) -> crate::ClientBuilderResult<Self::Client> {
14244                Self::Client::new(config).await
14245            }
14246        }
14247    }
14248
14249    /// Common implementation for [crate::client::SessionService] request builders.
14250    #[derive(Clone, Debug)]
14251    pub(crate) struct RequestBuilder<R: std::default::Default> {
14252        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14253        request: R,
14254        options: crate::RequestOptions,
14255    }
14256
14257    impl<R> RequestBuilder<R>
14258    where
14259        R: std::default::Default,
14260    {
14261        pub(crate) fn new(
14262            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14263        ) -> Self {
14264            Self {
14265                stub,
14266                request: R::default(),
14267                options: crate::RequestOptions::default(),
14268            }
14269        }
14270    }
14271
14272    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
14273    ///
14274    /// # Example
14275    /// ```
14276    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
14277    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14278    ///
14279    /// let builder = prepare_request_builder();
14280    /// let response = builder.send().await?;
14281    /// # Ok(()) }
14282    ///
14283    /// fn prepare_request_builder() -> CreateSession {
14284    ///   # panic!();
14285    ///   // ... details omitted ...
14286    /// }
14287    /// ```
14288    #[derive(Clone, Debug)]
14289    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
14290
14291    impl CreateSession {
14292        pub(crate) fn new(
14293            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14294        ) -> Self {
14295            Self(RequestBuilder::new(stub))
14296        }
14297
14298        /// Sets the full request, replacing any prior values.
14299        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
14300            self.0.request = v.into();
14301            self
14302        }
14303
14304        /// Sets all the options, replacing any prior values.
14305        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14306            self.0.options = v.into();
14307            self
14308        }
14309
14310        /// Sends the request.
14311        pub async fn send(self) -> Result<crate::model::Session> {
14312            (*self.0.stub)
14313                .create_session(self.0.request, self.0.options)
14314                .await
14315                .map(crate::Response::into_body)
14316        }
14317
14318        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
14319        ///
14320        /// This is a **required** field for requests.
14321        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14322            self.0.request.parent = v.into();
14323            self
14324        }
14325
14326        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
14327        ///
14328        /// This is a **required** field for requests.
14329        pub fn set_session<T>(mut self, v: T) -> Self
14330        where
14331            T: std::convert::Into<crate::model::Session>,
14332        {
14333            self.0.request.session = std::option::Option::Some(v.into());
14334            self
14335        }
14336
14337        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
14338        ///
14339        /// This is a **required** field for requests.
14340        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
14341        where
14342            T: std::convert::Into<crate::model::Session>,
14343        {
14344            self.0.request.session = v.map(|x| x.into());
14345            self
14346        }
14347    }
14348
14349    #[doc(hidden)]
14350    impl crate::RequestBuilder for CreateSession {
14351        fn request_options(&mut self) -> &mut crate::RequestOptions {
14352            &mut self.0.options
14353        }
14354    }
14355
14356    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
14357    ///
14358    /// # Example
14359    /// ```
14360    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
14361    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14362    ///
14363    /// let builder = prepare_request_builder();
14364    /// let response = builder.send().await?;
14365    /// # Ok(()) }
14366    ///
14367    /// fn prepare_request_builder() -> DeleteSession {
14368    ///   # panic!();
14369    ///   // ... details omitted ...
14370    /// }
14371    /// ```
14372    #[derive(Clone, Debug)]
14373    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
14374
14375    impl DeleteSession {
14376        pub(crate) fn new(
14377            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14378        ) -> Self {
14379            Self(RequestBuilder::new(stub))
14380        }
14381
14382        /// Sets the full request, replacing any prior values.
14383        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
14384            self.0.request = v.into();
14385            self
14386        }
14387
14388        /// Sets all the options, replacing any prior values.
14389        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14390            self.0.options = v.into();
14391            self
14392        }
14393
14394        /// Sends the request.
14395        pub async fn send(self) -> Result<()> {
14396            (*self.0.stub)
14397                .delete_session(self.0.request, self.0.options)
14398                .await
14399                .map(crate::Response::into_body)
14400        }
14401
14402        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
14403        ///
14404        /// This is a **required** field for requests.
14405        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14406            self.0.request.name = v.into();
14407            self
14408        }
14409    }
14410
14411    #[doc(hidden)]
14412    impl crate::RequestBuilder for DeleteSession {
14413        fn request_options(&mut self) -> &mut crate::RequestOptions {
14414            &mut self.0.options
14415        }
14416    }
14417
14418    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
14419    ///
14420    /// # Example
14421    /// ```
14422    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
14423    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14424    ///
14425    /// let builder = prepare_request_builder();
14426    /// let response = builder.send().await?;
14427    /// # Ok(()) }
14428    ///
14429    /// fn prepare_request_builder() -> UpdateSession {
14430    ///   # panic!();
14431    ///   // ... details omitted ...
14432    /// }
14433    /// ```
14434    #[derive(Clone, Debug)]
14435    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
14436
14437    impl UpdateSession {
14438        pub(crate) fn new(
14439            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14440        ) -> Self {
14441            Self(RequestBuilder::new(stub))
14442        }
14443
14444        /// Sets the full request, replacing any prior values.
14445        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
14446            self.0.request = v.into();
14447            self
14448        }
14449
14450        /// Sets all the options, replacing any prior values.
14451        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14452            self.0.options = v.into();
14453            self
14454        }
14455
14456        /// Sends the request.
14457        pub async fn send(self) -> Result<crate::model::Session> {
14458            (*self.0.stub)
14459                .update_session(self.0.request, self.0.options)
14460                .await
14461                .map(crate::Response::into_body)
14462        }
14463
14464        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
14465        ///
14466        /// This is a **required** field for requests.
14467        pub fn set_session<T>(mut self, v: T) -> Self
14468        where
14469            T: std::convert::Into<crate::model::Session>,
14470        {
14471            self.0.request.session = std::option::Option::Some(v.into());
14472            self
14473        }
14474
14475        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
14476        ///
14477        /// This is a **required** field for requests.
14478        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
14479        where
14480            T: std::convert::Into<crate::model::Session>,
14481        {
14482            self.0.request.session = v.map(|x| x.into());
14483            self
14484        }
14485
14486        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
14487        pub fn set_update_mask<T>(mut self, v: T) -> Self
14488        where
14489            T: std::convert::Into<wkt::FieldMask>,
14490        {
14491            self.0.request.update_mask = std::option::Option::Some(v.into());
14492            self
14493        }
14494
14495        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
14496        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14497        where
14498            T: std::convert::Into<wkt::FieldMask>,
14499        {
14500            self.0.request.update_mask = v.map(|x| x.into());
14501            self
14502        }
14503    }
14504
14505    #[doc(hidden)]
14506    impl crate::RequestBuilder for UpdateSession {
14507        fn request_options(&mut self) -> &mut crate::RequestOptions {
14508            &mut self.0.options
14509        }
14510    }
14511
14512    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
14513    ///
14514    /// # Example
14515    /// ```
14516    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
14517    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14518    ///
14519    /// let builder = prepare_request_builder();
14520    /// let response = builder.send().await?;
14521    /// # Ok(()) }
14522    ///
14523    /// fn prepare_request_builder() -> GetSession {
14524    ///   # panic!();
14525    ///   // ... details omitted ...
14526    /// }
14527    /// ```
14528    #[derive(Clone, Debug)]
14529    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
14530
14531    impl GetSession {
14532        pub(crate) fn new(
14533            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14534        ) -> Self {
14535            Self(RequestBuilder::new(stub))
14536        }
14537
14538        /// Sets the full request, replacing any prior values.
14539        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
14540            self.0.request = v.into();
14541            self
14542        }
14543
14544        /// Sets all the options, replacing any prior values.
14545        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14546            self.0.options = v.into();
14547            self
14548        }
14549
14550        /// Sends the request.
14551        pub async fn send(self) -> Result<crate::model::Session> {
14552            (*self.0.stub)
14553                .get_session(self.0.request, self.0.options)
14554                .await
14555                .map(crate::Response::into_body)
14556        }
14557
14558        /// Sets the value of [name][crate::model::GetSessionRequest::name].
14559        ///
14560        /// This is a **required** field for requests.
14561        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14562            self.0.request.name = v.into();
14563            self
14564        }
14565
14566        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
14567        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
14568            self.0.request.include_answer_details = v.into();
14569            self
14570        }
14571    }
14572
14573    #[doc(hidden)]
14574    impl crate::RequestBuilder for GetSession {
14575        fn request_options(&mut self) -> &mut crate::RequestOptions {
14576            &mut self.0.options
14577        }
14578    }
14579
14580    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
14581    ///
14582    /// # Example
14583    /// ```
14584    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
14585    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14586    /// use google_cloud_gax::paginator::ItemPaginator;
14587    ///
14588    /// let builder = prepare_request_builder();
14589    /// let mut items = builder.by_item();
14590    /// while let Some(result) = items.next().await {
14591    ///   let item = result?;
14592    /// }
14593    /// # Ok(()) }
14594    ///
14595    /// fn prepare_request_builder() -> ListSessions {
14596    ///   # panic!();
14597    ///   // ... details omitted ...
14598    /// }
14599    /// ```
14600    #[derive(Clone, Debug)]
14601    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
14602
14603    impl ListSessions {
14604        pub(crate) fn new(
14605            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14606        ) -> Self {
14607            Self(RequestBuilder::new(stub))
14608        }
14609
14610        /// Sets the full request, replacing any prior values.
14611        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
14612            self.0.request = v.into();
14613            self
14614        }
14615
14616        /// Sets all the options, replacing any prior values.
14617        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14618            self.0.options = v.into();
14619            self
14620        }
14621
14622        /// Sends the request.
14623        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14624            (*self.0.stub)
14625                .list_sessions(self.0.request, self.0.options)
14626                .await
14627                .map(crate::Response::into_body)
14628        }
14629
14630        /// Streams each page in the collection.
14631        pub fn by_page(
14632            self,
14633        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14634        {
14635            use std::clone::Clone;
14636            let token = self.0.request.page_token.clone();
14637            let execute = move |token: String| {
14638                let mut builder = self.clone();
14639                builder.0.request = builder.0.request.set_page_token(token);
14640                builder.send()
14641            };
14642            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14643        }
14644
14645        /// Streams each item in the collection.
14646        pub fn by_item(
14647            self,
14648        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14649            crate::model::ListSessionsResponse,
14650            crate::Error,
14651        > {
14652            use google_cloud_gax::paginator::Paginator;
14653            self.by_page().items()
14654        }
14655
14656        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
14657        ///
14658        /// This is a **required** field for requests.
14659        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14660            self.0.request.parent = v.into();
14661            self
14662        }
14663
14664        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
14665        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14666            self.0.request.page_size = v.into();
14667            self
14668        }
14669
14670        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
14671        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14672            self.0.request.page_token = v.into();
14673            self
14674        }
14675
14676        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
14677        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14678            self.0.request.filter = v.into();
14679            self
14680        }
14681
14682        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
14683        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14684            self.0.request.order_by = v.into();
14685            self
14686        }
14687    }
14688
14689    #[doc(hidden)]
14690    impl crate::RequestBuilder for ListSessions {
14691        fn request_options(&mut self) -> &mut crate::RequestOptions {
14692            &mut self.0.options
14693        }
14694    }
14695
14696    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
14697    ///
14698    /// # Example
14699    /// ```
14700    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
14701    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14702    /// use google_cloud_gax::paginator::ItemPaginator;
14703    ///
14704    /// let builder = prepare_request_builder();
14705    /// let mut items = builder.by_item();
14706    /// while let Some(result) = items.next().await {
14707    ///   let item = result?;
14708    /// }
14709    /// # Ok(()) }
14710    ///
14711    /// fn prepare_request_builder() -> ListOperations {
14712    ///   # panic!();
14713    ///   // ... details omitted ...
14714    /// }
14715    /// ```
14716    #[derive(Clone, Debug)]
14717    pub struct ListOperations(
14718        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14719    );
14720
14721    impl ListOperations {
14722        pub(crate) fn new(
14723            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14724        ) -> Self {
14725            Self(RequestBuilder::new(stub))
14726        }
14727
14728        /// Sets the full request, replacing any prior values.
14729        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14730            mut self,
14731            v: V,
14732        ) -> Self {
14733            self.0.request = v.into();
14734            self
14735        }
14736
14737        /// Sets all the options, replacing any prior values.
14738        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14739            self.0.options = v.into();
14740            self
14741        }
14742
14743        /// Sends the request.
14744        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14745            (*self.0.stub)
14746                .list_operations(self.0.request, self.0.options)
14747                .await
14748                .map(crate::Response::into_body)
14749        }
14750
14751        /// Streams each page in the collection.
14752        pub fn by_page(
14753            self,
14754        ) -> impl google_cloud_gax::paginator::Paginator<
14755            google_cloud_longrunning::model::ListOperationsResponse,
14756            crate::Error,
14757        > {
14758            use std::clone::Clone;
14759            let token = self.0.request.page_token.clone();
14760            let execute = move |token: String| {
14761                let mut builder = self.clone();
14762                builder.0.request = builder.0.request.set_page_token(token);
14763                builder.send()
14764            };
14765            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14766        }
14767
14768        /// Streams each item in the collection.
14769        pub fn by_item(
14770            self,
14771        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14772            google_cloud_longrunning::model::ListOperationsResponse,
14773            crate::Error,
14774        > {
14775            use google_cloud_gax::paginator::Paginator;
14776            self.by_page().items()
14777        }
14778
14779        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
14780        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14781            self.0.request.name = v.into();
14782            self
14783        }
14784
14785        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
14786        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14787            self.0.request.filter = v.into();
14788            self
14789        }
14790
14791        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
14792        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14793            self.0.request.page_size = v.into();
14794            self
14795        }
14796
14797        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14798        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14799            self.0.request.page_token = v.into();
14800            self
14801        }
14802
14803        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14804        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14805            self.0.request.return_partial_success = v.into();
14806            self
14807        }
14808    }
14809
14810    #[doc(hidden)]
14811    impl crate::RequestBuilder for ListOperations {
14812        fn request_options(&mut self) -> &mut crate::RequestOptions {
14813            &mut self.0.options
14814        }
14815    }
14816
14817    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
14818    ///
14819    /// # Example
14820    /// ```
14821    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
14822    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14823    ///
14824    /// let builder = prepare_request_builder();
14825    /// let response = builder.send().await?;
14826    /// # Ok(()) }
14827    ///
14828    /// fn prepare_request_builder() -> GetOperation {
14829    ///   # panic!();
14830    ///   // ... details omitted ...
14831    /// }
14832    /// ```
14833    #[derive(Clone, Debug)]
14834    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14835
14836    impl GetOperation {
14837        pub(crate) fn new(
14838            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14839        ) -> Self {
14840            Self(RequestBuilder::new(stub))
14841        }
14842
14843        /// Sets the full request, replacing any prior values.
14844        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14845            mut self,
14846            v: V,
14847        ) -> Self {
14848            self.0.request = v.into();
14849            self
14850        }
14851
14852        /// Sets all the options, replacing any prior values.
14853        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14854            self.0.options = v.into();
14855            self
14856        }
14857
14858        /// Sends the request.
14859        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14860            (*self.0.stub)
14861                .get_operation(self.0.request, self.0.options)
14862                .await
14863                .map(crate::Response::into_body)
14864        }
14865
14866        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14868            self.0.request.name = v.into();
14869            self
14870        }
14871    }
14872
14873    #[doc(hidden)]
14874    impl crate::RequestBuilder for GetOperation {
14875        fn request_options(&mut self) -> &mut crate::RequestOptions {
14876            &mut self.0.options
14877        }
14878    }
14879
14880    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
14881    ///
14882    /// # Example
14883    /// ```
14884    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
14885    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14886    ///
14887    /// let builder = prepare_request_builder();
14888    /// let response = builder.send().await?;
14889    /// # Ok(()) }
14890    ///
14891    /// fn prepare_request_builder() -> CancelOperation {
14892    ///   # panic!();
14893    ///   // ... details omitted ...
14894    /// }
14895    /// ```
14896    #[derive(Clone, Debug)]
14897    pub struct CancelOperation(
14898        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14899    );
14900
14901    impl CancelOperation {
14902        pub(crate) fn new(
14903            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14904        ) -> Self {
14905            Self(RequestBuilder::new(stub))
14906        }
14907
14908        /// Sets the full request, replacing any prior values.
14909        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14910            mut self,
14911            v: V,
14912        ) -> Self {
14913            self.0.request = v.into();
14914            self
14915        }
14916
14917        /// Sets all the options, replacing any prior values.
14918        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14919            self.0.options = v.into();
14920            self
14921        }
14922
14923        /// Sends the request.
14924        pub async fn send(self) -> Result<()> {
14925            (*self.0.stub)
14926                .cancel_operation(self.0.request, self.0.options)
14927                .await
14928                .map(crate::Response::into_body)
14929        }
14930
14931        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14932        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14933            self.0.request.name = v.into();
14934            self
14935        }
14936    }
14937
14938    #[doc(hidden)]
14939    impl crate::RequestBuilder for CancelOperation {
14940        fn request_options(&mut self) -> &mut crate::RequestOptions {
14941            &mut self.0.options
14942        }
14943    }
14944}
14945
14946/// Request and client builders for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14947#[cfg(feature = "site-search-engine-service")]
14948#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14949pub mod site_search_engine_service {
14950    use crate::Result;
14951
14952    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14953    ///
14954    /// ```
14955    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14956    /// # use google_cloud_discoveryengine_v1::*;
14957    /// # use builder::site_search_engine_service::ClientBuilder;
14958    /// # use client::SiteSearchEngineService;
14959    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
14960    /// let client = builder
14961    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14962    ///     .build().await?;
14963    /// # Ok(()) }
14964    /// ```
14965    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14966
14967    pub(crate) mod client {
14968        use super::super::super::client::SiteSearchEngineService;
14969        pub struct Factory;
14970        impl crate::ClientFactory for Factory {
14971            type Client = SiteSearchEngineService;
14972            type Credentials = gaxi::options::Credentials;
14973            async fn build(
14974                self,
14975                config: gaxi::options::ClientConfig,
14976            ) -> crate::ClientBuilderResult<Self::Client> {
14977                Self::Client::new(config).await
14978            }
14979        }
14980    }
14981
14982    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14983    #[derive(Clone, Debug)]
14984    pub(crate) struct RequestBuilder<R: std::default::Default> {
14985        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14986        request: R,
14987        options: crate::RequestOptions,
14988    }
14989
14990    impl<R> RequestBuilder<R>
14991    where
14992        R: std::default::Default,
14993    {
14994        pub(crate) fn new(
14995            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14996        ) -> Self {
14997            Self {
14998                stub,
14999                request: R::default(),
15000                options: crate::RequestOptions::default(),
15001            }
15002        }
15003    }
15004
15005    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
15006    ///
15007    /// # Example
15008    /// ```
15009    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
15010    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15011    ///
15012    /// let builder = prepare_request_builder();
15013    /// let response = builder.send().await?;
15014    /// # Ok(()) }
15015    ///
15016    /// fn prepare_request_builder() -> GetSiteSearchEngine {
15017    ///   # panic!();
15018    ///   // ... details omitted ...
15019    /// }
15020    /// ```
15021    #[derive(Clone, Debug)]
15022    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
15023
15024    impl GetSiteSearchEngine {
15025        pub(crate) fn new(
15026            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15027        ) -> Self {
15028            Self(RequestBuilder::new(stub))
15029        }
15030
15031        /// Sets the full request, replacing any prior values.
15032        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
15033            mut self,
15034            v: V,
15035        ) -> Self {
15036            self.0.request = v.into();
15037            self
15038        }
15039
15040        /// Sets all the options, replacing any prior values.
15041        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15042            self.0.options = v.into();
15043            self
15044        }
15045
15046        /// Sends the request.
15047        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
15048            (*self.0.stub)
15049                .get_site_search_engine(self.0.request, self.0.options)
15050                .await
15051                .map(crate::Response::into_body)
15052        }
15053
15054        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
15055        ///
15056        /// This is a **required** field for requests.
15057        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15058            self.0.request.name = v.into();
15059            self
15060        }
15061    }
15062
15063    #[doc(hidden)]
15064    impl crate::RequestBuilder for GetSiteSearchEngine {
15065        fn request_options(&mut self) -> &mut crate::RequestOptions {
15066            &mut self.0.options
15067        }
15068    }
15069
15070    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
15071    ///
15072    /// # Example
15073    /// ```
15074    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
15075    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15076    /// use google_cloud_lro::Poller;
15077    ///
15078    /// let builder = prepare_request_builder();
15079    /// let response = builder.poller().until_done().await?;
15080    /// # Ok(()) }
15081    ///
15082    /// fn prepare_request_builder() -> CreateTargetSite {
15083    ///   # panic!();
15084    ///   // ... details omitted ...
15085    /// }
15086    /// ```
15087    #[derive(Clone, Debug)]
15088    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
15089
15090    impl CreateTargetSite {
15091        pub(crate) fn new(
15092            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15093        ) -> Self {
15094            Self(RequestBuilder::new(stub))
15095        }
15096
15097        /// Sets the full request, replacing any prior values.
15098        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
15099            mut self,
15100            v: V,
15101        ) -> Self {
15102            self.0.request = v.into();
15103            self
15104        }
15105
15106        /// Sets all the options, replacing any prior values.
15107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15108            self.0.options = v.into();
15109            self
15110        }
15111
15112        /// Sends the request.
15113        ///
15114        /// # Long running operations
15115        ///
15116        /// This starts, but does not poll, a longrunning operation. More information
15117        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
15118        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15119            (*self.0.stub)
15120                .create_target_site(self.0.request, self.0.options)
15121                .await
15122                .map(crate::Response::into_body)
15123        }
15124
15125        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_target_site`.
15126        pub fn poller(
15127            self,
15128        ) -> impl google_cloud_lro::Poller<
15129            crate::model::TargetSite,
15130            crate::model::CreateTargetSiteMetadata,
15131        > {
15132            type Operation = google_cloud_lro::internal::Operation<
15133                crate::model::TargetSite,
15134                crate::model::CreateTargetSiteMetadata,
15135            >;
15136            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15137            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15138            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15139            if let Some(ref mut details) = poller_options.tracing {
15140                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
15141            }
15142
15143            let stub = self.0.stub.clone();
15144            let mut options = self.0.options.clone();
15145            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15146            let query = move |name| {
15147                let stub = stub.clone();
15148                let options = options.clone();
15149                async {
15150                    let op = GetOperation::new(stub)
15151                        .set_name(name)
15152                        .with_options(options)
15153                        .send()
15154                        .await?;
15155                    Ok(Operation::new(op))
15156                }
15157            };
15158
15159            let start = move || async {
15160                let op = self.send().await?;
15161                Ok(Operation::new(op))
15162            };
15163
15164            use google_cloud_lro::internal::PollerExt;
15165            {
15166                google_cloud_lro::internal::new_poller(
15167                    polling_error_policy,
15168                    polling_backoff_policy,
15169                    start,
15170                    query,
15171                )
15172            }
15173            .with_options(poller_options)
15174        }
15175
15176        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
15177        ///
15178        /// This is a **required** field for requests.
15179        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15180            self.0.request.parent = v.into();
15181            self
15182        }
15183
15184        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
15185        ///
15186        /// This is a **required** field for requests.
15187        pub fn set_target_site<T>(mut self, v: T) -> Self
15188        where
15189            T: std::convert::Into<crate::model::TargetSite>,
15190        {
15191            self.0.request.target_site = std::option::Option::Some(v.into());
15192            self
15193        }
15194
15195        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
15196        ///
15197        /// This is a **required** field for requests.
15198        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
15199        where
15200            T: std::convert::Into<crate::model::TargetSite>,
15201        {
15202            self.0.request.target_site = v.map(|x| x.into());
15203            self
15204        }
15205    }
15206
15207    #[doc(hidden)]
15208    impl crate::RequestBuilder for CreateTargetSite {
15209        fn request_options(&mut self) -> &mut crate::RequestOptions {
15210            &mut self.0.options
15211        }
15212    }
15213
15214    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
15215    ///
15216    /// # Example
15217    /// ```
15218    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
15219    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15220    /// use google_cloud_lro::Poller;
15221    ///
15222    /// let builder = prepare_request_builder();
15223    /// let response = builder.poller().until_done().await?;
15224    /// # Ok(()) }
15225    ///
15226    /// fn prepare_request_builder() -> BatchCreateTargetSites {
15227    ///   # panic!();
15228    ///   // ... details omitted ...
15229    /// }
15230    /// ```
15231    #[derive(Clone, Debug)]
15232    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
15233
15234    impl BatchCreateTargetSites {
15235        pub(crate) fn new(
15236            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15237        ) -> Self {
15238            Self(RequestBuilder::new(stub))
15239        }
15240
15241        /// Sets the full request, replacing any prior values.
15242        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
15243            mut self,
15244            v: V,
15245        ) -> Self {
15246            self.0.request = v.into();
15247            self
15248        }
15249
15250        /// Sets all the options, replacing any prior values.
15251        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15252            self.0.options = v.into();
15253            self
15254        }
15255
15256        /// Sends the request.
15257        ///
15258        /// # Long running operations
15259        ///
15260        /// This starts, but does not poll, a longrunning operation. More information
15261        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
15262        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15263            (*self.0.stub)
15264                .batch_create_target_sites(self.0.request, self.0.options)
15265                .await
15266                .map(crate::Response::into_body)
15267        }
15268
15269        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_target_sites`.
15270        pub fn poller(
15271            self,
15272        ) -> impl google_cloud_lro::Poller<
15273            crate::model::BatchCreateTargetSitesResponse,
15274            crate::model::BatchCreateTargetSiteMetadata,
15275        > {
15276            type Operation = google_cloud_lro::internal::Operation<
15277                crate::model::BatchCreateTargetSitesResponse,
15278                crate::model::BatchCreateTargetSiteMetadata,
15279            >;
15280            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15281            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15282            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15283            if let Some(ref mut details) = poller_options.tracing {
15284                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
15285            }
15286
15287            let stub = self.0.stub.clone();
15288            let mut options = self.0.options.clone();
15289            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15290            let query = move |name| {
15291                let stub = stub.clone();
15292                let options = options.clone();
15293                async {
15294                    let op = GetOperation::new(stub)
15295                        .set_name(name)
15296                        .with_options(options)
15297                        .send()
15298                        .await?;
15299                    Ok(Operation::new(op))
15300                }
15301            };
15302
15303            let start = move || async {
15304                let op = self.send().await?;
15305                Ok(Operation::new(op))
15306            };
15307
15308            use google_cloud_lro::internal::PollerExt;
15309            {
15310                google_cloud_lro::internal::new_poller(
15311                    polling_error_policy,
15312                    polling_backoff_policy,
15313                    start,
15314                    query,
15315                )
15316            }
15317            .with_options(poller_options)
15318        }
15319
15320        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
15321        ///
15322        /// This is a **required** field for requests.
15323        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15324            self.0.request.parent = v.into();
15325            self
15326        }
15327
15328        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
15329        ///
15330        /// This is a **required** field for requests.
15331        pub fn set_requests<T, V>(mut self, v: T) -> Self
15332        where
15333            T: std::iter::IntoIterator<Item = V>,
15334            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
15335        {
15336            use std::iter::Iterator;
15337            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
15338            self
15339        }
15340    }
15341
15342    #[doc(hidden)]
15343    impl crate::RequestBuilder for BatchCreateTargetSites {
15344        fn request_options(&mut self) -> &mut crate::RequestOptions {
15345            &mut self.0.options
15346        }
15347    }
15348
15349    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
15350    ///
15351    /// # Example
15352    /// ```
15353    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
15354    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15355    ///
15356    /// let builder = prepare_request_builder();
15357    /// let response = builder.send().await?;
15358    /// # Ok(()) }
15359    ///
15360    /// fn prepare_request_builder() -> GetTargetSite {
15361    ///   # panic!();
15362    ///   // ... details omitted ...
15363    /// }
15364    /// ```
15365    #[derive(Clone, Debug)]
15366    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
15367
15368    impl GetTargetSite {
15369        pub(crate) fn new(
15370            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15371        ) -> Self {
15372            Self(RequestBuilder::new(stub))
15373        }
15374
15375        /// Sets the full request, replacing any prior values.
15376        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
15377            self.0.request = v.into();
15378            self
15379        }
15380
15381        /// Sets all the options, replacing any prior values.
15382        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15383            self.0.options = v.into();
15384            self
15385        }
15386
15387        /// Sends the request.
15388        pub async fn send(self) -> Result<crate::model::TargetSite> {
15389            (*self.0.stub)
15390                .get_target_site(self.0.request, self.0.options)
15391                .await
15392                .map(crate::Response::into_body)
15393        }
15394
15395        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
15396        ///
15397        /// This is a **required** field for requests.
15398        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15399            self.0.request.name = v.into();
15400            self
15401        }
15402    }
15403
15404    #[doc(hidden)]
15405    impl crate::RequestBuilder for GetTargetSite {
15406        fn request_options(&mut self) -> &mut crate::RequestOptions {
15407            &mut self.0.options
15408        }
15409    }
15410
15411    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
15412    ///
15413    /// # Example
15414    /// ```
15415    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
15416    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15417    /// use google_cloud_lro::Poller;
15418    ///
15419    /// let builder = prepare_request_builder();
15420    /// let response = builder.poller().until_done().await?;
15421    /// # Ok(()) }
15422    ///
15423    /// fn prepare_request_builder() -> UpdateTargetSite {
15424    ///   # panic!();
15425    ///   // ... details omitted ...
15426    /// }
15427    /// ```
15428    #[derive(Clone, Debug)]
15429    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
15430
15431    impl UpdateTargetSite {
15432        pub(crate) fn new(
15433            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15434        ) -> Self {
15435            Self(RequestBuilder::new(stub))
15436        }
15437
15438        /// Sets the full request, replacing any prior values.
15439        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
15440            mut self,
15441            v: V,
15442        ) -> Self {
15443            self.0.request = v.into();
15444            self
15445        }
15446
15447        /// Sets all the options, replacing any prior values.
15448        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15449            self.0.options = v.into();
15450            self
15451        }
15452
15453        /// Sends the request.
15454        ///
15455        /// # Long running operations
15456        ///
15457        /// This starts, but does not poll, a longrunning operation. More information
15458        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
15459        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15460            (*self.0.stub)
15461                .update_target_site(self.0.request, self.0.options)
15462                .await
15463                .map(crate::Response::into_body)
15464        }
15465
15466        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_target_site`.
15467        pub fn poller(
15468            self,
15469        ) -> impl google_cloud_lro::Poller<
15470            crate::model::TargetSite,
15471            crate::model::UpdateTargetSiteMetadata,
15472        > {
15473            type Operation = google_cloud_lro::internal::Operation<
15474                crate::model::TargetSite,
15475                crate::model::UpdateTargetSiteMetadata,
15476            >;
15477            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15478            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15479            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15480            if let Some(ref mut details) = poller_options.tracing {
15481                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
15482            }
15483
15484            let stub = self.0.stub.clone();
15485            let mut options = self.0.options.clone();
15486            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15487            let query = move |name| {
15488                let stub = stub.clone();
15489                let options = options.clone();
15490                async {
15491                    let op = GetOperation::new(stub)
15492                        .set_name(name)
15493                        .with_options(options)
15494                        .send()
15495                        .await?;
15496                    Ok(Operation::new(op))
15497                }
15498            };
15499
15500            let start = move || async {
15501                let op = self.send().await?;
15502                Ok(Operation::new(op))
15503            };
15504
15505            use google_cloud_lro::internal::PollerExt;
15506            {
15507                google_cloud_lro::internal::new_poller(
15508                    polling_error_policy,
15509                    polling_backoff_policy,
15510                    start,
15511                    query,
15512                )
15513            }
15514            .with_options(poller_options)
15515        }
15516
15517        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
15518        ///
15519        /// This is a **required** field for requests.
15520        pub fn set_target_site<T>(mut self, v: T) -> Self
15521        where
15522            T: std::convert::Into<crate::model::TargetSite>,
15523        {
15524            self.0.request.target_site = std::option::Option::Some(v.into());
15525            self
15526        }
15527
15528        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
15529        ///
15530        /// This is a **required** field for requests.
15531        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
15532        where
15533            T: std::convert::Into<crate::model::TargetSite>,
15534        {
15535            self.0.request.target_site = v.map(|x| x.into());
15536            self
15537        }
15538    }
15539
15540    #[doc(hidden)]
15541    impl crate::RequestBuilder for UpdateTargetSite {
15542        fn request_options(&mut self) -> &mut crate::RequestOptions {
15543            &mut self.0.options
15544        }
15545    }
15546
15547    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
15548    ///
15549    /// # Example
15550    /// ```
15551    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
15552    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15553    /// use google_cloud_lro::Poller;
15554    ///
15555    /// let builder = prepare_request_builder();
15556    /// let response = builder.poller().until_done().await?;
15557    /// # Ok(()) }
15558    ///
15559    /// fn prepare_request_builder() -> DeleteTargetSite {
15560    ///   # panic!();
15561    ///   // ... details omitted ...
15562    /// }
15563    /// ```
15564    #[derive(Clone, Debug)]
15565    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
15566
15567    impl DeleteTargetSite {
15568        pub(crate) fn new(
15569            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15570        ) -> Self {
15571            Self(RequestBuilder::new(stub))
15572        }
15573
15574        /// Sets the full request, replacing any prior values.
15575        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
15576            mut self,
15577            v: V,
15578        ) -> Self {
15579            self.0.request = v.into();
15580            self
15581        }
15582
15583        /// Sets all the options, replacing any prior values.
15584        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15585            self.0.options = v.into();
15586            self
15587        }
15588
15589        /// Sends the request.
15590        ///
15591        /// # Long running operations
15592        ///
15593        /// This starts, but does not poll, a longrunning operation. More information
15594        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
15595        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15596            (*self.0.stub)
15597                .delete_target_site(self.0.request, self.0.options)
15598                .await
15599                .map(crate::Response::into_body)
15600        }
15601
15602        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_target_site`.
15603        pub fn poller(
15604            self,
15605        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
15606            type Operation = google_cloud_lro::internal::Operation<
15607                wkt::Empty,
15608                crate::model::DeleteTargetSiteMetadata,
15609            >;
15610            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15611            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15612            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15613            if let Some(ref mut details) = poller_options.tracing {
15614                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
15615            }
15616
15617            let stub = self.0.stub.clone();
15618            let mut options = self.0.options.clone();
15619            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15620            let query = move |name| {
15621                let stub = stub.clone();
15622                let options = options.clone();
15623                async {
15624                    let op = GetOperation::new(stub)
15625                        .set_name(name)
15626                        .with_options(options)
15627                        .send()
15628                        .await?;
15629                    Ok(Operation::new(op))
15630                }
15631            };
15632
15633            let start = move || async {
15634                let op = self.send().await?;
15635                Ok(Operation::new(op))
15636            };
15637
15638            use google_cloud_lro::internal::PollerExt;
15639            {
15640                google_cloud_lro::internal::new_unit_response_poller(
15641                    polling_error_policy,
15642                    polling_backoff_policy,
15643                    start,
15644                    query,
15645                )
15646            }
15647            .with_options(poller_options)
15648        }
15649
15650        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
15651        ///
15652        /// This is a **required** field for requests.
15653        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15654            self.0.request.name = v.into();
15655            self
15656        }
15657    }
15658
15659    #[doc(hidden)]
15660    impl crate::RequestBuilder for DeleteTargetSite {
15661        fn request_options(&mut self) -> &mut crate::RequestOptions {
15662            &mut self.0.options
15663        }
15664    }
15665
15666    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
15667    ///
15668    /// # Example
15669    /// ```
15670    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
15671    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15672    /// use google_cloud_gax::paginator::ItemPaginator;
15673    ///
15674    /// let builder = prepare_request_builder();
15675    /// let mut items = builder.by_item();
15676    /// while let Some(result) = items.next().await {
15677    ///   let item = result?;
15678    /// }
15679    /// # Ok(()) }
15680    ///
15681    /// fn prepare_request_builder() -> ListTargetSites {
15682    ///   # panic!();
15683    ///   // ... details omitted ...
15684    /// }
15685    /// ```
15686    #[derive(Clone, Debug)]
15687    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15688
15689    impl ListTargetSites {
15690        pub(crate) fn new(
15691            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15692        ) -> Self {
15693            Self(RequestBuilder::new(stub))
15694        }
15695
15696        /// Sets the full request, replacing any prior values.
15697        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15698            self.0.request = v.into();
15699            self
15700        }
15701
15702        /// Sets all the options, replacing any prior values.
15703        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15704            self.0.options = v.into();
15705            self
15706        }
15707
15708        /// Sends the request.
15709        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15710            (*self.0.stub)
15711                .list_target_sites(self.0.request, self.0.options)
15712                .await
15713                .map(crate::Response::into_body)
15714        }
15715
15716        /// Streams each page in the collection.
15717        pub fn by_page(
15718            self,
15719        ) -> impl google_cloud_gax::paginator::Paginator<
15720            crate::model::ListTargetSitesResponse,
15721            crate::Error,
15722        > {
15723            use std::clone::Clone;
15724            let token = self.0.request.page_token.clone();
15725            let execute = move |token: String| {
15726                let mut builder = self.clone();
15727                builder.0.request = builder.0.request.set_page_token(token);
15728                builder.send()
15729            };
15730            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15731        }
15732
15733        /// Streams each item in the collection.
15734        pub fn by_item(
15735            self,
15736        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15737            crate::model::ListTargetSitesResponse,
15738            crate::Error,
15739        > {
15740            use google_cloud_gax::paginator::Paginator;
15741            self.by_page().items()
15742        }
15743
15744        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
15745        ///
15746        /// This is a **required** field for requests.
15747        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15748            self.0.request.parent = v.into();
15749            self
15750        }
15751
15752        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
15753        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15754            self.0.request.page_size = v.into();
15755            self
15756        }
15757
15758        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
15759        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15760            self.0.request.page_token = v.into();
15761            self
15762        }
15763    }
15764
15765    #[doc(hidden)]
15766    impl crate::RequestBuilder for ListTargetSites {
15767        fn request_options(&mut self) -> &mut crate::RequestOptions {
15768            &mut self.0.options
15769        }
15770    }
15771
15772    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
15773    ///
15774    /// # Example
15775    /// ```
15776    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
15777    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15778    /// use google_cloud_lro::Poller;
15779    ///
15780    /// let builder = prepare_request_builder();
15781    /// let response = builder.poller().until_done().await?;
15782    /// # Ok(()) }
15783    ///
15784    /// fn prepare_request_builder() -> CreateSitemap {
15785    ///   # panic!();
15786    ///   // ... details omitted ...
15787    /// }
15788    /// ```
15789    #[derive(Clone, Debug)]
15790    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15791
15792    impl CreateSitemap {
15793        pub(crate) fn new(
15794            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15795        ) -> Self {
15796            Self(RequestBuilder::new(stub))
15797        }
15798
15799        /// Sets the full request, replacing any prior values.
15800        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15801            self.0.request = v.into();
15802            self
15803        }
15804
15805        /// Sets all the options, replacing any prior values.
15806        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15807            self.0.options = v.into();
15808            self
15809        }
15810
15811        /// Sends the request.
15812        ///
15813        /// # Long running operations
15814        ///
15815        /// This starts, but does not poll, a longrunning operation. More information
15816        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
15817        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15818            (*self.0.stub)
15819                .create_sitemap(self.0.request, self.0.options)
15820                .await
15821                .map(crate::Response::into_body)
15822        }
15823
15824        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_sitemap`.
15825        pub fn poller(
15826            self,
15827        ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15828        {
15829            type Operation = google_cloud_lro::internal::Operation<
15830                crate::model::Sitemap,
15831                crate::model::CreateSitemapMetadata,
15832            >;
15833            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15834            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15835            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15836            if let Some(ref mut details) = poller_options.tracing {
15837                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15838            }
15839
15840            let stub = self.0.stub.clone();
15841            let mut options = self.0.options.clone();
15842            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15843            let query = move |name| {
15844                let stub = stub.clone();
15845                let options = options.clone();
15846                async {
15847                    let op = GetOperation::new(stub)
15848                        .set_name(name)
15849                        .with_options(options)
15850                        .send()
15851                        .await?;
15852                    Ok(Operation::new(op))
15853                }
15854            };
15855
15856            let start = move || async {
15857                let op = self.send().await?;
15858                Ok(Operation::new(op))
15859            };
15860
15861            use google_cloud_lro::internal::PollerExt;
15862            {
15863                google_cloud_lro::internal::new_poller(
15864                    polling_error_policy,
15865                    polling_backoff_policy,
15866                    start,
15867                    query,
15868                )
15869            }
15870            .with_options(poller_options)
15871        }
15872
15873        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
15874        ///
15875        /// This is a **required** field for requests.
15876        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15877            self.0.request.parent = v.into();
15878            self
15879        }
15880
15881        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15882        ///
15883        /// This is a **required** field for requests.
15884        pub fn set_sitemap<T>(mut self, v: T) -> Self
15885        where
15886            T: std::convert::Into<crate::model::Sitemap>,
15887        {
15888            self.0.request.sitemap = std::option::Option::Some(v.into());
15889            self
15890        }
15891
15892        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15893        ///
15894        /// This is a **required** field for requests.
15895        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15896        where
15897            T: std::convert::Into<crate::model::Sitemap>,
15898        {
15899            self.0.request.sitemap = v.map(|x| x.into());
15900            self
15901        }
15902    }
15903
15904    #[doc(hidden)]
15905    impl crate::RequestBuilder for CreateSitemap {
15906        fn request_options(&mut self) -> &mut crate::RequestOptions {
15907            &mut self.0.options
15908        }
15909    }
15910
15911    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
15912    ///
15913    /// # Example
15914    /// ```
15915    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
15916    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15917    /// use google_cloud_lro::Poller;
15918    ///
15919    /// let builder = prepare_request_builder();
15920    /// let response = builder.poller().until_done().await?;
15921    /// # Ok(()) }
15922    ///
15923    /// fn prepare_request_builder() -> DeleteSitemap {
15924    ///   # panic!();
15925    ///   // ... details omitted ...
15926    /// }
15927    /// ```
15928    #[derive(Clone, Debug)]
15929    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15930
15931    impl DeleteSitemap {
15932        pub(crate) fn new(
15933            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15934        ) -> Self {
15935            Self(RequestBuilder::new(stub))
15936        }
15937
15938        /// Sets the full request, replacing any prior values.
15939        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15940            self.0.request = v.into();
15941            self
15942        }
15943
15944        /// Sets all the options, replacing any prior values.
15945        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15946            self.0.options = v.into();
15947            self
15948        }
15949
15950        /// Sends the request.
15951        ///
15952        /// # Long running operations
15953        ///
15954        /// This starts, but does not poll, a longrunning operation. More information
15955        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
15956        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15957            (*self.0.stub)
15958                .delete_sitemap(self.0.request, self.0.options)
15959                .await
15960                .map(crate::Response::into_body)
15961        }
15962
15963        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_sitemap`.
15964        pub fn poller(
15965            self,
15966        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15967            type Operation = google_cloud_lro::internal::Operation<
15968                wkt::Empty,
15969                crate::model::DeleteSitemapMetadata,
15970            >;
15971            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15972            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15973            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15974            if let Some(ref mut details) = poller_options.tracing {
15975                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15976            }
15977
15978            let stub = self.0.stub.clone();
15979            let mut options = self.0.options.clone();
15980            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15981            let query = move |name| {
15982                let stub = stub.clone();
15983                let options = options.clone();
15984                async {
15985                    let op = GetOperation::new(stub)
15986                        .set_name(name)
15987                        .with_options(options)
15988                        .send()
15989                        .await?;
15990                    Ok(Operation::new(op))
15991                }
15992            };
15993
15994            let start = move || async {
15995                let op = self.send().await?;
15996                Ok(Operation::new(op))
15997            };
15998
15999            use google_cloud_lro::internal::PollerExt;
16000            {
16001                google_cloud_lro::internal::new_unit_response_poller(
16002                    polling_error_policy,
16003                    polling_backoff_policy,
16004                    start,
16005                    query,
16006                )
16007            }
16008            .with_options(poller_options)
16009        }
16010
16011        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
16012        ///
16013        /// This is a **required** field for requests.
16014        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16015            self.0.request.name = v.into();
16016            self
16017        }
16018    }
16019
16020    #[doc(hidden)]
16021    impl crate::RequestBuilder for DeleteSitemap {
16022        fn request_options(&mut self) -> &mut crate::RequestOptions {
16023            &mut self.0.options
16024        }
16025    }
16026
16027    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
16028    ///
16029    /// # Example
16030    /// ```
16031    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
16032    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16033    ///
16034    /// let builder = prepare_request_builder();
16035    /// let response = builder.send().await?;
16036    /// # Ok(()) }
16037    ///
16038    /// fn prepare_request_builder() -> FetchSitemaps {
16039    ///   # panic!();
16040    ///   // ... details omitted ...
16041    /// }
16042    /// ```
16043    #[derive(Clone, Debug)]
16044    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
16045
16046    impl FetchSitemaps {
16047        pub(crate) fn new(
16048            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16049        ) -> Self {
16050            Self(RequestBuilder::new(stub))
16051        }
16052
16053        /// Sets the full request, replacing any prior values.
16054        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
16055            self.0.request = v.into();
16056            self
16057        }
16058
16059        /// Sets all the options, replacing any prior values.
16060        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16061            self.0.options = v.into();
16062            self
16063        }
16064
16065        /// Sends the request.
16066        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
16067            (*self.0.stub)
16068                .fetch_sitemaps(self.0.request, self.0.options)
16069                .await
16070                .map(crate::Response::into_body)
16071        }
16072
16073        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
16074        ///
16075        /// This is a **required** field for requests.
16076        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16077            self.0.request.parent = v.into();
16078            self
16079        }
16080
16081        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
16082        pub fn set_matcher<T>(mut self, v: T) -> Self
16083        where
16084            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
16085        {
16086            self.0.request.matcher = std::option::Option::Some(v.into());
16087            self
16088        }
16089
16090        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
16091        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
16092        where
16093            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
16094        {
16095            self.0.request.matcher = v.map(|x| x.into());
16096            self
16097        }
16098    }
16099
16100    #[doc(hidden)]
16101    impl crate::RequestBuilder for FetchSitemaps {
16102        fn request_options(&mut self) -> &mut crate::RequestOptions {
16103            &mut self.0.options
16104        }
16105    }
16106
16107    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
16108    ///
16109    /// # Example
16110    /// ```
16111    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
16112    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16113    /// use google_cloud_lro::Poller;
16114    ///
16115    /// let builder = prepare_request_builder();
16116    /// let response = builder.poller().until_done().await?;
16117    /// # Ok(()) }
16118    ///
16119    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
16120    ///   # panic!();
16121    ///   // ... details omitted ...
16122    /// }
16123    /// ```
16124    #[derive(Clone, Debug)]
16125    pub struct EnableAdvancedSiteSearch(
16126        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
16127    );
16128
16129    impl EnableAdvancedSiteSearch {
16130        pub(crate) fn new(
16131            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16132        ) -> Self {
16133            Self(RequestBuilder::new(stub))
16134        }
16135
16136        /// Sets the full request, replacing any prior values.
16137        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
16138            mut self,
16139            v: V,
16140        ) -> Self {
16141            self.0.request = v.into();
16142            self
16143        }
16144
16145        /// Sets all the options, replacing any prior values.
16146        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16147            self.0.options = v.into();
16148            self
16149        }
16150
16151        /// Sends the request.
16152        ///
16153        /// # Long running operations
16154        ///
16155        /// This starts, but does not poll, a longrunning operation. More information
16156        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
16157        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16158            (*self.0.stub)
16159                .enable_advanced_site_search(self.0.request, self.0.options)
16160                .await
16161                .map(crate::Response::into_body)
16162        }
16163
16164        /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_advanced_site_search`.
16165        pub fn poller(
16166            self,
16167        ) -> impl google_cloud_lro::Poller<
16168            crate::model::EnableAdvancedSiteSearchResponse,
16169            crate::model::EnableAdvancedSiteSearchMetadata,
16170        > {
16171            type Operation = google_cloud_lro::internal::Operation<
16172                crate::model::EnableAdvancedSiteSearchResponse,
16173                crate::model::EnableAdvancedSiteSearchMetadata,
16174            >;
16175            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16176            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16177            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16178            if let Some(ref mut details) = poller_options.tracing {
16179                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
16180            }
16181
16182            let stub = self.0.stub.clone();
16183            let mut options = self.0.options.clone();
16184            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16185            let query = move |name| {
16186                let stub = stub.clone();
16187                let options = options.clone();
16188                async {
16189                    let op = GetOperation::new(stub)
16190                        .set_name(name)
16191                        .with_options(options)
16192                        .send()
16193                        .await?;
16194                    Ok(Operation::new(op))
16195                }
16196            };
16197
16198            let start = move || async {
16199                let op = self.send().await?;
16200                Ok(Operation::new(op))
16201            };
16202
16203            use google_cloud_lro::internal::PollerExt;
16204            {
16205                google_cloud_lro::internal::new_poller(
16206                    polling_error_policy,
16207                    polling_backoff_policy,
16208                    start,
16209                    query,
16210                )
16211            }
16212            .with_options(poller_options)
16213        }
16214
16215        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
16216        ///
16217        /// This is a **required** field for requests.
16218        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16219            self.0.request.site_search_engine = v.into();
16220            self
16221        }
16222    }
16223
16224    #[doc(hidden)]
16225    impl crate::RequestBuilder for EnableAdvancedSiteSearch {
16226        fn request_options(&mut self) -> &mut crate::RequestOptions {
16227            &mut self.0.options
16228        }
16229    }
16230
16231    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
16232    ///
16233    /// # Example
16234    /// ```
16235    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
16236    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16237    /// use google_cloud_lro::Poller;
16238    ///
16239    /// let builder = prepare_request_builder();
16240    /// let response = builder.poller().until_done().await?;
16241    /// # Ok(()) }
16242    ///
16243    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
16244    ///   # panic!();
16245    ///   // ... details omitted ...
16246    /// }
16247    /// ```
16248    #[derive(Clone, Debug)]
16249    pub struct DisableAdvancedSiteSearch(
16250        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
16251    );
16252
16253    impl DisableAdvancedSiteSearch {
16254        pub(crate) fn new(
16255            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16256        ) -> Self {
16257            Self(RequestBuilder::new(stub))
16258        }
16259
16260        /// Sets the full request, replacing any prior values.
16261        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
16262            mut self,
16263            v: V,
16264        ) -> Self {
16265            self.0.request = v.into();
16266            self
16267        }
16268
16269        /// Sets all the options, replacing any prior values.
16270        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16271            self.0.options = v.into();
16272            self
16273        }
16274
16275        /// Sends the request.
16276        ///
16277        /// # Long running operations
16278        ///
16279        /// This starts, but does not poll, a longrunning operation. More information
16280        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
16281        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16282            (*self.0.stub)
16283                .disable_advanced_site_search(self.0.request, self.0.options)
16284                .await
16285                .map(crate::Response::into_body)
16286        }
16287
16288        /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_advanced_site_search`.
16289        pub fn poller(
16290            self,
16291        ) -> impl google_cloud_lro::Poller<
16292            crate::model::DisableAdvancedSiteSearchResponse,
16293            crate::model::DisableAdvancedSiteSearchMetadata,
16294        > {
16295            type Operation = google_cloud_lro::internal::Operation<
16296                crate::model::DisableAdvancedSiteSearchResponse,
16297                crate::model::DisableAdvancedSiteSearchMetadata,
16298            >;
16299            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16300            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16301            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16302            if let Some(ref mut details) = poller_options.tracing {
16303                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
16304            }
16305
16306            let stub = self.0.stub.clone();
16307            let mut options = self.0.options.clone();
16308            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16309            let query = move |name| {
16310                let stub = stub.clone();
16311                let options = options.clone();
16312                async {
16313                    let op = GetOperation::new(stub)
16314                        .set_name(name)
16315                        .with_options(options)
16316                        .send()
16317                        .await?;
16318                    Ok(Operation::new(op))
16319                }
16320            };
16321
16322            let start = move || async {
16323                let op = self.send().await?;
16324                Ok(Operation::new(op))
16325            };
16326
16327            use google_cloud_lro::internal::PollerExt;
16328            {
16329                google_cloud_lro::internal::new_poller(
16330                    polling_error_policy,
16331                    polling_backoff_policy,
16332                    start,
16333                    query,
16334                )
16335            }
16336            .with_options(poller_options)
16337        }
16338
16339        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
16340        ///
16341        /// This is a **required** field for requests.
16342        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343            self.0.request.site_search_engine = v.into();
16344            self
16345        }
16346    }
16347
16348    #[doc(hidden)]
16349    impl crate::RequestBuilder for DisableAdvancedSiteSearch {
16350        fn request_options(&mut self) -> &mut crate::RequestOptions {
16351            &mut self.0.options
16352        }
16353    }
16354
16355    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
16356    ///
16357    /// # Example
16358    /// ```
16359    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
16360    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16361    /// use google_cloud_lro::Poller;
16362    ///
16363    /// let builder = prepare_request_builder();
16364    /// let response = builder.poller().until_done().await?;
16365    /// # Ok(()) }
16366    ///
16367    /// fn prepare_request_builder() -> RecrawlUris {
16368    ///   # panic!();
16369    ///   // ... details omitted ...
16370    /// }
16371    /// ```
16372    #[derive(Clone, Debug)]
16373    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
16374
16375    impl RecrawlUris {
16376        pub(crate) fn new(
16377            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16378        ) -> Self {
16379            Self(RequestBuilder::new(stub))
16380        }
16381
16382        /// Sets the full request, replacing any prior values.
16383        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
16384            self.0.request = v.into();
16385            self
16386        }
16387
16388        /// Sets all the options, replacing any prior values.
16389        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16390            self.0.options = v.into();
16391            self
16392        }
16393
16394        /// Sends the request.
16395        ///
16396        /// # Long running operations
16397        ///
16398        /// This starts, but does not poll, a longrunning operation. More information
16399        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
16400        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16401            (*self.0.stub)
16402                .recrawl_uris(self.0.request, self.0.options)
16403                .await
16404                .map(crate::Response::into_body)
16405        }
16406
16407        /// Creates a [Poller][google_cloud_lro::Poller] to work with `recrawl_uris`.
16408        pub fn poller(
16409            self,
16410        ) -> impl google_cloud_lro::Poller<
16411            crate::model::RecrawlUrisResponse,
16412            crate::model::RecrawlUrisMetadata,
16413        > {
16414            type Operation = google_cloud_lro::internal::Operation<
16415                crate::model::RecrawlUrisResponse,
16416                crate::model::RecrawlUrisMetadata,
16417            >;
16418            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16419            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16420            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16421            if let Some(ref mut details) = poller_options.tracing {
16422                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
16423            }
16424
16425            let stub = self.0.stub.clone();
16426            let mut options = self.0.options.clone();
16427            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16428            let query = move |name| {
16429                let stub = stub.clone();
16430                let options = options.clone();
16431                async {
16432                    let op = GetOperation::new(stub)
16433                        .set_name(name)
16434                        .with_options(options)
16435                        .send()
16436                        .await?;
16437                    Ok(Operation::new(op))
16438                }
16439            };
16440
16441            let start = move || async {
16442                let op = self.send().await?;
16443                Ok(Operation::new(op))
16444            };
16445
16446            use google_cloud_lro::internal::PollerExt;
16447            {
16448                google_cloud_lro::internal::new_poller(
16449                    polling_error_policy,
16450                    polling_backoff_policy,
16451                    start,
16452                    query,
16453                )
16454            }
16455            .with_options(poller_options)
16456        }
16457
16458        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
16459        ///
16460        /// This is a **required** field for requests.
16461        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16462            self.0.request.site_search_engine = v.into();
16463            self
16464        }
16465
16466        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
16467        ///
16468        /// This is a **required** field for requests.
16469        pub fn set_uris<T, V>(mut self, v: T) -> Self
16470        where
16471            T: std::iter::IntoIterator<Item = V>,
16472            V: std::convert::Into<std::string::String>,
16473        {
16474            use std::iter::Iterator;
16475            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
16476            self
16477        }
16478
16479        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
16480        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
16481            self.0.request.site_credential = v.into();
16482            self
16483        }
16484    }
16485
16486    #[doc(hidden)]
16487    impl crate::RequestBuilder for RecrawlUris {
16488        fn request_options(&mut self) -> &mut crate::RequestOptions {
16489            &mut self.0.options
16490        }
16491    }
16492
16493    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
16494    ///
16495    /// # Example
16496    /// ```
16497    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
16498    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16499    /// use google_cloud_lro::Poller;
16500    ///
16501    /// let builder = prepare_request_builder();
16502    /// let response = builder.poller().until_done().await?;
16503    /// # Ok(()) }
16504    ///
16505    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
16506    ///   # panic!();
16507    ///   // ... details omitted ...
16508    /// }
16509    /// ```
16510    #[derive(Clone, Debug)]
16511    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
16512
16513    impl BatchVerifyTargetSites {
16514        pub(crate) fn new(
16515            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16516        ) -> Self {
16517            Self(RequestBuilder::new(stub))
16518        }
16519
16520        /// Sets the full request, replacing any prior values.
16521        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
16522            mut self,
16523            v: V,
16524        ) -> Self {
16525            self.0.request = v.into();
16526            self
16527        }
16528
16529        /// Sets all the options, replacing any prior values.
16530        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16531            self.0.options = v.into();
16532            self
16533        }
16534
16535        /// Sends the request.
16536        ///
16537        /// # Long running operations
16538        ///
16539        /// This starts, but does not poll, a longrunning operation. More information
16540        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
16541        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16542            (*self.0.stub)
16543                .batch_verify_target_sites(self.0.request, self.0.options)
16544                .await
16545                .map(crate::Response::into_body)
16546        }
16547
16548        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_verify_target_sites`.
16549        pub fn poller(
16550            self,
16551        ) -> impl google_cloud_lro::Poller<
16552            crate::model::BatchVerifyTargetSitesResponse,
16553            crate::model::BatchVerifyTargetSitesMetadata,
16554        > {
16555            type Operation = google_cloud_lro::internal::Operation<
16556                crate::model::BatchVerifyTargetSitesResponse,
16557                crate::model::BatchVerifyTargetSitesMetadata,
16558            >;
16559            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16560            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16561            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16562            if let Some(ref mut details) = poller_options.tracing {
16563                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
16564            }
16565
16566            let stub = self.0.stub.clone();
16567            let mut options = self.0.options.clone();
16568            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16569            let query = move |name| {
16570                let stub = stub.clone();
16571                let options = options.clone();
16572                async {
16573                    let op = GetOperation::new(stub)
16574                        .set_name(name)
16575                        .with_options(options)
16576                        .send()
16577                        .await?;
16578                    Ok(Operation::new(op))
16579                }
16580            };
16581
16582            let start = move || async {
16583                let op = self.send().await?;
16584                Ok(Operation::new(op))
16585            };
16586
16587            use google_cloud_lro::internal::PollerExt;
16588            {
16589                google_cloud_lro::internal::new_poller(
16590                    polling_error_policy,
16591                    polling_backoff_policy,
16592                    start,
16593                    query,
16594                )
16595            }
16596            .with_options(poller_options)
16597        }
16598
16599        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
16600        ///
16601        /// This is a **required** field for requests.
16602        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16603            self.0.request.parent = v.into();
16604            self
16605        }
16606    }
16607
16608    #[doc(hidden)]
16609    impl crate::RequestBuilder for BatchVerifyTargetSites {
16610        fn request_options(&mut self) -> &mut crate::RequestOptions {
16611            &mut self.0.options
16612        }
16613    }
16614
16615    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
16616    ///
16617    /// # Example
16618    /// ```
16619    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
16620    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16621    /// use google_cloud_gax::paginator::ItemPaginator;
16622    ///
16623    /// let builder = prepare_request_builder();
16624    /// let mut items = builder.by_item();
16625    /// while let Some(result) = items.next().await {
16626    ///   let item = result?;
16627    /// }
16628    /// # Ok(()) }
16629    ///
16630    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
16631    ///   # panic!();
16632    ///   // ... details omitted ...
16633    /// }
16634    /// ```
16635    #[derive(Clone, Debug)]
16636    pub struct FetchDomainVerificationStatus(
16637        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16638    );
16639
16640    impl FetchDomainVerificationStatus {
16641        pub(crate) fn new(
16642            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16643        ) -> Self {
16644            Self(RequestBuilder::new(stub))
16645        }
16646
16647        /// Sets the full request, replacing any prior values.
16648        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16649            mut self,
16650            v: V,
16651        ) -> Self {
16652            self.0.request = v.into();
16653            self
16654        }
16655
16656        /// Sets all the options, replacing any prior values.
16657        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16658            self.0.options = v.into();
16659            self
16660        }
16661
16662        /// Sends the request.
16663        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16664            (*self.0.stub)
16665                .fetch_domain_verification_status(self.0.request, self.0.options)
16666                .await
16667                .map(crate::Response::into_body)
16668        }
16669
16670        /// Streams each page in the collection.
16671        pub fn by_page(
16672            self,
16673        ) -> impl google_cloud_gax::paginator::Paginator<
16674            crate::model::FetchDomainVerificationStatusResponse,
16675            crate::Error,
16676        > {
16677            use std::clone::Clone;
16678            let token = self.0.request.page_token.clone();
16679            let execute = move |token: String| {
16680                let mut builder = self.clone();
16681                builder.0.request = builder.0.request.set_page_token(token);
16682                builder.send()
16683            };
16684            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16685        }
16686
16687        /// Streams each item in the collection.
16688        pub fn by_item(
16689            self,
16690        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16691            crate::model::FetchDomainVerificationStatusResponse,
16692            crate::Error,
16693        > {
16694            use google_cloud_gax::paginator::Paginator;
16695            self.by_page().items()
16696        }
16697
16698        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
16699        ///
16700        /// This is a **required** field for requests.
16701        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16702            self.0.request.site_search_engine = v.into();
16703            self
16704        }
16705
16706        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
16707        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16708            self.0.request.page_size = v.into();
16709            self
16710        }
16711
16712        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
16713        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16714            self.0.request.page_token = v.into();
16715            self
16716        }
16717    }
16718
16719    #[doc(hidden)]
16720    impl crate::RequestBuilder for FetchDomainVerificationStatus {
16721        fn request_options(&mut self) -> &mut crate::RequestOptions {
16722            &mut self.0.options
16723        }
16724    }
16725
16726    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
16727    ///
16728    /// # Example
16729    /// ```
16730    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
16731    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16732    /// use google_cloud_gax::paginator::ItemPaginator;
16733    ///
16734    /// let builder = prepare_request_builder();
16735    /// let mut items = builder.by_item();
16736    /// while let Some(result) = items.next().await {
16737    ///   let item = result?;
16738    /// }
16739    /// # Ok(()) }
16740    ///
16741    /// fn prepare_request_builder() -> ListOperations {
16742    ///   # panic!();
16743    ///   // ... details omitted ...
16744    /// }
16745    /// ```
16746    #[derive(Clone, Debug)]
16747    pub struct ListOperations(
16748        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16749    );
16750
16751    impl ListOperations {
16752        pub(crate) fn new(
16753            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16754        ) -> Self {
16755            Self(RequestBuilder::new(stub))
16756        }
16757
16758        /// Sets the full request, replacing any prior values.
16759        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16760            mut self,
16761            v: V,
16762        ) -> Self {
16763            self.0.request = v.into();
16764            self
16765        }
16766
16767        /// Sets all the options, replacing any prior values.
16768        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16769            self.0.options = v.into();
16770            self
16771        }
16772
16773        /// Sends the request.
16774        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16775            (*self.0.stub)
16776                .list_operations(self.0.request, self.0.options)
16777                .await
16778                .map(crate::Response::into_body)
16779        }
16780
16781        /// Streams each page in the collection.
16782        pub fn by_page(
16783            self,
16784        ) -> impl google_cloud_gax::paginator::Paginator<
16785            google_cloud_longrunning::model::ListOperationsResponse,
16786            crate::Error,
16787        > {
16788            use std::clone::Clone;
16789            let token = self.0.request.page_token.clone();
16790            let execute = move |token: String| {
16791                let mut builder = self.clone();
16792                builder.0.request = builder.0.request.set_page_token(token);
16793                builder.send()
16794            };
16795            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16796        }
16797
16798        /// Streams each item in the collection.
16799        pub fn by_item(
16800            self,
16801        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16802            google_cloud_longrunning::model::ListOperationsResponse,
16803            crate::Error,
16804        > {
16805            use google_cloud_gax::paginator::Paginator;
16806            self.by_page().items()
16807        }
16808
16809        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
16810        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16811            self.0.request.name = v.into();
16812            self
16813        }
16814
16815        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
16816        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16817            self.0.request.filter = v.into();
16818            self
16819        }
16820
16821        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
16822        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16823            self.0.request.page_size = v.into();
16824            self
16825        }
16826
16827        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
16828        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16829            self.0.request.page_token = v.into();
16830            self
16831        }
16832
16833        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
16834        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16835            self.0.request.return_partial_success = v.into();
16836            self
16837        }
16838    }
16839
16840    #[doc(hidden)]
16841    impl crate::RequestBuilder for ListOperations {
16842        fn request_options(&mut self) -> &mut crate::RequestOptions {
16843            &mut self.0.options
16844        }
16845    }
16846
16847    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
16848    ///
16849    /// # Example
16850    /// ```
16851    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
16852    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16853    ///
16854    /// let builder = prepare_request_builder();
16855    /// let response = builder.send().await?;
16856    /// # Ok(()) }
16857    ///
16858    /// fn prepare_request_builder() -> GetOperation {
16859    ///   # panic!();
16860    ///   // ... details omitted ...
16861    /// }
16862    /// ```
16863    #[derive(Clone, Debug)]
16864    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16865
16866    impl GetOperation {
16867        pub(crate) fn new(
16868            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16869        ) -> Self {
16870            Self(RequestBuilder::new(stub))
16871        }
16872
16873        /// Sets the full request, replacing any prior values.
16874        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16875            mut self,
16876            v: V,
16877        ) -> Self {
16878            self.0.request = v.into();
16879            self
16880        }
16881
16882        /// Sets all the options, replacing any prior values.
16883        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16884            self.0.options = v.into();
16885            self
16886        }
16887
16888        /// Sends the request.
16889        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16890            (*self.0.stub)
16891                .get_operation(self.0.request, self.0.options)
16892                .await
16893                .map(crate::Response::into_body)
16894        }
16895
16896        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16897        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16898            self.0.request.name = v.into();
16899            self
16900        }
16901    }
16902
16903    #[doc(hidden)]
16904    impl crate::RequestBuilder for GetOperation {
16905        fn request_options(&mut self) -> &mut crate::RequestOptions {
16906            &mut self.0.options
16907        }
16908    }
16909
16910    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
16911    ///
16912    /// # Example
16913    /// ```
16914    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
16915    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16916    ///
16917    /// let builder = prepare_request_builder();
16918    /// let response = builder.send().await?;
16919    /// # Ok(()) }
16920    ///
16921    /// fn prepare_request_builder() -> CancelOperation {
16922    ///   # panic!();
16923    ///   // ... details omitted ...
16924    /// }
16925    /// ```
16926    #[derive(Clone, Debug)]
16927    pub struct CancelOperation(
16928        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16929    );
16930
16931    impl CancelOperation {
16932        pub(crate) fn new(
16933            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16934        ) -> Self {
16935            Self(RequestBuilder::new(stub))
16936        }
16937
16938        /// Sets the full request, replacing any prior values.
16939        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16940            mut self,
16941            v: V,
16942        ) -> Self {
16943            self.0.request = v.into();
16944            self
16945        }
16946
16947        /// Sets all the options, replacing any prior values.
16948        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16949            self.0.options = v.into();
16950            self
16951        }
16952
16953        /// Sends the request.
16954        pub async fn send(self) -> Result<()> {
16955            (*self.0.stub)
16956                .cancel_operation(self.0.request, self.0.options)
16957                .await
16958                .map(crate::Response::into_body)
16959        }
16960
16961        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16962        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16963            self.0.request.name = v.into();
16964            self
16965        }
16966    }
16967
16968    #[doc(hidden)]
16969    impl crate::RequestBuilder for CancelOperation {
16970        fn request_options(&mut self) -> &mut crate::RequestOptions {
16971            &mut self.0.options
16972        }
16973    }
16974}
16975
16976/// Request and client builders for [UserEventService][crate::client::UserEventService].
16977#[cfg(feature = "user-event-service")]
16978#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16979pub mod user_event_service {
16980    use crate::Result;
16981
16982    /// A builder for [UserEventService][crate::client::UserEventService].
16983    ///
16984    /// ```
16985    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16986    /// # use google_cloud_discoveryengine_v1::*;
16987    /// # use builder::user_event_service::ClientBuilder;
16988    /// # use client::UserEventService;
16989    /// let builder : ClientBuilder = UserEventService::builder();
16990    /// let client = builder
16991    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16992    ///     .build().await?;
16993    /// # Ok(()) }
16994    /// ```
16995    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16996
16997    pub(crate) mod client {
16998        use super::super::super::client::UserEventService;
16999        pub struct Factory;
17000        impl crate::ClientFactory for Factory {
17001            type Client = UserEventService;
17002            type Credentials = gaxi::options::Credentials;
17003            async fn build(
17004                self,
17005                config: gaxi::options::ClientConfig,
17006            ) -> crate::ClientBuilderResult<Self::Client> {
17007                Self::Client::new(config).await
17008            }
17009        }
17010    }
17011
17012    /// Common implementation for [crate::client::UserEventService] request builders.
17013    #[derive(Clone, Debug)]
17014    pub(crate) struct RequestBuilder<R: std::default::Default> {
17015        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17016        request: R,
17017        options: crate::RequestOptions,
17018    }
17019
17020    impl<R> RequestBuilder<R>
17021    where
17022        R: std::default::Default,
17023    {
17024        pub(crate) fn new(
17025            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17026        ) -> Self {
17027            Self {
17028                stub,
17029                request: R::default(),
17030                options: crate::RequestOptions::default(),
17031            }
17032        }
17033    }
17034
17035    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
17036    ///
17037    /// # Example
17038    /// ```
17039    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
17040    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17041    ///
17042    /// let builder = prepare_request_builder();
17043    /// let response = builder.send().await?;
17044    /// # Ok(()) }
17045    ///
17046    /// fn prepare_request_builder() -> WriteUserEvent {
17047    ///   # panic!();
17048    ///   // ... details omitted ...
17049    /// }
17050    /// ```
17051    #[derive(Clone, Debug)]
17052    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
17053
17054    impl WriteUserEvent {
17055        pub(crate) fn new(
17056            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17057        ) -> Self {
17058            Self(RequestBuilder::new(stub))
17059        }
17060
17061        /// Sets the full request, replacing any prior values.
17062        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
17063            self.0.request = v.into();
17064            self
17065        }
17066
17067        /// Sets all the options, replacing any prior values.
17068        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17069            self.0.options = v.into();
17070            self
17071        }
17072
17073        /// Sends the request.
17074        pub async fn send(self) -> Result<crate::model::UserEvent> {
17075            (*self.0.stub)
17076                .write_user_event(self.0.request, self.0.options)
17077                .await
17078                .map(crate::Response::into_body)
17079        }
17080
17081        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
17082        ///
17083        /// This is a **required** field for requests.
17084        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17085            self.0.request.parent = v.into();
17086            self
17087        }
17088
17089        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
17090        ///
17091        /// This is a **required** field for requests.
17092        pub fn set_user_event<T>(mut self, v: T) -> Self
17093        where
17094            T: std::convert::Into<crate::model::UserEvent>,
17095        {
17096            self.0.request.user_event = std::option::Option::Some(v.into());
17097            self
17098        }
17099
17100        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
17101        ///
17102        /// This is a **required** field for requests.
17103        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
17104        where
17105            T: std::convert::Into<crate::model::UserEvent>,
17106        {
17107            self.0.request.user_event = v.map(|x| x.into());
17108            self
17109        }
17110
17111        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
17112        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
17113            self.0.request.write_async = v.into();
17114            self
17115        }
17116    }
17117
17118    #[doc(hidden)]
17119    impl crate::RequestBuilder for WriteUserEvent {
17120        fn request_options(&mut self) -> &mut crate::RequestOptions {
17121            &mut self.0.options
17122        }
17123    }
17124
17125    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
17126    ///
17127    /// # Example
17128    /// ```
17129    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
17130    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17131    ///
17132    /// let builder = prepare_request_builder();
17133    /// let response = builder.send().await?;
17134    /// # Ok(()) }
17135    ///
17136    /// fn prepare_request_builder() -> CollectUserEvent {
17137    ///   # panic!();
17138    ///   // ... details omitted ...
17139    /// }
17140    /// ```
17141    #[derive(Clone, Debug)]
17142    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
17143
17144    impl CollectUserEvent {
17145        pub(crate) fn new(
17146            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17147        ) -> Self {
17148            Self(RequestBuilder::new(stub))
17149        }
17150
17151        /// Sets the full request, replacing any prior values.
17152        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
17153            mut self,
17154            v: V,
17155        ) -> Self {
17156            self.0.request = v.into();
17157            self
17158        }
17159
17160        /// Sets all the options, replacing any prior values.
17161        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17162            self.0.options = v.into();
17163            self
17164        }
17165
17166        /// Sends the request.
17167        pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
17168            (*self.0.stub)
17169                .collect_user_event(self.0.request, self.0.options)
17170                .await
17171                .map(crate::Response::into_body)
17172        }
17173
17174        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
17175        ///
17176        /// This is a **required** field for requests.
17177        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17178            self.0.request.parent = v.into();
17179            self
17180        }
17181
17182        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
17183        ///
17184        /// This is a **required** field for requests.
17185        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
17186            self.0.request.user_event = v.into();
17187            self
17188        }
17189
17190        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
17191        pub fn set_uri<T>(mut self, v: T) -> Self
17192        where
17193            T: std::convert::Into<std::string::String>,
17194        {
17195            self.0.request.uri = std::option::Option::Some(v.into());
17196            self
17197        }
17198
17199        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
17200        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
17201        where
17202            T: std::convert::Into<std::string::String>,
17203        {
17204            self.0.request.uri = v.map(|x| x.into());
17205            self
17206        }
17207
17208        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
17209        pub fn set_ets<T>(mut self, v: T) -> Self
17210        where
17211            T: std::convert::Into<i64>,
17212        {
17213            self.0.request.ets = std::option::Option::Some(v.into());
17214            self
17215        }
17216
17217        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
17218        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
17219        where
17220            T: std::convert::Into<i64>,
17221        {
17222            self.0.request.ets = v.map(|x| x.into());
17223            self
17224        }
17225    }
17226
17227    #[doc(hidden)]
17228    impl crate::RequestBuilder for CollectUserEvent {
17229        fn request_options(&mut self) -> &mut crate::RequestOptions {
17230            &mut self.0.options
17231        }
17232    }
17233
17234    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
17235    ///
17236    /// # Example
17237    /// ```
17238    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
17239    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17240    /// use google_cloud_lro::Poller;
17241    ///
17242    /// let builder = prepare_request_builder();
17243    /// let response = builder.poller().until_done().await?;
17244    /// # Ok(()) }
17245    ///
17246    /// fn prepare_request_builder() -> PurgeUserEvents {
17247    ///   # panic!();
17248    ///   // ... details omitted ...
17249    /// }
17250    /// ```
17251    #[derive(Clone, Debug)]
17252    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
17253
17254    impl PurgeUserEvents {
17255        pub(crate) fn new(
17256            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17257        ) -> Self {
17258            Self(RequestBuilder::new(stub))
17259        }
17260
17261        /// Sets the full request, replacing any prior values.
17262        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
17263            self.0.request = v.into();
17264            self
17265        }
17266
17267        /// Sets all the options, replacing any prior values.
17268        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17269            self.0.options = v.into();
17270            self
17271        }
17272
17273        /// Sends the request.
17274        ///
17275        /// # Long running operations
17276        ///
17277        /// This starts, but does not poll, a longrunning operation. More information
17278        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
17279        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17280            (*self.0.stub)
17281                .purge_user_events(self.0.request, self.0.options)
17282                .await
17283                .map(crate::Response::into_body)
17284        }
17285
17286        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_user_events`.
17287        pub fn poller(
17288            self,
17289        ) -> impl google_cloud_lro::Poller<
17290            crate::model::PurgeUserEventsResponse,
17291            crate::model::PurgeUserEventsMetadata,
17292        > {
17293            type Operation = google_cloud_lro::internal::Operation<
17294                crate::model::PurgeUserEventsResponse,
17295                crate::model::PurgeUserEventsMetadata,
17296            >;
17297            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17298            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17299            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17300            if let Some(ref mut details) = poller_options.tracing {
17301                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
17302            }
17303
17304            let stub = self.0.stub.clone();
17305            let mut options = self.0.options.clone();
17306            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17307            let query = move |name| {
17308                let stub = stub.clone();
17309                let options = options.clone();
17310                async {
17311                    let op = GetOperation::new(stub)
17312                        .set_name(name)
17313                        .with_options(options)
17314                        .send()
17315                        .await?;
17316                    Ok(Operation::new(op))
17317                }
17318            };
17319
17320            let start = move || async {
17321                let op = self.send().await?;
17322                Ok(Operation::new(op))
17323            };
17324
17325            use google_cloud_lro::internal::PollerExt;
17326            {
17327                google_cloud_lro::internal::new_poller(
17328                    polling_error_policy,
17329                    polling_backoff_policy,
17330                    start,
17331                    query,
17332                )
17333            }
17334            .with_options(poller_options)
17335        }
17336
17337        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
17338        ///
17339        /// This is a **required** field for requests.
17340        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17341            self.0.request.parent = v.into();
17342            self
17343        }
17344
17345        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
17346        ///
17347        /// This is a **required** field for requests.
17348        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17349            self.0.request.filter = v.into();
17350            self
17351        }
17352
17353        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
17354        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
17355            self.0.request.force = v.into();
17356            self
17357        }
17358    }
17359
17360    #[doc(hidden)]
17361    impl crate::RequestBuilder for PurgeUserEvents {
17362        fn request_options(&mut self) -> &mut crate::RequestOptions {
17363            &mut self.0.options
17364        }
17365    }
17366
17367    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
17368    ///
17369    /// # Example
17370    /// ```
17371    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
17372    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17373    /// use google_cloud_lro::Poller;
17374    ///
17375    /// let builder = prepare_request_builder();
17376    /// let response = builder.poller().until_done().await?;
17377    /// # Ok(()) }
17378    ///
17379    /// fn prepare_request_builder() -> ImportUserEvents {
17380    ///   # panic!();
17381    ///   // ... details omitted ...
17382    /// }
17383    /// ```
17384    #[derive(Clone, Debug)]
17385    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
17386
17387    impl ImportUserEvents {
17388        pub(crate) fn new(
17389            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17390        ) -> Self {
17391            Self(RequestBuilder::new(stub))
17392        }
17393
17394        /// Sets the full request, replacing any prior values.
17395        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
17396            mut self,
17397            v: V,
17398        ) -> Self {
17399            self.0.request = v.into();
17400            self
17401        }
17402
17403        /// Sets all the options, replacing any prior values.
17404        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17405            self.0.options = v.into();
17406            self
17407        }
17408
17409        /// Sends the request.
17410        ///
17411        /// # Long running operations
17412        ///
17413        /// This starts, but does not poll, a longrunning operation. More information
17414        /// on [import_user_events][crate::client::UserEventService::import_user_events].
17415        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17416            (*self.0.stub)
17417                .import_user_events(self.0.request, self.0.options)
17418                .await
17419                .map(crate::Response::into_body)
17420        }
17421
17422        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_user_events`.
17423        pub fn poller(
17424            self,
17425        ) -> impl google_cloud_lro::Poller<
17426            crate::model::ImportUserEventsResponse,
17427            crate::model::ImportUserEventsMetadata,
17428        > {
17429            type Operation = google_cloud_lro::internal::Operation<
17430                crate::model::ImportUserEventsResponse,
17431                crate::model::ImportUserEventsMetadata,
17432            >;
17433            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17434            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17435            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17436            if let Some(ref mut details) = poller_options.tracing {
17437                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
17438            }
17439
17440            let stub = self.0.stub.clone();
17441            let mut options = self.0.options.clone();
17442            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17443            let query = move |name| {
17444                let stub = stub.clone();
17445                let options = options.clone();
17446                async {
17447                    let op = GetOperation::new(stub)
17448                        .set_name(name)
17449                        .with_options(options)
17450                        .send()
17451                        .await?;
17452                    Ok(Operation::new(op))
17453                }
17454            };
17455
17456            let start = move || async {
17457                let op = self.send().await?;
17458                Ok(Operation::new(op))
17459            };
17460
17461            use google_cloud_lro::internal::PollerExt;
17462            {
17463                google_cloud_lro::internal::new_poller(
17464                    polling_error_policy,
17465                    polling_backoff_policy,
17466                    start,
17467                    query,
17468                )
17469            }
17470            .with_options(poller_options)
17471        }
17472
17473        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
17474        ///
17475        /// This is a **required** field for requests.
17476        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17477            self.0.request.parent = v.into();
17478            self
17479        }
17480
17481        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
17482        pub fn set_error_config<T>(mut self, v: T) -> Self
17483        where
17484            T: std::convert::Into<crate::model::ImportErrorConfig>,
17485        {
17486            self.0.request.error_config = std::option::Option::Some(v.into());
17487            self
17488        }
17489
17490        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
17491        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
17492        where
17493            T: std::convert::Into<crate::model::ImportErrorConfig>,
17494        {
17495            self.0.request.error_config = v.map(|x| x.into());
17496            self
17497        }
17498
17499        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
17500        ///
17501        /// Note that all the setters affecting `source` are
17502        /// mutually exclusive.
17503        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
17504            mut self,
17505            v: T,
17506        ) -> Self {
17507            self.0.request.source = v.into();
17508            self
17509        }
17510
17511        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
17512        /// to hold a `InlineSource`.
17513        ///
17514        /// Note that all the setters affecting `source` are
17515        /// mutually exclusive.
17516        pub fn set_inline_source<
17517            T: std::convert::Into<
17518                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
17519                >,
17520        >(
17521            mut self,
17522            v: T,
17523        ) -> Self {
17524            self.0.request = self.0.request.set_inline_source(v);
17525            self
17526        }
17527
17528        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
17529        /// to hold a `GcsSource`.
17530        ///
17531        /// Note that all the setters affecting `source` are
17532        /// mutually exclusive.
17533        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
17534            mut self,
17535            v: T,
17536        ) -> Self {
17537            self.0.request = self.0.request.set_gcs_source(v);
17538            self
17539        }
17540
17541        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
17542        /// to hold a `BigquerySource`.
17543        ///
17544        /// Note that all the setters affecting `source` are
17545        /// mutually exclusive.
17546        pub fn set_bigquery_source<
17547            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
17548        >(
17549            mut self,
17550            v: T,
17551        ) -> Self {
17552            self.0.request = self.0.request.set_bigquery_source(v);
17553            self
17554        }
17555    }
17556
17557    #[doc(hidden)]
17558    impl crate::RequestBuilder for ImportUserEvents {
17559        fn request_options(&mut self) -> &mut crate::RequestOptions {
17560            &mut self.0.options
17561        }
17562    }
17563
17564    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
17565    ///
17566    /// # Example
17567    /// ```
17568    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
17569    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17570    /// use google_cloud_gax::paginator::ItemPaginator;
17571    ///
17572    /// let builder = prepare_request_builder();
17573    /// let mut items = builder.by_item();
17574    /// while let Some(result) = items.next().await {
17575    ///   let item = result?;
17576    /// }
17577    /// # Ok(()) }
17578    ///
17579    /// fn prepare_request_builder() -> ListOperations {
17580    ///   # panic!();
17581    ///   // ... details omitted ...
17582    /// }
17583    /// ```
17584    #[derive(Clone, Debug)]
17585    pub struct ListOperations(
17586        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17587    );
17588
17589    impl ListOperations {
17590        pub(crate) fn new(
17591            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17592        ) -> Self {
17593            Self(RequestBuilder::new(stub))
17594        }
17595
17596        /// Sets the full request, replacing any prior values.
17597        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17598            mut self,
17599            v: V,
17600        ) -> Self {
17601            self.0.request = v.into();
17602            self
17603        }
17604
17605        /// Sets all the options, replacing any prior values.
17606        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17607            self.0.options = v.into();
17608            self
17609        }
17610
17611        /// Sends the request.
17612        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17613            (*self.0.stub)
17614                .list_operations(self.0.request, self.0.options)
17615                .await
17616                .map(crate::Response::into_body)
17617        }
17618
17619        /// Streams each page in the collection.
17620        pub fn by_page(
17621            self,
17622        ) -> impl google_cloud_gax::paginator::Paginator<
17623            google_cloud_longrunning::model::ListOperationsResponse,
17624            crate::Error,
17625        > {
17626            use std::clone::Clone;
17627            let token = self.0.request.page_token.clone();
17628            let execute = move |token: String| {
17629                let mut builder = self.clone();
17630                builder.0.request = builder.0.request.set_page_token(token);
17631                builder.send()
17632            };
17633            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17634        }
17635
17636        /// Streams each item in the collection.
17637        pub fn by_item(
17638            self,
17639        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17640            google_cloud_longrunning::model::ListOperationsResponse,
17641            crate::Error,
17642        > {
17643            use google_cloud_gax::paginator::Paginator;
17644            self.by_page().items()
17645        }
17646
17647        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17648        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17649            self.0.request.name = v.into();
17650            self
17651        }
17652
17653        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17654        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17655            self.0.request.filter = v.into();
17656            self
17657        }
17658
17659        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17660        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17661            self.0.request.page_size = v.into();
17662            self
17663        }
17664
17665        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17666        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17667            self.0.request.page_token = v.into();
17668            self
17669        }
17670
17671        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17672        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17673            self.0.request.return_partial_success = v.into();
17674            self
17675        }
17676    }
17677
17678    #[doc(hidden)]
17679    impl crate::RequestBuilder for ListOperations {
17680        fn request_options(&mut self) -> &mut crate::RequestOptions {
17681            &mut self.0.options
17682        }
17683    }
17684
17685    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
17686    ///
17687    /// # Example
17688    /// ```
17689    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
17690    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17691    ///
17692    /// let builder = prepare_request_builder();
17693    /// let response = builder.send().await?;
17694    /// # Ok(()) }
17695    ///
17696    /// fn prepare_request_builder() -> GetOperation {
17697    ///   # panic!();
17698    ///   // ... details omitted ...
17699    /// }
17700    /// ```
17701    #[derive(Clone, Debug)]
17702    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17703
17704    impl GetOperation {
17705        pub(crate) fn new(
17706            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17707        ) -> Self {
17708            Self(RequestBuilder::new(stub))
17709        }
17710
17711        /// Sets the full request, replacing any prior values.
17712        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17713            mut self,
17714            v: V,
17715        ) -> Self {
17716            self.0.request = v.into();
17717            self
17718        }
17719
17720        /// Sets all the options, replacing any prior values.
17721        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17722            self.0.options = v.into();
17723            self
17724        }
17725
17726        /// Sends the request.
17727        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17728            (*self.0.stub)
17729                .get_operation(self.0.request, self.0.options)
17730                .await
17731                .map(crate::Response::into_body)
17732        }
17733
17734        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17735        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17736            self.0.request.name = v.into();
17737            self
17738        }
17739    }
17740
17741    #[doc(hidden)]
17742    impl crate::RequestBuilder for GetOperation {
17743        fn request_options(&mut self) -> &mut crate::RequestOptions {
17744            &mut self.0.options
17745        }
17746    }
17747
17748    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
17749    ///
17750    /// # Example
17751    /// ```
17752    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
17753    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17754    ///
17755    /// let builder = prepare_request_builder();
17756    /// let response = builder.send().await?;
17757    /// # Ok(()) }
17758    ///
17759    /// fn prepare_request_builder() -> CancelOperation {
17760    ///   # panic!();
17761    ///   // ... details omitted ...
17762    /// }
17763    /// ```
17764    #[derive(Clone, Debug)]
17765    pub struct CancelOperation(
17766        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17767    );
17768
17769    impl CancelOperation {
17770        pub(crate) fn new(
17771            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17772        ) -> Self {
17773            Self(RequestBuilder::new(stub))
17774        }
17775
17776        /// Sets the full request, replacing any prior values.
17777        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17778            mut self,
17779            v: V,
17780        ) -> Self {
17781            self.0.request = v.into();
17782            self
17783        }
17784
17785        /// Sets all the options, replacing any prior values.
17786        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17787            self.0.options = v.into();
17788            self
17789        }
17790
17791        /// Sends the request.
17792        pub async fn send(self) -> Result<()> {
17793            (*self.0.stub)
17794                .cancel_operation(self.0.request, self.0.options)
17795                .await
17796                .map(crate::Response::into_body)
17797        }
17798
17799        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17800        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17801            self.0.request.name = v.into();
17802            self
17803        }
17804    }
17805
17806    #[doc(hidden)]
17807    impl crate::RequestBuilder for CancelOperation {
17808        fn request_options(&mut self) -> &mut crate::RequestOptions {
17809            &mut self.0.options
17810        }
17811    }
17812}
17813
17814/// Request and client builders for [UserLicenseService][crate::client::UserLicenseService].
17815#[cfg(feature = "user-license-service")]
17816#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17817pub mod user_license_service {
17818    use crate::Result;
17819
17820    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
17821    ///
17822    /// ```
17823    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17824    /// # use google_cloud_discoveryengine_v1::*;
17825    /// # use builder::user_license_service::ClientBuilder;
17826    /// # use client::UserLicenseService;
17827    /// let builder : ClientBuilder = UserLicenseService::builder();
17828    /// let client = builder
17829    ///     .with_endpoint("https://discoveryengine.googleapis.com")
17830    ///     .build().await?;
17831    /// # Ok(()) }
17832    /// ```
17833    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17834
17835    pub(crate) mod client {
17836        use super::super::super::client::UserLicenseService;
17837        pub struct Factory;
17838        impl crate::ClientFactory for Factory {
17839            type Client = UserLicenseService;
17840            type Credentials = gaxi::options::Credentials;
17841            async fn build(
17842                self,
17843                config: gaxi::options::ClientConfig,
17844            ) -> crate::ClientBuilderResult<Self::Client> {
17845                Self::Client::new(config).await
17846            }
17847        }
17848    }
17849
17850    /// Common implementation for [crate::client::UserLicenseService] request builders.
17851    #[derive(Clone, Debug)]
17852    pub(crate) struct RequestBuilder<R: std::default::Default> {
17853        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17854        request: R,
17855        options: crate::RequestOptions,
17856    }
17857
17858    impl<R> RequestBuilder<R>
17859    where
17860        R: std::default::Default,
17861    {
17862        pub(crate) fn new(
17863            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17864        ) -> Self {
17865            Self {
17866                stub,
17867                request: R::default(),
17868                options: crate::RequestOptions::default(),
17869            }
17870        }
17871    }
17872
17873    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
17874    ///
17875    /// # Example
17876    /// ```
17877    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
17878    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17879    /// use google_cloud_gax::paginator::ItemPaginator;
17880    ///
17881    /// let builder = prepare_request_builder();
17882    /// let mut items = builder.by_item();
17883    /// while let Some(result) = items.next().await {
17884    ///   let item = result?;
17885    /// }
17886    /// # Ok(()) }
17887    ///
17888    /// fn prepare_request_builder() -> ListUserLicenses {
17889    ///   # panic!();
17890    ///   // ... details omitted ...
17891    /// }
17892    /// ```
17893    #[derive(Clone, Debug)]
17894    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17895
17896    impl ListUserLicenses {
17897        pub(crate) fn new(
17898            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17899        ) -> Self {
17900            Self(RequestBuilder::new(stub))
17901        }
17902
17903        /// Sets the full request, replacing any prior values.
17904        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17905            mut self,
17906            v: V,
17907        ) -> Self {
17908            self.0.request = v.into();
17909            self
17910        }
17911
17912        /// Sets all the options, replacing any prior values.
17913        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17914            self.0.options = v.into();
17915            self
17916        }
17917
17918        /// Sends the request.
17919        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17920            (*self.0.stub)
17921                .list_user_licenses(self.0.request, self.0.options)
17922                .await
17923                .map(crate::Response::into_body)
17924        }
17925
17926        /// Streams each page in the collection.
17927        pub fn by_page(
17928            self,
17929        ) -> impl google_cloud_gax::paginator::Paginator<
17930            crate::model::ListUserLicensesResponse,
17931            crate::Error,
17932        > {
17933            use std::clone::Clone;
17934            let token = self.0.request.page_token.clone();
17935            let execute = move |token: String| {
17936                let mut builder = self.clone();
17937                builder.0.request = builder.0.request.set_page_token(token);
17938                builder.send()
17939            };
17940            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17941        }
17942
17943        /// Streams each item in the collection.
17944        pub fn by_item(
17945            self,
17946        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17947            crate::model::ListUserLicensesResponse,
17948            crate::Error,
17949        > {
17950            use google_cloud_gax::paginator::Paginator;
17951            self.by_page().items()
17952        }
17953
17954        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
17955        ///
17956        /// This is a **required** field for requests.
17957        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17958            self.0.request.parent = v.into();
17959            self
17960        }
17961
17962        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
17963        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17964            self.0.request.page_size = v.into();
17965            self
17966        }
17967
17968        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
17969        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17970            self.0.request.page_token = v.into();
17971            self
17972        }
17973
17974        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
17975        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17976            self.0.request.filter = v.into();
17977            self
17978        }
17979    }
17980
17981    #[doc(hidden)]
17982    impl crate::RequestBuilder for ListUserLicenses {
17983        fn request_options(&mut self) -> &mut crate::RequestOptions {
17984            &mut self.0.options
17985        }
17986    }
17987
17988    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
17989    ///
17990    /// # Example
17991    /// ```
17992    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
17993    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17994    /// use google_cloud_lro::Poller;
17995    ///
17996    /// let builder = prepare_request_builder();
17997    /// let response = builder.poller().until_done().await?;
17998    /// # Ok(()) }
17999    ///
18000    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
18001    ///   # panic!();
18002    ///   // ... details omitted ...
18003    /// }
18004    /// ```
18005    #[derive(Clone, Debug)]
18006    pub struct BatchUpdateUserLicenses(
18007        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
18008    );
18009
18010    impl BatchUpdateUserLicenses {
18011        pub(crate) fn new(
18012            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18013        ) -> Self {
18014            Self(RequestBuilder::new(stub))
18015        }
18016
18017        /// Sets the full request, replacing any prior values.
18018        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
18019            mut self,
18020            v: V,
18021        ) -> Self {
18022            self.0.request = v.into();
18023            self
18024        }
18025
18026        /// Sets all the options, replacing any prior values.
18027        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18028            self.0.options = v.into();
18029            self
18030        }
18031
18032        /// Sends the request.
18033        ///
18034        /// # Long running operations
18035        ///
18036        /// This starts, but does not poll, a longrunning operation. More information
18037        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
18038        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
18039            (*self.0.stub)
18040                .batch_update_user_licenses(self.0.request, self.0.options)
18041                .await
18042                .map(crate::Response::into_body)
18043        }
18044
18045        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_update_user_licenses`.
18046        pub fn poller(
18047            self,
18048        ) -> impl google_cloud_lro::Poller<
18049            crate::model::BatchUpdateUserLicensesResponse,
18050            crate::model::BatchUpdateUserLicensesMetadata,
18051        > {
18052            type Operation = google_cloud_lro::internal::Operation<
18053                crate::model::BatchUpdateUserLicensesResponse,
18054                crate::model::BatchUpdateUserLicensesMetadata,
18055            >;
18056            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
18057            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
18058            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
18059            if let Some(ref mut details) = poller_options.tracing {
18060                details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
18061            }
18062
18063            let stub = self.0.stub.clone();
18064            let mut options = self.0.options.clone();
18065            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
18066            let query = move |name| {
18067                let stub = stub.clone();
18068                let options = options.clone();
18069                async {
18070                    let op = GetOperation::new(stub)
18071                        .set_name(name)
18072                        .with_options(options)
18073                        .send()
18074                        .await?;
18075                    Ok(Operation::new(op))
18076                }
18077            };
18078
18079            let start = move || async {
18080                let op = self.send().await?;
18081                Ok(Operation::new(op))
18082            };
18083
18084            use google_cloud_lro::internal::PollerExt;
18085            {
18086                google_cloud_lro::internal::new_poller(
18087                    polling_error_policy,
18088                    polling_backoff_policy,
18089                    start,
18090                    query,
18091                )
18092            }
18093            .with_options(poller_options)
18094        }
18095
18096        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
18097        ///
18098        /// This is a **required** field for requests.
18099        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18100            self.0.request.parent = v.into();
18101            self
18102        }
18103
18104        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
18105        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
18106            self.0.request.delete_unassigned_user_licenses = v.into();
18107            self
18108        }
18109
18110        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
18111        ///
18112        /// Note that all the setters affecting `source` are
18113        /// mutually exclusive.
18114        pub fn set_source<
18115            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
18116        >(
18117            mut self,
18118            v: T,
18119        ) -> Self {
18120            self.0.request.source = v.into();
18121            self
18122        }
18123
18124        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
18125        /// to hold a `InlineSource`.
18126        ///
18127        /// Note that all the setters affecting `source` are
18128        /// mutually exclusive.
18129        pub fn set_inline_source<
18130            T: std::convert::Into<
18131                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
18132                >,
18133        >(
18134            mut self,
18135            v: T,
18136        ) -> Self {
18137            self.0.request = self.0.request.set_inline_source(v);
18138            self
18139        }
18140    }
18141
18142    #[doc(hidden)]
18143    impl crate::RequestBuilder for BatchUpdateUserLicenses {
18144        fn request_options(&mut self) -> &mut crate::RequestOptions {
18145            &mut self.0.options
18146        }
18147    }
18148
18149    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
18150    ///
18151    /// # Example
18152    /// ```
18153    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
18154    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
18155    /// use google_cloud_gax::paginator::ItemPaginator;
18156    ///
18157    /// let builder = prepare_request_builder();
18158    /// let mut items = builder.by_item();
18159    /// while let Some(result) = items.next().await {
18160    ///   let item = result?;
18161    /// }
18162    /// # Ok(()) }
18163    ///
18164    /// fn prepare_request_builder() -> ListOperations {
18165    ///   # panic!();
18166    ///   // ... details omitted ...
18167    /// }
18168    /// ```
18169    #[derive(Clone, Debug)]
18170    pub struct ListOperations(
18171        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
18172    );
18173
18174    impl ListOperations {
18175        pub(crate) fn new(
18176            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18177        ) -> Self {
18178            Self(RequestBuilder::new(stub))
18179        }
18180
18181        /// Sets the full request, replacing any prior values.
18182        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
18183            mut self,
18184            v: V,
18185        ) -> Self {
18186            self.0.request = v.into();
18187            self
18188        }
18189
18190        /// Sets all the options, replacing any prior values.
18191        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18192            self.0.options = v.into();
18193            self
18194        }
18195
18196        /// Sends the request.
18197        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
18198            (*self.0.stub)
18199                .list_operations(self.0.request, self.0.options)
18200                .await
18201                .map(crate::Response::into_body)
18202        }
18203
18204        /// Streams each page in the collection.
18205        pub fn by_page(
18206            self,
18207        ) -> impl google_cloud_gax::paginator::Paginator<
18208            google_cloud_longrunning::model::ListOperationsResponse,
18209            crate::Error,
18210        > {
18211            use std::clone::Clone;
18212            let token = self.0.request.page_token.clone();
18213            let execute = move |token: String| {
18214                let mut builder = self.clone();
18215                builder.0.request = builder.0.request.set_page_token(token);
18216                builder.send()
18217            };
18218            google_cloud_gax::paginator::internal::new_paginator(token, execute)
18219        }
18220
18221        /// Streams each item in the collection.
18222        pub fn by_item(
18223            self,
18224        ) -> impl google_cloud_gax::paginator::ItemPaginator<
18225            google_cloud_longrunning::model::ListOperationsResponse,
18226            crate::Error,
18227        > {
18228            use google_cloud_gax::paginator::Paginator;
18229            self.by_page().items()
18230        }
18231
18232        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
18233        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18234            self.0.request.name = v.into();
18235            self
18236        }
18237
18238        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
18239        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18240            self.0.request.filter = v.into();
18241            self
18242        }
18243
18244        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
18245        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18246            self.0.request.page_size = v.into();
18247            self
18248        }
18249
18250        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
18251        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18252            self.0.request.page_token = v.into();
18253            self
18254        }
18255
18256        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
18257        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18258            self.0.request.return_partial_success = v.into();
18259            self
18260        }
18261    }
18262
18263    #[doc(hidden)]
18264    impl crate::RequestBuilder for ListOperations {
18265        fn request_options(&mut self) -> &mut crate::RequestOptions {
18266            &mut self.0.options
18267        }
18268    }
18269
18270    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
18271    ///
18272    /// # Example
18273    /// ```
18274    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
18275    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
18276    ///
18277    /// let builder = prepare_request_builder();
18278    /// let response = builder.send().await?;
18279    /// # Ok(()) }
18280    ///
18281    /// fn prepare_request_builder() -> GetOperation {
18282    ///   # panic!();
18283    ///   // ... details omitted ...
18284    /// }
18285    /// ```
18286    #[derive(Clone, Debug)]
18287    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
18288
18289    impl GetOperation {
18290        pub(crate) fn new(
18291            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18292        ) -> Self {
18293            Self(RequestBuilder::new(stub))
18294        }
18295
18296        /// Sets the full request, replacing any prior values.
18297        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
18298            mut self,
18299            v: V,
18300        ) -> Self {
18301            self.0.request = v.into();
18302            self
18303        }
18304
18305        /// Sets all the options, replacing any prior values.
18306        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18307            self.0.options = v.into();
18308            self
18309        }
18310
18311        /// Sends the request.
18312        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
18313            (*self.0.stub)
18314                .get_operation(self.0.request, self.0.options)
18315                .await
18316                .map(crate::Response::into_body)
18317        }
18318
18319        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
18320        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18321            self.0.request.name = v.into();
18322            self
18323        }
18324    }
18325
18326    #[doc(hidden)]
18327    impl crate::RequestBuilder for GetOperation {
18328        fn request_options(&mut self) -> &mut crate::RequestOptions {
18329            &mut self.0.options
18330        }
18331    }
18332
18333    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
18334    ///
18335    /// # Example
18336    /// ```
18337    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
18338    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
18339    ///
18340    /// let builder = prepare_request_builder();
18341    /// let response = builder.send().await?;
18342    /// # Ok(()) }
18343    ///
18344    /// fn prepare_request_builder() -> CancelOperation {
18345    ///   # panic!();
18346    ///   // ... details omitted ...
18347    /// }
18348    /// ```
18349    #[derive(Clone, Debug)]
18350    pub struct CancelOperation(
18351        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
18352    );
18353
18354    impl CancelOperation {
18355        pub(crate) fn new(
18356            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18357        ) -> Self {
18358            Self(RequestBuilder::new(stub))
18359        }
18360
18361        /// Sets the full request, replacing any prior values.
18362        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
18363            mut self,
18364            v: V,
18365        ) -> Self {
18366            self.0.request = v.into();
18367            self
18368        }
18369
18370        /// Sets all the options, replacing any prior values.
18371        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18372            self.0.options = v.into();
18373            self
18374        }
18375
18376        /// Sends the request.
18377        pub async fn send(self) -> Result<()> {
18378            (*self.0.stub)
18379                .cancel_operation(self.0.request, self.0.options)
18380                .await
18381                .map(crate::Response::into_body)
18382        }
18383
18384        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
18385        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18386            self.0.request.name = v.into();
18387            self
18388        }
18389    }
18390
18391    #[doc(hidden)]
18392    impl crate::RequestBuilder for CancelOperation {
18393        fn request_options(&mut self) -> &mut crate::RequestOptions {
18394            &mut self.0.options
18395        }
18396    }
18397}