Skip to main content

google_cloud_retail_v2/
builder.rs

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