google_workflows1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Workflows related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_workflows1 as workflows1;
49/// use workflows1::api::Workflow;
50/// use workflows1::{Result, Error};
51/// # async fn dox() {
52/// use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = Workflows::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Workflow::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_workflows_create(req, "parent")
99///              .workflow_id("At")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct Workflows<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for Workflows<C> {}
131
132impl<'a, C> Workflows<C> {
133    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Workflows<C> {
134        Workflows {
135            client,
136            auth: Box::new(auth),
137            _user_agent: "google-api-rust-client/7.0.0".to_string(),
138            _base_url: "https://workflows.googleapis.com/".to_string(),
139            _root_url: "https://workflows.googleapis.com/".to_string(),
140        }
141    }
142
143    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
144        ProjectMethods { hub: self }
145    }
146
147    /// Set the user-agent header field to use in all requests to the server.
148    /// It defaults to `google-api-rust-client/7.0.0`.
149    ///
150    /// Returns the previously set user-agent.
151    pub fn user_agent(&mut self, agent_name: String) -> String {
152        std::mem::replace(&mut self._user_agent, agent_name)
153    }
154
155    /// Set the base url to use in all requests to the server.
156    /// It defaults to `https://workflows.googleapis.com/`.
157    ///
158    /// Returns the previously set base url.
159    pub fn base_url(&mut self, new_base_url: String) -> String {
160        std::mem::replace(&mut self._base_url, new_base_url)
161    }
162
163    /// Set the root url to use in all requests to the server.
164    /// It defaults to `https://workflows.googleapis.com/`.
165    ///
166    /// Returns the previously set root url.
167    pub fn root_url(&mut self, new_root_url: String) -> String {
168        std::mem::replace(&mut self._root_url, new_root_url)
169    }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
176///
177/// # Activities
178///
179/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
180/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
181///
182/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
184#[serde_with::serde_as]
185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
186pub struct Empty {
187    _never_set: Option<bool>,
188}
189
190impl common::ResponseResult for Empty {}
191
192/// The response message for Locations.ListLocations.
193///
194/// # Activities
195///
196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
198///
199/// * [locations list projects](ProjectLocationListCall) (response)
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct ListLocationsResponse {
204    /// A list of locations that matches the specified filter in the request.
205    pub locations: Option<Vec<Location>>,
206    /// The standard List next-page token.
207    #[serde(rename = "nextPageToken")]
208    pub next_page_token: Option<String>,
209}
210
211impl common::ResponseResult for ListLocationsResponse {}
212
213/// The response message for Operations.ListOperations.
214///
215/// # Activities
216///
217/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
218/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
219///
220/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
222#[serde_with::serde_as]
223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
224pub struct ListOperationsResponse {
225    /// The standard List next-page token.
226    #[serde(rename = "nextPageToken")]
227    pub next_page_token: Option<String>,
228    /// A list of operations that matches the specified filter in the request.
229    pub operations: Option<Vec<Operation>>,
230    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
231    pub unreachable: Option<Vec<String>>,
232}
233
234impl common::ResponseResult for ListOperationsResponse {}
235
236/// Response for the ListWorkflowRevisions method.
237///
238/// # Activities
239///
240/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
241/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
242///
243/// * [locations workflows list revisions projects](ProjectLocationWorkflowListRevisionCall) (response)
244#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
245#[serde_with::serde_as]
246#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
247pub struct ListWorkflowRevisionsResponse {
248    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
249    #[serde(rename = "nextPageToken")]
250    pub next_page_token: Option<String>,
251    /// The revisions of the workflow, ordered in reverse chronological order.
252    pub workflows: Option<Vec<Workflow>>,
253}
254
255impl common::ResponseResult for ListWorkflowRevisionsResponse {}
256
257/// Response for the ListWorkflows method.
258///
259/// # Activities
260///
261/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
262/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
263///
264/// * [locations workflows list projects](ProjectLocationWorkflowListCall) (response)
265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
266#[serde_with::serde_as]
267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
268pub struct ListWorkflowsResponse {
269    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
270    #[serde(rename = "nextPageToken")]
271    pub next_page_token: Option<String>,
272    /// Unreachable resources.
273    pub unreachable: Option<Vec<String>>,
274    /// The workflows that match the request.
275    pub workflows: Option<Vec<Workflow>>,
276}
277
278impl common::ResponseResult for ListWorkflowsResponse {}
279
280/// A resource that represents a Google Cloud location.
281///
282/// # Activities
283///
284/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
285/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
286///
287/// * [locations get projects](ProjectLocationGetCall) (response)
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct Location {
292    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
293    #[serde(rename = "displayName")]
294    pub display_name: Option<String>,
295    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
296    pub labels: Option<HashMap<String, String>>,
297    /// The canonical id for this location. For example: `"us-east1"`.
298    #[serde(rename = "locationId")]
299    pub location_id: Option<String>,
300    /// Service-specific metadata. For example the available capacity at the given location.
301    pub metadata: Option<HashMap<String, serde_json::Value>>,
302    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
303    pub name: Option<String>,
304}
305
306impl common::ResponseResult for Location {}
307
308/// This resource represents a long-running operation that is the result of a network API call.
309///
310/// # Activities
311///
312/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
313/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
314///
315/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
316/// * [locations workflows create projects](ProjectLocationWorkflowCreateCall) (response)
317/// * [locations workflows delete projects](ProjectLocationWorkflowDeleteCall) (response)
318/// * [locations workflows patch projects](ProjectLocationWorkflowPatchCall) (response)
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct Operation {
323    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
324    pub done: Option<bool>,
325    /// The error result of the operation in case of failure or cancellation.
326    pub error: Option<Status>,
327    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
328    pub metadata: Option<HashMap<String, serde_json::Value>>,
329    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
330    pub name: Option<String>,
331    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
332    pub response: Option<HashMap<String, serde_json::Value>>,
333}
334
335impl common::ResponseResult for Operation {}
336
337/// Describes an error related to the current state of the workflow.
338///
339/// This type is not used in any activity, and only used as *part* of another schema.
340///
341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
342#[serde_with::serde_as]
343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
344pub struct StateError {
345    /// Provides specifics about the error.
346    pub details: Option<String>,
347    /// The type of this state error.
348    #[serde(rename = "type")]
349    pub type_: Option<String>,
350}
351
352impl common::Part for StateError {}
353
354/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
355///
356/// This type is not used in any activity, and only used as *part* of another schema.
357///
358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
359#[serde_with::serde_as]
360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
361pub struct Status {
362    /// The status code, which should be an enum value of google.rpc.Code.
363    pub code: Option<i32>,
364    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
365    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
366    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
367    pub message: Option<String>,
368}
369
370impl common::Part for Status {}
371
372/// Workflow program to be executed by Workflows.
373///
374/// # Activities
375///
376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
378///
379/// * [locations workflows create projects](ProjectLocationWorkflowCreateCall) (request)
380/// * [locations workflows get projects](ProjectLocationWorkflowGetCall) (response)
381/// * [locations workflows patch projects](ProjectLocationWorkflowPatchCall) (request)
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct Workflow {
386    /// Output only. A list of all KMS crypto keys used to encrypt or decrypt the data associated with the workflow.
387    #[serde(rename = "allKmsKeys")]
388    pub all_kms_keys: Option<Vec<String>>,
389    /// Output only. A list of all KMS crypto key versions used to encrypt or decrypt the data associated with the workflow.
390    #[serde(rename = "allKmsKeysVersions")]
391    pub all_kms_keys_versions: Option<Vec<String>>,
392    /// Optional. Describes the level of platform logging to apply to calls and call responses during executions of this workflow. If both the workflow and the execution specify a logging level, the execution level takes precedence.
393    #[serde(rename = "callLogLevel")]
394    pub call_log_level: Option<String>,
395    /// Output only. The timestamp for when the workflow was created. This is a workflow-wide field and is not tied to a specific revision.
396    #[serde(rename = "createTime")]
397    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
398    /// Optional. The resource name of a KMS crypto key used to encrypt or decrypt the data associated with the workflow. Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} Using `-` as a wildcard for the `{project}` or not providing one at all will infer the project from the account. If not provided, data associated with the workflow will not be CMEK-encrypted.
399    #[serde(rename = "cryptoKeyName")]
400    pub crypto_key_name: Option<String>,
401    /// Output only. The resource name of a KMS crypto key version used to encrypt or decrypt the data associated with the workflow. Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}
402    #[serde(rename = "cryptoKeyVersion")]
403    pub crypto_key_version: Option<String>,
404    /// Description of the workflow provided by the user. Must be at most 1000 Unicode characters long. This is a workflow-wide field and is not tied to a specific revision.
405    pub description: Option<String>,
406    /// Optional. Describes the execution history level to apply to this workflow.
407    #[serde(rename = "executionHistoryLevel")]
408    pub execution_history_level: Option<String>,
409    /// Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and can only contain lowercase letters, numeric characters, underscores, and dashes. Label keys must start with a letter. International characters are allowed. This is a workflow-wide field and is not tied to a specific revision.
410    pub labels: Option<HashMap<String, String>>,
411    /// The resource name of the workflow. Format: projects/{project}/locations/{location}/workflows/{workflow}. This is a workflow-wide field and is not tied to a specific revision.
412    pub name: Option<String>,
413    /// Output only. The timestamp for the latest revision of the workflow's creation.
414    #[serde(rename = "revisionCreateTime")]
415    pub revision_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
416    /// Output only. The revision of the workflow. A new revision of a workflow is created as a result of updating the following properties of a workflow: - Service account - Workflow code to be executed The format is "000001-a4d", where the first six characters define the zero-padded revision ordinal number. They are followed by a hyphen and three hexadecimal random characters.
417    #[serde(rename = "revisionId")]
418    pub revision_id: Option<String>,
419    /// The service account associated with the latest workflow version. This service account represents the identity of the workflow and determines what permissions the workflow has. Format: projects/{project}/serviceAccounts/{account} or {account} Using `-` as a wildcard for the `{project}` or not providing one at all will infer the project from the account. The `{account}` value can be the `email` address or the `unique_id` of the service account. If not provided, workflow will use the project's default service account. Modifying this field for an existing workflow results in a new workflow revision.
420    #[serde(rename = "serviceAccount")]
421    pub service_account: Option<String>,
422    /// Workflow code to be executed. The size limit is 128KB.
423    #[serde(rename = "sourceContents")]
424    pub source_contents: Option<String>,
425    /// Output only. State of the workflow deployment.
426    pub state: Option<String>,
427    /// Output only. Error regarding the state of the workflow. For example, this field will have error details if the execution data is unavailable due to revoked KMS key permissions.
428    #[serde(rename = "stateError")]
429    pub state_error: Option<StateError>,
430    /// Optional. Input only. Immutable. Tags associated with this workflow.
431    pub tags: Option<HashMap<String, String>>,
432    /// Output only. The timestamp for when the workflow was last updated. This is a workflow-wide field and is not tied to a specific revision.
433    #[serde(rename = "updateTime")]
434    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
435    /// Optional. User-defined environment variables associated with this workflow revision. This map has a maximum length of 20. Each string can take up to 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or "WORKFLOWS".
436    #[serde(rename = "userEnvVars")]
437    pub user_env_vars: Option<HashMap<String, String>>,
438}
439
440impl common::RequestValue for Workflow {}
441impl common::ResponseResult for Workflow {}
442
443// ###################
444// MethodBuilders ###
445// #################
446
447/// A builder providing access to all methods supported on *project* resources.
448/// It is not used directly, but through the [`Workflows`] hub.
449///
450/// # Example
451///
452/// Instantiate a resource builder
453///
454/// ```test_harness,no_run
455/// extern crate hyper;
456/// extern crate hyper_rustls;
457/// extern crate google_workflows1 as workflows1;
458///
459/// # async fn dox() {
460/// use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
461///
462/// let secret: yup_oauth2::ApplicationSecret = Default::default();
463/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
464///     .with_native_roots()
465///     .unwrap()
466///     .https_only()
467///     .enable_http2()
468///     .build();
469///
470/// let executor = hyper_util::rt::TokioExecutor::new();
471/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
472///     secret,
473///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
474///     yup_oauth2::client::CustomHyperClientBuilder::from(
475///         hyper_util::client::legacy::Client::builder(executor).build(connector),
476///     ),
477/// ).build().await.unwrap();
478///
479/// let client = hyper_util::client::legacy::Client::builder(
480///     hyper_util::rt::TokioExecutor::new()
481/// )
482/// .build(
483///     hyper_rustls::HttpsConnectorBuilder::new()
484///         .with_native_roots()
485///         .unwrap()
486///         .https_or_http()
487///         .enable_http2()
488///         .build()
489/// );
490/// let mut hub = Workflows::new(client, auth);
491/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
492/// // like `locations_get(...)`, `locations_list(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_workflows_create(...)`, `locations_workflows_delete(...)`, `locations_workflows_get(...)`, `locations_workflows_list(...)`, `locations_workflows_list_revisions(...)` and `locations_workflows_patch(...)`
493/// // to build up your call.
494/// let rb = hub.projects();
495/// # }
496/// ```
497pub struct ProjectMethods<'a, C>
498where
499    C: 'a,
500{
501    hub: &'a Workflows<C>,
502}
503
504impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
505
506impl<'a, C> ProjectMethods<'a, C> {
507    /// Create a builder to help you perform the following task:
508    ///
509    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
510    ///
511    /// # Arguments
512    ///
513    /// * `name` - The name of the operation resource to be deleted.
514    pub fn locations_operations_delete(
515        &self,
516        name: &str,
517    ) -> ProjectLocationOperationDeleteCall<'a, C> {
518        ProjectLocationOperationDeleteCall {
519            hub: self.hub,
520            _name: name.to_string(),
521            _delegate: Default::default(),
522            _additional_params: Default::default(),
523            _scopes: Default::default(),
524        }
525    }
526
527    /// Create a builder to help you perform the following task:
528    ///
529    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
530    ///
531    /// # Arguments
532    ///
533    /// * `name` - The name of the operation resource.
534    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
535        ProjectLocationOperationGetCall {
536            hub: self.hub,
537            _name: name.to_string(),
538            _delegate: Default::default(),
539            _additional_params: Default::default(),
540            _scopes: Default::default(),
541        }
542    }
543
544    /// Create a builder to help you perform the following task:
545    ///
546    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
547    ///
548    /// # Arguments
549    ///
550    /// * `name` - The name of the operation's parent resource.
551    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
552        ProjectLocationOperationListCall {
553            hub: self.hub,
554            _name: name.to_string(),
555            _return_partial_success: Default::default(),
556            _page_token: Default::default(),
557            _page_size: Default::default(),
558            _filter: Default::default(),
559            _delegate: Default::default(),
560            _additional_params: Default::default(),
561            _scopes: Default::default(),
562        }
563    }
564
565    /// Create a builder to help you perform the following task:
566    ///
567    /// Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a ALREADY_EXISTS error.
568    ///
569    /// # Arguments
570    ///
571    /// * `request` - No description provided.
572    /// * `parent` - Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location}
573    pub fn locations_workflows_create(
574        &self,
575        request: Workflow,
576        parent: &str,
577    ) -> ProjectLocationWorkflowCreateCall<'a, C> {
578        ProjectLocationWorkflowCreateCall {
579            hub: self.hub,
580            _request: request,
581            _parent: parent.to_string(),
582            _workflow_id: Default::default(),
583            _delegate: Default::default(),
584            _additional_params: Default::default(),
585            _scopes: Default::default(),
586        }
587    }
588
589    /// Create a builder to help you perform the following task:
590    ///
591    /// Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.
592    ///
593    /// # Arguments
594    ///
595    /// * `name` - Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow}
596    pub fn locations_workflows_delete(
597        &self,
598        name: &str,
599    ) -> ProjectLocationWorkflowDeleteCall<'a, C> {
600        ProjectLocationWorkflowDeleteCall {
601            hub: self.hub,
602            _name: name.to_string(),
603            _delegate: Default::default(),
604            _additional_params: Default::default(),
605            _scopes: Default::default(),
606        }
607    }
608
609    /// Create a builder to help you perform the following task:
610    ///
611    /// Gets details of a single workflow.
612    ///
613    /// # Arguments
614    ///
615    /// * `name` - Required. Name of the workflow for which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
616    pub fn locations_workflows_get(&self, name: &str) -> ProjectLocationWorkflowGetCall<'a, C> {
617        ProjectLocationWorkflowGetCall {
618            hub: self.hub,
619            _name: name.to_string(),
620            _revision_id: Default::default(),
621            _delegate: Default::default(),
622            _additional_params: Default::default(),
623            _scopes: Default::default(),
624        }
625    }
626
627    /// Create a builder to help you perform the following task:
628    ///
629    /// Lists workflows in a given project and location. The default order is not specified.
630    ///
631    /// # Arguments
632    ///
633    /// * `parent` - Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location}
634    pub fn locations_workflows_list(&self, parent: &str) -> ProjectLocationWorkflowListCall<'a, C> {
635        ProjectLocationWorkflowListCall {
636            hub: self.hub,
637            _parent: parent.to_string(),
638            _page_token: Default::default(),
639            _page_size: Default::default(),
640            _order_by: Default::default(),
641            _filter: Default::default(),
642            _delegate: Default::default(),
643            _additional_params: Default::default(),
644            _scopes: Default::default(),
645        }
646    }
647
648    /// Create a builder to help you perform the following task:
649    ///
650    /// Lists revisions for a given workflow.
651    ///
652    /// # Arguments
653    ///
654    /// * `name` - Required. Workflow for which the revisions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}
655    pub fn locations_workflows_list_revisions(
656        &self,
657        name: &str,
658    ) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
659        ProjectLocationWorkflowListRevisionCall {
660            hub: self.hub,
661            _name: name.to_string(),
662            _page_token: Default::default(),
663            _page_size: Default::default(),
664            _delegate: Default::default(),
665            _additional_params: Default::default(),
666            _scopes: Default::default(),
667        }
668    }
669
670    /// Create a builder to help you perform the following task:
671    ///
672    /// Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.
673    ///
674    /// # Arguments
675    ///
676    /// * `request` - No description provided.
677    /// * `name` - The resource name of the workflow. Format: projects/{project}/locations/{location}/workflows/{workflow}. This is a workflow-wide field and is not tied to a specific revision.
678    pub fn locations_workflows_patch(
679        &self,
680        request: Workflow,
681        name: &str,
682    ) -> ProjectLocationWorkflowPatchCall<'a, C> {
683        ProjectLocationWorkflowPatchCall {
684            hub: self.hub,
685            _request: request,
686            _name: name.to_string(),
687            _update_mask: Default::default(),
688            _delegate: Default::default(),
689            _additional_params: Default::default(),
690            _scopes: Default::default(),
691        }
692    }
693
694    /// Create a builder to help you perform the following task:
695    ///
696    /// Gets information about a location.
697    ///
698    /// # Arguments
699    ///
700    /// * `name` - Resource name for the location.
701    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
702        ProjectLocationGetCall {
703            hub: self.hub,
704            _name: name.to_string(),
705            _delegate: Default::default(),
706            _additional_params: Default::default(),
707            _scopes: Default::default(),
708        }
709    }
710
711    /// Create a builder to help you perform the following task:
712    ///
713    /// Lists information about the supported locations for this service.
714    ///
715    /// # Arguments
716    ///
717    /// * `name` - The resource that owns the locations collection, if applicable.
718    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
719        ProjectLocationListCall {
720            hub: self.hub,
721            _name: name.to_string(),
722            _page_token: Default::default(),
723            _page_size: Default::default(),
724            _filter: Default::default(),
725            _extra_location_types: Default::default(),
726            _delegate: Default::default(),
727            _additional_params: Default::default(),
728            _scopes: Default::default(),
729        }
730    }
731}
732
733// ###################
734// CallBuilders   ###
735// #################
736
737/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
738///
739/// A builder for the *locations.operations.delete* method supported by a *project* resource.
740/// It is not used directly, but through a [`ProjectMethods`] instance.
741///
742/// # Example
743///
744/// Instantiate a resource method builder
745///
746/// ```test_harness,no_run
747/// # extern crate hyper;
748/// # extern crate hyper_rustls;
749/// # extern crate google_workflows1 as workflows1;
750/// # async fn dox() {
751/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
752///
753/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
754/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
755/// #     .with_native_roots()
756/// #     .unwrap()
757/// #     .https_only()
758/// #     .enable_http2()
759/// #     .build();
760///
761/// # let executor = hyper_util::rt::TokioExecutor::new();
762/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
763/// #     secret,
764/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
765/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
766/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
767/// #     ),
768/// # ).build().await.unwrap();
769///
770/// # let client = hyper_util::client::legacy::Client::builder(
771/// #     hyper_util::rt::TokioExecutor::new()
772/// # )
773/// # .build(
774/// #     hyper_rustls::HttpsConnectorBuilder::new()
775/// #         .with_native_roots()
776/// #         .unwrap()
777/// #         .https_or_http()
778/// #         .enable_http2()
779/// #         .build()
780/// # );
781/// # let mut hub = Workflows::new(client, auth);
782/// // You can configure optional parameters by calling the respective setters at will, and
783/// // execute the final call using `doit()`.
784/// // Values shown here are possibly random and not representative !
785/// let result = hub.projects().locations_operations_delete("name")
786///              .doit().await;
787/// # }
788/// ```
789pub struct ProjectLocationOperationDeleteCall<'a, C>
790where
791    C: 'a,
792{
793    hub: &'a Workflows<C>,
794    _name: String,
795    _delegate: Option<&'a mut dyn common::Delegate>,
796    _additional_params: HashMap<String, String>,
797    _scopes: BTreeSet<String>,
798}
799
800impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
801
802impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
803where
804    C: common::Connector,
805{
806    /// Perform the operation you have build so far.
807    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
808        use std::borrow::Cow;
809        use std::io::{Read, Seek};
810
811        use common::{url::Params, ToParts};
812        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
813
814        let mut dd = common::DefaultDelegate;
815        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
816        dlg.begin(common::MethodInfo {
817            id: "workflows.projects.locations.operations.delete",
818            http_method: hyper::Method::DELETE,
819        });
820
821        for &field in ["alt", "name"].iter() {
822            if self._additional_params.contains_key(field) {
823                dlg.finished(false);
824                return Err(common::Error::FieldClash(field));
825            }
826        }
827
828        let mut params = Params::with_capacity(3 + self._additional_params.len());
829        params.push("name", self._name);
830
831        params.extend(self._additional_params.iter());
832
833        params.push("alt", "json");
834        let mut url = self.hub._base_url.clone() + "v1/{+name}";
835        if self._scopes.is_empty() {
836            self._scopes
837                .insert(Scope::CloudPlatform.as_ref().to_string());
838        }
839
840        #[allow(clippy::single_element_loop)]
841        for &(find_this, param_name) in [("{+name}", "name")].iter() {
842            url = params.uri_replacement(url, param_name, find_this, true);
843        }
844        {
845            let to_remove = ["name"];
846            params.remove_params(&to_remove);
847        }
848
849        let url = params.parse_with_url(&url);
850
851        loop {
852            let token = match self
853                .hub
854                .auth
855                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
856                .await
857            {
858                Ok(token) => token,
859                Err(e) => match dlg.token(e) {
860                    Ok(token) => token,
861                    Err(e) => {
862                        dlg.finished(false);
863                        return Err(common::Error::MissingToken(e));
864                    }
865                },
866            };
867            let mut req_result = {
868                let client = &self.hub.client;
869                dlg.pre_request();
870                let mut req_builder = hyper::Request::builder()
871                    .method(hyper::Method::DELETE)
872                    .uri(url.as_str())
873                    .header(USER_AGENT, self.hub._user_agent.clone());
874
875                if let Some(token) = token.as_ref() {
876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
877                }
878
879                let request = req_builder
880                    .header(CONTENT_LENGTH, 0_u64)
881                    .body(common::to_body::<String>(None));
882
883                client.request(request.unwrap()).await
884            };
885
886            match req_result {
887                Err(err) => {
888                    if let common::Retry::After(d) = dlg.http_error(&err) {
889                        sleep(d).await;
890                        continue;
891                    }
892                    dlg.finished(false);
893                    return Err(common::Error::HttpError(err));
894                }
895                Ok(res) => {
896                    let (mut parts, body) = res.into_parts();
897                    let mut body = common::Body::new(body);
898                    if !parts.status.is_success() {
899                        let bytes = common::to_bytes(body).await.unwrap_or_default();
900                        let error = serde_json::from_str(&common::to_string(&bytes));
901                        let response = common::to_response(parts, bytes.into());
902
903                        if let common::Retry::After(d) =
904                            dlg.http_failure(&response, error.as_ref().ok())
905                        {
906                            sleep(d).await;
907                            continue;
908                        }
909
910                        dlg.finished(false);
911
912                        return Err(match error {
913                            Ok(value) => common::Error::BadRequest(value),
914                            _ => common::Error::Failure(response),
915                        });
916                    }
917                    let response = {
918                        let bytes = common::to_bytes(body).await.unwrap_or_default();
919                        let encoded = common::to_string(&bytes);
920                        match serde_json::from_str(&encoded) {
921                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
922                            Err(error) => {
923                                dlg.response_json_decode_error(&encoded, &error);
924                                return Err(common::Error::JsonDecodeError(
925                                    encoded.to_string(),
926                                    error,
927                                ));
928                            }
929                        }
930                    };
931
932                    dlg.finished(true);
933                    return Ok(response);
934                }
935            }
936        }
937    }
938
939    /// The name of the operation resource to be deleted.
940    ///
941    /// Sets the *name* path property to the given value.
942    ///
943    /// Even though the property as already been set when instantiating this call,
944    /// we provide this method for API completeness.
945    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
946        self._name = new_value.to_string();
947        self
948    }
949    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
950    /// while executing the actual API request.
951    ///
952    /// ````text
953    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
954    /// ````
955    ///
956    /// Sets the *delegate* property to the given value.
957    pub fn delegate(
958        mut self,
959        new_value: &'a mut dyn common::Delegate,
960    ) -> ProjectLocationOperationDeleteCall<'a, C> {
961        self._delegate = Some(new_value);
962        self
963    }
964
965    /// Set any additional parameter of the query string used in the request.
966    /// It should be used to set parameters which are not yet available through their own
967    /// setters.
968    ///
969    /// Please note that this method must not be used to set any of the known parameters
970    /// which have their own setter method. If done anyway, the request will fail.
971    ///
972    /// # Additional Parameters
973    ///
974    /// * *$.xgafv* (query-string) - V1 error format.
975    /// * *access_token* (query-string) - OAuth access token.
976    /// * *alt* (query-string) - Data format for response.
977    /// * *callback* (query-string) - JSONP
978    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
979    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
980    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
981    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
982    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
983    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
984    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
985    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
986    where
987        T: AsRef<str>,
988    {
989        self._additional_params
990            .insert(name.as_ref().to_string(), value.as_ref().to_string());
991        self
992    }
993
994    /// Identifies the authorization scope for the method you are building.
995    ///
996    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
997    /// [`Scope::CloudPlatform`].
998    ///
999    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1000    /// tokens for more than one scope.
1001    ///
1002    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1003    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1004    /// sufficient, a read-write scope will do as well.
1005    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
1006    where
1007        St: AsRef<str>,
1008    {
1009        self._scopes.insert(String::from(scope.as_ref()));
1010        self
1011    }
1012    /// Identifies the authorization scope(s) for the method you are building.
1013    ///
1014    /// See [`Self::add_scope()`] for details.
1015    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
1016    where
1017        I: IntoIterator<Item = St>,
1018        St: AsRef<str>,
1019    {
1020        self._scopes
1021            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1022        self
1023    }
1024
1025    /// Removes all scopes, and no default scope will be used either.
1026    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1027    /// for details).
1028    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
1029        self._scopes.clear();
1030        self
1031    }
1032}
1033
1034/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1035///
1036/// A builder for the *locations.operations.get* method supported by a *project* resource.
1037/// It is not used directly, but through a [`ProjectMethods`] instance.
1038///
1039/// # Example
1040///
1041/// Instantiate a resource method builder
1042///
1043/// ```test_harness,no_run
1044/// # extern crate hyper;
1045/// # extern crate hyper_rustls;
1046/// # extern crate google_workflows1 as workflows1;
1047/// # async fn dox() {
1048/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1049///
1050/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1051/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1052/// #     .with_native_roots()
1053/// #     .unwrap()
1054/// #     .https_only()
1055/// #     .enable_http2()
1056/// #     .build();
1057///
1058/// # let executor = hyper_util::rt::TokioExecutor::new();
1059/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1060/// #     secret,
1061/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1062/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1063/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1064/// #     ),
1065/// # ).build().await.unwrap();
1066///
1067/// # let client = hyper_util::client::legacy::Client::builder(
1068/// #     hyper_util::rt::TokioExecutor::new()
1069/// # )
1070/// # .build(
1071/// #     hyper_rustls::HttpsConnectorBuilder::new()
1072/// #         .with_native_roots()
1073/// #         .unwrap()
1074/// #         .https_or_http()
1075/// #         .enable_http2()
1076/// #         .build()
1077/// # );
1078/// # let mut hub = Workflows::new(client, auth);
1079/// // You can configure optional parameters by calling the respective setters at will, and
1080/// // execute the final call using `doit()`.
1081/// // Values shown here are possibly random and not representative !
1082/// let result = hub.projects().locations_operations_get("name")
1083///              .doit().await;
1084/// # }
1085/// ```
1086pub struct ProjectLocationOperationGetCall<'a, C>
1087where
1088    C: 'a,
1089{
1090    hub: &'a Workflows<C>,
1091    _name: String,
1092    _delegate: Option<&'a mut dyn common::Delegate>,
1093    _additional_params: HashMap<String, String>,
1094    _scopes: BTreeSet<String>,
1095}
1096
1097impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
1098
1099impl<'a, C> ProjectLocationOperationGetCall<'a, C>
1100where
1101    C: common::Connector,
1102{
1103    /// Perform the operation you have build so far.
1104    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1105        use std::borrow::Cow;
1106        use std::io::{Read, Seek};
1107
1108        use common::{url::Params, ToParts};
1109        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1110
1111        let mut dd = common::DefaultDelegate;
1112        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1113        dlg.begin(common::MethodInfo {
1114            id: "workflows.projects.locations.operations.get",
1115            http_method: hyper::Method::GET,
1116        });
1117
1118        for &field in ["alt", "name"].iter() {
1119            if self._additional_params.contains_key(field) {
1120                dlg.finished(false);
1121                return Err(common::Error::FieldClash(field));
1122            }
1123        }
1124
1125        let mut params = Params::with_capacity(3 + self._additional_params.len());
1126        params.push("name", self._name);
1127
1128        params.extend(self._additional_params.iter());
1129
1130        params.push("alt", "json");
1131        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1132        if self._scopes.is_empty() {
1133            self._scopes
1134                .insert(Scope::CloudPlatform.as_ref().to_string());
1135        }
1136
1137        #[allow(clippy::single_element_loop)]
1138        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1139            url = params.uri_replacement(url, param_name, find_this, true);
1140        }
1141        {
1142            let to_remove = ["name"];
1143            params.remove_params(&to_remove);
1144        }
1145
1146        let url = params.parse_with_url(&url);
1147
1148        loop {
1149            let token = match self
1150                .hub
1151                .auth
1152                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1153                .await
1154            {
1155                Ok(token) => token,
1156                Err(e) => match dlg.token(e) {
1157                    Ok(token) => token,
1158                    Err(e) => {
1159                        dlg.finished(false);
1160                        return Err(common::Error::MissingToken(e));
1161                    }
1162                },
1163            };
1164            let mut req_result = {
1165                let client = &self.hub.client;
1166                dlg.pre_request();
1167                let mut req_builder = hyper::Request::builder()
1168                    .method(hyper::Method::GET)
1169                    .uri(url.as_str())
1170                    .header(USER_AGENT, self.hub._user_agent.clone());
1171
1172                if let Some(token) = token.as_ref() {
1173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1174                }
1175
1176                let request = req_builder
1177                    .header(CONTENT_LENGTH, 0_u64)
1178                    .body(common::to_body::<String>(None));
1179
1180                client.request(request.unwrap()).await
1181            };
1182
1183            match req_result {
1184                Err(err) => {
1185                    if let common::Retry::After(d) = dlg.http_error(&err) {
1186                        sleep(d).await;
1187                        continue;
1188                    }
1189                    dlg.finished(false);
1190                    return Err(common::Error::HttpError(err));
1191                }
1192                Ok(res) => {
1193                    let (mut parts, body) = res.into_parts();
1194                    let mut body = common::Body::new(body);
1195                    if !parts.status.is_success() {
1196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1197                        let error = serde_json::from_str(&common::to_string(&bytes));
1198                        let response = common::to_response(parts, bytes.into());
1199
1200                        if let common::Retry::After(d) =
1201                            dlg.http_failure(&response, error.as_ref().ok())
1202                        {
1203                            sleep(d).await;
1204                            continue;
1205                        }
1206
1207                        dlg.finished(false);
1208
1209                        return Err(match error {
1210                            Ok(value) => common::Error::BadRequest(value),
1211                            _ => common::Error::Failure(response),
1212                        });
1213                    }
1214                    let response = {
1215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1216                        let encoded = common::to_string(&bytes);
1217                        match serde_json::from_str(&encoded) {
1218                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1219                            Err(error) => {
1220                                dlg.response_json_decode_error(&encoded, &error);
1221                                return Err(common::Error::JsonDecodeError(
1222                                    encoded.to_string(),
1223                                    error,
1224                                ));
1225                            }
1226                        }
1227                    };
1228
1229                    dlg.finished(true);
1230                    return Ok(response);
1231                }
1232            }
1233        }
1234    }
1235
1236    /// The name of the operation resource.
1237    ///
1238    /// Sets the *name* path property to the given value.
1239    ///
1240    /// Even though the property as already been set when instantiating this call,
1241    /// we provide this method for API completeness.
1242    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
1243        self._name = new_value.to_string();
1244        self
1245    }
1246    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1247    /// while executing the actual API request.
1248    ///
1249    /// ````text
1250    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1251    /// ````
1252    ///
1253    /// Sets the *delegate* property to the given value.
1254    pub fn delegate(
1255        mut self,
1256        new_value: &'a mut dyn common::Delegate,
1257    ) -> ProjectLocationOperationGetCall<'a, C> {
1258        self._delegate = Some(new_value);
1259        self
1260    }
1261
1262    /// Set any additional parameter of the query string used in the request.
1263    /// It should be used to set parameters which are not yet available through their own
1264    /// setters.
1265    ///
1266    /// Please note that this method must not be used to set any of the known parameters
1267    /// which have their own setter method. If done anyway, the request will fail.
1268    ///
1269    /// # Additional Parameters
1270    ///
1271    /// * *$.xgafv* (query-string) - V1 error format.
1272    /// * *access_token* (query-string) - OAuth access token.
1273    /// * *alt* (query-string) - Data format for response.
1274    /// * *callback* (query-string) - JSONP
1275    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1276    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1277    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1278    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1279    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1280    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1281    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1282    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
1283    where
1284        T: AsRef<str>,
1285    {
1286        self._additional_params
1287            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1288        self
1289    }
1290
1291    /// Identifies the authorization scope for the method you are building.
1292    ///
1293    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1294    /// [`Scope::CloudPlatform`].
1295    ///
1296    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1297    /// tokens for more than one scope.
1298    ///
1299    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1300    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1301    /// sufficient, a read-write scope will do as well.
1302    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
1303    where
1304        St: AsRef<str>,
1305    {
1306        self._scopes.insert(String::from(scope.as_ref()));
1307        self
1308    }
1309    /// Identifies the authorization scope(s) for the method you are building.
1310    ///
1311    /// See [`Self::add_scope()`] for details.
1312    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
1313    where
1314        I: IntoIterator<Item = St>,
1315        St: AsRef<str>,
1316    {
1317        self._scopes
1318            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1319        self
1320    }
1321
1322    /// Removes all scopes, and no default scope will be used either.
1323    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1324    /// for details).
1325    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
1326        self._scopes.clear();
1327        self
1328    }
1329}
1330
1331/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1332///
1333/// A builder for the *locations.operations.list* method supported by a *project* resource.
1334/// It is not used directly, but through a [`ProjectMethods`] instance.
1335///
1336/// # Example
1337///
1338/// Instantiate a resource method builder
1339///
1340/// ```test_harness,no_run
1341/// # extern crate hyper;
1342/// # extern crate hyper_rustls;
1343/// # extern crate google_workflows1 as workflows1;
1344/// # async fn dox() {
1345/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1346///
1347/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1348/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1349/// #     .with_native_roots()
1350/// #     .unwrap()
1351/// #     .https_only()
1352/// #     .enable_http2()
1353/// #     .build();
1354///
1355/// # let executor = hyper_util::rt::TokioExecutor::new();
1356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1357/// #     secret,
1358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1359/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1360/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1361/// #     ),
1362/// # ).build().await.unwrap();
1363///
1364/// # let client = hyper_util::client::legacy::Client::builder(
1365/// #     hyper_util::rt::TokioExecutor::new()
1366/// # )
1367/// # .build(
1368/// #     hyper_rustls::HttpsConnectorBuilder::new()
1369/// #         .with_native_roots()
1370/// #         .unwrap()
1371/// #         .https_or_http()
1372/// #         .enable_http2()
1373/// #         .build()
1374/// # );
1375/// # let mut hub = Workflows::new(client, auth);
1376/// // You can configure optional parameters by calling the respective setters at will, and
1377/// // execute the final call using `doit()`.
1378/// // Values shown here are possibly random and not representative !
1379/// let result = hub.projects().locations_operations_list("name")
1380///              .return_partial_success(true)
1381///              .page_token("amet.")
1382///              .page_size(-20)
1383///              .filter("ipsum")
1384///              .doit().await;
1385/// # }
1386/// ```
1387pub struct ProjectLocationOperationListCall<'a, C>
1388where
1389    C: 'a,
1390{
1391    hub: &'a Workflows<C>,
1392    _name: String,
1393    _return_partial_success: Option<bool>,
1394    _page_token: Option<String>,
1395    _page_size: Option<i32>,
1396    _filter: Option<String>,
1397    _delegate: Option<&'a mut dyn common::Delegate>,
1398    _additional_params: HashMap<String, String>,
1399    _scopes: BTreeSet<String>,
1400}
1401
1402impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
1403
1404impl<'a, C> ProjectLocationOperationListCall<'a, C>
1405where
1406    C: common::Connector,
1407{
1408    /// Perform the operation you have build so far.
1409    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
1410        use std::borrow::Cow;
1411        use std::io::{Read, Seek};
1412
1413        use common::{url::Params, ToParts};
1414        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1415
1416        let mut dd = common::DefaultDelegate;
1417        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1418        dlg.begin(common::MethodInfo {
1419            id: "workflows.projects.locations.operations.list",
1420            http_method: hyper::Method::GET,
1421        });
1422
1423        for &field in [
1424            "alt",
1425            "name",
1426            "returnPartialSuccess",
1427            "pageToken",
1428            "pageSize",
1429            "filter",
1430        ]
1431        .iter()
1432        {
1433            if self._additional_params.contains_key(field) {
1434                dlg.finished(false);
1435                return Err(common::Error::FieldClash(field));
1436            }
1437        }
1438
1439        let mut params = Params::with_capacity(7 + self._additional_params.len());
1440        params.push("name", self._name);
1441        if let Some(value) = self._return_partial_success.as_ref() {
1442            params.push("returnPartialSuccess", value.to_string());
1443        }
1444        if let Some(value) = self._page_token.as_ref() {
1445            params.push("pageToken", value);
1446        }
1447        if let Some(value) = self._page_size.as_ref() {
1448            params.push("pageSize", value.to_string());
1449        }
1450        if let Some(value) = self._filter.as_ref() {
1451            params.push("filter", value);
1452        }
1453
1454        params.extend(self._additional_params.iter());
1455
1456        params.push("alt", "json");
1457        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
1458        if self._scopes.is_empty() {
1459            self._scopes
1460                .insert(Scope::CloudPlatform.as_ref().to_string());
1461        }
1462
1463        #[allow(clippy::single_element_loop)]
1464        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1465            url = params.uri_replacement(url, param_name, find_this, true);
1466        }
1467        {
1468            let to_remove = ["name"];
1469            params.remove_params(&to_remove);
1470        }
1471
1472        let url = params.parse_with_url(&url);
1473
1474        loop {
1475            let token = match self
1476                .hub
1477                .auth
1478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1479                .await
1480            {
1481                Ok(token) => token,
1482                Err(e) => match dlg.token(e) {
1483                    Ok(token) => token,
1484                    Err(e) => {
1485                        dlg.finished(false);
1486                        return Err(common::Error::MissingToken(e));
1487                    }
1488                },
1489            };
1490            let mut req_result = {
1491                let client = &self.hub.client;
1492                dlg.pre_request();
1493                let mut req_builder = hyper::Request::builder()
1494                    .method(hyper::Method::GET)
1495                    .uri(url.as_str())
1496                    .header(USER_AGENT, self.hub._user_agent.clone());
1497
1498                if let Some(token) = token.as_ref() {
1499                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1500                }
1501
1502                let request = req_builder
1503                    .header(CONTENT_LENGTH, 0_u64)
1504                    .body(common::to_body::<String>(None));
1505
1506                client.request(request.unwrap()).await
1507            };
1508
1509            match req_result {
1510                Err(err) => {
1511                    if let common::Retry::After(d) = dlg.http_error(&err) {
1512                        sleep(d).await;
1513                        continue;
1514                    }
1515                    dlg.finished(false);
1516                    return Err(common::Error::HttpError(err));
1517                }
1518                Ok(res) => {
1519                    let (mut parts, body) = res.into_parts();
1520                    let mut body = common::Body::new(body);
1521                    if !parts.status.is_success() {
1522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1523                        let error = serde_json::from_str(&common::to_string(&bytes));
1524                        let response = common::to_response(parts, bytes.into());
1525
1526                        if let common::Retry::After(d) =
1527                            dlg.http_failure(&response, error.as_ref().ok())
1528                        {
1529                            sleep(d).await;
1530                            continue;
1531                        }
1532
1533                        dlg.finished(false);
1534
1535                        return Err(match error {
1536                            Ok(value) => common::Error::BadRequest(value),
1537                            _ => common::Error::Failure(response),
1538                        });
1539                    }
1540                    let response = {
1541                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1542                        let encoded = common::to_string(&bytes);
1543                        match serde_json::from_str(&encoded) {
1544                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1545                            Err(error) => {
1546                                dlg.response_json_decode_error(&encoded, &error);
1547                                return Err(common::Error::JsonDecodeError(
1548                                    encoded.to_string(),
1549                                    error,
1550                                ));
1551                            }
1552                        }
1553                    };
1554
1555                    dlg.finished(true);
1556                    return Ok(response);
1557                }
1558            }
1559        }
1560    }
1561
1562    /// The name of the operation's parent resource.
1563    ///
1564    /// Sets the *name* path property to the given value.
1565    ///
1566    /// Even though the property as already been set when instantiating this call,
1567    /// we provide this method for API completeness.
1568    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
1569        self._name = new_value.to_string();
1570        self
1571    }
1572    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
1573    ///
1574    /// Sets the *return partial success* query property to the given value.
1575    pub fn return_partial_success(
1576        mut self,
1577        new_value: bool,
1578    ) -> ProjectLocationOperationListCall<'a, C> {
1579        self._return_partial_success = Some(new_value);
1580        self
1581    }
1582    /// The standard list page token.
1583    ///
1584    /// Sets the *page token* query property to the given value.
1585    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
1586        self._page_token = Some(new_value.to_string());
1587        self
1588    }
1589    /// The standard list page size.
1590    ///
1591    /// Sets the *page size* query property to the given value.
1592    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
1593        self._page_size = Some(new_value);
1594        self
1595    }
1596    /// The standard list filter.
1597    ///
1598    /// Sets the *filter* query property to the given value.
1599    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
1600        self._filter = Some(new_value.to_string());
1601        self
1602    }
1603    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1604    /// while executing the actual API request.
1605    ///
1606    /// ````text
1607    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1608    /// ````
1609    ///
1610    /// Sets the *delegate* property to the given value.
1611    pub fn delegate(
1612        mut self,
1613        new_value: &'a mut dyn common::Delegate,
1614    ) -> ProjectLocationOperationListCall<'a, C> {
1615        self._delegate = Some(new_value);
1616        self
1617    }
1618
1619    /// Set any additional parameter of the query string used in the request.
1620    /// It should be used to set parameters which are not yet available through their own
1621    /// setters.
1622    ///
1623    /// Please note that this method must not be used to set any of the known parameters
1624    /// which have their own setter method. If done anyway, the request will fail.
1625    ///
1626    /// # Additional Parameters
1627    ///
1628    /// * *$.xgafv* (query-string) - V1 error format.
1629    /// * *access_token* (query-string) - OAuth access token.
1630    /// * *alt* (query-string) - Data format for response.
1631    /// * *callback* (query-string) - JSONP
1632    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1633    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1634    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1635    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1636    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1637    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1638    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1639    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
1640    where
1641        T: AsRef<str>,
1642    {
1643        self._additional_params
1644            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1645        self
1646    }
1647
1648    /// Identifies the authorization scope for the method you are building.
1649    ///
1650    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1651    /// [`Scope::CloudPlatform`].
1652    ///
1653    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1654    /// tokens for more than one scope.
1655    ///
1656    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1657    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1658    /// sufficient, a read-write scope will do as well.
1659    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
1660    where
1661        St: AsRef<str>,
1662    {
1663        self._scopes.insert(String::from(scope.as_ref()));
1664        self
1665    }
1666    /// Identifies the authorization scope(s) for the method you are building.
1667    ///
1668    /// See [`Self::add_scope()`] for details.
1669    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
1670    where
1671        I: IntoIterator<Item = St>,
1672        St: AsRef<str>,
1673    {
1674        self._scopes
1675            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1676        self
1677    }
1678
1679    /// Removes all scopes, and no default scope will be used either.
1680    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1681    /// for details).
1682    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
1683        self._scopes.clear();
1684        self
1685    }
1686}
1687
1688/// Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a ALREADY_EXISTS error.
1689///
1690/// A builder for the *locations.workflows.create* method supported by a *project* resource.
1691/// It is not used directly, but through a [`ProjectMethods`] instance.
1692///
1693/// # Example
1694///
1695/// Instantiate a resource method builder
1696///
1697/// ```test_harness,no_run
1698/// # extern crate hyper;
1699/// # extern crate hyper_rustls;
1700/// # extern crate google_workflows1 as workflows1;
1701/// use workflows1::api::Workflow;
1702/// # async fn dox() {
1703/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1704///
1705/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1706/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1707/// #     .with_native_roots()
1708/// #     .unwrap()
1709/// #     .https_only()
1710/// #     .enable_http2()
1711/// #     .build();
1712///
1713/// # let executor = hyper_util::rt::TokioExecutor::new();
1714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1715/// #     secret,
1716/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1717/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1718/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1719/// #     ),
1720/// # ).build().await.unwrap();
1721///
1722/// # let client = hyper_util::client::legacy::Client::builder(
1723/// #     hyper_util::rt::TokioExecutor::new()
1724/// # )
1725/// # .build(
1726/// #     hyper_rustls::HttpsConnectorBuilder::new()
1727/// #         .with_native_roots()
1728/// #         .unwrap()
1729/// #         .https_or_http()
1730/// #         .enable_http2()
1731/// #         .build()
1732/// # );
1733/// # let mut hub = Workflows::new(client, auth);
1734/// // As the method needs a request, you would usually fill it with the desired information
1735/// // into the respective structure. Some of the parts shown here might not be applicable !
1736/// // Values shown here are possibly random and not representative !
1737/// let mut req = Workflow::default();
1738///
1739/// // You can configure optional parameters by calling the respective setters at will, and
1740/// // execute the final call using `doit()`.
1741/// // Values shown here are possibly random and not representative !
1742/// let result = hub.projects().locations_workflows_create(req, "parent")
1743///              .workflow_id("Lorem")
1744///              .doit().await;
1745/// # }
1746/// ```
1747pub struct ProjectLocationWorkflowCreateCall<'a, C>
1748where
1749    C: 'a,
1750{
1751    hub: &'a Workflows<C>,
1752    _request: Workflow,
1753    _parent: String,
1754    _workflow_id: Option<String>,
1755    _delegate: Option<&'a mut dyn common::Delegate>,
1756    _additional_params: HashMap<String, String>,
1757    _scopes: BTreeSet<String>,
1758}
1759
1760impl<'a, C> common::CallBuilder for ProjectLocationWorkflowCreateCall<'a, C> {}
1761
1762impl<'a, C> ProjectLocationWorkflowCreateCall<'a, C>
1763where
1764    C: common::Connector,
1765{
1766    /// Perform the operation you have build so far.
1767    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1768        use std::borrow::Cow;
1769        use std::io::{Read, Seek};
1770
1771        use common::{url::Params, ToParts};
1772        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1773
1774        let mut dd = common::DefaultDelegate;
1775        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1776        dlg.begin(common::MethodInfo {
1777            id: "workflows.projects.locations.workflows.create",
1778            http_method: hyper::Method::POST,
1779        });
1780
1781        for &field in ["alt", "parent", "workflowId"].iter() {
1782            if self._additional_params.contains_key(field) {
1783                dlg.finished(false);
1784                return Err(common::Error::FieldClash(field));
1785            }
1786        }
1787
1788        let mut params = Params::with_capacity(5 + self._additional_params.len());
1789        params.push("parent", self._parent);
1790        if let Some(value) = self._workflow_id.as_ref() {
1791            params.push("workflowId", value);
1792        }
1793
1794        params.extend(self._additional_params.iter());
1795
1796        params.push("alt", "json");
1797        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflows";
1798        if self._scopes.is_empty() {
1799            self._scopes
1800                .insert(Scope::CloudPlatform.as_ref().to_string());
1801        }
1802
1803        #[allow(clippy::single_element_loop)]
1804        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1805            url = params.uri_replacement(url, param_name, find_this, true);
1806        }
1807        {
1808            let to_remove = ["parent"];
1809            params.remove_params(&to_remove);
1810        }
1811
1812        let url = params.parse_with_url(&url);
1813
1814        let mut json_mime_type = mime::APPLICATION_JSON;
1815        let mut request_value_reader = {
1816            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1817            common::remove_json_null_values(&mut value);
1818            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1819            serde_json::to_writer(&mut dst, &value).unwrap();
1820            dst
1821        };
1822        let request_size = request_value_reader
1823            .seek(std::io::SeekFrom::End(0))
1824            .unwrap();
1825        request_value_reader
1826            .seek(std::io::SeekFrom::Start(0))
1827            .unwrap();
1828
1829        loop {
1830            let token = match self
1831                .hub
1832                .auth
1833                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1834                .await
1835            {
1836                Ok(token) => token,
1837                Err(e) => match dlg.token(e) {
1838                    Ok(token) => token,
1839                    Err(e) => {
1840                        dlg.finished(false);
1841                        return Err(common::Error::MissingToken(e));
1842                    }
1843                },
1844            };
1845            request_value_reader
1846                .seek(std::io::SeekFrom::Start(0))
1847                .unwrap();
1848            let mut req_result = {
1849                let client = &self.hub.client;
1850                dlg.pre_request();
1851                let mut req_builder = hyper::Request::builder()
1852                    .method(hyper::Method::POST)
1853                    .uri(url.as_str())
1854                    .header(USER_AGENT, self.hub._user_agent.clone());
1855
1856                if let Some(token) = token.as_ref() {
1857                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1858                }
1859
1860                let request = req_builder
1861                    .header(CONTENT_TYPE, json_mime_type.to_string())
1862                    .header(CONTENT_LENGTH, request_size as u64)
1863                    .body(common::to_body(
1864                        request_value_reader.get_ref().clone().into(),
1865                    ));
1866
1867                client.request(request.unwrap()).await
1868            };
1869
1870            match req_result {
1871                Err(err) => {
1872                    if let common::Retry::After(d) = dlg.http_error(&err) {
1873                        sleep(d).await;
1874                        continue;
1875                    }
1876                    dlg.finished(false);
1877                    return Err(common::Error::HttpError(err));
1878                }
1879                Ok(res) => {
1880                    let (mut parts, body) = res.into_parts();
1881                    let mut body = common::Body::new(body);
1882                    if !parts.status.is_success() {
1883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1884                        let error = serde_json::from_str(&common::to_string(&bytes));
1885                        let response = common::to_response(parts, bytes.into());
1886
1887                        if let common::Retry::After(d) =
1888                            dlg.http_failure(&response, error.as_ref().ok())
1889                        {
1890                            sleep(d).await;
1891                            continue;
1892                        }
1893
1894                        dlg.finished(false);
1895
1896                        return Err(match error {
1897                            Ok(value) => common::Error::BadRequest(value),
1898                            _ => common::Error::Failure(response),
1899                        });
1900                    }
1901                    let response = {
1902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1903                        let encoded = common::to_string(&bytes);
1904                        match serde_json::from_str(&encoded) {
1905                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1906                            Err(error) => {
1907                                dlg.response_json_decode_error(&encoded, &error);
1908                                return Err(common::Error::JsonDecodeError(
1909                                    encoded.to_string(),
1910                                    error,
1911                                ));
1912                            }
1913                        }
1914                    };
1915
1916                    dlg.finished(true);
1917                    return Ok(response);
1918                }
1919            }
1920        }
1921    }
1922
1923    ///
1924    /// Sets the *request* property to the given value.
1925    ///
1926    /// Even though the property as already been set when instantiating this call,
1927    /// we provide this method for API completeness.
1928    pub fn request(mut self, new_value: Workflow) -> ProjectLocationWorkflowCreateCall<'a, C> {
1929        self._request = new_value;
1930        self
1931    }
1932    /// Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location}
1933    ///
1934    /// Sets the *parent* path property to the given value.
1935    ///
1936    /// Even though the property as already been set when instantiating this call,
1937    /// we provide this method for API completeness.
1938    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowCreateCall<'a, C> {
1939        self._parent = new_value.to_string();
1940        self
1941    }
1942    /// Required. The ID of the workflow to be created. It has to fulfill the following requirements: * Must contain only letters, numbers, underscores and hyphens. * Must start with a letter. * Must be between 1-64 characters. * Must end with a number or a letter. * Must be unique within the customer project and location.
1943    ///
1944    /// Sets the *workflow id* query property to the given value.
1945    pub fn workflow_id(mut self, new_value: &str) -> ProjectLocationWorkflowCreateCall<'a, C> {
1946        self._workflow_id = Some(new_value.to_string());
1947        self
1948    }
1949    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1950    /// while executing the actual API request.
1951    ///
1952    /// ````text
1953    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1954    /// ````
1955    ///
1956    /// Sets the *delegate* property to the given value.
1957    pub fn delegate(
1958        mut self,
1959        new_value: &'a mut dyn common::Delegate,
1960    ) -> ProjectLocationWorkflowCreateCall<'a, C> {
1961        self._delegate = Some(new_value);
1962        self
1963    }
1964
1965    /// Set any additional parameter of the query string used in the request.
1966    /// It should be used to set parameters which are not yet available through their own
1967    /// setters.
1968    ///
1969    /// Please note that this method must not be used to set any of the known parameters
1970    /// which have their own setter method. If done anyway, the request will fail.
1971    ///
1972    /// # Additional Parameters
1973    ///
1974    /// * *$.xgafv* (query-string) - V1 error format.
1975    /// * *access_token* (query-string) - OAuth access token.
1976    /// * *alt* (query-string) - Data format for response.
1977    /// * *callback* (query-string) - JSONP
1978    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1979    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1980    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1981    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1982    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1983    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1984    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1985    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowCreateCall<'a, C>
1986    where
1987        T: AsRef<str>,
1988    {
1989        self._additional_params
1990            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1991        self
1992    }
1993
1994    /// Identifies the authorization scope for the method you are building.
1995    ///
1996    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1997    /// [`Scope::CloudPlatform`].
1998    ///
1999    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2000    /// tokens for more than one scope.
2001    ///
2002    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2003    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2004    /// sufficient, a read-write scope will do as well.
2005    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowCreateCall<'a, C>
2006    where
2007        St: AsRef<str>,
2008    {
2009        self._scopes.insert(String::from(scope.as_ref()));
2010        self
2011    }
2012    /// Identifies the authorization scope(s) for the method you are building.
2013    ///
2014    /// See [`Self::add_scope()`] for details.
2015    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowCreateCall<'a, C>
2016    where
2017        I: IntoIterator<Item = St>,
2018        St: AsRef<str>,
2019    {
2020        self._scopes
2021            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2022        self
2023    }
2024
2025    /// Removes all scopes, and no default scope will be used either.
2026    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2027    /// for details).
2028    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowCreateCall<'a, C> {
2029        self._scopes.clear();
2030        self
2031    }
2032}
2033
2034/// Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.
2035///
2036/// A builder for the *locations.workflows.delete* method supported by a *project* resource.
2037/// It is not used directly, but through a [`ProjectMethods`] instance.
2038///
2039/// # Example
2040///
2041/// Instantiate a resource method builder
2042///
2043/// ```test_harness,no_run
2044/// # extern crate hyper;
2045/// # extern crate hyper_rustls;
2046/// # extern crate google_workflows1 as workflows1;
2047/// # async fn dox() {
2048/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2049///
2050/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2051/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2052/// #     .with_native_roots()
2053/// #     .unwrap()
2054/// #     .https_only()
2055/// #     .enable_http2()
2056/// #     .build();
2057///
2058/// # let executor = hyper_util::rt::TokioExecutor::new();
2059/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2060/// #     secret,
2061/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2062/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2063/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2064/// #     ),
2065/// # ).build().await.unwrap();
2066///
2067/// # let client = hyper_util::client::legacy::Client::builder(
2068/// #     hyper_util::rt::TokioExecutor::new()
2069/// # )
2070/// # .build(
2071/// #     hyper_rustls::HttpsConnectorBuilder::new()
2072/// #         .with_native_roots()
2073/// #         .unwrap()
2074/// #         .https_or_http()
2075/// #         .enable_http2()
2076/// #         .build()
2077/// # );
2078/// # let mut hub = Workflows::new(client, auth);
2079/// // You can configure optional parameters by calling the respective setters at will, and
2080/// // execute the final call using `doit()`.
2081/// // Values shown here are possibly random and not representative !
2082/// let result = hub.projects().locations_workflows_delete("name")
2083///              .doit().await;
2084/// # }
2085/// ```
2086pub struct ProjectLocationWorkflowDeleteCall<'a, C>
2087where
2088    C: 'a,
2089{
2090    hub: &'a Workflows<C>,
2091    _name: String,
2092    _delegate: Option<&'a mut dyn common::Delegate>,
2093    _additional_params: HashMap<String, String>,
2094    _scopes: BTreeSet<String>,
2095}
2096
2097impl<'a, C> common::CallBuilder for ProjectLocationWorkflowDeleteCall<'a, C> {}
2098
2099impl<'a, C> ProjectLocationWorkflowDeleteCall<'a, C>
2100where
2101    C: common::Connector,
2102{
2103    /// Perform the operation you have build so far.
2104    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2105        use std::borrow::Cow;
2106        use std::io::{Read, Seek};
2107
2108        use common::{url::Params, ToParts};
2109        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2110
2111        let mut dd = common::DefaultDelegate;
2112        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2113        dlg.begin(common::MethodInfo {
2114            id: "workflows.projects.locations.workflows.delete",
2115            http_method: hyper::Method::DELETE,
2116        });
2117
2118        for &field in ["alt", "name"].iter() {
2119            if self._additional_params.contains_key(field) {
2120                dlg.finished(false);
2121                return Err(common::Error::FieldClash(field));
2122            }
2123        }
2124
2125        let mut params = Params::with_capacity(3 + self._additional_params.len());
2126        params.push("name", self._name);
2127
2128        params.extend(self._additional_params.iter());
2129
2130        params.push("alt", "json");
2131        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2132        if self._scopes.is_empty() {
2133            self._scopes
2134                .insert(Scope::CloudPlatform.as_ref().to_string());
2135        }
2136
2137        #[allow(clippy::single_element_loop)]
2138        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2139            url = params.uri_replacement(url, param_name, find_this, true);
2140        }
2141        {
2142            let to_remove = ["name"];
2143            params.remove_params(&to_remove);
2144        }
2145
2146        let url = params.parse_with_url(&url);
2147
2148        loop {
2149            let token = match self
2150                .hub
2151                .auth
2152                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2153                .await
2154            {
2155                Ok(token) => token,
2156                Err(e) => match dlg.token(e) {
2157                    Ok(token) => token,
2158                    Err(e) => {
2159                        dlg.finished(false);
2160                        return Err(common::Error::MissingToken(e));
2161                    }
2162                },
2163            };
2164            let mut req_result = {
2165                let client = &self.hub.client;
2166                dlg.pre_request();
2167                let mut req_builder = hyper::Request::builder()
2168                    .method(hyper::Method::DELETE)
2169                    .uri(url.as_str())
2170                    .header(USER_AGENT, self.hub._user_agent.clone());
2171
2172                if let Some(token) = token.as_ref() {
2173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2174                }
2175
2176                let request = req_builder
2177                    .header(CONTENT_LENGTH, 0_u64)
2178                    .body(common::to_body::<String>(None));
2179
2180                client.request(request.unwrap()).await
2181            };
2182
2183            match req_result {
2184                Err(err) => {
2185                    if let common::Retry::After(d) = dlg.http_error(&err) {
2186                        sleep(d).await;
2187                        continue;
2188                    }
2189                    dlg.finished(false);
2190                    return Err(common::Error::HttpError(err));
2191                }
2192                Ok(res) => {
2193                    let (mut parts, body) = res.into_parts();
2194                    let mut body = common::Body::new(body);
2195                    if !parts.status.is_success() {
2196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2197                        let error = serde_json::from_str(&common::to_string(&bytes));
2198                        let response = common::to_response(parts, bytes.into());
2199
2200                        if let common::Retry::After(d) =
2201                            dlg.http_failure(&response, error.as_ref().ok())
2202                        {
2203                            sleep(d).await;
2204                            continue;
2205                        }
2206
2207                        dlg.finished(false);
2208
2209                        return Err(match error {
2210                            Ok(value) => common::Error::BadRequest(value),
2211                            _ => common::Error::Failure(response),
2212                        });
2213                    }
2214                    let response = {
2215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2216                        let encoded = common::to_string(&bytes);
2217                        match serde_json::from_str(&encoded) {
2218                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2219                            Err(error) => {
2220                                dlg.response_json_decode_error(&encoded, &error);
2221                                return Err(common::Error::JsonDecodeError(
2222                                    encoded.to_string(),
2223                                    error,
2224                                ));
2225                            }
2226                        }
2227                    };
2228
2229                    dlg.finished(true);
2230                    return Ok(response);
2231                }
2232            }
2233        }
2234    }
2235
2236    /// Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow}
2237    ///
2238    /// Sets the *name* path property to the given value.
2239    ///
2240    /// Even though the property as already been set when instantiating this call,
2241    /// we provide this method for API completeness.
2242    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowDeleteCall<'a, C> {
2243        self._name = new_value.to_string();
2244        self
2245    }
2246    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2247    /// while executing the actual API request.
2248    ///
2249    /// ````text
2250    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2251    /// ````
2252    ///
2253    /// Sets the *delegate* property to the given value.
2254    pub fn delegate(
2255        mut self,
2256        new_value: &'a mut dyn common::Delegate,
2257    ) -> ProjectLocationWorkflowDeleteCall<'a, C> {
2258        self._delegate = Some(new_value);
2259        self
2260    }
2261
2262    /// Set any additional parameter of the query string used in the request.
2263    /// It should be used to set parameters which are not yet available through their own
2264    /// setters.
2265    ///
2266    /// Please note that this method must not be used to set any of the known parameters
2267    /// which have their own setter method. If done anyway, the request will fail.
2268    ///
2269    /// # Additional Parameters
2270    ///
2271    /// * *$.xgafv* (query-string) - V1 error format.
2272    /// * *access_token* (query-string) - OAuth access token.
2273    /// * *alt* (query-string) - Data format for response.
2274    /// * *callback* (query-string) - JSONP
2275    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2276    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2277    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2278    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2279    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2280    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2281    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2282    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowDeleteCall<'a, C>
2283    where
2284        T: AsRef<str>,
2285    {
2286        self._additional_params
2287            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2288        self
2289    }
2290
2291    /// Identifies the authorization scope for the method you are building.
2292    ///
2293    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2294    /// [`Scope::CloudPlatform`].
2295    ///
2296    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2297    /// tokens for more than one scope.
2298    ///
2299    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2300    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2301    /// sufficient, a read-write scope will do as well.
2302    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowDeleteCall<'a, C>
2303    where
2304        St: AsRef<str>,
2305    {
2306        self._scopes.insert(String::from(scope.as_ref()));
2307        self
2308    }
2309    /// Identifies the authorization scope(s) for the method you are building.
2310    ///
2311    /// See [`Self::add_scope()`] for details.
2312    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowDeleteCall<'a, C>
2313    where
2314        I: IntoIterator<Item = St>,
2315        St: AsRef<str>,
2316    {
2317        self._scopes
2318            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2319        self
2320    }
2321
2322    /// Removes all scopes, and no default scope will be used either.
2323    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2324    /// for details).
2325    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowDeleteCall<'a, C> {
2326        self._scopes.clear();
2327        self
2328    }
2329}
2330
2331/// Gets details of a single workflow.
2332///
2333/// A builder for the *locations.workflows.get* method supported by a *project* resource.
2334/// It is not used directly, but through a [`ProjectMethods`] instance.
2335///
2336/// # Example
2337///
2338/// Instantiate a resource method builder
2339///
2340/// ```test_harness,no_run
2341/// # extern crate hyper;
2342/// # extern crate hyper_rustls;
2343/// # extern crate google_workflows1 as workflows1;
2344/// # async fn dox() {
2345/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2346///
2347/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2348/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2349/// #     .with_native_roots()
2350/// #     .unwrap()
2351/// #     .https_only()
2352/// #     .enable_http2()
2353/// #     .build();
2354///
2355/// # let executor = hyper_util::rt::TokioExecutor::new();
2356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2357/// #     secret,
2358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2359/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2360/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2361/// #     ),
2362/// # ).build().await.unwrap();
2363///
2364/// # let client = hyper_util::client::legacy::Client::builder(
2365/// #     hyper_util::rt::TokioExecutor::new()
2366/// # )
2367/// # .build(
2368/// #     hyper_rustls::HttpsConnectorBuilder::new()
2369/// #         .with_native_roots()
2370/// #         .unwrap()
2371/// #         .https_or_http()
2372/// #         .enable_http2()
2373/// #         .build()
2374/// # );
2375/// # let mut hub = Workflows::new(client, auth);
2376/// // You can configure optional parameters by calling the respective setters at will, and
2377/// // execute the final call using `doit()`.
2378/// // Values shown here are possibly random and not representative !
2379/// let result = hub.projects().locations_workflows_get("name")
2380///              .revision_id("dolor")
2381///              .doit().await;
2382/// # }
2383/// ```
2384pub struct ProjectLocationWorkflowGetCall<'a, C>
2385where
2386    C: 'a,
2387{
2388    hub: &'a Workflows<C>,
2389    _name: String,
2390    _revision_id: Option<String>,
2391    _delegate: Option<&'a mut dyn common::Delegate>,
2392    _additional_params: HashMap<String, String>,
2393    _scopes: BTreeSet<String>,
2394}
2395
2396impl<'a, C> common::CallBuilder for ProjectLocationWorkflowGetCall<'a, C> {}
2397
2398impl<'a, C> ProjectLocationWorkflowGetCall<'a, C>
2399where
2400    C: common::Connector,
2401{
2402    /// Perform the operation you have build so far.
2403    pub async fn doit(mut self) -> common::Result<(common::Response, Workflow)> {
2404        use std::borrow::Cow;
2405        use std::io::{Read, Seek};
2406
2407        use common::{url::Params, ToParts};
2408        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2409
2410        let mut dd = common::DefaultDelegate;
2411        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2412        dlg.begin(common::MethodInfo {
2413            id: "workflows.projects.locations.workflows.get",
2414            http_method: hyper::Method::GET,
2415        });
2416
2417        for &field in ["alt", "name", "revisionId"].iter() {
2418            if self._additional_params.contains_key(field) {
2419                dlg.finished(false);
2420                return Err(common::Error::FieldClash(field));
2421            }
2422        }
2423
2424        let mut params = Params::with_capacity(4 + self._additional_params.len());
2425        params.push("name", self._name);
2426        if let Some(value) = self._revision_id.as_ref() {
2427            params.push("revisionId", value);
2428        }
2429
2430        params.extend(self._additional_params.iter());
2431
2432        params.push("alt", "json");
2433        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2434        if self._scopes.is_empty() {
2435            self._scopes
2436                .insert(Scope::CloudPlatform.as_ref().to_string());
2437        }
2438
2439        #[allow(clippy::single_element_loop)]
2440        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2441            url = params.uri_replacement(url, param_name, find_this, true);
2442        }
2443        {
2444            let to_remove = ["name"];
2445            params.remove_params(&to_remove);
2446        }
2447
2448        let url = params.parse_with_url(&url);
2449
2450        loop {
2451            let token = match self
2452                .hub
2453                .auth
2454                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2455                .await
2456            {
2457                Ok(token) => token,
2458                Err(e) => match dlg.token(e) {
2459                    Ok(token) => token,
2460                    Err(e) => {
2461                        dlg.finished(false);
2462                        return Err(common::Error::MissingToken(e));
2463                    }
2464                },
2465            };
2466            let mut req_result = {
2467                let client = &self.hub.client;
2468                dlg.pre_request();
2469                let mut req_builder = hyper::Request::builder()
2470                    .method(hyper::Method::GET)
2471                    .uri(url.as_str())
2472                    .header(USER_AGENT, self.hub._user_agent.clone());
2473
2474                if let Some(token) = token.as_ref() {
2475                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2476                }
2477
2478                let request = req_builder
2479                    .header(CONTENT_LENGTH, 0_u64)
2480                    .body(common::to_body::<String>(None));
2481
2482                client.request(request.unwrap()).await
2483            };
2484
2485            match req_result {
2486                Err(err) => {
2487                    if let common::Retry::After(d) = dlg.http_error(&err) {
2488                        sleep(d).await;
2489                        continue;
2490                    }
2491                    dlg.finished(false);
2492                    return Err(common::Error::HttpError(err));
2493                }
2494                Ok(res) => {
2495                    let (mut parts, body) = res.into_parts();
2496                    let mut body = common::Body::new(body);
2497                    if !parts.status.is_success() {
2498                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2499                        let error = serde_json::from_str(&common::to_string(&bytes));
2500                        let response = common::to_response(parts, bytes.into());
2501
2502                        if let common::Retry::After(d) =
2503                            dlg.http_failure(&response, error.as_ref().ok())
2504                        {
2505                            sleep(d).await;
2506                            continue;
2507                        }
2508
2509                        dlg.finished(false);
2510
2511                        return Err(match error {
2512                            Ok(value) => common::Error::BadRequest(value),
2513                            _ => common::Error::Failure(response),
2514                        });
2515                    }
2516                    let response = {
2517                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2518                        let encoded = common::to_string(&bytes);
2519                        match serde_json::from_str(&encoded) {
2520                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2521                            Err(error) => {
2522                                dlg.response_json_decode_error(&encoded, &error);
2523                                return Err(common::Error::JsonDecodeError(
2524                                    encoded.to_string(),
2525                                    error,
2526                                ));
2527                            }
2528                        }
2529                    };
2530
2531                    dlg.finished(true);
2532                    return Ok(response);
2533                }
2534            }
2535        }
2536    }
2537
2538    /// Required. Name of the workflow for which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
2539    ///
2540    /// Sets the *name* path property to the given value.
2541    ///
2542    /// Even though the property as already been set when instantiating this call,
2543    /// we provide this method for API completeness.
2544    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowGetCall<'a, C> {
2545        self._name = new_value.to_string();
2546        self
2547    }
2548    /// Optional. The revision of the workflow to retrieve. If the revision_id is empty, the latest revision is retrieved. The format is "000001-a4d", where the first six characters define the zero-padded decimal revision number. They are followed by a hyphen and three hexadecimal characters.
2549    ///
2550    /// Sets the *revision id* query property to the given value.
2551    pub fn revision_id(mut self, new_value: &str) -> ProjectLocationWorkflowGetCall<'a, C> {
2552        self._revision_id = Some(new_value.to_string());
2553        self
2554    }
2555    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2556    /// while executing the actual API request.
2557    ///
2558    /// ````text
2559    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2560    /// ````
2561    ///
2562    /// Sets the *delegate* property to the given value.
2563    pub fn delegate(
2564        mut self,
2565        new_value: &'a mut dyn common::Delegate,
2566    ) -> ProjectLocationWorkflowGetCall<'a, C> {
2567        self._delegate = Some(new_value);
2568        self
2569    }
2570
2571    /// Set any additional parameter of the query string used in the request.
2572    /// It should be used to set parameters which are not yet available through their own
2573    /// setters.
2574    ///
2575    /// Please note that this method must not be used to set any of the known parameters
2576    /// which have their own setter method. If done anyway, the request will fail.
2577    ///
2578    /// # Additional Parameters
2579    ///
2580    /// * *$.xgafv* (query-string) - V1 error format.
2581    /// * *access_token* (query-string) - OAuth access token.
2582    /// * *alt* (query-string) - Data format for response.
2583    /// * *callback* (query-string) - JSONP
2584    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2585    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2586    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2587    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2588    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2589    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2590    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2591    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowGetCall<'a, C>
2592    where
2593        T: AsRef<str>,
2594    {
2595        self._additional_params
2596            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2597        self
2598    }
2599
2600    /// Identifies the authorization scope for the method you are building.
2601    ///
2602    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2603    /// [`Scope::CloudPlatform`].
2604    ///
2605    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2606    /// tokens for more than one scope.
2607    ///
2608    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2609    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2610    /// sufficient, a read-write scope will do as well.
2611    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowGetCall<'a, C>
2612    where
2613        St: AsRef<str>,
2614    {
2615        self._scopes.insert(String::from(scope.as_ref()));
2616        self
2617    }
2618    /// Identifies the authorization scope(s) for the method you are building.
2619    ///
2620    /// See [`Self::add_scope()`] for details.
2621    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowGetCall<'a, C>
2622    where
2623        I: IntoIterator<Item = St>,
2624        St: AsRef<str>,
2625    {
2626        self._scopes
2627            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2628        self
2629    }
2630
2631    /// Removes all scopes, and no default scope will be used either.
2632    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2633    /// for details).
2634    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowGetCall<'a, C> {
2635        self._scopes.clear();
2636        self
2637    }
2638}
2639
2640/// Lists workflows in a given project and location. The default order is not specified.
2641///
2642/// A builder for the *locations.workflows.list* method supported by a *project* resource.
2643/// It is not used directly, but through a [`ProjectMethods`] instance.
2644///
2645/// # Example
2646///
2647/// Instantiate a resource method builder
2648///
2649/// ```test_harness,no_run
2650/// # extern crate hyper;
2651/// # extern crate hyper_rustls;
2652/// # extern crate google_workflows1 as workflows1;
2653/// # async fn dox() {
2654/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2655///
2656/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2657/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2658/// #     .with_native_roots()
2659/// #     .unwrap()
2660/// #     .https_only()
2661/// #     .enable_http2()
2662/// #     .build();
2663///
2664/// # let executor = hyper_util::rt::TokioExecutor::new();
2665/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2666/// #     secret,
2667/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2668/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2669/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2670/// #     ),
2671/// # ).build().await.unwrap();
2672///
2673/// # let client = hyper_util::client::legacy::Client::builder(
2674/// #     hyper_util::rt::TokioExecutor::new()
2675/// # )
2676/// # .build(
2677/// #     hyper_rustls::HttpsConnectorBuilder::new()
2678/// #         .with_native_roots()
2679/// #         .unwrap()
2680/// #         .https_or_http()
2681/// #         .enable_http2()
2682/// #         .build()
2683/// # );
2684/// # let mut hub = Workflows::new(client, auth);
2685/// // You can configure optional parameters by calling the respective setters at will, and
2686/// // execute the final call using `doit()`.
2687/// // Values shown here are possibly random and not representative !
2688/// let result = hub.projects().locations_workflows_list("parent")
2689///              .page_token("ipsum")
2690///              .page_size(-88)
2691///              .order_by("amet")
2692///              .filter("duo")
2693///              .doit().await;
2694/// # }
2695/// ```
2696pub struct ProjectLocationWorkflowListCall<'a, C>
2697where
2698    C: 'a,
2699{
2700    hub: &'a Workflows<C>,
2701    _parent: String,
2702    _page_token: Option<String>,
2703    _page_size: Option<i32>,
2704    _order_by: Option<String>,
2705    _filter: Option<String>,
2706    _delegate: Option<&'a mut dyn common::Delegate>,
2707    _additional_params: HashMap<String, String>,
2708    _scopes: BTreeSet<String>,
2709}
2710
2711impl<'a, C> common::CallBuilder for ProjectLocationWorkflowListCall<'a, C> {}
2712
2713impl<'a, C> ProjectLocationWorkflowListCall<'a, C>
2714where
2715    C: common::Connector,
2716{
2717    /// Perform the operation you have build so far.
2718    pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkflowsResponse)> {
2719        use std::borrow::Cow;
2720        use std::io::{Read, Seek};
2721
2722        use common::{url::Params, ToParts};
2723        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2724
2725        let mut dd = common::DefaultDelegate;
2726        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2727        dlg.begin(common::MethodInfo {
2728            id: "workflows.projects.locations.workflows.list",
2729            http_method: hyper::Method::GET,
2730        });
2731
2732        for &field in [
2733            "alt",
2734            "parent",
2735            "pageToken",
2736            "pageSize",
2737            "orderBy",
2738            "filter",
2739        ]
2740        .iter()
2741        {
2742            if self._additional_params.contains_key(field) {
2743                dlg.finished(false);
2744                return Err(common::Error::FieldClash(field));
2745            }
2746        }
2747
2748        let mut params = Params::with_capacity(7 + self._additional_params.len());
2749        params.push("parent", self._parent);
2750        if let Some(value) = self._page_token.as_ref() {
2751            params.push("pageToken", value);
2752        }
2753        if let Some(value) = self._page_size.as_ref() {
2754            params.push("pageSize", value.to_string());
2755        }
2756        if let Some(value) = self._order_by.as_ref() {
2757            params.push("orderBy", value);
2758        }
2759        if let Some(value) = self._filter.as_ref() {
2760            params.push("filter", value);
2761        }
2762
2763        params.extend(self._additional_params.iter());
2764
2765        params.push("alt", "json");
2766        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflows";
2767        if self._scopes.is_empty() {
2768            self._scopes
2769                .insert(Scope::CloudPlatform.as_ref().to_string());
2770        }
2771
2772        #[allow(clippy::single_element_loop)]
2773        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2774            url = params.uri_replacement(url, param_name, find_this, true);
2775        }
2776        {
2777            let to_remove = ["parent"];
2778            params.remove_params(&to_remove);
2779        }
2780
2781        let url = params.parse_with_url(&url);
2782
2783        loop {
2784            let token = match self
2785                .hub
2786                .auth
2787                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2788                .await
2789            {
2790                Ok(token) => token,
2791                Err(e) => match dlg.token(e) {
2792                    Ok(token) => token,
2793                    Err(e) => {
2794                        dlg.finished(false);
2795                        return Err(common::Error::MissingToken(e));
2796                    }
2797                },
2798            };
2799            let mut req_result = {
2800                let client = &self.hub.client;
2801                dlg.pre_request();
2802                let mut req_builder = hyper::Request::builder()
2803                    .method(hyper::Method::GET)
2804                    .uri(url.as_str())
2805                    .header(USER_AGENT, self.hub._user_agent.clone());
2806
2807                if let Some(token) = token.as_ref() {
2808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2809                }
2810
2811                let request = req_builder
2812                    .header(CONTENT_LENGTH, 0_u64)
2813                    .body(common::to_body::<String>(None));
2814
2815                client.request(request.unwrap()).await
2816            };
2817
2818            match req_result {
2819                Err(err) => {
2820                    if let common::Retry::After(d) = dlg.http_error(&err) {
2821                        sleep(d).await;
2822                        continue;
2823                    }
2824                    dlg.finished(false);
2825                    return Err(common::Error::HttpError(err));
2826                }
2827                Ok(res) => {
2828                    let (mut parts, body) = res.into_parts();
2829                    let mut body = common::Body::new(body);
2830                    if !parts.status.is_success() {
2831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2832                        let error = serde_json::from_str(&common::to_string(&bytes));
2833                        let response = common::to_response(parts, bytes.into());
2834
2835                        if let common::Retry::After(d) =
2836                            dlg.http_failure(&response, error.as_ref().ok())
2837                        {
2838                            sleep(d).await;
2839                            continue;
2840                        }
2841
2842                        dlg.finished(false);
2843
2844                        return Err(match error {
2845                            Ok(value) => common::Error::BadRequest(value),
2846                            _ => common::Error::Failure(response),
2847                        });
2848                    }
2849                    let response = {
2850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2851                        let encoded = common::to_string(&bytes);
2852                        match serde_json::from_str(&encoded) {
2853                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2854                            Err(error) => {
2855                                dlg.response_json_decode_error(&encoded, &error);
2856                                return Err(common::Error::JsonDecodeError(
2857                                    encoded.to_string(),
2858                                    error,
2859                                ));
2860                            }
2861                        }
2862                    };
2863
2864                    dlg.finished(true);
2865                    return Ok(response);
2866                }
2867            }
2868        }
2869    }
2870
2871    /// Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location}
2872    ///
2873    /// Sets the *parent* path property to the given value.
2874    ///
2875    /// Even though the property as already been set when instantiating this call,
2876    /// we provide this method for API completeness.
2877    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowListCall<'a, C> {
2878        self._parent = new_value.to_string();
2879        self
2880    }
2881    /// A page token, received from a previous `ListWorkflows` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListWorkflows` must match the call that provided the page token.
2882    ///
2883    /// Sets the *page token* query property to the given value.
2884    pub fn page_token(mut self, new_value: &str) -> ProjectLocationWorkflowListCall<'a, C> {
2885        self._page_token = Some(new_value.to_string());
2886        self
2887    }
2888    /// Maximum number of workflows to return per call. The service might return fewer than this value even if not at the end of the collection. If a value is not specified, a default value of 500 is used. The maximum permitted value is 1000 and values greater than 1000 are coerced down to 1000.
2889    ///
2890    /// Sets the *page size* query property to the given value.
2891    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkflowListCall<'a, C> {
2892        self._page_size = Some(new_value);
2893        self
2894    }
2895    /// Comma-separated list of fields that specify the order of the results. Default sorting order for a field is ascending. To specify descending order for a field, append a "desc" suffix. If not specified, the results are returned in an unspecified order.
2896    ///
2897    /// Sets the *order by* query property to the given value.
2898    pub fn order_by(mut self, new_value: &str) -> ProjectLocationWorkflowListCall<'a, C> {
2899        self._order_by = Some(new_value.to_string());
2900        self
2901    }
2902    /// Filter to restrict results to specific workflows. For details, see AIP-160. For example, if you are using the Google APIs Explorer: `state="SUCCEEDED"` or `createTime>"2023-08-01" AND state="FAILED"`
2903    ///
2904    /// Sets the *filter* query property to the given value.
2905    pub fn filter(mut self, new_value: &str) -> ProjectLocationWorkflowListCall<'a, C> {
2906        self._filter = Some(new_value.to_string());
2907        self
2908    }
2909    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2910    /// while executing the actual API request.
2911    ///
2912    /// ````text
2913    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2914    /// ````
2915    ///
2916    /// Sets the *delegate* property to the given value.
2917    pub fn delegate(
2918        mut self,
2919        new_value: &'a mut dyn common::Delegate,
2920    ) -> ProjectLocationWorkflowListCall<'a, C> {
2921        self._delegate = Some(new_value);
2922        self
2923    }
2924
2925    /// Set any additional parameter of the query string used in the request.
2926    /// It should be used to set parameters which are not yet available through their own
2927    /// setters.
2928    ///
2929    /// Please note that this method must not be used to set any of the known parameters
2930    /// which have their own setter method. If done anyway, the request will fail.
2931    ///
2932    /// # Additional Parameters
2933    ///
2934    /// * *$.xgafv* (query-string) - V1 error format.
2935    /// * *access_token* (query-string) - OAuth access token.
2936    /// * *alt* (query-string) - Data format for response.
2937    /// * *callback* (query-string) - JSONP
2938    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2939    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2940    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2941    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2942    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2943    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2944    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2945    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowListCall<'a, C>
2946    where
2947        T: AsRef<str>,
2948    {
2949        self._additional_params
2950            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2951        self
2952    }
2953
2954    /// Identifies the authorization scope for the method you are building.
2955    ///
2956    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2957    /// [`Scope::CloudPlatform`].
2958    ///
2959    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2960    /// tokens for more than one scope.
2961    ///
2962    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2963    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2964    /// sufficient, a read-write scope will do as well.
2965    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowListCall<'a, C>
2966    where
2967        St: AsRef<str>,
2968    {
2969        self._scopes.insert(String::from(scope.as_ref()));
2970        self
2971    }
2972    /// Identifies the authorization scope(s) for the method you are building.
2973    ///
2974    /// See [`Self::add_scope()`] for details.
2975    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowListCall<'a, C>
2976    where
2977        I: IntoIterator<Item = St>,
2978        St: AsRef<str>,
2979    {
2980        self._scopes
2981            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2982        self
2983    }
2984
2985    /// Removes all scopes, and no default scope will be used either.
2986    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2987    /// for details).
2988    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowListCall<'a, C> {
2989        self._scopes.clear();
2990        self
2991    }
2992}
2993
2994/// Lists revisions for a given workflow.
2995///
2996/// A builder for the *locations.workflows.listRevisions* method supported by a *project* resource.
2997/// It is not used directly, but through a [`ProjectMethods`] instance.
2998///
2999/// # Example
3000///
3001/// Instantiate a resource method builder
3002///
3003/// ```test_harness,no_run
3004/// # extern crate hyper;
3005/// # extern crate hyper_rustls;
3006/// # extern crate google_workflows1 as workflows1;
3007/// # async fn dox() {
3008/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3009///
3010/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3011/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3012/// #     .with_native_roots()
3013/// #     .unwrap()
3014/// #     .https_only()
3015/// #     .enable_http2()
3016/// #     .build();
3017///
3018/// # let executor = hyper_util::rt::TokioExecutor::new();
3019/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3020/// #     secret,
3021/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3022/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3023/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3024/// #     ),
3025/// # ).build().await.unwrap();
3026///
3027/// # let client = hyper_util::client::legacy::Client::builder(
3028/// #     hyper_util::rt::TokioExecutor::new()
3029/// # )
3030/// # .build(
3031/// #     hyper_rustls::HttpsConnectorBuilder::new()
3032/// #         .with_native_roots()
3033/// #         .unwrap()
3034/// #         .https_or_http()
3035/// #         .enable_http2()
3036/// #         .build()
3037/// # );
3038/// # let mut hub = Workflows::new(client, auth);
3039/// // You can configure optional parameters by calling the respective setters at will, and
3040/// // execute the final call using `doit()`.
3041/// // Values shown here are possibly random and not representative !
3042/// let result = hub.projects().locations_workflows_list_revisions("name")
3043///              .page_token("sed")
3044///              .page_size(-37)
3045///              .doit().await;
3046/// # }
3047/// ```
3048pub struct ProjectLocationWorkflowListRevisionCall<'a, C>
3049where
3050    C: 'a,
3051{
3052    hub: &'a Workflows<C>,
3053    _name: String,
3054    _page_token: Option<String>,
3055    _page_size: Option<i32>,
3056    _delegate: Option<&'a mut dyn common::Delegate>,
3057    _additional_params: HashMap<String, String>,
3058    _scopes: BTreeSet<String>,
3059}
3060
3061impl<'a, C> common::CallBuilder for ProjectLocationWorkflowListRevisionCall<'a, C> {}
3062
3063impl<'a, C> ProjectLocationWorkflowListRevisionCall<'a, C>
3064where
3065    C: common::Connector,
3066{
3067    /// Perform the operation you have build so far.
3068    pub async fn doit(
3069        mut self,
3070    ) -> common::Result<(common::Response, ListWorkflowRevisionsResponse)> {
3071        use std::borrow::Cow;
3072        use std::io::{Read, Seek};
3073
3074        use common::{url::Params, ToParts};
3075        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3076
3077        let mut dd = common::DefaultDelegate;
3078        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3079        dlg.begin(common::MethodInfo {
3080            id: "workflows.projects.locations.workflows.listRevisions",
3081            http_method: hyper::Method::GET,
3082        });
3083
3084        for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
3085            if self._additional_params.contains_key(field) {
3086                dlg.finished(false);
3087                return Err(common::Error::FieldClash(field));
3088            }
3089        }
3090
3091        let mut params = Params::with_capacity(5 + self._additional_params.len());
3092        params.push("name", self._name);
3093        if let Some(value) = self._page_token.as_ref() {
3094            params.push("pageToken", value);
3095        }
3096        if let Some(value) = self._page_size.as_ref() {
3097            params.push("pageSize", value.to_string());
3098        }
3099
3100        params.extend(self._additional_params.iter());
3101
3102        params.push("alt", "json");
3103        let mut url = self.hub._base_url.clone() + "v1/{+name}:listRevisions";
3104        if self._scopes.is_empty() {
3105            self._scopes
3106                .insert(Scope::CloudPlatform.as_ref().to_string());
3107        }
3108
3109        #[allow(clippy::single_element_loop)]
3110        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3111            url = params.uri_replacement(url, param_name, find_this, true);
3112        }
3113        {
3114            let to_remove = ["name"];
3115            params.remove_params(&to_remove);
3116        }
3117
3118        let url = params.parse_with_url(&url);
3119
3120        loop {
3121            let token = match self
3122                .hub
3123                .auth
3124                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3125                .await
3126            {
3127                Ok(token) => token,
3128                Err(e) => match dlg.token(e) {
3129                    Ok(token) => token,
3130                    Err(e) => {
3131                        dlg.finished(false);
3132                        return Err(common::Error::MissingToken(e));
3133                    }
3134                },
3135            };
3136            let mut req_result = {
3137                let client = &self.hub.client;
3138                dlg.pre_request();
3139                let mut req_builder = hyper::Request::builder()
3140                    .method(hyper::Method::GET)
3141                    .uri(url.as_str())
3142                    .header(USER_AGENT, self.hub._user_agent.clone());
3143
3144                if let Some(token) = token.as_ref() {
3145                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3146                }
3147
3148                let request = req_builder
3149                    .header(CONTENT_LENGTH, 0_u64)
3150                    .body(common::to_body::<String>(None));
3151
3152                client.request(request.unwrap()).await
3153            };
3154
3155            match req_result {
3156                Err(err) => {
3157                    if let common::Retry::After(d) = dlg.http_error(&err) {
3158                        sleep(d).await;
3159                        continue;
3160                    }
3161                    dlg.finished(false);
3162                    return Err(common::Error::HttpError(err));
3163                }
3164                Ok(res) => {
3165                    let (mut parts, body) = res.into_parts();
3166                    let mut body = common::Body::new(body);
3167                    if !parts.status.is_success() {
3168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3169                        let error = serde_json::from_str(&common::to_string(&bytes));
3170                        let response = common::to_response(parts, bytes.into());
3171
3172                        if let common::Retry::After(d) =
3173                            dlg.http_failure(&response, error.as_ref().ok())
3174                        {
3175                            sleep(d).await;
3176                            continue;
3177                        }
3178
3179                        dlg.finished(false);
3180
3181                        return Err(match error {
3182                            Ok(value) => common::Error::BadRequest(value),
3183                            _ => common::Error::Failure(response),
3184                        });
3185                    }
3186                    let response = {
3187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3188                        let encoded = common::to_string(&bytes);
3189                        match serde_json::from_str(&encoded) {
3190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3191                            Err(error) => {
3192                                dlg.response_json_decode_error(&encoded, &error);
3193                                return Err(common::Error::JsonDecodeError(
3194                                    encoded.to_string(),
3195                                    error,
3196                                ));
3197                            }
3198                        }
3199                    };
3200
3201                    dlg.finished(true);
3202                    return Ok(response);
3203                }
3204            }
3205        }
3206    }
3207
3208    /// Required. Workflow for which the revisions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}
3209    ///
3210    /// Sets the *name* path property to the given value.
3211    ///
3212    /// Even though the property as already been set when instantiating this call,
3213    /// we provide this method for API completeness.
3214    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
3215        self._name = new_value.to_string();
3216        self
3217    }
3218    /// The page token, received from a previous ListWorkflowRevisions call. Provide this to retrieve the subsequent page.
3219    ///
3220    /// Sets the *page token* query property to the given value.
3221    pub fn page_token(mut self, new_value: &str) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
3222        self._page_token = Some(new_value.to_string());
3223        self
3224    }
3225    /// The maximum number of revisions to return per page. If a value is not specified, a default value of 20 is used. The maximum permitted value is 100. Values greater than 100 are coerced down to 100.
3226    ///
3227    /// Sets the *page size* query property to the given value.
3228    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
3229        self._page_size = Some(new_value);
3230        self
3231    }
3232    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3233    /// while executing the actual API request.
3234    ///
3235    /// ````text
3236    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3237    /// ````
3238    ///
3239    /// Sets the *delegate* property to the given value.
3240    pub fn delegate(
3241        mut self,
3242        new_value: &'a mut dyn common::Delegate,
3243    ) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
3244        self._delegate = Some(new_value);
3245        self
3246    }
3247
3248    /// Set any additional parameter of the query string used in the request.
3249    /// It should be used to set parameters which are not yet available through their own
3250    /// setters.
3251    ///
3252    /// Please note that this method must not be used to set any of the known parameters
3253    /// which have their own setter method. If done anyway, the request will fail.
3254    ///
3255    /// # Additional Parameters
3256    ///
3257    /// * *$.xgafv* (query-string) - V1 error format.
3258    /// * *access_token* (query-string) - OAuth access token.
3259    /// * *alt* (query-string) - Data format for response.
3260    /// * *callback* (query-string) - JSONP
3261    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3262    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3263    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3264    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3265    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3266    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3267    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3268    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowListRevisionCall<'a, C>
3269    where
3270        T: AsRef<str>,
3271    {
3272        self._additional_params
3273            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3274        self
3275    }
3276
3277    /// Identifies the authorization scope for the method you are building.
3278    ///
3279    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3280    /// [`Scope::CloudPlatform`].
3281    ///
3282    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3283    /// tokens for more than one scope.
3284    ///
3285    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3286    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3287    /// sufficient, a read-write scope will do as well.
3288    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowListRevisionCall<'a, C>
3289    where
3290        St: AsRef<str>,
3291    {
3292        self._scopes.insert(String::from(scope.as_ref()));
3293        self
3294    }
3295    /// Identifies the authorization scope(s) for the method you are building.
3296    ///
3297    /// See [`Self::add_scope()`] for details.
3298    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowListRevisionCall<'a, C>
3299    where
3300        I: IntoIterator<Item = St>,
3301        St: AsRef<str>,
3302    {
3303        self._scopes
3304            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3305        self
3306    }
3307
3308    /// Removes all scopes, and no default scope will be used either.
3309    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3310    /// for details).
3311    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowListRevisionCall<'a, C> {
3312        self._scopes.clear();
3313        self
3314    }
3315}
3316
3317/// Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.
3318///
3319/// A builder for the *locations.workflows.patch* method supported by a *project* resource.
3320/// It is not used directly, but through a [`ProjectMethods`] instance.
3321///
3322/// # Example
3323///
3324/// Instantiate a resource method builder
3325///
3326/// ```test_harness,no_run
3327/// # extern crate hyper;
3328/// # extern crate hyper_rustls;
3329/// # extern crate google_workflows1 as workflows1;
3330/// use workflows1::api::Workflow;
3331/// # async fn dox() {
3332/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3333///
3334/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3335/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3336/// #     .with_native_roots()
3337/// #     .unwrap()
3338/// #     .https_only()
3339/// #     .enable_http2()
3340/// #     .build();
3341///
3342/// # let executor = hyper_util::rt::TokioExecutor::new();
3343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3344/// #     secret,
3345/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3346/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3347/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3348/// #     ),
3349/// # ).build().await.unwrap();
3350///
3351/// # let client = hyper_util::client::legacy::Client::builder(
3352/// #     hyper_util::rt::TokioExecutor::new()
3353/// # )
3354/// # .build(
3355/// #     hyper_rustls::HttpsConnectorBuilder::new()
3356/// #         .with_native_roots()
3357/// #         .unwrap()
3358/// #         .https_or_http()
3359/// #         .enable_http2()
3360/// #         .build()
3361/// # );
3362/// # let mut hub = Workflows::new(client, auth);
3363/// // As the method needs a request, you would usually fill it with the desired information
3364/// // into the respective structure. Some of the parts shown here might not be applicable !
3365/// // Values shown here are possibly random and not representative !
3366/// let mut req = Workflow::default();
3367///
3368/// // You can configure optional parameters by calling the respective setters at will, and
3369/// // execute the final call using `doit()`.
3370/// // Values shown here are possibly random and not representative !
3371/// let result = hub.projects().locations_workflows_patch(req, "name")
3372///              .update_mask(FieldMask::new::<&str>(&[]))
3373///              .doit().await;
3374/// # }
3375/// ```
3376pub struct ProjectLocationWorkflowPatchCall<'a, C>
3377where
3378    C: 'a,
3379{
3380    hub: &'a Workflows<C>,
3381    _request: Workflow,
3382    _name: String,
3383    _update_mask: Option<common::FieldMask>,
3384    _delegate: Option<&'a mut dyn common::Delegate>,
3385    _additional_params: HashMap<String, String>,
3386    _scopes: BTreeSet<String>,
3387}
3388
3389impl<'a, C> common::CallBuilder for ProjectLocationWorkflowPatchCall<'a, C> {}
3390
3391impl<'a, C> ProjectLocationWorkflowPatchCall<'a, C>
3392where
3393    C: common::Connector,
3394{
3395    /// Perform the operation you have build so far.
3396    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3397        use std::borrow::Cow;
3398        use std::io::{Read, Seek};
3399
3400        use common::{url::Params, ToParts};
3401        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3402
3403        let mut dd = common::DefaultDelegate;
3404        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3405        dlg.begin(common::MethodInfo {
3406            id: "workflows.projects.locations.workflows.patch",
3407            http_method: hyper::Method::PATCH,
3408        });
3409
3410        for &field in ["alt", "name", "updateMask"].iter() {
3411            if self._additional_params.contains_key(field) {
3412                dlg.finished(false);
3413                return Err(common::Error::FieldClash(field));
3414            }
3415        }
3416
3417        let mut params = Params::with_capacity(5 + self._additional_params.len());
3418        params.push("name", self._name);
3419        if let Some(value) = self._update_mask.as_ref() {
3420            params.push("updateMask", value.to_string());
3421        }
3422
3423        params.extend(self._additional_params.iter());
3424
3425        params.push("alt", "json");
3426        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3427        if self._scopes.is_empty() {
3428            self._scopes
3429                .insert(Scope::CloudPlatform.as_ref().to_string());
3430        }
3431
3432        #[allow(clippy::single_element_loop)]
3433        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3434            url = params.uri_replacement(url, param_name, find_this, true);
3435        }
3436        {
3437            let to_remove = ["name"];
3438            params.remove_params(&to_remove);
3439        }
3440
3441        let url = params.parse_with_url(&url);
3442
3443        let mut json_mime_type = mime::APPLICATION_JSON;
3444        let mut request_value_reader = {
3445            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3446            common::remove_json_null_values(&mut value);
3447            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3448            serde_json::to_writer(&mut dst, &value).unwrap();
3449            dst
3450        };
3451        let request_size = request_value_reader
3452            .seek(std::io::SeekFrom::End(0))
3453            .unwrap();
3454        request_value_reader
3455            .seek(std::io::SeekFrom::Start(0))
3456            .unwrap();
3457
3458        loop {
3459            let token = match self
3460                .hub
3461                .auth
3462                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3463                .await
3464            {
3465                Ok(token) => token,
3466                Err(e) => match dlg.token(e) {
3467                    Ok(token) => token,
3468                    Err(e) => {
3469                        dlg.finished(false);
3470                        return Err(common::Error::MissingToken(e));
3471                    }
3472                },
3473            };
3474            request_value_reader
3475                .seek(std::io::SeekFrom::Start(0))
3476                .unwrap();
3477            let mut req_result = {
3478                let client = &self.hub.client;
3479                dlg.pre_request();
3480                let mut req_builder = hyper::Request::builder()
3481                    .method(hyper::Method::PATCH)
3482                    .uri(url.as_str())
3483                    .header(USER_AGENT, self.hub._user_agent.clone());
3484
3485                if let Some(token) = token.as_ref() {
3486                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3487                }
3488
3489                let request = req_builder
3490                    .header(CONTENT_TYPE, json_mime_type.to_string())
3491                    .header(CONTENT_LENGTH, request_size as u64)
3492                    .body(common::to_body(
3493                        request_value_reader.get_ref().clone().into(),
3494                    ));
3495
3496                client.request(request.unwrap()).await
3497            };
3498
3499            match req_result {
3500                Err(err) => {
3501                    if let common::Retry::After(d) = dlg.http_error(&err) {
3502                        sleep(d).await;
3503                        continue;
3504                    }
3505                    dlg.finished(false);
3506                    return Err(common::Error::HttpError(err));
3507                }
3508                Ok(res) => {
3509                    let (mut parts, body) = res.into_parts();
3510                    let mut body = common::Body::new(body);
3511                    if !parts.status.is_success() {
3512                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3513                        let error = serde_json::from_str(&common::to_string(&bytes));
3514                        let response = common::to_response(parts, bytes.into());
3515
3516                        if let common::Retry::After(d) =
3517                            dlg.http_failure(&response, error.as_ref().ok())
3518                        {
3519                            sleep(d).await;
3520                            continue;
3521                        }
3522
3523                        dlg.finished(false);
3524
3525                        return Err(match error {
3526                            Ok(value) => common::Error::BadRequest(value),
3527                            _ => common::Error::Failure(response),
3528                        });
3529                    }
3530                    let response = {
3531                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3532                        let encoded = common::to_string(&bytes);
3533                        match serde_json::from_str(&encoded) {
3534                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3535                            Err(error) => {
3536                                dlg.response_json_decode_error(&encoded, &error);
3537                                return Err(common::Error::JsonDecodeError(
3538                                    encoded.to_string(),
3539                                    error,
3540                                ));
3541                            }
3542                        }
3543                    };
3544
3545                    dlg.finished(true);
3546                    return Ok(response);
3547                }
3548            }
3549        }
3550    }
3551
3552    ///
3553    /// Sets the *request* property to the given value.
3554    ///
3555    /// Even though the property as already been set when instantiating this call,
3556    /// we provide this method for API completeness.
3557    pub fn request(mut self, new_value: Workflow) -> ProjectLocationWorkflowPatchCall<'a, C> {
3558        self._request = new_value;
3559        self
3560    }
3561    /// The resource name of the workflow. Format: projects/{project}/locations/{location}/workflows/{workflow}. This is a workflow-wide field and is not tied to a specific revision.
3562    ///
3563    /// Sets the *name* path property to the given value.
3564    ///
3565    /// Even though the property as already been set when instantiating this call,
3566    /// we provide this method for API completeness.
3567    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowPatchCall<'a, C> {
3568        self._name = new_value.to_string();
3569        self
3570    }
3571    /// List of fields to be updated. If not present, the entire workflow will be updated.
3572    ///
3573    /// Sets the *update mask* query property to the given value.
3574    pub fn update_mask(
3575        mut self,
3576        new_value: common::FieldMask,
3577    ) -> ProjectLocationWorkflowPatchCall<'a, C> {
3578        self._update_mask = Some(new_value);
3579        self
3580    }
3581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3582    /// while executing the actual API request.
3583    ///
3584    /// ````text
3585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3586    /// ````
3587    ///
3588    /// Sets the *delegate* property to the given value.
3589    pub fn delegate(
3590        mut self,
3591        new_value: &'a mut dyn common::Delegate,
3592    ) -> ProjectLocationWorkflowPatchCall<'a, C> {
3593        self._delegate = Some(new_value);
3594        self
3595    }
3596
3597    /// Set any additional parameter of the query string used in the request.
3598    /// It should be used to set parameters which are not yet available through their own
3599    /// setters.
3600    ///
3601    /// Please note that this method must not be used to set any of the known parameters
3602    /// which have their own setter method. If done anyway, the request will fail.
3603    ///
3604    /// # Additional Parameters
3605    ///
3606    /// * *$.xgafv* (query-string) - V1 error format.
3607    /// * *access_token* (query-string) - OAuth access token.
3608    /// * *alt* (query-string) - Data format for response.
3609    /// * *callback* (query-string) - JSONP
3610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3611    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3614    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3617    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowPatchCall<'a, C>
3618    where
3619        T: AsRef<str>,
3620    {
3621        self._additional_params
3622            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3623        self
3624    }
3625
3626    /// Identifies the authorization scope for the method you are building.
3627    ///
3628    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3629    /// [`Scope::CloudPlatform`].
3630    ///
3631    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3632    /// tokens for more than one scope.
3633    ///
3634    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3635    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3636    /// sufficient, a read-write scope will do as well.
3637    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowPatchCall<'a, C>
3638    where
3639        St: AsRef<str>,
3640    {
3641        self._scopes.insert(String::from(scope.as_ref()));
3642        self
3643    }
3644    /// Identifies the authorization scope(s) for the method you are building.
3645    ///
3646    /// See [`Self::add_scope()`] for details.
3647    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowPatchCall<'a, C>
3648    where
3649        I: IntoIterator<Item = St>,
3650        St: AsRef<str>,
3651    {
3652        self._scopes
3653            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3654        self
3655    }
3656
3657    /// Removes all scopes, and no default scope will be used either.
3658    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3659    /// for details).
3660    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowPatchCall<'a, C> {
3661        self._scopes.clear();
3662        self
3663    }
3664}
3665
3666/// Gets information about a location.
3667///
3668/// A builder for the *locations.get* method supported by a *project* resource.
3669/// It is not used directly, but through a [`ProjectMethods`] instance.
3670///
3671/// # Example
3672///
3673/// Instantiate a resource method builder
3674///
3675/// ```test_harness,no_run
3676/// # extern crate hyper;
3677/// # extern crate hyper_rustls;
3678/// # extern crate google_workflows1 as workflows1;
3679/// # async fn dox() {
3680/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3681///
3682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3683/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3684/// #     .with_native_roots()
3685/// #     .unwrap()
3686/// #     .https_only()
3687/// #     .enable_http2()
3688/// #     .build();
3689///
3690/// # let executor = hyper_util::rt::TokioExecutor::new();
3691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3692/// #     secret,
3693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3694/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3695/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3696/// #     ),
3697/// # ).build().await.unwrap();
3698///
3699/// # let client = hyper_util::client::legacy::Client::builder(
3700/// #     hyper_util::rt::TokioExecutor::new()
3701/// # )
3702/// # .build(
3703/// #     hyper_rustls::HttpsConnectorBuilder::new()
3704/// #         .with_native_roots()
3705/// #         .unwrap()
3706/// #         .https_or_http()
3707/// #         .enable_http2()
3708/// #         .build()
3709/// # );
3710/// # let mut hub = Workflows::new(client, auth);
3711/// // You can configure optional parameters by calling the respective setters at will, and
3712/// // execute the final call using `doit()`.
3713/// // Values shown here are possibly random and not representative !
3714/// let result = hub.projects().locations_get("name")
3715///              .doit().await;
3716/// # }
3717/// ```
3718pub struct ProjectLocationGetCall<'a, C>
3719where
3720    C: 'a,
3721{
3722    hub: &'a Workflows<C>,
3723    _name: String,
3724    _delegate: Option<&'a mut dyn common::Delegate>,
3725    _additional_params: HashMap<String, String>,
3726    _scopes: BTreeSet<String>,
3727}
3728
3729impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
3730
3731impl<'a, C> ProjectLocationGetCall<'a, C>
3732where
3733    C: common::Connector,
3734{
3735    /// Perform the operation you have build so far.
3736    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
3737        use std::borrow::Cow;
3738        use std::io::{Read, Seek};
3739
3740        use common::{url::Params, ToParts};
3741        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3742
3743        let mut dd = common::DefaultDelegate;
3744        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3745        dlg.begin(common::MethodInfo {
3746            id: "workflows.projects.locations.get",
3747            http_method: hyper::Method::GET,
3748        });
3749
3750        for &field in ["alt", "name"].iter() {
3751            if self._additional_params.contains_key(field) {
3752                dlg.finished(false);
3753                return Err(common::Error::FieldClash(field));
3754            }
3755        }
3756
3757        let mut params = Params::with_capacity(3 + self._additional_params.len());
3758        params.push("name", self._name);
3759
3760        params.extend(self._additional_params.iter());
3761
3762        params.push("alt", "json");
3763        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3764        if self._scopes.is_empty() {
3765            self._scopes
3766                .insert(Scope::CloudPlatform.as_ref().to_string());
3767        }
3768
3769        #[allow(clippy::single_element_loop)]
3770        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3771            url = params.uri_replacement(url, param_name, find_this, true);
3772        }
3773        {
3774            let to_remove = ["name"];
3775            params.remove_params(&to_remove);
3776        }
3777
3778        let url = params.parse_with_url(&url);
3779
3780        loop {
3781            let token = match self
3782                .hub
3783                .auth
3784                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3785                .await
3786            {
3787                Ok(token) => token,
3788                Err(e) => match dlg.token(e) {
3789                    Ok(token) => token,
3790                    Err(e) => {
3791                        dlg.finished(false);
3792                        return Err(common::Error::MissingToken(e));
3793                    }
3794                },
3795            };
3796            let mut req_result = {
3797                let client = &self.hub.client;
3798                dlg.pre_request();
3799                let mut req_builder = hyper::Request::builder()
3800                    .method(hyper::Method::GET)
3801                    .uri(url.as_str())
3802                    .header(USER_AGENT, self.hub._user_agent.clone());
3803
3804                if let Some(token) = token.as_ref() {
3805                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3806                }
3807
3808                let request = req_builder
3809                    .header(CONTENT_LENGTH, 0_u64)
3810                    .body(common::to_body::<String>(None));
3811
3812                client.request(request.unwrap()).await
3813            };
3814
3815            match req_result {
3816                Err(err) => {
3817                    if let common::Retry::After(d) = dlg.http_error(&err) {
3818                        sleep(d).await;
3819                        continue;
3820                    }
3821                    dlg.finished(false);
3822                    return Err(common::Error::HttpError(err));
3823                }
3824                Ok(res) => {
3825                    let (mut parts, body) = res.into_parts();
3826                    let mut body = common::Body::new(body);
3827                    if !parts.status.is_success() {
3828                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3829                        let error = serde_json::from_str(&common::to_string(&bytes));
3830                        let response = common::to_response(parts, bytes.into());
3831
3832                        if let common::Retry::After(d) =
3833                            dlg.http_failure(&response, error.as_ref().ok())
3834                        {
3835                            sleep(d).await;
3836                            continue;
3837                        }
3838
3839                        dlg.finished(false);
3840
3841                        return Err(match error {
3842                            Ok(value) => common::Error::BadRequest(value),
3843                            _ => common::Error::Failure(response),
3844                        });
3845                    }
3846                    let response = {
3847                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3848                        let encoded = common::to_string(&bytes);
3849                        match serde_json::from_str(&encoded) {
3850                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3851                            Err(error) => {
3852                                dlg.response_json_decode_error(&encoded, &error);
3853                                return Err(common::Error::JsonDecodeError(
3854                                    encoded.to_string(),
3855                                    error,
3856                                ));
3857                            }
3858                        }
3859                    };
3860
3861                    dlg.finished(true);
3862                    return Ok(response);
3863                }
3864            }
3865        }
3866    }
3867
3868    /// Resource name for the location.
3869    ///
3870    /// Sets the *name* path property to the given value.
3871    ///
3872    /// Even though the property as already been set when instantiating this call,
3873    /// we provide this method for API completeness.
3874    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
3875        self._name = new_value.to_string();
3876        self
3877    }
3878    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3879    /// while executing the actual API request.
3880    ///
3881    /// ````text
3882    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3883    /// ````
3884    ///
3885    /// Sets the *delegate* property to the given value.
3886    pub fn delegate(
3887        mut self,
3888        new_value: &'a mut dyn common::Delegate,
3889    ) -> ProjectLocationGetCall<'a, C> {
3890        self._delegate = Some(new_value);
3891        self
3892    }
3893
3894    /// Set any additional parameter of the query string used in the request.
3895    /// It should be used to set parameters which are not yet available through their own
3896    /// setters.
3897    ///
3898    /// Please note that this method must not be used to set any of the known parameters
3899    /// which have their own setter method. If done anyway, the request will fail.
3900    ///
3901    /// # Additional Parameters
3902    ///
3903    /// * *$.xgafv* (query-string) - V1 error format.
3904    /// * *access_token* (query-string) - OAuth access token.
3905    /// * *alt* (query-string) - Data format for response.
3906    /// * *callback* (query-string) - JSONP
3907    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3908    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3909    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3910    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3911    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3912    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3913    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3914    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
3915    where
3916        T: AsRef<str>,
3917    {
3918        self._additional_params
3919            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3920        self
3921    }
3922
3923    /// Identifies the authorization scope for the method you are building.
3924    ///
3925    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3926    /// [`Scope::CloudPlatform`].
3927    ///
3928    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3929    /// tokens for more than one scope.
3930    ///
3931    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3932    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3933    /// sufficient, a read-write scope will do as well.
3934    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
3935    where
3936        St: AsRef<str>,
3937    {
3938        self._scopes.insert(String::from(scope.as_ref()));
3939        self
3940    }
3941    /// Identifies the authorization scope(s) for the method you are building.
3942    ///
3943    /// See [`Self::add_scope()`] for details.
3944    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
3945    where
3946        I: IntoIterator<Item = St>,
3947        St: AsRef<str>,
3948    {
3949        self._scopes
3950            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3951        self
3952    }
3953
3954    /// Removes all scopes, and no default scope will be used either.
3955    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3956    /// for details).
3957    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
3958        self._scopes.clear();
3959        self
3960    }
3961}
3962
3963/// Lists information about the supported locations for this service.
3964///
3965/// A builder for the *locations.list* method supported by a *project* resource.
3966/// It is not used directly, but through a [`ProjectMethods`] instance.
3967///
3968/// # Example
3969///
3970/// Instantiate a resource method builder
3971///
3972/// ```test_harness,no_run
3973/// # extern crate hyper;
3974/// # extern crate hyper_rustls;
3975/// # extern crate google_workflows1 as workflows1;
3976/// # async fn dox() {
3977/// # use workflows1::{Workflows, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3978///
3979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3980/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3981/// #     .with_native_roots()
3982/// #     .unwrap()
3983/// #     .https_only()
3984/// #     .enable_http2()
3985/// #     .build();
3986///
3987/// # let executor = hyper_util::rt::TokioExecutor::new();
3988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3989/// #     secret,
3990/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3991/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3992/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3993/// #     ),
3994/// # ).build().await.unwrap();
3995///
3996/// # let client = hyper_util::client::legacy::Client::builder(
3997/// #     hyper_util::rt::TokioExecutor::new()
3998/// # )
3999/// # .build(
4000/// #     hyper_rustls::HttpsConnectorBuilder::new()
4001/// #         .with_native_roots()
4002/// #         .unwrap()
4003/// #         .https_or_http()
4004/// #         .enable_http2()
4005/// #         .build()
4006/// # );
4007/// # let mut hub = Workflows::new(client, auth);
4008/// // You can configure optional parameters by calling the respective setters at will, and
4009/// // execute the final call using `doit()`.
4010/// // Values shown here are possibly random and not representative !
4011/// let result = hub.projects().locations_list("name")
4012///              .page_token("ipsum")
4013///              .page_size(-50)
4014///              .filter("est")
4015///              .add_extra_location_types("gubergren")
4016///              .doit().await;
4017/// # }
4018/// ```
4019pub struct ProjectLocationListCall<'a, C>
4020where
4021    C: 'a,
4022{
4023    hub: &'a Workflows<C>,
4024    _name: String,
4025    _page_token: Option<String>,
4026    _page_size: Option<i32>,
4027    _filter: Option<String>,
4028    _extra_location_types: Vec<String>,
4029    _delegate: Option<&'a mut dyn common::Delegate>,
4030    _additional_params: HashMap<String, String>,
4031    _scopes: BTreeSet<String>,
4032}
4033
4034impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
4035
4036impl<'a, C> ProjectLocationListCall<'a, C>
4037where
4038    C: common::Connector,
4039{
4040    /// Perform the operation you have build so far.
4041    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
4042        use std::borrow::Cow;
4043        use std::io::{Read, Seek};
4044
4045        use common::{url::Params, ToParts};
4046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4047
4048        let mut dd = common::DefaultDelegate;
4049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4050        dlg.begin(common::MethodInfo {
4051            id: "workflows.projects.locations.list",
4052            http_method: hyper::Method::GET,
4053        });
4054
4055        for &field in [
4056            "alt",
4057            "name",
4058            "pageToken",
4059            "pageSize",
4060            "filter",
4061            "extraLocationTypes",
4062        ]
4063        .iter()
4064        {
4065            if self._additional_params.contains_key(field) {
4066                dlg.finished(false);
4067                return Err(common::Error::FieldClash(field));
4068            }
4069        }
4070
4071        let mut params = Params::with_capacity(7 + self._additional_params.len());
4072        params.push("name", self._name);
4073        if let Some(value) = self._page_token.as_ref() {
4074            params.push("pageToken", value);
4075        }
4076        if let Some(value) = self._page_size.as_ref() {
4077            params.push("pageSize", value.to_string());
4078        }
4079        if let Some(value) = self._filter.as_ref() {
4080            params.push("filter", value);
4081        }
4082        if !self._extra_location_types.is_empty() {
4083            for f in self._extra_location_types.iter() {
4084                params.push("extraLocationTypes", f);
4085            }
4086        }
4087
4088        params.extend(self._additional_params.iter());
4089
4090        params.push("alt", "json");
4091        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
4092        if self._scopes.is_empty() {
4093            self._scopes
4094                .insert(Scope::CloudPlatform.as_ref().to_string());
4095        }
4096
4097        #[allow(clippy::single_element_loop)]
4098        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4099            url = params.uri_replacement(url, param_name, find_this, true);
4100        }
4101        {
4102            let to_remove = ["name"];
4103            params.remove_params(&to_remove);
4104        }
4105
4106        let url = params.parse_with_url(&url);
4107
4108        loop {
4109            let token = match self
4110                .hub
4111                .auth
4112                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4113                .await
4114            {
4115                Ok(token) => token,
4116                Err(e) => match dlg.token(e) {
4117                    Ok(token) => token,
4118                    Err(e) => {
4119                        dlg.finished(false);
4120                        return Err(common::Error::MissingToken(e));
4121                    }
4122                },
4123            };
4124            let mut req_result = {
4125                let client = &self.hub.client;
4126                dlg.pre_request();
4127                let mut req_builder = hyper::Request::builder()
4128                    .method(hyper::Method::GET)
4129                    .uri(url.as_str())
4130                    .header(USER_AGENT, self.hub._user_agent.clone());
4131
4132                if let Some(token) = token.as_ref() {
4133                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4134                }
4135
4136                let request = req_builder
4137                    .header(CONTENT_LENGTH, 0_u64)
4138                    .body(common::to_body::<String>(None));
4139
4140                client.request(request.unwrap()).await
4141            };
4142
4143            match req_result {
4144                Err(err) => {
4145                    if let common::Retry::After(d) = dlg.http_error(&err) {
4146                        sleep(d).await;
4147                        continue;
4148                    }
4149                    dlg.finished(false);
4150                    return Err(common::Error::HttpError(err));
4151                }
4152                Ok(res) => {
4153                    let (mut parts, body) = res.into_parts();
4154                    let mut body = common::Body::new(body);
4155                    if !parts.status.is_success() {
4156                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4157                        let error = serde_json::from_str(&common::to_string(&bytes));
4158                        let response = common::to_response(parts, bytes.into());
4159
4160                        if let common::Retry::After(d) =
4161                            dlg.http_failure(&response, error.as_ref().ok())
4162                        {
4163                            sleep(d).await;
4164                            continue;
4165                        }
4166
4167                        dlg.finished(false);
4168
4169                        return Err(match error {
4170                            Ok(value) => common::Error::BadRequest(value),
4171                            _ => common::Error::Failure(response),
4172                        });
4173                    }
4174                    let response = {
4175                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4176                        let encoded = common::to_string(&bytes);
4177                        match serde_json::from_str(&encoded) {
4178                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4179                            Err(error) => {
4180                                dlg.response_json_decode_error(&encoded, &error);
4181                                return Err(common::Error::JsonDecodeError(
4182                                    encoded.to_string(),
4183                                    error,
4184                                ));
4185                            }
4186                        }
4187                    };
4188
4189                    dlg.finished(true);
4190                    return Ok(response);
4191                }
4192            }
4193        }
4194    }
4195
4196    /// The resource that owns the locations collection, if applicable.
4197    ///
4198    /// Sets the *name* path property to the given value.
4199    ///
4200    /// Even though the property as already been set when instantiating this call,
4201    /// we provide this method for API completeness.
4202    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
4203        self._name = new_value.to_string();
4204        self
4205    }
4206    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
4207    ///
4208    /// Sets the *page token* query property to the given value.
4209    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
4210        self._page_token = Some(new_value.to_string());
4211        self
4212    }
4213    /// The maximum number of results to return. If not set, the service selects a default.
4214    ///
4215    /// Sets the *page size* query property to the given value.
4216    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
4217        self._page_size = Some(new_value);
4218        self
4219    }
4220    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
4221    ///
4222    /// Sets the *filter* query property to the given value.
4223    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
4224        self._filter = Some(new_value.to_string());
4225        self
4226    }
4227    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
4228    ///
4229    /// Append the given value to the *extra location types* query property.
4230    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4231    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
4232        self._extra_location_types.push(new_value.to_string());
4233        self
4234    }
4235    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4236    /// while executing the actual API request.
4237    ///
4238    /// ````text
4239    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4240    /// ````
4241    ///
4242    /// Sets the *delegate* property to the given value.
4243    pub fn delegate(
4244        mut self,
4245        new_value: &'a mut dyn common::Delegate,
4246    ) -> ProjectLocationListCall<'a, C> {
4247        self._delegate = Some(new_value);
4248        self
4249    }
4250
4251    /// Set any additional parameter of the query string used in the request.
4252    /// It should be used to set parameters which are not yet available through their own
4253    /// setters.
4254    ///
4255    /// Please note that this method must not be used to set any of the known parameters
4256    /// which have their own setter method. If done anyway, the request will fail.
4257    ///
4258    /// # Additional Parameters
4259    ///
4260    /// * *$.xgafv* (query-string) - V1 error format.
4261    /// * *access_token* (query-string) - OAuth access token.
4262    /// * *alt* (query-string) - Data format for response.
4263    /// * *callback* (query-string) - JSONP
4264    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4265    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4266    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4267    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4268    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4269    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4270    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4271    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
4272    where
4273        T: AsRef<str>,
4274    {
4275        self._additional_params
4276            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4277        self
4278    }
4279
4280    /// Identifies the authorization scope for the method you are building.
4281    ///
4282    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4283    /// [`Scope::CloudPlatform`].
4284    ///
4285    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4286    /// tokens for more than one scope.
4287    ///
4288    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4289    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4290    /// sufficient, a read-write scope will do as well.
4291    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
4292    where
4293        St: AsRef<str>,
4294    {
4295        self._scopes.insert(String::from(scope.as_ref()));
4296        self
4297    }
4298    /// Identifies the authorization scope(s) for the method you are building.
4299    ///
4300    /// See [`Self::add_scope()`] for details.
4301    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
4302    where
4303        I: IntoIterator<Item = St>,
4304        St: AsRef<str>,
4305    {
4306        self._scopes
4307            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4308        self
4309    }
4310
4311    /// Removes all scopes, and no default scope will be used either.
4312    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4313    /// for details).
4314    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
4315        self._scopes.clear();
4316        self
4317    }
4318}