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