Skip to main content

google_cloud_retail_v2/
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
17pub mod analytics_service {
18    use crate::Result;
19
20    /// A builder for [AnalyticsService][crate::client::AnalyticsService].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_retail_v2::*;
25    /// # use builder::analytics_service::ClientBuilder;
26    /// # use client::AnalyticsService;
27    /// let builder : ClientBuilder = AnalyticsService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://retail.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::AnalyticsService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = AnalyticsService;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::AnalyticsService] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [AnalyticsService::export_analytics_metrics][crate::client::AnalyticsService::export_analytics_metrics] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_retail_v2::builder::analytics_service::ExportAnalyticsMetrics;
79    /// # async fn sample() -> gax::Result<()> {
80    /// use lro::Poller;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let response = builder.poller().until_done().await?;
84    /// # Ok(()) }
85    ///
86    /// fn prepare_request_builder() -> ExportAnalyticsMetrics {
87    ///   # panic!();
88    ///   // ... details omitted ...
89    /// }
90    /// ```
91    #[derive(Clone, Debug)]
92    pub struct ExportAnalyticsMetrics(RequestBuilder<crate::model::ExportAnalyticsMetricsRequest>);
93
94    impl ExportAnalyticsMetrics {
95        pub(crate) fn new(
96            stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
97        ) -> Self {
98            Self(RequestBuilder::new(stub))
99        }
100
101        /// Sets the full request, replacing any prior values.
102        pub fn with_request<V: Into<crate::model::ExportAnalyticsMetricsRequest>>(
103            mut self,
104            v: V,
105        ) -> Self {
106            self.0.request = v.into();
107            self
108        }
109
110        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        ///
118        /// # Long running operations
119        ///
120        /// This starts, but does not poll, a longrunning operation. More information
121        /// on [export_analytics_metrics][crate::client::AnalyticsService::export_analytics_metrics].
122        pub async fn send(self) -> Result<longrunning::model::Operation> {
123            (*self.0.stub)
124                .export_analytics_metrics(self.0.request, self.0.options)
125                .await
126                .map(gax::response::Response::into_body)
127        }
128
129        /// Creates a [Poller][lro::Poller] to work with `export_analytics_metrics`.
130        pub fn poller(
131            self,
132        ) -> impl lro::Poller<crate::model::ExportAnalyticsMetricsResponse, crate::model::ExportMetadata>
133        {
134            type Operation = lro::internal::Operation<
135                crate::model::ExportAnalyticsMetricsResponse,
136                crate::model::ExportMetadata,
137            >;
138            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
139            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
140
141            let stub = self.0.stub.clone();
142            let mut options = self.0.options.clone();
143            options.set_retry_policy(gax::retry_policy::NeverRetry);
144            let query = move |name| {
145                let stub = stub.clone();
146                let options = options.clone();
147                async {
148                    let op = GetOperation::new(stub)
149                        .set_name(name)
150                        .with_options(options)
151                        .send()
152                        .await?;
153                    Ok(Operation::new(op))
154                }
155            };
156
157            let start = move || async {
158                let op = self.send().await?;
159                Ok(Operation::new(op))
160            };
161
162            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
163        }
164
165        /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
166        ///
167        /// This is a **required** field for requests.
168        pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
169            self.0.request.catalog = v.into();
170            self
171        }
172
173        /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
174        ///
175        /// This is a **required** field for requests.
176        pub fn set_output_config<T>(mut self, v: T) -> Self
177        where
178            T: std::convert::Into<crate::model::OutputConfig>,
179        {
180            self.0.request.output_config = std::option::Option::Some(v.into());
181            self
182        }
183
184        /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
185        ///
186        /// This is a **required** field for requests.
187        pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
188        where
189            T: std::convert::Into<crate::model::OutputConfig>,
190        {
191            self.0.request.output_config = v.map(|x| x.into());
192            self
193        }
194
195        /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
196        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
197            self.0.request.filter = v.into();
198            self
199        }
200    }
201
202    #[doc(hidden)]
203    impl gax::options::internal::RequestBuilder for ExportAnalyticsMetrics {
204        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
205            &mut self.0.options
206        }
207    }
208
209    /// The request builder for [AnalyticsService::list_operations][crate::client::AnalyticsService::list_operations] calls.
210    ///
211    /// # Example
212    /// ```
213    /// # use google_cloud_retail_v2::builder::analytics_service::ListOperations;
214    /// # async fn sample() -> gax::Result<()> {
215    /// use gax::paginator::ItemPaginator;
216    ///
217    /// let builder = prepare_request_builder();
218    /// let mut items = builder.by_item();
219    /// while let Some(result) = items.next().await {
220    ///   let item = result?;
221    /// }
222    /// # Ok(()) }
223    ///
224    /// fn prepare_request_builder() -> ListOperations {
225    ///   # panic!();
226    ///   // ... details omitted ...
227    /// }
228    /// ```
229    #[derive(Clone, Debug)]
230    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
231
232    impl ListOperations {
233        pub(crate) fn new(
234            stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
235        ) -> Self {
236            Self(RequestBuilder::new(stub))
237        }
238
239        /// Sets the full request, replacing any prior values.
240        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
241            mut self,
242            v: V,
243        ) -> Self {
244            self.0.request = v.into();
245            self
246        }
247
248        /// Sets all the options, replacing any prior values.
249        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
250            self.0.options = v.into();
251            self
252        }
253
254        /// Sends the request.
255        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
256            (*self.0.stub)
257                .list_operations(self.0.request, self.0.options)
258                .await
259                .map(gax::response::Response::into_body)
260        }
261
262        /// Streams each page in the collection.
263        pub fn by_page(
264            self,
265        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
266        {
267            use std::clone::Clone;
268            let token = self.0.request.page_token.clone();
269            let execute = move |token: String| {
270                let mut builder = self.clone();
271                builder.0.request = builder.0.request.set_page_token(token);
272                builder.send()
273            };
274            gax::paginator::internal::new_paginator(token, execute)
275        }
276
277        /// Streams each item in the collection.
278        pub fn by_item(
279            self,
280        ) -> impl gax::paginator::ItemPaginator<
281            longrunning::model::ListOperationsResponse,
282            gax::error::Error,
283        > {
284            use gax::paginator::Paginator;
285            self.by_page().items()
286        }
287
288        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
289        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
290            self.0.request.name = v.into();
291            self
292        }
293
294        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
295        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
296            self.0.request.filter = v.into();
297            self
298        }
299
300        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
301        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
302            self.0.request.page_size = v.into();
303            self
304        }
305
306        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
307        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
308            self.0.request.page_token = v.into();
309            self
310        }
311
312        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
313        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
314            self.0.request.return_partial_success = v.into();
315            self
316        }
317    }
318
319    #[doc(hidden)]
320    impl gax::options::internal::RequestBuilder for ListOperations {
321        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
322            &mut self.0.options
323        }
324    }
325
326    /// The request builder for [AnalyticsService::get_operation][crate::client::AnalyticsService::get_operation] calls.
327    ///
328    /// # Example
329    /// ```
330    /// # use google_cloud_retail_v2::builder::analytics_service::GetOperation;
331    /// # async fn sample() -> gax::Result<()> {
332    ///
333    /// let builder = prepare_request_builder();
334    /// let response = builder.send().await?;
335    /// # Ok(()) }
336    ///
337    /// fn prepare_request_builder() -> GetOperation {
338    ///   # panic!();
339    ///   // ... details omitted ...
340    /// }
341    /// ```
342    #[derive(Clone, Debug)]
343    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
344
345    impl GetOperation {
346        pub(crate) fn new(
347            stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
348        ) -> Self {
349            Self(RequestBuilder::new(stub))
350        }
351
352        /// Sets the full request, replacing any prior values.
353        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
354            mut self,
355            v: V,
356        ) -> Self {
357            self.0.request = v.into();
358            self
359        }
360
361        /// Sets all the options, replacing any prior values.
362        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
363            self.0.options = v.into();
364            self
365        }
366
367        /// Sends the request.
368        pub async fn send(self) -> Result<longrunning::model::Operation> {
369            (*self.0.stub)
370                .get_operation(self.0.request, self.0.options)
371                .await
372                .map(gax::response::Response::into_body)
373        }
374
375        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
376        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
377            self.0.request.name = v.into();
378            self
379        }
380    }
381
382    #[doc(hidden)]
383    impl gax::options::internal::RequestBuilder for GetOperation {
384        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
385            &mut self.0.options
386        }
387    }
388}
389
390pub mod catalog_service {
391    use crate::Result;
392
393    /// A builder for [CatalogService][crate::client::CatalogService].
394    ///
395    /// ```
396    /// # async fn sample() -> gax::client_builder::Result<()> {
397    /// # use google_cloud_retail_v2::*;
398    /// # use builder::catalog_service::ClientBuilder;
399    /// # use client::CatalogService;
400    /// let builder : ClientBuilder = CatalogService::builder();
401    /// let client = builder
402    ///     .with_endpoint("https://retail.googleapis.com")
403    ///     .build().await?;
404    /// # Ok(()) }
405    /// ```
406    pub type ClientBuilder =
407        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
408
409    pub(crate) mod client {
410        use super::super::super::client::CatalogService;
411        pub struct Factory;
412        impl gax::client_builder::internal::ClientFactory for Factory {
413            type Client = CatalogService;
414            type Credentials = gaxi::options::Credentials;
415            async fn build(
416                self,
417                config: gaxi::options::ClientConfig,
418            ) -> gax::client_builder::Result<Self::Client> {
419                Self::Client::new(config).await
420            }
421        }
422    }
423
424    /// Common implementation for [crate::client::CatalogService] request builders.
425    #[derive(Clone, Debug)]
426    pub(crate) struct RequestBuilder<R: std::default::Default> {
427        stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
428        request: R,
429        options: gax::options::RequestOptions,
430    }
431
432    impl<R> RequestBuilder<R>
433    where
434        R: std::default::Default,
435    {
436        pub(crate) fn new(
437            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
438        ) -> Self {
439            Self {
440                stub,
441                request: R::default(),
442                options: gax::options::RequestOptions::default(),
443            }
444        }
445    }
446
447    /// The request builder for [CatalogService::list_catalogs][crate::client::CatalogService::list_catalogs] calls.
448    ///
449    /// # Example
450    /// ```
451    /// # use google_cloud_retail_v2::builder::catalog_service::ListCatalogs;
452    /// # async fn sample() -> gax::Result<()> {
453    /// use gax::paginator::ItemPaginator;
454    ///
455    /// let builder = prepare_request_builder();
456    /// let mut items = builder.by_item();
457    /// while let Some(result) = items.next().await {
458    ///   let item = result?;
459    /// }
460    /// # Ok(()) }
461    ///
462    /// fn prepare_request_builder() -> ListCatalogs {
463    ///   # panic!();
464    ///   // ... details omitted ...
465    /// }
466    /// ```
467    #[derive(Clone, Debug)]
468    pub struct ListCatalogs(RequestBuilder<crate::model::ListCatalogsRequest>);
469
470    impl ListCatalogs {
471        pub(crate) fn new(
472            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
473        ) -> Self {
474            Self(RequestBuilder::new(stub))
475        }
476
477        /// Sets the full request, replacing any prior values.
478        pub fn with_request<V: Into<crate::model::ListCatalogsRequest>>(mut self, v: V) -> Self {
479            self.0.request = v.into();
480            self
481        }
482
483        /// Sets all the options, replacing any prior values.
484        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
485            self.0.options = v.into();
486            self
487        }
488
489        /// Sends the request.
490        pub async fn send(self) -> Result<crate::model::ListCatalogsResponse> {
491            (*self.0.stub)
492                .list_catalogs(self.0.request, self.0.options)
493                .await
494                .map(gax::response::Response::into_body)
495        }
496
497        /// Streams each page in the collection.
498        pub fn by_page(
499            self,
500        ) -> impl gax::paginator::Paginator<crate::model::ListCatalogsResponse, gax::error::Error>
501        {
502            use std::clone::Clone;
503            let token = self.0.request.page_token.clone();
504            let execute = move |token: String| {
505                let mut builder = self.clone();
506                builder.0.request = builder.0.request.set_page_token(token);
507                builder.send()
508            };
509            gax::paginator::internal::new_paginator(token, execute)
510        }
511
512        /// Streams each item in the collection.
513        pub fn by_item(
514            self,
515        ) -> impl gax::paginator::ItemPaginator<crate::model::ListCatalogsResponse, gax::error::Error>
516        {
517            use gax::paginator::Paginator;
518            self.by_page().items()
519        }
520
521        /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
522        ///
523        /// This is a **required** field for requests.
524        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
525            self.0.request.parent = v.into();
526            self
527        }
528
529        /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
530        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
531            self.0.request.page_size = v.into();
532            self
533        }
534
535        /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
536        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
537            self.0.request.page_token = v.into();
538            self
539        }
540    }
541
542    #[doc(hidden)]
543    impl gax::options::internal::RequestBuilder for ListCatalogs {
544        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
545            &mut self.0.options
546        }
547    }
548
549    /// The request builder for [CatalogService::update_catalog][crate::client::CatalogService::update_catalog] calls.
550    ///
551    /// # Example
552    /// ```
553    /// # use google_cloud_retail_v2::builder::catalog_service::UpdateCatalog;
554    /// # async fn sample() -> gax::Result<()> {
555    ///
556    /// let builder = prepare_request_builder();
557    /// let response = builder.send().await?;
558    /// # Ok(()) }
559    ///
560    /// fn prepare_request_builder() -> UpdateCatalog {
561    ///   # panic!();
562    ///   // ... details omitted ...
563    /// }
564    /// ```
565    #[derive(Clone, Debug)]
566    pub struct UpdateCatalog(RequestBuilder<crate::model::UpdateCatalogRequest>);
567
568    impl UpdateCatalog {
569        pub(crate) fn new(
570            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
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::UpdateCatalogRequest>>(mut self, v: V) -> Self {
577            self.0.request = v.into();
578            self
579        }
580
581        /// Sets all the options, replacing any prior values.
582        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
583            self.0.options = v.into();
584            self
585        }
586
587        /// Sends the request.
588        pub async fn send(self) -> Result<crate::model::Catalog> {
589            (*self.0.stub)
590                .update_catalog(self.0.request, self.0.options)
591                .await
592                .map(gax::response::Response::into_body)
593        }
594
595        /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
596        ///
597        /// This is a **required** field for requests.
598        pub fn set_catalog<T>(mut self, v: T) -> Self
599        where
600            T: std::convert::Into<crate::model::Catalog>,
601        {
602            self.0.request.catalog = std::option::Option::Some(v.into());
603            self
604        }
605
606        /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
607        ///
608        /// This is a **required** field for requests.
609        pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
610        where
611            T: std::convert::Into<crate::model::Catalog>,
612        {
613            self.0.request.catalog = v.map(|x| x.into());
614            self
615        }
616
617        /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
618        pub fn set_update_mask<T>(mut self, v: T) -> Self
619        where
620            T: std::convert::Into<wkt::FieldMask>,
621        {
622            self.0.request.update_mask = std::option::Option::Some(v.into());
623            self
624        }
625
626        /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
627        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
628        where
629            T: std::convert::Into<wkt::FieldMask>,
630        {
631            self.0.request.update_mask = v.map(|x| x.into());
632            self
633        }
634    }
635
636    #[doc(hidden)]
637    impl gax::options::internal::RequestBuilder for UpdateCatalog {
638        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
639            &mut self.0.options
640        }
641    }
642
643    /// The request builder for [CatalogService::set_default_branch][crate::client::CatalogService::set_default_branch] calls.
644    ///
645    /// # Example
646    /// ```
647    /// # use google_cloud_retail_v2::builder::catalog_service::SetDefaultBranch;
648    /// # async fn sample() -> gax::Result<()> {
649    ///
650    /// let builder = prepare_request_builder();
651    /// let response = builder.send().await?;
652    /// # Ok(()) }
653    ///
654    /// fn prepare_request_builder() -> SetDefaultBranch {
655    ///   # panic!();
656    ///   // ... details omitted ...
657    /// }
658    /// ```
659    #[derive(Clone, Debug)]
660    pub struct SetDefaultBranch(RequestBuilder<crate::model::SetDefaultBranchRequest>);
661
662    impl SetDefaultBranch {
663        pub(crate) fn new(
664            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
665        ) -> Self {
666            Self(RequestBuilder::new(stub))
667        }
668
669        /// Sets the full request, replacing any prior values.
670        pub fn with_request<V: Into<crate::model::SetDefaultBranchRequest>>(
671            mut self,
672            v: V,
673        ) -> Self {
674            self.0.request = v.into();
675            self
676        }
677
678        /// Sets all the options, replacing any prior values.
679        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
680            self.0.options = v.into();
681            self
682        }
683
684        /// Sends the request.
685        pub async fn send(self) -> Result<()> {
686            (*self.0.stub)
687                .set_default_branch(self.0.request, self.0.options)
688                .await
689                .map(gax::response::Response::into_body)
690        }
691
692        /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
693        pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
694            self.0.request.catalog = v.into();
695            self
696        }
697
698        /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
699        pub fn set_branch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
700            self.0.request.branch_id = v.into();
701            self
702        }
703
704        /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
705        pub fn set_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
706            self.0.request.note = v.into();
707            self
708        }
709
710        /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
711        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
712            self.0.request.force = v.into();
713            self
714        }
715    }
716
717    #[doc(hidden)]
718    impl gax::options::internal::RequestBuilder for SetDefaultBranch {
719        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
720            &mut self.0.options
721        }
722    }
723
724    /// The request builder for [CatalogService::get_default_branch][crate::client::CatalogService::get_default_branch] calls.
725    ///
726    /// # Example
727    /// ```
728    /// # use google_cloud_retail_v2::builder::catalog_service::GetDefaultBranch;
729    /// # async fn sample() -> gax::Result<()> {
730    ///
731    /// let builder = prepare_request_builder();
732    /// let response = builder.send().await?;
733    /// # Ok(()) }
734    ///
735    /// fn prepare_request_builder() -> GetDefaultBranch {
736    ///   # panic!();
737    ///   // ... details omitted ...
738    /// }
739    /// ```
740    #[derive(Clone, Debug)]
741    pub struct GetDefaultBranch(RequestBuilder<crate::model::GetDefaultBranchRequest>);
742
743    impl GetDefaultBranch {
744        pub(crate) fn new(
745            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
746        ) -> Self {
747            Self(RequestBuilder::new(stub))
748        }
749
750        /// Sets the full request, replacing any prior values.
751        pub fn with_request<V: Into<crate::model::GetDefaultBranchRequest>>(
752            mut self,
753            v: V,
754        ) -> Self {
755            self.0.request = v.into();
756            self
757        }
758
759        /// Sets all the options, replacing any prior values.
760        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
761            self.0.options = v.into();
762            self
763        }
764
765        /// Sends the request.
766        pub async fn send(self) -> Result<crate::model::GetDefaultBranchResponse> {
767            (*self.0.stub)
768                .get_default_branch(self.0.request, self.0.options)
769                .await
770                .map(gax::response::Response::into_body)
771        }
772
773        /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
774        pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
775            self.0.request.catalog = v.into();
776            self
777        }
778    }
779
780    #[doc(hidden)]
781    impl gax::options::internal::RequestBuilder for GetDefaultBranch {
782        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
783            &mut self.0.options
784        }
785    }
786
787    /// The request builder for [CatalogService::get_completion_config][crate::client::CatalogService::get_completion_config] calls.
788    ///
789    /// # Example
790    /// ```
791    /// # use google_cloud_retail_v2::builder::catalog_service::GetCompletionConfig;
792    /// # async fn sample() -> gax::Result<()> {
793    ///
794    /// let builder = prepare_request_builder();
795    /// let response = builder.send().await?;
796    /// # Ok(()) }
797    ///
798    /// fn prepare_request_builder() -> GetCompletionConfig {
799    ///   # panic!();
800    ///   // ... details omitted ...
801    /// }
802    /// ```
803    #[derive(Clone, Debug)]
804    pub struct GetCompletionConfig(RequestBuilder<crate::model::GetCompletionConfigRequest>);
805
806    impl GetCompletionConfig {
807        pub(crate) fn new(
808            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
809        ) -> Self {
810            Self(RequestBuilder::new(stub))
811        }
812
813        /// Sets the full request, replacing any prior values.
814        pub fn with_request<V: Into<crate::model::GetCompletionConfigRequest>>(
815            mut self,
816            v: V,
817        ) -> Self {
818            self.0.request = v.into();
819            self
820        }
821
822        /// Sets all the options, replacing any prior values.
823        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
824            self.0.options = v.into();
825            self
826        }
827
828        /// Sends the request.
829        pub async fn send(self) -> Result<crate::model::CompletionConfig> {
830            (*self.0.stub)
831                .get_completion_config(self.0.request, self.0.options)
832                .await
833                .map(gax::response::Response::into_body)
834        }
835
836        /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
837        ///
838        /// This is a **required** field for requests.
839        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
840            self.0.request.name = v.into();
841            self
842        }
843    }
844
845    #[doc(hidden)]
846    impl gax::options::internal::RequestBuilder for GetCompletionConfig {
847        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
848            &mut self.0.options
849        }
850    }
851
852    /// The request builder for [CatalogService::update_completion_config][crate::client::CatalogService::update_completion_config] calls.
853    ///
854    /// # Example
855    /// ```
856    /// # use google_cloud_retail_v2::builder::catalog_service::UpdateCompletionConfig;
857    /// # async fn sample() -> gax::Result<()> {
858    ///
859    /// let builder = prepare_request_builder();
860    /// let response = builder.send().await?;
861    /// # Ok(()) }
862    ///
863    /// fn prepare_request_builder() -> UpdateCompletionConfig {
864    ///   # panic!();
865    ///   // ... details omitted ...
866    /// }
867    /// ```
868    #[derive(Clone, Debug)]
869    pub struct UpdateCompletionConfig(RequestBuilder<crate::model::UpdateCompletionConfigRequest>);
870
871    impl UpdateCompletionConfig {
872        pub(crate) fn new(
873            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
874        ) -> Self {
875            Self(RequestBuilder::new(stub))
876        }
877
878        /// Sets the full request, replacing any prior values.
879        pub fn with_request<V: Into<crate::model::UpdateCompletionConfigRequest>>(
880            mut self,
881            v: V,
882        ) -> Self {
883            self.0.request = v.into();
884            self
885        }
886
887        /// Sets all the options, replacing any prior values.
888        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
889            self.0.options = v.into();
890            self
891        }
892
893        /// Sends the request.
894        pub async fn send(self) -> Result<crate::model::CompletionConfig> {
895            (*self.0.stub)
896                .update_completion_config(self.0.request, self.0.options)
897                .await
898                .map(gax::response::Response::into_body)
899        }
900
901        /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
902        ///
903        /// This is a **required** field for requests.
904        pub fn set_completion_config<T>(mut self, v: T) -> Self
905        where
906            T: std::convert::Into<crate::model::CompletionConfig>,
907        {
908            self.0.request.completion_config = std::option::Option::Some(v.into());
909            self
910        }
911
912        /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
913        ///
914        /// This is a **required** field for requests.
915        pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
916        where
917            T: std::convert::Into<crate::model::CompletionConfig>,
918        {
919            self.0.request.completion_config = v.map(|x| x.into());
920            self
921        }
922
923        /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
924        pub fn set_update_mask<T>(mut self, v: T) -> Self
925        where
926            T: std::convert::Into<wkt::FieldMask>,
927        {
928            self.0.request.update_mask = std::option::Option::Some(v.into());
929            self
930        }
931
932        /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
933        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
934        where
935            T: std::convert::Into<wkt::FieldMask>,
936        {
937            self.0.request.update_mask = v.map(|x| x.into());
938            self
939        }
940    }
941
942    #[doc(hidden)]
943    impl gax::options::internal::RequestBuilder for UpdateCompletionConfig {
944        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
945            &mut self.0.options
946        }
947    }
948
949    /// The request builder for [CatalogService::get_attributes_config][crate::client::CatalogService::get_attributes_config] calls.
950    ///
951    /// # Example
952    /// ```
953    /// # use google_cloud_retail_v2::builder::catalog_service::GetAttributesConfig;
954    /// # async fn sample() -> gax::Result<()> {
955    ///
956    /// let builder = prepare_request_builder();
957    /// let response = builder.send().await?;
958    /// # Ok(()) }
959    ///
960    /// fn prepare_request_builder() -> GetAttributesConfig {
961    ///   # panic!();
962    ///   // ... details omitted ...
963    /// }
964    /// ```
965    #[derive(Clone, Debug)]
966    pub struct GetAttributesConfig(RequestBuilder<crate::model::GetAttributesConfigRequest>);
967
968    impl GetAttributesConfig {
969        pub(crate) fn new(
970            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
971        ) -> Self {
972            Self(RequestBuilder::new(stub))
973        }
974
975        /// Sets the full request, replacing any prior values.
976        pub fn with_request<V: Into<crate::model::GetAttributesConfigRequest>>(
977            mut self,
978            v: V,
979        ) -> Self {
980            self.0.request = v.into();
981            self
982        }
983
984        /// Sets all the options, replacing any prior values.
985        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
986            self.0.options = v.into();
987            self
988        }
989
990        /// Sends the request.
991        pub async fn send(self) -> Result<crate::model::AttributesConfig> {
992            (*self.0.stub)
993                .get_attributes_config(self.0.request, self.0.options)
994                .await
995                .map(gax::response::Response::into_body)
996        }
997
998        /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
999        ///
1000        /// This is a **required** field for requests.
1001        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1002            self.0.request.name = v.into();
1003            self
1004        }
1005    }
1006
1007    #[doc(hidden)]
1008    impl gax::options::internal::RequestBuilder for GetAttributesConfig {
1009        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1010            &mut self.0.options
1011        }
1012    }
1013
1014    /// The request builder for [CatalogService::update_attributes_config][crate::client::CatalogService::update_attributes_config] calls.
1015    ///
1016    /// # Example
1017    /// ```
1018    /// # use google_cloud_retail_v2::builder::catalog_service::UpdateAttributesConfig;
1019    /// # async fn sample() -> gax::Result<()> {
1020    ///
1021    /// let builder = prepare_request_builder();
1022    /// let response = builder.send().await?;
1023    /// # Ok(()) }
1024    ///
1025    /// fn prepare_request_builder() -> UpdateAttributesConfig {
1026    ///   # panic!();
1027    ///   // ... details omitted ...
1028    /// }
1029    /// ```
1030    #[derive(Clone, Debug)]
1031    pub struct UpdateAttributesConfig(RequestBuilder<crate::model::UpdateAttributesConfigRequest>);
1032
1033    impl UpdateAttributesConfig {
1034        pub(crate) fn new(
1035            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1036        ) -> Self {
1037            Self(RequestBuilder::new(stub))
1038        }
1039
1040        /// Sets the full request, replacing any prior values.
1041        pub fn with_request<V: Into<crate::model::UpdateAttributesConfigRequest>>(
1042            mut self,
1043            v: V,
1044        ) -> Self {
1045            self.0.request = v.into();
1046            self
1047        }
1048
1049        /// Sets all the options, replacing any prior values.
1050        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1051            self.0.options = v.into();
1052            self
1053        }
1054
1055        /// Sends the request.
1056        pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1057            (*self.0.stub)
1058                .update_attributes_config(self.0.request, self.0.options)
1059                .await
1060                .map(gax::response::Response::into_body)
1061        }
1062
1063        /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
1064        ///
1065        /// This is a **required** field for requests.
1066        pub fn set_attributes_config<T>(mut self, v: T) -> Self
1067        where
1068            T: std::convert::Into<crate::model::AttributesConfig>,
1069        {
1070            self.0.request.attributes_config = std::option::Option::Some(v.into());
1071            self
1072        }
1073
1074        /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
1075        ///
1076        /// This is a **required** field for requests.
1077        pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
1078        where
1079            T: std::convert::Into<crate::model::AttributesConfig>,
1080        {
1081            self.0.request.attributes_config = v.map(|x| x.into());
1082            self
1083        }
1084
1085        /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
1086        pub fn set_update_mask<T>(mut self, v: T) -> Self
1087        where
1088            T: std::convert::Into<wkt::FieldMask>,
1089        {
1090            self.0.request.update_mask = std::option::Option::Some(v.into());
1091            self
1092        }
1093
1094        /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
1095        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1096        where
1097            T: std::convert::Into<wkt::FieldMask>,
1098        {
1099            self.0.request.update_mask = v.map(|x| x.into());
1100            self
1101        }
1102    }
1103
1104    #[doc(hidden)]
1105    impl gax::options::internal::RequestBuilder for UpdateAttributesConfig {
1106        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1107            &mut self.0.options
1108        }
1109    }
1110
1111    /// The request builder for [CatalogService::add_catalog_attribute][crate::client::CatalogService::add_catalog_attribute] calls.
1112    ///
1113    /// # Example
1114    /// ```
1115    /// # use google_cloud_retail_v2::builder::catalog_service::AddCatalogAttribute;
1116    /// # async fn sample() -> gax::Result<()> {
1117    ///
1118    /// let builder = prepare_request_builder();
1119    /// let response = builder.send().await?;
1120    /// # Ok(()) }
1121    ///
1122    /// fn prepare_request_builder() -> AddCatalogAttribute {
1123    ///   # panic!();
1124    ///   // ... details omitted ...
1125    /// }
1126    /// ```
1127    #[derive(Clone, Debug)]
1128    pub struct AddCatalogAttribute(RequestBuilder<crate::model::AddCatalogAttributeRequest>);
1129
1130    impl AddCatalogAttribute {
1131        pub(crate) fn new(
1132            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1133        ) -> Self {
1134            Self(RequestBuilder::new(stub))
1135        }
1136
1137        /// Sets the full request, replacing any prior values.
1138        pub fn with_request<V: Into<crate::model::AddCatalogAttributeRequest>>(
1139            mut self,
1140            v: V,
1141        ) -> Self {
1142            self.0.request = v.into();
1143            self
1144        }
1145
1146        /// Sets all the options, replacing any prior values.
1147        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1148            self.0.options = v.into();
1149            self
1150        }
1151
1152        /// Sends the request.
1153        pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1154            (*self.0.stub)
1155                .add_catalog_attribute(self.0.request, self.0.options)
1156                .await
1157                .map(gax::response::Response::into_body)
1158        }
1159
1160        /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
1161        ///
1162        /// This is a **required** field for requests.
1163        pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1164            self.0.request.attributes_config = v.into();
1165            self
1166        }
1167
1168        /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
1169        ///
1170        /// This is a **required** field for requests.
1171        pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1172        where
1173            T: std::convert::Into<crate::model::CatalogAttribute>,
1174        {
1175            self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1176            self
1177        }
1178
1179        /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
1180        ///
1181        /// This is a **required** field for requests.
1182        pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1183        where
1184            T: std::convert::Into<crate::model::CatalogAttribute>,
1185        {
1186            self.0.request.catalog_attribute = v.map(|x| x.into());
1187            self
1188        }
1189    }
1190
1191    #[doc(hidden)]
1192    impl gax::options::internal::RequestBuilder for AddCatalogAttribute {
1193        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1194            &mut self.0.options
1195        }
1196    }
1197
1198    /// The request builder for [CatalogService::remove_catalog_attribute][crate::client::CatalogService::remove_catalog_attribute] calls.
1199    ///
1200    /// # Example
1201    /// ```
1202    /// # use google_cloud_retail_v2::builder::catalog_service::RemoveCatalogAttribute;
1203    /// # async fn sample() -> gax::Result<()> {
1204    ///
1205    /// let builder = prepare_request_builder();
1206    /// let response = builder.send().await?;
1207    /// # Ok(()) }
1208    ///
1209    /// fn prepare_request_builder() -> RemoveCatalogAttribute {
1210    ///   # panic!();
1211    ///   // ... details omitted ...
1212    /// }
1213    /// ```
1214    #[derive(Clone, Debug)]
1215    pub struct RemoveCatalogAttribute(RequestBuilder<crate::model::RemoveCatalogAttributeRequest>);
1216
1217    impl RemoveCatalogAttribute {
1218        pub(crate) fn new(
1219            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1220        ) -> Self {
1221            Self(RequestBuilder::new(stub))
1222        }
1223
1224        /// Sets the full request, replacing any prior values.
1225        pub fn with_request<V: Into<crate::model::RemoveCatalogAttributeRequest>>(
1226            mut self,
1227            v: V,
1228        ) -> Self {
1229            self.0.request = v.into();
1230            self
1231        }
1232
1233        /// Sets all the options, replacing any prior values.
1234        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1235            self.0.options = v.into();
1236            self
1237        }
1238
1239        /// Sends the request.
1240        pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1241            (*self.0.stub)
1242                .remove_catalog_attribute(self.0.request, self.0.options)
1243                .await
1244                .map(gax::response::Response::into_body)
1245        }
1246
1247        /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
1248        ///
1249        /// This is a **required** field for requests.
1250        pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1251            self.0.request.attributes_config = v.into();
1252            self
1253        }
1254
1255        /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
1256        ///
1257        /// This is a **required** field for requests.
1258        pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
1259            self.0.request.key = v.into();
1260            self
1261        }
1262    }
1263
1264    #[doc(hidden)]
1265    impl gax::options::internal::RequestBuilder for RemoveCatalogAttribute {
1266        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1267            &mut self.0.options
1268        }
1269    }
1270
1271    /// The request builder for [CatalogService::replace_catalog_attribute][crate::client::CatalogService::replace_catalog_attribute] calls.
1272    ///
1273    /// # Example
1274    /// ```
1275    /// # use google_cloud_retail_v2::builder::catalog_service::ReplaceCatalogAttribute;
1276    /// # async fn sample() -> gax::Result<()> {
1277    ///
1278    /// let builder = prepare_request_builder();
1279    /// let response = builder.send().await?;
1280    /// # Ok(()) }
1281    ///
1282    /// fn prepare_request_builder() -> ReplaceCatalogAttribute {
1283    ///   # panic!();
1284    ///   // ... details omitted ...
1285    /// }
1286    /// ```
1287    #[derive(Clone, Debug)]
1288    pub struct ReplaceCatalogAttribute(
1289        RequestBuilder<crate::model::ReplaceCatalogAttributeRequest>,
1290    );
1291
1292    impl ReplaceCatalogAttribute {
1293        pub(crate) fn new(
1294            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1295        ) -> Self {
1296            Self(RequestBuilder::new(stub))
1297        }
1298
1299        /// Sets the full request, replacing any prior values.
1300        pub fn with_request<V: Into<crate::model::ReplaceCatalogAttributeRequest>>(
1301            mut self,
1302            v: V,
1303        ) -> Self {
1304            self.0.request = v.into();
1305            self
1306        }
1307
1308        /// Sets all the options, replacing any prior values.
1309        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1310            self.0.options = v.into();
1311            self
1312        }
1313
1314        /// Sends the request.
1315        pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1316            (*self.0.stub)
1317                .replace_catalog_attribute(self.0.request, self.0.options)
1318                .await
1319                .map(gax::response::Response::into_body)
1320        }
1321
1322        /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
1323        ///
1324        /// This is a **required** field for requests.
1325        pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1326            self.0.request.attributes_config = v.into();
1327            self
1328        }
1329
1330        /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
1331        ///
1332        /// This is a **required** field for requests.
1333        pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1334        where
1335            T: std::convert::Into<crate::model::CatalogAttribute>,
1336        {
1337            self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1338            self
1339        }
1340
1341        /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
1342        ///
1343        /// This is a **required** field for requests.
1344        pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1345        where
1346            T: std::convert::Into<crate::model::CatalogAttribute>,
1347        {
1348            self.0.request.catalog_attribute = v.map(|x| x.into());
1349            self
1350        }
1351
1352        /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
1353        pub fn set_update_mask<T>(mut self, v: T) -> Self
1354        where
1355            T: std::convert::Into<wkt::FieldMask>,
1356        {
1357            self.0.request.update_mask = std::option::Option::Some(v.into());
1358            self
1359        }
1360
1361        /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
1362        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1363        where
1364            T: std::convert::Into<wkt::FieldMask>,
1365        {
1366            self.0.request.update_mask = v.map(|x| x.into());
1367            self
1368        }
1369    }
1370
1371    #[doc(hidden)]
1372    impl gax::options::internal::RequestBuilder for ReplaceCatalogAttribute {
1373        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1374            &mut self.0.options
1375        }
1376    }
1377
1378    /// The request builder for [CatalogService::list_operations][crate::client::CatalogService::list_operations] calls.
1379    ///
1380    /// # Example
1381    /// ```
1382    /// # use google_cloud_retail_v2::builder::catalog_service::ListOperations;
1383    /// # async fn sample() -> gax::Result<()> {
1384    /// use gax::paginator::ItemPaginator;
1385    ///
1386    /// let builder = prepare_request_builder();
1387    /// let mut items = builder.by_item();
1388    /// while let Some(result) = items.next().await {
1389    ///   let item = result?;
1390    /// }
1391    /// # Ok(()) }
1392    ///
1393    /// fn prepare_request_builder() -> ListOperations {
1394    ///   # panic!();
1395    ///   // ... details omitted ...
1396    /// }
1397    /// ```
1398    #[derive(Clone, Debug)]
1399    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1400
1401    impl ListOperations {
1402        pub(crate) fn new(
1403            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1404        ) -> Self {
1405            Self(RequestBuilder::new(stub))
1406        }
1407
1408        /// Sets the full request, replacing any prior values.
1409        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1410            mut self,
1411            v: V,
1412        ) -> Self {
1413            self.0.request = v.into();
1414            self
1415        }
1416
1417        /// Sets all the options, replacing any prior values.
1418        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1419            self.0.options = v.into();
1420            self
1421        }
1422
1423        /// Sends the request.
1424        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1425            (*self.0.stub)
1426                .list_operations(self.0.request, self.0.options)
1427                .await
1428                .map(gax::response::Response::into_body)
1429        }
1430
1431        /// Streams each page in the collection.
1432        pub fn by_page(
1433            self,
1434        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1435        {
1436            use std::clone::Clone;
1437            let token = self.0.request.page_token.clone();
1438            let execute = move |token: String| {
1439                let mut builder = self.clone();
1440                builder.0.request = builder.0.request.set_page_token(token);
1441                builder.send()
1442            };
1443            gax::paginator::internal::new_paginator(token, execute)
1444        }
1445
1446        /// Streams each item in the collection.
1447        pub fn by_item(
1448            self,
1449        ) -> impl gax::paginator::ItemPaginator<
1450            longrunning::model::ListOperationsResponse,
1451            gax::error::Error,
1452        > {
1453            use gax::paginator::Paginator;
1454            self.by_page().items()
1455        }
1456
1457        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1458        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1459            self.0.request.name = v.into();
1460            self
1461        }
1462
1463        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1464        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1465            self.0.request.filter = v.into();
1466            self
1467        }
1468
1469        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1470        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1471            self.0.request.page_size = v.into();
1472            self
1473        }
1474
1475        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1476        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1477            self.0.request.page_token = v.into();
1478            self
1479        }
1480
1481        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1482        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1483            self.0.request.return_partial_success = v.into();
1484            self
1485        }
1486    }
1487
1488    #[doc(hidden)]
1489    impl gax::options::internal::RequestBuilder for ListOperations {
1490        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1491            &mut self.0.options
1492        }
1493    }
1494
1495    /// The request builder for [CatalogService::get_operation][crate::client::CatalogService::get_operation] calls.
1496    ///
1497    /// # Example
1498    /// ```
1499    /// # use google_cloud_retail_v2::builder::catalog_service::GetOperation;
1500    /// # async fn sample() -> gax::Result<()> {
1501    ///
1502    /// let builder = prepare_request_builder();
1503    /// let response = builder.send().await?;
1504    /// # Ok(()) }
1505    ///
1506    /// fn prepare_request_builder() -> GetOperation {
1507    ///   # panic!();
1508    ///   // ... details omitted ...
1509    /// }
1510    /// ```
1511    #[derive(Clone, Debug)]
1512    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1513
1514    impl GetOperation {
1515        pub(crate) fn new(
1516            stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1517        ) -> Self {
1518            Self(RequestBuilder::new(stub))
1519        }
1520
1521        /// Sets the full request, replacing any prior values.
1522        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1523            mut self,
1524            v: V,
1525        ) -> Self {
1526            self.0.request = v.into();
1527            self
1528        }
1529
1530        /// Sets all the options, replacing any prior values.
1531        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1532            self.0.options = v.into();
1533            self
1534        }
1535
1536        /// Sends the request.
1537        pub async fn send(self) -> Result<longrunning::model::Operation> {
1538            (*self.0.stub)
1539                .get_operation(self.0.request, self.0.options)
1540                .await
1541                .map(gax::response::Response::into_body)
1542        }
1543
1544        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1545        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1546            self.0.request.name = v.into();
1547            self
1548        }
1549    }
1550
1551    #[doc(hidden)]
1552    impl gax::options::internal::RequestBuilder for GetOperation {
1553        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1554            &mut self.0.options
1555        }
1556    }
1557}
1558
1559pub mod completion_service {
1560    use crate::Result;
1561
1562    /// A builder for [CompletionService][crate::client::CompletionService].
1563    ///
1564    /// ```
1565    /// # async fn sample() -> gax::client_builder::Result<()> {
1566    /// # use google_cloud_retail_v2::*;
1567    /// # use builder::completion_service::ClientBuilder;
1568    /// # use client::CompletionService;
1569    /// let builder : ClientBuilder = CompletionService::builder();
1570    /// let client = builder
1571    ///     .with_endpoint("https://retail.googleapis.com")
1572    ///     .build().await?;
1573    /// # Ok(()) }
1574    /// ```
1575    pub type ClientBuilder =
1576        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1577
1578    pub(crate) mod client {
1579        use super::super::super::client::CompletionService;
1580        pub struct Factory;
1581        impl gax::client_builder::internal::ClientFactory for Factory {
1582            type Client = CompletionService;
1583            type Credentials = gaxi::options::Credentials;
1584            async fn build(
1585                self,
1586                config: gaxi::options::ClientConfig,
1587            ) -> gax::client_builder::Result<Self::Client> {
1588                Self::Client::new(config).await
1589            }
1590        }
1591    }
1592
1593    /// Common implementation for [crate::client::CompletionService] request builders.
1594    #[derive(Clone, Debug)]
1595    pub(crate) struct RequestBuilder<R: std::default::Default> {
1596        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1597        request: R,
1598        options: gax::options::RequestOptions,
1599    }
1600
1601    impl<R> RequestBuilder<R>
1602    where
1603        R: std::default::Default,
1604    {
1605        pub(crate) fn new(
1606            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1607        ) -> Self {
1608            Self {
1609                stub,
1610                request: R::default(),
1611                options: gax::options::RequestOptions::default(),
1612            }
1613        }
1614    }
1615
1616    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1617    ///
1618    /// # Example
1619    /// ```
1620    /// # use google_cloud_retail_v2::builder::completion_service::CompleteQuery;
1621    /// # async fn sample() -> gax::Result<()> {
1622    ///
1623    /// let builder = prepare_request_builder();
1624    /// let response = builder.send().await?;
1625    /// # Ok(()) }
1626    ///
1627    /// fn prepare_request_builder() -> CompleteQuery {
1628    ///   # panic!();
1629    ///   // ... details omitted ...
1630    /// }
1631    /// ```
1632    #[derive(Clone, Debug)]
1633    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1634
1635    impl CompleteQuery {
1636        pub(crate) fn new(
1637            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1638        ) -> Self {
1639            Self(RequestBuilder::new(stub))
1640        }
1641
1642        /// Sets the full request, replacing any prior values.
1643        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1644            self.0.request = v.into();
1645            self
1646        }
1647
1648        /// Sets all the options, replacing any prior values.
1649        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1650            self.0.options = v.into();
1651            self
1652        }
1653
1654        /// Sends the request.
1655        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1656            (*self.0.stub)
1657                .complete_query(self.0.request, self.0.options)
1658                .await
1659                .map(gax::response::Response::into_body)
1660        }
1661
1662        /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
1663        ///
1664        /// This is a **required** field for requests.
1665        pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
1666            self.0.request.catalog = v.into();
1667            self
1668        }
1669
1670        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1671        ///
1672        /// This is a **required** field for requests.
1673        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1674            self.0.request.query = v.into();
1675            self
1676        }
1677
1678        /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
1679        pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1680            self.0.request.visitor_id = v.into();
1681            self
1682        }
1683
1684        /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
1685        pub fn set_language_codes<T, V>(mut self, v: T) -> Self
1686        where
1687            T: std::iter::IntoIterator<Item = V>,
1688            V: std::convert::Into<std::string::String>,
1689        {
1690            use std::iter::Iterator;
1691            self.0.request.language_codes = v.into_iter().map(|i| i.into()).collect();
1692            self
1693        }
1694
1695        /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
1696        pub fn set_device_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
1697            self.0.request.device_type = v.into();
1698            self
1699        }
1700
1701        /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
1702        pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
1703            self.0.request.dataset = v.into();
1704            self
1705        }
1706
1707        /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
1708        pub fn set_max_suggestions<T: Into<i32>>(mut self, v: T) -> Self {
1709            self.0.request.max_suggestions = v.into();
1710            self
1711        }
1712
1713        /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
1714        pub fn set_enable_attribute_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1715            self.0.request.enable_attribute_suggestions = v.into();
1716            self
1717        }
1718
1719        /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
1720        pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
1721            self.0.request.entity = v.into();
1722            self
1723        }
1724    }
1725
1726    #[doc(hidden)]
1727    impl gax::options::internal::RequestBuilder for CompleteQuery {
1728        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1729            &mut self.0.options
1730        }
1731    }
1732
1733    /// The request builder for [CompletionService::import_completion_data][crate::client::CompletionService::import_completion_data] calls.
1734    ///
1735    /// # Example
1736    /// ```
1737    /// # use google_cloud_retail_v2::builder::completion_service::ImportCompletionData;
1738    /// # async fn sample() -> gax::Result<()> {
1739    /// use lro::Poller;
1740    ///
1741    /// let builder = prepare_request_builder();
1742    /// let response = builder.poller().until_done().await?;
1743    /// # Ok(()) }
1744    ///
1745    /// fn prepare_request_builder() -> ImportCompletionData {
1746    ///   # panic!();
1747    ///   // ... details omitted ...
1748    /// }
1749    /// ```
1750    #[derive(Clone, Debug)]
1751    pub struct ImportCompletionData(RequestBuilder<crate::model::ImportCompletionDataRequest>);
1752
1753    impl ImportCompletionData {
1754        pub(crate) fn new(
1755            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1756        ) -> Self {
1757            Self(RequestBuilder::new(stub))
1758        }
1759
1760        /// Sets the full request, replacing any prior values.
1761        pub fn with_request<V: Into<crate::model::ImportCompletionDataRequest>>(
1762            mut self,
1763            v: V,
1764        ) -> Self {
1765            self.0.request = v.into();
1766            self
1767        }
1768
1769        /// Sets all the options, replacing any prior values.
1770        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1771            self.0.options = v.into();
1772            self
1773        }
1774
1775        /// Sends the request.
1776        ///
1777        /// # Long running operations
1778        ///
1779        /// This starts, but does not poll, a longrunning operation. More information
1780        /// on [import_completion_data][crate::client::CompletionService::import_completion_data].
1781        pub async fn send(self) -> Result<longrunning::model::Operation> {
1782            (*self.0.stub)
1783                .import_completion_data(self.0.request, self.0.options)
1784                .await
1785                .map(gax::response::Response::into_body)
1786        }
1787
1788        /// Creates a [Poller][lro::Poller] to work with `import_completion_data`.
1789        pub fn poller(
1790            self,
1791        ) -> impl lro::Poller<crate::model::ImportCompletionDataResponse, crate::model::ImportMetadata>
1792        {
1793            type Operation = lro::internal::Operation<
1794                crate::model::ImportCompletionDataResponse,
1795                crate::model::ImportMetadata,
1796            >;
1797            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1798            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1799
1800            let stub = self.0.stub.clone();
1801            let mut options = self.0.options.clone();
1802            options.set_retry_policy(gax::retry_policy::NeverRetry);
1803            let query = move |name| {
1804                let stub = stub.clone();
1805                let options = options.clone();
1806                async {
1807                    let op = GetOperation::new(stub)
1808                        .set_name(name)
1809                        .with_options(options)
1810                        .send()
1811                        .await?;
1812                    Ok(Operation::new(op))
1813                }
1814            };
1815
1816            let start = move || async {
1817                let op = self.send().await?;
1818                Ok(Operation::new(op))
1819            };
1820
1821            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1822        }
1823
1824        /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
1825        ///
1826        /// This is a **required** field for requests.
1827        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1828            self.0.request.parent = v.into();
1829            self
1830        }
1831
1832        /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
1833        ///
1834        /// This is a **required** field for requests.
1835        pub fn set_input_config<T>(mut self, v: T) -> Self
1836        where
1837            T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1838        {
1839            self.0.request.input_config = std::option::Option::Some(v.into());
1840            self
1841        }
1842
1843        /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
1844        ///
1845        /// This is a **required** field for requests.
1846        pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
1847        where
1848            T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1849        {
1850            self.0.request.input_config = v.map(|x| x.into());
1851            self
1852        }
1853
1854        /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
1855        pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
1856            self.0.request.notification_pubsub_topic = v.into();
1857            self
1858        }
1859    }
1860
1861    #[doc(hidden)]
1862    impl gax::options::internal::RequestBuilder for ImportCompletionData {
1863        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1864            &mut self.0.options
1865        }
1866    }
1867
1868    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1869    ///
1870    /// # Example
1871    /// ```
1872    /// # use google_cloud_retail_v2::builder::completion_service::ListOperations;
1873    /// # async fn sample() -> gax::Result<()> {
1874    /// use gax::paginator::ItemPaginator;
1875    ///
1876    /// let builder = prepare_request_builder();
1877    /// let mut items = builder.by_item();
1878    /// while let Some(result) = items.next().await {
1879    ///   let item = result?;
1880    /// }
1881    /// # Ok(()) }
1882    ///
1883    /// fn prepare_request_builder() -> ListOperations {
1884    ///   # panic!();
1885    ///   // ... details omitted ...
1886    /// }
1887    /// ```
1888    #[derive(Clone, Debug)]
1889    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1890
1891    impl ListOperations {
1892        pub(crate) fn new(
1893            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1894        ) -> Self {
1895            Self(RequestBuilder::new(stub))
1896        }
1897
1898        /// Sets the full request, replacing any prior values.
1899        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1900            mut self,
1901            v: V,
1902        ) -> Self {
1903            self.0.request = v.into();
1904            self
1905        }
1906
1907        /// Sets all the options, replacing any prior values.
1908        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1909            self.0.options = v.into();
1910            self
1911        }
1912
1913        /// Sends the request.
1914        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1915            (*self.0.stub)
1916                .list_operations(self.0.request, self.0.options)
1917                .await
1918                .map(gax::response::Response::into_body)
1919        }
1920
1921        /// Streams each page in the collection.
1922        pub fn by_page(
1923            self,
1924        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1925        {
1926            use std::clone::Clone;
1927            let token = self.0.request.page_token.clone();
1928            let execute = move |token: String| {
1929                let mut builder = self.clone();
1930                builder.0.request = builder.0.request.set_page_token(token);
1931                builder.send()
1932            };
1933            gax::paginator::internal::new_paginator(token, execute)
1934        }
1935
1936        /// Streams each item in the collection.
1937        pub fn by_item(
1938            self,
1939        ) -> impl gax::paginator::ItemPaginator<
1940            longrunning::model::ListOperationsResponse,
1941            gax::error::Error,
1942        > {
1943            use gax::paginator::Paginator;
1944            self.by_page().items()
1945        }
1946
1947        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1949            self.0.request.name = v.into();
1950            self
1951        }
1952
1953        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1954        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1955            self.0.request.filter = v.into();
1956            self
1957        }
1958
1959        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1960        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1961            self.0.request.page_size = v.into();
1962            self
1963        }
1964
1965        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1966        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1967            self.0.request.page_token = v.into();
1968            self
1969        }
1970
1971        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1972        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1973            self.0.request.return_partial_success = v.into();
1974            self
1975        }
1976    }
1977
1978    #[doc(hidden)]
1979    impl gax::options::internal::RequestBuilder for ListOperations {
1980        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1981            &mut self.0.options
1982        }
1983    }
1984
1985    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1986    ///
1987    /// # Example
1988    /// ```
1989    /// # use google_cloud_retail_v2::builder::completion_service::GetOperation;
1990    /// # async fn sample() -> gax::Result<()> {
1991    ///
1992    /// let builder = prepare_request_builder();
1993    /// let response = builder.send().await?;
1994    /// # Ok(()) }
1995    ///
1996    /// fn prepare_request_builder() -> GetOperation {
1997    ///   # panic!();
1998    ///   // ... details omitted ...
1999    /// }
2000    /// ```
2001    #[derive(Clone, Debug)]
2002    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2003
2004    impl GetOperation {
2005        pub(crate) fn new(
2006            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2007        ) -> Self {
2008            Self(RequestBuilder::new(stub))
2009        }
2010
2011        /// Sets the full request, replacing any prior values.
2012        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2013            mut self,
2014            v: V,
2015        ) -> Self {
2016            self.0.request = v.into();
2017            self
2018        }
2019
2020        /// Sets all the options, replacing any prior values.
2021        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2022            self.0.options = v.into();
2023            self
2024        }
2025
2026        /// Sends the request.
2027        pub async fn send(self) -> Result<longrunning::model::Operation> {
2028            (*self.0.stub)
2029                .get_operation(self.0.request, self.0.options)
2030                .await
2031                .map(gax::response::Response::into_body)
2032        }
2033
2034        /// Sets the value of [name][longrunning::model::GetOperationRequest::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
2041    #[doc(hidden)]
2042    impl gax::options::internal::RequestBuilder for GetOperation {
2043        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2044            &mut self.0.options
2045        }
2046    }
2047}
2048
2049pub mod control_service {
2050    use crate::Result;
2051
2052    /// A builder for [ControlService][crate::client::ControlService].
2053    ///
2054    /// ```
2055    /// # async fn sample() -> gax::client_builder::Result<()> {
2056    /// # use google_cloud_retail_v2::*;
2057    /// # use builder::control_service::ClientBuilder;
2058    /// # use client::ControlService;
2059    /// let builder : ClientBuilder = ControlService::builder();
2060    /// let client = builder
2061    ///     .with_endpoint("https://retail.googleapis.com")
2062    ///     .build().await?;
2063    /// # Ok(()) }
2064    /// ```
2065    pub type ClientBuilder =
2066        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2067
2068    pub(crate) mod client {
2069        use super::super::super::client::ControlService;
2070        pub struct Factory;
2071        impl gax::client_builder::internal::ClientFactory for Factory {
2072            type Client = ControlService;
2073            type Credentials = gaxi::options::Credentials;
2074            async fn build(
2075                self,
2076                config: gaxi::options::ClientConfig,
2077            ) -> gax::client_builder::Result<Self::Client> {
2078                Self::Client::new(config).await
2079            }
2080        }
2081    }
2082
2083    /// Common implementation for [crate::client::ControlService] request builders.
2084    #[derive(Clone, Debug)]
2085    pub(crate) struct RequestBuilder<R: std::default::Default> {
2086        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2087        request: R,
2088        options: gax::options::RequestOptions,
2089    }
2090
2091    impl<R> RequestBuilder<R>
2092    where
2093        R: std::default::Default,
2094    {
2095        pub(crate) fn new(
2096            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2097        ) -> Self {
2098            Self {
2099                stub,
2100                request: R::default(),
2101                options: gax::options::RequestOptions::default(),
2102            }
2103        }
2104    }
2105
2106    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2107    ///
2108    /// # Example
2109    /// ```
2110    /// # use google_cloud_retail_v2::builder::control_service::CreateControl;
2111    /// # async fn sample() -> gax::Result<()> {
2112    ///
2113    /// let builder = prepare_request_builder();
2114    /// let response = builder.send().await?;
2115    /// # Ok(()) }
2116    ///
2117    /// fn prepare_request_builder() -> CreateControl {
2118    ///   # panic!();
2119    ///   // ... details omitted ...
2120    /// }
2121    /// ```
2122    #[derive(Clone, Debug)]
2123    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2124
2125    impl CreateControl {
2126        pub(crate) fn new(
2127            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2128        ) -> Self {
2129            Self(RequestBuilder::new(stub))
2130        }
2131
2132        /// Sets the full request, replacing any prior values.
2133        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2134            self.0.request = v.into();
2135            self
2136        }
2137
2138        /// Sets all the options, replacing any prior values.
2139        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2140            self.0.options = v.into();
2141            self
2142        }
2143
2144        /// Sends the request.
2145        pub async fn send(self) -> Result<crate::model::Control> {
2146            (*self.0.stub)
2147                .create_control(self.0.request, self.0.options)
2148                .await
2149                .map(gax::response::Response::into_body)
2150        }
2151
2152        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2153        ///
2154        /// This is a **required** field for requests.
2155        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2156            self.0.request.parent = v.into();
2157            self
2158        }
2159
2160        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2161        ///
2162        /// This is a **required** field for requests.
2163        pub fn set_control<T>(mut self, v: T) -> Self
2164        where
2165            T: std::convert::Into<crate::model::Control>,
2166        {
2167            self.0.request.control = std::option::Option::Some(v.into());
2168            self
2169        }
2170
2171        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2172        ///
2173        /// This is a **required** field for requests.
2174        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2175        where
2176            T: std::convert::Into<crate::model::Control>,
2177        {
2178            self.0.request.control = v.map(|x| x.into());
2179            self
2180        }
2181
2182        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2183        ///
2184        /// This is a **required** field for requests.
2185        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2186            self.0.request.control_id = v.into();
2187            self
2188        }
2189    }
2190
2191    #[doc(hidden)]
2192    impl gax::options::internal::RequestBuilder for CreateControl {
2193        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2194            &mut self.0.options
2195        }
2196    }
2197
2198    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2199    ///
2200    /// # Example
2201    /// ```
2202    /// # use google_cloud_retail_v2::builder::control_service::DeleteControl;
2203    /// # async fn sample() -> gax::Result<()> {
2204    ///
2205    /// let builder = prepare_request_builder();
2206    /// let response = builder.send().await?;
2207    /// # Ok(()) }
2208    ///
2209    /// fn prepare_request_builder() -> DeleteControl {
2210    ///   # panic!();
2211    ///   // ... details omitted ...
2212    /// }
2213    /// ```
2214    #[derive(Clone, Debug)]
2215    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2216
2217    impl DeleteControl {
2218        pub(crate) fn new(
2219            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2220        ) -> Self {
2221            Self(RequestBuilder::new(stub))
2222        }
2223
2224        /// Sets the full request, replacing any prior values.
2225        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2226            self.0.request = v.into();
2227            self
2228        }
2229
2230        /// Sets all the options, replacing any prior values.
2231        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2232            self.0.options = v.into();
2233            self
2234        }
2235
2236        /// Sends the request.
2237        pub async fn send(self) -> Result<()> {
2238            (*self.0.stub)
2239                .delete_control(self.0.request, self.0.options)
2240                .await
2241                .map(gax::response::Response::into_body)
2242        }
2243
2244        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2245        ///
2246        /// This is a **required** field for requests.
2247        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2248            self.0.request.name = v.into();
2249            self
2250        }
2251    }
2252
2253    #[doc(hidden)]
2254    impl gax::options::internal::RequestBuilder for DeleteControl {
2255        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2256            &mut self.0.options
2257        }
2258    }
2259
2260    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2261    ///
2262    /// # Example
2263    /// ```
2264    /// # use google_cloud_retail_v2::builder::control_service::UpdateControl;
2265    /// # async fn sample() -> gax::Result<()> {
2266    ///
2267    /// let builder = prepare_request_builder();
2268    /// let response = builder.send().await?;
2269    /// # Ok(()) }
2270    ///
2271    /// fn prepare_request_builder() -> UpdateControl {
2272    ///   # panic!();
2273    ///   // ... details omitted ...
2274    /// }
2275    /// ```
2276    #[derive(Clone, Debug)]
2277    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2278
2279    impl UpdateControl {
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::UpdateControlRequest>>(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<gax::options::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                .update_control(self.0.request, self.0.options)
2302                .await
2303                .map(gax::response::Response::into_body)
2304        }
2305
2306        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2307        ///
2308        /// This is a **required** field for requests.
2309        pub fn set_control<T>(mut self, v: T) -> Self
2310        where
2311            T: std::convert::Into<crate::model::Control>,
2312        {
2313            self.0.request.control = std::option::Option::Some(v.into());
2314            self
2315        }
2316
2317        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2318        ///
2319        /// This is a **required** field for requests.
2320        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2321        where
2322            T: std::convert::Into<crate::model::Control>,
2323        {
2324            self.0.request.control = v.map(|x| x.into());
2325            self
2326        }
2327
2328        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2329        pub fn set_update_mask<T>(mut self, v: T) -> Self
2330        where
2331            T: std::convert::Into<wkt::FieldMask>,
2332        {
2333            self.0.request.update_mask = std::option::Option::Some(v.into());
2334            self
2335        }
2336
2337        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2338        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2339        where
2340            T: std::convert::Into<wkt::FieldMask>,
2341        {
2342            self.0.request.update_mask = v.map(|x| x.into());
2343            self
2344        }
2345    }
2346
2347    #[doc(hidden)]
2348    impl gax::options::internal::RequestBuilder for UpdateControl {
2349        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2350            &mut self.0.options
2351        }
2352    }
2353
2354    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2355    ///
2356    /// # Example
2357    /// ```
2358    /// # use google_cloud_retail_v2::builder::control_service::GetControl;
2359    /// # async fn sample() -> gax::Result<()> {
2360    ///
2361    /// let builder = prepare_request_builder();
2362    /// let response = builder.send().await?;
2363    /// # Ok(()) }
2364    ///
2365    /// fn prepare_request_builder() -> GetControl {
2366    ///   # panic!();
2367    ///   // ... details omitted ...
2368    /// }
2369    /// ```
2370    #[derive(Clone, Debug)]
2371    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2372
2373    impl GetControl {
2374        pub(crate) fn new(
2375            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2376        ) -> Self {
2377            Self(RequestBuilder::new(stub))
2378        }
2379
2380        /// Sets the full request, replacing any prior values.
2381        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2382            self.0.request = v.into();
2383            self
2384        }
2385
2386        /// Sets all the options, replacing any prior values.
2387        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2388            self.0.options = v.into();
2389            self
2390        }
2391
2392        /// Sends the request.
2393        pub async fn send(self) -> Result<crate::model::Control> {
2394            (*self.0.stub)
2395                .get_control(self.0.request, self.0.options)
2396                .await
2397                .map(gax::response::Response::into_body)
2398        }
2399
2400        /// Sets the value of [name][crate::model::GetControlRequest::name].
2401        ///
2402        /// This is a **required** field for requests.
2403        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2404            self.0.request.name = v.into();
2405            self
2406        }
2407    }
2408
2409    #[doc(hidden)]
2410    impl gax::options::internal::RequestBuilder for GetControl {
2411        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2412            &mut self.0.options
2413        }
2414    }
2415
2416    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2417    ///
2418    /// # Example
2419    /// ```
2420    /// # use google_cloud_retail_v2::builder::control_service::ListControls;
2421    /// # async fn sample() -> gax::Result<()> {
2422    /// use gax::paginator::ItemPaginator;
2423    ///
2424    /// let builder = prepare_request_builder();
2425    /// let mut items = builder.by_item();
2426    /// while let Some(result) = items.next().await {
2427    ///   let item = result?;
2428    /// }
2429    /// # Ok(()) }
2430    ///
2431    /// fn prepare_request_builder() -> ListControls {
2432    ///   # panic!();
2433    ///   // ... details omitted ...
2434    /// }
2435    /// ```
2436    #[derive(Clone, Debug)]
2437    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2438
2439    impl ListControls {
2440        pub(crate) fn new(
2441            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2442        ) -> Self {
2443            Self(RequestBuilder::new(stub))
2444        }
2445
2446        /// Sets the full request, replacing any prior values.
2447        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2448            self.0.request = v.into();
2449            self
2450        }
2451
2452        /// Sets all the options, replacing any prior values.
2453        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2454            self.0.options = v.into();
2455            self
2456        }
2457
2458        /// Sends the request.
2459        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2460            (*self.0.stub)
2461                .list_controls(self.0.request, self.0.options)
2462                .await
2463                .map(gax::response::Response::into_body)
2464        }
2465
2466        /// Streams each page in the collection.
2467        pub fn by_page(
2468            self,
2469        ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2470        {
2471            use std::clone::Clone;
2472            let token = self.0.request.page_token.clone();
2473            let execute = move |token: String| {
2474                let mut builder = self.clone();
2475                builder.0.request = builder.0.request.set_page_token(token);
2476                builder.send()
2477            };
2478            gax::paginator::internal::new_paginator(token, execute)
2479        }
2480
2481        /// Streams each item in the collection.
2482        pub fn by_item(
2483            self,
2484        ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2485        {
2486            use gax::paginator::Paginator;
2487            self.by_page().items()
2488        }
2489
2490        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2491        ///
2492        /// This is a **required** field for requests.
2493        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2494            self.0.request.parent = v.into();
2495            self
2496        }
2497
2498        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2499        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2500            self.0.request.page_size = v.into();
2501            self
2502        }
2503
2504        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2505        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2506            self.0.request.page_token = v.into();
2507            self
2508        }
2509
2510        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2511        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2512            self.0.request.filter = v.into();
2513            self
2514        }
2515    }
2516
2517    #[doc(hidden)]
2518    impl gax::options::internal::RequestBuilder for ListControls {
2519        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2520            &mut self.0.options
2521        }
2522    }
2523
2524    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2525    ///
2526    /// # Example
2527    /// ```
2528    /// # use google_cloud_retail_v2::builder::control_service::ListOperations;
2529    /// # async fn sample() -> gax::Result<()> {
2530    /// use gax::paginator::ItemPaginator;
2531    ///
2532    /// let builder = prepare_request_builder();
2533    /// let mut items = builder.by_item();
2534    /// while let Some(result) = items.next().await {
2535    ///   let item = result?;
2536    /// }
2537    /// # Ok(()) }
2538    ///
2539    /// fn prepare_request_builder() -> ListOperations {
2540    ///   # panic!();
2541    ///   // ... details omitted ...
2542    /// }
2543    /// ```
2544    #[derive(Clone, Debug)]
2545    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2546
2547    impl ListOperations {
2548        pub(crate) fn new(
2549            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2550        ) -> Self {
2551            Self(RequestBuilder::new(stub))
2552        }
2553
2554        /// Sets the full request, replacing any prior values.
2555        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2556            mut self,
2557            v: V,
2558        ) -> Self {
2559            self.0.request = v.into();
2560            self
2561        }
2562
2563        /// Sets all the options, replacing any prior values.
2564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2565            self.0.options = v.into();
2566            self
2567        }
2568
2569        /// Sends the request.
2570        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2571            (*self.0.stub)
2572                .list_operations(self.0.request, self.0.options)
2573                .await
2574                .map(gax::response::Response::into_body)
2575        }
2576
2577        /// Streams each page in the collection.
2578        pub fn by_page(
2579            self,
2580        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2581        {
2582            use std::clone::Clone;
2583            let token = self.0.request.page_token.clone();
2584            let execute = move |token: String| {
2585                let mut builder = self.clone();
2586                builder.0.request = builder.0.request.set_page_token(token);
2587                builder.send()
2588            };
2589            gax::paginator::internal::new_paginator(token, execute)
2590        }
2591
2592        /// Streams each item in the collection.
2593        pub fn by_item(
2594            self,
2595        ) -> impl gax::paginator::ItemPaginator<
2596            longrunning::model::ListOperationsResponse,
2597            gax::error::Error,
2598        > {
2599            use gax::paginator::Paginator;
2600            self.by_page().items()
2601        }
2602
2603        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2604        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2605            self.0.request.name = v.into();
2606            self
2607        }
2608
2609        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2610        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2611            self.0.request.filter = v.into();
2612            self
2613        }
2614
2615        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2616        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2617            self.0.request.page_size = v.into();
2618            self
2619        }
2620
2621        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2622        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2623            self.0.request.page_token = v.into();
2624            self
2625        }
2626
2627        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2628        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2629            self.0.request.return_partial_success = v.into();
2630            self
2631        }
2632    }
2633
2634    #[doc(hidden)]
2635    impl gax::options::internal::RequestBuilder for ListOperations {
2636        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2637            &mut self.0.options
2638        }
2639    }
2640
2641    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2642    ///
2643    /// # Example
2644    /// ```
2645    /// # use google_cloud_retail_v2::builder::control_service::GetOperation;
2646    /// # async fn sample() -> gax::Result<()> {
2647    ///
2648    /// let builder = prepare_request_builder();
2649    /// let response = builder.send().await?;
2650    /// # Ok(()) }
2651    ///
2652    /// fn prepare_request_builder() -> GetOperation {
2653    ///   # panic!();
2654    ///   // ... details omitted ...
2655    /// }
2656    /// ```
2657    #[derive(Clone, Debug)]
2658    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2659
2660    impl GetOperation {
2661        pub(crate) fn new(
2662            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2663        ) -> Self {
2664            Self(RequestBuilder::new(stub))
2665        }
2666
2667        /// Sets the full request, replacing any prior values.
2668        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2669            mut self,
2670            v: V,
2671        ) -> Self {
2672            self.0.request = v.into();
2673            self
2674        }
2675
2676        /// Sets all the options, replacing any prior values.
2677        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2678            self.0.options = v.into();
2679            self
2680        }
2681
2682        /// Sends the request.
2683        pub async fn send(self) -> Result<longrunning::model::Operation> {
2684            (*self.0.stub)
2685                .get_operation(self.0.request, self.0.options)
2686                .await
2687                .map(gax::response::Response::into_body)
2688        }
2689
2690        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2691        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2692            self.0.request.name = v.into();
2693            self
2694        }
2695    }
2696
2697    #[doc(hidden)]
2698    impl gax::options::internal::RequestBuilder for GetOperation {
2699        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2700            &mut self.0.options
2701        }
2702    }
2703}
2704
2705pub mod conversational_search_service {
2706    use crate::Result;
2707
2708    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2709    ///
2710    /// ```
2711    /// # async fn sample() -> gax::client_builder::Result<()> {
2712    /// # use google_cloud_retail_v2::*;
2713    /// # use builder::conversational_search_service::ClientBuilder;
2714    /// # use client::ConversationalSearchService;
2715    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2716    /// let client = builder
2717    ///     .with_endpoint("https://retail.googleapis.com")
2718    ///     .build().await?;
2719    /// # Ok(()) }
2720    /// ```
2721    pub type ClientBuilder =
2722        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2723
2724    pub(crate) mod client {
2725        use super::super::super::client::ConversationalSearchService;
2726        pub struct Factory;
2727        impl gax::client_builder::internal::ClientFactory for Factory {
2728            type Client = ConversationalSearchService;
2729            type Credentials = gaxi::options::Credentials;
2730            async fn build(
2731                self,
2732                config: gaxi::options::ClientConfig,
2733            ) -> gax::client_builder::Result<Self::Client> {
2734                Self::Client::new(config).await
2735            }
2736        }
2737    }
2738
2739    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2740    #[derive(Clone, Debug)]
2741    pub(crate) struct RequestBuilder<R: std::default::Default> {
2742        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2743        request: R,
2744        options: gax::options::RequestOptions,
2745    }
2746
2747    impl<R> RequestBuilder<R>
2748    where
2749        R: std::default::Default,
2750    {
2751        pub(crate) fn new(
2752            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2753        ) -> Self {
2754            Self {
2755                stub,
2756                request: R::default(),
2757                options: gax::options::RequestOptions::default(),
2758            }
2759        }
2760    }
2761
2762    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
2763    ///
2764    /// # Example
2765    /// ```
2766    /// # use google_cloud_retail_v2::builder::conversational_search_service::ListOperations;
2767    /// # async fn sample() -> gax::Result<()> {
2768    /// use gax::paginator::ItemPaginator;
2769    ///
2770    /// let builder = prepare_request_builder();
2771    /// let mut items = builder.by_item();
2772    /// while let Some(result) = items.next().await {
2773    ///   let item = result?;
2774    /// }
2775    /// # Ok(()) }
2776    ///
2777    /// fn prepare_request_builder() -> ListOperations {
2778    ///   # panic!();
2779    ///   // ... details omitted ...
2780    /// }
2781    /// ```
2782    #[derive(Clone, Debug)]
2783    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2784
2785    impl ListOperations {
2786        pub(crate) fn new(
2787            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2788        ) -> Self {
2789            Self(RequestBuilder::new(stub))
2790        }
2791
2792        /// Sets the full request, replacing any prior values.
2793        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2794            mut self,
2795            v: V,
2796        ) -> Self {
2797            self.0.request = v.into();
2798            self
2799        }
2800
2801        /// Sets all the options, replacing any prior values.
2802        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2803            self.0.options = v.into();
2804            self
2805        }
2806
2807        /// Sends the request.
2808        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2809            (*self.0.stub)
2810                .list_operations(self.0.request, self.0.options)
2811                .await
2812                .map(gax::response::Response::into_body)
2813        }
2814
2815        /// Streams each page in the collection.
2816        pub fn by_page(
2817            self,
2818        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2819        {
2820            use std::clone::Clone;
2821            let token = self.0.request.page_token.clone();
2822            let execute = move |token: String| {
2823                let mut builder = self.clone();
2824                builder.0.request = builder.0.request.set_page_token(token);
2825                builder.send()
2826            };
2827            gax::paginator::internal::new_paginator(token, execute)
2828        }
2829
2830        /// Streams each item in the collection.
2831        pub fn by_item(
2832            self,
2833        ) -> impl gax::paginator::ItemPaginator<
2834            longrunning::model::ListOperationsResponse,
2835            gax::error::Error,
2836        > {
2837            use gax::paginator::Paginator;
2838            self.by_page().items()
2839        }
2840
2841        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2842        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2843            self.0.request.name = v.into();
2844            self
2845        }
2846
2847        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2848        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849            self.0.request.filter = v.into();
2850            self
2851        }
2852
2853        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2854        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2855            self.0.request.page_size = v.into();
2856            self
2857        }
2858
2859        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2860        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861            self.0.request.page_token = v.into();
2862            self
2863        }
2864
2865        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2866        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2867            self.0.request.return_partial_success = v.into();
2868            self
2869        }
2870    }
2871
2872    #[doc(hidden)]
2873    impl gax::options::internal::RequestBuilder for ListOperations {
2874        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2875            &mut self.0.options
2876        }
2877    }
2878
2879    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
2880    ///
2881    /// # Example
2882    /// ```
2883    /// # use google_cloud_retail_v2::builder::conversational_search_service::GetOperation;
2884    /// # async fn sample() -> gax::Result<()> {
2885    ///
2886    /// let builder = prepare_request_builder();
2887    /// let response = builder.send().await?;
2888    /// # Ok(()) }
2889    ///
2890    /// fn prepare_request_builder() -> GetOperation {
2891    ///   # panic!();
2892    ///   // ... details omitted ...
2893    /// }
2894    /// ```
2895    #[derive(Clone, Debug)]
2896    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2897
2898    impl GetOperation {
2899        pub(crate) fn new(
2900            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2901        ) -> Self {
2902            Self(RequestBuilder::new(stub))
2903        }
2904
2905        /// Sets the full request, replacing any prior values.
2906        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2907            mut self,
2908            v: V,
2909        ) -> Self {
2910            self.0.request = v.into();
2911            self
2912        }
2913
2914        /// Sets all the options, replacing any prior values.
2915        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2916            self.0.options = v.into();
2917            self
2918        }
2919
2920        /// Sends the request.
2921        pub async fn send(self) -> Result<longrunning::model::Operation> {
2922            (*self.0.stub)
2923                .get_operation(self.0.request, self.0.options)
2924                .await
2925                .map(gax::response::Response::into_body)
2926        }
2927
2928        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2929        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2930            self.0.request.name = v.into();
2931            self
2932        }
2933    }
2934
2935    #[doc(hidden)]
2936    impl gax::options::internal::RequestBuilder for GetOperation {
2937        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2938            &mut self.0.options
2939        }
2940    }
2941}
2942
2943pub mod generative_question_service {
2944    use crate::Result;
2945
2946    /// A builder for [GenerativeQuestionService][crate::client::GenerativeQuestionService].
2947    ///
2948    /// ```
2949    /// # async fn sample() -> gax::client_builder::Result<()> {
2950    /// # use google_cloud_retail_v2::*;
2951    /// # use builder::generative_question_service::ClientBuilder;
2952    /// # use client::GenerativeQuestionService;
2953    /// let builder : ClientBuilder = GenerativeQuestionService::builder();
2954    /// let client = builder
2955    ///     .with_endpoint("https://retail.googleapis.com")
2956    ///     .build().await?;
2957    /// # Ok(()) }
2958    /// ```
2959    pub type ClientBuilder =
2960        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2961
2962    pub(crate) mod client {
2963        use super::super::super::client::GenerativeQuestionService;
2964        pub struct Factory;
2965        impl gax::client_builder::internal::ClientFactory for Factory {
2966            type Client = GenerativeQuestionService;
2967            type Credentials = gaxi::options::Credentials;
2968            async fn build(
2969                self,
2970                config: gaxi::options::ClientConfig,
2971            ) -> gax::client_builder::Result<Self::Client> {
2972                Self::Client::new(config).await
2973            }
2974        }
2975    }
2976
2977    /// Common implementation for [crate::client::GenerativeQuestionService] request builders.
2978    #[derive(Clone, Debug)]
2979    pub(crate) struct RequestBuilder<R: std::default::Default> {
2980        stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
2981        request: R,
2982        options: gax::options::RequestOptions,
2983    }
2984
2985    impl<R> RequestBuilder<R>
2986    where
2987        R: std::default::Default,
2988    {
2989        pub(crate) fn new(
2990            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
2991        ) -> Self {
2992            Self {
2993                stub,
2994                request: R::default(),
2995                options: gax::options::RequestOptions::default(),
2996            }
2997        }
2998    }
2999
3000    /// The request builder for [GenerativeQuestionService::update_generative_questions_feature_config][crate::client::GenerativeQuestionService::update_generative_questions_feature_config] calls.
3001    ///
3002    /// # Example
3003    /// ```
3004    /// # use google_cloud_retail_v2::builder::generative_question_service::UpdateGenerativeQuestionsFeatureConfig;
3005    /// # async fn sample() -> gax::Result<()> {
3006    ///
3007    /// let builder = prepare_request_builder();
3008    /// let response = builder.send().await?;
3009    /// # Ok(()) }
3010    ///
3011    /// fn prepare_request_builder() -> UpdateGenerativeQuestionsFeatureConfig {
3012    ///   # panic!();
3013    ///   // ... details omitted ...
3014    /// }
3015    /// ```
3016    #[derive(Clone, Debug)]
3017    pub struct UpdateGenerativeQuestionsFeatureConfig(
3018        RequestBuilder<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3019    );
3020
3021    impl UpdateGenerativeQuestionsFeatureConfig {
3022        pub(crate) fn new(
3023            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3024        ) -> Self {
3025            Self(RequestBuilder::new(stub))
3026        }
3027
3028        /// Sets the full request, replacing any prior values.
3029        pub fn with_request<
3030            V: Into<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3031        >(
3032            mut self,
3033            v: V,
3034        ) -> Self {
3035            self.0.request = v.into();
3036            self
3037        }
3038
3039        /// Sets all the options, replacing any prior values.
3040        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3041            self.0.options = v.into();
3042            self
3043        }
3044
3045        /// Sends the request.
3046        pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3047            (*self.0.stub)
3048                .update_generative_questions_feature_config(self.0.request, self.0.options)
3049                .await
3050                .map(gax::response::Response::into_body)
3051        }
3052
3053        /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
3054        ///
3055        /// This is a **required** field for requests.
3056        pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
3057        where
3058            T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3059        {
3060            self.0.request.generative_questions_feature_config =
3061                std::option::Option::Some(v.into());
3062            self
3063        }
3064
3065        /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
3066        ///
3067        /// This is a **required** field for requests.
3068        pub fn set_or_clear_generative_questions_feature_config<T>(
3069            mut self,
3070            v: std::option::Option<T>,
3071        ) -> Self
3072        where
3073            T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3074        {
3075            self.0.request.generative_questions_feature_config = v.map(|x| x.into());
3076            self
3077        }
3078
3079        /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
3080        pub fn set_update_mask<T>(mut self, v: T) -> Self
3081        where
3082            T: std::convert::Into<wkt::FieldMask>,
3083        {
3084            self.0.request.update_mask = std::option::Option::Some(v.into());
3085            self
3086        }
3087
3088        /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
3089        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3090        where
3091            T: std::convert::Into<wkt::FieldMask>,
3092        {
3093            self.0.request.update_mask = v.map(|x| x.into());
3094            self
3095        }
3096    }
3097
3098    #[doc(hidden)]
3099    impl gax::options::internal::RequestBuilder for UpdateGenerativeQuestionsFeatureConfig {
3100        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3101            &mut self.0.options
3102        }
3103    }
3104
3105    /// The request builder for [GenerativeQuestionService::get_generative_questions_feature_config][crate::client::GenerativeQuestionService::get_generative_questions_feature_config] calls.
3106    ///
3107    /// # Example
3108    /// ```
3109    /// # use google_cloud_retail_v2::builder::generative_question_service::GetGenerativeQuestionsFeatureConfig;
3110    /// # async fn sample() -> gax::Result<()> {
3111    ///
3112    /// let builder = prepare_request_builder();
3113    /// let response = builder.send().await?;
3114    /// # Ok(()) }
3115    ///
3116    /// fn prepare_request_builder() -> GetGenerativeQuestionsFeatureConfig {
3117    ///   # panic!();
3118    ///   // ... details omitted ...
3119    /// }
3120    /// ```
3121    #[derive(Clone, Debug)]
3122    pub struct GetGenerativeQuestionsFeatureConfig(
3123        RequestBuilder<crate::model::GetGenerativeQuestionsFeatureConfigRequest>,
3124    );
3125
3126    impl GetGenerativeQuestionsFeatureConfig {
3127        pub(crate) fn new(
3128            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3129        ) -> Self {
3130            Self(RequestBuilder::new(stub))
3131        }
3132
3133        /// Sets the full request, replacing any prior values.
3134        pub fn with_request<V: Into<crate::model::GetGenerativeQuestionsFeatureConfigRequest>>(
3135            mut self,
3136            v: V,
3137        ) -> Self {
3138            self.0.request = v.into();
3139            self
3140        }
3141
3142        /// Sets all the options, replacing any prior values.
3143        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3144            self.0.options = v.into();
3145            self
3146        }
3147
3148        /// Sends the request.
3149        pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3150            (*self.0.stub)
3151                .get_generative_questions_feature_config(self.0.request, self.0.options)
3152                .await
3153                .map(gax::response::Response::into_body)
3154        }
3155
3156        /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
3157        ///
3158        /// This is a **required** field for requests.
3159        pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
3160            self.0.request.catalog = v.into();
3161            self
3162        }
3163    }
3164
3165    #[doc(hidden)]
3166    impl gax::options::internal::RequestBuilder for GetGenerativeQuestionsFeatureConfig {
3167        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3168            &mut self.0.options
3169        }
3170    }
3171
3172    /// The request builder for [GenerativeQuestionService::list_generative_question_configs][crate::client::GenerativeQuestionService::list_generative_question_configs] calls.
3173    ///
3174    /// # Example
3175    /// ```
3176    /// # use google_cloud_retail_v2::builder::generative_question_service::ListGenerativeQuestionConfigs;
3177    /// # async fn sample() -> gax::Result<()> {
3178    ///
3179    /// let builder = prepare_request_builder();
3180    /// let response = builder.send().await?;
3181    /// # Ok(()) }
3182    ///
3183    /// fn prepare_request_builder() -> ListGenerativeQuestionConfigs {
3184    ///   # panic!();
3185    ///   // ... details omitted ...
3186    /// }
3187    /// ```
3188    #[derive(Clone, Debug)]
3189    pub struct ListGenerativeQuestionConfigs(
3190        RequestBuilder<crate::model::ListGenerativeQuestionConfigsRequest>,
3191    );
3192
3193    impl ListGenerativeQuestionConfigs {
3194        pub(crate) fn new(
3195            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3196        ) -> Self {
3197            Self(RequestBuilder::new(stub))
3198        }
3199
3200        /// Sets the full request, replacing any prior values.
3201        pub fn with_request<V: Into<crate::model::ListGenerativeQuestionConfigsRequest>>(
3202            mut self,
3203            v: V,
3204        ) -> Self {
3205            self.0.request = v.into();
3206            self
3207        }
3208
3209        /// Sets all the options, replacing any prior values.
3210        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3211            self.0.options = v.into();
3212            self
3213        }
3214
3215        /// Sends the request.
3216        pub async fn send(self) -> Result<crate::model::ListGenerativeQuestionConfigsResponse> {
3217            (*self.0.stub)
3218                .list_generative_question_configs(self.0.request, self.0.options)
3219                .await
3220                .map(gax::response::Response::into_body)
3221        }
3222
3223        /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
3224        ///
3225        /// This is a **required** field for requests.
3226        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3227            self.0.request.parent = v.into();
3228            self
3229        }
3230    }
3231
3232    #[doc(hidden)]
3233    impl gax::options::internal::RequestBuilder for ListGenerativeQuestionConfigs {
3234        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3235            &mut self.0.options
3236        }
3237    }
3238
3239    /// The request builder for [GenerativeQuestionService::update_generative_question_config][crate::client::GenerativeQuestionService::update_generative_question_config] calls.
3240    ///
3241    /// # Example
3242    /// ```
3243    /// # use google_cloud_retail_v2::builder::generative_question_service::UpdateGenerativeQuestionConfig;
3244    /// # async fn sample() -> gax::Result<()> {
3245    ///
3246    /// let builder = prepare_request_builder();
3247    /// let response = builder.send().await?;
3248    /// # Ok(()) }
3249    ///
3250    /// fn prepare_request_builder() -> UpdateGenerativeQuestionConfig {
3251    ///   # panic!();
3252    ///   // ... details omitted ...
3253    /// }
3254    /// ```
3255    #[derive(Clone, Debug)]
3256    pub struct UpdateGenerativeQuestionConfig(
3257        RequestBuilder<crate::model::UpdateGenerativeQuestionConfigRequest>,
3258    );
3259
3260    impl UpdateGenerativeQuestionConfig {
3261        pub(crate) fn new(
3262            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3263        ) -> Self {
3264            Self(RequestBuilder::new(stub))
3265        }
3266
3267        /// Sets the full request, replacing any prior values.
3268        pub fn with_request<V: Into<crate::model::UpdateGenerativeQuestionConfigRequest>>(
3269            mut self,
3270            v: V,
3271        ) -> Self {
3272            self.0.request = v.into();
3273            self
3274        }
3275
3276        /// Sets all the options, replacing any prior values.
3277        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3278            self.0.options = v.into();
3279            self
3280        }
3281
3282        /// Sends the request.
3283        pub async fn send(self) -> Result<crate::model::GenerativeQuestionConfig> {
3284            (*self.0.stub)
3285                .update_generative_question_config(self.0.request, self.0.options)
3286                .await
3287                .map(gax::response::Response::into_body)
3288        }
3289
3290        /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
3291        ///
3292        /// This is a **required** field for requests.
3293        pub fn set_generative_question_config<T>(mut self, v: T) -> Self
3294        where
3295            T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3296        {
3297            self.0.request.generative_question_config = std::option::Option::Some(v.into());
3298            self
3299        }
3300
3301        /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
3302        ///
3303        /// This is a **required** field for requests.
3304        pub fn set_or_clear_generative_question_config<T>(
3305            mut self,
3306            v: std::option::Option<T>,
3307        ) -> Self
3308        where
3309            T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3310        {
3311            self.0.request.generative_question_config = v.map(|x| x.into());
3312            self
3313        }
3314
3315        /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
3316        pub fn set_update_mask<T>(mut self, v: T) -> Self
3317        where
3318            T: std::convert::Into<wkt::FieldMask>,
3319        {
3320            self.0.request.update_mask = std::option::Option::Some(v.into());
3321            self
3322        }
3323
3324        /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
3325        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3326        where
3327            T: std::convert::Into<wkt::FieldMask>,
3328        {
3329            self.0.request.update_mask = v.map(|x| x.into());
3330            self
3331        }
3332    }
3333
3334    #[doc(hidden)]
3335    impl gax::options::internal::RequestBuilder for UpdateGenerativeQuestionConfig {
3336        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3337            &mut self.0.options
3338        }
3339    }
3340
3341    /// The request builder for [GenerativeQuestionService::batch_update_generative_question_configs][crate::client::GenerativeQuestionService::batch_update_generative_question_configs] calls.
3342    ///
3343    /// # Example
3344    /// ```
3345    /// # use google_cloud_retail_v2::builder::generative_question_service::BatchUpdateGenerativeQuestionConfigs;
3346    /// # async fn sample() -> gax::Result<()> {
3347    ///
3348    /// let builder = prepare_request_builder();
3349    /// let response = builder.send().await?;
3350    /// # Ok(()) }
3351    ///
3352    /// fn prepare_request_builder() -> BatchUpdateGenerativeQuestionConfigs {
3353    ///   # panic!();
3354    ///   // ... details omitted ...
3355    /// }
3356    /// ```
3357    #[derive(Clone, Debug)]
3358    pub struct BatchUpdateGenerativeQuestionConfigs(
3359        RequestBuilder<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>,
3360    );
3361
3362    impl BatchUpdateGenerativeQuestionConfigs {
3363        pub(crate) fn new(
3364            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3365        ) -> Self {
3366            Self(RequestBuilder::new(stub))
3367        }
3368
3369        /// Sets the full request, replacing any prior values.
3370        pub fn with_request<V: Into<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>>(
3371            mut self,
3372            v: V,
3373        ) -> Self {
3374            self.0.request = v.into();
3375            self
3376        }
3377
3378        /// Sets all the options, replacing any prior values.
3379        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3380            self.0.options = v.into();
3381            self
3382        }
3383
3384        /// Sends the request.
3385        pub async fn send(
3386            self,
3387        ) -> Result<crate::model::BatchUpdateGenerativeQuestionConfigsResponse> {
3388            (*self.0.stub)
3389                .batch_update_generative_question_configs(self.0.request, self.0.options)
3390                .await
3391                .map(gax::response::Response::into_body)
3392        }
3393
3394        /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
3395        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3396            self.0.request.parent = v.into();
3397            self
3398        }
3399
3400        /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
3401        ///
3402        /// This is a **required** field for requests.
3403        pub fn set_requests<T, V>(mut self, v: T) -> Self
3404        where
3405            T: std::iter::IntoIterator<Item = V>,
3406            V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
3407        {
3408            use std::iter::Iterator;
3409            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
3410            self
3411        }
3412    }
3413
3414    #[doc(hidden)]
3415    impl gax::options::internal::RequestBuilder for BatchUpdateGenerativeQuestionConfigs {
3416        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3417            &mut self.0.options
3418        }
3419    }
3420
3421    /// The request builder for [GenerativeQuestionService::list_operations][crate::client::GenerativeQuestionService::list_operations] calls.
3422    ///
3423    /// # Example
3424    /// ```
3425    /// # use google_cloud_retail_v2::builder::generative_question_service::ListOperations;
3426    /// # async fn sample() -> gax::Result<()> {
3427    /// use gax::paginator::ItemPaginator;
3428    ///
3429    /// let builder = prepare_request_builder();
3430    /// let mut items = builder.by_item();
3431    /// while let Some(result) = items.next().await {
3432    ///   let item = result?;
3433    /// }
3434    /// # Ok(()) }
3435    ///
3436    /// fn prepare_request_builder() -> ListOperations {
3437    ///   # panic!();
3438    ///   // ... details omitted ...
3439    /// }
3440    /// ```
3441    #[derive(Clone, Debug)]
3442    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3443
3444    impl ListOperations {
3445        pub(crate) fn new(
3446            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3447        ) -> Self {
3448            Self(RequestBuilder::new(stub))
3449        }
3450
3451        /// Sets the full request, replacing any prior values.
3452        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3453            mut self,
3454            v: V,
3455        ) -> Self {
3456            self.0.request = v.into();
3457            self
3458        }
3459
3460        /// Sets all the options, replacing any prior values.
3461        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3462            self.0.options = v.into();
3463            self
3464        }
3465
3466        /// Sends the request.
3467        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3468            (*self.0.stub)
3469                .list_operations(self.0.request, self.0.options)
3470                .await
3471                .map(gax::response::Response::into_body)
3472        }
3473
3474        /// Streams each page in the collection.
3475        pub fn by_page(
3476            self,
3477        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3478        {
3479            use std::clone::Clone;
3480            let token = self.0.request.page_token.clone();
3481            let execute = move |token: String| {
3482                let mut builder = self.clone();
3483                builder.0.request = builder.0.request.set_page_token(token);
3484                builder.send()
3485            };
3486            gax::paginator::internal::new_paginator(token, execute)
3487        }
3488
3489        /// Streams each item in the collection.
3490        pub fn by_item(
3491            self,
3492        ) -> impl gax::paginator::ItemPaginator<
3493            longrunning::model::ListOperationsResponse,
3494            gax::error::Error,
3495        > {
3496            use gax::paginator::Paginator;
3497            self.by_page().items()
3498        }
3499
3500        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3501        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3502            self.0.request.name = v.into();
3503            self
3504        }
3505
3506        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3507        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3508            self.0.request.filter = v.into();
3509            self
3510        }
3511
3512        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3513        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3514            self.0.request.page_size = v.into();
3515            self
3516        }
3517
3518        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3519        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3520            self.0.request.page_token = v.into();
3521            self
3522        }
3523
3524        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
3525        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3526            self.0.request.return_partial_success = v.into();
3527            self
3528        }
3529    }
3530
3531    #[doc(hidden)]
3532    impl gax::options::internal::RequestBuilder for ListOperations {
3533        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3534            &mut self.0.options
3535        }
3536    }
3537
3538    /// The request builder for [GenerativeQuestionService::get_operation][crate::client::GenerativeQuestionService::get_operation] calls.
3539    ///
3540    /// # Example
3541    /// ```
3542    /// # use google_cloud_retail_v2::builder::generative_question_service::GetOperation;
3543    /// # async fn sample() -> gax::Result<()> {
3544    ///
3545    /// let builder = prepare_request_builder();
3546    /// let response = builder.send().await?;
3547    /// # Ok(()) }
3548    ///
3549    /// fn prepare_request_builder() -> GetOperation {
3550    ///   # panic!();
3551    ///   // ... details omitted ...
3552    /// }
3553    /// ```
3554    #[derive(Clone, Debug)]
3555    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3556
3557    impl GetOperation {
3558        pub(crate) fn new(
3559            stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3560        ) -> Self {
3561            Self(RequestBuilder::new(stub))
3562        }
3563
3564        /// Sets the full request, replacing any prior values.
3565        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3566            mut self,
3567            v: V,
3568        ) -> Self {
3569            self.0.request = v.into();
3570            self
3571        }
3572
3573        /// Sets all the options, replacing any prior values.
3574        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3575            self.0.options = v.into();
3576            self
3577        }
3578
3579        /// Sends the request.
3580        pub async fn send(self) -> Result<longrunning::model::Operation> {
3581            (*self.0.stub)
3582                .get_operation(self.0.request, self.0.options)
3583                .await
3584                .map(gax::response::Response::into_body)
3585        }
3586
3587        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3588        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3589            self.0.request.name = v.into();
3590            self
3591        }
3592    }
3593
3594    #[doc(hidden)]
3595    impl gax::options::internal::RequestBuilder for GetOperation {
3596        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3597            &mut self.0.options
3598        }
3599    }
3600}
3601
3602pub mod model_service {
3603    use crate::Result;
3604
3605    /// A builder for [ModelService][crate::client::ModelService].
3606    ///
3607    /// ```
3608    /// # async fn sample() -> gax::client_builder::Result<()> {
3609    /// # use google_cloud_retail_v2::*;
3610    /// # use builder::model_service::ClientBuilder;
3611    /// # use client::ModelService;
3612    /// let builder : ClientBuilder = ModelService::builder();
3613    /// let client = builder
3614    ///     .with_endpoint("https://retail.googleapis.com")
3615    ///     .build().await?;
3616    /// # Ok(()) }
3617    /// ```
3618    pub type ClientBuilder =
3619        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3620
3621    pub(crate) mod client {
3622        use super::super::super::client::ModelService;
3623        pub struct Factory;
3624        impl gax::client_builder::internal::ClientFactory for Factory {
3625            type Client = ModelService;
3626            type Credentials = gaxi::options::Credentials;
3627            async fn build(
3628                self,
3629                config: gaxi::options::ClientConfig,
3630            ) -> gax::client_builder::Result<Self::Client> {
3631                Self::Client::new(config).await
3632            }
3633        }
3634    }
3635
3636    /// Common implementation for [crate::client::ModelService] request builders.
3637    #[derive(Clone, Debug)]
3638    pub(crate) struct RequestBuilder<R: std::default::Default> {
3639        stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3640        request: R,
3641        options: gax::options::RequestOptions,
3642    }
3643
3644    impl<R> RequestBuilder<R>
3645    where
3646        R: std::default::Default,
3647    {
3648        pub(crate) fn new(
3649            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3650        ) -> Self {
3651            Self {
3652                stub,
3653                request: R::default(),
3654                options: gax::options::RequestOptions::default(),
3655            }
3656        }
3657    }
3658
3659    /// The request builder for [ModelService::create_model][crate::client::ModelService::create_model] calls.
3660    ///
3661    /// # Example
3662    /// ```
3663    /// # use google_cloud_retail_v2::builder::model_service::CreateModel;
3664    /// # async fn sample() -> gax::Result<()> {
3665    /// use lro::Poller;
3666    ///
3667    /// let builder = prepare_request_builder();
3668    /// let response = builder.poller().until_done().await?;
3669    /// # Ok(()) }
3670    ///
3671    /// fn prepare_request_builder() -> CreateModel {
3672    ///   # panic!();
3673    ///   // ... details omitted ...
3674    /// }
3675    /// ```
3676    #[derive(Clone, Debug)]
3677    pub struct CreateModel(RequestBuilder<crate::model::CreateModelRequest>);
3678
3679    impl CreateModel {
3680        pub(crate) fn new(
3681            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3682        ) -> Self {
3683            Self(RequestBuilder::new(stub))
3684        }
3685
3686        /// Sets the full request, replacing any prior values.
3687        pub fn with_request<V: Into<crate::model::CreateModelRequest>>(mut self, v: V) -> Self {
3688            self.0.request = v.into();
3689            self
3690        }
3691
3692        /// Sets all the options, replacing any prior values.
3693        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3694            self.0.options = v.into();
3695            self
3696        }
3697
3698        /// Sends the request.
3699        ///
3700        /// # Long running operations
3701        ///
3702        /// This starts, but does not poll, a longrunning operation. More information
3703        /// on [create_model][crate::client::ModelService::create_model].
3704        pub async fn send(self) -> Result<longrunning::model::Operation> {
3705            (*self.0.stub)
3706                .create_model(self.0.request, self.0.options)
3707                .await
3708                .map(gax::response::Response::into_body)
3709        }
3710
3711        /// Creates a [Poller][lro::Poller] to work with `create_model`.
3712        pub fn poller(
3713            self,
3714        ) -> impl lro::Poller<crate::model::Model, crate::model::CreateModelMetadata> {
3715            type Operation =
3716                lro::internal::Operation<crate::model::Model, crate::model::CreateModelMetadata>;
3717            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3718            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3719
3720            let stub = self.0.stub.clone();
3721            let mut options = self.0.options.clone();
3722            options.set_retry_policy(gax::retry_policy::NeverRetry);
3723            let query = move |name| {
3724                let stub = stub.clone();
3725                let options = options.clone();
3726                async {
3727                    let op = GetOperation::new(stub)
3728                        .set_name(name)
3729                        .with_options(options)
3730                        .send()
3731                        .await?;
3732                    Ok(Operation::new(op))
3733                }
3734            };
3735
3736            let start = move || async {
3737                let op = self.send().await?;
3738                Ok(Operation::new(op))
3739            };
3740
3741            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3742        }
3743
3744        /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
3745        ///
3746        /// This is a **required** field for requests.
3747        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3748            self.0.request.parent = v.into();
3749            self
3750        }
3751
3752        /// Sets the value of [model][crate::model::CreateModelRequest::model].
3753        ///
3754        /// This is a **required** field for requests.
3755        pub fn set_model<T>(mut self, v: T) -> Self
3756        where
3757            T: std::convert::Into<crate::model::Model>,
3758        {
3759            self.0.request.model = std::option::Option::Some(v.into());
3760            self
3761        }
3762
3763        /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
3764        ///
3765        /// This is a **required** field for requests.
3766        pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3767        where
3768            T: std::convert::Into<crate::model::Model>,
3769        {
3770            self.0.request.model = v.map(|x| x.into());
3771            self
3772        }
3773
3774        /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
3775        pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
3776            self.0.request.dry_run = v.into();
3777            self
3778        }
3779    }
3780
3781    #[doc(hidden)]
3782    impl gax::options::internal::RequestBuilder for CreateModel {
3783        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3784            &mut self.0.options
3785        }
3786    }
3787
3788    /// The request builder for [ModelService::get_model][crate::client::ModelService::get_model] calls.
3789    ///
3790    /// # Example
3791    /// ```
3792    /// # use google_cloud_retail_v2::builder::model_service::GetModel;
3793    /// # async fn sample() -> gax::Result<()> {
3794    ///
3795    /// let builder = prepare_request_builder();
3796    /// let response = builder.send().await?;
3797    /// # Ok(()) }
3798    ///
3799    /// fn prepare_request_builder() -> GetModel {
3800    ///   # panic!();
3801    ///   // ... details omitted ...
3802    /// }
3803    /// ```
3804    #[derive(Clone, Debug)]
3805    pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
3806
3807    impl GetModel {
3808        pub(crate) fn new(
3809            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3810        ) -> Self {
3811            Self(RequestBuilder::new(stub))
3812        }
3813
3814        /// Sets the full request, replacing any prior values.
3815        pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
3816            self.0.request = v.into();
3817            self
3818        }
3819
3820        /// Sets all the options, replacing any prior values.
3821        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3822            self.0.options = v.into();
3823            self
3824        }
3825
3826        /// Sends the request.
3827        pub async fn send(self) -> Result<crate::model::Model> {
3828            (*self.0.stub)
3829                .get_model(self.0.request, self.0.options)
3830                .await
3831                .map(gax::response::Response::into_body)
3832        }
3833
3834        /// Sets the value of [name][crate::model::GetModelRequest::name].
3835        ///
3836        /// This is a **required** field for requests.
3837        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3838            self.0.request.name = v.into();
3839            self
3840        }
3841    }
3842
3843    #[doc(hidden)]
3844    impl gax::options::internal::RequestBuilder for GetModel {
3845        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3846            &mut self.0.options
3847        }
3848    }
3849
3850    /// The request builder for [ModelService::pause_model][crate::client::ModelService::pause_model] calls.
3851    ///
3852    /// # Example
3853    /// ```
3854    /// # use google_cloud_retail_v2::builder::model_service::PauseModel;
3855    /// # async fn sample() -> gax::Result<()> {
3856    ///
3857    /// let builder = prepare_request_builder();
3858    /// let response = builder.send().await?;
3859    /// # Ok(()) }
3860    ///
3861    /// fn prepare_request_builder() -> PauseModel {
3862    ///   # panic!();
3863    ///   // ... details omitted ...
3864    /// }
3865    /// ```
3866    #[derive(Clone, Debug)]
3867    pub struct PauseModel(RequestBuilder<crate::model::PauseModelRequest>);
3868
3869    impl PauseModel {
3870        pub(crate) fn new(
3871            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3872        ) -> Self {
3873            Self(RequestBuilder::new(stub))
3874        }
3875
3876        /// Sets the full request, replacing any prior values.
3877        pub fn with_request<V: Into<crate::model::PauseModelRequest>>(mut self, v: V) -> Self {
3878            self.0.request = v.into();
3879            self
3880        }
3881
3882        /// Sets all the options, replacing any prior values.
3883        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3884            self.0.options = v.into();
3885            self
3886        }
3887
3888        /// Sends the request.
3889        pub async fn send(self) -> Result<crate::model::Model> {
3890            (*self.0.stub)
3891                .pause_model(self.0.request, self.0.options)
3892                .await
3893                .map(gax::response::Response::into_body)
3894        }
3895
3896        /// Sets the value of [name][crate::model::PauseModelRequest::name].
3897        ///
3898        /// This is a **required** field for requests.
3899        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3900            self.0.request.name = v.into();
3901            self
3902        }
3903    }
3904
3905    #[doc(hidden)]
3906    impl gax::options::internal::RequestBuilder for PauseModel {
3907        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3908            &mut self.0.options
3909        }
3910    }
3911
3912    /// The request builder for [ModelService::resume_model][crate::client::ModelService::resume_model] calls.
3913    ///
3914    /// # Example
3915    /// ```
3916    /// # use google_cloud_retail_v2::builder::model_service::ResumeModel;
3917    /// # async fn sample() -> gax::Result<()> {
3918    ///
3919    /// let builder = prepare_request_builder();
3920    /// let response = builder.send().await?;
3921    /// # Ok(()) }
3922    ///
3923    /// fn prepare_request_builder() -> ResumeModel {
3924    ///   # panic!();
3925    ///   // ... details omitted ...
3926    /// }
3927    /// ```
3928    #[derive(Clone, Debug)]
3929    pub struct ResumeModel(RequestBuilder<crate::model::ResumeModelRequest>);
3930
3931    impl ResumeModel {
3932        pub(crate) fn new(
3933            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3934        ) -> Self {
3935            Self(RequestBuilder::new(stub))
3936        }
3937
3938        /// Sets the full request, replacing any prior values.
3939        pub fn with_request<V: Into<crate::model::ResumeModelRequest>>(mut self, v: V) -> Self {
3940            self.0.request = v.into();
3941            self
3942        }
3943
3944        /// Sets all the options, replacing any prior values.
3945        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3946            self.0.options = v.into();
3947            self
3948        }
3949
3950        /// Sends the request.
3951        pub async fn send(self) -> Result<crate::model::Model> {
3952            (*self.0.stub)
3953                .resume_model(self.0.request, self.0.options)
3954                .await
3955                .map(gax::response::Response::into_body)
3956        }
3957
3958        /// Sets the value of [name][crate::model::ResumeModelRequest::name].
3959        ///
3960        /// This is a **required** field for requests.
3961        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3962            self.0.request.name = v.into();
3963            self
3964        }
3965    }
3966
3967    #[doc(hidden)]
3968    impl gax::options::internal::RequestBuilder for ResumeModel {
3969        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3970            &mut self.0.options
3971        }
3972    }
3973
3974    /// The request builder for [ModelService::delete_model][crate::client::ModelService::delete_model] calls.
3975    ///
3976    /// # Example
3977    /// ```
3978    /// # use google_cloud_retail_v2::builder::model_service::DeleteModel;
3979    /// # async fn sample() -> gax::Result<()> {
3980    ///
3981    /// let builder = prepare_request_builder();
3982    /// let response = builder.send().await?;
3983    /// # Ok(()) }
3984    ///
3985    /// fn prepare_request_builder() -> DeleteModel {
3986    ///   # panic!();
3987    ///   // ... details omitted ...
3988    /// }
3989    /// ```
3990    #[derive(Clone, Debug)]
3991    pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
3992
3993    impl DeleteModel {
3994        pub(crate) fn new(
3995            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3996        ) -> Self {
3997            Self(RequestBuilder::new(stub))
3998        }
3999
4000        /// Sets the full request, replacing any prior values.
4001        pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
4002            self.0.request = v.into();
4003            self
4004        }
4005
4006        /// Sets all the options, replacing any prior values.
4007        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4008            self.0.options = v.into();
4009            self
4010        }
4011
4012        /// Sends the request.
4013        pub async fn send(self) -> Result<()> {
4014            (*self.0.stub)
4015                .delete_model(self.0.request, self.0.options)
4016                .await
4017                .map(gax::response::Response::into_body)
4018        }
4019
4020        /// Sets the value of [name][crate::model::DeleteModelRequest::name].
4021        ///
4022        /// This is a **required** field for requests.
4023        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4024            self.0.request.name = v.into();
4025            self
4026        }
4027    }
4028
4029    #[doc(hidden)]
4030    impl gax::options::internal::RequestBuilder for DeleteModel {
4031        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4032            &mut self.0.options
4033        }
4034    }
4035
4036    /// The request builder for [ModelService::list_models][crate::client::ModelService::list_models] calls.
4037    ///
4038    /// # Example
4039    /// ```
4040    /// # use google_cloud_retail_v2::builder::model_service::ListModels;
4041    /// # async fn sample() -> gax::Result<()> {
4042    /// use gax::paginator::ItemPaginator;
4043    ///
4044    /// let builder = prepare_request_builder();
4045    /// let mut items = builder.by_item();
4046    /// while let Some(result) = items.next().await {
4047    ///   let item = result?;
4048    /// }
4049    /// # Ok(()) }
4050    ///
4051    /// fn prepare_request_builder() -> ListModels {
4052    ///   # panic!();
4053    ///   // ... details omitted ...
4054    /// }
4055    /// ```
4056    #[derive(Clone, Debug)]
4057    pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
4058
4059    impl ListModels {
4060        pub(crate) fn new(
4061            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4062        ) -> Self {
4063            Self(RequestBuilder::new(stub))
4064        }
4065
4066        /// Sets the full request, replacing any prior values.
4067        pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
4068            self.0.request = v.into();
4069            self
4070        }
4071
4072        /// Sets all the options, replacing any prior values.
4073        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4074            self.0.options = v.into();
4075            self
4076        }
4077
4078        /// Sends the request.
4079        pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
4080            (*self.0.stub)
4081                .list_models(self.0.request, self.0.options)
4082                .await
4083                .map(gax::response::Response::into_body)
4084        }
4085
4086        /// Streams each page in the collection.
4087        pub fn by_page(
4088            self,
4089        ) -> impl gax::paginator::Paginator<crate::model::ListModelsResponse, gax::error::Error>
4090        {
4091            use std::clone::Clone;
4092            let token = self.0.request.page_token.clone();
4093            let execute = move |token: String| {
4094                let mut builder = self.clone();
4095                builder.0.request = builder.0.request.set_page_token(token);
4096                builder.send()
4097            };
4098            gax::paginator::internal::new_paginator(token, execute)
4099        }
4100
4101        /// Streams each item in the collection.
4102        pub fn by_item(
4103            self,
4104        ) -> impl gax::paginator::ItemPaginator<crate::model::ListModelsResponse, gax::error::Error>
4105        {
4106            use gax::paginator::Paginator;
4107            self.by_page().items()
4108        }
4109
4110        /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
4111        ///
4112        /// This is a **required** field for requests.
4113        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4114            self.0.request.parent = v.into();
4115            self
4116        }
4117
4118        /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
4119        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4120            self.0.request.page_size = v.into();
4121            self
4122        }
4123
4124        /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
4125        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4126            self.0.request.page_token = v.into();
4127            self
4128        }
4129    }
4130
4131    #[doc(hidden)]
4132    impl gax::options::internal::RequestBuilder for ListModels {
4133        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4134            &mut self.0.options
4135        }
4136    }
4137
4138    /// The request builder for [ModelService::update_model][crate::client::ModelService::update_model] calls.
4139    ///
4140    /// # Example
4141    /// ```
4142    /// # use google_cloud_retail_v2::builder::model_service::UpdateModel;
4143    /// # async fn sample() -> gax::Result<()> {
4144    ///
4145    /// let builder = prepare_request_builder();
4146    /// let response = builder.send().await?;
4147    /// # Ok(()) }
4148    ///
4149    /// fn prepare_request_builder() -> UpdateModel {
4150    ///   # panic!();
4151    ///   // ... details omitted ...
4152    /// }
4153    /// ```
4154    #[derive(Clone, Debug)]
4155    pub struct UpdateModel(RequestBuilder<crate::model::UpdateModelRequest>);
4156
4157    impl UpdateModel {
4158        pub(crate) fn new(
4159            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
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::UpdateModelRequest>>(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<gax::options::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::Model> {
4178            (*self.0.stub)
4179                .update_model(self.0.request, self.0.options)
4180                .await
4181                .map(gax::response::Response::into_body)
4182        }
4183
4184        /// Sets the value of [model][crate::model::UpdateModelRequest::model].
4185        ///
4186        /// This is a **required** field for requests.
4187        pub fn set_model<T>(mut self, v: T) -> Self
4188        where
4189            T: std::convert::Into<crate::model::Model>,
4190        {
4191            self.0.request.model = std::option::Option::Some(v.into());
4192            self
4193        }
4194
4195        /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
4196        ///
4197        /// This is a **required** field for requests.
4198        pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
4199        where
4200            T: std::convert::Into<crate::model::Model>,
4201        {
4202            self.0.request.model = v.map(|x| x.into());
4203            self
4204        }
4205
4206        /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
4207        pub fn set_update_mask<T>(mut self, v: T) -> Self
4208        where
4209            T: std::convert::Into<wkt::FieldMask>,
4210        {
4211            self.0.request.update_mask = std::option::Option::Some(v.into());
4212            self
4213        }
4214
4215        /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
4216        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4217        where
4218            T: std::convert::Into<wkt::FieldMask>,
4219        {
4220            self.0.request.update_mask = v.map(|x| x.into());
4221            self
4222        }
4223    }
4224
4225    #[doc(hidden)]
4226    impl gax::options::internal::RequestBuilder for UpdateModel {
4227        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4228            &mut self.0.options
4229        }
4230    }
4231
4232    /// The request builder for [ModelService::tune_model][crate::client::ModelService::tune_model] calls.
4233    ///
4234    /// # Example
4235    /// ```
4236    /// # use google_cloud_retail_v2::builder::model_service::TuneModel;
4237    /// # async fn sample() -> gax::Result<()> {
4238    /// use lro::Poller;
4239    ///
4240    /// let builder = prepare_request_builder();
4241    /// let response = builder.poller().until_done().await?;
4242    /// # Ok(()) }
4243    ///
4244    /// fn prepare_request_builder() -> TuneModel {
4245    ///   # panic!();
4246    ///   // ... details omitted ...
4247    /// }
4248    /// ```
4249    #[derive(Clone, Debug)]
4250    pub struct TuneModel(RequestBuilder<crate::model::TuneModelRequest>);
4251
4252    impl TuneModel {
4253        pub(crate) fn new(
4254            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4255        ) -> Self {
4256            Self(RequestBuilder::new(stub))
4257        }
4258
4259        /// Sets the full request, replacing any prior values.
4260        pub fn with_request<V: Into<crate::model::TuneModelRequest>>(mut self, v: V) -> Self {
4261            self.0.request = v.into();
4262            self
4263        }
4264
4265        /// Sets all the options, replacing any prior values.
4266        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4267            self.0.options = v.into();
4268            self
4269        }
4270
4271        /// Sends the request.
4272        ///
4273        /// # Long running operations
4274        ///
4275        /// This starts, but does not poll, a longrunning operation. More information
4276        /// on [tune_model][crate::client::ModelService::tune_model].
4277        pub async fn send(self) -> Result<longrunning::model::Operation> {
4278            (*self.0.stub)
4279                .tune_model(self.0.request, self.0.options)
4280                .await
4281                .map(gax::response::Response::into_body)
4282        }
4283
4284        /// Creates a [Poller][lro::Poller] to work with `tune_model`.
4285        pub fn poller(
4286            self,
4287        ) -> impl lro::Poller<crate::model::TuneModelResponse, crate::model::TuneModelMetadata>
4288        {
4289            type Operation = lro::internal::Operation<
4290                crate::model::TuneModelResponse,
4291                crate::model::TuneModelMetadata,
4292            >;
4293            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4294            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4295
4296            let stub = self.0.stub.clone();
4297            let mut options = self.0.options.clone();
4298            options.set_retry_policy(gax::retry_policy::NeverRetry);
4299            let query = move |name| {
4300                let stub = stub.clone();
4301                let options = options.clone();
4302                async {
4303                    let op = GetOperation::new(stub)
4304                        .set_name(name)
4305                        .with_options(options)
4306                        .send()
4307                        .await?;
4308                    Ok(Operation::new(op))
4309                }
4310            };
4311
4312            let start = move || async {
4313                let op = self.send().await?;
4314                Ok(Operation::new(op))
4315            };
4316
4317            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4318        }
4319
4320        /// Sets the value of [name][crate::model::TuneModelRequest::name].
4321        ///
4322        /// This is a **required** field for requests.
4323        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4324            self.0.request.name = v.into();
4325            self
4326        }
4327    }
4328
4329    #[doc(hidden)]
4330    impl gax::options::internal::RequestBuilder for TuneModel {
4331        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4332            &mut self.0.options
4333        }
4334    }
4335
4336    /// The request builder for [ModelService::list_operations][crate::client::ModelService::list_operations] calls.
4337    ///
4338    /// # Example
4339    /// ```
4340    /// # use google_cloud_retail_v2::builder::model_service::ListOperations;
4341    /// # async fn sample() -> gax::Result<()> {
4342    /// use gax::paginator::ItemPaginator;
4343    ///
4344    /// let builder = prepare_request_builder();
4345    /// let mut items = builder.by_item();
4346    /// while let Some(result) = items.next().await {
4347    ///   let item = result?;
4348    /// }
4349    /// # Ok(()) }
4350    ///
4351    /// fn prepare_request_builder() -> ListOperations {
4352    ///   # panic!();
4353    ///   // ... details omitted ...
4354    /// }
4355    /// ```
4356    #[derive(Clone, Debug)]
4357    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4358
4359    impl ListOperations {
4360        pub(crate) fn new(
4361            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4362        ) -> Self {
4363            Self(RequestBuilder::new(stub))
4364        }
4365
4366        /// Sets the full request, replacing any prior values.
4367        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4368            mut self,
4369            v: V,
4370        ) -> Self {
4371            self.0.request = v.into();
4372            self
4373        }
4374
4375        /// Sets all the options, replacing any prior values.
4376        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4377            self.0.options = v.into();
4378            self
4379        }
4380
4381        /// Sends the request.
4382        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4383            (*self.0.stub)
4384                .list_operations(self.0.request, self.0.options)
4385                .await
4386                .map(gax::response::Response::into_body)
4387        }
4388
4389        /// Streams each page in the collection.
4390        pub fn by_page(
4391            self,
4392        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4393        {
4394            use std::clone::Clone;
4395            let token = self.0.request.page_token.clone();
4396            let execute = move |token: String| {
4397                let mut builder = self.clone();
4398                builder.0.request = builder.0.request.set_page_token(token);
4399                builder.send()
4400            };
4401            gax::paginator::internal::new_paginator(token, execute)
4402        }
4403
4404        /// Streams each item in the collection.
4405        pub fn by_item(
4406            self,
4407        ) -> impl gax::paginator::ItemPaginator<
4408            longrunning::model::ListOperationsResponse,
4409            gax::error::Error,
4410        > {
4411            use gax::paginator::Paginator;
4412            self.by_page().items()
4413        }
4414
4415        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4416        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4417            self.0.request.name = v.into();
4418            self
4419        }
4420
4421        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4422        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4423            self.0.request.filter = v.into();
4424            self
4425        }
4426
4427        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4428        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4429            self.0.request.page_size = v.into();
4430            self
4431        }
4432
4433        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4434        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4435            self.0.request.page_token = v.into();
4436            self
4437        }
4438
4439        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4440        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4441            self.0.request.return_partial_success = v.into();
4442            self
4443        }
4444    }
4445
4446    #[doc(hidden)]
4447    impl gax::options::internal::RequestBuilder for ListOperations {
4448        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4449            &mut self.0.options
4450        }
4451    }
4452
4453    /// The request builder for [ModelService::get_operation][crate::client::ModelService::get_operation] calls.
4454    ///
4455    /// # Example
4456    /// ```
4457    /// # use google_cloud_retail_v2::builder::model_service::GetOperation;
4458    /// # async fn sample() -> gax::Result<()> {
4459    ///
4460    /// let builder = prepare_request_builder();
4461    /// let response = builder.send().await?;
4462    /// # Ok(()) }
4463    ///
4464    /// fn prepare_request_builder() -> GetOperation {
4465    ///   # panic!();
4466    ///   // ... details omitted ...
4467    /// }
4468    /// ```
4469    #[derive(Clone, Debug)]
4470    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4471
4472    impl GetOperation {
4473        pub(crate) fn new(
4474            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4475        ) -> Self {
4476            Self(RequestBuilder::new(stub))
4477        }
4478
4479        /// Sets the full request, replacing any prior values.
4480        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4481            mut self,
4482            v: V,
4483        ) -> Self {
4484            self.0.request = v.into();
4485            self
4486        }
4487
4488        /// Sets all the options, replacing any prior values.
4489        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4490            self.0.options = v.into();
4491            self
4492        }
4493
4494        /// Sends the request.
4495        pub async fn send(self) -> Result<longrunning::model::Operation> {
4496            (*self.0.stub)
4497                .get_operation(self.0.request, self.0.options)
4498                .await
4499                .map(gax::response::Response::into_body)
4500        }
4501
4502        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4503        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4504            self.0.request.name = v.into();
4505            self
4506        }
4507    }
4508
4509    #[doc(hidden)]
4510    impl gax::options::internal::RequestBuilder for GetOperation {
4511        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4512            &mut self.0.options
4513        }
4514    }
4515}
4516
4517pub mod prediction_service {
4518    use crate::Result;
4519
4520    /// A builder for [PredictionService][crate::client::PredictionService].
4521    ///
4522    /// ```
4523    /// # async fn sample() -> gax::client_builder::Result<()> {
4524    /// # use google_cloud_retail_v2::*;
4525    /// # use builder::prediction_service::ClientBuilder;
4526    /// # use client::PredictionService;
4527    /// let builder : ClientBuilder = PredictionService::builder();
4528    /// let client = builder
4529    ///     .with_endpoint("https://retail.googleapis.com")
4530    ///     .build().await?;
4531    /// # Ok(()) }
4532    /// ```
4533    pub type ClientBuilder =
4534        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4535
4536    pub(crate) mod client {
4537        use super::super::super::client::PredictionService;
4538        pub struct Factory;
4539        impl gax::client_builder::internal::ClientFactory for Factory {
4540            type Client = PredictionService;
4541            type Credentials = gaxi::options::Credentials;
4542            async fn build(
4543                self,
4544                config: gaxi::options::ClientConfig,
4545            ) -> gax::client_builder::Result<Self::Client> {
4546                Self::Client::new(config).await
4547            }
4548        }
4549    }
4550
4551    /// Common implementation for [crate::client::PredictionService] request builders.
4552    #[derive(Clone, Debug)]
4553    pub(crate) struct RequestBuilder<R: std::default::Default> {
4554        stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4555        request: R,
4556        options: gax::options::RequestOptions,
4557    }
4558
4559    impl<R> RequestBuilder<R>
4560    where
4561        R: std::default::Default,
4562    {
4563        pub(crate) fn new(
4564            stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4565        ) -> Self {
4566            Self {
4567                stub,
4568                request: R::default(),
4569                options: gax::options::RequestOptions::default(),
4570            }
4571        }
4572    }
4573
4574    /// The request builder for [PredictionService::predict][crate::client::PredictionService::predict] calls.
4575    ///
4576    /// # Example
4577    /// ```
4578    /// # use google_cloud_retail_v2::builder::prediction_service::Predict;
4579    /// # async fn sample() -> gax::Result<()> {
4580    ///
4581    /// let builder = prepare_request_builder();
4582    /// let response = builder.send().await?;
4583    /// # Ok(()) }
4584    ///
4585    /// fn prepare_request_builder() -> Predict {
4586    ///   # panic!();
4587    ///   // ... details omitted ...
4588    /// }
4589    /// ```
4590    #[derive(Clone, Debug)]
4591    pub struct Predict(RequestBuilder<crate::model::PredictRequest>);
4592
4593    impl Predict {
4594        pub(crate) fn new(
4595            stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4596        ) -> Self {
4597            Self(RequestBuilder::new(stub))
4598        }
4599
4600        /// Sets the full request, replacing any prior values.
4601        pub fn with_request<V: Into<crate::model::PredictRequest>>(mut self, v: V) -> Self {
4602            self.0.request = v.into();
4603            self
4604        }
4605
4606        /// Sets all the options, replacing any prior values.
4607        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4608            self.0.options = v.into();
4609            self
4610        }
4611
4612        /// Sends the request.
4613        pub async fn send(self) -> Result<crate::model::PredictResponse> {
4614            (*self.0.stub)
4615                .predict(self.0.request, self.0.options)
4616                .await
4617                .map(gax::response::Response::into_body)
4618        }
4619
4620        /// Sets the value of [placement][crate::model::PredictRequest::placement].
4621        ///
4622        /// This is a **required** field for requests.
4623        pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
4624            self.0.request.placement = v.into();
4625            self
4626        }
4627
4628        /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
4629        ///
4630        /// This is a **required** field for requests.
4631        pub fn set_user_event<T>(mut self, v: T) -> Self
4632        where
4633            T: std::convert::Into<crate::model::UserEvent>,
4634        {
4635            self.0.request.user_event = std::option::Option::Some(v.into());
4636            self
4637        }
4638
4639        /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
4640        ///
4641        /// This is a **required** field for requests.
4642        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
4643        where
4644            T: std::convert::Into<crate::model::UserEvent>,
4645        {
4646            self.0.request.user_event = v.map(|x| x.into());
4647            self
4648        }
4649
4650        /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
4651        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4652            self.0.request.page_size = v.into();
4653            self
4654        }
4655
4656        /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
4657        #[deprecated]
4658        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4659            self.0.request.page_token = v.into();
4660            self
4661        }
4662
4663        /// Sets the value of [filter][crate::model::PredictRequest::filter].
4664        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4665            self.0.request.filter = v.into();
4666            self
4667        }
4668
4669        /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
4670        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4671            self.0.request.validate_only = v.into();
4672            self
4673        }
4674
4675        /// Sets the value of [params][crate::model::PredictRequest::params].
4676        pub fn set_params<T, K, V>(mut self, v: T) -> Self
4677        where
4678            T: std::iter::IntoIterator<Item = (K, V)>,
4679            K: std::convert::Into<std::string::String>,
4680            V: std::convert::Into<wkt::Value>,
4681        {
4682            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4683            self
4684        }
4685
4686        /// Sets the value of [labels][crate::model::PredictRequest::labels].
4687        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4688        where
4689            T: std::iter::IntoIterator<Item = (K, V)>,
4690            K: std::convert::Into<std::string::String>,
4691            V: std::convert::Into<std::string::String>,
4692        {
4693            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4694            self
4695        }
4696    }
4697
4698    #[doc(hidden)]
4699    impl gax::options::internal::RequestBuilder for Predict {
4700        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4701            &mut self.0.options
4702        }
4703    }
4704
4705    /// The request builder for [PredictionService::list_operations][crate::client::PredictionService::list_operations] calls.
4706    ///
4707    /// # Example
4708    /// ```
4709    /// # use google_cloud_retail_v2::builder::prediction_service::ListOperations;
4710    /// # async fn sample() -> gax::Result<()> {
4711    /// use gax::paginator::ItemPaginator;
4712    ///
4713    /// let builder = prepare_request_builder();
4714    /// let mut items = builder.by_item();
4715    /// while let Some(result) = items.next().await {
4716    ///   let item = result?;
4717    /// }
4718    /// # Ok(()) }
4719    ///
4720    /// fn prepare_request_builder() -> ListOperations {
4721    ///   # panic!();
4722    ///   // ... details omitted ...
4723    /// }
4724    /// ```
4725    #[derive(Clone, Debug)]
4726    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4727
4728    impl ListOperations {
4729        pub(crate) fn new(
4730            stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4731        ) -> Self {
4732            Self(RequestBuilder::new(stub))
4733        }
4734
4735        /// Sets the full request, replacing any prior values.
4736        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4737            mut self,
4738            v: V,
4739        ) -> Self {
4740            self.0.request = v.into();
4741            self
4742        }
4743
4744        /// Sets all the options, replacing any prior values.
4745        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4746            self.0.options = v.into();
4747            self
4748        }
4749
4750        /// Sends the request.
4751        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4752            (*self.0.stub)
4753                .list_operations(self.0.request, self.0.options)
4754                .await
4755                .map(gax::response::Response::into_body)
4756        }
4757
4758        /// Streams each page in the collection.
4759        pub fn by_page(
4760            self,
4761        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4762        {
4763            use std::clone::Clone;
4764            let token = self.0.request.page_token.clone();
4765            let execute = move |token: String| {
4766                let mut builder = self.clone();
4767                builder.0.request = builder.0.request.set_page_token(token);
4768                builder.send()
4769            };
4770            gax::paginator::internal::new_paginator(token, execute)
4771        }
4772
4773        /// Streams each item in the collection.
4774        pub fn by_item(
4775            self,
4776        ) -> impl gax::paginator::ItemPaginator<
4777            longrunning::model::ListOperationsResponse,
4778            gax::error::Error,
4779        > {
4780            use gax::paginator::Paginator;
4781            self.by_page().items()
4782        }
4783
4784        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4785        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4786            self.0.request.name = v.into();
4787            self
4788        }
4789
4790        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4791        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4792            self.0.request.filter = v.into();
4793            self
4794        }
4795
4796        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4797        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4798            self.0.request.page_size = v.into();
4799            self
4800        }
4801
4802        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4803        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4804            self.0.request.page_token = v.into();
4805            self
4806        }
4807
4808        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4809        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4810            self.0.request.return_partial_success = v.into();
4811            self
4812        }
4813    }
4814
4815    #[doc(hidden)]
4816    impl gax::options::internal::RequestBuilder for ListOperations {
4817        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4818            &mut self.0.options
4819        }
4820    }
4821
4822    /// The request builder for [PredictionService::get_operation][crate::client::PredictionService::get_operation] calls.
4823    ///
4824    /// # Example
4825    /// ```
4826    /// # use google_cloud_retail_v2::builder::prediction_service::GetOperation;
4827    /// # async fn sample() -> gax::Result<()> {
4828    ///
4829    /// let builder = prepare_request_builder();
4830    /// let response = builder.send().await?;
4831    /// # Ok(()) }
4832    ///
4833    /// fn prepare_request_builder() -> GetOperation {
4834    ///   # panic!();
4835    ///   // ... details omitted ...
4836    /// }
4837    /// ```
4838    #[derive(Clone, Debug)]
4839    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4840
4841    impl GetOperation {
4842        pub(crate) fn new(
4843            stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4844        ) -> Self {
4845            Self(RequestBuilder::new(stub))
4846        }
4847
4848        /// Sets the full request, replacing any prior values.
4849        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4850            mut self,
4851            v: V,
4852        ) -> Self {
4853            self.0.request = v.into();
4854            self
4855        }
4856
4857        /// Sets all the options, replacing any prior values.
4858        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4859            self.0.options = v.into();
4860            self
4861        }
4862
4863        /// Sends the request.
4864        pub async fn send(self) -> Result<longrunning::model::Operation> {
4865            (*self.0.stub)
4866                .get_operation(self.0.request, self.0.options)
4867                .await
4868                .map(gax::response::Response::into_body)
4869        }
4870
4871        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4872        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4873            self.0.request.name = v.into();
4874            self
4875        }
4876    }
4877
4878    #[doc(hidden)]
4879    impl gax::options::internal::RequestBuilder for GetOperation {
4880        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4881            &mut self.0.options
4882        }
4883    }
4884}
4885
4886pub mod product_service {
4887    use crate::Result;
4888
4889    /// A builder for [ProductService][crate::client::ProductService].
4890    ///
4891    /// ```
4892    /// # async fn sample() -> gax::client_builder::Result<()> {
4893    /// # use google_cloud_retail_v2::*;
4894    /// # use builder::product_service::ClientBuilder;
4895    /// # use client::ProductService;
4896    /// let builder : ClientBuilder = ProductService::builder();
4897    /// let client = builder
4898    ///     .with_endpoint("https://retail.googleapis.com")
4899    ///     .build().await?;
4900    /// # Ok(()) }
4901    /// ```
4902    pub type ClientBuilder =
4903        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4904
4905    pub(crate) mod client {
4906        use super::super::super::client::ProductService;
4907        pub struct Factory;
4908        impl gax::client_builder::internal::ClientFactory for Factory {
4909            type Client = ProductService;
4910            type Credentials = gaxi::options::Credentials;
4911            async fn build(
4912                self,
4913                config: gaxi::options::ClientConfig,
4914            ) -> gax::client_builder::Result<Self::Client> {
4915                Self::Client::new(config).await
4916            }
4917        }
4918    }
4919
4920    /// Common implementation for [crate::client::ProductService] request builders.
4921    #[derive(Clone, Debug)]
4922    pub(crate) struct RequestBuilder<R: std::default::Default> {
4923        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4924        request: R,
4925        options: gax::options::RequestOptions,
4926    }
4927
4928    impl<R> RequestBuilder<R>
4929    where
4930        R: std::default::Default,
4931    {
4932        pub(crate) fn new(
4933            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4934        ) -> Self {
4935            Self {
4936                stub,
4937                request: R::default(),
4938                options: gax::options::RequestOptions::default(),
4939            }
4940        }
4941    }
4942
4943    /// The request builder for [ProductService::create_product][crate::client::ProductService::create_product] calls.
4944    ///
4945    /// # Example
4946    /// ```
4947    /// # use google_cloud_retail_v2::builder::product_service::CreateProduct;
4948    /// # async fn sample() -> gax::Result<()> {
4949    ///
4950    /// let builder = prepare_request_builder();
4951    /// let response = builder.send().await?;
4952    /// # Ok(()) }
4953    ///
4954    /// fn prepare_request_builder() -> CreateProduct {
4955    ///   # panic!();
4956    ///   // ... details omitted ...
4957    /// }
4958    /// ```
4959    #[derive(Clone, Debug)]
4960    pub struct CreateProduct(RequestBuilder<crate::model::CreateProductRequest>);
4961
4962    impl CreateProduct {
4963        pub(crate) fn new(
4964            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4965        ) -> Self {
4966            Self(RequestBuilder::new(stub))
4967        }
4968
4969        /// Sets the full request, replacing any prior values.
4970        pub fn with_request<V: Into<crate::model::CreateProductRequest>>(mut self, v: V) -> Self {
4971            self.0.request = v.into();
4972            self
4973        }
4974
4975        /// Sets all the options, replacing any prior values.
4976        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4977            self.0.options = v.into();
4978            self
4979        }
4980
4981        /// Sends the request.
4982        pub async fn send(self) -> Result<crate::model::Product> {
4983            (*self.0.stub)
4984                .create_product(self.0.request, self.0.options)
4985                .await
4986                .map(gax::response::Response::into_body)
4987        }
4988
4989        /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
4990        ///
4991        /// This is a **required** field for requests.
4992        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4993            self.0.request.parent = v.into();
4994            self
4995        }
4996
4997        /// Sets the value of [product][crate::model::CreateProductRequest::product].
4998        ///
4999        /// This is a **required** field for requests.
5000        pub fn set_product<T>(mut self, v: T) -> Self
5001        where
5002            T: std::convert::Into<crate::model::Product>,
5003        {
5004            self.0.request.product = std::option::Option::Some(v.into());
5005            self
5006        }
5007
5008        /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
5009        ///
5010        /// This is a **required** field for requests.
5011        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5012        where
5013            T: std::convert::Into<crate::model::Product>,
5014        {
5015            self.0.request.product = v.map(|x| x.into());
5016            self
5017        }
5018
5019        /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
5020        ///
5021        /// This is a **required** field for requests.
5022        pub fn set_product_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5023            self.0.request.product_id = v.into();
5024            self
5025        }
5026    }
5027
5028    #[doc(hidden)]
5029    impl gax::options::internal::RequestBuilder for CreateProduct {
5030        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5031            &mut self.0.options
5032        }
5033    }
5034
5035    /// The request builder for [ProductService::get_product][crate::client::ProductService::get_product] calls.
5036    ///
5037    /// # Example
5038    /// ```
5039    /// # use google_cloud_retail_v2::builder::product_service::GetProduct;
5040    /// # async fn sample() -> gax::Result<()> {
5041    ///
5042    /// let builder = prepare_request_builder();
5043    /// let response = builder.send().await?;
5044    /// # Ok(()) }
5045    ///
5046    /// fn prepare_request_builder() -> GetProduct {
5047    ///   # panic!();
5048    ///   // ... details omitted ...
5049    /// }
5050    /// ```
5051    #[derive(Clone, Debug)]
5052    pub struct GetProduct(RequestBuilder<crate::model::GetProductRequest>);
5053
5054    impl GetProduct {
5055        pub(crate) fn new(
5056            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5057        ) -> Self {
5058            Self(RequestBuilder::new(stub))
5059        }
5060
5061        /// Sets the full request, replacing any prior values.
5062        pub fn with_request<V: Into<crate::model::GetProductRequest>>(mut self, v: V) -> Self {
5063            self.0.request = v.into();
5064            self
5065        }
5066
5067        /// Sets all the options, replacing any prior values.
5068        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5069            self.0.options = v.into();
5070            self
5071        }
5072
5073        /// Sends the request.
5074        pub async fn send(self) -> Result<crate::model::Product> {
5075            (*self.0.stub)
5076                .get_product(self.0.request, self.0.options)
5077                .await
5078                .map(gax::response::Response::into_body)
5079        }
5080
5081        /// Sets the value of [name][crate::model::GetProductRequest::name].
5082        ///
5083        /// This is a **required** field for requests.
5084        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5085            self.0.request.name = v.into();
5086            self
5087        }
5088    }
5089
5090    #[doc(hidden)]
5091    impl gax::options::internal::RequestBuilder for GetProduct {
5092        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5093            &mut self.0.options
5094        }
5095    }
5096
5097    /// The request builder for [ProductService::list_products][crate::client::ProductService::list_products] calls.
5098    ///
5099    /// # Example
5100    /// ```
5101    /// # use google_cloud_retail_v2::builder::product_service::ListProducts;
5102    /// # async fn sample() -> gax::Result<()> {
5103    /// use gax::paginator::ItemPaginator;
5104    ///
5105    /// let builder = prepare_request_builder();
5106    /// let mut items = builder.by_item();
5107    /// while let Some(result) = items.next().await {
5108    ///   let item = result?;
5109    /// }
5110    /// # Ok(()) }
5111    ///
5112    /// fn prepare_request_builder() -> ListProducts {
5113    ///   # panic!();
5114    ///   // ... details omitted ...
5115    /// }
5116    /// ```
5117    #[derive(Clone, Debug)]
5118    pub struct ListProducts(RequestBuilder<crate::model::ListProductsRequest>);
5119
5120    impl ListProducts {
5121        pub(crate) fn new(
5122            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5123        ) -> Self {
5124            Self(RequestBuilder::new(stub))
5125        }
5126
5127        /// Sets the full request, replacing any prior values.
5128        pub fn with_request<V: Into<crate::model::ListProductsRequest>>(mut self, v: V) -> Self {
5129            self.0.request = v.into();
5130            self
5131        }
5132
5133        /// Sets all the options, replacing any prior values.
5134        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5135            self.0.options = v.into();
5136            self
5137        }
5138
5139        /// Sends the request.
5140        pub async fn send(self) -> Result<crate::model::ListProductsResponse> {
5141            (*self.0.stub)
5142                .list_products(self.0.request, self.0.options)
5143                .await
5144                .map(gax::response::Response::into_body)
5145        }
5146
5147        /// Streams each page in the collection.
5148        pub fn by_page(
5149            self,
5150        ) -> impl gax::paginator::Paginator<crate::model::ListProductsResponse, gax::error::Error>
5151        {
5152            use std::clone::Clone;
5153            let token = self.0.request.page_token.clone();
5154            let execute = move |token: String| {
5155                let mut builder = self.clone();
5156                builder.0.request = builder.0.request.set_page_token(token);
5157                builder.send()
5158            };
5159            gax::paginator::internal::new_paginator(token, execute)
5160        }
5161
5162        /// Streams each item in the collection.
5163        pub fn by_item(
5164            self,
5165        ) -> impl gax::paginator::ItemPaginator<crate::model::ListProductsResponse, gax::error::Error>
5166        {
5167            use gax::paginator::Paginator;
5168            self.by_page().items()
5169        }
5170
5171        /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
5172        ///
5173        /// This is a **required** field for requests.
5174        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5175            self.0.request.parent = v.into();
5176            self
5177        }
5178
5179        /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
5180        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5181            self.0.request.page_size = v.into();
5182            self
5183        }
5184
5185        /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
5186        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5187            self.0.request.page_token = v.into();
5188            self
5189        }
5190
5191        /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
5192        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5193            self.0.request.filter = v.into();
5194            self
5195        }
5196
5197        /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
5198        pub fn set_read_mask<T>(mut self, v: T) -> Self
5199        where
5200            T: std::convert::Into<wkt::FieldMask>,
5201        {
5202            self.0.request.read_mask = std::option::Option::Some(v.into());
5203            self
5204        }
5205
5206        /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
5207        pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5208        where
5209            T: std::convert::Into<wkt::FieldMask>,
5210        {
5211            self.0.request.read_mask = v.map(|x| x.into());
5212            self
5213        }
5214    }
5215
5216    #[doc(hidden)]
5217    impl gax::options::internal::RequestBuilder for ListProducts {
5218        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5219            &mut self.0.options
5220        }
5221    }
5222
5223    /// The request builder for [ProductService::update_product][crate::client::ProductService::update_product] calls.
5224    ///
5225    /// # Example
5226    /// ```
5227    /// # use google_cloud_retail_v2::builder::product_service::UpdateProduct;
5228    /// # async fn sample() -> gax::Result<()> {
5229    ///
5230    /// let builder = prepare_request_builder();
5231    /// let response = builder.send().await?;
5232    /// # Ok(()) }
5233    ///
5234    /// fn prepare_request_builder() -> UpdateProduct {
5235    ///   # panic!();
5236    ///   // ... details omitted ...
5237    /// }
5238    /// ```
5239    #[derive(Clone, Debug)]
5240    pub struct UpdateProduct(RequestBuilder<crate::model::UpdateProductRequest>);
5241
5242    impl UpdateProduct {
5243        pub(crate) fn new(
5244            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5245        ) -> Self {
5246            Self(RequestBuilder::new(stub))
5247        }
5248
5249        /// Sets the full request, replacing any prior values.
5250        pub fn with_request<V: Into<crate::model::UpdateProductRequest>>(mut self, v: V) -> Self {
5251            self.0.request = v.into();
5252            self
5253        }
5254
5255        /// Sets all the options, replacing any prior values.
5256        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5257            self.0.options = v.into();
5258            self
5259        }
5260
5261        /// Sends the request.
5262        pub async fn send(self) -> Result<crate::model::Product> {
5263            (*self.0.stub)
5264                .update_product(self.0.request, self.0.options)
5265                .await
5266                .map(gax::response::Response::into_body)
5267        }
5268
5269        /// Sets the value of [product][crate::model::UpdateProductRequest::product].
5270        ///
5271        /// This is a **required** field for requests.
5272        pub fn set_product<T>(mut self, v: T) -> Self
5273        where
5274            T: std::convert::Into<crate::model::Product>,
5275        {
5276            self.0.request.product = std::option::Option::Some(v.into());
5277            self
5278        }
5279
5280        /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
5281        ///
5282        /// This is a **required** field for requests.
5283        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5284        where
5285            T: std::convert::Into<crate::model::Product>,
5286        {
5287            self.0.request.product = v.map(|x| x.into());
5288            self
5289        }
5290
5291        /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
5292        pub fn set_update_mask<T>(mut self, v: T) -> Self
5293        where
5294            T: std::convert::Into<wkt::FieldMask>,
5295        {
5296            self.0.request.update_mask = std::option::Option::Some(v.into());
5297            self
5298        }
5299
5300        /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
5301        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5302        where
5303            T: std::convert::Into<wkt::FieldMask>,
5304        {
5305            self.0.request.update_mask = v.map(|x| x.into());
5306            self
5307        }
5308
5309        /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
5310        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5311            self.0.request.allow_missing = v.into();
5312            self
5313        }
5314    }
5315
5316    #[doc(hidden)]
5317    impl gax::options::internal::RequestBuilder for UpdateProduct {
5318        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5319            &mut self.0.options
5320        }
5321    }
5322
5323    /// The request builder for [ProductService::delete_product][crate::client::ProductService::delete_product] calls.
5324    ///
5325    /// # Example
5326    /// ```
5327    /// # use google_cloud_retail_v2::builder::product_service::DeleteProduct;
5328    /// # async fn sample() -> gax::Result<()> {
5329    ///
5330    /// let builder = prepare_request_builder();
5331    /// let response = builder.send().await?;
5332    /// # Ok(()) }
5333    ///
5334    /// fn prepare_request_builder() -> DeleteProduct {
5335    ///   # panic!();
5336    ///   // ... details omitted ...
5337    /// }
5338    /// ```
5339    #[derive(Clone, Debug)]
5340    pub struct DeleteProduct(RequestBuilder<crate::model::DeleteProductRequest>);
5341
5342    impl DeleteProduct {
5343        pub(crate) fn new(
5344            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5345        ) -> Self {
5346            Self(RequestBuilder::new(stub))
5347        }
5348
5349        /// Sets the full request, replacing any prior values.
5350        pub fn with_request<V: Into<crate::model::DeleteProductRequest>>(mut self, v: V) -> Self {
5351            self.0.request = v.into();
5352            self
5353        }
5354
5355        /// Sets all the options, replacing any prior values.
5356        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5357            self.0.options = v.into();
5358            self
5359        }
5360
5361        /// Sends the request.
5362        pub async fn send(self) -> Result<()> {
5363            (*self.0.stub)
5364                .delete_product(self.0.request, self.0.options)
5365                .await
5366                .map(gax::response::Response::into_body)
5367        }
5368
5369        /// Sets the value of [name][crate::model::DeleteProductRequest::name].
5370        ///
5371        /// This is a **required** field for requests.
5372        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5373            self.0.request.name = v.into();
5374            self
5375        }
5376    }
5377
5378    #[doc(hidden)]
5379    impl gax::options::internal::RequestBuilder for DeleteProduct {
5380        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5381            &mut self.0.options
5382        }
5383    }
5384
5385    /// The request builder for [ProductService::purge_products][crate::client::ProductService::purge_products] calls.
5386    ///
5387    /// # Example
5388    /// ```
5389    /// # use google_cloud_retail_v2::builder::product_service::PurgeProducts;
5390    /// # async fn sample() -> gax::Result<()> {
5391    /// use lro::Poller;
5392    ///
5393    /// let builder = prepare_request_builder();
5394    /// let response = builder.poller().until_done().await?;
5395    /// # Ok(()) }
5396    ///
5397    /// fn prepare_request_builder() -> PurgeProducts {
5398    ///   # panic!();
5399    ///   // ... details omitted ...
5400    /// }
5401    /// ```
5402    #[derive(Clone, Debug)]
5403    pub struct PurgeProducts(RequestBuilder<crate::model::PurgeProductsRequest>);
5404
5405    impl PurgeProducts {
5406        pub(crate) fn new(
5407            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5408        ) -> Self {
5409            Self(RequestBuilder::new(stub))
5410        }
5411
5412        /// Sets the full request, replacing any prior values.
5413        pub fn with_request<V: Into<crate::model::PurgeProductsRequest>>(mut self, v: V) -> Self {
5414            self.0.request = v.into();
5415            self
5416        }
5417
5418        /// Sets all the options, replacing any prior values.
5419        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5420            self.0.options = v.into();
5421            self
5422        }
5423
5424        /// Sends the request.
5425        ///
5426        /// # Long running operations
5427        ///
5428        /// This starts, but does not poll, a longrunning operation. More information
5429        /// on [purge_products][crate::client::ProductService::purge_products].
5430        pub async fn send(self) -> Result<longrunning::model::Operation> {
5431            (*self.0.stub)
5432                .purge_products(self.0.request, self.0.options)
5433                .await
5434                .map(gax::response::Response::into_body)
5435        }
5436
5437        /// Creates a [Poller][lro::Poller] to work with `purge_products`.
5438        pub fn poller(
5439            self,
5440        ) -> impl lro::Poller<crate::model::PurgeProductsResponse, crate::model::PurgeProductsMetadata>
5441        {
5442            type Operation = lro::internal::Operation<
5443                crate::model::PurgeProductsResponse,
5444                crate::model::PurgeProductsMetadata,
5445            >;
5446            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5447            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5448
5449            let stub = self.0.stub.clone();
5450            let mut options = self.0.options.clone();
5451            options.set_retry_policy(gax::retry_policy::NeverRetry);
5452            let query = move |name| {
5453                let stub = stub.clone();
5454                let options = options.clone();
5455                async {
5456                    let op = GetOperation::new(stub)
5457                        .set_name(name)
5458                        .with_options(options)
5459                        .send()
5460                        .await?;
5461                    Ok(Operation::new(op))
5462                }
5463            };
5464
5465            let start = move || async {
5466                let op = self.send().await?;
5467                Ok(Operation::new(op))
5468            };
5469
5470            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5471        }
5472
5473        /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
5474        ///
5475        /// This is a **required** field for requests.
5476        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5477            self.0.request.parent = v.into();
5478            self
5479        }
5480
5481        /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
5482        ///
5483        /// This is a **required** field for requests.
5484        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5485            self.0.request.filter = v.into();
5486            self
5487        }
5488
5489        /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
5490        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
5491            self.0.request.force = v.into();
5492            self
5493        }
5494    }
5495
5496    #[doc(hidden)]
5497    impl gax::options::internal::RequestBuilder for PurgeProducts {
5498        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5499            &mut self.0.options
5500        }
5501    }
5502
5503    /// The request builder for [ProductService::import_products][crate::client::ProductService::import_products] calls.
5504    ///
5505    /// # Example
5506    /// ```
5507    /// # use google_cloud_retail_v2::builder::product_service::ImportProducts;
5508    /// # async fn sample() -> gax::Result<()> {
5509    /// use lro::Poller;
5510    ///
5511    /// let builder = prepare_request_builder();
5512    /// let response = builder.poller().until_done().await?;
5513    /// # Ok(()) }
5514    ///
5515    /// fn prepare_request_builder() -> ImportProducts {
5516    ///   # panic!();
5517    ///   // ... details omitted ...
5518    /// }
5519    /// ```
5520    #[derive(Clone, Debug)]
5521    pub struct ImportProducts(RequestBuilder<crate::model::ImportProductsRequest>);
5522
5523    impl ImportProducts {
5524        pub(crate) fn new(
5525            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5526        ) -> Self {
5527            Self(RequestBuilder::new(stub))
5528        }
5529
5530        /// Sets the full request, replacing any prior values.
5531        pub fn with_request<V: Into<crate::model::ImportProductsRequest>>(mut self, v: V) -> Self {
5532            self.0.request = v.into();
5533            self
5534        }
5535
5536        /// Sets all the options, replacing any prior values.
5537        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5538            self.0.options = v.into();
5539            self
5540        }
5541
5542        /// Sends the request.
5543        ///
5544        /// # Long running operations
5545        ///
5546        /// This starts, but does not poll, a longrunning operation. More information
5547        /// on [import_products][crate::client::ProductService::import_products].
5548        pub async fn send(self) -> Result<longrunning::model::Operation> {
5549            (*self.0.stub)
5550                .import_products(self.0.request, self.0.options)
5551                .await
5552                .map(gax::response::Response::into_body)
5553        }
5554
5555        /// Creates a [Poller][lro::Poller] to work with `import_products`.
5556        pub fn poller(
5557            self,
5558        ) -> impl lro::Poller<crate::model::ImportProductsResponse, crate::model::ImportMetadata>
5559        {
5560            type Operation = lro::internal::Operation<
5561                crate::model::ImportProductsResponse,
5562                crate::model::ImportMetadata,
5563            >;
5564            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5565            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5566
5567            let stub = self.0.stub.clone();
5568            let mut options = self.0.options.clone();
5569            options.set_retry_policy(gax::retry_policy::NeverRetry);
5570            let query = move |name| {
5571                let stub = stub.clone();
5572                let options = options.clone();
5573                async {
5574                    let op = GetOperation::new(stub)
5575                        .set_name(name)
5576                        .with_options(options)
5577                        .send()
5578                        .await?;
5579                    Ok(Operation::new(op))
5580                }
5581            };
5582
5583            let start = move || async {
5584                let op = self.send().await?;
5585                Ok(Operation::new(op))
5586            };
5587
5588            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5589        }
5590
5591        /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
5592        ///
5593        /// This is a **required** field for requests.
5594        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5595            self.0.request.parent = v.into();
5596            self
5597        }
5598
5599        /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
5600        #[deprecated]
5601        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5602            self.0.request.request_id = v.into();
5603            self
5604        }
5605
5606        /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
5607        ///
5608        /// This is a **required** field for requests.
5609        pub fn set_input_config<T>(mut self, v: T) -> Self
5610        where
5611            T: std::convert::Into<crate::model::ProductInputConfig>,
5612        {
5613            self.0.request.input_config = std::option::Option::Some(v.into());
5614            self
5615        }
5616
5617        /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
5618        ///
5619        /// This is a **required** field for requests.
5620        pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5621        where
5622            T: std::convert::Into<crate::model::ProductInputConfig>,
5623        {
5624            self.0.request.input_config = v.map(|x| x.into());
5625            self
5626        }
5627
5628        /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
5629        pub fn set_errors_config<T>(mut self, v: T) -> Self
5630        where
5631            T: std::convert::Into<crate::model::ImportErrorsConfig>,
5632        {
5633            self.0.request.errors_config = std::option::Option::Some(v.into());
5634            self
5635        }
5636
5637        /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
5638        pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
5639        where
5640            T: std::convert::Into<crate::model::ImportErrorsConfig>,
5641        {
5642            self.0.request.errors_config = v.map(|x| x.into());
5643            self
5644        }
5645
5646        /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
5647        pub fn set_update_mask<T>(mut self, v: T) -> Self
5648        where
5649            T: std::convert::Into<wkt::FieldMask>,
5650        {
5651            self.0.request.update_mask = std::option::Option::Some(v.into());
5652            self
5653        }
5654
5655        /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
5656        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5657        where
5658            T: std::convert::Into<wkt::FieldMask>,
5659        {
5660            self.0.request.update_mask = v.map(|x| x.into());
5661            self
5662        }
5663
5664        /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
5665        pub fn set_reconciliation_mode<
5666            T: Into<crate::model::import_products_request::ReconciliationMode>,
5667        >(
5668            mut self,
5669            v: T,
5670        ) -> Self {
5671            self.0.request.reconciliation_mode = v.into();
5672            self
5673        }
5674
5675        /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
5676        pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
5677            self.0.request.notification_pubsub_topic = v.into();
5678            self
5679        }
5680    }
5681
5682    #[doc(hidden)]
5683    impl gax::options::internal::RequestBuilder for ImportProducts {
5684        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5685            &mut self.0.options
5686        }
5687    }
5688
5689    /// The request builder for [ProductService::set_inventory][crate::client::ProductService::set_inventory] calls.
5690    ///
5691    /// # Example
5692    /// ```
5693    /// # use google_cloud_retail_v2::builder::product_service::SetInventory;
5694    /// # async fn sample() -> gax::Result<()> {
5695    /// use lro::Poller;
5696    ///
5697    /// let builder = prepare_request_builder();
5698    /// let response = builder.poller().until_done().await?;
5699    /// # Ok(()) }
5700    ///
5701    /// fn prepare_request_builder() -> SetInventory {
5702    ///   # panic!();
5703    ///   // ... details omitted ...
5704    /// }
5705    /// ```
5706    #[derive(Clone, Debug)]
5707    pub struct SetInventory(RequestBuilder<crate::model::SetInventoryRequest>);
5708
5709    impl SetInventory {
5710        pub(crate) fn new(
5711            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5712        ) -> Self {
5713            Self(RequestBuilder::new(stub))
5714        }
5715
5716        /// Sets the full request, replacing any prior values.
5717        pub fn with_request<V: Into<crate::model::SetInventoryRequest>>(mut self, v: V) -> Self {
5718            self.0.request = v.into();
5719            self
5720        }
5721
5722        /// Sets all the options, replacing any prior values.
5723        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5724            self.0.options = v.into();
5725            self
5726        }
5727
5728        /// Sends the request.
5729        ///
5730        /// # Long running operations
5731        ///
5732        /// This starts, but does not poll, a longrunning operation. More information
5733        /// on [set_inventory][crate::client::ProductService::set_inventory].
5734        pub async fn send(self) -> Result<longrunning::model::Operation> {
5735            (*self.0.stub)
5736                .set_inventory(self.0.request, self.0.options)
5737                .await
5738                .map(gax::response::Response::into_body)
5739        }
5740
5741        /// Creates a [Poller][lro::Poller] to work with `set_inventory`.
5742        pub fn poller(
5743            self,
5744        ) -> impl lro::Poller<crate::model::SetInventoryResponse, crate::model::SetInventoryMetadata>
5745        {
5746            type Operation = lro::internal::Operation<
5747                crate::model::SetInventoryResponse,
5748                crate::model::SetInventoryMetadata,
5749            >;
5750            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5751            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5752
5753            let stub = self.0.stub.clone();
5754            let mut options = self.0.options.clone();
5755            options.set_retry_policy(gax::retry_policy::NeverRetry);
5756            let query = move |name| {
5757                let stub = stub.clone();
5758                let options = options.clone();
5759                async {
5760                    let op = GetOperation::new(stub)
5761                        .set_name(name)
5762                        .with_options(options)
5763                        .send()
5764                        .await?;
5765                    Ok(Operation::new(op))
5766                }
5767            };
5768
5769            let start = move || async {
5770                let op = self.send().await?;
5771                Ok(Operation::new(op))
5772            };
5773
5774            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5775        }
5776
5777        /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
5778        ///
5779        /// This is a **required** field for requests.
5780        pub fn set_inventory<T>(mut self, v: T) -> Self
5781        where
5782            T: std::convert::Into<crate::model::Product>,
5783        {
5784            self.0.request.inventory = std::option::Option::Some(v.into());
5785            self
5786        }
5787
5788        /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
5789        ///
5790        /// This is a **required** field for requests.
5791        pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
5792        where
5793            T: std::convert::Into<crate::model::Product>,
5794        {
5795            self.0.request.inventory = v.map(|x| x.into());
5796            self
5797        }
5798
5799        /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
5800        pub fn set_set_mask<T>(mut self, v: T) -> Self
5801        where
5802            T: std::convert::Into<wkt::FieldMask>,
5803        {
5804            self.0.request.set_mask = std::option::Option::Some(v.into());
5805            self
5806        }
5807
5808        /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
5809        pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
5810        where
5811            T: std::convert::Into<wkt::FieldMask>,
5812        {
5813            self.0.request.set_mask = v.map(|x| x.into());
5814            self
5815        }
5816
5817        /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
5818        pub fn set_set_time<T>(mut self, v: T) -> Self
5819        where
5820            T: std::convert::Into<wkt::Timestamp>,
5821        {
5822            self.0.request.set_time = std::option::Option::Some(v.into());
5823            self
5824        }
5825
5826        /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
5827        pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
5828        where
5829            T: std::convert::Into<wkt::Timestamp>,
5830        {
5831            self.0.request.set_time = v.map(|x| x.into());
5832            self
5833        }
5834
5835        /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
5836        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5837            self.0.request.allow_missing = v.into();
5838            self
5839        }
5840    }
5841
5842    #[doc(hidden)]
5843    impl gax::options::internal::RequestBuilder for SetInventory {
5844        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5845            &mut self.0.options
5846        }
5847    }
5848
5849    /// The request builder for [ProductService::add_fulfillment_places][crate::client::ProductService::add_fulfillment_places] calls.
5850    ///
5851    /// # Example
5852    /// ```
5853    /// # use google_cloud_retail_v2::builder::product_service::AddFulfillmentPlaces;
5854    /// # async fn sample() -> gax::Result<()> {
5855    /// use lro::Poller;
5856    ///
5857    /// let builder = prepare_request_builder();
5858    /// let response = builder.poller().until_done().await?;
5859    /// # Ok(()) }
5860    ///
5861    /// fn prepare_request_builder() -> AddFulfillmentPlaces {
5862    ///   # panic!();
5863    ///   // ... details omitted ...
5864    /// }
5865    /// ```
5866    #[derive(Clone, Debug)]
5867    pub struct AddFulfillmentPlaces(RequestBuilder<crate::model::AddFulfillmentPlacesRequest>);
5868
5869    impl AddFulfillmentPlaces {
5870        pub(crate) fn new(
5871            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5872        ) -> Self {
5873            Self(RequestBuilder::new(stub))
5874        }
5875
5876        /// Sets the full request, replacing any prior values.
5877        pub fn with_request<V: Into<crate::model::AddFulfillmentPlacesRequest>>(
5878            mut self,
5879            v: V,
5880        ) -> Self {
5881            self.0.request = v.into();
5882            self
5883        }
5884
5885        /// Sets all the options, replacing any prior values.
5886        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5887            self.0.options = v.into();
5888            self
5889        }
5890
5891        /// Sends the request.
5892        ///
5893        /// # Long running operations
5894        ///
5895        /// This starts, but does not poll, a longrunning operation. More information
5896        /// on [add_fulfillment_places][crate::client::ProductService::add_fulfillment_places].
5897        pub async fn send(self) -> Result<longrunning::model::Operation> {
5898            (*self.0.stub)
5899                .add_fulfillment_places(self.0.request, self.0.options)
5900                .await
5901                .map(gax::response::Response::into_body)
5902        }
5903
5904        /// Creates a [Poller][lro::Poller] to work with `add_fulfillment_places`.
5905        pub fn poller(
5906            self,
5907        ) -> impl lro::Poller<
5908            crate::model::AddFulfillmentPlacesResponse,
5909            crate::model::AddFulfillmentPlacesMetadata,
5910        > {
5911            type Operation = lro::internal::Operation<
5912                crate::model::AddFulfillmentPlacesResponse,
5913                crate::model::AddFulfillmentPlacesMetadata,
5914            >;
5915            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5916            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5917
5918            let stub = self.0.stub.clone();
5919            let mut options = self.0.options.clone();
5920            options.set_retry_policy(gax::retry_policy::NeverRetry);
5921            let query = move |name| {
5922                let stub = stub.clone();
5923                let options = options.clone();
5924                async {
5925                    let op = GetOperation::new(stub)
5926                        .set_name(name)
5927                        .with_options(options)
5928                        .send()
5929                        .await?;
5930                    Ok(Operation::new(op))
5931                }
5932            };
5933
5934            let start = move || async {
5935                let op = self.send().await?;
5936                Ok(Operation::new(op))
5937            };
5938
5939            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5940        }
5941
5942        /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
5943        ///
5944        /// This is a **required** field for requests.
5945        pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
5946            self.0.request.product = v.into();
5947            self
5948        }
5949
5950        /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
5951        ///
5952        /// This is a **required** field for requests.
5953        pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
5954            self.0.request.r#type = v.into();
5955            self
5956        }
5957
5958        /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
5959        ///
5960        /// This is a **required** field for requests.
5961        pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5962        where
5963            T: std::iter::IntoIterator<Item = V>,
5964            V: std::convert::Into<std::string::String>,
5965        {
5966            use std::iter::Iterator;
5967            self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
5968            self
5969        }
5970
5971        /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
5972        pub fn set_add_time<T>(mut self, v: T) -> Self
5973        where
5974            T: std::convert::Into<wkt::Timestamp>,
5975        {
5976            self.0.request.add_time = std::option::Option::Some(v.into());
5977            self
5978        }
5979
5980        /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
5981        pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
5982        where
5983            T: std::convert::Into<wkt::Timestamp>,
5984        {
5985            self.0.request.add_time = v.map(|x| x.into());
5986            self
5987        }
5988
5989        /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
5990        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5991            self.0.request.allow_missing = v.into();
5992            self
5993        }
5994    }
5995
5996    #[doc(hidden)]
5997    impl gax::options::internal::RequestBuilder for AddFulfillmentPlaces {
5998        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5999            &mut self.0.options
6000        }
6001    }
6002
6003    /// The request builder for [ProductService::remove_fulfillment_places][crate::client::ProductService::remove_fulfillment_places] calls.
6004    ///
6005    /// # Example
6006    /// ```
6007    /// # use google_cloud_retail_v2::builder::product_service::RemoveFulfillmentPlaces;
6008    /// # async fn sample() -> gax::Result<()> {
6009    /// use lro::Poller;
6010    ///
6011    /// let builder = prepare_request_builder();
6012    /// let response = builder.poller().until_done().await?;
6013    /// # Ok(()) }
6014    ///
6015    /// fn prepare_request_builder() -> RemoveFulfillmentPlaces {
6016    ///   # panic!();
6017    ///   // ... details omitted ...
6018    /// }
6019    /// ```
6020    #[derive(Clone, Debug)]
6021    pub struct RemoveFulfillmentPlaces(
6022        RequestBuilder<crate::model::RemoveFulfillmentPlacesRequest>,
6023    );
6024
6025    impl RemoveFulfillmentPlaces {
6026        pub(crate) fn new(
6027            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6028        ) -> Self {
6029            Self(RequestBuilder::new(stub))
6030        }
6031
6032        /// Sets the full request, replacing any prior values.
6033        pub fn with_request<V: Into<crate::model::RemoveFulfillmentPlacesRequest>>(
6034            mut self,
6035            v: V,
6036        ) -> Self {
6037            self.0.request = v.into();
6038            self
6039        }
6040
6041        /// Sets all the options, replacing any prior values.
6042        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6043            self.0.options = v.into();
6044            self
6045        }
6046
6047        /// Sends the request.
6048        ///
6049        /// # Long running operations
6050        ///
6051        /// This starts, but does not poll, a longrunning operation. More information
6052        /// on [remove_fulfillment_places][crate::client::ProductService::remove_fulfillment_places].
6053        pub async fn send(self) -> Result<longrunning::model::Operation> {
6054            (*self.0.stub)
6055                .remove_fulfillment_places(self.0.request, self.0.options)
6056                .await
6057                .map(gax::response::Response::into_body)
6058        }
6059
6060        /// Creates a [Poller][lro::Poller] to work with `remove_fulfillment_places`.
6061        pub fn poller(
6062            self,
6063        ) -> impl lro::Poller<
6064            crate::model::RemoveFulfillmentPlacesResponse,
6065            crate::model::RemoveFulfillmentPlacesMetadata,
6066        > {
6067            type Operation = lro::internal::Operation<
6068                crate::model::RemoveFulfillmentPlacesResponse,
6069                crate::model::RemoveFulfillmentPlacesMetadata,
6070            >;
6071            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6072            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6073
6074            let stub = self.0.stub.clone();
6075            let mut options = self.0.options.clone();
6076            options.set_retry_policy(gax::retry_policy::NeverRetry);
6077            let query = move |name| {
6078                let stub = stub.clone();
6079                let options = options.clone();
6080                async {
6081                    let op = GetOperation::new(stub)
6082                        .set_name(name)
6083                        .with_options(options)
6084                        .send()
6085                        .await?;
6086                    Ok(Operation::new(op))
6087                }
6088            };
6089
6090            let start = move || async {
6091                let op = self.send().await?;
6092                Ok(Operation::new(op))
6093            };
6094
6095            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6096        }
6097
6098        /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
6099        ///
6100        /// This is a **required** field for requests.
6101        pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6102            self.0.request.product = v.into();
6103            self
6104        }
6105
6106        /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
6107        ///
6108        /// This is a **required** field for requests.
6109        pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6110            self.0.request.r#type = v.into();
6111            self
6112        }
6113
6114        /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
6115        ///
6116        /// This is a **required** field for requests.
6117        pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6118        where
6119            T: std::iter::IntoIterator<Item = V>,
6120            V: std::convert::Into<std::string::String>,
6121        {
6122            use std::iter::Iterator;
6123            self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6124            self
6125        }
6126
6127        /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
6128        pub fn set_remove_time<T>(mut self, v: T) -> Self
6129        where
6130            T: std::convert::Into<wkt::Timestamp>,
6131        {
6132            self.0.request.remove_time = std::option::Option::Some(v.into());
6133            self
6134        }
6135
6136        /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
6137        pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6138        where
6139            T: std::convert::Into<wkt::Timestamp>,
6140        {
6141            self.0.request.remove_time = v.map(|x| x.into());
6142            self
6143        }
6144
6145        /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
6146        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6147            self.0.request.allow_missing = v.into();
6148            self
6149        }
6150    }
6151
6152    #[doc(hidden)]
6153    impl gax::options::internal::RequestBuilder for RemoveFulfillmentPlaces {
6154        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6155            &mut self.0.options
6156        }
6157    }
6158
6159    /// The request builder for [ProductService::add_local_inventories][crate::client::ProductService::add_local_inventories] calls.
6160    ///
6161    /// # Example
6162    /// ```
6163    /// # use google_cloud_retail_v2::builder::product_service::AddLocalInventories;
6164    /// # async fn sample() -> gax::Result<()> {
6165    /// use lro::Poller;
6166    ///
6167    /// let builder = prepare_request_builder();
6168    /// let response = builder.poller().until_done().await?;
6169    /// # Ok(()) }
6170    ///
6171    /// fn prepare_request_builder() -> AddLocalInventories {
6172    ///   # panic!();
6173    ///   // ... details omitted ...
6174    /// }
6175    /// ```
6176    #[derive(Clone, Debug)]
6177    pub struct AddLocalInventories(RequestBuilder<crate::model::AddLocalInventoriesRequest>);
6178
6179    impl AddLocalInventories {
6180        pub(crate) fn new(
6181            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6182        ) -> Self {
6183            Self(RequestBuilder::new(stub))
6184        }
6185
6186        /// Sets the full request, replacing any prior values.
6187        pub fn with_request<V: Into<crate::model::AddLocalInventoriesRequest>>(
6188            mut self,
6189            v: V,
6190        ) -> Self {
6191            self.0.request = v.into();
6192            self
6193        }
6194
6195        /// Sets all the options, replacing any prior values.
6196        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6197            self.0.options = v.into();
6198            self
6199        }
6200
6201        /// Sends the request.
6202        ///
6203        /// # Long running operations
6204        ///
6205        /// This starts, but does not poll, a longrunning operation. More information
6206        /// on [add_local_inventories][crate::client::ProductService::add_local_inventories].
6207        pub async fn send(self) -> Result<longrunning::model::Operation> {
6208            (*self.0.stub)
6209                .add_local_inventories(self.0.request, self.0.options)
6210                .await
6211                .map(gax::response::Response::into_body)
6212        }
6213
6214        /// Creates a [Poller][lro::Poller] to work with `add_local_inventories`.
6215        pub fn poller(
6216            self,
6217        ) -> impl lro::Poller<
6218            crate::model::AddLocalInventoriesResponse,
6219            crate::model::AddLocalInventoriesMetadata,
6220        > {
6221            type Operation = lro::internal::Operation<
6222                crate::model::AddLocalInventoriesResponse,
6223                crate::model::AddLocalInventoriesMetadata,
6224            >;
6225            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6226            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6227
6228            let stub = self.0.stub.clone();
6229            let mut options = self.0.options.clone();
6230            options.set_retry_policy(gax::retry_policy::NeverRetry);
6231            let query = move |name| {
6232                let stub = stub.clone();
6233                let options = options.clone();
6234                async {
6235                    let op = GetOperation::new(stub)
6236                        .set_name(name)
6237                        .with_options(options)
6238                        .send()
6239                        .await?;
6240                    Ok(Operation::new(op))
6241                }
6242            };
6243
6244            let start = move || async {
6245                let op = self.send().await?;
6246                Ok(Operation::new(op))
6247            };
6248
6249            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6250        }
6251
6252        /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
6253        ///
6254        /// This is a **required** field for requests.
6255        pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6256            self.0.request.product = v.into();
6257            self
6258        }
6259
6260        /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
6261        ///
6262        /// This is a **required** field for requests.
6263        pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
6264        where
6265            T: std::iter::IntoIterator<Item = V>,
6266            V: std::convert::Into<crate::model::LocalInventory>,
6267        {
6268            use std::iter::Iterator;
6269            self.0.request.local_inventories = v.into_iter().map(|i| i.into()).collect();
6270            self
6271        }
6272
6273        /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
6274        pub fn set_add_mask<T>(mut self, v: T) -> Self
6275        where
6276            T: std::convert::Into<wkt::FieldMask>,
6277        {
6278            self.0.request.add_mask = std::option::Option::Some(v.into());
6279            self
6280        }
6281
6282        /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
6283        pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
6284        where
6285            T: std::convert::Into<wkt::FieldMask>,
6286        {
6287            self.0.request.add_mask = v.map(|x| x.into());
6288            self
6289        }
6290
6291        /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
6292        pub fn set_add_time<T>(mut self, v: T) -> Self
6293        where
6294            T: std::convert::Into<wkt::Timestamp>,
6295        {
6296            self.0.request.add_time = std::option::Option::Some(v.into());
6297            self
6298        }
6299
6300        /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
6301        pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6302        where
6303            T: std::convert::Into<wkt::Timestamp>,
6304        {
6305            self.0.request.add_time = v.map(|x| x.into());
6306            self
6307        }
6308
6309        /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
6310        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6311            self.0.request.allow_missing = v.into();
6312            self
6313        }
6314    }
6315
6316    #[doc(hidden)]
6317    impl gax::options::internal::RequestBuilder for AddLocalInventories {
6318        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6319            &mut self.0.options
6320        }
6321    }
6322
6323    /// The request builder for [ProductService::remove_local_inventories][crate::client::ProductService::remove_local_inventories] calls.
6324    ///
6325    /// # Example
6326    /// ```
6327    /// # use google_cloud_retail_v2::builder::product_service::RemoveLocalInventories;
6328    /// # async fn sample() -> gax::Result<()> {
6329    /// use lro::Poller;
6330    ///
6331    /// let builder = prepare_request_builder();
6332    /// let response = builder.poller().until_done().await?;
6333    /// # Ok(()) }
6334    ///
6335    /// fn prepare_request_builder() -> RemoveLocalInventories {
6336    ///   # panic!();
6337    ///   // ... details omitted ...
6338    /// }
6339    /// ```
6340    #[derive(Clone, Debug)]
6341    pub struct RemoveLocalInventories(RequestBuilder<crate::model::RemoveLocalInventoriesRequest>);
6342
6343    impl RemoveLocalInventories {
6344        pub(crate) fn new(
6345            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6346        ) -> Self {
6347            Self(RequestBuilder::new(stub))
6348        }
6349
6350        /// Sets the full request, replacing any prior values.
6351        pub fn with_request<V: Into<crate::model::RemoveLocalInventoriesRequest>>(
6352            mut self,
6353            v: V,
6354        ) -> Self {
6355            self.0.request = v.into();
6356            self
6357        }
6358
6359        /// Sets all the options, replacing any prior values.
6360        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6361            self.0.options = v.into();
6362            self
6363        }
6364
6365        /// Sends the request.
6366        ///
6367        /// # Long running operations
6368        ///
6369        /// This starts, but does not poll, a longrunning operation. More information
6370        /// on [remove_local_inventories][crate::client::ProductService::remove_local_inventories].
6371        pub async fn send(self) -> Result<longrunning::model::Operation> {
6372            (*self.0.stub)
6373                .remove_local_inventories(self.0.request, self.0.options)
6374                .await
6375                .map(gax::response::Response::into_body)
6376        }
6377
6378        /// Creates a [Poller][lro::Poller] to work with `remove_local_inventories`.
6379        pub fn poller(
6380            self,
6381        ) -> impl lro::Poller<
6382            crate::model::RemoveLocalInventoriesResponse,
6383            crate::model::RemoveLocalInventoriesMetadata,
6384        > {
6385            type Operation = lro::internal::Operation<
6386                crate::model::RemoveLocalInventoriesResponse,
6387                crate::model::RemoveLocalInventoriesMetadata,
6388            >;
6389            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6390            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6391
6392            let stub = self.0.stub.clone();
6393            let mut options = self.0.options.clone();
6394            options.set_retry_policy(gax::retry_policy::NeverRetry);
6395            let query = move |name| {
6396                let stub = stub.clone();
6397                let options = options.clone();
6398                async {
6399                    let op = GetOperation::new(stub)
6400                        .set_name(name)
6401                        .with_options(options)
6402                        .send()
6403                        .await?;
6404                    Ok(Operation::new(op))
6405                }
6406            };
6407
6408            let start = move || async {
6409                let op = self.send().await?;
6410                Ok(Operation::new(op))
6411            };
6412
6413            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6414        }
6415
6416        /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
6417        ///
6418        /// This is a **required** field for requests.
6419        pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6420            self.0.request.product = v.into();
6421            self
6422        }
6423
6424        /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
6425        ///
6426        /// This is a **required** field for requests.
6427        pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6428        where
6429            T: std::iter::IntoIterator<Item = V>,
6430            V: std::convert::Into<std::string::String>,
6431        {
6432            use std::iter::Iterator;
6433            self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6434            self
6435        }
6436
6437        /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
6438        pub fn set_remove_time<T>(mut self, v: T) -> Self
6439        where
6440            T: std::convert::Into<wkt::Timestamp>,
6441        {
6442            self.0.request.remove_time = std::option::Option::Some(v.into());
6443            self
6444        }
6445
6446        /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
6447        pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6448        where
6449            T: std::convert::Into<wkt::Timestamp>,
6450        {
6451            self.0.request.remove_time = v.map(|x| x.into());
6452            self
6453        }
6454
6455        /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
6456        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6457            self.0.request.allow_missing = v.into();
6458            self
6459        }
6460    }
6461
6462    #[doc(hidden)]
6463    impl gax::options::internal::RequestBuilder for RemoveLocalInventories {
6464        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6465            &mut self.0.options
6466        }
6467    }
6468
6469    /// The request builder for [ProductService::list_operations][crate::client::ProductService::list_operations] calls.
6470    ///
6471    /// # Example
6472    /// ```
6473    /// # use google_cloud_retail_v2::builder::product_service::ListOperations;
6474    /// # async fn sample() -> gax::Result<()> {
6475    /// use gax::paginator::ItemPaginator;
6476    ///
6477    /// let builder = prepare_request_builder();
6478    /// let mut items = builder.by_item();
6479    /// while let Some(result) = items.next().await {
6480    ///   let item = result?;
6481    /// }
6482    /// # Ok(()) }
6483    ///
6484    /// fn prepare_request_builder() -> ListOperations {
6485    ///   # panic!();
6486    ///   // ... details omitted ...
6487    /// }
6488    /// ```
6489    #[derive(Clone, Debug)]
6490    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6491
6492    impl ListOperations {
6493        pub(crate) fn new(
6494            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6495        ) -> Self {
6496            Self(RequestBuilder::new(stub))
6497        }
6498
6499        /// Sets the full request, replacing any prior values.
6500        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6501            mut self,
6502            v: V,
6503        ) -> Self {
6504            self.0.request = v.into();
6505            self
6506        }
6507
6508        /// Sets all the options, replacing any prior values.
6509        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6510            self.0.options = v.into();
6511            self
6512        }
6513
6514        /// Sends the request.
6515        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6516            (*self.0.stub)
6517                .list_operations(self.0.request, self.0.options)
6518                .await
6519                .map(gax::response::Response::into_body)
6520        }
6521
6522        /// Streams each page in the collection.
6523        pub fn by_page(
6524            self,
6525        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6526        {
6527            use std::clone::Clone;
6528            let token = self.0.request.page_token.clone();
6529            let execute = move |token: String| {
6530                let mut builder = self.clone();
6531                builder.0.request = builder.0.request.set_page_token(token);
6532                builder.send()
6533            };
6534            gax::paginator::internal::new_paginator(token, execute)
6535        }
6536
6537        /// Streams each item in the collection.
6538        pub fn by_item(
6539            self,
6540        ) -> impl gax::paginator::ItemPaginator<
6541            longrunning::model::ListOperationsResponse,
6542            gax::error::Error,
6543        > {
6544            use gax::paginator::Paginator;
6545            self.by_page().items()
6546        }
6547
6548        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6549        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6550            self.0.request.name = v.into();
6551            self
6552        }
6553
6554        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6555        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6556            self.0.request.filter = v.into();
6557            self
6558        }
6559
6560        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6561        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6562            self.0.request.page_size = v.into();
6563            self
6564        }
6565
6566        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6567        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6568            self.0.request.page_token = v.into();
6569            self
6570        }
6571
6572        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
6573        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6574            self.0.request.return_partial_success = v.into();
6575            self
6576        }
6577    }
6578
6579    #[doc(hidden)]
6580    impl gax::options::internal::RequestBuilder for ListOperations {
6581        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6582            &mut self.0.options
6583        }
6584    }
6585
6586    /// The request builder for [ProductService::get_operation][crate::client::ProductService::get_operation] calls.
6587    ///
6588    /// # Example
6589    /// ```
6590    /// # use google_cloud_retail_v2::builder::product_service::GetOperation;
6591    /// # async fn sample() -> gax::Result<()> {
6592    ///
6593    /// let builder = prepare_request_builder();
6594    /// let response = builder.send().await?;
6595    /// # Ok(()) }
6596    ///
6597    /// fn prepare_request_builder() -> GetOperation {
6598    ///   # panic!();
6599    ///   // ... details omitted ...
6600    /// }
6601    /// ```
6602    #[derive(Clone, Debug)]
6603    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6604
6605    impl GetOperation {
6606        pub(crate) fn new(
6607            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6608        ) -> Self {
6609            Self(RequestBuilder::new(stub))
6610        }
6611
6612        /// Sets the full request, replacing any prior values.
6613        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6614            mut self,
6615            v: V,
6616        ) -> Self {
6617            self.0.request = v.into();
6618            self
6619        }
6620
6621        /// Sets all the options, replacing any prior values.
6622        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6623            self.0.options = v.into();
6624            self
6625        }
6626
6627        /// Sends the request.
6628        pub async fn send(self) -> Result<longrunning::model::Operation> {
6629            (*self.0.stub)
6630                .get_operation(self.0.request, self.0.options)
6631                .await
6632                .map(gax::response::Response::into_body)
6633        }
6634
6635        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6636        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6637            self.0.request.name = v.into();
6638            self
6639        }
6640    }
6641
6642    #[doc(hidden)]
6643    impl gax::options::internal::RequestBuilder for GetOperation {
6644        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6645            &mut self.0.options
6646        }
6647    }
6648}
6649
6650pub mod search_service {
6651    use crate::Result;
6652
6653    /// A builder for [SearchService][crate::client::SearchService].
6654    ///
6655    /// ```
6656    /// # async fn sample() -> gax::client_builder::Result<()> {
6657    /// # use google_cloud_retail_v2::*;
6658    /// # use builder::search_service::ClientBuilder;
6659    /// # use client::SearchService;
6660    /// let builder : ClientBuilder = SearchService::builder();
6661    /// let client = builder
6662    ///     .with_endpoint("https://retail.googleapis.com")
6663    ///     .build().await?;
6664    /// # Ok(()) }
6665    /// ```
6666    pub type ClientBuilder =
6667        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6668
6669    pub(crate) mod client {
6670        use super::super::super::client::SearchService;
6671        pub struct Factory;
6672        impl gax::client_builder::internal::ClientFactory for Factory {
6673            type Client = SearchService;
6674            type Credentials = gaxi::options::Credentials;
6675            async fn build(
6676                self,
6677                config: gaxi::options::ClientConfig,
6678            ) -> gax::client_builder::Result<Self::Client> {
6679                Self::Client::new(config).await
6680            }
6681        }
6682    }
6683
6684    /// Common implementation for [crate::client::SearchService] request builders.
6685    #[derive(Clone, Debug)]
6686    pub(crate) struct RequestBuilder<R: std::default::Default> {
6687        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6688        request: R,
6689        options: gax::options::RequestOptions,
6690    }
6691
6692    impl<R> RequestBuilder<R>
6693    where
6694        R: std::default::Default,
6695    {
6696        pub(crate) fn new(
6697            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6698        ) -> Self {
6699            Self {
6700                stub,
6701                request: R::default(),
6702                options: gax::options::RequestOptions::default(),
6703            }
6704        }
6705    }
6706
6707    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
6708    ///
6709    /// # Example
6710    /// ```
6711    /// # use google_cloud_retail_v2::builder::search_service::Search;
6712    /// # async fn sample() -> gax::Result<()> {
6713    /// use gax::paginator::ItemPaginator;
6714    ///
6715    /// let builder = prepare_request_builder();
6716    /// let mut items = builder.by_item();
6717    /// while let Some(result) = items.next().await {
6718    ///   let item = result?;
6719    /// }
6720    /// # Ok(()) }
6721    ///
6722    /// fn prepare_request_builder() -> Search {
6723    ///   # panic!();
6724    ///   // ... details omitted ...
6725    /// }
6726    /// ```
6727    #[derive(Clone, Debug)]
6728    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
6729
6730    impl Search {
6731        pub(crate) fn new(
6732            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6733        ) -> Self {
6734            Self(RequestBuilder::new(stub))
6735        }
6736
6737        /// Sets the full request, replacing any prior values.
6738        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
6739            self.0.request = v.into();
6740            self
6741        }
6742
6743        /// Sets all the options, replacing any prior values.
6744        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6745            self.0.options = v.into();
6746            self
6747        }
6748
6749        /// Sends the request.
6750        pub async fn send(self) -> Result<crate::model::SearchResponse> {
6751            (*self.0.stub)
6752                .search(self.0.request, self.0.options)
6753                .await
6754                .map(gax::response::Response::into_body)
6755        }
6756
6757        /// Streams each page in the collection.
6758        pub fn by_page(
6759            self,
6760        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
6761        {
6762            use std::clone::Clone;
6763            let token = self.0.request.page_token.clone();
6764            let execute = move |token: String| {
6765                let mut builder = self.clone();
6766                builder.0.request = builder.0.request.set_page_token(token);
6767                builder.send()
6768            };
6769            gax::paginator::internal::new_paginator(token, execute)
6770        }
6771
6772        /// Streams each item in the collection.
6773        pub fn by_item(
6774            self,
6775        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
6776        {
6777            use gax::paginator::Paginator;
6778            self.by_page().items()
6779        }
6780
6781        /// Sets the value of [placement][crate::model::SearchRequest::placement].
6782        ///
6783        /// This is a **required** field for requests.
6784        pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
6785            self.0.request.placement = v.into();
6786            self
6787        }
6788
6789        /// Sets the value of [branch][crate::model::SearchRequest::branch].
6790        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
6791            self.0.request.branch = v.into();
6792            self
6793        }
6794
6795        /// Sets the value of [query][crate::model::SearchRequest::query].
6796        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
6797            self.0.request.query = v.into();
6798            self
6799        }
6800
6801        /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
6802        ///
6803        /// This is a **required** field for requests.
6804        pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6805            self.0.request.visitor_id = v.into();
6806            self
6807        }
6808
6809        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
6810        pub fn set_user_info<T>(mut self, v: T) -> Self
6811        where
6812            T: std::convert::Into<crate::model::UserInfo>,
6813        {
6814            self.0.request.user_info = std::option::Option::Some(v.into());
6815            self
6816        }
6817
6818        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
6819        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
6820        where
6821            T: std::convert::Into<crate::model::UserInfo>,
6822        {
6823            self.0.request.user_info = v.map(|x| x.into());
6824            self
6825        }
6826
6827        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
6828        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6829            self.0.request.page_size = v.into();
6830            self
6831        }
6832
6833        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
6834        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6835            self.0.request.page_token = v.into();
6836            self
6837        }
6838
6839        /// Sets the value of [offset][crate::model::SearchRequest::offset].
6840        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
6841            self.0.request.offset = v.into();
6842            self
6843        }
6844
6845        /// Sets the value of [filter][crate::model::SearchRequest::filter].
6846        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6847            self.0.request.filter = v.into();
6848            self
6849        }
6850
6851        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
6852        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6853            self.0.request.canonical_filter = v.into();
6854            self
6855        }
6856
6857        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
6858        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
6859            self.0.request.order_by = v.into();
6860            self
6861        }
6862
6863        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
6864        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
6865        where
6866            T: std::iter::IntoIterator<Item = V>,
6867            V: std::convert::Into<crate::model::search_request::FacetSpec>,
6868        {
6869            use std::iter::Iterator;
6870            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
6871            self
6872        }
6873
6874        /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
6875        #[deprecated]
6876        pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
6877        where
6878            T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6879        {
6880            self.0.request.dynamic_facet_spec = std::option::Option::Some(v.into());
6881            self
6882        }
6883
6884        /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
6885        #[deprecated]
6886        pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
6887        where
6888            T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6889        {
6890            self.0.request.dynamic_facet_spec = v.map(|x| x.into());
6891            self
6892        }
6893
6894        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
6895        pub fn set_boost_spec<T>(mut self, v: T) -> Self
6896        where
6897            T: std::convert::Into<crate::model::search_request::BoostSpec>,
6898        {
6899            self.0.request.boost_spec = std::option::Option::Some(v.into());
6900            self
6901        }
6902
6903        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
6904        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
6905        where
6906            T: std::convert::Into<crate::model::search_request::BoostSpec>,
6907        {
6908            self.0.request.boost_spec = v.map(|x| x.into());
6909            self
6910        }
6911
6912        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
6913        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
6914        where
6915            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
6916        {
6917            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
6918            self
6919        }
6920
6921        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
6922        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
6923        where
6924            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
6925        {
6926            self.0.request.query_expansion_spec = v.map(|x| x.into());
6927            self
6928        }
6929
6930        /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
6931        pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
6932        where
6933            T: std::iter::IntoIterator<Item = V>,
6934            V: std::convert::Into<std::string::String>,
6935        {
6936            use std::iter::Iterator;
6937            self.0.request.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
6938            self
6939        }
6940
6941        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
6942        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
6943        where
6944            T: std::iter::IntoIterator<Item = V>,
6945            V: std::convert::Into<std::string::String>,
6946        {
6947            use std::iter::Iterator;
6948            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
6949            self
6950        }
6951
6952        /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
6953        pub fn set_search_mode<T: Into<crate::model::search_request::SearchMode>>(
6954            mut self,
6955            v: T,
6956        ) -> Self {
6957            self.0.request.search_mode = v.into();
6958            self
6959        }
6960
6961        /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
6962        pub fn set_personalization_spec<T>(mut self, v: T) -> Self
6963        where
6964            T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
6965        {
6966            self.0.request.personalization_spec = std::option::Option::Some(v.into());
6967            self
6968        }
6969
6970        /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
6971        pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
6972        where
6973            T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
6974        {
6975            self.0.request.personalization_spec = v.map(|x| x.into());
6976            self
6977        }
6978
6979        /// Sets the value of [labels][crate::model::SearchRequest::labels].
6980        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6981        where
6982            T: std::iter::IntoIterator<Item = (K, V)>,
6983            K: std::convert::Into<std::string::String>,
6984            V: std::convert::Into<std::string::String>,
6985        {
6986            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6987            self
6988        }
6989
6990        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
6991        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
6992        where
6993            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
6994        {
6995            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
6996            self
6997        }
6998
6999        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
7000        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
7001        where
7002            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7003        {
7004            self.0.request.spell_correction_spec = v.map(|x| x.into());
7005            self
7006        }
7007
7008        /// Sets the value of [entity][crate::model::SearchRequest::entity].
7009        pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
7010            self.0.request.entity = v.into();
7011            self
7012        }
7013
7014        /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
7015        pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
7016        where
7017            T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7018        {
7019            self.0.request.conversational_search_spec = std::option::Option::Some(v.into());
7020            self
7021        }
7022
7023        /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
7024        pub fn set_or_clear_conversational_search_spec<T>(
7025            mut self,
7026            v: std::option::Option<T>,
7027        ) -> Self
7028        where
7029            T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7030        {
7031            self.0.request.conversational_search_spec = v.map(|x| x.into());
7032            self
7033        }
7034
7035        /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
7036        pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
7037        where
7038            T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7039        {
7040            self.0.request.tile_navigation_spec = std::option::Option::Some(v.into());
7041            self
7042        }
7043
7044        /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
7045        pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7046        where
7047            T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7048        {
7049            self.0.request.tile_navigation_spec = v.map(|x| x.into());
7050            self
7051        }
7052
7053        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
7054        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7055            self.0.request.language_code = v.into();
7056            self
7057        }
7058
7059        /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
7060        pub fn set_region_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7061            self.0.request.region_code = v.into();
7062            self
7063        }
7064
7065        /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
7066        pub fn set_place_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7067            self.0.request.place_id = v.into();
7068            self
7069        }
7070
7071        /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
7072        pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
7073        where
7074            T: std::iter::IntoIterator<Item = (K, V)>,
7075            K: std::convert::Into<std::string::String>,
7076            V: std::convert::Into<crate::model::StringList>,
7077        {
7078            self.0.request.user_attributes =
7079                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7080            self
7081        }
7082    }
7083
7084    #[doc(hidden)]
7085    impl gax::options::internal::RequestBuilder for Search {
7086        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7087            &mut self.0.options
7088        }
7089    }
7090
7091    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
7092    ///
7093    /// # Example
7094    /// ```
7095    /// # use google_cloud_retail_v2::builder::search_service::ListOperations;
7096    /// # async fn sample() -> gax::Result<()> {
7097    /// use gax::paginator::ItemPaginator;
7098    ///
7099    /// let builder = prepare_request_builder();
7100    /// let mut items = builder.by_item();
7101    /// while let Some(result) = items.next().await {
7102    ///   let item = result?;
7103    /// }
7104    /// # Ok(()) }
7105    ///
7106    /// fn prepare_request_builder() -> ListOperations {
7107    ///   # panic!();
7108    ///   // ... details omitted ...
7109    /// }
7110    /// ```
7111    #[derive(Clone, Debug)]
7112    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7113
7114    impl ListOperations {
7115        pub(crate) fn new(
7116            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7117        ) -> Self {
7118            Self(RequestBuilder::new(stub))
7119        }
7120
7121        /// Sets the full request, replacing any prior values.
7122        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7123            mut self,
7124            v: V,
7125        ) -> Self {
7126            self.0.request = v.into();
7127            self
7128        }
7129
7130        /// Sets all the options, replacing any prior values.
7131        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7132            self.0.options = v.into();
7133            self
7134        }
7135
7136        /// Sends the request.
7137        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7138            (*self.0.stub)
7139                .list_operations(self.0.request, self.0.options)
7140                .await
7141                .map(gax::response::Response::into_body)
7142        }
7143
7144        /// Streams each page in the collection.
7145        pub fn by_page(
7146            self,
7147        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7148        {
7149            use std::clone::Clone;
7150            let token = self.0.request.page_token.clone();
7151            let execute = move |token: String| {
7152                let mut builder = self.clone();
7153                builder.0.request = builder.0.request.set_page_token(token);
7154                builder.send()
7155            };
7156            gax::paginator::internal::new_paginator(token, execute)
7157        }
7158
7159        /// Streams each item in the collection.
7160        pub fn by_item(
7161            self,
7162        ) -> impl gax::paginator::ItemPaginator<
7163            longrunning::model::ListOperationsResponse,
7164            gax::error::Error,
7165        > {
7166            use gax::paginator::Paginator;
7167            self.by_page().items()
7168        }
7169
7170        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7171        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7172            self.0.request.name = v.into();
7173            self
7174        }
7175
7176        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7177        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7178            self.0.request.filter = v.into();
7179            self
7180        }
7181
7182        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7183        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7184            self.0.request.page_size = v.into();
7185            self
7186        }
7187
7188        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7189        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7190            self.0.request.page_token = v.into();
7191            self
7192        }
7193
7194        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
7195        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7196            self.0.request.return_partial_success = v.into();
7197            self
7198        }
7199    }
7200
7201    #[doc(hidden)]
7202    impl gax::options::internal::RequestBuilder for ListOperations {
7203        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7204            &mut self.0.options
7205        }
7206    }
7207
7208    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
7209    ///
7210    /// # Example
7211    /// ```
7212    /// # use google_cloud_retail_v2::builder::search_service::GetOperation;
7213    /// # async fn sample() -> gax::Result<()> {
7214    ///
7215    /// let builder = prepare_request_builder();
7216    /// let response = builder.send().await?;
7217    /// # Ok(()) }
7218    ///
7219    /// fn prepare_request_builder() -> GetOperation {
7220    ///   # panic!();
7221    ///   // ... details omitted ...
7222    /// }
7223    /// ```
7224    #[derive(Clone, Debug)]
7225    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7226
7227    impl GetOperation {
7228        pub(crate) fn new(
7229            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7230        ) -> Self {
7231            Self(RequestBuilder::new(stub))
7232        }
7233
7234        /// Sets the full request, replacing any prior values.
7235        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7236            mut self,
7237            v: V,
7238        ) -> Self {
7239            self.0.request = v.into();
7240            self
7241        }
7242
7243        /// Sets all the options, replacing any prior values.
7244        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7245            self.0.options = v.into();
7246            self
7247        }
7248
7249        /// Sends the request.
7250        pub async fn send(self) -> Result<longrunning::model::Operation> {
7251            (*self.0.stub)
7252                .get_operation(self.0.request, self.0.options)
7253                .await
7254                .map(gax::response::Response::into_body)
7255        }
7256
7257        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7258        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7259            self.0.request.name = v.into();
7260            self
7261        }
7262    }
7263
7264    #[doc(hidden)]
7265    impl gax::options::internal::RequestBuilder for GetOperation {
7266        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7267            &mut self.0.options
7268        }
7269    }
7270}
7271
7272pub mod serving_config_service {
7273    use crate::Result;
7274
7275    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
7276    ///
7277    /// ```
7278    /// # async fn sample() -> gax::client_builder::Result<()> {
7279    /// # use google_cloud_retail_v2::*;
7280    /// # use builder::serving_config_service::ClientBuilder;
7281    /// # use client::ServingConfigService;
7282    /// let builder : ClientBuilder = ServingConfigService::builder();
7283    /// let client = builder
7284    ///     .with_endpoint("https://retail.googleapis.com")
7285    ///     .build().await?;
7286    /// # Ok(()) }
7287    /// ```
7288    pub type ClientBuilder =
7289        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7290
7291    pub(crate) mod client {
7292        use super::super::super::client::ServingConfigService;
7293        pub struct Factory;
7294        impl gax::client_builder::internal::ClientFactory for Factory {
7295            type Client = ServingConfigService;
7296            type Credentials = gaxi::options::Credentials;
7297            async fn build(
7298                self,
7299                config: gaxi::options::ClientConfig,
7300            ) -> gax::client_builder::Result<Self::Client> {
7301                Self::Client::new(config).await
7302            }
7303        }
7304    }
7305
7306    /// Common implementation for [crate::client::ServingConfigService] request builders.
7307    #[derive(Clone, Debug)]
7308    pub(crate) struct RequestBuilder<R: std::default::Default> {
7309        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7310        request: R,
7311        options: gax::options::RequestOptions,
7312    }
7313
7314    impl<R> RequestBuilder<R>
7315    where
7316        R: std::default::Default,
7317    {
7318        pub(crate) fn new(
7319            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7320        ) -> Self {
7321            Self {
7322                stub,
7323                request: R::default(),
7324                options: gax::options::RequestOptions::default(),
7325            }
7326        }
7327    }
7328
7329    /// The request builder for [ServingConfigService::create_serving_config][crate::client::ServingConfigService::create_serving_config] calls.
7330    ///
7331    /// # Example
7332    /// ```
7333    /// # use google_cloud_retail_v2::builder::serving_config_service::CreateServingConfig;
7334    /// # async fn sample() -> gax::Result<()> {
7335    ///
7336    /// let builder = prepare_request_builder();
7337    /// let response = builder.send().await?;
7338    /// # Ok(()) }
7339    ///
7340    /// fn prepare_request_builder() -> CreateServingConfig {
7341    ///   # panic!();
7342    ///   // ... details omitted ...
7343    /// }
7344    /// ```
7345    #[derive(Clone, Debug)]
7346    pub struct CreateServingConfig(RequestBuilder<crate::model::CreateServingConfigRequest>);
7347
7348    impl CreateServingConfig {
7349        pub(crate) fn new(
7350            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7351        ) -> Self {
7352            Self(RequestBuilder::new(stub))
7353        }
7354
7355        /// Sets the full request, replacing any prior values.
7356        pub fn with_request<V: Into<crate::model::CreateServingConfigRequest>>(
7357            mut self,
7358            v: V,
7359        ) -> Self {
7360            self.0.request = v.into();
7361            self
7362        }
7363
7364        /// Sets all the options, replacing any prior values.
7365        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7366            self.0.options = v.into();
7367            self
7368        }
7369
7370        /// Sends the request.
7371        pub async fn send(self) -> Result<crate::model::ServingConfig> {
7372            (*self.0.stub)
7373                .create_serving_config(self.0.request, self.0.options)
7374                .await
7375                .map(gax::response::Response::into_body)
7376        }
7377
7378        /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
7379        ///
7380        /// This is a **required** field for requests.
7381        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7382            self.0.request.parent = v.into();
7383            self
7384        }
7385
7386        /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
7387        ///
7388        /// This is a **required** field for requests.
7389        pub fn set_serving_config<T>(mut self, v: T) -> Self
7390        where
7391            T: std::convert::Into<crate::model::ServingConfig>,
7392        {
7393            self.0.request.serving_config = std::option::Option::Some(v.into());
7394            self
7395        }
7396
7397        /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
7398        ///
7399        /// This is a **required** field for requests.
7400        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7401        where
7402            T: std::convert::Into<crate::model::ServingConfig>,
7403        {
7404            self.0.request.serving_config = v.map(|x| x.into());
7405            self
7406        }
7407
7408        /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
7409        ///
7410        /// This is a **required** field for requests.
7411        pub fn set_serving_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7412            self.0.request.serving_config_id = v.into();
7413            self
7414        }
7415    }
7416
7417    #[doc(hidden)]
7418    impl gax::options::internal::RequestBuilder for CreateServingConfig {
7419        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7420            &mut self.0.options
7421        }
7422    }
7423
7424    /// The request builder for [ServingConfigService::delete_serving_config][crate::client::ServingConfigService::delete_serving_config] calls.
7425    ///
7426    /// # Example
7427    /// ```
7428    /// # use google_cloud_retail_v2::builder::serving_config_service::DeleteServingConfig;
7429    /// # async fn sample() -> gax::Result<()> {
7430    ///
7431    /// let builder = prepare_request_builder();
7432    /// let response = builder.send().await?;
7433    /// # Ok(()) }
7434    ///
7435    /// fn prepare_request_builder() -> DeleteServingConfig {
7436    ///   # panic!();
7437    ///   // ... details omitted ...
7438    /// }
7439    /// ```
7440    #[derive(Clone, Debug)]
7441    pub struct DeleteServingConfig(RequestBuilder<crate::model::DeleteServingConfigRequest>);
7442
7443    impl DeleteServingConfig {
7444        pub(crate) fn new(
7445            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7446        ) -> Self {
7447            Self(RequestBuilder::new(stub))
7448        }
7449
7450        /// Sets the full request, replacing any prior values.
7451        pub fn with_request<V: Into<crate::model::DeleteServingConfigRequest>>(
7452            mut self,
7453            v: V,
7454        ) -> Self {
7455            self.0.request = v.into();
7456            self
7457        }
7458
7459        /// Sets all the options, replacing any prior values.
7460        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7461            self.0.options = v.into();
7462            self
7463        }
7464
7465        /// Sends the request.
7466        pub async fn send(self) -> Result<()> {
7467            (*self.0.stub)
7468                .delete_serving_config(self.0.request, self.0.options)
7469                .await
7470                .map(gax::response::Response::into_body)
7471        }
7472
7473        /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
7474        ///
7475        /// This is a **required** field for requests.
7476        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7477            self.0.request.name = v.into();
7478            self
7479        }
7480    }
7481
7482    #[doc(hidden)]
7483    impl gax::options::internal::RequestBuilder for DeleteServingConfig {
7484        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7485            &mut self.0.options
7486        }
7487    }
7488
7489    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
7490    ///
7491    /// # Example
7492    /// ```
7493    /// # use google_cloud_retail_v2::builder::serving_config_service::UpdateServingConfig;
7494    /// # async fn sample() -> gax::Result<()> {
7495    ///
7496    /// let builder = prepare_request_builder();
7497    /// let response = builder.send().await?;
7498    /// # Ok(()) }
7499    ///
7500    /// fn prepare_request_builder() -> UpdateServingConfig {
7501    ///   # panic!();
7502    ///   // ... details omitted ...
7503    /// }
7504    /// ```
7505    #[derive(Clone, Debug)]
7506    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
7507
7508    impl UpdateServingConfig {
7509        pub(crate) fn new(
7510            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7511        ) -> Self {
7512            Self(RequestBuilder::new(stub))
7513        }
7514
7515        /// Sets the full request, replacing any prior values.
7516        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
7517            mut self,
7518            v: V,
7519        ) -> Self {
7520            self.0.request = v.into();
7521            self
7522        }
7523
7524        /// Sets all the options, replacing any prior values.
7525        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7526            self.0.options = v.into();
7527            self
7528        }
7529
7530        /// Sends the request.
7531        pub async fn send(self) -> Result<crate::model::ServingConfig> {
7532            (*self.0.stub)
7533                .update_serving_config(self.0.request, self.0.options)
7534                .await
7535                .map(gax::response::Response::into_body)
7536        }
7537
7538        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
7539        ///
7540        /// This is a **required** field for requests.
7541        pub fn set_serving_config<T>(mut self, v: T) -> Self
7542        where
7543            T: std::convert::Into<crate::model::ServingConfig>,
7544        {
7545            self.0.request.serving_config = std::option::Option::Some(v.into());
7546            self
7547        }
7548
7549        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
7550        ///
7551        /// This is a **required** field for requests.
7552        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7553        where
7554            T: std::convert::Into<crate::model::ServingConfig>,
7555        {
7556            self.0.request.serving_config = v.map(|x| x.into());
7557            self
7558        }
7559
7560        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
7561        pub fn set_update_mask<T>(mut self, v: T) -> Self
7562        where
7563            T: std::convert::Into<wkt::FieldMask>,
7564        {
7565            self.0.request.update_mask = std::option::Option::Some(v.into());
7566            self
7567        }
7568
7569        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
7570        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7571        where
7572            T: std::convert::Into<wkt::FieldMask>,
7573        {
7574            self.0.request.update_mask = v.map(|x| x.into());
7575            self
7576        }
7577    }
7578
7579    #[doc(hidden)]
7580    impl gax::options::internal::RequestBuilder for UpdateServingConfig {
7581        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7582            &mut self.0.options
7583        }
7584    }
7585
7586    /// The request builder for [ServingConfigService::get_serving_config][crate::client::ServingConfigService::get_serving_config] calls.
7587    ///
7588    /// # Example
7589    /// ```
7590    /// # use google_cloud_retail_v2::builder::serving_config_service::GetServingConfig;
7591    /// # async fn sample() -> gax::Result<()> {
7592    ///
7593    /// let builder = prepare_request_builder();
7594    /// let response = builder.send().await?;
7595    /// # Ok(()) }
7596    ///
7597    /// fn prepare_request_builder() -> GetServingConfig {
7598    ///   # panic!();
7599    ///   // ... details omitted ...
7600    /// }
7601    /// ```
7602    #[derive(Clone, Debug)]
7603    pub struct GetServingConfig(RequestBuilder<crate::model::GetServingConfigRequest>);
7604
7605    impl GetServingConfig {
7606        pub(crate) fn new(
7607            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7608        ) -> Self {
7609            Self(RequestBuilder::new(stub))
7610        }
7611
7612        /// Sets the full request, replacing any prior values.
7613        pub fn with_request<V: Into<crate::model::GetServingConfigRequest>>(
7614            mut self,
7615            v: V,
7616        ) -> Self {
7617            self.0.request = v.into();
7618            self
7619        }
7620
7621        /// Sets all the options, replacing any prior values.
7622        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7623            self.0.options = v.into();
7624            self
7625        }
7626
7627        /// Sends the request.
7628        pub async fn send(self) -> Result<crate::model::ServingConfig> {
7629            (*self.0.stub)
7630                .get_serving_config(self.0.request, self.0.options)
7631                .await
7632                .map(gax::response::Response::into_body)
7633        }
7634
7635        /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
7636        ///
7637        /// This is a **required** field for requests.
7638        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7639            self.0.request.name = v.into();
7640            self
7641        }
7642    }
7643
7644    #[doc(hidden)]
7645    impl gax::options::internal::RequestBuilder for GetServingConfig {
7646        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7647            &mut self.0.options
7648        }
7649    }
7650
7651    /// The request builder for [ServingConfigService::list_serving_configs][crate::client::ServingConfigService::list_serving_configs] calls.
7652    ///
7653    /// # Example
7654    /// ```
7655    /// # use google_cloud_retail_v2::builder::serving_config_service::ListServingConfigs;
7656    /// # async fn sample() -> gax::Result<()> {
7657    /// use gax::paginator::ItemPaginator;
7658    ///
7659    /// let builder = prepare_request_builder();
7660    /// let mut items = builder.by_item();
7661    /// while let Some(result) = items.next().await {
7662    ///   let item = result?;
7663    /// }
7664    /// # Ok(()) }
7665    ///
7666    /// fn prepare_request_builder() -> ListServingConfigs {
7667    ///   # panic!();
7668    ///   // ... details omitted ...
7669    /// }
7670    /// ```
7671    #[derive(Clone, Debug)]
7672    pub struct ListServingConfigs(RequestBuilder<crate::model::ListServingConfigsRequest>);
7673
7674    impl ListServingConfigs {
7675        pub(crate) fn new(
7676            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7677        ) -> Self {
7678            Self(RequestBuilder::new(stub))
7679        }
7680
7681        /// Sets the full request, replacing any prior values.
7682        pub fn with_request<V: Into<crate::model::ListServingConfigsRequest>>(
7683            mut self,
7684            v: V,
7685        ) -> Self {
7686            self.0.request = v.into();
7687            self
7688        }
7689
7690        /// Sets all the options, replacing any prior values.
7691        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7692            self.0.options = v.into();
7693            self
7694        }
7695
7696        /// Sends the request.
7697        pub async fn send(self) -> Result<crate::model::ListServingConfigsResponse> {
7698            (*self.0.stub)
7699                .list_serving_configs(self.0.request, self.0.options)
7700                .await
7701                .map(gax::response::Response::into_body)
7702        }
7703
7704        /// Streams each page in the collection.
7705        pub fn by_page(
7706            self,
7707        ) -> impl gax::paginator::Paginator<crate::model::ListServingConfigsResponse, gax::error::Error>
7708        {
7709            use std::clone::Clone;
7710            let token = self.0.request.page_token.clone();
7711            let execute = move |token: String| {
7712                let mut builder = self.clone();
7713                builder.0.request = builder.0.request.set_page_token(token);
7714                builder.send()
7715            };
7716            gax::paginator::internal::new_paginator(token, execute)
7717        }
7718
7719        /// Streams each item in the collection.
7720        pub fn by_item(
7721            self,
7722        ) -> impl gax::paginator::ItemPaginator<
7723            crate::model::ListServingConfigsResponse,
7724            gax::error::Error,
7725        > {
7726            use gax::paginator::Paginator;
7727            self.by_page().items()
7728        }
7729
7730        /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
7731        ///
7732        /// This is a **required** field for requests.
7733        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7734            self.0.request.parent = v.into();
7735            self
7736        }
7737
7738        /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
7739        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7740            self.0.request.page_size = v.into();
7741            self
7742        }
7743
7744        /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
7745        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7746            self.0.request.page_token = v.into();
7747            self
7748        }
7749    }
7750
7751    #[doc(hidden)]
7752    impl gax::options::internal::RequestBuilder for ListServingConfigs {
7753        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7754            &mut self.0.options
7755        }
7756    }
7757
7758    /// The request builder for [ServingConfigService::add_control][crate::client::ServingConfigService::add_control] calls.
7759    ///
7760    /// # Example
7761    /// ```
7762    /// # use google_cloud_retail_v2::builder::serving_config_service::AddControl;
7763    /// # async fn sample() -> gax::Result<()> {
7764    ///
7765    /// let builder = prepare_request_builder();
7766    /// let response = builder.send().await?;
7767    /// # Ok(()) }
7768    ///
7769    /// fn prepare_request_builder() -> AddControl {
7770    ///   # panic!();
7771    ///   // ... details omitted ...
7772    /// }
7773    /// ```
7774    #[derive(Clone, Debug)]
7775    pub struct AddControl(RequestBuilder<crate::model::AddControlRequest>);
7776
7777    impl AddControl {
7778        pub(crate) fn new(
7779            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7780        ) -> Self {
7781            Self(RequestBuilder::new(stub))
7782        }
7783
7784        /// Sets the full request, replacing any prior values.
7785        pub fn with_request<V: Into<crate::model::AddControlRequest>>(mut self, v: V) -> Self {
7786            self.0.request = v.into();
7787            self
7788        }
7789
7790        /// Sets all the options, replacing any prior values.
7791        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7792            self.0.options = v.into();
7793            self
7794        }
7795
7796        /// Sends the request.
7797        pub async fn send(self) -> Result<crate::model::ServingConfig> {
7798            (*self.0.stub)
7799                .add_control(self.0.request, self.0.options)
7800                .await
7801                .map(gax::response::Response::into_body)
7802        }
7803
7804        /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
7805        ///
7806        /// This is a **required** field for requests.
7807        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7808            self.0.request.serving_config = v.into();
7809            self
7810        }
7811
7812        /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
7813        ///
7814        /// This is a **required** field for requests.
7815        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7816            self.0.request.control_id = v.into();
7817            self
7818        }
7819    }
7820
7821    #[doc(hidden)]
7822    impl gax::options::internal::RequestBuilder for AddControl {
7823        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7824            &mut self.0.options
7825        }
7826    }
7827
7828    /// The request builder for [ServingConfigService::remove_control][crate::client::ServingConfigService::remove_control] calls.
7829    ///
7830    /// # Example
7831    /// ```
7832    /// # use google_cloud_retail_v2::builder::serving_config_service::RemoveControl;
7833    /// # async fn sample() -> gax::Result<()> {
7834    ///
7835    /// let builder = prepare_request_builder();
7836    /// let response = builder.send().await?;
7837    /// # Ok(()) }
7838    ///
7839    /// fn prepare_request_builder() -> RemoveControl {
7840    ///   # panic!();
7841    ///   // ... details omitted ...
7842    /// }
7843    /// ```
7844    #[derive(Clone, Debug)]
7845    pub struct RemoveControl(RequestBuilder<crate::model::RemoveControlRequest>);
7846
7847    impl RemoveControl {
7848        pub(crate) fn new(
7849            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7850        ) -> Self {
7851            Self(RequestBuilder::new(stub))
7852        }
7853
7854        /// Sets the full request, replacing any prior values.
7855        pub fn with_request<V: Into<crate::model::RemoveControlRequest>>(mut self, v: V) -> Self {
7856            self.0.request = v.into();
7857            self
7858        }
7859
7860        /// Sets all the options, replacing any prior values.
7861        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7862            self.0.options = v.into();
7863            self
7864        }
7865
7866        /// Sends the request.
7867        pub async fn send(self) -> Result<crate::model::ServingConfig> {
7868            (*self.0.stub)
7869                .remove_control(self.0.request, self.0.options)
7870                .await
7871                .map(gax::response::Response::into_body)
7872        }
7873
7874        /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
7875        ///
7876        /// This is a **required** field for requests.
7877        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7878            self.0.request.serving_config = v.into();
7879            self
7880        }
7881
7882        /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
7883        ///
7884        /// This is a **required** field for requests.
7885        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7886            self.0.request.control_id = v.into();
7887            self
7888        }
7889    }
7890
7891    #[doc(hidden)]
7892    impl gax::options::internal::RequestBuilder for RemoveControl {
7893        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7894            &mut self.0.options
7895        }
7896    }
7897
7898    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
7899    ///
7900    /// # Example
7901    /// ```
7902    /// # use google_cloud_retail_v2::builder::serving_config_service::ListOperations;
7903    /// # async fn sample() -> gax::Result<()> {
7904    /// use gax::paginator::ItemPaginator;
7905    ///
7906    /// let builder = prepare_request_builder();
7907    /// let mut items = builder.by_item();
7908    /// while let Some(result) = items.next().await {
7909    ///   let item = result?;
7910    /// }
7911    /// # Ok(()) }
7912    ///
7913    /// fn prepare_request_builder() -> ListOperations {
7914    ///   # panic!();
7915    ///   // ... details omitted ...
7916    /// }
7917    /// ```
7918    #[derive(Clone, Debug)]
7919    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7920
7921    impl ListOperations {
7922        pub(crate) fn new(
7923            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7924        ) -> Self {
7925            Self(RequestBuilder::new(stub))
7926        }
7927
7928        /// Sets the full request, replacing any prior values.
7929        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7930            mut self,
7931            v: V,
7932        ) -> Self {
7933            self.0.request = v.into();
7934            self
7935        }
7936
7937        /// Sets all the options, replacing any prior values.
7938        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7939            self.0.options = v.into();
7940            self
7941        }
7942
7943        /// Sends the request.
7944        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7945            (*self.0.stub)
7946                .list_operations(self.0.request, self.0.options)
7947                .await
7948                .map(gax::response::Response::into_body)
7949        }
7950
7951        /// Streams each page in the collection.
7952        pub fn by_page(
7953            self,
7954        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7955        {
7956            use std::clone::Clone;
7957            let token = self.0.request.page_token.clone();
7958            let execute = move |token: String| {
7959                let mut builder = self.clone();
7960                builder.0.request = builder.0.request.set_page_token(token);
7961                builder.send()
7962            };
7963            gax::paginator::internal::new_paginator(token, execute)
7964        }
7965
7966        /// Streams each item in the collection.
7967        pub fn by_item(
7968            self,
7969        ) -> impl gax::paginator::ItemPaginator<
7970            longrunning::model::ListOperationsResponse,
7971            gax::error::Error,
7972        > {
7973            use gax::paginator::Paginator;
7974            self.by_page().items()
7975        }
7976
7977        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7978        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7979            self.0.request.name = v.into();
7980            self
7981        }
7982
7983        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7984        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7985            self.0.request.filter = v.into();
7986            self
7987        }
7988
7989        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7990        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7991            self.0.request.page_size = v.into();
7992            self
7993        }
7994
7995        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7996        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7997            self.0.request.page_token = v.into();
7998            self
7999        }
8000
8001        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
8002        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8003            self.0.request.return_partial_success = v.into();
8004            self
8005        }
8006    }
8007
8008    #[doc(hidden)]
8009    impl gax::options::internal::RequestBuilder for ListOperations {
8010        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8011            &mut self.0.options
8012        }
8013    }
8014
8015    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
8016    ///
8017    /// # Example
8018    /// ```
8019    /// # use google_cloud_retail_v2::builder::serving_config_service::GetOperation;
8020    /// # async fn sample() -> gax::Result<()> {
8021    ///
8022    /// let builder = prepare_request_builder();
8023    /// let response = builder.send().await?;
8024    /// # Ok(()) }
8025    ///
8026    /// fn prepare_request_builder() -> GetOperation {
8027    ///   # panic!();
8028    ///   // ... details omitted ...
8029    /// }
8030    /// ```
8031    #[derive(Clone, Debug)]
8032    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8033
8034    impl GetOperation {
8035        pub(crate) fn new(
8036            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8037        ) -> Self {
8038            Self(RequestBuilder::new(stub))
8039        }
8040
8041        /// Sets the full request, replacing any prior values.
8042        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8043            mut self,
8044            v: V,
8045        ) -> Self {
8046            self.0.request = v.into();
8047            self
8048        }
8049
8050        /// Sets all the options, replacing any prior values.
8051        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8052            self.0.options = v.into();
8053            self
8054        }
8055
8056        /// Sends the request.
8057        pub async fn send(self) -> Result<longrunning::model::Operation> {
8058            (*self.0.stub)
8059                .get_operation(self.0.request, self.0.options)
8060                .await
8061                .map(gax::response::Response::into_body)
8062        }
8063
8064        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8065        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8066            self.0.request.name = v.into();
8067            self
8068        }
8069    }
8070
8071    #[doc(hidden)]
8072    impl gax::options::internal::RequestBuilder for GetOperation {
8073        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8074            &mut self.0.options
8075        }
8076    }
8077}
8078
8079pub mod user_event_service {
8080    use crate::Result;
8081
8082    /// A builder for [UserEventService][crate::client::UserEventService].
8083    ///
8084    /// ```
8085    /// # async fn sample() -> gax::client_builder::Result<()> {
8086    /// # use google_cloud_retail_v2::*;
8087    /// # use builder::user_event_service::ClientBuilder;
8088    /// # use client::UserEventService;
8089    /// let builder : ClientBuilder = UserEventService::builder();
8090    /// let client = builder
8091    ///     .with_endpoint("https://retail.googleapis.com")
8092    ///     .build().await?;
8093    /// # Ok(()) }
8094    /// ```
8095    pub type ClientBuilder =
8096        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8097
8098    pub(crate) mod client {
8099        use super::super::super::client::UserEventService;
8100        pub struct Factory;
8101        impl gax::client_builder::internal::ClientFactory for Factory {
8102            type Client = UserEventService;
8103            type Credentials = gaxi::options::Credentials;
8104            async fn build(
8105                self,
8106                config: gaxi::options::ClientConfig,
8107            ) -> gax::client_builder::Result<Self::Client> {
8108                Self::Client::new(config).await
8109            }
8110        }
8111    }
8112
8113    /// Common implementation for [crate::client::UserEventService] request builders.
8114    #[derive(Clone, Debug)]
8115    pub(crate) struct RequestBuilder<R: std::default::Default> {
8116        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8117        request: R,
8118        options: gax::options::RequestOptions,
8119    }
8120
8121    impl<R> RequestBuilder<R>
8122    where
8123        R: std::default::Default,
8124    {
8125        pub(crate) fn new(
8126            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8127        ) -> Self {
8128            Self {
8129                stub,
8130                request: R::default(),
8131                options: gax::options::RequestOptions::default(),
8132            }
8133        }
8134    }
8135
8136    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
8137    ///
8138    /// # Example
8139    /// ```
8140    /// # use google_cloud_retail_v2::builder::user_event_service::WriteUserEvent;
8141    /// # async fn sample() -> gax::Result<()> {
8142    ///
8143    /// let builder = prepare_request_builder();
8144    /// let response = builder.send().await?;
8145    /// # Ok(()) }
8146    ///
8147    /// fn prepare_request_builder() -> WriteUserEvent {
8148    ///   # panic!();
8149    ///   // ... details omitted ...
8150    /// }
8151    /// ```
8152    #[derive(Clone, Debug)]
8153    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
8154
8155    impl WriteUserEvent {
8156        pub(crate) fn new(
8157            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8158        ) -> Self {
8159            Self(RequestBuilder::new(stub))
8160        }
8161
8162        /// Sets the full request, replacing any prior values.
8163        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
8164            self.0.request = v.into();
8165            self
8166        }
8167
8168        /// Sets all the options, replacing any prior values.
8169        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8170            self.0.options = v.into();
8171            self
8172        }
8173
8174        /// Sends the request.
8175        pub async fn send(self) -> Result<crate::model::UserEvent> {
8176            (*self.0.stub)
8177                .write_user_event(self.0.request, self.0.options)
8178                .await
8179                .map(gax::response::Response::into_body)
8180        }
8181
8182        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
8183        ///
8184        /// This is a **required** field for requests.
8185        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8186            self.0.request.parent = v.into();
8187            self
8188        }
8189
8190        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
8191        ///
8192        /// This is a **required** field for requests.
8193        pub fn set_user_event<T>(mut self, v: T) -> Self
8194        where
8195            T: std::convert::Into<crate::model::UserEvent>,
8196        {
8197            self.0.request.user_event = std::option::Option::Some(v.into());
8198            self
8199        }
8200
8201        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
8202        ///
8203        /// This is a **required** field for requests.
8204        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
8205        where
8206            T: std::convert::Into<crate::model::UserEvent>,
8207        {
8208            self.0.request.user_event = v.map(|x| x.into());
8209            self
8210        }
8211
8212        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
8213        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
8214            self.0.request.write_async = v.into();
8215            self
8216        }
8217    }
8218
8219    #[doc(hidden)]
8220    impl gax::options::internal::RequestBuilder for WriteUserEvent {
8221        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8222            &mut self.0.options
8223        }
8224    }
8225
8226    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
8227    ///
8228    /// # Example
8229    /// ```
8230    /// # use google_cloud_retail_v2::builder::user_event_service::CollectUserEvent;
8231    /// # async fn sample() -> gax::Result<()> {
8232    ///
8233    /// let builder = prepare_request_builder();
8234    /// let response = builder.send().await?;
8235    /// # Ok(()) }
8236    ///
8237    /// fn prepare_request_builder() -> CollectUserEvent {
8238    ///   # panic!();
8239    ///   // ... details omitted ...
8240    /// }
8241    /// ```
8242    #[derive(Clone, Debug)]
8243    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
8244
8245    impl CollectUserEvent {
8246        pub(crate) fn new(
8247            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8248        ) -> Self {
8249            Self(RequestBuilder::new(stub))
8250        }
8251
8252        /// Sets the full request, replacing any prior values.
8253        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
8254            mut self,
8255            v: V,
8256        ) -> Self {
8257            self.0.request = v.into();
8258            self
8259        }
8260
8261        /// Sets all the options, replacing any prior values.
8262        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8263            self.0.options = v.into();
8264            self
8265        }
8266
8267        /// Sends the request.
8268        pub async fn send(self) -> Result<api::model::HttpBody> {
8269            (*self.0.stub)
8270                .collect_user_event(self.0.request, self.0.options)
8271                .await
8272                .map(gax::response::Response::into_body)
8273        }
8274
8275        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
8276        ///
8277        /// This is a **required** field for requests.
8278        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8279            self.0.request.parent = v.into();
8280            self
8281        }
8282
8283        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
8284        ///
8285        /// This is a **required** field for requests.
8286        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
8287            self.0.request.user_event = v.into();
8288            self
8289        }
8290
8291        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
8292        pub fn set_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
8293            self.0.request.uri = v.into();
8294            self
8295        }
8296
8297        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
8298        pub fn set_ets<T: Into<i64>>(mut self, v: T) -> Self {
8299            self.0.request.ets = v.into();
8300            self
8301        }
8302
8303        /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
8304        pub fn set_raw_json<T: Into<std::string::String>>(mut self, v: T) -> Self {
8305            self.0.request.raw_json = v.into();
8306            self
8307        }
8308
8309        /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
8310        ///
8311        /// Note that all the setters affecting `conversion_rule` are
8312        /// mutually exclusive.
8313        pub fn set_conversion_rule<
8314            T: Into<Option<crate::model::collect_user_event_request::ConversionRule>>,
8315        >(
8316            mut self,
8317            v: T,
8318        ) -> Self {
8319            self.0.request.conversion_rule = v.into();
8320            self
8321        }
8322
8323        /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
8324        /// to hold a `PrebuiltRule`.
8325        ///
8326        /// Note that all the setters affecting `conversion_rule` are
8327        /// mutually exclusive.
8328        pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(
8329            mut self,
8330            v: T,
8331        ) -> Self {
8332            self.0.request = self.0.request.set_prebuilt_rule(v);
8333            self
8334        }
8335    }
8336
8337    #[doc(hidden)]
8338    impl gax::options::internal::RequestBuilder for CollectUserEvent {
8339        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8340            &mut self.0.options
8341        }
8342    }
8343
8344    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
8345    ///
8346    /// # Example
8347    /// ```
8348    /// # use google_cloud_retail_v2::builder::user_event_service::PurgeUserEvents;
8349    /// # async fn sample() -> gax::Result<()> {
8350    /// use lro::Poller;
8351    ///
8352    /// let builder = prepare_request_builder();
8353    /// let response = builder.poller().until_done().await?;
8354    /// # Ok(()) }
8355    ///
8356    /// fn prepare_request_builder() -> PurgeUserEvents {
8357    ///   # panic!();
8358    ///   // ... details omitted ...
8359    /// }
8360    /// ```
8361    #[derive(Clone, Debug)]
8362    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
8363
8364    impl PurgeUserEvents {
8365        pub(crate) fn new(
8366            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8367        ) -> Self {
8368            Self(RequestBuilder::new(stub))
8369        }
8370
8371        /// Sets the full request, replacing any prior values.
8372        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
8373            self.0.request = v.into();
8374            self
8375        }
8376
8377        /// Sets all the options, replacing any prior values.
8378        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8379            self.0.options = v.into();
8380            self
8381        }
8382
8383        /// Sends the request.
8384        ///
8385        /// # Long running operations
8386        ///
8387        /// This starts, but does not poll, a longrunning operation. More information
8388        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
8389        pub async fn send(self) -> Result<longrunning::model::Operation> {
8390            (*self.0.stub)
8391                .purge_user_events(self.0.request, self.0.options)
8392                .await
8393                .map(gax::response::Response::into_body)
8394        }
8395
8396        /// Creates a [Poller][lro::Poller] to work with `purge_user_events`.
8397        pub fn poller(
8398            self,
8399        ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeMetadata>
8400        {
8401            type Operation = lro::internal::Operation<
8402                crate::model::PurgeUserEventsResponse,
8403                crate::model::PurgeMetadata,
8404            >;
8405            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8406            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8407
8408            let stub = self.0.stub.clone();
8409            let mut options = self.0.options.clone();
8410            options.set_retry_policy(gax::retry_policy::NeverRetry);
8411            let query = move |name| {
8412                let stub = stub.clone();
8413                let options = options.clone();
8414                async {
8415                    let op = GetOperation::new(stub)
8416                        .set_name(name)
8417                        .with_options(options)
8418                        .send()
8419                        .await?;
8420                    Ok(Operation::new(op))
8421                }
8422            };
8423
8424            let start = move || async {
8425                let op = self.send().await?;
8426                Ok(Operation::new(op))
8427            };
8428
8429            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8430        }
8431
8432        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
8433        ///
8434        /// This is a **required** field for requests.
8435        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8436            self.0.request.parent = v.into();
8437            self
8438        }
8439
8440        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
8441        ///
8442        /// This is a **required** field for requests.
8443        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8444            self.0.request.filter = v.into();
8445            self
8446        }
8447
8448        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
8449        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
8450            self.0.request.force = v.into();
8451            self
8452        }
8453    }
8454
8455    #[doc(hidden)]
8456    impl gax::options::internal::RequestBuilder for PurgeUserEvents {
8457        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8458            &mut self.0.options
8459        }
8460    }
8461
8462    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
8463    ///
8464    /// # Example
8465    /// ```
8466    /// # use google_cloud_retail_v2::builder::user_event_service::ImportUserEvents;
8467    /// # async fn sample() -> gax::Result<()> {
8468    /// use lro::Poller;
8469    ///
8470    /// let builder = prepare_request_builder();
8471    /// let response = builder.poller().until_done().await?;
8472    /// # Ok(()) }
8473    ///
8474    /// fn prepare_request_builder() -> ImportUserEvents {
8475    ///   # panic!();
8476    ///   // ... details omitted ...
8477    /// }
8478    /// ```
8479    #[derive(Clone, Debug)]
8480    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
8481
8482    impl ImportUserEvents {
8483        pub(crate) fn new(
8484            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8485        ) -> Self {
8486            Self(RequestBuilder::new(stub))
8487        }
8488
8489        /// Sets the full request, replacing any prior values.
8490        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
8491            mut self,
8492            v: V,
8493        ) -> Self {
8494            self.0.request = v.into();
8495            self
8496        }
8497
8498        /// Sets all the options, replacing any prior values.
8499        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8500            self.0.options = v.into();
8501            self
8502        }
8503
8504        /// Sends the request.
8505        ///
8506        /// # Long running operations
8507        ///
8508        /// This starts, but does not poll, a longrunning operation. More information
8509        /// on [import_user_events][crate::client::UserEventService::import_user_events].
8510        pub async fn send(self) -> Result<longrunning::model::Operation> {
8511            (*self.0.stub)
8512                .import_user_events(self.0.request, self.0.options)
8513                .await
8514                .map(gax::response::Response::into_body)
8515        }
8516
8517        /// Creates a [Poller][lro::Poller] to work with `import_user_events`.
8518        pub fn poller(
8519            self,
8520        ) -> impl lro::Poller<crate::model::ImportUserEventsResponse, crate::model::ImportMetadata>
8521        {
8522            type Operation = lro::internal::Operation<
8523                crate::model::ImportUserEventsResponse,
8524                crate::model::ImportMetadata,
8525            >;
8526            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8527            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8528
8529            let stub = self.0.stub.clone();
8530            let mut options = self.0.options.clone();
8531            options.set_retry_policy(gax::retry_policy::NeverRetry);
8532            let query = move |name| {
8533                let stub = stub.clone();
8534                let options = options.clone();
8535                async {
8536                    let op = GetOperation::new(stub)
8537                        .set_name(name)
8538                        .with_options(options)
8539                        .send()
8540                        .await?;
8541                    Ok(Operation::new(op))
8542                }
8543            };
8544
8545            let start = move || async {
8546                let op = self.send().await?;
8547                Ok(Operation::new(op))
8548            };
8549
8550            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8551        }
8552
8553        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
8554        ///
8555        /// This is a **required** field for requests.
8556        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8557            self.0.request.parent = v.into();
8558            self
8559        }
8560
8561        /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
8562        ///
8563        /// This is a **required** field for requests.
8564        pub fn set_input_config<T>(mut self, v: T) -> Self
8565        where
8566            T: std::convert::Into<crate::model::UserEventInputConfig>,
8567        {
8568            self.0.request.input_config = std::option::Option::Some(v.into());
8569            self
8570        }
8571
8572        /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
8573        ///
8574        /// This is a **required** field for requests.
8575        pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
8576        where
8577            T: std::convert::Into<crate::model::UserEventInputConfig>,
8578        {
8579            self.0.request.input_config = v.map(|x| x.into());
8580            self
8581        }
8582
8583        /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
8584        pub fn set_errors_config<T>(mut self, v: T) -> Self
8585        where
8586            T: std::convert::Into<crate::model::ImportErrorsConfig>,
8587        {
8588            self.0.request.errors_config = std::option::Option::Some(v.into());
8589            self
8590        }
8591
8592        /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
8593        pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
8594        where
8595            T: std::convert::Into<crate::model::ImportErrorsConfig>,
8596        {
8597            self.0.request.errors_config = v.map(|x| x.into());
8598            self
8599        }
8600    }
8601
8602    #[doc(hidden)]
8603    impl gax::options::internal::RequestBuilder for ImportUserEvents {
8604        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8605            &mut self.0.options
8606        }
8607    }
8608
8609    /// The request builder for [UserEventService::rejoin_user_events][crate::client::UserEventService::rejoin_user_events] calls.
8610    ///
8611    /// # Example
8612    /// ```
8613    /// # use google_cloud_retail_v2::builder::user_event_service::RejoinUserEvents;
8614    /// # async fn sample() -> gax::Result<()> {
8615    /// use lro::Poller;
8616    ///
8617    /// let builder = prepare_request_builder();
8618    /// let response = builder.poller().until_done().await?;
8619    /// # Ok(()) }
8620    ///
8621    /// fn prepare_request_builder() -> RejoinUserEvents {
8622    ///   # panic!();
8623    ///   // ... details omitted ...
8624    /// }
8625    /// ```
8626    #[derive(Clone, Debug)]
8627    pub struct RejoinUserEvents(RequestBuilder<crate::model::RejoinUserEventsRequest>);
8628
8629    impl RejoinUserEvents {
8630        pub(crate) fn new(
8631            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8632        ) -> Self {
8633            Self(RequestBuilder::new(stub))
8634        }
8635
8636        /// Sets the full request, replacing any prior values.
8637        pub fn with_request<V: Into<crate::model::RejoinUserEventsRequest>>(
8638            mut self,
8639            v: V,
8640        ) -> Self {
8641            self.0.request = v.into();
8642            self
8643        }
8644
8645        /// Sets all the options, replacing any prior values.
8646        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8647            self.0.options = v.into();
8648            self
8649        }
8650
8651        /// Sends the request.
8652        ///
8653        /// # Long running operations
8654        ///
8655        /// This starts, but does not poll, a longrunning operation. More information
8656        /// on [rejoin_user_events][crate::client::UserEventService::rejoin_user_events].
8657        pub async fn send(self) -> Result<longrunning::model::Operation> {
8658            (*self.0.stub)
8659                .rejoin_user_events(self.0.request, self.0.options)
8660                .await
8661                .map(gax::response::Response::into_body)
8662        }
8663
8664        /// Creates a [Poller][lro::Poller] to work with `rejoin_user_events`.
8665        pub fn poller(
8666            self,
8667        ) -> impl lro::Poller<
8668            crate::model::RejoinUserEventsResponse,
8669            crate::model::RejoinUserEventsMetadata,
8670        > {
8671            type Operation = lro::internal::Operation<
8672                crate::model::RejoinUserEventsResponse,
8673                crate::model::RejoinUserEventsMetadata,
8674            >;
8675            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8676            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8677
8678            let stub = self.0.stub.clone();
8679            let mut options = self.0.options.clone();
8680            options.set_retry_policy(gax::retry_policy::NeverRetry);
8681            let query = move |name| {
8682                let stub = stub.clone();
8683                let options = options.clone();
8684                async {
8685                    let op = GetOperation::new(stub)
8686                        .set_name(name)
8687                        .with_options(options)
8688                        .send()
8689                        .await?;
8690                    Ok(Operation::new(op))
8691                }
8692            };
8693
8694            let start = move || async {
8695                let op = self.send().await?;
8696                Ok(Operation::new(op))
8697            };
8698
8699            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8700        }
8701
8702        /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
8703        ///
8704        /// This is a **required** field for requests.
8705        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8706            self.0.request.parent = v.into();
8707            self
8708        }
8709
8710        /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
8711        pub fn set_user_event_rejoin_scope<
8712            T: Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
8713        >(
8714            mut self,
8715            v: T,
8716        ) -> Self {
8717            self.0.request.user_event_rejoin_scope = v.into();
8718            self
8719        }
8720    }
8721
8722    #[doc(hidden)]
8723    impl gax::options::internal::RequestBuilder for RejoinUserEvents {
8724        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8725            &mut self.0.options
8726        }
8727    }
8728
8729    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
8730    ///
8731    /// # Example
8732    /// ```
8733    /// # use google_cloud_retail_v2::builder::user_event_service::ListOperations;
8734    /// # async fn sample() -> gax::Result<()> {
8735    /// use gax::paginator::ItemPaginator;
8736    ///
8737    /// let builder = prepare_request_builder();
8738    /// let mut items = builder.by_item();
8739    /// while let Some(result) = items.next().await {
8740    ///   let item = result?;
8741    /// }
8742    /// # Ok(()) }
8743    ///
8744    /// fn prepare_request_builder() -> ListOperations {
8745    ///   # panic!();
8746    ///   // ... details omitted ...
8747    /// }
8748    /// ```
8749    #[derive(Clone, Debug)]
8750    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8751
8752    impl ListOperations {
8753        pub(crate) fn new(
8754            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8755        ) -> Self {
8756            Self(RequestBuilder::new(stub))
8757        }
8758
8759        /// Sets the full request, replacing any prior values.
8760        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8761            mut self,
8762            v: V,
8763        ) -> Self {
8764            self.0.request = v.into();
8765            self
8766        }
8767
8768        /// Sets all the options, replacing any prior values.
8769        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8770            self.0.options = v.into();
8771            self
8772        }
8773
8774        /// Sends the request.
8775        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8776            (*self.0.stub)
8777                .list_operations(self.0.request, self.0.options)
8778                .await
8779                .map(gax::response::Response::into_body)
8780        }
8781
8782        /// Streams each page in the collection.
8783        pub fn by_page(
8784            self,
8785        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8786        {
8787            use std::clone::Clone;
8788            let token = self.0.request.page_token.clone();
8789            let execute = move |token: String| {
8790                let mut builder = self.clone();
8791                builder.0.request = builder.0.request.set_page_token(token);
8792                builder.send()
8793            };
8794            gax::paginator::internal::new_paginator(token, execute)
8795        }
8796
8797        /// Streams each item in the collection.
8798        pub fn by_item(
8799            self,
8800        ) -> impl gax::paginator::ItemPaginator<
8801            longrunning::model::ListOperationsResponse,
8802            gax::error::Error,
8803        > {
8804            use gax::paginator::Paginator;
8805            self.by_page().items()
8806        }
8807
8808        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
8809        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8810            self.0.request.name = v.into();
8811            self
8812        }
8813
8814        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
8815        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8816            self.0.request.filter = v.into();
8817            self
8818        }
8819
8820        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
8821        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8822            self.0.request.page_size = v.into();
8823            self
8824        }
8825
8826        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
8827        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8828            self.0.request.page_token = v.into();
8829            self
8830        }
8831
8832        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
8833        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8834            self.0.request.return_partial_success = v.into();
8835            self
8836        }
8837    }
8838
8839    #[doc(hidden)]
8840    impl gax::options::internal::RequestBuilder for ListOperations {
8841        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8842            &mut self.0.options
8843        }
8844    }
8845
8846    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
8847    ///
8848    /// # Example
8849    /// ```
8850    /// # use google_cloud_retail_v2::builder::user_event_service::GetOperation;
8851    /// # async fn sample() -> gax::Result<()> {
8852    ///
8853    /// let builder = prepare_request_builder();
8854    /// let response = builder.send().await?;
8855    /// # Ok(()) }
8856    ///
8857    /// fn prepare_request_builder() -> GetOperation {
8858    ///   # panic!();
8859    ///   // ... details omitted ...
8860    /// }
8861    /// ```
8862    #[derive(Clone, Debug)]
8863    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8864
8865    impl GetOperation {
8866        pub(crate) fn new(
8867            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8868        ) -> Self {
8869            Self(RequestBuilder::new(stub))
8870        }
8871
8872        /// Sets the full request, replacing any prior values.
8873        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8874            mut self,
8875            v: V,
8876        ) -> Self {
8877            self.0.request = v.into();
8878            self
8879        }
8880
8881        /// Sets all the options, replacing any prior values.
8882        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8883            self.0.options = v.into();
8884            self
8885        }
8886
8887        /// Sends the request.
8888        pub async fn send(self) -> Result<longrunning::model::Operation> {
8889            (*self.0.stub)
8890                .get_operation(self.0.request, self.0.options)
8891                .await
8892                .map(gax::response::Response::into_body)
8893        }
8894
8895        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8896        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8897            self.0.request.name = v.into();
8898            self
8899        }
8900    }
8901
8902    #[doc(hidden)]
8903    impl gax::options::internal::RequestBuilder for GetOperation {
8904        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8905            &mut self.0.options
8906        }
8907    }
8908}