Skip to main content

google_cloud_recommender_v1/
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 recommender {
18    use crate::Result;
19
20    /// A builder for [Recommender][crate::client::Recommender].
21    ///
22    /// ```
23    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24    /// # use google_cloud_recommender_v1::*;
25    /// # use builder::recommender::ClientBuilder;
26    /// # use client::Recommender;
27    /// let builder : ClientBuilder = Recommender::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://recommender.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::Recommender;
37        pub struct Factory;
38        impl crate::ClientFactory for Factory {
39            type Client = Recommender;
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::Recommender] 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::Recommender>,
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::Recommender>,
64        ) -> Self {
65            Self {
66                stub,
67                request: R::default(),
68                options: crate::RequestOptions::default(),
69            }
70        }
71    }
72
73    /// The request builder for [Recommender::list_insights][crate::client::Recommender::list_insights] calls.
74    ///
75    /// # Example
76    /// ```
77    /// # use google_cloud_recommender_v1::builder::recommender::ListInsights;
78    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
79    /// use google_cloud_gax::paginator::ItemPaginator;
80    ///
81    /// let builder = prepare_request_builder();
82    /// let mut items = builder.by_item();
83    /// while let Some(result) = items.next().await {
84    ///   let item = result?;
85    /// }
86    /// # Ok(()) }
87    ///
88    /// fn prepare_request_builder() -> ListInsights {
89    ///   # panic!();
90    ///   // ... details omitted ...
91    /// }
92    /// ```
93    #[derive(Clone, Debug)]
94    pub struct ListInsights(RequestBuilder<crate::model::ListInsightsRequest>);
95
96    impl ListInsights {
97        pub(crate) fn new(
98            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
99        ) -> Self {
100            Self(RequestBuilder::new(stub))
101        }
102
103        /// Sets the full request, replacing any prior values.
104        pub fn with_request<V: Into<crate::model::ListInsightsRequest>>(mut self, v: V) -> 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        pub async fn send(self) -> Result<crate::model::ListInsightsResponse> {
117            (*self.0.stub)
118                .list_insights(self.0.request, self.0.options)
119                .await
120                .map(crate::Response::into_body)
121        }
122
123        /// Streams each page in the collection.
124        pub fn by_page(
125            self,
126        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInsightsResponse, crate::Error>
127        {
128            use std::clone::Clone;
129            let token = self.0.request.page_token.clone();
130            let execute = move |token: String| {
131                let mut builder = self.clone();
132                builder.0.request = builder.0.request.set_page_token(token);
133                builder.send()
134            };
135            google_cloud_gax::paginator::internal::new_paginator(token, execute)
136        }
137
138        /// Streams each item in the collection.
139        pub fn by_item(
140            self,
141        ) -> impl google_cloud_gax::paginator::ItemPaginator<
142            crate::model::ListInsightsResponse,
143            crate::Error,
144        > {
145            use google_cloud_gax::paginator::Paginator;
146            self.by_page().items()
147        }
148
149        /// Sets the value of [parent][crate::model::ListInsightsRequest::parent].
150        ///
151        /// This is a **required** field for requests.
152        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153            self.0.request.parent = v.into();
154            self
155        }
156
157        /// Sets the value of [page_size][crate::model::ListInsightsRequest::page_size].
158        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159            self.0.request.page_size = v.into();
160            self
161        }
162
163        /// Sets the value of [page_token][crate::model::ListInsightsRequest::page_token].
164        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165            self.0.request.page_token = v.into();
166            self
167        }
168
169        /// Sets the value of [filter][crate::model::ListInsightsRequest::filter].
170        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
171            self.0.request.filter = v.into();
172            self
173        }
174    }
175
176    #[doc(hidden)]
177    impl crate::RequestBuilder for ListInsights {
178        fn request_options(&mut self) -> &mut crate::RequestOptions {
179            &mut self.0.options
180        }
181    }
182
183    /// The request builder for [Recommender::get_insight][crate::client::Recommender::get_insight] calls.
184    ///
185    /// # Example
186    /// ```
187    /// # use google_cloud_recommender_v1::builder::recommender::GetInsight;
188    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
189    ///
190    /// let builder = prepare_request_builder();
191    /// let response = builder.send().await?;
192    /// # Ok(()) }
193    ///
194    /// fn prepare_request_builder() -> GetInsight {
195    ///   # panic!();
196    ///   // ... details omitted ...
197    /// }
198    /// ```
199    #[derive(Clone, Debug)]
200    pub struct GetInsight(RequestBuilder<crate::model::GetInsightRequest>);
201
202    impl GetInsight {
203        pub(crate) fn new(
204            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
205        ) -> Self {
206            Self(RequestBuilder::new(stub))
207        }
208
209        /// Sets the full request, replacing any prior values.
210        pub fn with_request<V: Into<crate::model::GetInsightRequest>>(mut self, v: V) -> Self {
211            self.0.request = v.into();
212            self
213        }
214
215        /// Sets all the options, replacing any prior values.
216        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
217            self.0.options = v.into();
218            self
219        }
220
221        /// Sends the request.
222        pub async fn send(self) -> Result<crate::model::Insight> {
223            (*self.0.stub)
224                .get_insight(self.0.request, self.0.options)
225                .await
226                .map(crate::Response::into_body)
227        }
228
229        /// Sets the value of [name][crate::model::GetInsightRequest::name].
230        ///
231        /// This is a **required** field for requests.
232        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
233            self.0.request.name = v.into();
234            self
235        }
236    }
237
238    #[doc(hidden)]
239    impl crate::RequestBuilder for GetInsight {
240        fn request_options(&mut self) -> &mut crate::RequestOptions {
241            &mut self.0.options
242        }
243    }
244
245    /// The request builder for [Recommender::mark_insight_accepted][crate::client::Recommender::mark_insight_accepted] calls.
246    ///
247    /// # Example
248    /// ```
249    /// # use google_cloud_recommender_v1::builder::recommender::MarkInsightAccepted;
250    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
251    ///
252    /// let builder = prepare_request_builder();
253    /// let response = builder.send().await?;
254    /// # Ok(()) }
255    ///
256    /// fn prepare_request_builder() -> MarkInsightAccepted {
257    ///   # panic!();
258    ///   // ... details omitted ...
259    /// }
260    /// ```
261    #[derive(Clone, Debug)]
262    pub struct MarkInsightAccepted(RequestBuilder<crate::model::MarkInsightAcceptedRequest>);
263
264    impl MarkInsightAccepted {
265        pub(crate) fn new(
266            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
267        ) -> Self {
268            Self(RequestBuilder::new(stub))
269        }
270
271        /// Sets the full request, replacing any prior values.
272        pub fn with_request<V: Into<crate::model::MarkInsightAcceptedRequest>>(
273            mut self,
274            v: V,
275        ) -> Self {
276            self.0.request = v.into();
277            self
278        }
279
280        /// Sets all the options, replacing any prior values.
281        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
282            self.0.options = v.into();
283            self
284        }
285
286        /// Sends the request.
287        pub async fn send(self) -> Result<crate::model::Insight> {
288            (*self.0.stub)
289                .mark_insight_accepted(self.0.request, self.0.options)
290                .await
291                .map(crate::Response::into_body)
292        }
293
294        /// Sets the value of [name][crate::model::MarkInsightAcceptedRequest::name].
295        ///
296        /// This is a **required** field for requests.
297        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
298            self.0.request.name = v.into();
299            self
300        }
301
302        /// Sets the value of [state_metadata][crate::model::MarkInsightAcceptedRequest::state_metadata].
303        pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
304        where
305            T: std::iter::IntoIterator<Item = (K, V)>,
306            K: std::convert::Into<std::string::String>,
307            V: std::convert::Into<std::string::String>,
308        {
309            self.0.request.state_metadata =
310                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
311            self
312        }
313
314        /// Sets the value of [etag][crate::model::MarkInsightAcceptedRequest::etag].
315        ///
316        /// This is a **required** field for requests.
317        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
318            self.0.request.etag = v.into();
319            self
320        }
321    }
322
323    #[doc(hidden)]
324    impl crate::RequestBuilder for MarkInsightAccepted {
325        fn request_options(&mut self) -> &mut crate::RequestOptions {
326            &mut self.0.options
327        }
328    }
329
330    /// The request builder for [Recommender::list_recommendations][crate::client::Recommender::list_recommendations] calls.
331    ///
332    /// # Example
333    /// ```
334    /// # use google_cloud_recommender_v1::builder::recommender::ListRecommendations;
335    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
336    /// use google_cloud_gax::paginator::ItemPaginator;
337    ///
338    /// let builder = prepare_request_builder();
339    /// let mut items = builder.by_item();
340    /// while let Some(result) = items.next().await {
341    ///   let item = result?;
342    /// }
343    /// # Ok(()) }
344    ///
345    /// fn prepare_request_builder() -> ListRecommendations {
346    ///   # panic!();
347    ///   // ... details omitted ...
348    /// }
349    /// ```
350    #[derive(Clone, Debug)]
351    pub struct ListRecommendations(RequestBuilder<crate::model::ListRecommendationsRequest>);
352
353    impl ListRecommendations {
354        pub(crate) fn new(
355            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
356        ) -> Self {
357            Self(RequestBuilder::new(stub))
358        }
359
360        /// Sets the full request, replacing any prior values.
361        pub fn with_request<V: Into<crate::model::ListRecommendationsRequest>>(
362            mut self,
363            v: V,
364        ) -> Self {
365            self.0.request = v.into();
366            self
367        }
368
369        /// Sets all the options, replacing any prior values.
370        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
371            self.0.options = v.into();
372            self
373        }
374
375        /// Sends the request.
376        pub async fn send(self) -> Result<crate::model::ListRecommendationsResponse> {
377            (*self.0.stub)
378                .list_recommendations(self.0.request, self.0.options)
379                .await
380                .map(crate::Response::into_body)
381        }
382
383        /// Streams each page in the collection.
384        pub fn by_page(
385            self,
386        ) -> impl google_cloud_gax::paginator::Paginator<
387            crate::model::ListRecommendationsResponse,
388            crate::Error,
389        > {
390            use std::clone::Clone;
391            let token = self.0.request.page_token.clone();
392            let execute = move |token: String| {
393                let mut builder = self.clone();
394                builder.0.request = builder.0.request.set_page_token(token);
395                builder.send()
396            };
397            google_cloud_gax::paginator::internal::new_paginator(token, execute)
398        }
399
400        /// Streams each item in the collection.
401        pub fn by_item(
402            self,
403        ) -> impl google_cloud_gax::paginator::ItemPaginator<
404            crate::model::ListRecommendationsResponse,
405            crate::Error,
406        > {
407            use google_cloud_gax::paginator::Paginator;
408            self.by_page().items()
409        }
410
411        /// Sets the value of [parent][crate::model::ListRecommendationsRequest::parent].
412        ///
413        /// This is a **required** field for requests.
414        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
415            self.0.request.parent = v.into();
416            self
417        }
418
419        /// Sets the value of [page_size][crate::model::ListRecommendationsRequest::page_size].
420        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
421            self.0.request.page_size = v.into();
422            self
423        }
424
425        /// Sets the value of [page_token][crate::model::ListRecommendationsRequest::page_token].
426        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
427            self.0.request.page_token = v.into();
428            self
429        }
430
431        /// Sets the value of [filter][crate::model::ListRecommendationsRequest::filter].
432        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
433            self.0.request.filter = v.into();
434            self
435        }
436    }
437
438    #[doc(hidden)]
439    impl crate::RequestBuilder for ListRecommendations {
440        fn request_options(&mut self) -> &mut crate::RequestOptions {
441            &mut self.0.options
442        }
443    }
444
445    /// The request builder for [Recommender::get_recommendation][crate::client::Recommender::get_recommendation] calls.
446    ///
447    /// # Example
448    /// ```
449    /// # use google_cloud_recommender_v1::builder::recommender::GetRecommendation;
450    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
451    ///
452    /// let builder = prepare_request_builder();
453    /// let response = builder.send().await?;
454    /// # Ok(()) }
455    ///
456    /// fn prepare_request_builder() -> GetRecommendation {
457    ///   # panic!();
458    ///   // ... details omitted ...
459    /// }
460    /// ```
461    #[derive(Clone, Debug)]
462    pub struct GetRecommendation(RequestBuilder<crate::model::GetRecommendationRequest>);
463
464    impl GetRecommendation {
465        pub(crate) fn new(
466            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
467        ) -> Self {
468            Self(RequestBuilder::new(stub))
469        }
470
471        /// Sets the full request, replacing any prior values.
472        pub fn with_request<V: Into<crate::model::GetRecommendationRequest>>(
473            mut self,
474            v: V,
475        ) -> Self {
476            self.0.request = v.into();
477            self
478        }
479
480        /// Sets all the options, replacing any prior values.
481        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
482            self.0.options = v.into();
483            self
484        }
485
486        /// Sends the request.
487        pub async fn send(self) -> Result<crate::model::Recommendation> {
488            (*self.0.stub)
489                .get_recommendation(self.0.request, self.0.options)
490                .await
491                .map(crate::Response::into_body)
492        }
493
494        /// Sets the value of [name][crate::model::GetRecommendationRequest::name].
495        ///
496        /// This is a **required** field for requests.
497        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
498            self.0.request.name = v.into();
499            self
500        }
501    }
502
503    #[doc(hidden)]
504    impl crate::RequestBuilder for GetRecommendation {
505        fn request_options(&mut self) -> &mut crate::RequestOptions {
506            &mut self.0.options
507        }
508    }
509
510    /// The request builder for [Recommender::mark_recommendation_dismissed][crate::client::Recommender::mark_recommendation_dismissed] calls.
511    ///
512    /// # Example
513    /// ```
514    /// # use google_cloud_recommender_v1::builder::recommender::MarkRecommendationDismissed;
515    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
516    ///
517    /// let builder = prepare_request_builder();
518    /// let response = builder.send().await?;
519    /// # Ok(()) }
520    ///
521    /// fn prepare_request_builder() -> MarkRecommendationDismissed {
522    ///   # panic!();
523    ///   // ... details omitted ...
524    /// }
525    /// ```
526    #[derive(Clone, Debug)]
527    pub struct MarkRecommendationDismissed(
528        RequestBuilder<crate::model::MarkRecommendationDismissedRequest>,
529    );
530
531    impl MarkRecommendationDismissed {
532        pub(crate) fn new(
533            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
534        ) -> Self {
535            Self(RequestBuilder::new(stub))
536        }
537
538        /// Sets the full request, replacing any prior values.
539        pub fn with_request<V: Into<crate::model::MarkRecommendationDismissedRequest>>(
540            mut self,
541            v: V,
542        ) -> Self {
543            self.0.request = v.into();
544            self
545        }
546
547        /// Sets all the options, replacing any prior values.
548        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
549            self.0.options = v.into();
550            self
551        }
552
553        /// Sends the request.
554        pub async fn send(self) -> Result<crate::model::Recommendation> {
555            (*self.0.stub)
556                .mark_recommendation_dismissed(self.0.request, self.0.options)
557                .await
558                .map(crate::Response::into_body)
559        }
560
561        /// Sets the value of [name][crate::model::MarkRecommendationDismissedRequest::name].
562        ///
563        /// This is a **required** field for requests.
564        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
565            self.0.request.name = v.into();
566            self
567        }
568
569        /// Sets the value of [etag][crate::model::MarkRecommendationDismissedRequest::etag].
570        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
571            self.0.request.etag = v.into();
572            self
573        }
574    }
575
576    #[doc(hidden)]
577    impl crate::RequestBuilder for MarkRecommendationDismissed {
578        fn request_options(&mut self) -> &mut crate::RequestOptions {
579            &mut self.0.options
580        }
581    }
582
583    /// The request builder for [Recommender::mark_recommendation_claimed][crate::client::Recommender::mark_recommendation_claimed] calls.
584    ///
585    /// # Example
586    /// ```
587    /// # use google_cloud_recommender_v1::builder::recommender::MarkRecommendationClaimed;
588    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
589    ///
590    /// let builder = prepare_request_builder();
591    /// let response = builder.send().await?;
592    /// # Ok(()) }
593    ///
594    /// fn prepare_request_builder() -> MarkRecommendationClaimed {
595    ///   # panic!();
596    ///   // ... details omitted ...
597    /// }
598    /// ```
599    #[derive(Clone, Debug)]
600    pub struct MarkRecommendationClaimed(
601        RequestBuilder<crate::model::MarkRecommendationClaimedRequest>,
602    );
603
604    impl MarkRecommendationClaimed {
605        pub(crate) fn new(
606            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
607        ) -> Self {
608            Self(RequestBuilder::new(stub))
609        }
610
611        /// Sets the full request, replacing any prior values.
612        pub fn with_request<V: Into<crate::model::MarkRecommendationClaimedRequest>>(
613            mut self,
614            v: V,
615        ) -> Self {
616            self.0.request = v.into();
617            self
618        }
619
620        /// Sets all the options, replacing any prior values.
621        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
622            self.0.options = v.into();
623            self
624        }
625
626        /// Sends the request.
627        pub async fn send(self) -> Result<crate::model::Recommendation> {
628            (*self.0.stub)
629                .mark_recommendation_claimed(self.0.request, self.0.options)
630                .await
631                .map(crate::Response::into_body)
632        }
633
634        /// Sets the value of [name][crate::model::MarkRecommendationClaimedRequest::name].
635        ///
636        /// This is a **required** field for requests.
637        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
638            self.0.request.name = v.into();
639            self
640        }
641
642        /// Sets the value of [state_metadata][crate::model::MarkRecommendationClaimedRequest::state_metadata].
643        pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
644        where
645            T: std::iter::IntoIterator<Item = (K, V)>,
646            K: std::convert::Into<std::string::String>,
647            V: std::convert::Into<std::string::String>,
648        {
649            self.0.request.state_metadata =
650                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
651            self
652        }
653
654        /// Sets the value of [etag][crate::model::MarkRecommendationClaimedRequest::etag].
655        ///
656        /// This is a **required** field for requests.
657        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
658            self.0.request.etag = v.into();
659            self
660        }
661    }
662
663    #[doc(hidden)]
664    impl crate::RequestBuilder for MarkRecommendationClaimed {
665        fn request_options(&mut self) -> &mut crate::RequestOptions {
666            &mut self.0.options
667        }
668    }
669
670    /// The request builder for [Recommender::mark_recommendation_succeeded][crate::client::Recommender::mark_recommendation_succeeded] calls.
671    ///
672    /// # Example
673    /// ```
674    /// # use google_cloud_recommender_v1::builder::recommender::MarkRecommendationSucceeded;
675    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
676    ///
677    /// let builder = prepare_request_builder();
678    /// let response = builder.send().await?;
679    /// # Ok(()) }
680    ///
681    /// fn prepare_request_builder() -> MarkRecommendationSucceeded {
682    ///   # panic!();
683    ///   // ... details omitted ...
684    /// }
685    /// ```
686    #[derive(Clone, Debug)]
687    pub struct MarkRecommendationSucceeded(
688        RequestBuilder<crate::model::MarkRecommendationSucceededRequest>,
689    );
690
691    impl MarkRecommendationSucceeded {
692        pub(crate) fn new(
693            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
694        ) -> Self {
695            Self(RequestBuilder::new(stub))
696        }
697
698        /// Sets the full request, replacing any prior values.
699        pub fn with_request<V: Into<crate::model::MarkRecommendationSucceededRequest>>(
700            mut self,
701            v: V,
702        ) -> Self {
703            self.0.request = v.into();
704            self
705        }
706
707        /// Sets all the options, replacing any prior values.
708        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
709            self.0.options = v.into();
710            self
711        }
712
713        /// Sends the request.
714        pub async fn send(self) -> Result<crate::model::Recommendation> {
715            (*self.0.stub)
716                .mark_recommendation_succeeded(self.0.request, self.0.options)
717                .await
718                .map(crate::Response::into_body)
719        }
720
721        /// Sets the value of [name][crate::model::MarkRecommendationSucceededRequest::name].
722        ///
723        /// This is a **required** field for requests.
724        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
725            self.0.request.name = v.into();
726            self
727        }
728
729        /// Sets the value of [state_metadata][crate::model::MarkRecommendationSucceededRequest::state_metadata].
730        pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
731        where
732            T: std::iter::IntoIterator<Item = (K, V)>,
733            K: std::convert::Into<std::string::String>,
734            V: std::convert::Into<std::string::String>,
735        {
736            self.0.request.state_metadata =
737                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
738            self
739        }
740
741        /// Sets the value of [etag][crate::model::MarkRecommendationSucceededRequest::etag].
742        ///
743        /// This is a **required** field for requests.
744        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
745            self.0.request.etag = v.into();
746            self
747        }
748    }
749
750    #[doc(hidden)]
751    impl crate::RequestBuilder for MarkRecommendationSucceeded {
752        fn request_options(&mut self) -> &mut crate::RequestOptions {
753            &mut self.0.options
754        }
755    }
756
757    /// The request builder for [Recommender::mark_recommendation_failed][crate::client::Recommender::mark_recommendation_failed] calls.
758    ///
759    /// # Example
760    /// ```
761    /// # use google_cloud_recommender_v1::builder::recommender::MarkRecommendationFailed;
762    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
763    ///
764    /// let builder = prepare_request_builder();
765    /// let response = builder.send().await?;
766    /// # Ok(()) }
767    ///
768    /// fn prepare_request_builder() -> MarkRecommendationFailed {
769    ///   # panic!();
770    ///   // ... details omitted ...
771    /// }
772    /// ```
773    #[derive(Clone, Debug)]
774    pub struct MarkRecommendationFailed(
775        RequestBuilder<crate::model::MarkRecommendationFailedRequest>,
776    );
777
778    impl MarkRecommendationFailed {
779        pub(crate) fn new(
780            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
781        ) -> Self {
782            Self(RequestBuilder::new(stub))
783        }
784
785        /// Sets the full request, replacing any prior values.
786        pub fn with_request<V: Into<crate::model::MarkRecommendationFailedRequest>>(
787            mut self,
788            v: V,
789        ) -> Self {
790            self.0.request = v.into();
791            self
792        }
793
794        /// Sets all the options, replacing any prior values.
795        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
796            self.0.options = v.into();
797            self
798        }
799
800        /// Sends the request.
801        pub async fn send(self) -> Result<crate::model::Recommendation> {
802            (*self.0.stub)
803                .mark_recommendation_failed(self.0.request, self.0.options)
804                .await
805                .map(crate::Response::into_body)
806        }
807
808        /// Sets the value of [name][crate::model::MarkRecommendationFailedRequest::name].
809        ///
810        /// This is a **required** field for requests.
811        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
812            self.0.request.name = v.into();
813            self
814        }
815
816        /// Sets the value of [state_metadata][crate::model::MarkRecommendationFailedRequest::state_metadata].
817        pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
818        where
819            T: std::iter::IntoIterator<Item = (K, V)>,
820            K: std::convert::Into<std::string::String>,
821            V: std::convert::Into<std::string::String>,
822        {
823            self.0.request.state_metadata =
824                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
825            self
826        }
827
828        /// Sets the value of [etag][crate::model::MarkRecommendationFailedRequest::etag].
829        ///
830        /// This is a **required** field for requests.
831        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
832            self.0.request.etag = v.into();
833            self
834        }
835    }
836
837    #[doc(hidden)]
838    impl crate::RequestBuilder for MarkRecommendationFailed {
839        fn request_options(&mut self) -> &mut crate::RequestOptions {
840            &mut self.0.options
841        }
842    }
843
844    /// The request builder for [Recommender::get_recommender_config][crate::client::Recommender::get_recommender_config] calls.
845    ///
846    /// # Example
847    /// ```
848    /// # use google_cloud_recommender_v1::builder::recommender::GetRecommenderConfig;
849    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
850    ///
851    /// let builder = prepare_request_builder();
852    /// let response = builder.send().await?;
853    /// # Ok(()) }
854    ///
855    /// fn prepare_request_builder() -> GetRecommenderConfig {
856    ///   # panic!();
857    ///   // ... details omitted ...
858    /// }
859    /// ```
860    #[derive(Clone, Debug)]
861    pub struct GetRecommenderConfig(RequestBuilder<crate::model::GetRecommenderConfigRequest>);
862
863    impl GetRecommenderConfig {
864        pub(crate) fn new(
865            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
866        ) -> Self {
867            Self(RequestBuilder::new(stub))
868        }
869
870        /// Sets the full request, replacing any prior values.
871        pub fn with_request<V: Into<crate::model::GetRecommenderConfigRequest>>(
872            mut self,
873            v: V,
874        ) -> Self {
875            self.0.request = v.into();
876            self
877        }
878
879        /// Sets all the options, replacing any prior values.
880        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
881            self.0.options = v.into();
882            self
883        }
884
885        /// Sends the request.
886        pub async fn send(self) -> Result<crate::model::RecommenderConfig> {
887            (*self.0.stub)
888                .get_recommender_config(self.0.request, self.0.options)
889                .await
890                .map(crate::Response::into_body)
891        }
892
893        /// Sets the value of [name][crate::model::GetRecommenderConfigRequest::name].
894        ///
895        /// This is a **required** field for requests.
896        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
897            self.0.request.name = v.into();
898            self
899        }
900    }
901
902    #[doc(hidden)]
903    impl crate::RequestBuilder for GetRecommenderConfig {
904        fn request_options(&mut self) -> &mut crate::RequestOptions {
905            &mut self.0.options
906        }
907    }
908
909    /// The request builder for [Recommender::update_recommender_config][crate::client::Recommender::update_recommender_config] calls.
910    ///
911    /// # Example
912    /// ```
913    /// # use google_cloud_recommender_v1::builder::recommender::UpdateRecommenderConfig;
914    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
915    ///
916    /// let builder = prepare_request_builder();
917    /// let response = builder.send().await?;
918    /// # Ok(()) }
919    ///
920    /// fn prepare_request_builder() -> UpdateRecommenderConfig {
921    ///   # panic!();
922    ///   // ... details omitted ...
923    /// }
924    /// ```
925    #[derive(Clone, Debug)]
926    pub struct UpdateRecommenderConfig(
927        RequestBuilder<crate::model::UpdateRecommenderConfigRequest>,
928    );
929
930    impl UpdateRecommenderConfig {
931        pub(crate) fn new(
932            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
933        ) -> Self {
934            Self(RequestBuilder::new(stub))
935        }
936
937        /// Sets the full request, replacing any prior values.
938        pub fn with_request<V: Into<crate::model::UpdateRecommenderConfigRequest>>(
939            mut self,
940            v: V,
941        ) -> Self {
942            self.0.request = v.into();
943            self
944        }
945
946        /// Sets all the options, replacing any prior values.
947        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
948            self.0.options = v.into();
949            self
950        }
951
952        /// Sends the request.
953        pub async fn send(self) -> Result<crate::model::RecommenderConfig> {
954            (*self.0.stub)
955                .update_recommender_config(self.0.request, self.0.options)
956                .await
957                .map(crate::Response::into_body)
958        }
959
960        /// Sets the value of [recommender_config][crate::model::UpdateRecommenderConfigRequest::recommender_config].
961        ///
962        /// This is a **required** field for requests.
963        pub fn set_recommender_config<T>(mut self, v: T) -> Self
964        where
965            T: std::convert::Into<crate::model::RecommenderConfig>,
966        {
967            self.0.request.recommender_config = std::option::Option::Some(v.into());
968            self
969        }
970
971        /// Sets or clears the value of [recommender_config][crate::model::UpdateRecommenderConfigRequest::recommender_config].
972        ///
973        /// This is a **required** field for requests.
974        pub fn set_or_clear_recommender_config<T>(mut self, v: std::option::Option<T>) -> Self
975        where
976            T: std::convert::Into<crate::model::RecommenderConfig>,
977        {
978            self.0.request.recommender_config = v.map(|x| x.into());
979            self
980        }
981
982        /// Sets the value of [update_mask][crate::model::UpdateRecommenderConfigRequest::update_mask].
983        pub fn set_update_mask<T>(mut self, v: T) -> Self
984        where
985            T: std::convert::Into<wkt::FieldMask>,
986        {
987            self.0.request.update_mask = std::option::Option::Some(v.into());
988            self
989        }
990
991        /// Sets or clears the value of [update_mask][crate::model::UpdateRecommenderConfigRequest::update_mask].
992        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
993        where
994            T: std::convert::Into<wkt::FieldMask>,
995        {
996            self.0.request.update_mask = v.map(|x| x.into());
997            self
998        }
999
1000        /// Sets the value of [validate_only][crate::model::UpdateRecommenderConfigRequest::validate_only].
1001        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1002            self.0.request.validate_only = v.into();
1003            self
1004        }
1005    }
1006
1007    #[doc(hidden)]
1008    impl crate::RequestBuilder for UpdateRecommenderConfig {
1009        fn request_options(&mut self) -> &mut crate::RequestOptions {
1010            &mut self.0.options
1011        }
1012    }
1013
1014    /// The request builder for [Recommender::get_insight_type_config][crate::client::Recommender::get_insight_type_config] calls.
1015    ///
1016    /// # Example
1017    /// ```
1018    /// # use google_cloud_recommender_v1::builder::recommender::GetInsightTypeConfig;
1019    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
1020    ///
1021    /// let builder = prepare_request_builder();
1022    /// let response = builder.send().await?;
1023    /// # Ok(()) }
1024    ///
1025    /// fn prepare_request_builder() -> GetInsightTypeConfig {
1026    ///   # panic!();
1027    ///   // ... details omitted ...
1028    /// }
1029    /// ```
1030    #[derive(Clone, Debug)]
1031    pub struct GetInsightTypeConfig(RequestBuilder<crate::model::GetInsightTypeConfigRequest>);
1032
1033    impl GetInsightTypeConfig {
1034        pub(crate) fn new(
1035            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
1036        ) -> Self {
1037            Self(RequestBuilder::new(stub))
1038        }
1039
1040        /// Sets the full request, replacing any prior values.
1041        pub fn with_request<V: Into<crate::model::GetInsightTypeConfigRequest>>(
1042            mut self,
1043            v: V,
1044        ) -> Self {
1045            self.0.request = v.into();
1046            self
1047        }
1048
1049        /// Sets all the options, replacing any prior values.
1050        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1051            self.0.options = v.into();
1052            self
1053        }
1054
1055        /// Sends the request.
1056        pub async fn send(self) -> Result<crate::model::InsightTypeConfig> {
1057            (*self.0.stub)
1058                .get_insight_type_config(self.0.request, self.0.options)
1059                .await
1060                .map(crate::Response::into_body)
1061        }
1062
1063        /// Sets the value of [name][crate::model::GetInsightTypeConfigRequest::name].
1064        ///
1065        /// This is a **required** field for requests.
1066        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1067            self.0.request.name = v.into();
1068            self
1069        }
1070    }
1071
1072    #[doc(hidden)]
1073    impl crate::RequestBuilder for GetInsightTypeConfig {
1074        fn request_options(&mut self) -> &mut crate::RequestOptions {
1075            &mut self.0.options
1076        }
1077    }
1078
1079    /// The request builder for [Recommender::update_insight_type_config][crate::client::Recommender::update_insight_type_config] calls.
1080    ///
1081    /// # Example
1082    /// ```
1083    /// # use google_cloud_recommender_v1::builder::recommender::UpdateInsightTypeConfig;
1084    /// # async fn sample() -> google_cloud_recommender_v1::Result<()> {
1085    ///
1086    /// let builder = prepare_request_builder();
1087    /// let response = builder.send().await?;
1088    /// # Ok(()) }
1089    ///
1090    /// fn prepare_request_builder() -> UpdateInsightTypeConfig {
1091    ///   # panic!();
1092    ///   // ... details omitted ...
1093    /// }
1094    /// ```
1095    #[derive(Clone, Debug)]
1096    pub struct UpdateInsightTypeConfig(
1097        RequestBuilder<crate::model::UpdateInsightTypeConfigRequest>,
1098    );
1099
1100    impl UpdateInsightTypeConfig {
1101        pub(crate) fn new(
1102            stub: std::sync::Arc<dyn super::super::stub::dynamic::Recommender>,
1103        ) -> Self {
1104            Self(RequestBuilder::new(stub))
1105        }
1106
1107        /// Sets the full request, replacing any prior values.
1108        pub fn with_request<V: Into<crate::model::UpdateInsightTypeConfigRequest>>(
1109            mut self,
1110            v: V,
1111        ) -> Self {
1112            self.0.request = v.into();
1113            self
1114        }
1115
1116        /// Sets all the options, replacing any prior values.
1117        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1118            self.0.options = v.into();
1119            self
1120        }
1121
1122        /// Sends the request.
1123        pub async fn send(self) -> Result<crate::model::InsightTypeConfig> {
1124            (*self.0.stub)
1125                .update_insight_type_config(self.0.request, self.0.options)
1126                .await
1127                .map(crate::Response::into_body)
1128        }
1129
1130        /// Sets the value of [insight_type_config][crate::model::UpdateInsightTypeConfigRequest::insight_type_config].
1131        ///
1132        /// This is a **required** field for requests.
1133        pub fn set_insight_type_config<T>(mut self, v: T) -> Self
1134        where
1135            T: std::convert::Into<crate::model::InsightTypeConfig>,
1136        {
1137            self.0.request.insight_type_config = std::option::Option::Some(v.into());
1138            self
1139        }
1140
1141        /// Sets or clears the value of [insight_type_config][crate::model::UpdateInsightTypeConfigRequest::insight_type_config].
1142        ///
1143        /// This is a **required** field for requests.
1144        pub fn set_or_clear_insight_type_config<T>(mut self, v: std::option::Option<T>) -> Self
1145        where
1146            T: std::convert::Into<crate::model::InsightTypeConfig>,
1147        {
1148            self.0.request.insight_type_config = v.map(|x| x.into());
1149            self
1150        }
1151
1152        /// Sets the value of [update_mask][crate::model::UpdateInsightTypeConfigRequest::update_mask].
1153        pub fn set_update_mask<T>(mut self, v: T) -> Self
1154        where
1155            T: std::convert::Into<wkt::FieldMask>,
1156        {
1157            self.0.request.update_mask = std::option::Option::Some(v.into());
1158            self
1159        }
1160
1161        /// Sets or clears the value of [update_mask][crate::model::UpdateInsightTypeConfigRequest::update_mask].
1162        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1163        where
1164            T: std::convert::Into<wkt::FieldMask>,
1165        {
1166            self.0.request.update_mask = v.map(|x| x.into());
1167            self
1168        }
1169
1170        /// Sets the value of [validate_only][crate::model::UpdateInsightTypeConfigRequest::validate_only].
1171        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1172            self.0.request.validate_only = v.into();
1173            self
1174        }
1175    }
1176
1177    #[doc(hidden)]
1178    impl crate::RequestBuilder for UpdateInsightTypeConfig {
1179        fn request_options(&mut self) -> &mut crate::RequestOptions {
1180            &mut self.0.options
1181        }
1182    }
1183}