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