Skip to main content

google_cloud_retail_v2/
builder.rs

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