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