google_cloud_workflows_v1/
builder.rs

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