Skip to main content

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