google_cloud_workflows_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod workflows {
18    use crate::Result;
19
20    /// A builder for [Workflows][crate::client::Workflows].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_workflows_v1::*;
25    /// # use builder::workflows::ClientBuilder;
26    /// # use client::Workflows;
27    /// let builder : ClientBuilder = Workflows::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://workflows.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::Workflows;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = Workflows;
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::Workflows] 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::Workflows>,
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::Workflows>,
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 [Workflows::list_workflows][crate::client::Workflows::list_workflows] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_workflows_v1::builder::workflows::ListWorkflows;
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() -> ListWorkflows {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListWorkflows(RequestBuilder<crate::model::ListWorkflowsRequest>);
96
97    impl ListWorkflows {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
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::ListWorkflowsRequest>>(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::ListWorkflowsResponse> {
118            (*self.0.stub)
119                .list_workflows(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::ListWorkflowsResponse, 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::ListWorkflowsResponse, gax::error::Error>
143        {
144            use gax::paginator::Paginator;
145            self.by_page().items()
146        }
147
148        /// Sets the value of [parent][crate::model::ListWorkflowsRequest::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 [page_size][crate::model::ListWorkflowsRequest::page_size].
157        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158            self.0.request.page_size = v.into();
159            self
160        }
161
162        /// Sets the value of [page_token][crate::model::ListWorkflowsRequest::page_token].
163        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164            self.0.request.page_token = v.into();
165            self
166        }
167
168        /// Sets the value of [filter][crate::model::ListWorkflowsRequest::filter].
169        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.filter = v.into();
171            self
172        }
173
174        /// Sets the value of [order_by][crate::model::ListWorkflowsRequest::order_by].
175        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.order_by = v.into();
177            self
178        }
179    }
180
181    #[doc(hidden)]
182    impl gax::options::internal::RequestBuilder for ListWorkflows {
183        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184            &mut self.0.options
185        }
186    }
187
188    /// The request builder for [Workflows::get_workflow][crate::client::Workflows::get_workflow] calls.
189    ///
190    /// # Example
191    /// ```
192    /// # use google_cloud_workflows_v1::builder::workflows::GetWorkflow;
193    /// # async fn sample() -> gax::Result<()> {
194    ///
195    /// let builder = prepare_request_builder();
196    /// let response = builder.send().await?;
197    /// # Ok(()) }
198    ///
199    /// fn prepare_request_builder() -> GetWorkflow {
200    ///   # panic!();
201    ///   // ... details omitted ...
202    /// }
203    /// ```
204    #[derive(Clone, Debug)]
205    pub struct GetWorkflow(RequestBuilder<crate::model::GetWorkflowRequest>);
206
207    impl GetWorkflow {
208        pub(crate) fn new(
209            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
210        ) -> Self {
211            Self(RequestBuilder::new(stub))
212        }
213
214        /// Sets the full request, replacing any prior values.
215        pub fn with_request<V: Into<crate::model::GetWorkflowRequest>>(mut self, v: V) -> Self {
216            self.0.request = v.into();
217            self
218        }
219
220        /// Sets all the options, replacing any prior values.
221        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
222            self.0.options = v.into();
223            self
224        }
225
226        /// Sends the request.
227        pub async fn send(self) -> Result<crate::model::Workflow> {
228            (*self.0.stub)
229                .get_workflow(self.0.request, self.0.options)
230                .await
231                .map(gax::response::Response::into_body)
232        }
233
234        /// Sets the value of [name][crate::model::GetWorkflowRequest::name].
235        ///
236        /// This is a **required** field for requests.
237        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.name = v.into();
239            self
240        }
241
242        /// Sets the value of [revision_id][crate::model::GetWorkflowRequest::revision_id].
243        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.revision_id = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl gax::options::internal::RequestBuilder for GetWorkflow {
251        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [Workflows::create_workflow][crate::client::Workflows::create_workflow] calls.
257    ///
258    /// # Example
259    /// ```
260    /// # use google_cloud_workflows_v1::builder::workflows::CreateWorkflow;
261    /// # async fn sample() -> gax::Result<()> {
262    /// use lro::Poller;
263    ///
264    /// let builder = prepare_request_builder();
265    /// let response = builder.poller().until_done().await?;
266    /// # Ok(()) }
267    ///
268    /// fn prepare_request_builder() -> CreateWorkflow {
269    ///   # panic!();
270    ///   // ... details omitted ...
271    /// }
272    /// ```
273    #[derive(Clone, Debug)]
274    pub struct CreateWorkflow(RequestBuilder<crate::model::CreateWorkflowRequest>);
275
276    impl CreateWorkflow {
277        pub(crate) fn new(
278            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
279        ) -> Self {
280            Self(RequestBuilder::new(stub))
281        }
282
283        /// Sets the full request, replacing any prior values.
284        pub fn with_request<V: Into<crate::model::CreateWorkflowRequest>>(mut self, v: V) -> Self {
285            self.0.request = v.into();
286            self
287        }
288
289        /// Sets all the options, replacing any prior values.
290        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
291            self.0.options = v.into();
292            self
293        }
294
295        /// Sends the request.
296        ///
297        /// # Long running operations
298        ///
299        /// This starts, but does not poll, a longrunning operation. More information
300        /// on [create_workflow][crate::client::Workflows::create_workflow].
301        pub async fn send(self) -> Result<longrunning::model::Operation> {
302            (*self.0.stub)
303                .create_workflow(self.0.request, self.0.options)
304                .await
305                .map(gax::response::Response::into_body)
306        }
307
308        /// Creates a [Poller][lro::Poller] to work with `create_workflow`.
309        pub fn poller(
310            self,
311        ) -> impl lro::Poller<crate::model::Workflow, crate::model::OperationMetadata> {
312            type Operation =
313                lro::internal::Operation<crate::model::Workflow, crate::model::OperationMetadata>;
314            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
315            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
316
317            let stub = self.0.stub.clone();
318            let mut options = self.0.options.clone();
319            options.set_retry_policy(gax::retry_policy::NeverRetry);
320            let query = move |name| {
321                let stub = stub.clone();
322                let options = options.clone();
323                async {
324                    let op = GetOperation::new(stub)
325                        .set_name(name)
326                        .with_options(options)
327                        .send()
328                        .await?;
329                    Ok(Operation::new(op))
330                }
331            };
332
333            let start = move || async {
334                let op = self.send().await?;
335                Ok(Operation::new(op))
336            };
337
338            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
339        }
340
341        /// Sets the value of [parent][crate::model::CreateWorkflowRequest::parent].
342        ///
343        /// This is a **required** field for requests.
344        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
345            self.0.request.parent = v.into();
346            self
347        }
348
349        /// Sets the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
350        ///
351        /// This is a **required** field for requests.
352        pub fn set_workflow<T>(mut self, v: T) -> Self
353        where
354            T: std::convert::Into<crate::model::Workflow>,
355        {
356            self.0.request.workflow = std::option::Option::Some(v.into());
357            self
358        }
359
360        /// Sets or clears the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
361        ///
362        /// This is a **required** field for requests.
363        pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
364        where
365            T: std::convert::Into<crate::model::Workflow>,
366        {
367            self.0.request.workflow = v.map(|x| x.into());
368            self
369        }
370
371        /// Sets the value of [workflow_id][crate::model::CreateWorkflowRequest::workflow_id].
372        ///
373        /// This is a **required** field for requests.
374        pub fn set_workflow_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
375            self.0.request.workflow_id = v.into();
376            self
377        }
378    }
379
380    #[doc(hidden)]
381    impl gax::options::internal::RequestBuilder for CreateWorkflow {
382        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
383            &mut self.0.options
384        }
385    }
386
387    /// The request builder for [Workflows::delete_workflow][crate::client::Workflows::delete_workflow] calls.
388    ///
389    /// # Example
390    /// ```
391    /// # use google_cloud_workflows_v1::builder::workflows::DeleteWorkflow;
392    /// # async fn sample() -> gax::Result<()> {
393    /// use lro::Poller;
394    ///
395    /// let builder = prepare_request_builder();
396    /// let response = builder.poller().until_done().await?;
397    /// # Ok(()) }
398    ///
399    /// fn prepare_request_builder() -> DeleteWorkflow {
400    ///   # panic!();
401    ///   // ... details omitted ...
402    /// }
403    /// ```
404    #[derive(Clone, Debug)]
405    pub struct DeleteWorkflow(RequestBuilder<crate::model::DeleteWorkflowRequest>);
406
407    impl DeleteWorkflow {
408        pub(crate) fn new(
409            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
410        ) -> Self {
411            Self(RequestBuilder::new(stub))
412        }
413
414        /// Sets the full request, replacing any prior values.
415        pub fn with_request<V: Into<crate::model::DeleteWorkflowRequest>>(mut self, v: V) -> Self {
416            self.0.request = v.into();
417            self
418        }
419
420        /// Sets all the options, replacing any prior values.
421        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
422            self.0.options = v.into();
423            self
424        }
425
426        /// Sends the request.
427        ///
428        /// # Long running operations
429        ///
430        /// This starts, but does not poll, a longrunning operation. More information
431        /// on [delete_workflow][crate::client::Workflows::delete_workflow].
432        pub async fn send(self) -> Result<longrunning::model::Operation> {
433            (*self.0.stub)
434                .delete_workflow(self.0.request, self.0.options)
435                .await
436                .map(gax::response::Response::into_body)
437        }
438
439        /// Creates a [Poller][lro::Poller] to work with `delete_workflow`.
440        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
441            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
442            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
443            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
444
445            let stub = self.0.stub.clone();
446            let mut options = self.0.options.clone();
447            options.set_retry_policy(gax::retry_policy::NeverRetry);
448            let query = move |name| {
449                let stub = stub.clone();
450                let options = options.clone();
451                async {
452                    let op = GetOperation::new(stub)
453                        .set_name(name)
454                        .with_options(options)
455                        .send()
456                        .await?;
457                    Ok(Operation::new(op))
458                }
459            };
460
461            let start = move || async {
462                let op = self.send().await?;
463                Ok(Operation::new(op))
464            };
465
466            lro::internal::new_unit_response_poller(
467                polling_error_policy,
468                polling_backoff_policy,
469                start,
470                query,
471            )
472        }
473
474        /// Sets the value of [name][crate::model::DeleteWorkflowRequest::name].
475        ///
476        /// This is a **required** field for requests.
477        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
478            self.0.request.name = v.into();
479            self
480        }
481    }
482
483    #[doc(hidden)]
484    impl gax::options::internal::RequestBuilder for DeleteWorkflow {
485        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
486            &mut self.0.options
487        }
488    }
489
490    /// The request builder for [Workflows::update_workflow][crate::client::Workflows::update_workflow] calls.
491    ///
492    /// # Example
493    /// ```
494    /// # use google_cloud_workflows_v1::builder::workflows::UpdateWorkflow;
495    /// # async fn sample() -> gax::Result<()> {
496    /// use lro::Poller;
497    ///
498    /// let builder = prepare_request_builder();
499    /// let response = builder.poller().until_done().await?;
500    /// # Ok(()) }
501    ///
502    /// fn prepare_request_builder() -> UpdateWorkflow {
503    ///   # panic!();
504    ///   // ... details omitted ...
505    /// }
506    /// ```
507    #[derive(Clone, Debug)]
508    pub struct UpdateWorkflow(RequestBuilder<crate::model::UpdateWorkflowRequest>);
509
510    impl UpdateWorkflow {
511        pub(crate) fn new(
512            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
513        ) -> Self {
514            Self(RequestBuilder::new(stub))
515        }
516
517        /// Sets the full request, replacing any prior values.
518        pub fn with_request<V: Into<crate::model::UpdateWorkflowRequest>>(mut self, v: V) -> Self {
519            self.0.request = v.into();
520            self
521        }
522
523        /// Sets all the options, replacing any prior values.
524        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
525            self.0.options = v.into();
526            self
527        }
528
529        /// Sends the request.
530        ///
531        /// # Long running operations
532        ///
533        /// This starts, but does not poll, a longrunning operation. More information
534        /// on [update_workflow][crate::client::Workflows::update_workflow].
535        pub async fn send(self) -> Result<longrunning::model::Operation> {
536            (*self.0.stub)
537                .update_workflow(self.0.request, self.0.options)
538                .await
539                .map(gax::response::Response::into_body)
540        }
541
542        /// Creates a [Poller][lro::Poller] to work with `update_workflow`.
543        pub fn poller(
544            self,
545        ) -> impl lro::Poller<crate::model::Workflow, crate::model::OperationMetadata> {
546            type Operation =
547                lro::internal::Operation<crate::model::Workflow, crate::model::OperationMetadata>;
548            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
549            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
550
551            let stub = self.0.stub.clone();
552            let mut options = self.0.options.clone();
553            options.set_retry_policy(gax::retry_policy::NeverRetry);
554            let query = move |name| {
555                let stub = stub.clone();
556                let options = options.clone();
557                async {
558                    let op = GetOperation::new(stub)
559                        .set_name(name)
560                        .with_options(options)
561                        .send()
562                        .await?;
563                    Ok(Operation::new(op))
564                }
565            };
566
567            let start = move || async {
568                let op = self.send().await?;
569                Ok(Operation::new(op))
570            };
571
572            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
573        }
574
575        /// Sets the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
576        ///
577        /// This is a **required** field for requests.
578        pub fn set_workflow<T>(mut self, v: T) -> Self
579        where
580            T: std::convert::Into<crate::model::Workflow>,
581        {
582            self.0.request.workflow = std::option::Option::Some(v.into());
583            self
584        }
585
586        /// Sets or clears the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
587        ///
588        /// This is a **required** field for requests.
589        pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
590        where
591            T: std::convert::Into<crate::model::Workflow>,
592        {
593            self.0.request.workflow = v.map(|x| x.into());
594            self
595        }
596
597        /// Sets the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
598        pub fn set_update_mask<T>(mut self, v: T) -> Self
599        where
600            T: std::convert::Into<wkt::FieldMask>,
601        {
602            self.0.request.update_mask = std::option::Option::Some(v.into());
603            self
604        }
605
606        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
607        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
608        where
609            T: std::convert::Into<wkt::FieldMask>,
610        {
611            self.0.request.update_mask = v.map(|x| x.into());
612            self
613        }
614    }
615
616    #[doc(hidden)]
617    impl gax::options::internal::RequestBuilder for UpdateWorkflow {
618        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
619            &mut self.0.options
620        }
621    }
622
623    /// The request builder for [Workflows::list_workflow_revisions][crate::client::Workflows::list_workflow_revisions] calls.
624    ///
625    /// # Example
626    /// ```
627    /// # use google_cloud_workflows_v1::builder::workflows::ListWorkflowRevisions;
628    /// # async fn sample() -> gax::Result<()> {
629    /// use gax::paginator::ItemPaginator;
630    ///
631    /// let builder = prepare_request_builder();
632    /// let mut items = builder.by_item();
633    /// while let Some(result) = items.next().await {
634    ///   let item = result?;
635    /// }
636    /// # Ok(()) }
637    ///
638    /// fn prepare_request_builder() -> ListWorkflowRevisions {
639    ///   # panic!();
640    ///   // ... details omitted ...
641    /// }
642    /// ```
643    #[derive(Clone, Debug)]
644    pub struct ListWorkflowRevisions(RequestBuilder<crate::model::ListWorkflowRevisionsRequest>);
645
646    impl ListWorkflowRevisions {
647        pub(crate) fn new(
648            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
649        ) -> Self {
650            Self(RequestBuilder::new(stub))
651        }
652
653        /// Sets the full request, replacing any prior values.
654        pub fn with_request<V: Into<crate::model::ListWorkflowRevisionsRequest>>(
655            mut self,
656            v: V,
657        ) -> Self {
658            self.0.request = v.into();
659            self
660        }
661
662        /// Sets all the options, replacing any prior values.
663        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
664            self.0.options = v.into();
665            self
666        }
667
668        /// Sends the request.
669        pub async fn send(self) -> Result<crate::model::ListWorkflowRevisionsResponse> {
670            (*self.0.stub)
671                .list_workflow_revisions(self.0.request, self.0.options)
672                .await
673                .map(gax::response::Response::into_body)
674        }
675
676        /// Streams each page in the collection.
677        pub fn by_page(
678            self,
679        ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowRevisionsResponse, gax::error::Error>
680        {
681            use std::clone::Clone;
682            let token = self.0.request.page_token.clone();
683            let execute = move |token: String| {
684                let mut builder = self.clone();
685                builder.0.request = builder.0.request.set_page_token(token);
686                builder.send()
687            };
688            gax::paginator::internal::new_paginator(token, execute)
689        }
690
691        /// Streams each item in the collection.
692        pub fn by_item(
693            self,
694        ) -> impl gax::paginator::ItemPaginator<
695            crate::model::ListWorkflowRevisionsResponse,
696            gax::error::Error,
697        > {
698            use gax::paginator::Paginator;
699            self.by_page().items()
700        }
701
702        /// Sets the value of [name][crate::model::ListWorkflowRevisionsRequest::name].
703        ///
704        /// This is a **required** field for requests.
705        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
706            self.0.request.name = v.into();
707            self
708        }
709
710        /// Sets the value of [page_size][crate::model::ListWorkflowRevisionsRequest::page_size].
711        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
712            self.0.request.page_size = v.into();
713            self
714        }
715
716        /// Sets the value of [page_token][crate::model::ListWorkflowRevisionsRequest::page_token].
717        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
718            self.0.request.page_token = v.into();
719            self
720        }
721    }
722
723    #[doc(hidden)]
724    impl gax::options::internal::RequestBuilder for ListWorkflowRevisions {
725        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
726            &mut self.0.options
727        }
728    }
729
730    /// The request builder for [Workflows::list_locations][crate::client::Workflows::list_locations] calls.
731    ///
732    /// # Example
733    /// ```
734    /// # use google_cloud_workflows_v1::builder::workflows::ListLocations;
735    /// # async fn sample() -> gax::Result<()> {
736    /// use gax::paginator::ItemPaginator;
737    ///
738    /// let builder = prepare_request_builder();
739    /// let mut items = builder.by_item();
740    /// while let Some(result) = items.next().await {
741    ///   let item = result?;
742    /// }
743    /// # Ok(()) }
744    ///
745    /// fn prepare_request_builder() -> ListLocations {
746    ///   # panic!();
747    ///   // ... details omitted ...
748    /// }
749    /// ```
750    #[derive(Clone, Debug)]
751    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
752
753    impl ListLocations {
754        pub(crate) fn new(
755            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
756        ) -> Self {
757            Self(RequestBuilder::new(stub))
758        }
759
760        /// Sets the full request, replacing any prior values.
761        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
762            mut self,
763            v: V,
764        ) -> Self {
765            self.0.request = v.into();
766            self
767        }
768
769        /// Sets all the options, replacing any prior values.
770        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
771            self.0.options = v.into();
772            self
773        }
774
775        /// Sends the request.
776        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
777            (*self.0.stub)
778                .list_locations(self.0.request, self.0.options)
779                .await
780                .map(gax::response::Response::into_body)
781        }
782
783        /// Streams each page in the collection.
784        pub fn by_page(
785            self,
786        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
787        {
788            use std::clone::Clone;
789            let token = self.0.request.page_token.clone();
790            let execute = move |token: String| {
791                let mut builder = self.clone();
792                builder.0.request = builder.0.request.set_page_token(token);
793                builder.send()
794            };
795            gax::paginator::internal::new_paginator(token, execute)
796        }
797
798        /// Streams each item in the collection.
799        pub fn by_item(
800            self,
801        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
802        {
803            use gax::paginator::Paginator;
804            self.by_page().items()
805        }
806
807        /// Sets the value of [name][location::model::ListLocationsRequest::name].
808        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
809            self.0.request.name = v.into();
810            self
811        }
812
813        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
814        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
815            self.0.request.filter = v.into();
816            self
817        }
818
819        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
820        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
821            self.0.request.page_size = v.into();
822            self
823        }
824
825        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
826        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
827            self.0.request.page_token = v.into();
828            self
829        }
830    }
831
832    #[doc(hidden)]
833    impl gax::options::internal::RequestBuilder for ListLocations {
834        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
835            &mut self.0.options
836        }
837    }
838
839    /// The request builder for [Workflows::get_location][crate::client::Workflows::get_location] calls.
840    ///
841    /// # Example
842    /// ```
843    /// # use google_cloud_workflows_v1::builder::workflows::GetLocation;
844    /// # async fn sample() -> gax::Result<()> {
845    ///
846    /// let builder = prepare_request_builder();
847    /// let response = builder.send().await?;
848    /// # Ok(()) }
849    ///
850    /// fn prepare_request_builder() -> GetLocation {
851    ///   # panic!();
852    ///   // ... details omitted ...
853    /// }
854    /// ```
855    #[derive(Clone, Debug)]
856    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
857
858    impl GetLocation {
859        pub(crate) fn new(
860            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
861        ) -> Self {
862            Self(RequestBuilder::new(stub))
863        }
864
865        /// Sets the full request, replacing any prior values.
866        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
867            self.0.request = v.into();
868            self
869        }
870
871        /// Sets all the options, replacing any prior values.
872        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
873            self.0.options = v.into();
874            self
875        }
876
877        /// Sends the request.
878        pub async fn send(self) -> Result<location::model::Location> {
879            (*self.0.stub)
880                .get_location(self.0.request, self.0.options)
881                .await
882                .map(gax::response::Response::into_body)
883        }
884
885        /// Sets the value of [name][location::model::GetLocationRequest::name].
886        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
887            self.0.request.name = v.into();
888            self
889        }
890    }
891
892    #[doc(hidden)]
893    impl gax::options::internal::RequestBuilder for GetLocation {
894        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
895            &mut self.0.options
896        }
897    }
898
899    /// The request builder for [Workflows::list_operations][crate::client::Workflows::list_operations] calls.
900    ///
901    /// # Example
902    /// ```
903    /// # use google_cloud_workflows_v1::builder::workflows::ListOperations;
904    /// # async fn sample() -> gax::Result<()> {
905    /// use gax::paginator::ItemPaginator;
906    ///
907    /// let builder = prepare_request_builder();
908    /// let mut items = builder.by_item();
909    /// while let Some(result) = items.next().await {
910    ///   let item = result?;
911    /// }
912    /// # Ok(()) }
913    ///
914    /// fn prepare_request_builder() -> ListOperations {
915    ///   # panic!();
916    ///   // ... details omitted ...
917    /// }
918    /// ```
919    #[derive(Clone, Debug)]
920    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
921
922    impl ListOperations {
923        pub(crate) fn new(
924            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
925        ) -> Self {
926            Self(RequestBuilder::new(stub))
927        }
928
929        /// Sets the full request, replacing any prior values.
930        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
931            mut self,
932            v: V,
933        ) -> Self {
934            self.0.request = v.into();
935            self
936        }
937
938        /// Sets all the options, replacing any prior values.
939        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
940            self.0.options = v.into();
941            self
942        }
943
944        /// Sends the request.
945        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
946            (*self.0.stub)
947                .list_operations(self.0.request, self.0.options)
948                .await
949                .map(gax::response::Response::into_body)
950        }
951
952        /// Streams each page in the collection.
953        pub fn by_page(
954            self,
955        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
956        {
957            use std::clone::Clone;
958            let token = self.0.request.page_token.clone();
959            let execute = move |token: String| {
960                let mut builder = self.clone();
961                builder.0.request = builder.0.request.set_page_token(token);
962                builder.send()
963            };
964            gax::paginator::internal::new_paginator(token, execute)
965        }
966
967        /// Streams each item in the collection.
968        pub fn by_item(
969            self,
970        ) -> impl gax::paginator::ItemPaginator<
971            longrunning::model::ListOperationsResponse,
972            gax::error::Error,
973        > {
974            use gax::paginator::Paginator;
975            self.by_page().items()
976        }
977
978        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
979        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
980            self.0.request.name = v.into();
981            self
982        }
983
984        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
985        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
986            self.0.request.filter = v.into();
987            self
988        }
989
990        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
991        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
992            self.0.request.page_size = v.into();
993            self
994        }
995
996        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
997        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
998            self.0.request.page_token = v.into();
999            self
1000        }
1001
1002        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1003        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1004            self.0.request.return_partial_success = v.into();
1005            self
1006        }
1007    }
1008
1009    #[doc(hidden)]
1010    impl gax::options::internal::RequestBuilder for ListOperations {
1011        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1012            &mut self.0.options
1013        }
1014    }
1015
1016    /// The request builder for [Workflows::get_operation][crate::client::Workflows::get_operation] calls.
1017    ///
1018    /// # Example
1019    /// ```
1020    /// # use google_cloud_workflows_v1::builder::workflows::GetOperation;
1021    /// # async fn sample() -> gax::Result<()> {
1022    ///
1023    /// let builder = prepare_request_builder();
1024    /// let response = builder.send().await?;
1025    /// # Ok(()) }
1026    ///
1027    /// fn prepare_request_builder() -> GetOperation {
1028    ///   # panic!();
1029    ///   // ... details omitted ...
1030    /// }
1031    /// ```
1032    #[derive(Clone, Debug)]
1033    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1034
1035    impl GetOperation {
1036        pub(crate) fn new(
1037            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
1038        ) -> Self {
1039            Self(RequestBuilder::new(stub))
1040        }
1041
1042        /// Sets the full request, replacing any prior values.
1043        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1044            mut self,
1045            v: V,
1046        ) -> Self {
1047            self.0.request = v.into();
1048            self
1049        }
1050
1051        /// Sets all the options, replacing any prior values.
1052        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1053            self.0.options = v.into();
1054            self
1055        }
1056
1057        /// Sends the request.
1058        pub async fn send(self) -> Result<longrunning::model::Operation> {
1059            (*self.0.stub)
1060                .get_operation(self.0.request, self.0.options)
1061                .await
1062                .map(gax::response::Response::into_body)
1063        }
1064
1065        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1066        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1067            self.0.request.name = v.into();
1068            self
1069        }
1070    }
1071
1072    #[doc(hidden)]
1073    impl gax::options::internal::RequestBuilder for GetOperation {
1074        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1075            &mut self.0.options
1076        }
1077    }
1078
1079    /// The request builder for [Workflows::delete_operation][crate::client::Workflows::delete_operation] calls.
1080    ///
1081    /// # Example
1082    /// ```
1083    /// # use google_cloud_workflows_v1::builder::workflows::DeleteOperation;
1084    /// # async fn sample() -> gax::Result<()> {
1085    ///
1086    /// let builder = prepare_request_builder();
1087    /// let response = builder.send().await?;
1088    /// # Ok(()) }
1089    ///
1090    /// fn prepare_request_builder() -> DeleteOperation {
1091    ///   # panic!();
1092    ///   // ... details omitted ...
1093    /// }
1094    /// ```
1095    #[derive(Clone, Debug)]
1096    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1097
1098    impl DeleteOperation {
1099        pub(crate) fn new(
1100            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workflows>,
1101        ) -> Self {
1102            Self(RequestBuilder::new(stub))
1103        }
1104
1105        /// Sets the full request, replacing any prior values.
1106        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1107            mut self,
1108            v: V,
1109        ) -> Self {
1110            self.0.request = v.into();
1111            self
1112        }
1113
1114        /// Sets all the options, replacing any prior values.
1115        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1116            self.0.options = v.into();
1117            self
1118        }
1119
1120        /// Sends the request.
1121        pub async fn send(self) -> Result<()> {
1122            (*self.0.stub)
1123                .delete_operation(self.0.request, self.0.options)
1124                .await
1125                .map(gax::response::Response::into_body)
1126        }
1127
1128        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1129        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130            self.0.request.name = v.into();
1131            self
1132        }
1133    }
1134
1135    #[doc(hidden)]
1136    impl gax::options::internal::RequestBuilder for DeleteOperation {
1137        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1138            &mut self.0.options
1139        }
1140    }
1141}