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