Skip to main content

google_cloud_tasks_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 cloud_tasks {
18    use crate::Result;
19
20    /// A builder for [CloudTasks][crate::client::CloudTasks].
21    ///
22    /// ```
23    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24    /// # use google_cloud_tasks_v2::*;
25    /// # use builder::cloud_tasks::ClientBuilder;
26    /// # use client::CloudTasks;
27    /// let builder : ClientBuilder = CloudTasks::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://cloudtasks.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::CloudTasks;
37        pub struct Factory;
38        impl crate::ClientFactory for Factory {
39            type Client = CloudTasks;
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::CloudTasks] 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::CloudTasks>,
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::CloudTasks>,
64        ) -> Self {
65            Self {
66                stub,
67                request: R::default(),
68                options: crate::RequestOptions::default(),
69            }
70        }
71    }
72
73    /// The request builder for [CloudTasks::list_queues][crate::client::CloudTasks::list_queues] calls.
74    ///
75    /// # Example
76    /// ```
77    /// # use google_cloud_tasks_v2::builder::cloud_tasks::ListQueues;
78    /// # async fn sample() -> google_cloud_tasks_v2::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() -> ListQueues {
89    ///   # panic!();
90    ///   // ... details omitted ...
91    /// }
92    /// ```
93    #[derive(Clone, Debug)]
94    pub struct ListQueues(RequestBuilder<crate::model::ListQueuesRequest>);
95
96    impl ListQueues {
97        pub(crate) fn new(
98            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
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::ListQueuesRequest>>(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::ListQueuesResponse> {
117            (*self.0.stub)
118                .list_queues(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::ListQueuesResponse, 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::ListQueuesResponse,
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::ListQueuesRequest::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 [filter][crate::model::ListQueuesRequest::filter].
158        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
159            self.0.request.filter = v.into();
160            self
161        }
162
163        /// Sets the value of [page_size][crate::model::ListQueuesRequest::page_size].
164        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
165            self.0.request.page_size = v.into();
166            self
167        }
168
169        /// Sets the value of [page_token][crate::model::ListQueuesRequest::page_token].
170        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
171            self.0.request.page_token = v.into();
172            self
173        }
174    }
175
176    #[doc(hidden)]
177    impl crate::RequestBuilder for ListQueues {
178        fn request_options(&mut self) -> &mut crate::RequestOptions {
179            &mut self.0.options
180        }
181    }
182
183    /// The request builder for [CloudTasks::get_queue][crate::client::CloudTasks::get_queue] calls.
184    ///
185    /// # Example
186    /// ```
187    /// # use google_cloud_tasks_v2::builder::cloud_tasks::GetQueue;
188    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
189    ///
190    /// let builder = prepare_request_builder();
191    /// let response = builder.send().await?;
192    /// # Ok(()) }
193    ///
194    /// fn prepare_request_builder() -> GetQueue {
195    ///   # panic!();
196    ///   // ... details omitted ...
197    /// }
198    /// ```
199    #[derive(Clone, Debug)]
200    pub struct GetQueue(RequestBuilder<crate::model::GetQueueRequest>);
201
202    impl GetQueue {
203        pub(crate) fn new(
204            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
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::GetQueueRequest>>(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::Queue> {
223            (*self.0.stub)
224                .get_queue(self.0.request, self.0.options)
225                .await
226                .map(crate::Response::into_body)
227        }
228
229        /// Sets the value of [name][crate::model::GetQueueRequest::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 GetQueue {
240        fn request_options(&mut self) -> &mut crate::RequestOptions {
241            &mut self.0.options
242        }
243    }
244
245    /// The request builder for [CloudTasks::create_queue][crate::client::CloudTasks::create_queue] calls.
246    ///
247    /// # Example
248    /// ```
249    /// # use google_cloud_tasks_v2::builder::cloud_tasks::CreateQueue;
250    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
251    ///
252    /// let builder = prepare_request_builder();
253    /// let response = builder.send().await?;
254    /// # Ok(()) }
255    ///
256    /// fn prepare_request_builder() -> CreateQueue {
257    ///   # panic!();
258    ///   // ... details omitted ...
259    /// }
260    /// ```
261    #[derive(Clone, Debug)]
262    pub struct CreateQueue(RequestBuilder<crate::model::CreateQueueRequest>);
263
264    impl CreateQueue {
265        pub(crate) fn new(
266            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
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::CreateQueueRequest>>(mut self, v: V) -> Self {
273            self.0.request = v.into();
274            self
275        }
276
277        /// Sets all the options, replacing any prior values.
278        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
279            self.0.options = v.into();
280            self
281        }
282
283        /// Sends the request.
284        pub async fn send(self) -> Result<crate::model::Queue> {
285            (*self.0.stub)
286                .create_queue(self.0.request, self.0.options)
287                .await
288                .map(crate::Response::into_body)
289        }
290
291        /// Sets the value of [parent][crate::model::CreateQueueRequest::parent].
292        ///
293        /// This is a **required** field for requests.
294        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
295            self.0.request.parent = v.into();
296            self
297        }
298
299        /// Sets the value of [queue][crate::model::CreateQueueRequest::queue].
300        ///
301        /// This is a **required** field for requests.
302        pub fn set_queue<T>(mut self, v: T) -> Self
303        where
304            T: std::convert::Into<crate::model::Queue>,
305        {
306            self.0.request.queue = std::option::Option::Some(v.into());
307            self
308        }
309
310        /// Sets or clears the value of [queue][crate::model::CreateQueueRequest::queue].
311        ///
312        /// This is a **required** field for requests.
313        pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
314        where
315            T: std::convert::Into<crate::model::Queue>,
316        {
317            self.0.request.queue = v.map(|x| x.into());
318            self
319        }
320    }
321
322    #[doc(hidden)]
323    impl crate::RequestBuilder for CreateQueue {
324        fn request_options(&mut self) -> &mut crate::RequestOptions {
325            &mut self.0.options
326        }
327    }
328
329    /// The request builder for [CloudTasks::update_queue][crate::client::CloudTasks::update_queue] calls.
330    ///
331    /// # Example
332    /// ```
333    /// # use google_cloud_tasks_v2::builder::cloud_tasks::UpdateQueue;
334    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
335    ///
336    /// let builder = prepare_request_builder();
337    /// let response = builder.send().await?;
338    /// # Ok(()) }
339    ///
340    /// fn prepare_request_builder() -> UpdateQueue {
341    ///   # panic!();
342    ///   // ... details omitted ...
343    /// }
344    /// ```
345    #[derive(Clone, Debug)]
346    pub struct UpdateQueue(RequestBuilder<crate::model::UpdateQueueRequest>);
347
348    impl UpdateQueue {
349        pub(crate) fn new(
350            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
351        ) -> Self {
352            Self(RequestBuilder::new(stub))
353        }
354
355        /// Sets the full request, replacing any prior values.
356        pub fn with_request<V: Into<crate::model::UpdateQueueRequest>>(mut self, v: V) -> Self {
357            self.0.request = v.into();
358            self
359        }
360
361        /// Sets all the options, replacing any prior values.
362        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
363            self.0.options = v.into();
364            self
365        }
366
367        /// Sends the request.
368        pub async fn send(self) -> Result<crate::model::Queue> {
369            (*self.0.stub)
370                .update_queue(self.0.request, self.0.options)
371                .await
372                .map(crate::Response::into_body)
373        }
374
375        /// Sets the value of [queue][crate::model::UpdateQueueRequest::queue].
376        ///
377        /// This is a **required** field for requests.
378        pub fn set_queue<T>(mut self, v: T) -> Self
379        where
380            T: std::convert::Into<crate::model::Queue>,
381        {
382            self.0.request.queue = std::option::Option::Some(v.into());
383            self
384        }
385
386        /// Sets or clears the value of [queue][crate::model::UpdateQueueRequest::queue].
387        ///
388        /// This is a **required** field for requests.
389        pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
390        where
391            T: std::convert::Into<crate::model::Queue>,
392        {
393            self.0.request.queue = v.map(|x| x.into());
394            self
395        }
396
397        /// Sets the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
398        pub fn set_update_mask<T>(mut self, v: T) -> Self
399        where
400            T: std::convert::Into<wkt::FieldMask>,
401        {
402            self.0.request.update_mask = std::option::Option::Some(v.into());
403            self
404        }
405
406        /// Sets or clears the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
407        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
408        where
409            T: std::convert::Into<wkt::FieldMask>,
410        {
411            self.0.request.update_mask = v.map(|x| x.into());
412            self
413        }
414    }
415
416    #[doc(hidden)]
417    impl crate::RequestBuilder for UpdateQueue {
418        fn request_options(&mut self) -> &mut crate::RequestOptions {
419            &mut self.0.options
420        }
421    }
422
423    /// The request builder for [CloudTasks::delete_queue][crate::client::CloudTasks::delete_queue] calls.
424    ///
425    /// # Example
426    /// ```
427    /// # use google_cloud_tasks_v2::builder::cloud_tasks::DeleteQueue;
428    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
429    ///
430    /// let builder = prepare_request_builder();
431    /// let response = builder.send().await?;
432    /// # Ok(()) }
433    ///
434    /// fn prepare_request_builder() -> DeleteQueue {
435    ///   # panic!();
436    ///   // ... details omitted ...
437    /// }
438    /// ```
439    #[derive(Clone, Debug)]
440    pub struct DeleteQueue(RequestBuilder<crate::model::DeleteQueueRequest>);
441
442    impl DeleteQueue {
443        pub(crate) fn new(
444            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
445        ) -> Self {
446            Self(RequestBuilder::new(stub))
447        }
448
449        /// Sets the full request, replacing any prior values.
450        pub fn with_request<V: Into<crate::model::DeleteQueueRequest>>(mut self, v: V) -> Self {
451            self.0.request = v.into();
452            self
453        }
454
455        /// Sets all the options, replacing any prior values.
456        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
457            self.0.options = v.into();
458            self
459        }
460
461        /// Sends the request.
462        pub async fn send(self) -> Result<()> {
463            (*self.0.stub)
464                .delete_queue(self.0.request, self.0.options)
465                .await
466                .map(crate::Response::into_body)
467        }
468
469        /// Sets the value of [name][crate::model::DeleteQueueRequest::name].
470        ///
471        /// This is a **required** field for requests.
472        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
473            self.0.request.name = v.into();
474            self
475        }
476    }
477
478    #[doc(hidden)]
479    impl crate::RequestBuilder for DeleteQueue {
480        fn request_options(&mut self) -> &mut crate::RequestOptions {
481            &mut self.0.options
482        }
483    }
484
485    /// The request builder for [CloudTasks::purge_queue][crate::client::CloudTasks::purge_queue] calls.
486    ///
487    /// # Example
488    /// ```
489    /// # use google_cloud_tasks_v2::builder::cloud_tasks::PurgeQueue;
490    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
491    ///
492    /// let builder = prepare_request_builder();
493    /// let response = builder.send().await?;
494    /// # Ok(()) }
495    ///
496    /// fn prepare_request_builder() -> PurgeQueue {
497    ///   # panic!();
498    ///   // ... details omitted ...
499    /// }
500    /// ```
501    #[derive(Clone, Debug)]
502    pub struct PurgeQueue(RequestBuilder<crate::model::PurgeQueueRequest>);
503
504    impl PurgeQueue {
505        pub(crate) fn new(
506            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
507        ) -> Self {
508            Self(RequestBuilder::new(stub))
509        }
510
511        /// Sets the full request, replacing any prior values.
512        pub fn with_request<V: Into<crate::model::PurgeQueueRequest>>(mut self, v: V) -> Self {
513            self.0.request = v.into();
514            self
515        }
516
517        /// Sets all the options, replacing any prior values.
518        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
519            self.0.options = v.into();
520            self
521        }
522
523        /// Sends the request.
524        pub async fn send(self) -> Result<crate::model::Queue> {
525            (*self.0.stub)
526                .purge_queue(self.0.request, self.0.options)
527                .await
528                .map(crate::Response::into_body)
529        }
530
531        /// Sets the value of [name][crate::model::PurgeQueueRequest::name].
532        ///
533        /// This is a **required** field for requests.
534        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
535            self.0.request.name = v.into();
536            self
537        }
538    }
539
540    #[doc(hidden)]
541    impl crate::RequestBuilder for PurgeQueue {
542        fn request_options(&mut self) -> &mut crate::RequestOptions {
543            &mut self.0.options
544        }
545    }
546
547    /// The request builder for [CloudTasks::pause_queue][crate::client::CloudTasks::pause_queue] calls.
548    ///
549    /// # Example
550    /// ```
551    /// # use google_cloud_tasks_v2::builder::cloud_tasks::PauseQueue;
552    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
553    ///
554    /// let builder = prepare_request_builder();
555    /// let response = builder.send().await?;
556    /// # Ok(()) }
557    ///
558    /// fn prepare_request_builder() -> PauseQueue {
559    ///   # panic!();
560    ///   // ... details omitted ...
561    /// }
562    /// ```
563    #[derive(Clone, Debug)]
564    pub struct PauseQueue(RequestBuilder<crate::model::PauseQueueRequest>);
565
566    impl PauseQueue {
567        pub(crate) fn new(
568            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
569        ) -> Self {
570            Self(RequestBuilder::new(stub))
571        }
572
573        /// Sets the full request, replacing any prior values.
574        pub fn with_request<V: Into<crate::model::PauseQueueRequest>>(mut self, v: V) -> Self {
575            self.0.request = v.into();
576            self
577        }
578
579        /// Sets all the options, replacing any prior values.
580        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
581            self.0.options = v.into();
582            self
583        }
584
585        /// Sends the request.
586        pub async fn send(self) -> Result<crate::model::Queue> {
587            (*self.0.stub)
588                .pause_queue(self.0.request, self.0.options)
589                .await
590                .map(crate::Response::into_body)
591        }
592
593        /// Sets the value of [name][crate::model::PauseQueueRequest::name].
594        ///
595        /// This is a **required** field for requests.
596        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
597            self.0.request.name = v.into();
598            self
599        }
600    }
601
602    #[doc(hidden)]
603    impl crate::RequestBuilder for PauseQueue {
604        fn request_options(&mut self) -> &mut crate::RequestOptions {
605            &mut self.0.options
606        }
607    }
608
609    /// The request builder for [CloudTasks::resume_queue][crate::client::CloudTasks::resume_queue] calls.
610    ///
611    /// # Example
612    /// ```
613    /// # use google_cloud_tasks_v2::builder::cloud_tasks::ResumeQueue;
614    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
615    ///
616    /// let builder = prepare_request_builder();
617    /// let response = builder.send().await?;
618    /// # Ok(()) }
619    ///
620    /// fn prepare_request_builder() -> ResumeQueue {
621    ///   # panic!();
622    ///   // ... details omitted ...
623    /// }
624    /// ```
625    #[derive(Clone, Debug)]
626    pub struct ResumeQueue(RequestBuilder<crate::model::ResumeQueueRequest>);
627
628    impl ResumeQueue {
629        pub(crate) fn new(
630            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
631        ) -> Self {
632            Self(RequestBuilder::new(stub))
633        }
634
635        /// Sets the full request, replacing any prior values.
636        pub fn with_request<V: Into<crate::model::ResumeQueueRequest>>(mut self, v: V) -> Self {
637            self.0.request = v.into();
638            self
639        }
640
641        /// Sets all the options, replacing any prior values.
642        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
643            self.0.options = v.into();
644            self
645        }
646
647        /// Sends the request.
648        pub async fn send(self) -> Result<crate::model::Queue> {
649            (*self.0.stub)
650                .resume_queue(self.0.request, self.0.options)
651                .await
652                .map(crate::Response::into_body)
653        }
654
655        /// Sets the value of [name][crate::model::ResumeQueueRequest::name].
656        ///
657        /// This is a **required** field for requests.
658        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
659            self.0.request.name = v.into();
660            self
661        }
662    }
663
664    #[doc(hidden)]
665    impl crate::RequestBuilder for ResumeQueue {
666        fn request_options(&mut self) -> &mut crate::RequestOptions {
667            &mut self.0.options
668        }
669    }
670
671    /// The request builder for [CloudTasks::get_iam_policy][crate::client::CloudTasks::get_iam_policy] calls.
672    ///
673    /// # Example
674    /// ```
675    /// # use google_cloud_tasks_v2::builder::cloud_tasks::GetIamPolicy;
676    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
677    ///
678    /// let builder = prepare_request_builder();
679    /// let response = builder.send().await?;
680    /// # Ok(()) }
681    ///
682    /// fn prepare_request_builder() -> GetIamPolicy {
683    ///   # panic!();
684    ///   // ... details omitted ...
685    /// }
686    /// ```
687    #[derive(Clone, Debug)]
688    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
689
690    impl GetIamPolicy {
691        pub(crate) fn new(
692            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
693        ) -> Self {
694            Self(RequestBuilder::new(stub))
695        }
696
697        /// Sets the full request, replacing any prior values.
698        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
699            mut self,
700            v: V,
701        ) -> Self {
702            self.0.request = v.into();
703            self
704        }
705
706        /// Sets all the options, replacing any prior values.
707        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
708            self.0.options = v.into();
709            self
710        }
711
712        /// Sends the request.
713        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
714            (*self.0.stub)
715                .get_iam_policy(self.0.request, self.0.options)
716                .await
717                .map(crate::Response::into_body)
718        }
719
720        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
721        ///
722        /// This is a **required** field for requests.
723        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
724            self.0.request.resource = v.into();
725            self
726        }
727
728        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
729        pub fn set_options<T>(mut self, v: T) -> Self
730        where
731            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
732        {
733            self.0.request.options = std::option::Option::Some(v.into());
734            self
735        }
736
737        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
738        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
739        where
740            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
741        {
742            self.0.request.options = v.map(|x| x.into());
743            self
744        }
745    }
746
747    #[doc(hidden)]
748    impl crate::RequestBuilder for GetIamPolicy {
749        fn request_options(&mut self) -> &mut crate::RequestOptions {
750            &mut self.0.options
751        }
752    }
753
754    /// The request builder for [CloudTasks::set_iam_policy][crate::client::CloudTasks::set_iam_policy] calls.
755    ///
756    /// # Example
757    /// ```
758    /// # use google_cloud_tasks_v2::builder::cloud_tasks::SetIamPolicy;
759    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
760    ///
761    /// let builder = prepare_request_builder();
762    /// let response = builder.send().await?;
763    /// # Ok(()) }
764    ///
765    /// fn prepare_request_builder() -> SetIamPolicy {
766    ///   # panic!();
767    ///   // ... details omitted ...
768    /// }
769    /// ```
770    #[derive(Clone, Debug)]
771    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
772
773    impl SetIamPolicy {
774        pub(crate) fn new(
775            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
776        ) -> Self {
777            Self(RequestBuilder::new(stub))
778        }
779
780        /// Sets the full request, replacing any prior values.
781        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
782            mut self,
783            v: V,
784        ) -> Self {
785            self.0.request = v.into();
786            self
787        }
788
789        /// Sets all the options, replacing any prior values.
790        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
791            self.0.options = v.into();
792            self
793        }
794
795        /// Sends the request.
796        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
797            (*self.0.stub)
798                .set_iam_policy(self.0.request, self.0.options)
799                .await
800                .map(crate::Response::into_body)
801        }
802
803        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
804        ///
805        /// This is a **required** field for requests.
806        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
807            self.0.request.resource = v.into();
808            self
809        }
810
811        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
812        ///
813        /// This is a **required** field for requests.
814        pub fn set_policy<T>(mut self, v: T) -> Self
815        where
816            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
817        {
818            self.0.request.policy = std::option::Option::Some(v.into());
819            self
820        }
821
822        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
823        ///
824        /// This is a **required** field for requests.
825        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
826        where
827            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
828        {
829            self.0.request.policy = v.map(|x| x.into());
830            self
831        }
832
833        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
834        pub fn set_update_mask<T>(mut self, v: T) -> Self
835        where
836            T: std::convert::Into<wkt::FieldMask>,
837        {
838            self.0.request.update_mask = std::option::Option::Some(v.into());
839            self
840        }
841
842        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
843        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
844        where
845            T: std::convert::Into<wkt::FieldMask>,
846        {
847            self.0.request.update_mask = v.map(|x| x.into());
848            self
849        }
850    }
851
852    #[doc(hidden)]
853    impl crate::RequestBuilder for SetIamPolicy {
854        fn request_options(&mut self) -> &mut crate::RequestOptions {
855            &mut self.0.options
856        }
857    }
858
859    /// The request builder for [CloudTasks::test_iam_permissions][crate::client::CloudTasks::test_iam_permissions] calls.
860    ///
861    /// # Example
862    /// ```
863    /// # use google_cloud_tasks_v2::builder::cloud_tasks::TestIamPermissions;
864    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
865    ///
866    /// let builder = prepare_request_builder();
867    /// let response = builder.send().await?;
868    /// # Ok(()) }
869    ///
870    /// fn prepare_request_builder() -> TestIamPermissions {
871    ///   # panic!();
872    ///   // ... details omitted ...
873    /// }
874    /// ```
875    #[derive(Clone, Debug)]
876    pub struct TestIamPermissions(
877        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
878    );
879
880    impl TestIamPermissions {
881        pub(crate) fn new(
882            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
883        ) -> Self {
884            Self(RequestBuilder::new(stub))
885        }
886
887        /// Sets the full request, replacing any prior values.
888        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
889            mut self,
890            v: V,
891        ) -> Self {
892            self.0.request = v.into();
893            self
894        }
895
896        /// Sets all the options, replacing any prior values.
897        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
898            self.0.options = v.into();
899            self
900        }
901
902        /// Sends the request.
903        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
904            (*self.0.stub)
905                .test_iam_permissions(self.0.request, self.0.options)
906                .await
907                .map(crate::Response::into_body)
908        }
909
910        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
911        ///
912        /// This is a **required** field for requests.
913        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
914            self.0.request.resource = v.into();
915            self
916        }
917
918        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
919        ///
920        /// This is a **required** field for requests.
921        pub fn set_permissions<T, V>(mut self, v: T) -> Self
922        where
923            T: std::iter::IntoIterator<Item = V>,
924            V: std::convert::Into<std::string::String>,
925        {
926            use std::iter::Iterator;
927            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
928            self
929        }
930    }
931
932    #[doc(hidden)]
933    impl crate::RequestBuilder for TestIamPermissions {
934        fn request_options(&mut self) -> &mut crate::RequestOptions {
935            &mut self.0.options
936        }
937    }
938
939    /// The request builder for [CloudTasks::list_tasks][crate::client::CloudTasks::list_tasks] calls.
940    ///
941    /// # Example
942    /// ```
943    /// # use google_cloud_tasks_v2::builder::cloud_tasks::ListTasks;
944    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
945    /// use google_cloud_gax::paginator::ItemPaginator;
946    ///
947    /// let builder = prepare_request_builder();
948    /// let mut items = builder.by_item();
949    /// while let Some(result) = items.next().await {
950    ///   let item = result?;
951    /// }
952    /// # Ok(()) }
953    ///
954    /// fn prepare_request_builder() -> ListTasks {
955    ///   # panic!();
956    ///   // ... details omitted ...
957    /// }
958    /// ```
959    #[derive(Clone, Debug)]
960    pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
961
962    impl ListTasks {
963        pub(crate) fn new(
964            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
965        ) -> Self {
966            Self(RequestBuilder::new(stub))
967        }
968
969        /// Sets the full request, replacing any prior values.
970        pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
971            self.0.request = v.into();
972            self
973        }
974
975        /// Sets all the options, replacing any prior values.
976        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
977            self.0.options = v.into();
978            self
979        }
980
981        /// Sends the request.
982        pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
983            (*self.0.stub)
984                .list_tasks(self.0.request, self.0.options)
985                .await
986                .map(crate::Response::into_body)
987        }
988
989        /// Streams each page in the collection.
990        pub fn by_page(
991            self,
992        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTasksResponse, crate::Error>
993        {
994            use std::clone::Clone;
995            let token = self.0.request.page_token.clone();
996            let execute = move |token: String| {
997                let mut builder = self.clone();
998                builder.0.request = builder.0.request.set_page_token(token);
999                builder.send()
1000            };
1001            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1002        }
1003
1004        /// Streams each item in the collection.
1005        pub fn by_item(
1006            self,
1007        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListTasksResponse, crate::Error>
1008        {
1009            use google_cloud_gax::paginator::Paginator;
1010            self.by_page().items()
1011        }
1012
1013        /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
1014        ///
1015        /// This is a **required** field for requests.
1016        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1017            self.0.request.parent = v.into();
1018            self
1019        }
1020
1021        /// Sets the value of [response_view][crate::model::ListTasksRequest::response_view].
1022        pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1023            self.0.request.response_view = v.into();
1024            self
1025        }
1026
1027        /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
1028        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1029            self.0.request.page_size = v.into();
1030            self
1031        }
1032
1033        /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
1034        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1035            self.0.request.page_token = v.into();
1036            self
1037        }
1038    }
1039
1040    #[doc(hidden)]
1041    impl crate::RequestBuilder for ListTasks {
1042        fn request_options(&mut self) -> &mut crate::RequestOptions {
1043            &mut self.0.options
1044        }
1045    }
1046
1047    /// The request builder for [CloudTasks::get_task][crate::client::CloudTasks::get_task] calls.
1048    ///
1049    /// # Example
1050    /// ```
1051    /// # use google_cloud_tasks_v2::builder::cloud_tasks::GetTask;
1052    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1053    ///
1054    /// let builder = prepare_request_builder();
1055    /// let response = builder.send().await?;
1056    /// # Ok(()) }
1057    ///
1058    /// fn prepare_request_builder() -> GetTask {
1059    ///   # panic!();
1060    ///   // ... details omitted ...
1061    /// }
1062    /// ```
1063    #[derive(Clone, Debug)]
1064    pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
1065
1066    impl GetTask {
1067        pub(crate) fn new(
1068            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1069        ) -> Self {
1070            Self(RequestBuilder::new(stub))
1071        }
1072
1073        /// Sets the full request, replacing any prior values.
1074        pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
1075            self.0.request = v.into();
1076            self
1077        }
1078
1079        /// Sets all the options, replacing any prior values.
1080        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1081            self.0.options = v.into();
1082            self
1083        }
1084
1085        /// Sends the request.
1086        pub async fn send(self) -> Result<crate::model::Task> {
1087            (*self.0.stub)
1088                .get_task(self.0.request, self.0.options)
1089                .await
1090                .map(crate::Response::into_body)
1091        }
1092
1093        /// Sets the value of [name][crate::model::GetTaskRequest::name].
1094        ///
1095        /// This is a **required** field for requests.
1096        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097            self.0.request.name = v.into();
1098            self
1099        }
1100
1101        /// Sets the value of [response_view][crate::model::GetTaskRequest::response_view].
1102        pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1103            self.0.request.response_view = v.into();
1104            self
1105        }
1106    }
1107
1108    #[doc(hidden)]
1109    impl crate::RequestBuilder for GetTask {
1110        fn request_options(&mut self) -> &mut crate::RequestOptions {
1111            &mut self.0.options
1112        }
1113    }
1114
1115    /// The request builder for [CloudTasks::create_task][crate::client::CloudTasks::create_task] calls.
1116    ///
1117    /// # Example
1118    /// ```
1119    /// # use google_cloud_tasks_v2::builder::cloud_tasks::CreateTask;
1120    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1121    ///
1122    /// let builder = prepare_request_builder();
1123    /// let response = builder.send().await?;
1124    /// # Ok(()) }
1125    ///
1126    /// fn prepare_request_builder() -> CreateTask {
1127    ///   # panic!();
1128    ///   // ... details omitted ...
1129    /// }
1130    /// ```
1131    #[derive(Clone, Debug)]
1132    pub struct CreateTask(RequestBuilder<crate::model::CreateTaskRequest>);
1133
1134    impl CreateTask {
1135        pub(crate) fn new(
1136            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1137        ) -> Self {
1138            Self(RequestBuilder::new(stub))
1139        }
1140
1141        /// Sets the full request, replacing any prior values.
1142        pub fn with_request<V: Into<crate::model::CreateTaskRequest>>(mut self, v: V) -> Self {
1143            self.0.request = v.into();
1144            self
1145        }
1146
1147        /// Sets all the options, replacing any prior values.
1148        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1149            self.0.options = v.into();
1150            self
1151        }
1152
1153        /// Sends the request.
1154        pub async fn send(self) -> Result<crate::model::Task> {
1155            (*self.0.stub)
1156                .create_task(self.0.request, self.0.options)
1157                .await
1158                .map(crate::Response::into_body)
1159        }
1160
1161        /// Sets the value of [parent][crate::model::CreateTaskRequest::parent].
1162        ///
1163        /// This is a **required** field for requests.
1164        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1165            self.0.request.parent = v.into();
1166            self
1167        }
1168
1169        /// Sets the value of [task][crate::model::CreateTaskRequest::task].
1170        ///
1171        /// This is a **required** field for requests.
1172        pub fn set_task<T>(mut self, v: T) -> Self
1173        where
1174            T: std::convert::Into<crate::model::Task>,
1175        {
1176            self.0.request.task = std::option::Option::Some(v.into());
1177            self
1178        }
1179
1180        /// Sets or clears the value of [task][crate::model::CreateTaskRequest::task].
1181        ///
1182        /// This is a **required** field for requests.
1183        pub fn set_or_clear_task<T>(mut self, v: std::option::Option<T>) -> Self
1184        where
1185            T: std::convert::Into<crate::model::Task>,
1186        {
1187            self.0.request.task = v.map(|x| x.into());
1188            self
1189        }
1190
1191        /// Sets the value of [response_view][crate::model::CreateTaskRequest::response_view].
1192        pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1193            self.0.request.response_view = v.into();
1194            self
1195        }
1196    }
1197
1198    #[doc(hidden)]
1199    impl crate::RequestBuilder for CreateTask {
1200        fn request_options(&mut self) -> &mut crate::RequestOptions {
1201            &mut self.0.options
1202        }
1203    }
1204
1205    /// The request builder for [CloudTasks::delete_task][crate::client::CloudTasks::delete_task] calls.
1206    ///
1207    /// # Example
1208    /// ```
1209    /// # use google_cloud_tasks_v2::builder::cloud_tasks::DeleteTask;
1210    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1211    ///
1212    /// let builder = prepare_request_builder();
1213    /// let response = builder.send().await?;
1214    /// # Ok(()) }
1215    ///
1216    /// fn prepare_request_builder() -> DeleteTask {
1217    ///   # panic!();
1218    ///   // ... details omitted ...
1219    /// }
1220    /// ```
1221    #[derive(Clone, Debug)]
1222    pub struct DeleteTask(RequestBuilder<crate::model::DeleteTaskRequest>);
1223
1224    impl DeleteTask {
1225        pub(crate) fn new(
1226            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1227        ) -> Self {
1228            Self(RequestBuilder::new(stub))
1229        }
1230
1231        /// Sets the full request, replacing any prior values.
1232        pub fn with_request<V: Into<crate::model::DeleteTaskRequest>>(mut self, v: V) -> Self {
1233            self.0.request = v.into();
1234            self
1235        }
1236
1237        /// Sets all the options, replacing any prior values.
1238        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1239            self.0.options = v.into();
1240            self
1241        }
1242
1243        /// Sends the request.
1244        pub async fn send(self) -> Result<()> {
1245            (*self.0.stub)
1246                .delete_task(self.0.request, self.0.options)
1247                .await
1248                .map(crate::Response::into_body)
1249        }
1250
1251        /// Sets the value of [name][crate::model::DeleteTaskRequest::name].
1252        ///
1253        /// This is a **required** field for requests.
1254        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1255            self.0.request.name = v.into();
1256            self
1257        }
1258    }
1259
1260    #[doc(hidden)]
1261    impl crate::RequestBuilder for DeleteTask {
1262        fn request_options(&mut self) -> &mut crate::RequestOptions {
1263            &mut self.0.options
1264        }
1265    }
1266
1267    /// The request builder for [CloudTasks::run_task][crate::client::CloudTasks::run_task] calls.
1268    ///
1269    /// # Example
1270    /// ```
1271    /// # use google_cloud_tasks_v2::builder::cloud_tasks::RunTask;
1272    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1273    ///
1274    /// let builder = prepare_request_builder();
1275    /// let response = builder.send().await?;
1276    /// # Ok(()) }
1277    ///
1278    /// fn prepare_request_builder() -> RunTask {
1279    ///   # panic!();
1280    ///   // ... details omitted ...
1281    /// }
1282    /// ```
1283    #[derive(Clone, Debug)]
1284    pub struct RunTask(RequestBuilder<crate::model::RunTaskRequest>);
1285
1286    impl RunTask {
1287        pub(crate) fn new(
1288            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1289        ) -> Self {
1290            Self(RequestBuilder::new(stub))
1291        }
1292
1293        /// Sets the full request, replacing any prior values.
1294        pub fn with_request<V: Into<crate::model::RunTaskRequest>>(mut self, v: V) -> Self {
1295            self.0.request = v.into();
1296            self
1297        }
1298
1299        /// Sets all the options, replacing any prior values.
1300        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1301            self.0.options = v.into();
1302            self
1303        }
1304
1305        /// Sends the request.
1306        pub async fn send(self) -> Result<crate::model::Task> {
1307            (*self.0.stub)
1308                .run_task(self.0.request, self.0.options)
1309                .await
1310                .map(crate::Response::into_body)
1311        }
1312
1313        /// Sets the value of [name][crate::model::RunTaskRequest::name].
1314        ///
1315        /// This is a **required** field for requests.
1316        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1317            self.0.request.name = v.into();
1318            self
1319        }
1320
1321        /// Sets the value of [response_view][crate::model::RunTaskRequest::response_view].
1322        pub fn set_response_view<T: Into<crate::model::task::View>>(mut self, v: T) -> Self {
1323            self.0.request.response_view = v.into();
1324            self
1325        }
1326    }
1327
1328    #[doc(hidden)]
1329    impl crate::RequestBuilder for RunTask {
1330        fn request_options(&mut self) -> &mut crate::RequestOptions {
1331            &mut self.0.options
1332        }
1333    }
1334
1335    /// The request builder for [CloudTasks::list_locations][crate::client::CloudTasks::list_locations] calls.
1336    ///
1337    /// # Example
1338    /// ```
1339    /// # use google_cloud_tasks_v2::builder::cloud_tasks::ListLocations;
1340    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1341    /// use google_cloud_gax::paginator::ItemPaginator;
1342    ///
1343    /// let builder = prepare_request_builder();
1344    /// let mut items = builder.by_item();
1345    /// while let Some(result) = items.next().await {
1346    ///   let item = result?;
1347    /// }
1348    /// # Ok(()) }
1349    ///
1350    /// fn prepare_request_builder() -> ListLocations {
1351    ///   # panic!();
1352    ///   // ... details omitted ...
1353    /// }
1354    /// ```
1355    #[derive(Clone, Debug)]
1356    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1357
1358    impl ListLocations {
1359        pub(crate) fn new(
1360            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1361        ) -> Self {
1362            Self(RequestBuilder::new(stub))
1363        }
1364
1365        /// Sets the full request, replacing any prior values.
1366        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1367            mut self,
1368            v: V,
1369        ) -> Self {
1370            self.0.request = v.into();
1371            self
1372        }
1373
1374        /// Sets all the options, replacing any prior values.
1375        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1376            self.0.options = v.into();
1377            self
1378        }
1379
1380        /// Sends the request.
1381        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1382            (*self.0.stub)
1383                .list_locations(self.0.request, self.0.options)
1384                .await
1385                .map(crate::Response::into_body)
1386        }
1387
1388        /// Streams each page in the collection.
1389        pub fn by_page(
1390            self,
1391        ) -> impl google_cloud_gax::paginator::Paginator<
1392            google_cloud_location::model::ListLocationsResponse,
1393            crate::Error,
1394        > {
1395            use std::clone::Clone;
1396            let token = self.0.request.page_token.clone();
1397            let execute = move |token: String| {
1398                let mut builder = self.clone();
1399                builder.0.request = builder.0.request.set_page_token(token);
1400                builder.send()
1401            };
1402            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1403        }
1404
1405        /// Streams each item in the collection.
1406        pub fn by_item(
1407            self,
1408        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1409            google_cloud_location::model::ListLocationsResponse,
1410            crate::Error,
1411        > {
1412            use google_cloud_gax::paginator::Paginator;
1413            self.by_page().items()
1414        }
1415
1416        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
1417        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1418            self.0.request.name = v.into();
1419            self
1420        }
1421
1422        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
1423        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1424            self.0.request.filter = v.into();
1425            self
1426        }
1427
1428        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
1429        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1430            self.0.request.page_size = v.into();
1431            self
1432        }
1433
1434        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
1435        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1436            self.0.request.page_token = v.into();
1437            self
1438        }
1439    }
1440
1441    #[doc(hidden)]
1442    impl crate::RequestBuilder for ListLocations {
1443        fn request_options(&mut self) -> &mut crate::RequestOptions {
1444            &mut self.0.options
1445        }
1446    }
1447
1448    /// The request builder for [CloudTasks::get_location][crate::client::CloudTasks::get_location] calls.
1449    ///
1450    /// # Example
1451    /// ```
1452    /// # use google_cloud_tasks_v2::builder::cloud_tasks::GetLocation;
1453    /// # async fn sample() -> google_cloud_tasks_v2::Result<()> {
1454    ///
1455    /// let builder = prepare_request_builder();
1456    /// let response = builder.send().await?;
1457    /// # Ok(()) }
1458    ///
1459    /// fn prepare_request_builder() -> GetLocation {
1460    ///   # panic!();
1461    ///   // ... details omitted ...
1462    /// }
1463    /// ```
1464    #[derive(Clone, Debug)]
1465    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1466
1467    impl GetLocation {
1468        pub(crate) fn new(
1469            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudTasks>,
1470        ) -> Self {
1471            Self(RequestBuilder::new(stub))
1472        }
1473
1474        /// Sets the full request, replacing any prior values.
1475        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1476            mut self,
1477            v: V,
1478        ) -> Self {
1479            self.0.request = v.into();
1480            self
1481        }
1482
1483        /// Sets all the options, replacing any prior values.
1484        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1485            self.0.options = v.into();
1486            self
1487        }
1488
1489        /// Sends the request.
1490        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1491            (*self.0.stub)
1492                .get_location(self.0.request, self.0.options)
1493                .await
1494                .map(crate::Response::into_body)
1495        }
1496
1497        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
1498        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1499            self.0.request.name = v.into();
1500            self
1501        }
1502    }
1503
1504    #[doc(hidden)]
1505    impl crate::RequestBuilder for GetLocation {
1506        fn request_options(&mut self) -> &mut crate::RequestOptions {
1507            &mut self.0.options
1508        }
1509    }
1510}