google_tagmanager1/
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    /// Delete your Google Tag Manager containers
17    DeleteContainer,
18
19    /// Manage your Google Tag Manager container and its subcomponents, excluding versioning and publishing
20    EditContainer,
21
22    /// Manage your Google Tag Manager container versions
23    EditContainerversion,
24
25    /// View and manage your Google Tag Manager accounts
26    ManageAccount,
27
28    /// Manage user permissions of your Google Tag Manager account and container
29    ManageUser,
30
31    /// Publish your Google Tag Manager container versions
32    Publish,
33
34    /// View your Google Tag Manager container and its subcomponents
35    Readonly,
36}
37
38impl AsRef<str> for Scope {
39    fn as_ref(&self) -> &str {
40        match *self {
41            Scope::DeleteContainer => {
42                "https://www.googleapis.com/auth/tagmanager.delete.containers"
43            }
44            Scope::EditContainer => "https://www.googleapis.com/auth/tagmanager.edit.containers",
45            Scope::EditContainerversion => {
46                "https://www.googleapis.com/auth/tagmanager.edit.containerversions"
47            }
48            Scope::ManageAccount => "https://www.googleapis.com/auth/tagmanager.manage.accounts",
49            Scope::ManageUser => "https://www.googleapis.com/auth/tagmanager.manage.users",
50            Scope::Publish => "https://www.googleapis.com/auth/tagmanager.publish",
51            Scope::Readonly => "https://www.googleapis.com/auth/tagmanager.readonly",
52        }
53    }
54}
55
56#[allow(clippy::derivable_impls)]
57impl Default for Scope {
58    fn default() -> Scope {
59        Scope::Readonly
60    }
61}
62
63// ########
64// HUB ###
65// ######
66
67/// Central instance to access all TagManager related resource activities
68///
69/// # Examples
70///
71/// Instantiate a new hub
72///
73/// ```test_harness,no_run
74/// extern crate hyper;
75/// extern crate hyper_rustls;
76/// extern crate google_tagmanager1 as tagmanager1;
77/// use tagmanager1::api::Folder;
78/// use tagmanager1::{Result, Error};
79/// # async fn dox() {
80/// use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
81///
82/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
83/// // `client_secret`, among other things.
84/// let secret: yup_oauth2::ApplicationSecret = Default::default();
85/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
86/// // unless you replace  `None` with the desired Flow.
87/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
88/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
89/// // retrieve them from storage.
90/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
91///     .with_native_roots()
92///     .unwrap()
93///     .https_only()
94///     .enable_http2()
95///     .build();
96///
97/// let executor = hyper_util::rt::TokioExecutor::new();
98/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
99///     secret,
100///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
101///     yup_oauth2::client::CustomHyperClientBuilder::from(
102///         hyper_util::client::legacy::Client::builder(executor).build(connector),
103///     ),
104/// ).build().await.unwrap();
105///
106/// let client = hyper_util::client::legacy::Client::builder(
107///     hyper_util::rt::TokioExecutor::new()
108/// )
109/// .build(
110///     hyper_rustls::HttpsConnectorBuilder::new()
111///         .with_native_roots()
112///         .unwrap()
113///         .https_or_http()
114///         .enable_http2()
115///         .build()
116/// );
117/// let mut hub = TagManager::new(client, auth);
118/// // As the method needs a request, you would usually fill it with the desired information
119/// // into the respective structure. Some of the parts shown here might not be applicable !
120/// // Values shown here are possibly random and not representative !
121/// let mut req = Folder::default();
122///
123/// // You can configure optional parameters by calling the respective setters at will, and
124/// // execute the final call using `doit()`.
125/// // Values shown here are possibly random and not representative !
126/// let result = hub.accounts().containers_move_folders_update(req, "accountId", "containerId", "folderId")
127///              .add_variable_id("gubergren")
128///              .add_trigger_id("eos")
129///              .add_tag_id("dolor")
130///              .doit().await;
131///
132/// match result {
133///     Err(e) => match e {
134///         // The Error enum provides details about what exactly happened.
135///         // You can also just use its `Debug`, `Display` or `Error` traits
136///          Error::HttpError(_)
137///         |Error::Io(_)
138///         |Error::MissingAPIKey
139///         |Error::MissingToken(_)
140///         |Error::Cancelled
141///         |Error::UploadSizeLimitExceeded(_, _)
142///         |Error::Failure(_)
143///         |Error::BadRequest(_)
144///         |Error::FieldClash(_)
145///         |Error::JsonDecodeError(_, _) => println!("{}", e),
146///     },
147///     Ok(res) => println!("Success: {:?}", res),
148/// }
149/// # }
150/// ```
151#[derive(Clone)]
152pub struct TagManager<C> {
153    pub client: common::Client<C>,
154    pub auth: Box<dyn common::GetToken>,
155    _user_agent: String,
156    _base_url: String,
157    _root_url: String,
158}
159
160impl<C> common::Hub for TagManager<C> {}
161
162impl<'a, C> TagManager<C> {
163    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> TagManager<C> {
164        TagManager {
165            client,
166            auth: Box::new(auth),
167            _user_agent: "google-api-rust-client/7.0.0".to_string(),
168            _base_url: "https://tagmanager.googleapis.com/".to_string(),
169            _root_url: "https://tagmanager.googleapis.com/".to_string(),
170        }
171    }
172
173    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
174        AccountMethods { hub: self }
175    }
176
177    /// Set the user-agent header field to use in all requests to the server.
178    /// It defaults to `google-api-rust-client/7.0.0`.
179    ///
180    /// Returns the previously set user-agent.
181    pub fn user_agent(&mut self, agent_name: String) -> String {
182        std::mem::replace(&mut self._user_agent, agent_name)
183    }
184
185    /// Set the base url to use in all requests to the server.
186    /// It defaults to `https://tagmanager.googleapis.com/`.
187    ///
188    /// Returns the previously set base url.
189    pub fn base_url(&mut self, new_base_url: String) -> String {
190        std::mem::replace(&mut self._base_url, new_base_url)
191    }
192
193    /// Set the root url to use in all requests to the server.
194    /// It defaults to `https://tagmanager.googleapis.com/`.
195    ///
196    /// Returns the previously set root url.
197    pub fn root_url(&mut self, new_root_url: String) -> String {
198        std::mem::replace(&mut self._root_url, new_root_url)
199    }
200}
201
202// ############
203// SCHEMAS ###
204// ##########
205/// Represents a Google Tag Manager Account.
206///
207/// # Activities
208///
209/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
210/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
211///
212/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (none)
213/// * [containers environments delete accounts](AccountContainerEnvironmentDeleteCall) (none)
214/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (none)
215/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (none)
216/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (none)
217/// * [containers folders entities list accounts](AccountContainerFolderEntityListCall) (none)
218/// * [containers folders create accounts](AccountContainerFolderCreateCall) (none)
219/// * [containers folders delete accounts](AccountContainerFolderDeleteCall) (none)
220/// * [containers folders get accounts](AccountContainerFolderGetCall) (none)
221/// * [containers folders list accounts](AccountContainerFolderListCall) (none)
222/// * [containers folders update accounts](AccountContainerFolderUpdateCall) (none)
223/// * [containers move_folders update accounts](AccountContainerMoveFolderUpdateCall) (none)
224/// * [containers reauthorize_environments update accounts](AccountContainerReauthorizeEnvironmentUpdateCall) (none)
225/// * [containers tags create accounts](AccountContainerTagCreateCall) (none)
226/// * [containers tags delete accounts](AccountContainerTagDeleteCall) (none)
227/// * [containers tags get accounts](AccountContainerTagGetCall) (none)
228/// * [containers tags list accounts](AccountContainerTagListCall) (none)
229/// * [containers tags update accounts](AccountContainerTagUpdateCall) (none)
230/// * [containers triggers create accounts](AccountContainerTriggerCreateCall) (none)
231/// * [containers triggers delete accounts](AccountContainerTriggerDeleteCall) (none)
232/// * [containers triggers get accounts](AccountContainerTriggerGetCall) (none)
233/// * [containers triggers list accounts](AccountContainerTriggerListCall) (none)
234/// * [containers triggers update accounts](AccountContainerTriggerUpdateCall) (none)
235/// * [containers variables create accounts](AccountContainerVariableCreateCall) (none)
236/// * [containers variables delete accounts](AccountContainerVariableDeleteCall) (none)
237/// * [containers variables get accounts](AccountContainerVariableGetCall) (none)
238/// * [containers variables list accounts](AccountContainerVariableListCall) (none)
239/// * [containers variables update accounts](AccountContainerVariableUpdateCall) (none)
240/// * [containers versions create accounts](AccountContainerVersionCreateCall) (none)
241/// * [containers versions delete accounts](AccountContainerVersionDeleteCall) (none)
242/// * [containers versions get accounts](AccountContainerVersionGetCall) (none)
243/// * [containers versions list accounts](AccountContainerVersionListCall) (none)
244/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (none)
245/// * [containers versions restore accounts](AccountContainerVersionRestoreCall) (none)
246/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (none)
247/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (none)
248/// * [containers create accounts](AccountContainerCreateCall) (none)
249/// * [containers delete accounts](AccountContainerDeleteCall) (none)
250/// * [containers get accounts](AccountContainerGetCall) (none)
251/// * [containers list accounts](AccountContainerListCall) (none)
252/// * [containers update accounts](AccountContainerUpdateCall) (none)
253/// * [permissions create accounts](AccountPermissionCreateCall) (none)
254/// * [permissions delete accounts](AccountPermissionDeleteCall) (none)
255/// * [permissions get accounts](AccountPermissionGetCall) (none)
256/// * [permissions list accounts](AccountPermissionListCall) (none)
257/// * [permissions update accounts](AccountPermissionUpdateCall) (none)
258/// * [get accounts](AccountGetCall) (response)
259/// * [list accounts](AccountListCall) (none)
260/// * [update accounts](AccountUpdateCall) (request|response)
261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
262#[serde_with::serde_as]
263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
264pub struct Account {
265    /// The Account ID uniquely identifies the GTM Account.
266    #[serde(rename = "accountId")]
267    pub account_id: Option<String>,
268    /// The fingerprint of the GTM Account as computed at storage time. This value is recomputed whenever the account is modified.
269    pub fingerprint: Option<String>,
270    /// Account display name.
271    pub name: Option<String>,
272    /// Whether the account shares data anonymously with Google and others.
273    #[serde(rename = "shareData")]
274    pub share_data: Option<bool>,
275}
276
277impl common::RequestValue for Account {}
278impl common::Resource for Account {}
279impl common::ResponseResult for Account {}
280
281/// Defines the Google Tag Manager Account access permissions.
282///
283/// This type is not used in any activity, and only used as *part* of another schema.
284///
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct AccountAccess {
289    /// List of Account permissions. Valid account permissions are read and manage.
290    pub permission: Option<Vec<String>>,
291}
292
293impl common::Part for AccountAccess {}
294
295/// Represents a predicate.
296///
297/// This type is not used in any activity, and only used as *part* of another schema.
298///
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct Condition {
303    /// A list of named parameters (key/value), depending on the condition's type. Notes: - For binary operators, include parameters named arg0 and arg1 for specifying the left and right operands, respectively. - At this time, the left operand (arg0) must be a reference to a variable. - For case-insensitive Regex matching, include a boolean parameter named ignore_case that is set to true. If not specified or set to any other value, the matching will be case sensitive. - To negate an operator, include a boolean parameter named negate boolean parameter that is set to true.
304    pub parameter: Option<Vec<Parameter>>,
305    /// The type of operator for this condition.
306    #[serde(rename = "type")]
307    pub type_: Option<String>,
308}
309
310impl common::Part for Condition {}
311
312/// Represents a Google Tag Manager Container.
313///
314/// # Activities
315///
316/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
317/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
318///
319/// * [containers create accounts](AccountContainerCreateCall) (request|response)
320/// * [containers get accounts](AccountContainerGetCall) (response)
321/// * [containers update accounts](AccountContainerUpdateCall) (request|response)
322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
323#[serde_with::serde_as]
324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
325pub struct Container {
326    /// GTM Account ID.
327    #[serde(rename = "accountId")]
328    pub account_id: Option<String>,
329    /// The Container ID uniquely identifies the GTM Container.
330    #[serde(rename = "containerId")]
331    pub container_id: Option<String>,
332    /// Optional list of domain names associated with the Container.
333    #[serde(rename = "domainName")]
334    pub domain_name: Option<Vec<String>>,
335    /// List of enabled built-in variables. Valid values include: pageUrl, pageHostname, pagePath, referrer, event, clickElement, clickClasses, clickId, clickTarget, clickUrl, clickText, formElement, formClasses, formId, formTarget, formUrl, formText, errorMessage, errorUrl, errorLine, newHistoryFragment, oldHistoryFragment, newHistoryState, oldHistoryState, historySource, containerVersion, debugMode, randomNumber, containerId.
336    #[serde(rename = "enabledBuiltInVariable")]
337    pub enabled_built_in_variable: Option<Vec<String>>,
338    /// The fingerprint of the GTM Container as computed at storage time. This value is recomputed whenever the account is modified.
339    pub fingerprint: Option<String>,
340    /// Container display name.
341    pub name: Option<String>,
342    /// Container Notes.
343    pub notes: Option<String>,
344    /// Container Public ID.
345    #[serde(rename = "publicId")]
346    pub public_id: Option<String>,
347    /// Container Country ID.
348    #[serde(rename = "timeZoneCountryId")]
349    pub time_zone_country_id: Option<String>,
350    /// Container Time Zone ID.
351    #[serde(rename = "timeZoneId")]
352    pub time_zone_id: Option<String>,
353    /// List of Usage Contexts for the Container. Valid values include: web, android, ios.
354    #[serde(rename = "usageContext")]
355    pub usage_context: Option<Vec<String>>,
356}
357
358impl common::RequestValue for Container {}
359impl common::ResponseResult for Container {}
360
361/// Defines the Google Tag Manager Container access permissions.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct ContainerAccess {
369    /// GTM Container ID.
370    #[serde(rename = "containerId")]
371    pub container_id: Option<String>,
372    /// List of Container permissions. Valid container permissions are: read, edit, delete, publish.
373    pub permission: Option<Vec<String>>,
374}
375
376impl common::Part for ContainerAccess {}
377
378/// Represents a Google Tag Manager Container Version.
379///
380/// # Activities
381///
382/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
383/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
384///
385/// * [containers versions get accounts](AccountContainerVersionGetCall) (response)
386/// * [containers versions restore accounts](AccountContainerVersionRestoreCall) (response)
387/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (response)
388/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (request|response)
389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
390#[serde_with::serde_as]
391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
392pub struct ContainerVersion {
393    /// GTM Account ID.
394    #[serde(rename = "accountId")]
395    pub account_id: Option<String>,
396    /// The container that this version was taken from.
397    pub container: Option<Container>,
398    /// GTM Container ID.
399    #[serde(rename = "containerId")]
400    pub container_id: Option<String>,
401    /// The Container Version ID uniquely identifies the GTM Container Version.
402    #[serde(rename = "containerVersionId")]
403    pub container_version_id: Option<String>,
404    /// A value of true indicates this container version has been deleted.
405    pub deleted: Option<bool>,
406    /// The fingerprint of the GTM Container Version as computed at storage time. This value is recomputed whenever the container version is modified.
407    pub fingerprint: Option<String>,
408    /// The folders in the container that this version was taken from.
409    pub folder: Option<Vec<Folder>>,
410    /// Container version display name.
411    pub name: Option<String>,
412    /// User notes on how to apply this container version in the container.
413    pub notes: Option<String>,
414    /// The tags in the container that this version was taken from.
415    pub tag: Option<Vec<Tag>>,
416    /// The triggers in the container that this version was taken from.
417    pub trigger: Option<Vec<Trigger>>,
418    /// The variables in the container that this version was taken from.
419    pub variable: Option<Vec<Variable>>,
420}
421
422impl common::RequestValue for ContainerVersion {}
423impl common::ResponseResult for ContainerVersion {}
424
425/// Represents a Google Tag Manager Container Version Header.
426///
427/// This type is not used in any activity, and only used as *part* of another schema.
428///
429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
430#[serde_with::serde_as]
431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
432pub struct ContainerVersionHeader {
433    /// GTM Account ID.
434    #[serde(rename = "accountId")]
435    pub account_id: Option<String>,
436    /// GTM Container ID.
437    #[serde(rename = "containerId")]
438    pub container_id: Option<String>,
439    /// The Container Version ID uniquely identifies the GTM Container Version.
440    #[serde(rename = "containerVersionId")]
441    pub container_version_id: Option<String>,
442    /// A value of true indicates this container version has been deleted.
443    pub deleted: Option<bool>,
444    /// Container version display name.
445    pub name: Option<String>,
446    /// Number of tags in the container version.
447    #[serde(rename = "numTags")]
448    pub num_tags: Option<String>,
449    /// Number of triggers in the container version.
450    #[serde(rename = "numTriggers")]
451    pub num_triggers: Option<String>,
452    /// Number of variables in the container version.
453    #[serde(rename = "numVariables")]
454    pub num_variables: Option<String>,
455}
456
457impl common::Part for ContainerVersionHeader {}
458
459/// Options for new container versions.
460///
461/// # Activities
462///
463/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
464/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
465///
466/// * [containers versions create accounts](AccountContainerVersionCreateCall) (request)
467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
468#[serde_with::serde_as]
469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
470pub struct CreateContainerVersionRequestVersionOptions {
471    /// The name of the container version to be created.
472    pub name: Option<String>,
473    /// The notes of the container version to be created.
474    pub notes: Option<String>,
475    /// The creation of this version may be for quick preview and shouldn't be saved.
476    #[serde(rename = "quickPreview")]
477    pub quick_preview: Option<bool>,
478}
479
480impl common::RequestValue for CreateContainerVersionRequestVersionOptions {}
481
482/// Create container versions response.
483///
484/// # Activities
485///
486/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
487/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
488///
489/// * [containers versions create accounts](AccountContainerVersionCreateCall) (response)
490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
491#[serde_with::serde_as]
492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
493pub struct CreateContainerVersionResponse {
494    /// Compiler errors or not.
495    #[serde(rename = "compilerError")]
496    pub compiler_error: Option<bool>,
497    /// The container version created.
498    #[serde(rename = "containerVersion")]
499    pub container_version: Option<ContainerVersion>,
500}
501
502impl common::ResponseResult for CreateContainerVersionResponse {}
503
504/// Represents a Google Tag Manager Environment. Note that a user can create, delete and update environments of type USER, but can only update the enable_debug and url fields of environments of other types.
505///
506/// # Activities
507///
508/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
509/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
510///
511/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (request|response)
512/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (response)
513/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (request|response)
514/// * [containers reauthorize_environments update accounts](AccountContainerReauthorizeEnvironmentUpdateCall) (request|response)
515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
516#[serde_with::serde_as]
517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
518pub struct Environment {
519    /// GTM Account ID.
520    #[serde(rename = "accountId")]
521    pub account_id: Option<String>,
522    /// The environment authorization code.
523    #[serde(rename = "authorizationCode")]
524    pub authorization_code: Option<String>,
525    /// The last update time-stamp for the authorization code.
526    #[serde(rename = "authorizationTimestampMs")]
527    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
528    pub authorization_timestamp_ms: Option<i64>,
529    /// GTM Container ID.
530    #[serde(rename = "containerId")]
531    pub container_id: Option<String>,
532    /// no description provided
533    #[serde(rename = "containerVersionId")]
534    pub container_version_id: Option<String>,
535    /// The environment description. Can be set or changed only on USER type environments.
536    pub description: Option<String>,
537    /// Whether or not to enable debug by default on for the environment.
538    #[serde(rename = "enableDebug")]
539    pub enable_debug: Option<bool>,
540    /// GTM Environment ID uniquely identifies the GTM Environment.
541    #[serde(rename = "environmentId")]
542    pub environment_id: Option<String>,
543    /// The fingerprint of the GTM environment as computed at storage time. This value is recomputed whenever the environment is modified.
544    pub fingerprint: Option<String>,
545    /// The environment display name. Can be set or changed only on USER type environments.
546    pub name: Option<String>,
547    /// The type of this environment.
548    #[serde(rename = "type")]
549    pub type_: Option<String>,
550    /// Default preview page url for the environment.
551    pub url: Option<String>,
552}
553
554impl common::RequestValue for Environment {}
555impl common::ResponseResult for Environment {}
556
557/// Represents a Google Tag Manager Folder.
558///
559/// # Activities
560///
561/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
562/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
563///
564/// * [containers folders create accounts](AccountContainerFolderCreateCall) (request|response)
565/// * [containers folders get accounts](AccountContainerFolderGetCall) (response)
566/// * [containers folders update accounts](AccountContainerFolderUpdateCall) (request|response)
567/// * [containers move_folders update accounts](AccountContainerMoveFolderUpdateCall) (request)
568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
569#[serde_with::serde_as]
570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
571pub struct Folder {
572    /// GTM Account ID.
573    #[serde(rename = "accountId")]
574    pub account_id: Option<String>,
575    /// GTM Container ID.
576    #[serde(rename = "containerId")]
577    pub container_id: Option<String>,
578    /// The fingerprint of the GTM Folder as computed at storage time. This value is recomputed whenever the folder is modified.
579    pub fingerprint: Option<String>,
580    /// The Folder ID uniquely identifies the GTM Folder.
581    #[serde(rename = "folderId")]
582    pub folder_id: Option<String>,
583    /// Folder display name.
584    pub name: Option<String>,
585}
586
587impl common::RequestValue for Folder {}
588impl common::ResponseResult for Folder {}
589
590/// Represents a Google Tag Manager Folder’s contents.
591///
592/// # Activities
593///
594/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
595/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
596///
597/// * [containers folders entities list accounts](AccountContainerFolderEntityListCall) (response)
598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
599#[serde_with::serde_as]
600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
601pub struct FolderEntities {
602    /// The list of tags inside the folder.
603    pub tag: Option<Vec<Tag>>,
604    /// The list of triggers inside the folder.
605    pub trigger: Option<Vec<Trigger>>,
606    /// The list of variables inside the folder.
607    pub variable: Option<Vec<Variable>>,
608}
609
610impl common::ResponseResult for FolderEntities {}
611
612/// List AccountUsers Response.
613///
614/// # Activities
615///
616/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
617/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
618///
619/// * [permissions list accounts](AccountPermissionListCall) (response)
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct ListAccountUsersResponse {
624    /// All GTM AccountUsers of a GTM Account.
625    #[serde(rename = "userAccess")]
626    pub user_access: Option<Vec<UserAccess>>,
627}
628
629impl common::ResponseResult for ListAccountUsersResponse {}
630
631/// List Accounts Response.
632///
633/// # Activities
634///
635/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
636/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
637///
638/// * [list accounts](AccountListCall) (response)
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct ListAccountsResponse {
643    /// List of GTM Accounts that a user has access to.
644    pub accounts: Option<Vec<Account>>,
645}
646
647impl common::ResponseResult for ListAccountsResponse {}
648
649/// List container versions response.
650///
651/// # Activities
652///
653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
655///
656/// * [containers versions list accounts](AccountContainerVersionListCall) (response)
657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
658#[serde_with::serde_as]
659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
660pub struct ListContainerVersionsResponse {
661    /// All versions of a GTM Container.
662    #[serde(rename = "containerVersion")]
663    pub container_version: Option<Vec<ContainerVersion>>,
664    /// All container version headers of a GTM Container.
665    #[serde(rename = "containerVersionHeader")]
666    pub container_version_header: Option<Vec<ContainerVersionHeader>>,
667}
668
669impl common::ResponseResult for ListContainerVersionsResponse {}
670
671/// List Containers Response.
672///
673/// # Activities
674///
675/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
676/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
677///
678/// * [containers list accounts](AccountContainerListCall) (response)
679#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
680#[serde_with::serde_as]
681#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
682pub struct ListContainersResponse {
683    /// All Containers of a GTM Account.
684    pub containers: Option<Vec<Container>>,
685}
686
687impl common::ResponseResult for ListContainersResponse {}
688
689/// List Environments Response.
690///
691/// # Activities
692///
693/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
694/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
695///
696/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (response)
697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
698#[serde_with::serde_as]
699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
700pub struct ListEnvironmentsResponse {
701    /// All Environments of a GTM Container.
702    pub environments: Option<Vec<Environment>>,
703}
704
705impl common::ResponseResult for ListEnvironmentsResponse {}
706
707/// List Folders Response.
708///
709/// # Activities
710///
711/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
712/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
713///
714/// * [containers folders list accounts](AccountContainerFolderListCall) (response)
715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
716#[serde_with::serde_as]
717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
718pub struct ListFoldersResponse {
719    /// All GTM Folders of a GTM Container.
720    pub folders: Option<Vec<Folder>>,
721}
722
723impl common::ResponseResult for ListFoldersResponse {}
724
725/// List Tags Response.
726///
727/// # Activities
728///
729/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
730/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
731///
732/// * [containers tags list accounts](AccountContainerTagListCall) (response)
733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
734#[serde_with::serde_as]
735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
736pub struct ListTagsResponse {
737    /// All GTM Tags of a GTM Container.
738    pub tags: Option<Vec<Tag>>,
739}
740
741impl common::ResponseResult for ListTagsResponse {}
742
743/// List triggers response.
744///
745/// # Activities
746///
747/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
748/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
749///
750/// * [containers triggers list accounts](AccountContainerTriggerListCall) (response)
751#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
752#[serde_with::serde_as]
753#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
754pub struct ListTriggersResponse {
755    /// All GTM Triggers of a GTM Container.
756    pub triggers: Option<Vec<Trigger>>,
757}
758
759impl common::ResponseResult for ListTriggersResponse {}
760
761/// List Variables Response.
762///
763/// # Activities
764///
765/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
766/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
767///
768/// * [containers variables list accounts](AccountContainerVariableListCall) (response)
769#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
770#[serde_with::serde_as]
771#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
772pub struct ListVariablesResponse {
773    /// All GTM Variables of a GTM Container.
774    pub variables: Option<Vec<Variable>>,
775}
776
777impl common::ResponseResult for ListVariablesResponse {}
778
779/// Represents a Google Tag Manager Parameter.
780///
781/// This type is not used in any activity, and only used as *part* of another schema.
782///
783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
784#[serde_with::serde_as]
785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
786pub struct Parameter {
787    /// The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values.
788    pub key: Option<String>,
789    /// This list parameter's parameters (keys will be ignored).
790    pub list: Option<Vec<Parameter>>,
791    /// This map parameter's parameters (must have keys; keys must be unique).
792    pub map: Option<Vec<Parameter>>,
793    /// The parameter type. Valid values are: - boolean: The value represents a boolean, represented as 'true' or 'false' - integer: The value represents a 64-bit signed integer value, in base 10 - list: A list of parameters should be specified - map: A map of parameters should be specified - template: The value represents any text; this can include variable references (even variable references that might return non-string types) - trigger_reference: The value represents a trigger, represented as the trigger id - tag_reference: The value represents a tag, represented as the tag name
794    #[serde(rename = "type")]
795    pub type_: Option<String>,
796    /// A parameter's value (may contain variable references). as appropriate to the specified type.
797    pub value: Option<String>,
798}
799
800impl common::Part for Parameter {}
801
802/// Publish container version response.
803///
804/// # Activities
805///
806/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
807/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
808///
809/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (response)
810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
811#[serde_with::serde_as]
812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
813pub struct PublishContainerVersionResponse {
814    /// Compiler errors or not.
815    #[serde(rename = "compilerError")]
816    pub compiler_error: Option<bool>,
817    /// The container version created.
818    #[serde(rename = "containerVersion")]
819    pub container_version: Option<ContainerVersion>,
820}
821
822impl common::ResponseResult for PublishContainerVersionResponse {}
823
824/// There is no detailed description.
825///
826/// This type is not used in any activity, and only used as *part* of another schema.
827///
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct SetupTag {
832    /// If true, fire the main tag if and only if the setup tag fires successfully. If false, fire the main tag regardless of setup tag firing status.
833    #[serde(rename = "stopOnSetupFailure")]
834    pub stop_on_setup_failure: Option<bool>,
835    /// The name of the setup tag.
836    #[serde(rename = "tagName")]
837    pub tag_name: Option<String>,
838}
839
840impl common::Part for SetupTag {}
841
842/// Represents a Google Tag Manager Tag.
843///
844/// # Activities
845///
846/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
847/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
848///
849/// * [containers tags create accounts](AccountContainerTagCreateCall) (request|response)
850/// * [containers tags get accounts](AccountContainerTagGetCall) (response)
851/// * [containers tags update accounts](AccountContainerTagUpdateCall) (request|response)
852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
853#[serde_with::serde_as]
854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
855pub struct Tag {
856    /// GTM Account ID.
857    #[serde(rename = "accountId")]
858    pub account_id: Option<String>,
859    /// Blocking trigger IDs. If any of the listed triggers evaluate to true, the tag will not fire.
860    #[serde(rename = "blockingTriggerId")]
861    pub blocking_trigger_id: Option<Vec<String>>,
862    /// GTM Container ID.
863    #[serde(rename = "containerId")]
864    pub container_id: Option<String>,
865    /// The fingerprint of the GTM Tag as computed at storage time. This value is recomputed whenever the tag is modified.
866    pub fingerprint: Option<String>,
867    /// Firing trigger IDs. A tag will fire when any of the listed triggers are true and all of its blockingTriggerIds (if any specified) are false.
868    #[serde(rename = "firingTriggerId")]
869    pub firing_trigger_id: Option<Vec<String>>,
870    /// If set to true, this tag will only fire in the live environment (e.g. not in preview or debug mode).
871    #[serde(rename = "liveOnly")]
872    pub live_only: Option<bool>,
873    /// Tag display name.
874    pub name: Option<String>,
875    /// User notes on how to apply this tag in the container.
876    pub notes: Option<String>,
877    /// The tag's parameters.
878    pub parameter: Option<Vec<Parameter>>,
879    /// Parent folder id.
880    #[serde(rename = "parentFolderId")]
881    pub parent_folder_id: Option<String>,
882    /// True if the tag is paused.
883    pub paused: Option<bool>,
884    /// User defined numeric priority of the tag. Tags are fired asynchronously in order of priority. Tags with higher numeric value fire first. A tag's priority can be a positive or negative value. The default value is 0.
885    pub priority: Option<Parameter>,
886    /// The end timestamp in milliseconds to schedule a tag.
887    #[serde(rename = "scheduleEndMs")]
888    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
889    pub schedule_end_ms: Option<i64>,
890    /// The start timestamp in milliseconds to schedule a tag.
891    #[serde(rename = "scheduleStartMs")]
892    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
893    pub schedule_start_ms: Option<i64>,
894    /// The list of setup tags. Currently we only allow one.
895    #[serde(rename = "setupTag")]
896    pub setup_tag: Option<Vec<SetupTag>>,
897    /// Option to fire this tag.
898    #[serde(rename = "tagFiringOption")]
899    pub tag_firing_option: Option<String>,
900    /// The Tag ID uniquely identifies the GTM Tag.
901    #[serde(rename = "tagId")]
902    pub tag_id: Option<String>,
903    /// The list of teardown tags. Currently we only allow one.
904    #[serde(rename = "teardownTag")]
905    pub teardown_tag: Option<Vec<TeardownTag>>,
906    /// GTM Tag Type.
907    #[serde(rename = "type")]
908    pub type_: Option<String>,
909}
910
911impl common::RequestValue for Tag {}
912impl common::ResponseResult for Tag {}
913
914/// There is no detailed description.
915///
916/// This type is not used in any activity, and only used as *part* of another schema.
917///
918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
919#[serde_with::serde_as]
920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
921pub struct TeardownTag {
922    /// If true, fire the teardown tag if and only if the main tag fires successfully. If false, fire the teardown tag regardless of main tag firing status.
923    #[serde(rename = "stopTeardownOnFailure")]
924    pub stop_teardown_on_failure: Option<bool>,
925    /// The name of the teardown tag.
926    #[serde(rename = "tagName")]
927    pub tag_name: Option<String>,
928}
929
930impl common::Part for TeardownTag {}
931
932/// Represents a Google Tag Manager Trigger
933///
934/// # Activities
935///
936/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
937/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
938///
939/// * [containers triggers create accounts](AccountContainerTriggerCreateCall) (request|response)
940/// * [containers triggers get accounts](AccountContainerTriggerGetCall) (response)
941/// * [containers triggers update accounts](AccountContainerTriggerUpdateCall) (request|response)
942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
943#[serde_with::serde_as]
944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
945pub struct Trigger {
946    /// GTM Account ID.
947    #[serde(rename = "accountId")]
948    pub account_id: Option<String>,
949    /// Used in the case of auto event tracking.
950    #[serde(rename = "autoEventFilter")]
951    pub auto_event_filter: Option<Vec<Condition>>,
952    /// Whether or not we should only fire tags if the form submit or link click event is not cancelled by some other event handler (e.g. because of validation). Only valid for Form Submission and Link Click triggers.
953    #[serde(rename = "checkValidation")]
954    pub check_validation: Option<Parameter>,
955    /// GTM Container ID.
956    #[serde(rename = "containerId")]
957    pub container_id: Option<String>,
958    /// A visibility trigger minimum continuous visible time (in milliseconds). Only valid for AMP Visibility trigger.
959    #[serde(rename = "continuousTimeMinMilliseconds")]
960    pub continuous_time_min_milliseconds: Option<Parameter>,
961    /// Used in the case of custom event, which is fired iff all Conditions are true.
962    #[serde(rename = "customEventFilter")]
963    pub custom_event_filter: Option<Vec<Condition>>,
964    /// Name of the GTM event that is fired. Only valid for Timer triggers.
965    #[serde(rename = "eventName")]
966    pub event_name: Option<Parameter>,
967    /// The trigger will only fire iff all Conditions are true.
968    pub filter: Option<Vec<Condition>>,
969    /// The fingerprint of the GTM Trigger as computed at storage time. This value is recomputed whenever the trigger is modified.
970    pub fingerprint: Option<String>,
971    /// List of integer percentage values for scroll triggers. The trigger will fire when each percentage is reached when the view is scrolled horizontally. Only valid for AMP scroll triggers.
972    #[serde(rename = "horizontalScrollPercentageList")]
973    pub horizontal_scroll_percentage_list: Option<Parameter>,
974    /// Time between triggering recurring Timer Events (in milliseconds). Only valid for Timer triggers.
975    pub interval: Option<Parameter>,
976    /// Time between Timer Events to fire (in seconds). Only valid for AMP Timer trigger.
977    #[serde(rename = "intervalSeconds")]
978    pub interval_seconds: Option<Parameter>,
979    /// Limit of the number of GTM events this Timer Trigger will fire. If no limit is set, we will continue to fire GTM events until the user leaves the page. Only valid for Timer triggers.
980    pub limit: Option<Parameter>,
981    /// Max time to fire Timer Events (in seconds). Only valid for AMP Timer trigger.
982    #[serde(rename = "maxTimerLengthSeconds")]
983    pub max_timer_length_seconds: Option<Parameter>,
984    /// Trigger display name.
985    pub name: Option<String>,
986    /// Additional parameters.
987    pub parameter: Option<Vec<Parameter>>,
988    /// Parent folder id.
989    #[serde(rename = "parentFolderId")]
990    pub parent_folder_id: Option<String>,
991    /// A click trigger CSS selector (i.e. "a", "button" etc.). Only valid for AMP Click trigger.
992    pub selector: Option<Parameter>,
993    /// A visibility trigger minimum total visible time (in milliseconds). Only valid for AMP Visibility trigger.
994    #[serde(rename = "totalTimeMinMilliseconds")]
995    pub total_time_min_milliseconds: Option<Parameter>,
996    /// The Trigger ID uniquely identifies the GTM Trigger.
997    #[serde(rename = "triggerId")]
998    pub trigger_id: Option<String>,
999    /// Defines the data layer event that causes this trigger.
1000    #[serde(rename = "type")]
1001    pub type_: Option<String>,
1002    /// Globally unique id of the trigger that auto-generates this (a Form Submit, Link Click or Timer listener) if any. Used to make incompatible auto-events work together with trigger filtering based on trigger ids. This value is populated during output generation since the tags implied by triggers don't exist until then. Only valid for Form Submit, Link Click and Timer triggers.
1003    #[serde(rename = "uniqueTriggerId")]
1004    pub unique_trigger_id: Option<Parameter>,
1005    /// List of integer percentage values for scroll triggers. The trigger will fire when each percentage is reached when the view is scrolled vertically. Only valid for AMP scroll triggers.
1006    #[serde(rename = "verticalScrollPercentageList")]
1007    pub vertical_scroll_percentage_list: Option<Parameter>,
1008    /// A visibility trigger CSS selector (i.e. "#id"). Only valid for AMP Visibility trigger.
1009    #[serde(rename = "visibilitySelector")]
1010    pub visibility_selector: Option<Parameter>,
1011    /// A visibility trigger maximum percent visibility. Only valid for AMP Visibility trigger.
1012    #[serde(rename = "visiblePercentageMax")]
1013    pub visible_percentage_max: Option<Parameter>,
1014    /// A visibility trigger minimum percent visibility. Only valid for AMP Visibility trigger.
1015    #[serde(rename = "visiblePercentageMin")]
1016    pub visible_percentage_min: Option<Parameter>,
1017    /// Whether or not we should delay the form submissions or link opening until all of the tags have fired (by preventing the default action and later simulating the default action). Only valid for Form Submission and Link Click triggers.
1018    #[serde(rename = "waitForTags")]
1019    pub wait_for_tags: Option<Parameter>,
1020    /// How long to wait (in milliseconds) for tags to fire when 'waits_for_tags' above evaluates to true. Only valid for Form Submission and Link Click triggers.
1021    #[serde(rename = "waitForTagsTimeout")]
1022    pub wait_for_tags_timeout: Option<Parameter>,
1023}
1024
1025impl common::RequestValue for Trigger {}
1026impl common::ResponseResult for Trigger {}
1027
1028/// Represents a user’s permissions to an account and its container.
1029///
1030/// # Activities
1031///
1032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1034///
1035/// * [permissions create accounts](AccountPermissionCreateCall) (request|response)
1036/// * [permissions get accounts](AccountPermissionGetCall) (response)
1037/// * [permissions update accounts](AccountPermissionUpdateCall) (request|response)
1038#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1039#[serde_with::serde_as]
1040#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1041pub struct UserAccess {
1042    /// GTM Account access permissions.
1043    #[serde(rename = "accountAccess")]
1044    pub account_access: Option<AccountAccess>,
1045    /// GTM Account ID.
1046    #[serde(rename = "accountId")]
1047    pub account_id: Option<String>,
1048    /// GTM Container access permissions.
1049    #[serde(rename = "containerAccess")]
1050    pub container_access: Option<Vec<ContainerAccess>>,
1051    /// User's email address.
1052    #[serde(rename = "emailAddress")]
1053    pub email_address: Option<String>,
1054    /// Account Permission ID.
1055    #[serde(rename = "permissionId")]
1056    pub permission_id: Option<String>,
1057}
1058
1059impl common::RequestValue for UserAccess {}
1060impl common::ResponseResult for UserAccess {}
1061
1062/// Represents a Google Tag Manager Variable.
1063///
1064/// # Activities
1065///
1066/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1067/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1068///
1069/// * [containers variables create accounts](AccountContainerVariableCreateCall) (request|response)
1070/// * [containers variables get accounts](AccountContainerVariableGetCall) (response)
1071/// * [containers variables update accounts](AccountContainerVariableUpdateCall) (request|response)
1072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1073#[serde_with::serde_as]
1074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1075pub struct Variable {
1076    /// GTM Account ID.
1077    #[serde(rename = "accountId")]
1078    pub account_id: Option<String>,
1079    /// GTM Container ID.
1080    #[serde(rename = "containerId")]
1081    pub container_id: Option<String>,
1082    /// For mobile containers only: A list of trigger IDs for disabling conditional variables; the variable is enabled if one of the enabling trigger is true while all the disabling trigger are false. Treated as an unordered set.
1083    #[serde(rename = "disablingTriggerId")]
1084    pub disabling_trigger_id: Option<Vec<String>>,
1085    /// For mobile containers only: A list of trigger IDs for enabling conditional variables; the variable is enabled if one of the enabling triggers is true while all the disabling triggers are false. Treated as an unordered set.
1086    #[serde(rename = "enablingTriggerId")]
1087    pub enabling_trigger_id: Option<Vec<String>>,
1088    /// The fingerprint of the GTM Variable as computed at storage time. This value is recomputed whenever the variable is modified.
1089    pub fingerprint: Option<String>,
1090    /// Variable display name.
1091    pub name: Option<String>,
1092    /// User notes on how to apply this variable in the container.
1093    pub notes: Option<String>,
1094    /// The variable's parameters.
1095    pub parameter: Option<Vec<Parameter>>,
1096    /// Parent folder id.
1097    #[serde(rename = "parentFolderId")]
1098    pub parent_folder_id: Option<String>,
1099    /// The end timestamp in milliseconds to schedule a variable.
1100    #[serde(rename = "scheduleEndMs")]
1101    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1102    pub schedule_end_ms: Option<i64>,
1103    /// The start timestamp in milliseconds to schedule a variable.
1104    #[serde(rename = "scheduleStartMs")]
1105    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1106    pub schedule_start_ms: Option<i64>,
1107    /// GTM Variable Type.
1108    #[serde(rename = "type")]
1109    pub type_: Option<String>,
1110    /// The Variable ID uniquely identifies the GTM Variable.
1111    #[serde(rename = "variableId")]
1112    pub variable_id: Option<String>,
1113}
1114
1115impl common::RequestValue for Variable {}
1116impl common::ResponseResult for Variable {}
1117
1118// ###################
1119// MethodBuilders ###
1120// #################
1121
1122/// A builder providing access to all methods supported on *account* resources.
1123/// It is not used directly, but through the [`TagManager`] hub.
1124///
1125/// # Example
1126///
1127/// Instantiate a resource builder
1128///
1129/// ```test_harness,no_run
1130/// extern crate hyper;
1131/// extern crate hyper_rustls;
1132/// extern crate google_tagmanager1 as tagmanager1;
1133///
1134/// # async fn dox() {
1135/// use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1136///
1137/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1138/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1139///     .with_native_roots()
1140///     .unwrap()
1141///     .https_only()
1142///     .enable_http2()
1143///     .build();
1144///
1145/// let executor = hyper_util::rt::TokioExecutor::new();
1146/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1147///     secret,
1148///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1149///     yup_oauth2::client::CustomHyperClientBuilder::from(
1150///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1151///     ),
1152/// ).build().await.unwrap();
1153///
1154/// let client = hyper_util::client::legacy::Client::builder(
1155///     hyper_util::rt::TokioExecutor::new()
1156/// )
1157/// .build(
1158///     hyper_rustls::HttpsConnectorBuilder::new()
1159///         .with_native_roots()
1160///         .unwrap()
1161///         .https_or_http()
1162///         .enable_http2()
1163///         .build()
1164/// );
1165/// let mut hub = TagManager::new(client, auth);
1166/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1167/// // like `containers_create(...)`, `containers_delete(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_update(...)`, `containers_folders_create(...)`, `containers_folders_delete(...)`, `containers_folders_entities_list(...)`, `containers_folders_get(...)`, `containers_folders_list(...)`, `containers_folders_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_move_folders_update(...)`, `containers_reauthorize_environments_update(...)`, `containers_tags_create(...)`, `containers_tags_delete(...)`, `containers_tags_get(...)`, `containers_tags_list(...)`, `containers_tags_update(...)`, `containers_triggers_create(...)`, `containers_triggers_delete(...)`, `containers_triggers_get(...)`, `containers_triggers_list(...)`, `containers_triggers_update(...)`, `containers_update(...)`, `containers_variables_create(...)`, `containers_variables_delete(...)`, `containers_variables_get(...)`, `containers_variables_list(...)`, `containers_variables_update(...)`, `containers_versions_create(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_list(...)`, `containers_versions_publish(...)`, `containers_versions_restore(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `get(...)`, `list(...)`, `permissions_create(...)`, `permissions_delete(...)`, `permissions_get(...)`, `permissions_list(...)`, `permissions_update(...)` and `update(...)`
1168/// // to build up your call.
1169/// let rb = hub.accounts();
1170/// # }
1171/// ```
1172pub struct AccountMethods<'a, C>
1173where
1174    C: 'a,
1175{
1176    hub: &'a TagManager<C>,
1177}
1178
1179impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
1180
1181impl<'a, C> AccountMethods<'a, C> {
1182    /// Create a builder to help you perform the following task:
1183    ///
1184    /// Creates a GTM Environment.
1185    ///
1186    /// # Arguments
1187    ///
1188    /// * `request` - No description provided.
1189    /// * `accountId` - The GTM Account ID.
1190    /// * `containerId` - The GTM Container ID.
1191    pub fn containers_environments_create(
1192        &self,
1193        request: Environment,
1194        account_id: &str,
1195        container_id: &str,
1196    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
1197        AccountContainerEnvironmentCreateCall {
1198            hub: self.hub,
1199            _request: request,
1200            _account_id: account_id.to_string(),
1201            _container_id: container_id.to_string(),
1202            _delegate: Default::default(),
1203            _additional_params: Default::default(),
1204            _scopes: Default::default(),
1205        }
1206    }
1207
1208    /// Create a builder to help you perform the following task:
1209    ///
1210    /// Deletes a GTM Environment.
1211    ///
1212    /// # Arguments
1213    ///
1214    /// * `accountId` - The GTM Account ID.
1215    /// * `containerId` - The GTM Container ID.
1216    /// * `environmentId` - The GTM Environment ID.
1217    pub fn containers_environments_delete(
1218        &self,
1219        account_id: &str,
1220        container_id: &str,
1221        environment_id: &str,
1222    ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
1223        AccountContainerEnvironmentDeleteCall {
1224            hub: self.hub,
1225            _account_id: account_id.to_string(),
1226            _container_id: container_id.to_string(),
1227            _environment_id: environment_id.to_string(),
1228            _delegate: Default::default(),
1229            _additional_params: Default::default(),
1230            _scopes: Default::default(),
1231        }
1232    }
1233
1234    /// Create a builder to help you perform the following task:
1235    ///
1236    /// Gets a GTM Environment.
1237    ///
1238    /// # Arguments
1239    ///
1240    /// * `accountId` - The GTM Account ID.
1241    /// * `containerId` - The GTM Container ID.
1242    /// * `environmentId` - The GTM Environment ID.
1243    pub fn containers_environments_get(
1244        &self,
1245        account_id: &str,
1246        container_id: &str,
1247        environment_id: &str,
1248    ) -> AccountContainerEnvironmentGetCall<'a, C> {
1249        AccountContainerEnvironmentGetCall {
1250            hub: self.hub,
1251            _account_id: account_id.to_string(),
1252            _container_id: container_id.to_string(),
1253            _environment_id: environment_id.to_string(),
1254            _delegate: Default::default(),
1255            _additional_params: Default::default(),
1256            _scopes: Default::default(),
1257        }
1258    }
1259
1260    /// Create a builder to help you perform the following task:
1261    ///
1262    /// Lists all GTM Environments of a GTM Container.
1263    ///
1264    /// # Arguments
1265    ///
1266    /// * `accountId` - The GTM Account ID.
1267    /// * `containerId` - The GTM Container ID.
1268    pub fn containers_environments_list(
1269        &self,
1270        account_id: &str,
1271        container_id: &str,
1272    ) -> AccountContainerEnvironmentListCall<'a, C> {
1273        AccountContainerEnvironmentListCall {
1274            hub: self.hub,
1275            _account_id: account_id.to_string(),
1276            _container_id: container_id.to_string(),
1277            _delegate: Default::default(),
1278            _additional_params: Default::default(),
1279            _scopes: Default::default(),
1280        }
1281    }
1282
1283    /// Create a builder to help you perform the following task:
1284    ///
1285    /// Updates a GTM Environment.
1286    ///
1287    /// # Arguments
1288    ///
1289    /// * `request` - No description provided.
1290    /// * `accountId` - The GTM Account ID.
1291    /// * `containerId` - The GTM Container ID.
1292    /// * `environmentId` - The GTM Environment ID.
1293    pub fn containers_environments_update(
1294        &self,
1295        request: Environment,
1296        account_id: &str,
1297        container_id: &str,
1298        environment_id: &str,
1299    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
1300        AccountContainerEnvironmentUpdateCall {
1301            hub: self.hub,
1302            _request: request,
1303            _account_id: account_id.to_string(),
1304            _container_id: container_id.to_string(),
1305            _environment_id: environment_id.to_string(),
1306            _fingerprint: Default::default(),
1307            _delegate: Default::default(),
1308            _additional_params: Default::default(),
1309            _scopes: Default::default(),
1310        }
1311    }
1312
1313    /// Create a builder to help you perform the following task:
1314    ///
1315    /// List all entities in a GTM Folder.
1316    ///
1317    /// # Arguments
1318    ///
1319    /// * `accountId` - The GTM Account ID.
1320    /// * `containerId` - The GTM Container ID.
1321    /// * `folderId` - The GTM Folder ID.
1322    pub fn containers_folders_entities_list(
1323        &self,
1324        account_id: &str,
1325        container_id: &str,
1326        folder_id: &str,
1327    ) -> AccountContainerFolderEntityListCall<'a, C> {
1328        AccountContainerFolderEntityListCall {
1329            hub: self.hub,
1330            _account_id: account_id.to_string(),
1331            _container_id: container_id.to_string(),
1332            _folder_id: folder_id.to_string(),
1333            _delegate: Default::default(),
1334            _additional_params: Default::default(),
1335            _scopes: Default::default(),
1336        }
1337    }
1338
1339    /// Create a builder to help you perform the following task:
1340    ///
1341    /// Creates a GTM Folder.
1342    ///
1343    /// # Arguments
1344    ///
1345    /// * `request` - No description provided.
1346    /// * `accountId` - The GTM Account ID.
1347    /// * `containerId` - The GTM Container ID.
1348    pub fn containers_folders_create(
1349        &self,
1350        request: Folder,
1351        account_id: &str,
1352        container_id: &str,
1353    ) -> AccountContainerFolderCreateCall<'a, C> {
1354        AccountContainerFolderCreateCall {
1355            hub: self.hub,
1356            _request: request,
1357            _account_id: account_id.to_string(),
1358            _container_id: container_id.to_string(),
1359            _delegate: Default::default(),
1360            _additional_params: Default::default(),
1361            _scopes: Default::default(),
1362        }
1363    }
1364
1365    /// Create a builder to help you perform the following task:
1366    ///
1367    /// Deletes a GTM Folder.
1368    ///
1369    /// # Arguments
1370    ///
1371    /// * `accountId` - The GTM Account ID.
1372    /// * `containerId` - The GTM Container ID.
1373    /// * `folderId` - The GTM Folder ID.
1374    pub fn containers_folders_delete(
1375        &self,
1376        account_id: &str,
1377        container_id: &str,
1378        folder_id: &str,
1379    ) -> AccountContainerFolderDeleteCall<'a, C> {
1380        AccountContainerFolderDeleteCall {
1381            hub: self.hub,
1382            _account_id: account_id.to_string(),
1383            _container_id: container_id.to_string(),
1384            _folder_id: folder_id.to_string(),
1385            _delegate: Default::default(),
1386            _additional_params: Default::default(),
1387            _scopes: Default::default(),
1388        }
1389    }
1390
1391    /// Create a builder to help you perform the following task:
1392    ///
1393    /// Gets a GTM Folder.
1394    ///
1395    /// # Arguments
1396    ///
1397    /// * `accountId` - The GTM Account ID.
1398    /// * `containerId` - The GTM Container ID.
1399    /// * `folderId` - The GTM Folder ID.
1400    pub fn containers_folders_get(
1401        &self,
1402        account_id: &str,
1403        container_id: &str,
1404        folder_id: &str,
1405    ) -> AccountContainerFolderGetCall<'a, C> {
1406        AccountContainerFolderGetCall {
1407            hub: self.hub,
1408            _account_id: account_id.to_string(),
1409            _container_id: container_id.to_string(),
1410            _folder_id: folder_id.to_string(),
1411            _delegate: Default::default(),
1412            _additional_params: Default::default(),
1413            _scopes: Default::default(),
1414        }
1415    }
1416
1417    /// Create a builder to help you perform the following task:
1418    ///
1419    /// Lists all GTM Folders of a Container.
1420    ///
1421    /// # Arguments
1422    ///
1423    /// * `accountId` - The GTM Account ID.
1424    /// * `containerId` - The GTM Container ID.
1425    pub fn containers_folders_list(
1426        &self,
1427        account_id: &str,
1428        container_id: &str,
1429    ) -> AccountContainerFolderListCall<'a, C> {
1430        AccountContainerFolderListCall {
1431            hub: self.hub,
1432            _account_id: account_id.to_string(),
1433            _container_id: container_id.to_string(),
1434            _delegate: Default::default(),
1435            _additional_params: Default::default(),
1436            _scopes: Default::default(),
1437        }
1438    }
1439
1440    /// Create a builder to help you perform the following task:
1441    ///
1442    /// Updates a GTM Folder.
1443    ///
1444    /// # Arguments
1445    ///
1446    /// * `request` - No description provided.
1447    /// * `accountId` - The GTM Account ID.
1448    /// * `containerId` - The GTM Container ID.
1449    /// * `folderId` - The GTM Folder ID.
1450    pub fn containers_folders_update(
1451        &self,
1452        request: Folder,
1453        account_id: &str,
1454        container_id: &str,
1455        folder_id: &str,
1456    ) -> AccountContainerFolderUpdateCall<'a, C> {
1457        AccountContainerFolderUpdateCall {
1458            hub: self.hub,
1459            _request: request,
1460            _account_id: account_id.to_string(),
1461            _container_id: container_id.to_string(),
1462            _folder_id: folder_id.to_string(),
1463            _fingerprint: Default::default(),
1464            _delegate: Default::default(),
1465            _additional_params: Default::default(),
1466            _scopes: Default::default(),
1467        }
1468    }
1469
1470    /// Create a builder to help you perform the following task:
1471    ///
1472    /// Moves entities to a GTM Folder.
1473    ///
1474    /// # Arguments
1475    ///
1476    /// * `request` - No description provided.
1477    /// * `accountId` - The GTM Account ID.
1478    /// * `containerId` - The GTM Container ID.
1479    /// * `folderId` - The GTM Folder ID.
1480    pub fn containers_move_folders_update(
1481        &self,
1482        request: Folder,
1483        account_id: &str,
1484        container_id: &str,
1485        folder_id: &str,
1486    ) -> AccountContainerMoveFolderUpdateCall<'a, C> {
1487        AccountContainerMoveFolderUpdateCall {
1488            hub: self.hub,
1489            _request: request,
1490            _account_id: account_id.to_string(),
1491            _container_id: container_id.to_string(),
1492            _folder_id: folder_id.to_string(),
1493            _variable_id: Default::default(),
1494            _trigger_id: Default::default(),
1495            _tag_id: Default::default(),
1496            _delegate: Default::default(),
1497            _additional_params: Default::default(),
1498            _scopes: Default::default(),
1499        }
1500    }
1501
1502    /// Create a builder to help you perform the following task:
1503    ///
1504    /// Re-generates the authorization code for a GTM Environment.
1505    ///
1506    /// # Arguments
1507    ///
1508    /// * `request` - No description provided.
1509    /// * `accountId` - The GTM Account ID.
1510    /// * `containerId` - The GTM Container ID.
1511    /// * `environmentId` - The GTM Environment ID.
1512    pub fn containers_reauthorize_environments_update(
1513        &self,
1514        request: Environment,
1515        account_id: &str,
1516        container_id: &str,
1517        environment_id: &str,
1518    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
1519        AccountContainerReauthorizeEnvironmentUpdateCall {
1520            hub: self.hub,
1521            _request: request,
1522            _account_id: account_id.to_string(),
1523            _container_id: container_id.to_string(),
1524            _environment_id: environment_id.to_string(),
1525            _delegate: Default::default(),
1526            _additional_params: Default::default(),
1527            _scopes: Default::default(),
1528        }
1529    }
1530
1531    /// Create a builder to help you perform the following task:
1532    ///
1533    /// Creates a GTM Tag.
1534    ///
1535    /// # Arguments
1536    ///
1537    /// * `request` - No description provided.
1538    /// * `accountId` - The GTM Account ID.
1539    /// * `containerId` - The GTM Container ID.
1540    pub fn containers_tags_create(
1541        &self,
1542        request: Tag,
1543        account_id: &str,
1544        container_id: &str,
1545    ) -> AccountContainerTagCreateCall<'a, C> {
1546        AccountContainerTagCreateCall {
1547            hub: self.hub,
1548            _request: request,
1549            _account_id: account_id.to_string(),
1550            _container_id: container_id.to_string(),
1551            _delegate: Default::default(),
1552            _additional_params: Default::default(),
1553            _scopes: Default::default(),
1554        }
1555    }
1556
1557    /// Create a builder to help you perform the following task:
1558    ///
1559    /// Deletes a GTM Tag.
1560    ///
1561    /// # Arguments
1562    ///
1563    /// * `accountId` - The GTM Account ID.
1564    /// * `containerId` - The GTM Container ID.
1565    /// * `tagId` - The GTM Tag ID.
1566    pub fn containers_tags_delete(
1567        &self,
1568        account_id: &str,
1569        container_id: &str,
1570        tag_id: &str,
1571    ) -> AccountContainerTagDeleteCall<'a, C> {
1572        AccountContainerTagDeleteCall {
1573            hub: self.hub,
1574            _account_id: account_id.to_string(),
1575            _container_id: container_id.to_string(),
1576            _tag_id: tag_id.to_string(),
1577            _delegate: Default::default(),
1578            _additional_params: Default::default(),
1579            _scopes: Default::default(),
1580        }
1581    }
1582
1583    /// Create a builder to help you perform the following task:
1584    ///
1585    /// Gets a GTM Tag.
1586    ///
1587    /// # Arguments
1588    ///
1589    /// * `accountId` - The GTM Account ID.
1590    /// * `containerId` - The GTM Container ID.
1591    /// * `tagId` - The GTM Tag ID.
1592    pub fn containers_tags_get(
1593        &self,
1594        account_id: &str,
1595        container_id: &str,
1596        tag_id: &str,
1597    ) -> AccountContainerTagGetCall<'a, C> {
1598        AccountContainerTagGetCall {
1599            hub: self.hub,
1600            _account_id: account_id.to_string(),
1601            _container_id: container_id.to_string(),
1602            _tag_id: tag_id.to_string(),
1603            _delegate: Default::default(),
1604            _additional_params: Default::default(),
1605            _scopes: Default::default(),
1606        }
1607    }
1608
1609    /// Create a builder to help you perform the following task:
1610    ///
1611    /// Lists all GTM Tags of a Container.
1612    ///
1613    /// # Arguments
1614    ///
1615    /// * `accountId` - The GTM Account ID.
1616    /// * `containerId` - The GTM Container ID.
1617    pub fn containers_tags_list(
1618        &self,
1619        account_id: &str,
1620        container_id: &str,
1621    ) -> AccountContainerTagListCall<'a, C> {
1622        AccountContainerTagListCall {
1623            hub: self.hub,
1624            _account_id: account_id.to_string(),
1625            _container_id: container_id.to_string(),
1626            _delegate: Default::default(),
1627            _additional_params: Default::default(),
1628            _scopes: Default::default(),
1629        }
1630    }
1631
1632    /// Create a builder to help you perform the following task:
1633    ///
1634    /// Updates a GTM Tag.
1635    ///
1636    /// # Arguments
1637    ///
1638    /// * `request` - No description provided.
1639    /// * `accountId` - The GTM Account ID.
1640    /// * `containerId` - The GTM Container ID.
1641    /// * `tagId` - The GTM Tag ID.
1642    pub fn containers_tags_update(
1643        &self,
1644        request: Tag,
1645        account_id: &str,
1646        container_id: &str,
1647        tag_id: &str,
1648    ) -> AccountContainerTagUpdateCall<'a, C> {
1649        AccountContainerTagUpdateCall {
1650            hub: self.hub,
1651            _request: request,
1652            _account_id: account_id.to_string(),
1653            _container_id: container_id.to_string(),
1654            _tag_id: tag_id.to_string(),
1655            _fingerprint: Default::default(),
1656            _delegate: Default::default(),
1657            _additional_params: Default::default(),
1658            _scopes: Default::default(),
1659        }
1660    }
1661
1662    /// Create a builder to help you perform the following task:
1663    ///
1664    /// Creates a GTM Trigger.
1665    ///
1666    /// # Arguments
1667    ///
1668    /// * `request` - No description provided.
1669    /// * `accountId` - The GTM Account ID.
1670    /// * `containerId` - The GTM Container ID.
1671    pub fn containers_triggers_create(
1672        &self,
1673        request: Trigger,
1674        account_id: &str,
1675        container_id: &str,
1676    ) -> AccountContainerTriggerCreateCall<'a, C> {
1677        AccountContainerTriggerCreateCall {
1678            hub: self.hub,
1679            _request: request,
1680            _account_id: account_id.to_string(),
1681            _container_id: container_id.to_string(),
1682            _delegate: Default::default(),
1683            _additional_params: Default::default(),
1684            _scopes: Default::default(),
1685        }
1686    }
1687
1688    /// Create a builder to help you perform the following task:
1689    ///
1690    /// Deletes a GTM Trigger.
1691    ///
1692    /// # Arguments
1693    ///
1694    /// * `accountId` - The GTM Account ID.
1695    /// * `containerId` - The GTM Container ID.
1696    /// * `triggerId` - The GTM Trigger ID.
1697    pub fn containers_triggers_delete(
1698        &self,
1699        account_id: &str,
1700        container_id: &str,
1701        trigger_id: &str,
1702    ) -> AccountContainerTriggerDeleteCall<'a, C> {
1703        AccountContainerTriggerDeleteCall {
1704            hub: self.hub,
1705            _account_id: account_id.to_string(),
1706            _container_id: container_id.to_string(),
1707            _trigger_id: trigger_id.to_string(),
1708            _delegate: Default::default(),
1709            _additional_params: Default::default(),
1710            _scopes: Default::default(),
1711        }
1712    }
1713
1714    /// Create a builder to help you perform the following task:
1715    ///
1716    /// Gets a GTM Trigger.
1717    ///
1718    /// # Arguments
1719    ///
1720    /// * `accountId` - The GTM Account ID.
1721    /// * `containerId` - The GTM Container ID.
1722    /// * `triggerId` - The GTM Trigger ID.
1723    pub fn containers_triggers_get(
1724        &self,
1725        account_id: &str,
1726        container_id: &str,
1727        trigger_id: &str,
1728    ) -> AccountContainerTriggerGetCall<'a, C> {
1729        AccountContainerTriggerGetCall {
1730            hub: self.hub,
1731            _account_id: account_id.to_string(),
1732            _container_id: container_id.to_string(),
1733            _trigger_id: trigger_id.to_string(),
1734            _delegate: Default::default(),
1735            _additional_params: Default::default(),
1736            _scopes: Default::default(),
1737        }
1738    }
1739
1740    /// Create a builder to help you perform the following task:
1741    ///
1742    /// Lists all GTM Triggers of a Container.
1743    ///
1744    /// # Arguments
1745    ///
1746    /// * `accountId` - The GTM Account ID.
1747    /// * `containerId` - The GTM Container ID.
1748    pub fn containers_triggers_list(
1749        &self,
1750        account_id: &str,
1751        container_id: &str,
1752    ) -> AccountContainerTriggerListCall<'a, C> {
1753        AccountContainerTriggerListCall {
1754            hub: self.hub,
1755            _account_id: account_id.to_string(),
1756            _container_id: container_id.to_string(),
1757            _delegate: Default::default(),
1758            _additional_params: Default::default(),
1759            _scopes: Default::default(),
1760        }
1761    }
1762
1763    /// Create a builder to help you perform the following task:
1764    ///
1765    /// Updates a GTM Trigger.
1766    ///
1767    /// # Arguments
1768    ///
1769    /// * `request` - No description provided.
1770    /// * `accountId` - The GTM Account ID.
1771    /// * `containerId` - The GTM Container ID.
1772    /// * `triggerId` - The GTM Trigger ID.
1773    pub fn containers_triggers_update(
1774        &self,
1775        request: Trigger,
1776        account_id: &str,
1777        container_id: &str,
1778        trigger_id: &str,
1779    ) -> AccountContainerTriggerUpdateCall<'a, C> {
1780        AccountContainerTriggerUpdateCall {
1781            hub: self.hub,
1782            _request: request,
1783            _account_id: account_id.to_string(),
1784            _container_id: container_id.to_string(),
1785            _trigger_id: trigger_id.to_string(),
1786            _fingerprint: Default::default(),
1787            _delegate: Default::default(),
1788            _additional_params: Default::default(),
1789            _scopes: Default::default(),
1790        }
1791    }
1792
1793    /// Create a builder to help you perform the following task:
1794    ///
1795    /// Creates a GTM Variable.
1796    ///
1797    /// # Arguments
1798    ///
1799    /// * `request` - No description provided.
1800    /// * `accountId` - The GTM Account ID.
1801    /// * `containerId` - The GTM Container ID.
1802    pub fn containers_variables_create(
1803        &self,
1804        request: Variable,
1805        account_id: &str,
1806        container_id: &str,
1807    ) -> AccountContainerVariableCreateCall<'a, C> {
1808        AccountContainerVariableCreateCall {
1809            hub: self.hub,
1810            _request: request,
1811            _account_id: account_id.to_string(),
1812            _container_id: container_id.to_string(),
1813            _delegate: Default::default(),
1814            _additional_params: Default::default(),
1815            _scopes: Default::default(),
1816        }
1817    }
1818
1819    /// Create a builder to help you perform the following task:
1820    ///
1821    /// Deletes a GTM Variable.
1822    ///
1823    /// # Arguments
1824    ///
1825    /// * `accountId` - The GTM Account ID.
1826    /// * `containerId` - The GTM Container ID.
1827    /// * `variableId` - The GTM Variable ID.
1828    pub fn containers_variables_delete(
1829        &self,
1830        account_id: &str,
1831        container_id: &str,
1832        variable_id: &str,
1833    ) -> AccountContainerVariableDeleteCall<'a, C> {
1834        AccountContainerVariableDeleteCall {
1835            hub: self.hub,
1836            _account_id: account_id.to_string(),
1837            _container_id: container_id.to_string(),
1838            _variable_id: variable_id.to_string(),
1839            _delegate: Default::default(),
1840            _additional_params: Default::default(),
1841            _scopes: Default::default(),
1842        }
1843    }
1844
1845    /// Create a builder to help you perform the following task:
1846    ///
1847    /// Gets a GTM Variable.
1848    ///
1849    /// # Arguments
1850    ///
1851    /// * `accountId` - The GTM Account ID.
1852    /// * `containerId` - The GTM Container ID.
1853    /// * `variableId` - The GTM Variable ID.
1854    pub fn containers_variables_get(
1855        &self,
1856        account_id: &str,
1857        container_id: &str,
1858        variable_id: &str,
1859    ) -> AccountContainerVariableGetCall<'a, C> {
1860        AccountContainerVariableGetCall {
1861            hub: self.hub,
1862            _account_id: account_id.to_string(),
1863            _container_id: container_id.to_string(),
1864            _variable_id: variable_id.to_string(),
1865            _delegate: Default::default(),
1866            _additional_params: Default::default(),
1867            _scopes: Default::default(),
1868        }
1869    }
1870
1871    /// Create a builder to help you perform the following task:
1872    ///
1873    /// Lists all GTM Variables of a Container.
1874    ///
1875    /// # Arguments
1876    ///
1877    /// * `accountId` - The GTM Account ID.
1878    /// * `containerId` - The GTM Container ID.
1879    pub fn containers_variables_list(
1880        &self,
1881        account_id: &str,
1882        container_id: &str,
1883    ) -> AccountContainerVariableListCall<'a, C> {
1884        AccountContainerVariableListCall {
1885            hub: self.hub,
1886            _account_id: account_id.to_string(),
1887            _container_id: container_id.to_string(),
1888            _delegate: Default::default(),
1889            _additional_params: Default::default(),
1890            _scopes: Default::default(),
1891        }
1892    }
1893
1894    /// Create a builder to help you perform the following task:
1895    ///
1896    /// Updates a GTM Variable.
1897    ///
1898    /// # Arguments
1899    ///
1900    /// * `request` - No description provided.
1901    /// * `accountId` - The GTM Account ID.
1902    /// * `containerId` - The GTM Container ID.
1903    /// * `variableId` - The GTM Variable ID.
1904    pub fn containers_variables_update(
1905        &self,
1906        request: Variable,
1907        account_id: &str,
1908        container_id: &str,
1909        variable_id: &str,
1910    ) -> AccountContainerVariableUpdateCall<'a, C> {
1911        AccountContainerVariableUpdateCall {
1912            hub: self.hub,
1913            _request: request,
1914            _account_id: account_id.to_string(),
1915            _container_id: container_id.to_string(),
1916            _variable_id: variable_id.to_string(),
1917            _fingerprint: Default::default(),
1918            _delegate: Default::default(),
1919            _additional_params: Default::default(),
1920            _scopes: Default::default(),
1921        }
1922    }
1923
1924    /// Create a builder to help you perform the following task:
1925    ///
1926    /// Creates a Container Version.
1927    ///
1928    /// # Arguments
1929    ///
1930    /// * `request` - No description provided.
1931    /// * `accountId` - The GTM Account ID.
1932    /// * `containerId` - The GTM Container ID.
1933    pub fn containers_versions_create(
1934        &self,
1935        request: CreateContainerVersionRequestVersionOptions,
1936        account_id: &str,
1937        container_id: &str,
1938    ) -> AccountContainerVersionCreateCall<'a, C> {
1939        AccountContainerVersionCreateCall {
1940            hub: self.hub,
1941            _request: request,
1942            _account_id: account_id.to_string(),
1943            _container_id: container_id.to_string(),
1944            _delegate: Default::default(),
1945            _additional_params: Default::default(),
1946            _scopes: Default::default(),
1947        }
1948    }
1949
1950    /// Create a builder to help you perform the following task:
1951    ///
1952    /// Deletes a Container Version.
1953    ///
1954    /// # Arguments
1955    ///
1956    /// * `accountId` - The GTM Account ID.
1957    /// * `containerId` - The GTM Container ID.
1958    /// * `containerVersionId` - The GTM Container Version ID.
1959    pub fn containers_versions_delete(
1960        &self,
1961        account_id: &str,
1962        container_id: &str,
1963        container_version_id: &str,
1964    ) -> AccountContainerVersionDeleteCall<'a, C> {
1965        AccountContainerVersionDeleteCall {
1966            hub: self.hub,
1967            _account_id: account_id.to_string(),
1968            _container_id: container_id.to_string(),
1969            _container_version_id: container_version_id.to_string(),
1970            _delegate: Default::default(),
1971            _additional_params: Default::default(),
1972            _scopes: Default::default(),
1973        }
1974    }
1975
1976    /// Create a builder to help you perform the following task:
1977    ///
1978    /// Gets a Container Version.
1979    ///
1980    /// # Arguments
1981    ///
1982    /// * `accountId` - The GTM Account ID.
1983    /// * `containerId` - The GTM Container ID.
1984    /// * `containerVersionId` - The GTM Container Version ID. Specify published to retrieve the currently published version.
1985    pub fn containers_versions_get(
1986        &self,
1987        account_id: &str,
1988        container_id: &str,
1989        container_version_id: &str,
1990    ) -> AccountContainerVersionGetCall<'a, C> {
1991        AccountContainerVersionGetCall {
1992            hub: self.hub,
1993            _account_id: account_id.to_string(),
1994            _container_id: container_id.to_string(),
1995            _container_version_id: container_version_id.to_string(),
1996            _delegate: Default::default(),
1997            _additional_params: Default::default(),
1998            _scopes: Default::default(),
1999        }
2000    }
2001
2002    /// Create a builder to help you perform the following task:
2003    ///
2004    /// Lists all Container Versions of a GTM Container.
2005    ///
2006    /// # Arguments
2007    ///
2008    /// * `accountId` - The GTM Account ID.
2009    /// * `containerId` - The GTM Container ID.
2010    pub fn containers_versions_list(
2011        &self,
2012        account_id: &str,
2013        container_id: &str,
2014    ) -> AccountContainerVersionListCall<'a, C> {
2015        AccountContainerVersionListCall {
2016            hub: self.hub,
2017            _account_id: account_id.to_string(),
2018            _container_id: container_id.to_string(),
2019            _include_deleted: Default::default(),
2020            _headers: Default::default(),
2021            _delegate: Default::default(),
2022            _additional_params: Default::default(),
2023            _scopes: Default::default(),
2024        }
2025    }
2026
2027    /// Create a builder to help you perform the following task:
2028    ///
2029    /// Publishes a Container Version.
2030    ///
2031    /// # Arguments
2032    ///
2033    /// * `accountId` - The GTM Account ID.
2034    /// * `containerId` - The GTM Container ID.
2035    /// * `containerVersionId` - The GTM Container Version ID.
2036    pub fn containers_versions_publish(
2037        &self,
2038        account_id: &str,
2039        container_id: &str,
2040        container_version_id: &str,
2041    ) -> AccountContainerVersionPublishCall<'a, C> {
2042        AccountContainerVersionPublishCall {
2043            hub: self.hub,
2044            _account_id: account_id.to_string(),
2045            _container_id: container_id.to_string(),
2046            _container_version_id: container_version_id.to_string(),
2047            _fingerprint: Default::default(),
2048            _delegate: Default::default(),
2049            _additional_params: Default::default(),
2050            _scopes: Default::default(),
2051        }
2052    }
2053
2054    /// Create a builder to help you perform the following task:
2055    ///
2056    /// Restores a Container Version. This will overwrite the container's current configuration (including its variables, triggers and tags). The operation will not have any effect on the version that is being served (i.e. the published version).
2057    ///
2058    /// # Arguments
2059    ///
2060    /// * `accountId` - The GTM Account ID.
2061    /// * `containerId` - The GTM Container ID.
2062    /// * `containerVersionId` - The GTM Container Version ID.
2063    pub fn containers_versions_restore(
2064        &self,
2065        account_id: &str,
2066        container_id: &str,
2067        container_version_id: &str,
2068    ) -> AccountContainerVersionRestoreCall<'a, C> {
2069        AccountContainerVersionRestoreCall {
2070            hub: self.hub,
2071            _account_id: account_id.to_string(),
2072            _container_id: container_id.to_string(),
2073            _container_version_id: container_version_id.to_string(),
2074            _delegate: Default::default(),
2075            _additional_params: Default::default(),
2076            _scopes: Default::default(),
2077        }
2078    }
2079
2080    /// Create a builder to help you perform the following task:
2081    ///
2082    /// Undeletes a Container Version.
2083    ///
2084    /// # Arguments
2085    ///
2086    /// * `accountId` - The GTM Account ID.
2087    /// * `containerId` - The GTM Container ID.
2088    /// * `containerVersionId` - The GTM Container Version ID.
2089    pub fn containers_versions_undelete(
2090        &self,
2091        account_id: &str,
2092        container_id: &str,
2093        container_version_id: &str,
2094    ) -> AccountContainerVersionUndeleteCall<'a, C> {
2095        AccountContainerVersionUndeleteCall {
2096            hub: self.hub,
2097            _account_id: account_id.to_string(),
2098            _container_id: container_id.to_string(),
2099            _container_version_id: container_version_id.to_string(),
2100            _delegate: Default::default(),
2101            _additional_params: Default::default(),
2102            _scopes: Default::default(),
2103        }
2104    }
2105
2106    /// Create a builder to help you perform the following task:
2107    ///
2108    /// Updates a Container Version.
2109    ///
2110    /// # Arguments
2111    ///
2112    /// * `request` - No description provided.
2113    /// * `accountId` - The GTM Account ID.
2114    /// * `containerId` - The GTM Container ID.
2115    /// * `containerVersionId` - The GTM Container Version ID.
2116    pub fn containers_versions_update(
2117        &self,
2118        request: ContainerVersion,
2119        account_id: &str,
2120        container_id: &str,
2121        container_version_id: &str,
2122    ) -> AccountContainerVersionUpdateCall<'a, C> {
2123        AccountContainerVersionUpdateCall {
2124            hub: self.hub,
2125            _request: request,
2126            _account_id: account_id.to_string(),
2127            _container_id: container_id.to_string(),
2128            _container_version_id: container_version_id.to_string(),
2129            _fingerprint: Default::default(),
2130            _delegate: Default::default(),
2131            _additional_params: Default::default(),
2132            _scopes: Default::default(),
2133        }
2134    }
2135
2136    /// Create a builder to help you perform the following task:
2137    ///
2138    /// Creates a Container.
2139    ///
2140    /// # Arguments
2141    ///
2142    /// * `request` - No description provided.
2143    /// * `accountId` - The GTM Account ID.
2144    pub fn containers_create(
2145        &self,
2146        request: Container,
2147        account_id: &str,
2148    ) -> AccountContainerCreateCall<'a, C> {
2149        AccountContainerCreateCall {
2150            hub: self.hub,
2151            _request: request,
2152            _account_id: account_id.to_string(),
2153            _delegate: Default::default(),
2154            _additional_params: Default::default(),
2155            _scopes: Default::default(),
2156        }
2157    }
2158
2159    /// Create a builder to help you perform the following task:
2160    ///
2161    /// Deletes a Container.
2162    ///
2163    /// # Arguments
2164    ///
2165    /// * `accountId` - The GTM Account ID.
2166    /// * `containerId` - The GTM Container ID.
2167    pub fn containers_delete(
2168        &self,
2169        account_id: &str,
2170        container_id: &str,
2171    ) -> AccountContainerDeleteCall<'a, C> {
2172        AccountContainerDeleteCall {
2173            hub: self.hub,
2174            _account_id: account_id.to_string(),
2175            _container_id: container_id.to_string(),
2176            _delegate: Default::default(),
2177            _additional_params: Default::default(),
2178            _scopes: Default::default(),
2179        }
2180    }
2181
2182    /// Create a builder to help you perform the following task:
2183    ///
2184    /// Gets a Container.
2185    ///
2186    /// # Arguments
2187    ///
2188    /// * `accountId` - The GTM Account ID.
2189    /// * `containerId` - The GTM Container ID.
2190    pub fn containers_get(
2191        &self,
2192        account_id: &str,
2193        container_id: &str,
2194    ) -> AccountContainerGetCall<'a, C> {
2195        AccountContainerGetCall {
2196            hub: self.hub,
2197            _account_id: account_id.to_string(),
2198            _container_id: container_id.to_string(),
2199            _delegate: Default::default(),
2200            _additional_params: Default::default(),
2201            _scopes: Default::default(),
2202        }
2203    }
2204
2205    /// Create a builder to help you perform the following task:
2206    ///
2207    /// Lists all Containers that belongs to a GTM Account.
2208    ///
2209    /// # Arguments
2210    ///
2211    /// * `accountId` - The GTM Account ID.
2212    pub fn containers_list(&self, account_id: &str) -> AccountContainerListCall<'a, C> {
2213        AccountContainerListCall {
2214            hub: self.hub,
2215            _account_id: account_id.to_string(),
2216            _delegate: Default::default(),
2217            _additional_params: Default::default(),
2218            _scopes: Default::default(),
2219        }
2220    }
2221
2222    /// Create a builder to help you perform the following task:
2223    ///
2224    /// Updates a Container.
2225    ///
2226    /// # Arguments
2227    ///
2228    /// * `request` - No description provided.
2229    /// * `accountId` - The GTM Account ID.
2230    /// * `containerId` - The GTM Container ID.
2231    pub fn containers_update(
2232        &self,
2233        request: Container,
2234        account_id: &str,
2235        container_id: &str,
2236    ) -> AccountContainerUpdateCall<'a, C> {
2237        AccountContainerUpdateCall {
2238            hub: self.hub,
2239            _request: request,
2240            _account_id: account_id.to_string(),
2241            _container_id: container_id.to_string(),
2242            _fingerprint: Default::default(),
2243            _delegate: Default::default(),
2244            _additional_params: Default::default(),
2245            _scopes: Default::default(),
2246        }
2247    }
2248
2249    /// Create a builder to help you perform the following task:
2250    ///
2251    /// Creates a user's Account & Container Permissions.
2252    ///
2253    /// # Arguments
2254    ///
2255    /// * `request` - No description provided.
2256    /// * `accountId` - The GTM Account ID.
2257    pub fn permissions_create(
2258        &self,
2259        request: UserAccess,
2260        account_id: &str,
2261    ) -> AccountPermissionCreateCall<'a, C> {
2262        AccountPermissionCreateCall {
2263            hub: self.hub,
2264            _request: request,
2265            _account_id: account_id.to_string(),
2266            _delegate: Default::default(),
2267            _additional_params: Default::default(),
2268            _scopes: Default::default(),
2269        }
2270    }
2271
2272    /// Create a builder to help you perform the following task:
2273    ///
2274    /// Removes a user from the account, revoking access to it and all of its containers.
2275    ///
2276    /// # Arguments
2277    ///
2278    /// * `accountId` - The GTM Account ID.
2279    /// * `permissionId` - The GTM User ID.
2280    pub fn permissions_delete(
2281        &self,
2282        account_id: &str,
2283        permission_id: &str,
2284    ) -> AccountPermissionDeleteCall<'a, C> {
2285        AccountPermissionDeleteCall {
2286            hub: self.hub,
2287            _account_id: account_id.to_string(),
2288            _permission_id: permission_id.to_string(),
2289            _delegate: Default::default(),
2290            _additional_params: Default::default(),
2291            _scopes: Default::default(),
2292        }
2293    }
2294
2295    /// Create a builder to help you perform the following task:
2296    ///
2297    /// Gets a user's Account & Container Permissions.
2298    ///
2299    /// # Arguments
2300    ///
2301    /// * `accountId` - The GTM Account ID.
2302    /// * `permissionId` - The GTM User ID.
2303    pub fn permissions_get(
2304        &self,
2305        account_id: &str,
2306        permission_id: &str,
2307    ) -> AccountPermissionGetCall<'a, C> {
2308        AccountPermissionGetCall {
2309            hub: self.hub,
2310            _account_id: account_id.to_string(),
2311            _permission_id: permission_id.to_string(),
2312            _delegate: Default::default(),
2313            _additional_params: Default::default(),
2314            _scopes: Default::default(),
2315        }
2316    }
2317
2318    /// Create a builder to help you perform the following task:
2319    ///
2320    /// List all users that have access to the account along with Account and Container Permissions granted to each of them.
2321    ///
2322    /// # Arguments
2323    ///
2324    /// * `accountId` - The GTM Account ID.
2325    pub fn permissions_list(&self, account_id: &str) -> AccountPermissionListCall<'a, C> {
2326        AccountPermissionListCall {
2327            hub: self.hub,
2328            _account_id: account_id.to_string(),
2329            _delegate: Default::default(),
2330            _additional_params: Default::default(),
2331            _scopes: Default::default(),
2332        }
2333    }
2334
2335    /// Create a builder to help you perform the following task:
2336    ///
2337    /// Updates a user's Account & Container Permissions.
2338    ///
2339    /// # Arguments
2340    ///
2341    /// * `request` - No description provided.
2342    /// * `accountId` - The GTM Account ID.
2343    /// * `permissionId` - The GTM User ID.
2344    pub fn permissions_update(
2345        &self,
2346        request: UserAccess,
2347        account_id: &str,
2348        permission_id: &str,
2349    ) -> AccountPermissionUpdateCall<'a, C> {
2350        AccountPermissionUpdateCall {
2351            hub: self.hub,
2352            _request: request,
2353            _account_id: account_id.to_string(),
2354            _permission_id: permission_id.to_string(),
2355            _delegate: Default::default(),
2356            _additional_params: Default::default(),
2357            _scopes: Default::default(),
2358        }
2359    }
2360
2361    /// Create a builder to help you perform the following task:
2362    ///
2363    /// Gets a GTM Account.
2364    ///
2365    /// # Arguments
2366    ///
2367    /// * `accountId` - The GTM Account ID.
2368    pub fn get(&self, account_id: &str) -> AccountGetCall<'a, C> {
2369        AccountGetCall {
2370            hub: self.hub,
2371            _account_id: account_id.to_string(),
2372            _delegate: Default::default(),
2373            _additional_params: Default::default(),
2374            _scopes: Default::default(),
2375        }
2376    }
2377
2378    /// Create a builder to help you perform the following task:
2379    ///
2380    /// Lists all GTM Accounts that a user has access to.
2381    pub fn list(&self) -> AccountListCall<'a, C> {
2382        AccountListCall {
2383            hub: self.hub,
2384            _delegate: Default::default(),
2385            _additional_params: Default::default(),
2386            _scopes: Default::default(),
2387        }
2388    }
2389
2390    /// Create a builder to help you perform the following task:
2391    ///
2392    /// Updates a GTM Account.
2393    ///
2394    /// # Arguments
2395    ///
2396    /// * `request` - No description provided.
2397    /// * `accountId` - The GTM Account ID.
2398    pub fn update(&self, request: Account, account_id: &str) -> AccountUpdateCall<'a, C> {
2399        AccountUpdateCall {
2400            hub: self.hub,
2401            _request: request,
2402            _account_id: account_id.to_string(),
2403            _fingerprint: Default::default(),
2404            _delegate: Default::default(),
2405            _additional_params: Default::default(),
2406            _scopes: Default::default(),
2407        }
2408    }
2409}
2410
2411// ###################
2412// CallBuilders   ###
2413// #################
2414
2415/// Creates a GTM Environment.
2416///
2417/// A builder for the *containers.environments.create* method supported by a *account* resource.
2418/// It is not used directly, but through a [`AccountMethods`] instance.
2419///
2420/// # Example
2421///
2422/// Instantiate a resource method builder
2423///
2424/// ```test_harness,no_run
2425/// # extern crate hyper;
2426/// # extern crate hyper_rustls;
2427/// # extern crate google_tagmanager1 as tagmanager1;
2428/// use tagmanager1::api::Environment;
2429/// # async fn dox() {
2430/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2431///
2432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2433/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2434/// #     .with_native_roots()
2435/// #     .unwrap()
2436/// #     .https_only()
2437/// #     .enable_http2()
2438/// #     .build();
2439///
2440/// # let executor = hyper_util::rt::TokioExecutor::new();
2441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2442/// #     secret,
2443/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2444/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2445/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2446/// #     ),
2447/// # ).build().await.unwrap();
2448///
2449/// # let client = hyper_util::client::legacy::Client::builder(
2450/// #     hyper_util::rt::TokioExecutor::new()
2451/// # )
2452/// # .build(
2453/// #     hyper_rustls::HttpsConnectorBuilder::new()
2454/// #         .with_native_roots()
2455/// #         .unwrap()
2456/// #         .https_or_http()
2457/// #         .enable_http2()
2458/// #         .build()
2459/// # );
2460/// # let mut hub = TagManager::new(client, auth);
2461/// // As the method needs a request, you would usually fill it with the desired information
2462/// // into the respective structure. Some of the parts shown here might not be applicable !
2463/// // Values shown here are possibly random and not representative !
2464/// let mut req = Environment::default();
2465///
2466/// // You can configure optional parameters by calling the respective setters at will, and
2467/// // execute the final call using `doit()`.
2468/// // Values shown here are possibly random and not representative !
2469/// let result = hub.accounts().containers_environments_create(req, "accountId", "containerId")
2470///              .doit().await;
2471/// # }
2472/// ```
2473pub struct AccountContainerEnvironmentCreateCall<'a, C>
2474where
2475    C: 'a,
2476{
2477    hub: &'a TagManager<C>,
2478    _request: Environment,
2479    _account_id: String,
2480    _container_id: String,
2481    _delegate: Option<&'a mut dyn common::Delegate>,
2482    _additional_params: HashMap<String, String>,
2483    _scopes: BTreeSet<String>,
2484}
2485
2486impl<'a, C> common::CallBuilder for AccountContainerEnvironmentCreateCall<'a, C> {}
2487
2488impl<'a, C> AccountContainerEnvironmentCreateCall<'a, C>
2489where
2490    C: common::Connector,
2491{
2492    /// Perform the operation you have build so far.
2493    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
2494        use std::borrow::Cow;
2495        use std::io::{Read, Seek};
2496
2497        use common::{url::Params, ToParts};
2498        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2499
2500        let mut dd = common::DefaultDelegate;
2501        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2502        dlg.begin(common::MethodInfo {
2503            id: "tagmanager.accounts.containers.environments.create",
2504            http_method: hyper::Method::POST,
2505        });
2506
2507        for &field in ["alt", "accountId", "containerId"].iter() {
2508            if self._additional_params.contains_key(field) {
2509                dlg.finished(false);
2510                return Err(common::Error::FieldClash(field));
2511            }
2512        }
2513
2514        let mut params = Params::with_capacity(5 + self._additional_params.len());
2515        params.push("accountId", self._account_id);
2516        params.push("containerId", self._container_id);
2517
2518        params.extend(self._additional_params.iter());
2519
2520        params.push("alt", "json");
2521        let mut url = self.hub._base_url.clone()
2522            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/environments";
2523        if self._scopes.is_empty() {
2524            self._scopes
2525                .insert(Scope::EditContainer.as_ref().to_string());
2526        }
2527
2528        #[allow(clippy::single_element_loop)]
2529        for &(find_this, param_name) in [
2530            ("{accountId}", "accountId"),
2531            ("{containerId}", "containerId"),
2532        ]
2533        .iter()
2534        {
2535            url = params.uri_replacement(url, param_name, find_this, false);
2536        }
2537        {
2538            let to_remove = ["containerId", "accountId"];
2539            params.remove_params(&to_remove);
2540        }
2541
2542        let url = params.parse_with_url(&url);
2543
2544        let mut json_mime_type = mime::APPLICATION_JSON;
2545        let mut request_value_reader = {
2546            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2547            common::remove_json_null_values(&mut value);
2548            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2549            serde_json::to_writer(&mut dst, &value).unwrap();
2550            dst
2551        };
2552        let request_size = request_value_reader
2553            .seek(std::io::SeekFrom::End(0))
2554            .unwrap();
2555        request_value_reader
2556            .seek(std::io::SeekFrom::Start(0))
2557            .unwrap();
2558
2559        loop {
2560            let token = match self
2561                .hub
2562                .auth
2563                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2564                .await
2565            {
2566                Ok(token) => token,
2567                Err(e) => match dlg.token(e) {
2568                    Ok(token) => token,
2569                    Err(e) => {
2570                        dlg.finished(false);
2571                        return Err(common::Error::MissingToken(e));
2572                    }
2573                },
2574            };
2575            request_value_reader
2576                .seek(std::io::SeekFrom::Start(0))
2577                .unwrap();
2578            let mut req_result = {
2579                let client = &self.hub.client;
2580                dlg.pre_request();
2581                let mut req_builder = hyper::Request::builder()
2582                    .method(hyper::Method::POST)
2583                    .uri(url.as_str())
2584                    .header(USER_AGENT, self.hub._user_agent.clone());
2585
2586                if let Some(token) = token.as_ref() {
2587                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2588                }
2589
2590                let request = req_builder
2591                    .header(CONTENT_TYPE, json_mime_type.to_string())
2592                    .header(CONTENT_LENGTH, request_size as u64)
2593                    .body(common::to_body(
2594                        request_value_reader.get_ref().clone().into(),
2595                    ));
2596
2597                client.request(request.unwrap()).await
2598            };
2599
2600            match req_result {
2601                Err(err) => {
2602                    if let common::Retry::After(d) = dlg.http_error(&err) {
2603                        sleep(d).await;
2604                        continue;
2605                    }
2606                    dlg.finished(false);
2607                    return Err(common::Error::HttpError(err));
2608                }
2609                Ok(res) => {
2610                    let (mut parts, body) = res.into_parts();
2611                    let mut body = common::Body::new(body);
2612                    if !parts.status.is_success() {
2613                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2614                        let error = serde_json::from_str(&common::to_string(&bytes));
2615                        let response = common::to_response(parts, bytes.into());
2616
2617                        if let common::Retry::After(d) =
2618                            dlg.http_failure(&response, error.as_ref().ok())
2619                        {
2620                            sleep(d).await;
2621                            continue;
2622                        }
2623
2624                        dlg.finished(false);
2625
2626                        return Err(match error {
2627                            Ok(value) => common::Error::BadRequest(value),
2628                            _ => common::Error::Failure(response),
2629                        });
2630                    }
2631                    let response = {
2632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2633                        let encoded = common::to_string(&bytes);
2634                        match serde_json::from_str(&encoded) {
2635                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2636                            Err(error) => {
2637                                dlg.response_json_decode_error(&encoded, &error);
2638                                return Err(common::Error::JsonDecodeError(
2639                                    encoded.to_string(),
2640                                    error,
2641                                ));
2642                            }
2643                        }
2644                    };
2645
2646                    dlg.finished(true);
2647                    return Ok(response);
2648                }
2649            }
2650        }
2651    }
2652
2653    ///
2654    /// Sets the *request* property to the given value.
2655    ///
2656    /// Even though the property as already been set when instantiating this call,
2657    /// we provide this method for API completeness.
2658    pub fn request(
2659        mut self,
2660        new_value: Environment,
2661    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
2662        self._request = new_value;
2663        self
2664    }
2665    /// The GTM Account ID.
2666    ///
2667    /// Sets the *account id* path property to the given value.
2668    ///
2669    /// Even though the property as already been set when instantiating this call,
2670    /// we provide this method for API completeness.
2671    pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentCreateCall<'a, C> {
2672        self._account_id = new_value.to_string();
2673        self
2674    }
2675    /// The GTM Container ID.
2676    ///
2677    /// Sets the *container id* path property to the given value.
2678    ///
2679    /// Even though the property as already been set when instantiating this call,
2680    /// we provide this method for API completeness.
2681    pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentCreateCall<'a, C> {
2682        self._container_id = new_value.to_string();
2683        self
2684    }
2685    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2686    /// while executing the actual API request.
2687    ///
2688    /// ````text
2689    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2690    /// ````
2691    ///
2692    /// Sets the *delegate* property to the given value.
2693    pub fn delegate(
2694        mut self,
2695        new_value: &'a mut dyn common::Delegate,
2696    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
2697        self._delegate = Some(new_value);
2698        self
2699    }
2700
2701    /// Set any additional parameter of the query string used in the request.
2702    /// It should be used to set parameters which are not yet available through their own
2703    /// setters.
2704    ///
2705    /// Please note that this method must not be used to set any of the known parameters
2706    /// which have their own setter method. If done anyway, the request will fail.
2707    ///
2708    /// # Additional Parameters
2709    ///
2710    /// * *$.xgafv* (query-string) - V1 error format.
2711    /// * *access_token* (query-string) - OAuth access token.
2712    /// * *alt* (query-string) - Data format for response.
2713    /// * *callback* (query-string) - JSONP
2714    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2715    /// * *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.
2716    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2717    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2718    /// * *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.
2719    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2720    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2721    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentCreateCall<'a, C>
2722    where
2723        T: AsRef<str>,
2724    {
2725        self._additional_params
2726            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2727        self
2728    }
2729
2730    /// Identifies the authorization scope for the method you are building.
2731    ///
2732    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2733    /// [`Scope::EditContainer`].
2734    ///
2735    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2736    /// tokens for more than one scope.
2737    ///
2738    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2739    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2740    /// sufficient, a read-write scope will do as well.
2741    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentCreateCall<'a, C>
2742    where
2743        St: AsRef<str>,
2744    {
2745        self._scopes.insert(String::from(scope.as_ref()));
2746        self
2747    }
2748    /// Identifies the authorization scope(s) for the method you are building.
2749    ///
2750    /// See [`Self::add_scope()`] for details.
2751    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentCreateCall<'a, C>
2752    where
2753        I: IntoIterator<Item = St>,
2754        St: AsRef<str>,
2755    {
2756        self._scopes
2757            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2758        self
2759    }
2760
2761    /// Removes all scopes, and no default scope will be used either.
2762    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2763    /// for details).
2764    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentCreateCall<'a, C> {
2765        self._scopes.clear();
2766        self
2767    }
2768}
2769
2770/// Deletes a GTM Environment.
2771///
2772/// A builder for the *containers.environments.delete* method supported by a *account* resource.
2773/// It is not used directly, but through a [`AccountMethods`] instance.
2774///
2775/// # Example
2776///
2777/// Instantiate a resource method builder
2778///
2779/// ```test_harness,no_run
2780/// # extern crate hyper;
2781/// # extern crate hyper_rustls;
2782/// # extern crate google_tagmanager1 as tagmanager1;
2783/// # async fn dox() {
2784/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2785///
2786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2787/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2788/// #     .with_native_roots()
2789/// #     .unwrap()
2790/// #     .https_only()
2791/// #     .enable_http2()
2792/// #     .build();
2793///
2794/// # let executor = hyper_util::rt::TokioExecutor::new();
2795/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2796/// #     secret,
2797/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2798/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2799/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2800/// #     ),
2801/// # ).build().await.unwrap();
2802///
2803/// # let client = hyper_util::client::legacy::Client::builder(
2804/// #     hyper_util::rt::TokioExecutor::new()
2805/// # )
2806/// # .build(
2807/// #     hyper_rustls::HttpsConnectorBuilder::new()
2808/// #         .with_native_roots()
2809/// #         .unwrap()
2810/// #         .https_or_http()
2811/// #         .enable_http2()
2812/// #         .build()
2813/// # );
2814/// # let mut hub = TagManager::new(client, auth);
2815/// // You can configure optional parameters by calling the respective setters at will, and
2816/// // execute the final call using `doit()`.
2817/// // Values shown here are possibly random and not representative !
2818/// let result = hub.accounts().containers_environments_delete("accountId", "containerId", "environmentId")
2819///              .doit().await;
2820/// # }
2821/// ```
2822pub struct AccountContainerEnvironmentDeleteCall<'a, C>
2823where
2824    C: 'a,
2825{
2826    hub: &'a TagManager<C>,
2827    _account_id: String,
2828    _container_id: String,
2829    _environment_id: String,
2830    _delegate: Option<&'a mut dyn common::Delegate>,
2831    _additional_params: HashMap<String, String>,
2832    _scopes: BTreeSet<String>,
2833}
2834
2835impl<'a, C> common::CallBuilder for AccountContainerEnvironmentDeleteCall<'a, C> {}
2836
2837impl<'a, C> AccountContainerEnvironmentDeleteCall<'a, C>
2838where
2839    C: common::Connector,
2840{
2841    /// Perform the operation you have build so far.
2842    pub async fn doit(mut self) -> common::Result<common::Response> {
2843        use std::borrow::Cow;
2844        use std::io::{Read, Seek};
2845
2846        use common::{url::Params, ToParts};
2847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2848
2849        let mut dd = common::DefaultDelegate;
2850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2851        dlg.begin(common::MethodInfo {
2852            id: "tagmanager.accounts.containers.environments.delete",
2853            http_method: hyper::Method::DELETE,
2854        });
2855
2856        for &field in ["accountId", "containerId", "environmentId"].iter() {
2857            if self._additional_params.contains_key(field) {
2858                dlg.finished(false);
2859                return Err(common::Error::FieldClash(field));
2860            }
2861        }
2862
2863        let mut params = Params::with_capacity(4 + self._additional_params.len());
2864        params.push("accountId", self._account_id);
2865        params.push("containerId", self._container_id);
2866        params.push("environmentId", self._environment_id);
2867
2868        params.extend(self._additional_params.iter());
2869
2870        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/environments/{environmentId}";
2871        if self._scopes.is_empty() {
2872            self._scopes
2873                .insert(Scope::EditContainer.as_ref().to_string());
2874        }
2875
2876        #[allow(clippy::single_element_loop)]
2877        for &(find_this, param_name) in [
2878            ("{accountId}", "accountId"),
2879            ("{containerId}", "containerId"),
2880            ("{environmentId}", "environmentId"),
2881        ]
2882        .iter()
2883        {
2884            url = params.uri_replacement(url, param_name, find_this, false);
2885        }
2886        {
2887            let to_remove = ["environmentId", "containerId", "accountId"];
2888            params.remove_params(&to_remove);
2889        }
2890
2891        let url = params.parse_with_url(&url);
2892
2893        loop {
2894            let token = match self
2895                .hub
2896                .auth
2897                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2898                .await
2899            {
2900                Ok(token) => token,
2901                Err(e) => match dlg.token(e) {
2902                    Ok(token) => token,
2903                    Err(e) => {
2904                        dlg.finished(false);
2905                        return Err(common::Error::MissingToken(e));
2906                    }
2907                },
2908            };
2909            let mut req_result = {
2910                let client = &self.hub.client;
2911                dlg.pre_request();
2912                let mut req_builder = hyper::Request::builder()
2913                    .method(hyper::Method::DELETE)
2914                    .uri(url.as_str())
2915                    .header(USER_AGENT, self.hub._user_agent.clone());
2916
2917                if let Some(token) = token.as_ref() {
2918                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2919                }
2920
2921                let request = req_builder
2922                    .header(CONTENT_LENGTH, 0_u64)
2923                    .body(common::to_body::<String>(None));
2924
2925                client.request(request.unwrap()).await
2926            };
2927
2928            match req_result {
2929                Err(err) => {
2930                    if let common::Retry::After(d) = dlg.http_error(&err) {
2931                        sleep(d).await;
2932                        continue;
2933                    }
2934                    dlg.finished(false);
2935                    return Err(common::Error::HttpError(err));
2936                }
2937                Ok(res) => {
2938                    let (mut parts, body) = res.into_parts();
2939                    let mut body = common::Body::new(body);
2940                    if !parts.status.is_success() {
2941                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2942                        let error = serde_json::from_str(&common::to_string(&bytes));
2943                        let response = common::to_response(parts, bytes.into());
2944
2945                        if let common::Retry::After(d) =
2946                            dlg.http_failure(&response, error.as_ref().ok())
2947                        {
2948                            sleep(d).await;
2949                            continue;
2950                        }
2951
2952                        dlg.finished(false);
2953
2954                        return Err(match error {
2955                            Ok(value) => common::Error::BadRequest(value),
2956                            _ => common::Error::Failure(response),
2957                        });
2958                    }
2959                    let response = common::Response::from_parts(parts, body);
2960
2961                    dlg.finished(true);
2962                    return Ok(response);
2963                }
2964            }
2965        }
2966    }
2967
2968    /// The GTM Account ID.
2969    ///
2970    /// Sets the *account id* path property to the given value.
2971    ///
2972    /// Even though the property as already been set when instantiating this call,
2973    /// we provide this method for API completeness.
2974    pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentDeleteCall<'a, C> {
2975        self._account_id = new_value.to_string();
2976        self
2977    }
2978    /// The GTM Container ID.
2979    ///
2980    /// Sets the *container id* path property to the given value.
2981    ///
2982    /// Even though the property as already been set when instantiating this call,
2983    /// we provide this method for API completeness.
2984    pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentDeleteCall<'a, C> {
2985        self._container_id = new_value.to_string();
2986        self
2987    }
2988    /// The GTM Environment ID.
2989    ///
2990    /// Sets the *environment id* path property to the given value.
2991    ///
2992    /// Even though the property as already been set when instantiating this call,
2993    /// we provide this method for API completeness.
2994    pub fn environment_id(
2995        mut self,
2996        new_value: &str,
2997    ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
2998        self._environment_id = new_value.to_string();
2999        self
3000    }
3001    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3002    /// while executing the actual API request.
3003    ///
3004    /// ````text
3005    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3006    /// ````
3007    ///
3008    /// Sets the *delegate* property to the given value.
3009    pub fn delegate(
3010        mut self,
3011        new_value: &'a mut dyn common::Delegate,
3012    ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
3013        self._delegate = Some(new_value);
3014        self
3015    }
3016
3017    /// Set any additional parameter of the query string used in the request.
3018    /// It should be used to set parameters which are not yet available through their own
3019    /// setters.
3020    ///
3021    /// Please note that this method must not be used to set any of the known parameters
3022    /// which have their own setter method. If done anyway, the request will fail.
3023    ///
3024    /// # Additional Parameters
3025    ///
3026    /// * *$.xgafv* (query-string) - V1 error format.
3027    /// * *access_token* (query-string) - OAuth access token.
3028    /// * *alt* (query-string) - Data format for response.
3029    /// * *callback* (query-string) - JSONP
3030    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3031    /// * *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.
3032    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3033    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3034    /// * *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.
3035    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3036    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3037    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentDeleteCall<'a, C>
3038    where
3039        T: AsRef<str>,
3040    {
3041        self._additional_params
3042            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3043        self
3044    }
3045
3046    /// Identifies the authorization scope for the method you are building.
3047    ///
3048    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3049    /// [`Scope::EditContainer`].
3050    ///
3051    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3052    /// tokens for more than one scope.
3053    ///
3054    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3055    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3056    /// sufficient, a read-write scope will do as well.
3057    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentDeleteCall<'a, C>
3058    where
3059        St: AsRef<str>,
3060    {
3061        self._scopes.insert(String::from(scope.as_ref()));
3062        self
3063    }
3064    /// Identifies the authorization scope(s) for the method you are building.
3065    ///
3066    /// See [`Self::add_scope()`] for details.
3067    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentDeleteCall<'a, C>
3068    where
3069        I: IntoIterator<Item = St>,
3070        St: AsRef<str>,
3071    {
3072        self._scopes
3073            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3074        self
3075    }
3076
3077    /// Removes all scopes, and no default scope will be used either.
3078    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3079    /// for details).
3080    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentDeleteCall<'a, C> {
3081        self._scopes.clear();
3082        self
3083    }
3084}
3085
3086/// Gets a GTM Environment.
3087///
3088/// A builder for the *containers.environments.get* method supported by a *account* resource.
3089/// It is not used directly, but through a [`AccountMethods`] instance.
3090///
3091/// # Example
3092///
3093/// Instantiate a resource method builder
3094///
3095/// ```test_harness,no_run
3096/// # extern crate hyper;
3097/// # extern crate hyper_rustls;
3098/// # extern crate google_tagmanager1 as tagmanager1;
3099/// # async fn dox() {
3100/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3101///
3102/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3103/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3104/// #     .with_native_roots()
3105/// #     .unwrap()
3106/// #     .https_only()
3107/// #     .enable_http2()
3108/// #     .build();
3109///
3110/// # let executor = hyper_util::rt::TokioExecutor::new();
3111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3112/// #     secret,
3113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3114/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3115/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3116/// #     ),
3117/// # ).build().await.unwrap();
3118///
3119/// # let client = hyper_util::client::legacy::Client::builder(
3120/// #     hyper_util::rt::TokioExecutor::new()
3121/// # )
3122/// # .build(
3123/// #     hyper_rustls::HttpsConnectorBuilder::new()
3124/// #         .with_native_roots()
3125/// #         .unwrap()
3126/// #         .https_or_http()
3127/// #         .enable_http2()
3128/// #         .build()
3129/// # );
3130/// # let mut hub = TagManager::new(client, auth);
3131/// // You can configure optional parameters by calling the respective setters at will, and
3132/// // execute the final call using `doit()`.
3133/// // Values shown here are possibly random and not representative !
3134/// let result = hub.accounts().containers_environments_get("accountId", "containerId", "environmentId")
3135///              .doit().await;
3136/// # }
3137/// ```
3138pub struct AccountContainerEnvironmentGetCall<'a, C>
3139where
3140    C: 'a,
3141{
3142    hub: &'a TagManager<C>,
3143    _account_id: String,
3144    _container_id: String,
3145    _environment_id: String,
3146    _delegate: Option<&'a mut dyn common::Delegate>,
3147    _additional_params: HashMap<String, String>,
3148    _scopes: BTreeSet<String>,
3149}
3150
3151impl<'a, C> common::CallBuilder for AccountContainerEnvironmentGetCall<'a, C> {}
3152
3153impl<'a, C> AccountContainerEnvironmentGetCall<'a, C>
3154where
3155    C: common::Connector,
3156{
3157    /// Perform the operation you have build so far.
3158    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
3159        use std::borrow::Cow;
3160        use std::io::{Read, Seek};
3161
3162        use common::{url::Params, ToParts};
3163        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3164
3165        let mut dd = common::DefaultDelegate;
3166        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3167        dlg.begin(common::MethodInfo {
3168            id: "tagmanager.accounts.containers.environments.get",
3169            http_method: hyper::Method::GET,
3170        });
3171
3172        for &field in ["alt", "accountId", "containerId", "environmentId"].iter() {
3173            if self._additional_params.contains_key(field) {
3174                dlg.finished(false);
3175                return Err(common::Error::FieldClash(field));
3176            }
3177        }
3178
3179        let mut params = Params::with_capacity(5 + self._additional_params.len());
3180        params.push("accountId", self._account_id);
3181        params.push("containerId", self._container_id);
3182        params.push("environmentId", self._environment_id);
3183
3184        params.extend(self._additional_params.iter());
3185
3186        params.push("alt", "json");
3187        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/environments/{environmentId}";
3188        if self._scopes.is_empty() {
3189            self._scopes.insert(Scope::Readonly.as_ref().to_string());
3190        }
3191
3192        #[allow(clippy::single_element_loop)]
3193        for &(find_this, param_name) in [
3194            ("{accountId}", "accountId"),
3195            ("{containerId}", "containerId"),
3196            ("{environmentId}", "environmentId"),
3197        ]
3198        .iter()
3199        {
3200            url = params.uri_replacement(url, param_name, find_this, false);
3201        }
3202        {
3203            let to_remove = ["environmentId", "containerId", "accountId"];
3204            params.remove_params(&to_remove);
3205        }
3206
3207        let url = params.parse_with_url(&url);
3208
3209        loop {
3210            let token = match self
3211                .hub
3212                .auth
3213                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3214                .await
3215            {
3216                Ok(token) => token,
3217                Err(e) => match dlg.token(e) {
3218                    Ok(token) => token,
3219                    Err(e) => {
3220                        dlg.finished(false);
3221                        return Err(common::Error::MissingToken(e));
3222                    }
3223                },
3224            };
3225            let mut req_result = {
3226                let client = &self.hub.client;
3227                dlg.pre_request();
3228                let mut req_builder = hyper::Request::builder()
3229                    .method(hyper::Method::GET)
3230                    .uri(url.as_str())
3231                    .header(USER_AGENT, self.hub._user_agent.clone());
3232
3233                if let Some(token) = token.as_ref() {
3234                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3235                }
3236
3237                let request = req_builder
3238                    .header(CONTENT_LENGTH, 0_u64)
3239                    .body(common::to_body::<String>(None));
3240
3241                client.request(request.unwrap()).await
3242            };
3243
3244            match req_result {
3245                Err(err) => {
3246                    if let common::Retry::After(d) = dlg.http_error(&err) {
3247                        sleep(d).await;
3248                        continue;
3249                    }
3250                    dlg.finished(false);
3251                    return Err(common::Error::HttpError(err));
3252                }
3253                Ok(res) => {
3254                    let (mut parts, body) = res.into_parts();
3255                    let mut body = common::Body::new(body);
3256                    if !parts.status.is_success() {
3257                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3258                        let error = serde_json::from_str(&common::to_string(&bytes));
3259                        let response = common::to_response(parts, bytes.into());
3260
3261                        if let common::Retry::After(d) =
3262                            dlg.http_failure(&response, error.as_ref().ok())
3263                        {
3264                            sleep(d).await;
3265                            continue;
3266                        }
3267
3268                        dlg.finished(false);
3269
3270                        return Err(match error {
3271                            Ok(value) => common::Error::BadRequest(value),
3272                            _ => common::Error::Failure(response),
3273                        });
3274                    }
3275                    let response = {
3276                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3277                        let encoded = common::to_string(&bytes);
3278                        match serde_json::from_str(&encoded) {
3279                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3280                            Err(error) => {
3281                                dlg.response_json_decode_error(&encoded, &error);
3282                                return Err(common::Error::JsonDecodeError(
3283                                    encoded.to_string(),
3284                                    error,
3285                                ));
3286                            }
3287                        }
3288                    };
3289
3290                    dlg.finished(true);
3291                    return Ok(response);
3292                }
3293            }
3294        }
3295    }
3296
3297    /// The GTM Account ID.
3298    ///
3299    /// Sets the *account id* path property to the given value.
3300    ///
3301    /// Even though the property as already been set when instantiating this call,
3302    /// we provide this method for API completeness.
3303    pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C> {
3304        self._account_id = new_value.to_string();
3305        self
3306    }
3307    /// The GTM Container ID.
3308    ///
3309    /// Sets the *container id* path property to the given value.
3310    ///
3311    /// Even though the property as already been set when instantiating this call,
3312    /// we provide this method for API completeness.
3313    pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C> {
3314        self._container_id = new_value.to_string();
3315        self
3316    }
3317    /// The GTM Environment ID.
3318    ///
3319    /// Sets the *environment id* path property to the given value.
3320    ///
3321    /// Even though the property as already been set when instantiating this call,
3322    /// we provide this method for API completeness.
3323    pub fn environment_id(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C> {
3324        self._environment_id = new_value.to_string();
3325        self
3326    }
3327    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3328    /// while executing the actual API request.
3329    ///
3330    /// ````text
3331    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3332    /// ````
3333    ///
3334    /// Sets the *delegate* property to the given value.
3335    pub fn delegate(
3336        mut self,
3337        new_value: &'a mut dyn common::Delegate,
3338    ) -> AccountContainerEnvironmentGetCall<'a, C> {
3339        self._delegate = Some(new_value);
3340        self
3341    }
3342
3343    /// Set any additional parameter of the query string used in the request.
3344    /// It should be used to set parameters which are not yet available through their own
3345    /// setters.
3346    ///
3347    /// Please note that this method must not be used to set any of the known parameters
3348    /// which have their own setter method. If done anyway, the request will fail.
3349    ///
3350    /// # Additional Parameters
3351    ///
3352    /// * *$.xgafv* (query-string) - V1 error format.
3353    /// * *access_token* (query-string) - OAuth access token.
3354    /// * *alt* (query-string) - Data format for response.
3355    /// * *callback* (query-string) - JSONP
3356    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3357    /// * *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.
3358    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3359    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3360    /// * *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.
3361    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3362    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3363    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentGetCall<'a, C>
3364    where
3365        T: AsRef<str>,
3366    {
3367        self._additional_params
3368            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3369        self
3370    }
3371
3372    /// Identifies the authorization scope for the method you are building.
3373    ///
3374    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3375    /// [`Scope::Readonly`].
3376    ///
3377    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3378    /// tokens for more than one scope.
3379    ///
3380    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3381    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3382    /// sufficient, a read-write scope will do as well.
3383    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentGetCall<'a, C>
3384    where
3385        St: AsRef<str>,
3386    {
3387        self._scopes.insert(String::from(scope.as_ref()));
3388        self
3389    }
3390    /// Identifies the authorization scope(s) for the method you are building.
3391    ///
3392    /// See [`Self::add_scope()`] for details.
3393    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentGetCall<'a, C>
3394    where
3395        I: IntoIterator<Item = St>,
3396        St: AsRef<str>,
3397    {
3398        self._scopes
3399            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3400        self
3401    }
3402
3403    /// Removes all scopes, and no default scope will be used either.
3404    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3405    /// for details).
3406    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentGetCall<'a, C> {
3407        self._scopes.clear();
3408        self
3409    }
3410}
3411
3412/// Lists all GTM Environments of a GTM Container.
3413///
3414/// A builder for the *containers.environments.list* method supported by a *account* resource.
3415/// It is not used directly, but through a [`AccountMethods`] instance.
3416///
3417/// # Example
3418///
3419/// Instantiate a resource method builder
3420///
3421/// ```test_harness,no_run
3422/// # extern crate hyper;
3423/// # extern crate hyper_rustls;
3424/// # extern crate google_tagmanager1 as tagmanager1;
3425/// # async fn dox() {
3426/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3427///
3428/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3429/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3430/// #     .with_native_roots()
3431/// #     .unwrap()
3432/// #     .https_only()
3433/// #     .enable_http2()
3434/// #     .build();
3435///
3436/// # let executor = hyper_util::rt::TokioExecutor::new();
3437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3438/// #     secret,
3439/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3440/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3441/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3442/// #     ),
3443/// # ).build().await.unwrap();
3444///
3445/// # let client = hyper_util::client::legacy::Client::builder(
3446/// #     hyper_util::rt::TokioExecutor::new()
3447/// # )
3448/// # .build(
3449/// #     hyper_rustls::HttpsConnectorBuilder::new()
3450/// #         .with_native_roots()
3451/// #         .unwrap()
3452/// #         .https_or_http()
3453/// #         .enable_http2()
3454/// #         .build()
3455/// # );
3456/// # let mut hub = TagManager::new(client, auth);
3457/// // You can configure optional parameters by calling the respective setters at will, and
3458/// // execute the final call using `doit()`.
3459/// // Values shown here are possibly random and not representative !
3460/// let result = hub.accounts().containers_environments_list("accountId", "containerId")
3461///              .doit().await;
3462/// # }
3463/// ```
3464pub struct AccountContainerEnvironmentListCall<'a, C>
3465where
3466    C: 'a,
3467{
3468    hub: &'a TagManager<C>,
3469    _account_id: String,
3470    _container_id: String,
3471    _delegate: Option<&'a mut dyn common::Delegate>,
3472    _additional_params: HashMap<String, String>,
3473    _scopes: BTreeSet<String>,
3474}
3475
3476impl<'a, C> common::CallBuilder for AccountContainerEnvironmentListCall<'a, C> {}
3477
3478impl<'a, C> AccountContainerEnvironmentListCall<'a, C>
3479where
3480    C: common::Connector,
3481{
3482    /// Perform the operation you have build so far.
3483    pub async fn doit(mut self) -> common::Result<(common::Response, ListEnvironmentsResponse)> {
3484        use std::borrow::Cow;
3485        use std::io::{Read, Seek};
3486
3487        use common::{url::Params, ToParts};
3488        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3489
3490        let mut dd = common::DefaultDelegate;
3491        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3492        dlg.begin(common::MethodInfo {
3493            id: "tagmanager.accounts.containers.environments.list",
3494            http_method: hyper::Method::GET,
3495        });
3496
3497        for &field in ["alt", "accountId", "containerId"].iter() {
3498            if self._additional_params.contains_key(field) {
3499                dlg.finished(false);
3500                return Err(common::Error::FieldClash(field));
3501            }
3502        }
3503
3504        let mut params = Params::with_capacity(4 + self._additional_params.len());
3505        params.push("accountId", self._account_id);
3506        params.push("containerId", self._container_id);
3507
3508        params.extend(self._additional_params.iter());
3509
3510        params.push("alt", "json");
3511        let mut url = self.hub._base_url.clone()
3512            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/environments";
3513        if self._scopes.is_empty() {
3514            self._scopes.insert(Scope::Readonly.as_ref().to_string());
3515        }
3516
3517        #[allow(clippy::single_element_loop)]
3518        for &(find_this, param_name) in [
3519            ("{accountId}", "accountId"),
3520            ("{containerId}", "containerId"),
3521        ]
3522        .iter()
3523        {
3524            url = params.uri_replacement(url, param_name, find_this, false);
3525        }
3526        {
3527            let to_remove = ["containerId", "accountId"];
3528            params.remove_params(&to_remove);
3529        }
3530
3531        let url = params.parse_with_url(&url);
3532
3533        loop {
3534            let token = match self
3535                .hub
3536                .auth
3537                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3538                .await
3539            {
3540                Ok(token) => token,
3541                Err(e) => match dlg.token(e) {
3542                    Ok(token) => token,
3543                    Err(e) => {
3544                        dlg.finished(false);
3545                        return Err(common::Error::MissingToken(e));
3546                    }
3547                },
3548            };
3549            let mut req_result = {
3550                let client = &self.hub.client;
3551                dlg.pre_request();
3552                let mut req_builder = hyper::Request::builder()
3553                    .method(hyper::Method::GET)
3554                    .uri(url.as_str())
3555                    .header(USER_AGENT, self.hub._user_agent.clone());
3556
3557                if let Some(token) = token.as_ref() {
3558                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3559                }
3560
3561                let request = req_builder
3562                    .header(CONTENT_LENGTH, 0_u64)
3563                    .body(common::to_body::<String>(None));
3564
3565                client.request(request.unwrap()).await
3566            };
3567
3568            match req_result {
3569                Err(err) => {
3570                    if let common::Retry::After(d) = dlg.http_error(&err) {
3571                        sleep(d).await;
3572                        continue;
3573                    }
3574                    dlg.finished(false);
3575                    return Err(common::Error::HttpError(err));
3576                }
3577                Ok(res) => {
3578                    let (mut parts, body) = res.into_parts();
3579                    let mut body = common::Body::new(body);
3580                    if !parts.status.is_success() {
3581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3582                        let error = serde_json::from_str(&common::to_string(&bytes));
3583                        let response = common::to_response(parts, bytes.into());
3584
3585                        if let common::Retry::After(d) =
3586                            dlg.http_failure(&response, error.as_ref().ok())
3587                        {
3588                            sleep(d).await;
3589                            continue;
3590                        }
3591
3592                        dlg.finished(false);
3593
3594                        return Err(match error {
3595                            Ok(value) => common::Error::BadRequest(value),
3596                            _ => common::Error::Failure(response),
3597                        });
3598                    }
3599                    let response = {
3600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3601                        let encoded = common::to_string(&bytes);
3602                        match serde_json::from_str(&encoded) {
3603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3604                            Err(error) => {
3605                                dlg.response_json_decode_error(&encoded, &error);
3606                                return Err(common::Error::JsonDecodeError(
3607                                    encoded.to_string(),
3608                                    error,
3609                                ));
3610                            }
3611                        }
3612                    };
3613
3614                    dlg.finished(true);
3615                    return Ok(response);
3616                }
3617            }
3618        }
3619    }
3620
3621    /// The GTM Account ID.
3622    ///
3623    /// Sets the *account id* path property to the given value.
3624    ///
3625    /// Even though the property as already been set when instantiating this call,
3626    /// we provide this method for API completeness.
3627    pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
3628        self._account_id = new_value.to_string();
3629        self
3630    }
3631    /// The GTM Container ID.
3632    ///
3633    /// Sets the *container id* path property to the given value.
3634    ///
3635    /// Even though the property as already been set when instantiating this call,
3636    /// we provide this method for API completeness.
3637    pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
3638        self._container_id = new_value.to_string();
3639        self
3640    }
3641    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3642    /// while executing the actual API request.
3643    ///
3644    /// ````text
3645    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3646    /// ````
3647    ///
3648    /// Sets the *delegate* property to the given value.
3649    pub fn delegate(
3650        mut self,
3651        new_value: &'a mut dyn common::Delegate,
3652    ) -> AccountContainerEnvironmentListCall<'a, C> {
3653        self._delegate = Some(new_value);
3654        self
3655    }
3656
3657    /// Set any additional parameter of the query string used in the request.
3658    /// It should be used to set parameters which are not yet available through their own
3659    /// setters.
3660    ///
3661    /// Please note that this method must not be used to set any of the known parameters
3662    /// which have their own setter method. If done anyway, the request will fail.
3663    ///
3664    /// # Additional Parameters
3665    ///
3666    /// * *$.xgafv* (query-string) - V1 error format.
3667    /// * *access_token* (query-string) - OAuth access token.
3668    /// * *alt* (query-string) - Data format for response.
3669    /// * *callback* (query-string) - JSONP
3670    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3671    /// * *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.
3672    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3673    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3674    /// * *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.
3675    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3676    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3677    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentListCall<'a, C>
3678    where
3679        T: AsRef<str>,
3680    {
3681        self._additional_params
3682            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3683        self
3684    }
3685
3686    /// Identifies the authorization scope for the method you are building.
3687    ///
3688    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3689    /// [`Scope::Readonly`].
3690    ///
3691    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3692    /// tokens for more than one scope.
3693    ///
3694    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3695    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3696    /// sufficient, a read-write scope will do as well.
3697    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentListCall<'a, C>
3698    where
3699        St: AsRef<str>,
3700    {
3701        self._scopes.insert(String::from(scope.as_ref()));
3702        self
3703    }
3704    /// Identifies the authorization scope(s) for the method you are building.
3705    ///
3706    /// See [`Self::add_scope()`] for details.
3707    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentListCall<'a, C>
3708    where
3709        I: IntoIterator<Item = St>,
3710        St: AsRef<str>,
3711    {
3712        self._scopes
3713            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3714        self
3715    }
3716
3717    /// Removes all scopes, and no default scope will be used either.
3718    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3719    /// for details).
3720    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentListCall<'a, C> {
3721        self._scopes.clear();
3722        self
3723    }
3724}
3725
3726/// Updates a GTM Environment.
3727///
3728/// A builder for the *containers.environments.update* method supported by a *account* resource.
3729/// It is not used directly, but through a [`AccountMethods`] instance.
3730///
3731/// # Example
3732///
3733/// Instantiate a resource method builder
3734///
3735/// ```test_harness,no_run
3736/// # extern crate hyper;
3737/// # extern crate hyper_rustls;
3738/// # extern crate google_tagmanager1 as tagmanager1;
3739/// use tagmanager1::api::Environment;
3740/// # async fn dox() {
3741/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3742///
3743/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3744/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3745/// #     .with_native_roots()
3746/// #     .unwrap()
3747/// #     .https_only()
3748/// #     .enable_http2()
3749/// #     .build();
3750///
3751/// # let executor = hyper_util::rt::TokioExecutor::new();
3752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3753/// #     secret,
3754/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3755/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3756/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3757/// #     ),
3758/// # ).build().await.unwrap();
3759///
3760/// # let client = hyper_util::client::legacy::Client::builder(
3761/// #     hyper_util::rt::TokioExecutor::new()
3762/// # )
3763/// # .build(
3764/// #     hyper_rustls::HttpsConnectorBuilder::new()
3765/// #         .with_native_roots()
3766/// #         .unwrap()
3767/// #         .https_or_http()
3768/// #         .enable_http2()
3769/// #         .build()
3770/// # );
3771/// # let mut hub = TagManager::new(client, auth);
3772/// // As the method needs a request, you would usually fill it with the desired information
3773/// // into the respective structure. Some of the parts shown here might not be applicable !
3774/// // Values shown here are possibly random and not representative !
3775/// let mut req = Environment::default();
3776///
3777/// // You can configure optional parameters by calling the respective setters at will, and
3778/// // execute the final call using `doit()`.
3779/// // Values shown here are possibly random and not representative !
3780/// let result = hub.accounts().containers_environments_update(req, "accountId", "containerId", "environmentId")
3781///              .fingerprint("est")
3782///              .doit().await;
3783/// # }
3784/// ```
3785pub struct AccountContainerEnvironmentUpdateCall<'a, C>
3786where
3787    C: 'a,
3788{
3789    hub: &'a TagManager<C>,
3790    _request: Environment,
3791    _account_id: String,
3792    _container_id: String,
3793    _environment_id: String,
3794    _fingerprint: Option<String>,
3795    _delegate: Option<&'a mut dyn common::Delegate>,
3796    _additional_params: HashMap<String, String>,
3797    _scopes: BTreeSet<String>,
3798}
3799
3800impl<'a, C> common::CallBuilder for AccountContainerEnvironmentUpdateCall<'a, C> {}
3801
3802impl<'a, C> AccountContainerEnvironmentUpdateCall<'a, C>
3803where
3804    C: common::Connector,
3805{
3806    /// Perform the operation you have build so far.
3807    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
3808        use std::borrow::Cow;
3809        use std::io::{Read, Seek};
3810
3811        use common::{url::Params, ToParts};
3812        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3813
3814        let mut dd = common::DefaultDelegate;
3815        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3816        dlg.begin(common::MethodInfo {
3817            id: "tagmanager.accounts.containers.environments.update",
3818            http_method: hyper::Method::PUT,
3819        });
3820
3821        for &field in [
3822            "alt",
3823            "accountId",
3824            "containerId",
3825            "environmentId",
3826            "fingerprint",
3827        ]
3828        .iter()
3829        {
3830            if self._additional_params.contains_key(field) {
3831                dlg.finished(false);
3832                return Err(common::Error::FieldClash(field));
3833            }
3834        }
3835
3836        let mut params = Params::with_capacity(7 + self._additional_params.len());
3837        params.push("accountId", self._account_id);
3838        params.push("containerId", self._container_id);
3839        params.push("environmentId", self._environment_id);
3840        if let Some(value) = self._fingerprint.as_ref() {
3841            params.push("fingerprint", value);
3842        }
3843
3844        params.extend(self._additional_params.iter());
3845
3846        params.push("alt", "json");
3847        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/environments/{environmentId}";
3848        if self._scopes.is_empty() {
3849            self._scopes
3850                .insert(Scope::EditContainer.as_ref().to_string());
3851        }
3852
3853        #[allow(clippy::single_element_loop)]
3854        for &(find_this, param_name) in [
3855            ("{accountId}", "accountId"),
3856            ("{containerId}", "containerId"),
3857            ("{environmentId}", "environmentId"),
3858        ]
3859        .iter()
3860        {
3861            url = params.uri_replacement(url, param_name, find_this, false);
3862        }
3863        {
3864            let to_remove = ["environmentId", "containerId", "accountId"];
3865            params.remove_params(&to_remove);
3866        }
3867
3868        let url = params.parse_with_url(&url);
3869
3870        let mut json_mime_type = mime::APPLICATION_JSON;
3871        let mut request_value_reader = {
3872            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3873            common::remove_json_null_values(&mut value);
3874            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3875            serde_json::to_writer(&mut dst, &value).unwrap();
3876            dst
3877        };
3878        let request_size = request_value_reader
3879            .seek(std::io::SeekFrom::End(0))
3880            .unwrap();
3881        request_value_reader
3882            .seek(std::io::SeekFrom::Start(0))
3883            .unwrap();
3884
3885        loop {
3886            let token = match self
3887                .hub
3888                .auth
3889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3890                .await
3891            {
3892                Ok(token) => token,
3893                Err(e) => match dlg.token(e) {
3894                    Ok(token) => token,
3895                    Err(e) => {
3896                        dlg.finished(false);
3897                        return Err(common::Error::MissingToken(e));
3898                    }
3899                },
3900            };
3901            request_value_reader
3902                .seek(std::io::SeekFrom::Start(0))
3903                .unwrap();
3904            let mut req_result = {
3905                let client = &self.hub.client;
3906                dlg.pre_request();
3907                let mut req_builder = hyper::Request::builder()
3908                    .method(hyper::Method::PUT)
3909                    .uri(url.as_str())
3910                    .header(USER_AGENT, self.hub._user_agent.clone());
3911
3912                if let Some(token) = token.as_ref() {
3913                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3914                }
3915
3916                let request = req_builder
3917                    .header(CONTENT_TYPE, json_mime_type.to_string())
3918                    .header(CONTENT_LENGTH, request_size as u64)
3919                    .body(common::to_body(
3920                        request_value_reader.get_ref().clone().into(),
3921                    ));
3922
3923                client.request(request.unwrap()).await
3924            };
3925
3926            match req_result {
3927                Err(err) => {
3928                    if let common::Retry::After(d) = dlg.http_error(&err) {
3929                        sleep(d).await;
3930                        continue;
3931                    }
3932                    dlg.finished(false);
3933                    return Err(common::Error::HttpError(err));
3934                }
3935                Ok(res) => {
3936                    let (mut parts, body) = res.into_parts();
3937                    let mut body = common::Body::new(body);
3938                    if !parts.status.is_success() {
3939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3940                        let error = serde_json::from_str(&common::to_string(&bytes));
3941                        let response = common::to_response(parts, bytes.into());
3942
3943                        if let common::Retry::After(d) =
3944                            dlg.http_failure(&response, error.as_ref().ok())
3945                        {
3946                            sleep(d).await;
3947                            continue;
3948                        }
3949
3950                        dlg.finished(false);
3951
3952                        return Err(match error {
3953                            Ok(value) => common::Error::BadRequest(value),
3954                            _ => common::Error::Failure(response),
3955                        });
3956                    }
3957                    let response = {
3958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3959                        let encoded = common::to_string(&bytes);
3960                        match serde_json::from_str(&encoded) {
3961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3962                            Err(error) => {
3963                                dlg.response_json_decode_error(&encoded, &error);
3964                                return Err(common::Error::JsonDecodeError(
3965                                    encoded.to_string(),
3966                                    error,
3967                                ));
3968                            }
3969                        }
3970                    };
3971
3972                    dlg.finished(true);
3973                    return Ok(response);
3974                }
3975            }
3976        }
3977    }
3978
3979    ///
3980    /// Sets the *request* property to the given value.
3981    ///
3982    /// Even though the property as already been set when instantiating this call,
3983    /// we provide this method for API completeness.
3984    pub fn request(
3985        mut self,
3986        new_value: Environment,
3987    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
3988        self._request = new_value;
3989        self
3990    }
3991    /// The GTM Account ID.
3992    ///
3993    /// Sets the *account id* path property to the given value.
3994    ///
3995    /// Even though the property as already been set when instantiating this call,
3996    /// we provide this method for API completeness.
3997    pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
3998        self._account_id = new_value.to_string();
3999        self
4000    }
4001    /// The GTM Container ID.
4002    ///
4003    /// Sets the *container id* path property to the given value.
4004    ///
4005    /// Even though the property as already been set when instantiating this call,
4006    /// we provide this method for API completeness.
4007    pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
4008        self._container_id = new_value.to_string();
4009        self
4010    }
4011    /// The GTM Environment ID.
4012    ///
4013    /// Sets the *environment id* path property to the given value.
4014    ///
4015    /// Even though the property as already been set when instantiating this call,
4016    /// we provide this method for API completeness.
4017    pub fn environment_id(
4018        mut self,
4019        new_value: &str,
4020    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
4021        self._environment_id = new_value.to_string();
4022        self
4023    }
4024    /// When provided, this fingerprint must match the fingerprint of the environment in storage.
4025    ///
4026    /// Sets the *fingerprint* query property to the given value.
4027    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
4028        self._fingerprint = Some(new_value.to_string());
4029        self
4030    }
4031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4032    /// while executing the actual API request.
4033    ///
4034    /// ````text
4035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4036    /// ````
4037    ///
4038    /// Sets the *delegate* property to the given value.
4039    pub fn delegate(
4040        mut self,
4041        new_value: &'a mut dyn common::Delegate,
4042    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
4043        self._delegate = Some(new_value);
4044        self
4045    }
4046
4047    /// Set any additional parameter of the query string used in the request.
4048    /// It should be used to set parameters which are not yet available through their own
4049    /// setters.
4050    ///
4051    /// Please note that this method must not be used to set any of the known parameters
4052    /// which have their own setter method. If done anyway, the request will fail.
4053    ///
4054    /// # Additional Parameters
4055    ///
4056    /// * *$.xgafv* (query-string) - V1 error format.
4057    /// * *access_token* (query-string) - OAuth access token.
4058    /// * *alt* (query-string) - Data format for response.
4059    /// * *callback* (query-string) - JSONP
4060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4061    /// * *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.
4062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4064    /// * *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.
4065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4067    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentUpdateCall<'a, C>
4068    where
4069        T: AsRef<str>,
4070    {
4071        self._additional_params
4072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4073        self
4074    }
4075
4076    /// Identifies the authorization scope for the method you are building.
4077    ///
4078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4079    /// [`Scope::EditContainer`].
4080    ///
4081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4082    /// tokens for more than one scope.
4083    ///
4084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4086    /// sufficient, a read-write scope will do as well.
4087    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentUpdateCall<'a, C>
4088    where
4089        St: AsRef<str>,
4090    {
4091        self._scopes.insert(String::from(scope.as_ref()));
4092        self
4093    }
4094    /// Identifies the authorization scope(s) for the method you are building.
4095    ///
4096    /// See [`Self::add_scope()`] for details.
4097    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentUpdateCall<'a, C>
4098    where
4099        I: IntoIterator<Item = St>,
4100        St: AsRef<str>,
4101    {
4102        self._scopes
4103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4104        self
4105    }
4106
4107    /// Removes all scopes, and no default scope will be used either.
4108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4109    /// for details).
4110    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentUpdateCall<'a, C> {
4111        self._scopes.clear();
4112        self
4113    }
4114}
4115
4116/// List all entities in a GTM Folder.
4117///
4118/// A builder for the *containers.folders.entities.list* method supported by a *account* resource.
4119/// It is not used directly, but through a [`AccountMethods`] instance.
4120///
4121/// # Example
4122///
4123/// Instantiate a resource method builder
4124///
4125/// ```test_harness,no_run
4126/// # extern crate hyper;
4127/// # extern crate hyper_rustls;
4128/// # extern crate google_tagmanager1 as tagmanager1;
4129/// # async fn dox() {
4130/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4131///
4132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4133/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4134/// #     .with_native_roots()
4135/// #     .unwrap()
4136/// #     .https_only()
4137/// #     .enable_http2()
4138/// #     .build();
4139///
4140/// # let executor = hyper_util::rt::TokioExecutor::new();
4141/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4142/// #     secret,
4143/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4144/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4145/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4146/// #     ),
4147/// # ).build().await.unwrap();
4148///
4149/// # let client = hyper_util::client::legacy::Client::builder(
4150/// #     hyper_util::rt::TokioExecutor::new()
4151/// # )
4152/// # .build(
4153/// #     hyper_rustls::HttpsConnectorBuilder::new()
4154/// #         .with_native_roots()
4155/// #         .unwrap()
4156/// #         .https_or_http()
4157/// #         .enable_http2()
4158/// #         .build()
4159/// # );
4160/// # let mut hub = TagManager::new(client, auth);
4161/// // You can configure optional parameters by calling the respective setters at will, and
4162/// // execute the final call using `doit()`.
4163/// // Values shown here are possibly random and not representative !
4164/// let result = hub.accounts().containers_folders_entities_list("accountId", "containerId", "folderId")
4165///              .doit().await;
4166/// # }
4167/// ```
4168pub struct AccountContainerFolderEntityListCall<'a, C>
4169where
4170    C: 'a,
4171{
4172    hub: &'a TagManager<C>,
4173    _account_id: String,
4174    _container_id: String,
4175    _folder_id: String,
4176    _delegate: Option<&'a mut dyn common::Delegate>,
4177    _additional_params: HashMap<String, String>,
4178    _scopes: BTreeSet<String>,
4179}
4180
4181impl<'a, C> common::CallBuilder for AccountContainerFolderEntityListCall<'a, C> {}
4182
4183impl<'a, C> AccountContainerFolderEntityListCall<'a, C>
4184where
4185    C: common::Connector,
4186{
4187    /// Perform the operation you have build so far.
4188    pub async fn doit(mut self) -> common::Result<(common::Response, FolderEntities)> {
4189        use std::borrow::Cow;
4190        use std::io::{Read, Seek};
4191
4192        use common::{url::Params, ToParts};
4193        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4194
4195        let mut dd = common::DefaultDelegate;
4196        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4197        dlg.begin(common::MethodInfo {
4198            id: "tagmanager.accounts.containers.folders.entities.list",
4199            http_method: hyper::Method::GET,
4200        });
4201
4202        for &field in ["alt", "accountId", "containerId", "folderId"].iter() {
4203            if self._additional_params.contains_key(field) {
4204                dlg.finished(false);
4205                return Err(common::Error::FieldClash(field));
4206            }
4207        }
4208
4209        let mut params = Params::with_capacity(5 + self._additional_params.len());
4210        params.push("accountId", self._account_id);
4211        params.push("containerId", self._container_id);
4212        params.push("folderId", self._folder_id);
4213
4214        params.extend(self._additional_params.iter());
4215
4216        params.push("alt", "json");
4217        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders/{folderId}/entities";
4218        if self._scopes.is_empty() {
4219            self._scopes.insert(Scope::Readonly.as_ref().to_string());
4220        }
4221
4222        #[allow(clippy::single_element_loop)]
4223        for &(find_this, param_name) in [
4224            ("{accountId}", "accountId"),
4225            ("{containerId}", "containerId"),
4226            ("{folderId}", "folderId"),
4227        ]
4228        .iter()
4229        {
4230            url = params.uri_replacement(url, param_name, find_this, false);
4231        }
4232        {
4233            let to_remove = ["folderId", "containerId", "accountId"];
4234            params.remove_params(&to_remove);
4235        }
4236
4237        let url = params.parse_with_url(&url);
4238
4239        loop {
4240            let token = match self
4241                .hub
4242                .auth
4243                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4244                .await
4245            {
4246                Ok(token) => token,
4247                Err(e) => match dlg.token(e) {
4248                    Ok(token) => token,
4249                    Err(e) => {
4250                        dlg.finished(false);
4251                        return Err(common::Error::MissingToken(e));
4252                    }
4253                },
4254            };
4255            let mut req_result = {
4256                let client = &self.hub.client;
4257                dlg.pre_request();
4258                let mut req_builder = hyper::Request::builder()
4259                    .method(hyper::Method::GET)
4260                    .uri(url.as_str())
4261                    .header(USER_AGENT, self.hub._user_agent.clone());
4262
4263                if let Some(token) = token.as_ref() {
4264                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4265                }
4266
4267                let request = req_builder
4268                    .header(CONTENT_LENGTH, 0_u64)
4269                    .body(common::to_body::<String>(None));
4270
4271                client.request(request.unwrap()).await
4272            };
4273
4274            match req_result {
4275                Err(err) => {
4276                    if let common::Retry::After(d) = dlg.http_error(&err) {
4277                        sleep(d).await;
4278                        continue;
4279                    }
4280                    dlg.finished(false);
4281                    return Err(common::Error::HttpError(err));
4282                }
4283                Ok(res) => {
4284                    let (mut parts, body) = res.into_parts();
4285                    let mut body = common::Body::new(body);
4286                    if !parts.status.is_success() {
4287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4288                        let error = serde_json::from_str(&common::to_string(&bytes));
4289                        let response = common::to_response(parts, bytes.into());
4290
4291                        if let common::Retry::After(d) =
4292                            dlg.http_failure(&response, error.as_ref().ok())
4293                        {
4294                            sleep(d).await;
4295                            continue;
4296                        }
4297
4298                        dlg.finished(false);
4299
4300                        return Err(match error {
4301                            Ok(value) => common::Error::BadRequest(value),
4302                            _ => common::Error::Failure(response),
4303                        });
4304                    }
4305                    let response = {
4306                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4307                        let encoded = common::to_string(&bytes);
4308                        match serde_json::from_str(&encoded) {
4309                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4310                            Err(error) => {
4311                                dlg.response_json_decode_error(&encoded, &error);
4312                                return Err(common::Error::JsonDecodeError(
4313                                    encoded.to_string(),
4314                                    error,
4315                                ));
4316                            }
4317                        }
4318                    };
4319
4320                    dlg.finished(true);
4321                    return Ok(response);
4322                }
4323            }
4324        }
4325    }
4326
4327    /// The GTM Account ID.
4328    ///
4329    /// Sets the *account id* path property to the given value.
4330    ///
4331    /// Even though the property as already been set when instantiating this call,
4332    /// we provide this method for API completeness.
4333    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C> {
4334        self._account_id = new_value.to_string();
4335        self
4336    }
4337    /// The GTM Container ID.
4338    ///
4339    /// Sets the *container id* path property to the given value.
4340    ///
4341    /// Even though the property as already been set when instantiating this call,
4342    /// we provide this method for API completeness.
4343    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C> {
4344        self._container_id = new_value.to_string();
4345        self
4346    }
4347    /// The GTM Folder ID.
4348    ///
4349    /// Sets the *folder id* path property to the given value.
4350    ///
4351    /// Even though the property as already been set when instantiating this call,
4352    /// we provide this method for API completeness.
4353    pub fn folder_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C> {
4354        self._folder_id = new_value.to_string();
4355        self
4356    }
4357    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4358    /// while executing the actual API request.
4359    ///
4360    /// ````text
4361    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4362    /// ````
4363    ///
4364    /// Sets the *delegate* property to the given value.
4365    pub fn delegate(
4366        mut self,
4367        new_value: &'a mut dyn common::Delegate,
4368    ) -> AccountContainerFolderEntityListCall<'a, C> {
4369        self._delegate = Some(new_value);
4370        self
4371    }
4372
4373    /// Set any additional parameter of the query string used in the request.
4374    /// It should be used to set parameters which are not yet available through their own
4375    /// setters.
4376    ///
4377    /// Please note that this method must not be used to set any of the known parameters
4378    /// which have their own setter method. If done anyway, the request will fail.
4379    ///
4380    /// # Additional Parameters
4381    ///
4382    /// * *$.xgafv* (query-string) - V1 error format.
4383    /// * *access_token* (query-string) - OAuth access token.
4384    /// * *alt* (query-string) - Data format for response.
4385    /// * *callback* (query-string) - JSONP
4386    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4387    /// * *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.
4388    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4389    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4390    /// * *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.
4391    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4392    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4393    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderEntityListCall<'a, C>
4394    where
4395        T: AsRef<str>,
4396    {
4397        self._additional_params
4398            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4399        self
4400    }
4401
4402    /// Identifies the authorization scope for the method you are building.
4403    ///
4404    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4405    /// [`Scope::Readonly`].
4406    ///
4407    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4408    /// tokens for more than one scope.
4409    ///
4410    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4411    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4412    /// sufficient, a read-write scope will do as well.
4413    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderEntityListCall<'a, C>
4414    where
4415        St: AsRef<str>,
4416    {
4417        self._scopes.insert(String::from(scope.as_ref()));
4418        self
4419    }
4420    /// Identifies the authorization scope(s) for the method you are building.
4421    ///
4422    /// See [`Self::add_scope()`] for details.
4423    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderEntityListCall<'a, C>
4424    where
4425        I: IntoIterator<Item = St>,
4426        St: AsRef<str>,
4427    {
4428        self._scopes
4429            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4430        self
4431    }
4432
4433    /// Removes all scopes, and no default scope will be used either.
4434    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4435    /// for details).
4436    pub fn clear_scopes(mut self) -> AccountContainerFolderEntityListCall<'a, C> {
4437        self._scopes.clear();
4438        self
4439    }
4440}
4441
4442/// Creates a GTM Folder.
4443///
4444/// A builder for the *containers.folders.create* method supported by a *account* resource.
4445/// It is not used directly, but through a [`AccountMethods`] instance.
4446///
4447/// # Example
4448///
4449/// Instantiate a resource method builder
4450///
4451/// ```test_harness,no_run
4452/// # extern crate hyper;
4453/// # extern crate hyper_rustls;
4454/// # extern crate google_tagmanager1 as tagmanager1;
4455/// use tagmanager1::api::Folder;
4456/// # async fn dox() {
4457/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4458///
4459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4460/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4461/// #     .with_native_roots()
4462/// #     .unwrap()
4463/// #     .https_only()
4464/// #     .enable_http2()
4465/// #     .build();
4466///
4467/// # let executor = hyper_util::rt::TokioExecutor::new();
4468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4469/// #     secret,
4470/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4471/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4472/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4473/// #     ),
4474/// # ).build().await.unwrap();
4475///
4476/// # let client = hyper_util::client::legacy::Client::builder(
4477/// #     hyper_util::rt::TokioExecutor::new()
4478/// # )
4479/// # .build(
4480/// #     hyper_rustls::HttpsConnectorBuilder::new()
4481/// #         .with_native_roots()
4482/// #         .unwrap()
4483/// #         .https_or_http()
4484/// #         .enable_http2()
4485/// #         .build()
4486/// # );
4487/// # let mut hub = TagManager::new(client, auth);
4488/// // As the method needs a request, you would usually fill it with the desired information
4489/// // into the respective structure. Some of the parts shown here might not be applicable !
4490/// // Values shown here are possibly random and not representative !
4491/// let mut req = Folder::default();
4492///
4493/// // You can configure optional parameters by calling the respective setters at will, and
4494/// // execute the final call using `doit()`.
4495/// // Values shown here are possibly random and not representative !
4496/// let result = hub.accounts().containers_folders_create(req, "accountId", "containerId")
4497///              .doit().await;
4498/// # }
4499/// ```
4500pub struct AccountContainerFolderCreateCall<'a, C>
4501where
4502    C: 'a,
4503{
4504    hub: &'a TagManager<C>,
4505    _request: Folder,
4506    _account_id: String,
4507    _container_id: String,
4508    _delegate: Option<&'a mut dyn common::Delegate>,
4509    _additional_params: HashMap<String, String>,
4510    _scopes: BTreeSet<String>,
4511}
4512
4513impl<'a, C> common::CallBuilder for AccountContainerFolderCreateCall<'a, C> {}
4514
4515impl<'a, C> AccountContainerFolderCreateCall<'a, C>
4516where
4517    C: common::Connector,
4518{
4519    /// Perform the operation you have build so far.
4520    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
4521        use std::borrow::Cow;
4522        use std::io::{Read, Seek};
4523
4524        use common::{url::Params, ToParts};
4525        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4526
4527        let mut dd = common::DefaultDelegate;
4528        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4529        dlg.begin(common::MethodInfo {
4530            id: "tagmanager.accounts.containers.folders.create",
4531            http_method: hyper::Method::POST,
4532        });
4533
4534        for &field in ["alt", "accountId", "containerId"].iter() {
4535            if self._additional_params.contains_key(field) {
4536                dlg.finished(false);
4537                return Err(common::Error::FieldClash(field));
4538            }
4539        }
4540
4541        let mut params = Params::with_capacity(5 + self._additional_params.len());
4542        params.push("accountId", self._account_id);
4543        params.push("containerId", self._container_id);
4544
4545        params.extend(self._additional_params.iter());
4546
4547        params.push("alt", "json");
4548        let mut url = self.hub._base_url.clone()
4549            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders";
4550        if self._scopes.is_empty() {
4551            self._scopes
4552                .insert(Scope::EditContainer.as_ref().to_string());
4553        }
4554
4555        #[allow(clippy::single_element_loop)]
4556        for &(find_this, param_name) in [
4557            ("{accountId}", "accountId"),
4558            ("{containerId}", "containerId"),
4559        ]
4560        .iter()
4561        {
4562            url = params.uri_replacement(url, param_name, find_this, false);
4563        }
4564        {
4565            let to_remove = ["containerId", "accountId"];
4566            params.remove_params(&to_remove);
4567        }
4568
4569        let url = params.parse_with_url(&url);
4570
4571        let mut json_mime_type = mime::APPLICATION_JSON;
4572        let mut request_value_reader = {
4573            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4574            common::remove_json_null_values(&mut value);
4575            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4576            serde_json::to_writer(&mut dst, &value).unwrap();
4577            dst
4578        };
4579        let request_size = request_value_reader
4580            .seek(std::io::SeekFrom::End(0))
4581            .unwrap();
4582        request_value_reader
4583            .seek(std::io::SeekFrom::Start(0))
4584            .unwrap();
4585
4586        loop {
4587            let token = match self
4588                .hub
4589                .auth
4590                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4591                .await
4592            {
4593                Ok(token) => token,
4594                Err(e) => match dlg.token(e) {
4595                    Ok(token) => token,
4596                    Err(e) => {
4597                        dlg.finished(false);
4598                        return Err(common::Error::MissingToken(e));
4599                    }
4600                },
4601            };
4602            request_value_reader
4603                .seek(std::io::SeekFrom::Start(0))
4604                .unwrap();
4605            let mut req_result = {
4606                let client = &self.hub.client;
4607                dlg.pre_request();
4608                let mut req_builder = hyper::Request::builder()
4609                    .method(hyper::Method::POST)
4610                    .uri(url.as_str())
4611                    .header(USER_AGENT, self.hub._user_agent.clone());
4612
4613                if let Some(token) = token.as_ref() {
4614                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4615                }
4616
4617                let request = req_builder
4618                    .header(CONTENT_TYPE, json_mime_type.to_string())
4619                    .header(CONTENT_LENGTH, request_size as u64)
4620                    .body(common::to_body(
4621                        request_value_reader.get_ref().clone().into(),
4622                    ));
4623
4624                client.request(request.unwrap()).await
4625            };
4626
4627            match req_result {
4628                Err(err) => {
4629                    if let common::Retry::After(d) = dlg.http_error(&err) {
4630                        sleep(d).await;
4631                        continue;
4632                    }
4633                    dlg.finished(false);
4634                    return Err(common::Error::HttpError(err));
4635                }
4636                Ok(res) => {
4637                    let (mut parts, body) = res.into_parts();
4638                    let mut body = common::Body::new(body);
4639                    if !parts.status.is_success() {
4640                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4641                        let error = serde_json::from_str(&common::to_string(&bytes));
4642                        let response = common::to_response(parts, bytes.into());
4643
4644                        if let common::Retry::After(d) =
4645                            dlg.http_failure(&response, error.as_ref().ok())
4646                        {
4647                            sleep(d).await;
4648                            continue;
4649                        }
4650
4651                        dlg.finished(false);
4652
4653                        return Err(match error {
4654                            Ok(value) => common::Error::BadRequest(value),
4655                            _ => common::Error::Failure(response),
4656                        });
4657                    }
4658                    let response = {
4659                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4660                        let encoded = common::to_string(&bytes);
4661                        match serde_json::from_str(&encoded) {
4662                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4663                            Err(error) => {
4664                                dlg.response_json_decode_error(&encoded, &error);
4665                                return Err(common::Error::JsonDecodeError(
4666                                    encoded.to_string(),
4667                                    error,
4668                                ));
4669                            }
4670                        }
4671                    };
4672
4673                    dlg.finished(true);
4674                    return Ok(response);
4675                }
4676            }
4677        }
4678    }
4679
4680    ///
4681    /// Sets the *request* property to the given value.
4682    ///
4683    /// Even though the property as already been set when instantiating this call,
4684    /// we provide this method for API completeness.
4685    pub fn request(mut self, new_value: Folder) -> AccountContainerFolderCreateCall<'a, C> {
4686        self._request = new_value;
4687        self
4688    }
4689    /// The GTM Account ID.
4690    ///
4691    /// Sets the *account id* path property to the given value.
4692    ///
4693    /// Even though the property as already been set when instantiating this call,
4694    /// we provide this method for API completeness.
4695    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderCreateCall<'a, C> {
4696        self._account_id = new_value.to_string();
4697        self
4698    }
4699    /// The GTM Container ID.
4700    ///
4701    /// Sets the *container id* path property to the given value.
4702    ///
4703    /// Even though the property as already been set when instantiating this call,
4704    /// we provide this method for API completeness.
4705    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderCreateCall<'a, C> {
4706        self._container_id = new_value.to_string();
4707        self
4708    }
4709    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4710    /// while executing the actual API request.
4711    ///
4712    /// ````text
4713    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4714    /// ````
4715    ///
4716    /// Sets the *delegate* property to the given value.
4717    pub fn delegate(
4718        mut self,
4719        new_value: &'a mut dyn common::Delegate,
4720    ) -> AccountContainerFolderCreateCall<'a, C> {
4721        self._delegate = Some(new_value);
4722        self
4723    }
4724
4725    /// Set any additional parameter of the query string used in the request.
4726    /// It should be used to set parameters which are not yet available through their own
4727    /// setters.
4728    ///
4729    /// Please note that this method must not be used to set any of the known parameters
4730    /// which have their own setter method. If done anyway, the request will fail.
4731    ///
4732    /// # Additional Parameters
4733    ///
4734    /// * *$.xgafv* (query-string) - V1 error format.
4735    /// * *access_token* (query-string) - OAuth access token.
4736    /// * *alt* (query-string) - Data format for response.
4737    /// * *callback* (query-string) - JSONP
4738    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4739    /// * *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.
4740    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4741    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4742    /// * *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.
4743    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4744    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4745    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderCreateCall<'a, C>
4746    where
4747        T: AsRef<str>,
4748    {
4749        self._additional_params
4750            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4751        self
4752    }
4753
4754    /// Identifies the authorization scope for the method you are building.
4755    ///
4756    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4757    /// [`Scope::EditContainer`].
4758    ///
4759    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4760    /// tokens for more than one scope.
4761    ///
4762    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4763    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4764    /// sufficient, a read-write scope will do as well.
4765    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderCreateCall<'a, C>
4766    where
4767        St: AsRef<str>,
4768    {
4769        self._scopes.insert(String::from(scope.as_ref()));
4770        self
4771    }
4772    /// Identifies the authorization scope(s) for the method you are building.
4773    ///
4774    /// See [`Self::add_scope()`] for details.
4775    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderCreateCall<'a, C>
4776    where
4777        I: IntoIterator<Item = St>,
4778        St: AsRef<str>,
4779    {
4780        self._scopes
4781            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4782        self
4783    }
4784
4785    /// Removes all scopes, and no default scope will be used either.
4786    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4787    /// for details).
4788    pub fn clear_scopes(mut self) -> AccountContainerFolderCreateCall<'a, C> {
4789        self._scopes.clear();
4790        self
4791    }
4792}
4793
4794/// Deletes a GTM Folder.
4795///
4796/// A builder for the *containers.folders.delete* method supported by a *account* resource.
4797/// It is not used directly, but through a [`AccountMethods`] instance.
4798///
4799/// # Example
4800///
4801/// Instantiate a resource method builder
4802///
4803/// ```test_harness,no_run
4804/// # extern crate hyper;
4805/// # extern crate hyper_rustls;
4806/// # extern crate google_tagmanager1 as tagmanager1;
4807/// # async fn dox() {
4808/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4809///
4810/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4811/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4812/// #     .with_native_roots()
4813/// #     .unwrap()
4814/// #     .https_only()
4815/// #     .enable_http2()
4816/// #     .build();
4817///
4818/// # let executor = hyper_util::rt::TokioExecutor::new();
4819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4820/// #     secret,
4821/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4822/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4823/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4824/// #     ),
4825/// # ).build().await.unwrap();
4826///
4827/// # let client = hyper_util::client::legacy::Client::builder(
4828/// #     hyper_util::rt::TokioExecutor::new()
4829/// # )
4830/// # .build(
4831/// #     hyper_rustls::HttpsConnectorBuilder::new()
4832/// #         .with_native_roots()
4833/// #         .unwrap()
4834/// #         .https_or_http()
4835/// #         .enable_http2()
4836/// #         .build()
4837/// # );
4838/// # let mut hub = TagManager::new(client, auth);
4839/// // You can configure optional parameters by calling the respective setters at will, and
4840/// // execute the final call using `doit()`.
4841/// // Values shown here are possibly random and not representative !
4842/// let result = hub.accounts().containers_folders_delete("accountId", "containerId", "folderId")
4843///              .doit().await;
4844/// # }
4845/// ```
4846pub struct AccountContainerFolderDeleteCall<'a, C>
4847where
4848    C: 'a,
4849{
4850    hub: &'a TagManager<C>,
4851    _account_id: String,
4852    _container_id: String,
4853    _folder_id: String,
4854    _delegate: Option<&'a mut dyn common::Delegate>,
4855    _additional_params: HashMap<String, String>,
4856    _scopes: BTreeSet<String>,
4857}
4858
4859impl<'a, C> common::CallBuilder for AccountContainerFolderDeleteCall<'a, C> {}
4860
4861impl<'a, C> AccountContainerFolderDeleteCall<'a, C>
4862where
4863    C: common::Connector,
4864{
4865    /// Perform the operation you have build so far.
4866    pub async fn doit(mut self) -> common::Result<common::Response> {
4867        use std::borrow::Cow;
4868        use std::io::{Read, Seek};
4869
4870        use common::{url::Params, ToParts};
4871        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4872
4873        let mut dd = common::DefaultDelegate;
4874        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4875        dlg.begin(common::MethodInfo {
4876            id: "tagmanager.accounts.containers.folders.delete",
4877            http_method: hyper::Method::DELETE,
4878        });
4879
4880        for &field in ["accountId", "containerId", "folderId"].iter() {
4881            if self._additional_params.contains_key(field) {
4882                dlg.finished(false);
4883                return Err(common::Error::FieldClash(field));
4884            }
4885        }
4886
4887        let mut params = Params::with_capacity(4 + self._additional_params.len());
4888        params.push("accountId", self._account_id);
4889        params.push("containerId", self._container_id);
4890        params.push("folderId", self._folder_id);
4891
4892        params.extend(self._additional_params.iter());
4893
4894        let mut url = self.hub._base_url.clone()
4895            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders/{folderId}";
4896        if self._scopes.is_empty() {
4897            self._scopes
4898                .insert(Scope::EditContainer.as_ref().to_string());
4899        }
4900
4901        #[allow(clippy::single_element_loop)]
4902        for &(find_this, param_name) in [
4903            ("{accountId}", "accountId"),
4904            ("{containerId}", "containerId"),
4905            ("{folderId}", "folderId"),
4906        ]
4907        .iter()
4908        {
4909            url = params.uri_replacement(url, param_name, find_this, false);
4910        }
4911        {
4912            let to_remove = ["folderId", "containerId", "accountId"];
4913            params.remove_params(&to_remove);
4914        }
4915
4916        let url = params.parse_with_url(&url);
4917
4918        loop {
4919            let token = match self
4920                .hub
4921                .auth
4922                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4923                .await
4924            {
4925                Ok(token) => token,
4926                Err(e) => match dlg.token(e) {
4927                    Ok(token) => token,
4928                    Err(e) => {
4929                        dlg.finished(false);
4930                        return Err(common::Error::MissingToken(e));
4931                    }
4932                },
4933            };
4934            let mut req_result = {
4935                let client = &self.hub.client;
4936                dlg.pre_request();
4937                let mut req_builder = hyper::Request::builder()
4938                    .method(hyper::Method::DELETE)
4939                    .uri(url.as_str())
4940                    .header(USER_AGENT, self.hub._user_agent.clone());
4941
4942                if let Some(token) = token.as_ref() {
4943                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4944                }
4945
4946                let request = req_builder
4947                    .header(CONTENT_LENGTH, 0_u64)
4948                    .body(common::to_body::<String>(None));
4949
4950                client.request(request.unwrap()).await
4951            };
4952
4953            match req_result {
4954                Err(err) => {
4955                    if let common::Retry::After(d) = dlg.http_error(&err) {
4956                        sleep(d).await;
4957                        continue;
4958                    }
4959                    dlg.finished(false);
4960                    return Err(common::Error::HttpError(err));
4961                }
4962                Ok(res) => {
4963                    let (mut parts, body) = res.into_parts();
4964                    let mut body = common::Body::new(body);
4965                    if !parts.status.is_success() {
4966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4967                        let error = serde_json::from_str(&common::to_string(&bytes));
4968                        let response = common::to_response(parts, bytes.into());
4969
4970                        if let common::Retry::After(d) =
4971                            dlg.http_failure(&response, error.as_ref().ok())
4972                        {
4973                            sleep(d).await;
4974                            continue;
4975                        }
4976
4977                        dlg.finished(false);
4978
4979                        return Err(match error {
4980                            Ok(value) => common::Error::BadRequest(value),
4981                            _ => common::Error::Failure(response),
4982                        });
4983                    }
4984                    let response = common::Response::from_parts(parts, body);
4985
4986                    dlg.finished(true);
4987                    return Ok(response);
4988                }
4989            }
4990        }
4991    }
4992
4993    /// The GTM Account ID.
4994    ///
4995    /// Sets the *account id* path property to the given value.
4996    ///
4997    /// Even though the property as already been set when instantiating this call,
4998    /// we provide this method for API completeness.
4999    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderDeleteCall<'a, C> {
5000        self._account_id = new_value.to_string();
5001        self
5002    }
5003    /// The GTM Container ID.
5004    ///
5005    /// Sets the *container id* path property to the given value.
5006    ///
5007    /// Even though the property as already been set when instantiating this call,
5008    /// we provide this method for API completeness.
5009    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderDeleteCall<'a, C> {
5010        self._container_id = new_value.to_string();
5011        self
5012    }
5013    /// The GTM Folder ID.
5014    ///
5015    /// Sets the *folder id* path property to the given value.
5016    ///
5017    /// Even though the property as already been set when instantiating this call,
5018    /// we provide this method for API completeness.
5019    pub fn folder_id(mut self, new_value: &str) -> AccountContainerFolderDeleteCall<'a, C> {
5020        self._folder_id = new_value.to_string();
5021        self
5022    }
5023    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5024    /// while executing the actual API request.
5025    ///
5026    /// ````text
5027    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5028    /// ````
5029    ///
5030    /// Sets the *delegate* property to the given value.
5031    pub fn delegate(
5032        mut self,
5033        new_value: &'a mut dyn common::Delegate,
5034    ) -> AccountContainerFolderDeleteCall<'a, C> {
5035        self._delegate = Some(new_value);
5036        self
5037    }
5038
5039    /// Set any additional parameter of the query string used in the request.
5040    /// It should be used to set parameters which are not yet available through their own
5041    /// setters.
5042    ///
5043    /// Please note that this method must not be used to set any of the known parameters
5044    /// which have their own setter method. If done anyway, the request will fail.
5045    ///
5046    /// # Additional Parameters
5047    ///
5048    /// * *$.xgafv* (query-string) - V1 error format.
5049    /// * *access_token* (query-string) - OAuth access token.
5050    /// * *alt* (query-string) - Data format for response.
5051    /// * *callback* (query-string) - JSONP
5052    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5053    /// * *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.
5054    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5055    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5056    /// * *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.
5057    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5058    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5059    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderDeleteCall<'a, C>
5060    where
5061        T: AsRef<str>,
5062    {
5063        self._additional_params
5064            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5065        self
5066    }
5067
5068    /// Identifies the authorization scope for the method you are building.
5069    ///
5070    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5071    /// [`Scope::EditContainer`].
5072    ///
5073    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5074    /// tokens for more than one scope.
5075    ///
5076    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5077    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5078    /// sufficient, a read-write scope will do as well.
5079    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderDeleteCall<'a, C>
5080    where
5081        St: AsRef<str>,
5082    {
5083        self._scopes.insert(String::from(scope.as_ref()));
5084        self
5085    }
5086    /// Identifies the authorization scope(s) for the method you are building.
5087    ///
5088    /// See [`Self::add_scope()`] for details.
5089    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderDeleteCall<'a, C>
5090    where
5091        I: IntoIterator<Item = St>,
5092        St: AsRef<str>,
5093    {
5094        self._scopes
5095            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5096        self
5097    }
5098
5099    /// Removes all scopes, and no default scope will be used either.
5100    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5101    /// for details).
5102    pub fn clear_scopes(mut self) -> AccountContainerFolderDeleteCall<'a, C> {
5103        self._scopes.clear();
5104        self
5105    }
5106}
5107
5108/// Gets a GTM Folder.
5109///
5110/// A builder for the *containers.folders.get* method supported by a *account* resource.
5111/// It is not used directly, but through a [`AccountMethods`] instance.
5112///
5113/// # Example
5114///
5115/// Instantiate a resource method builder
5116///
5117/// ```test_harness,no_run
5118/// # extern crate hyper;
5119/// # extern crate hyper_rustls;
5120/// # extern crate google_tagmanager1 as tagmanager1;
5121/// # async fn dox() {
5122/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5123///
5124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5125/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5126/// #     .with_native_roots()
5127/// #     .unwrap()
5128/// #     .https_only()
5129/// #     .enable_http2()
5130/// #     .build();
5131///
5132/// # let executor = hyper_util::rt::TokioExecutor::new();
5133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5134/// #     secret,
5135/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5136/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5137/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5138/// #     ),
5139/// # ).build().await.unwrap();
5140///
5141/// # let client = hyper_util::client::legacy::Client::builder(
5142/// #     hyper_util::rt::TokioExecutor::new()
5143/// # )
5144/// # .build(
5145/// #     hyper_rustls::HttpsConnectorBuilder::new()
5146/// #         .with_native_roots()
5147/// #         .unwrap()
5148/// #         .https_or_http()
5149/// #         .enable_http2()
5150/// #         .build()
5151/// # );
5152/// # let mut hub = TagManager::new(client, auth);
5153/// // You can configure optional parameters by calling the respective setters at will, and
5154/// // execute the final call using `doit()`.
5155/// // Values shown here are possibly random and not representative !
5156/// let result = hub.accounts().containers_folders_get("accountId", "containerId", "folderId")
5157///              .doit().await;
5158/// # }
5159/// ```
5160pub struct AccountContainerFolderGetCall<'a, C>
5161where
5162    C: 'a,
5163{
5164    hub: &'a TagManager<C>,
5165    _account_id: String,
5166    _container_id: String,
5167    _folder_id: String,
5168    _delegate: Option<&'a mut dyn common::Delegate>,
5169    _additional_params: HashMap<String, String>,
5170    _scopes: BTreeSet<String>,
5171}
5172
5173impl<'a, C> common::CallBuilder for AccountContainerFolderGetCall<'a, C> {}
5174
5175impl<'a, C> AccountContainerFolderGetCall<'a, C>
5176where
5177    C: common::Connector,
5178{
5179    /// Perform the operation you have build so far.
5180    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
5181        use std::borrow::Cow;
5182        use std::io::{Read, Seek};
5183
5184        use common::{url::Params, ToParts};
5185        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5186
5187        let mut dd = common::DefaultDelegate;
5188        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5189        dlg.begin(common::MethodInfo {
5190            id: "tagmanager.accounts.containers.folders.get",
5191            http_method: hyper::Method::GET,
5192        });
5193
5194        for &field in ["alt", "accountId", "containerId", "folderId"].iter() {
5195            if self._additional_params.contains_key(field) {
5196                dlg.finished(false);
5197                return Err(common::Error::FieldClash(field));
5198            }
5199        }
5200
5201        let mut params = Params::with_capacity(5 + self._additional_params.len());
5202        params.push("accountId", self._account_id);
5203        params.push("containerId", self._container_id);
5204        params.push("folderId", self._folder_id);
5205
5206        params.extend(self._additional_params.iter());
5207
5208        params.push("alt", "json");
5209        let mut url = self.hub._base_url.clone()
5210            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders/{folderId}";
5211        if self._scopes.is_empty() {
5212            self._scopes.insert(Scope::Readonly.as_ref().to_string());
5213        }
5214
5215        #[allow(clippy::single_element_loop)]
5216        for &(find_this, param_name) in [
5217            ("{accountId}", "accountId"),
5218            ("{containerId}", "containerId"),
5219            ("{folderId}", "folderId"),
5220        ]
5221        .iter()
5222        {
5223            url = params.uri_replacement(url, param_name, find_this, false);
5224        }
5225        {
5226            let to_remove = ["folderId", "containerId", "accountId"];
5227            params.remove_params(&to_remove);
5228        }
5229
5230        let url = params.parse_with_url(&url);
5231
5232        loop {
5233            let token = match self
5234                .hub
5235                .auth
5236                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5237                .await
5238            {
5239                Ok(token) => token,
5240                Err(e) => match dlg.token(e) {
5241                    Ok(token) => token,
5242                    Err(e) => {
5243                        dlg.finished(false);
5244                        return Err(common::Error::MissingToken(e));
5245                    }
5246                },
5247            };
5248            let mut req_result = {
5249                let client = &self.hub.client;
5250                dlg.pre_request();
5251                let mut req_builder = hyper::Request::builder()
5252                    .method(hyper::Method::GET)
5253                    .uri(url.as_str())
5254                    .header(USER_AGENT, self.hub._user_agent.clone());
5255
5256                if let Some(token) = token.as_ref() {
5257                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5258                }
5259
5260                let request = req_builder
5261                    .header(CONTENT_LENGTH, 0_u64)
5262                    .body(common::to_body::<String>(None));
5263
5264                client.request(request.unwrap()).await
5265            };
5266
5267            match req_result {
5268                Err(err) => {
5269                    if let common::Retry::After(d) = dlg.http_error(&err) {
5270                        sleep(d).await;
5271                        continue;
5272                    }
5273                    dlg.finished(false);
5274                    return Err(common::Error::HttpError(err));
5275                }
5276                Ok(res) => {
5277                    let (mut parts, body) = res.into_parts();
5278                    let mut body = common::Body::new(body);
5279                    if !parts.status.is_success() {
5280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5281                        let error = serde_json::from_str(&common::to_string(&bytes));
5282                        let response = common::to_response(parts, bytes.into());
5283
5284                        if let common::Retry::After(d) =
5285                            dlg.http_failure(&response, error.as_ref().ok())
5286                        {
5287                            sleep(d).await;
5288                            continue;
5289                        }
5290
5291                        dlg.finished(false);
5292
5293                        return Err(match error {
5294                            Ok(value) => common::Error::BadRequest(value),
5295                            _ => common::Error::Failure(response),
5296                        });
5297                    }
5298                    let response = {
5299                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5300                        let encoded = common::to_string(&bytes);
5301                        match serde_json::from_str(&encoded) {
5302                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5303                            Err(error) => {
5304                                dlg.response_json_decode_error(&encoded, &error);
5305                                return Err(common::Error::JsonDecodeError(
5306                                    encoded.to_string(),
5307                                    error,
5308                                ));
5309                            }
5310                        }
5311                    };
5312
5313                    dlg.finished(true);
5314                    return Ok(response);
5315                }
5316            }
5317        }
5318    }
5319
5320    /// The GTM Account ID.
5321    ///
5322    /// Sets the *account id* path property to the given value.
5323    ///
5324    /// Even though the property as already been set when instantiating this call,
5325    /// we provide this method for API completeness.
5326    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderGetCall<'a, C> {
5327        self._account_id = new_value.to_string();
5328        self
5329    }
5330    /// The GTM Container ID.
5331    ///
5332    /// Sets the *container id* path property to the given value.
5333    ///
5334    /// Even though the property as already been set when instantiating this call,
5335    /// we provide this method for API completeness.
5336    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderGetCall<'a, C> {
5337        self._container_id = new_value.to_string();
5338        self
5339    }
5340    /// The GTM Folder ID.
5341    ///
5342    /// Sets the *folder id* path property to the given value.
5343    ///
5344    /// Even though the property as already been set when instantiating this call,
5345    /// we provide this method for API completeness.
5346    pub fn folder_id(mut self, new_value: &str) -> AccountContainerFolderGetCall<'a, C> {
5347        self._folder_id = new_value.to_string();
5348        self
5349    }
5350    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5351    /// while executing the actual API request.
5352    ///
5353    /// ````text
5354    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5355    /// ````
5356    ///
5357    /// Sets the *delegate* property to the given value.
5358    pub fn delegate(
5359        mut self,
5360        new_value: &'a mut dyn common::Delegate,
5361    ) -> AccountContainerFolderGetCall<'a, C> {
5362        self._delegate = Some(new_value);
5363        self
5364    }
5365
5366    /// Set any additional parameter of the query string used in the request.
5367    /// It should be used to set parameters which are not yet available through their own
5368    /// setters.
5369    ///
5370    /// Please note that this method must not be used to set any of the known parameters
5371    /// which have their own setter method. If done anyway, the request will fail.
5372    ///
5373    /// # Additional Parameters
5374    ///
5375    /// * *$.xgafv* (query-string) - V1 error format.
5376    /// * *access_token* (query-string) - OAuth access token.
5377    /// * *alt* (query-string) - Data format for response.
5378    /// * *callback* (query-string) - JSONP
5379    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5380    /// * *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.
5381    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5382    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5383    /// * *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.
5384    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5385    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5386    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderGetCall<'a, C>
5387    where
5388        T: AsRef<str>,
5389    {
5390        self._additional_params
5391            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5392        self
5393    }
5394
5395    /// Identifies the authorization scope for the method you are building.
5396    ///
5397    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5398    /// [`Scope::Readonly`].
5399    ///
5400    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5401    /// tokens for more than one scope.
5402    ///
5403    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5404    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5405    /// sufficient, a read-write scope will do as well.
5406    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderGetCall<'a, C>
5407    where
5408        St: AsRef<str>,
5409    {
5410        self._scopes.insert(String::from(scope.as_ref()));
5411        self
5412    }
5413    /// Identifies the authorization scope(s) for the method you are building.
5414    ///
5415    /// See [`Self::add_scope()`] for details.
5416    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderGetCall<'a, C>
5417    where
5418        I: IntoIterator<Item = St>,
5419        St: AsRef<str>,
5420    {
5421        self._scopes
5422            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5423        self
5424    }
5425
5426    /// Removes all scopes, and no default scope will be used either.
5427    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5428    /// for details).
5429    pub fn clear_scopes(mut self) -> AccountContainerFolderGetCall<'a, C> {
5430        self._scopes.clear();
5431        self
5432    }
5433}
5434
5435/// Lists all GTM Folders of a Container.
5436///
5437/// A builder for the *containers.folders.list* method supported by a *account* resource.
5438/// It is not used directly, but through a [`AccountMethods`] instance.
5439///
5440/// # Example
5441///
5442/// Instantiate a resource method builder
5443///
5444/// ```test_harness,no_run
5445/// # extern crate hyper;
5446/// # extern crate hyper_rustls;
5447/// # extern crate google_tagmanager1 as tagmanager1;
5448/// # async fn dox() {
5449/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5450///
5451/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5452/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5453/// #     .with_native_roots()
5454/// #     .unwrap()
5455/// #     .https_only()
5456/// #     .enable_http2()
5457/// #     .build();
5458///
5459/// # let executor = hyper_util::rt::TokioExecutor::new();
5460/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5461/// #     secret,
5462/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5463/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5464/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5465/// #     ),
5466/// # ).build().await.unwrap();
5467///
5468/// # let client = hyper_util::client::legacy::Client::builder(
5469/// #     hyper_util::rt::TokioExecutor::new()
5470/// # )
5471/// # .build(
5472/// #     hyper_rustls::HttpsConnectorBuilder::new()
5473/// #         .with_native_roots()
5474/// #         .unwrap()
5475/// #         .https_or_http()
5476/// #         .enable_http2()
5477/// #         .build()
5478/// # );
5479/// # let mut hub = TagManager::new(client, auth);
5480/// // You can configure optional parameters by calling the respective setters at will, and
5481/// // execute the final call using `doit()`.
5482/// // Values shown here are possibly random and not representative !
5483/// let result = hub.accounts().containers_folders_list("accountId", "containerId")
5484///              .doit().await;
5485/// # }
5486/// ```
5487pub struct AccountContainerFolderListCall<'a, C>
5488where
5489    C: 'a,
5490{
5491    hub: &'a TagManager<C>,
5492    _account_id: String,
5493    _container_id: String,
5494    _delegate: Option<&'a mut dyn common::Delegate>,
5495    _additional_params: HashMap<String, String>,
5496    _scopes: BTreeSet<String>,
5497}
5498
5499impl<'a, C> common::CallBuilder for AccountContainerFolderListCall<'a, C> {}
5500
5501impl<'a, C> AccountContainerFolderListCall<'a, C>
5502where
5503    C: common::Connector,
5504{
5505    /// Perform the operation you have build so far.
5506    pub async fn doit(mut self) -> common::Result<(common::Response, ListFoldersResponse)> {
5507        use std::borrow::Cow;
5508        use std::io::{Read, Seek};
5509
5510        use common::{url::Params, ToParts};
5511        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5512
5513        let mut dd = common::DefaultDelegate;
5514        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5515        dlg.begin(common::MethodInfo {
5516            id: "tagmanager.accounts.containers.folders.list",
5517            http_method: hyper::Method::GET,
5518        });
5519
5520        for &field in ["alt", "accountId", "containerId"].iter() {
5521            if self._additional_params.contains_key(field) {
5522                dlg.finished(false);
5523                return Err(common::Error::FieldClash(field));
5524            }
5525        }
5526
5527        let mut params = Params::with_capacity(4 + self._additional_params.len());
5528        params.push("accountId", self._account_id);
5529        params.push("containerId", self._container_id);
5530
5531        params.extend(self._additional_params.iter());
5532
5533        params.push("alt", "json");
5534        let mut url = self.hub._base_url.clone()
5535            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders";
5536        if self._scopes.is_empty() {
5537            self._scopes.insert(Scope::Readonly.as_ref().to_string());
5538        }
5539
5540        #[allow(clippy::single_element_loop)]
5541        for &(find_this, param_name) in [
5542            ("{accountId}", "accountId"),
5543            ("{containerId}", "containerId"),
5544        ]
5545        .iter()
5546        {
5547            url = params.uri_replacement(url, param_name, find_this, false);
5548        }
5549        {
5550            let to_remove = ["containerId", "accountId"];
5551            params.remove_params(&to_remove);
5552        }
5553
5554        let url = params.parse_with_url(&url);
5555
5556        loop {
5557            let token = match self
5558                .hub
5559                .auth
5560                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5561                .await
5562            {
5563                Ok(token) => token,
5564                Err(e) => match dlg.token(e) {
5565                    Ok(token) => token,
5566                    Err(e) => {
5567                        dlg.finished(false);
5568                        return Err(common::Error::MissingToken(e));
5569                    }
5570                },
5571            };
5572            let mut req_result = {
5573                let client = &self.hub.client;
5574                dlg.pre_request();
5575                let mut req_builder = hyper::Request::builder()
5576                    .method(hyper::Method::GET)
5577                    .uri(url.as_str())
5578                    .header(USER_AGENT, self.hub._user_agent.clone());
5579
5580                if let Some(token) = token.as_ref() {
5581                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5582                }
5583
5584                let request = req_builder
5585                    .header(CONTENT_LENGTH, 0_u64)
5586                    .body(common::to_body::<String>(None));
5587
5588                client.request(request.unwrap()).await
5589            };
5590
5591            match req_result {
5592                Err(err) => {
5593                    if let common::Retry::After(d) = dlg.http_error(&err) {
5594                        sleep(d).await;
5595                        continue;
5596                    }
5597                    dlg.finished(false);
5598                    return Err(common::Error::HttpError(err));
5599                }
5600                Ok(res) => {
5601                    let (mut parts, body) = res.into_parts();
5602                    let mut body = common::Body::new(body);
5603                    if !parts.status.is_success() {
5604                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5605                        let error = serde_json::from_str(&common::to_string(&bytes));
5606                        let response = common::to_response(parts, bytes.into());
5607
5608                        if let common::Retry::After(d) =
5609                            dlg.http_failure(&response, error.as_ref().ok())
5610                        {
5611                            sleep(d).await;
5612                            continue;
5613                        }
5614
5615                        dlg.finished(false);
5616
5617                        return Err(match error {
5618                            Ok(value) => common::Error::BadRequest(value),
5619                            _ => common::Error::Failure(response),
5620                        });
5621                    }
5622                    let response = {
5623                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5624                        let encoded = common::to_string(&bytes);
5625                        match serde_json::from_str(&encoded) {
5626                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5627                            Err(error) => {
5628                                dlg.response_json_decode_error(&encoded, &error);
5629                                return Err(common::Error::JsonDecodeError(
5630                                    encoded.to_string(),
5631                                    error,
5632                                ));
5633                            }
5634                        }
5635                    };
5636
5637                    dlg.finished(true);
5638                    return Ok(response);
5639                }
5640            }
5641        }
5642    }
5643
5644    /// The GTM Account ID.
5645    ///
5646    /// Sets the *account id* path property to the given value.
5647    ///
5648    /// Even though the property as already been set when instantiating this call,
5649    /// we provide this method for API completeness.
5650    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderListCall<'a, C> {
5651        self._account_id = new_value.to_string();
5652        self
5653    }
5654    /// The GTM Container ID.
5655    ///
5656    /// Sets the *container id* path property to the given value.
5657    ///
5658    /// Even though the property as already been set when instantiating this call,
5659    /// we provide this method for API completeness.
5660    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderListCall<'a, C> {
5661        self._container_id = new_value.to_string();
5662        self
5663    }
5664    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5665    /// while executing the actual API request.
5666    ///
5667    /// ````text
5668    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5669    /// ````
5670    ///
5671    /// Sets the *delegate* property to the given value.
5672    pub fn delegate(
5673        mut self,
5674        new_value: &'a mut dyn common::Delegate,
5675    ) -> AccountContainerFolderListCall<'a, C> {
5676        self._delegate = Some(new_value);
5677        self
5678    }
5679
5680    /// Set any additional parameter of the query string used in the request.
5681    /// It should be used to set parameters which are not yet available through their own
5682    /// setters.
5683    ///
5684    /// Please note that this method must not be used to set any of the known parameters
5685    /// which have their own setter method. If done anyway, the request will fail.
5686    ///
5687    /// # Additional Parameters
5688    ///
5689    /// * *$.xgafv* (query-string) - V1 error format.
5690    /// * *access_token* (query-string) - OAuth access token.
5691    /// * *alt* (query-string) - Data format for response.
5692    /// * *callback* (query-string) - JSONP
5693    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5694    /// * *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.
5695    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5696    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5697    /// * *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.
5698    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5699    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5700    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderListCall<'a, C>
5701    where
5702        T: AsRef<str>,
5703    {
5704        self._additional_params
5705            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5706        self
5707    }
5708
5709    /// Identifies the authorization scope for the method you are building.
5710    ///
5711    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5712    /// [`Scope::Readonly`].
5713    ///
5714    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5715    /// tokens for more than one scope.
5716    ///
5717    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5718    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5719    /// sufficient, a read-write scope will do as well.
5720    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderListCall<'a, C>
5721    where
5722        St: AsRef<str>,
5723    {
5724        self._scopes.insert(String::from(scope.as_ref()));
5725        self
5726    }
5727    /// Identifies the authorization scope(s) for the method you are building.
5728    ///
5729    /// See [`Self::add_scope()`] for details.
5730    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderListCall<'a, C>
5731    where
5732        I: IntoIterator<Item = St>,
5733        St: AsRef<str>,
5734    {
5735        self._scopes
5736            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5737        self
5738    }
5739
5740    /// Removes all scopes, and no default scope will be used either.
5741    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5742    /// for details).
5743    pub fn clear_scopes(mut self) -> AccountContainerFolderListCall<'a, C> {
5744        self._scopes.clear();
5745        self
5746    }
5747}
5748
5749/// Updates a GTM Folder.
5750///
5751/// A builder for the *containers.folders.update* method supported by a *account* resource.
5752/// It is not used directly, but through a [`AccountMethods`] instance.
5753///
5754/// # Example
5755///
5756/// Instantiate a resource method builder
5757///
5758/// ```test_harness,no_run
5759/// # extern crate hyper;
5760/// # extern crate hyper_rustls;
5761/// # extern crate google_tagmanager1 as tagmanager1;
5762/// use tagmanager1::api::Folder;
5763/// # async fn dox() {
5764/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5765///
5766/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5767/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5768/// #     .with_native_roots()
5769/// #     .unwrap()
5770/// #     .https_only()
5771/// #     .enable_http2()
5772/// #     .build();
5773///
5774/// # let executor = hyper_util::rt::TokioExecutor::new();
5775/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5776/// #     secret,
5777/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5778/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5779/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5780/// #     ),
5781/// # ).build().await.unwrap();
5782///
5783/// # let client = hyper_util::client::legacy::Client::builder(
5784/// #     hyper_util::rt::TokioExecutor::new()
5785/// # )
5786/// # .build(
5787/// #     hyper_rustls::HttpsConnectorBuilder::new()
5788/// #         .with_native_roots()
5789/// #         .unwrap()
5790/// #         .https_or_http()
5791/// #         .enable_http2()
5792/// #         .build()
5793/// # );
5794/// # let mut hub = TagManager::new(client, auth);
5795/// // As the method needs a request, you would usually fill it with the desired information
5796/// // into the respective structure. Some of the parts shown here might not be applicable !
5797/// // Values shown here are possibly random and not representative !
5798/// let mut req = Folder::default();
5799///
5800/// // You can configure optional parameters by calling the respective setters at will, and
5801/// // execute the final call using `doit()`.
5802/// // Values shown here are possibly random and not representative !
5803/// let result = hub.accounts().containers_folders_update(req, "accountId", "containerId", "folderId")
5804///              .fingerprint("vero")
5805///              .doit().await;
5806/// # }
5807/// ```
5808pub struct AccountContainerFolderUpdateCall<'a, C>
5809where
5810    C: 'a,
5811{
5812    hub: &'a TagManager<C>,
5813    _request: Folder,
5814    _account_id: String,
5815    _container_id: String,
5816    _folder_id: String,
5817    _fingerprint: Option<String>,
5818    _delegate: Option<&'a mut dyn common::Delegate>,
5819    _additional_params: HashMap<String, String>,
5820    _scopes: BTreeSet<String>,
5821}
5822
5823impl<'a, C> common::CallBuilder for AccountContainerFolderUpdateCall<'a, C> {}
5824
5825impl<'a, C> AccountContainerFolderUpdateCall<'a, C>
5826where
5827    C: common::Connector,
5828{
5829    /// Perform the operation you have build so far.
5830    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
5831        use std::borrow::Cow;
5832        use std::io::{Read, Seek};
5833
5834        use common::{url::Params, ToParts};
5835        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5836
5837        let mut dd = common::DefaultDelegate;
5838        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5839        dlg.begin(common::MethodInfo {
5840            id: "tagmanager.accounts.containers.folders.update",
5841            http_method: hyper::Method::PUT,
5842        });
5843
5844        for &field in ["alt", "accountId", "containerId", "folderId", "fingerprint"].iter() {
5845            if self._additional_params.contains_key(field) {
5846                dlg.finished(false);
5847                return Err(common::Error::FieldClash(field));
5848            }
5849        }
5850
5851        let mut params = Params::with_capacity(7 + self._additional_params.len());
5852        params.push("accountId", self._account_id);
5853        params.push("containerId", self._container_id);
5854        params.push("folderId", self._folder_id);
5855        if let Some(value) = self._fingerprint.as_ref() {
5856            params.push("fingerprint", value);
5857        }
5858
5859        params.extend(self._additional_params.iter());
5860
5861        params.push("alt", "json");
5862        let mut url = self.hub._base_url.clone()
5863            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/folders/{folderId}";
5864        if self._scopes.is_empty() {
5865            self._scopes
5866                .insert(Scope::EditContainer.as_ref().to_string());
5867        }
5868
5869        #[allow(clippy::single_element_loop)]
5870        for &(find_this, param_name) in [
5871            ("{accountId}", "accountId"),
5872            ("{containerId}", "containerId"),
5873            ("{folderId}", "folderId"),
5874        ]
5875        .iter()
5876        {
5877            url = params.uri_replacement(url, param_name, find_this, false);
5878        }
5879        {
5880            let to_remove = ["folderId", "containerId", "accountId"];
5881            params.remove_params(&to_remove);
5882        }
5883
5884        let url = params.parse_with_url(&url);
5885
5886        let mut json_mime_type = mime::APPLICATION_JSON;
5887        let mut request_value_reader = {
5888            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5889            common::remove_json_null_values(&mut value);
5890            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5891            serde_json::to_writer(&mut dst, &value).unwrap();
5892            dst
5893        };
5894        let request_size = request_value_reader
5895            .seek(std::io::SeekFrom::End(0))
5896            .unwrap();
5897        request_value_reader
5898            .seek(std::io::SeekFrom::Start(0))
5899            .unwrap();
5900
5901        loop {
5902            let token = match self
5903                .hub
5904                .auth
5905                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5906                .await
5907            {
5908                Ok(token) => token,
5909                Err(e) => match dlg.token(e) {
5910                    Ok(token) => token,
5911                    Err(e) => {
5912                        dlg.finished(false);
5913                        return Err(common::Error::MissingToken(e));
5914                    }
5915                },
5916            };
5917            request_value_reader
5918                .seek(std::io::SeekFrom::Start(0))
5919                .unwrap();
5920            let mut req_result = {
5921                let client = &self.hub.client;
5922                dlg.pre_request();
5923                let mut req_builder = hyper::Request::builder()
5924                    .method(hyper::Method::PUT)
5925                    .uri(url.as_str())
5926                    .header(USER_AGENT, self.hub._user_agent.clone());
5927
5928                if let Some(token) = token.as_ref() {
5929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5930                }
5931
5932                let request = req_builder
5933                    .header(CONTENT_TYPE, json_mime_type.to_string())
5934                    .header(CONTENT_LENGTH, request_size as u64)
5935                    .body(common::to_body(
5936                        request_value_reader.get_ref().clone().into(),
5937                    ));
5938
5939                client.request(request.unwrap()).await
5940            };
5941
5942            match req_result {
5943                Err(err) => {
5944                    if let common::Retry::After(d) = dlg.http_error(&err) {
5945                        sleep(d).await;
5946                        continue;
5947                    }
5948                    dlg.finished(false);
5949                    return Err(common::Error::HttpError(err));
5950                }
5951                Ok(res) => {
5952                    let (mut parts, body) = res.into_parts();
5953                    let mut body = common::Body::new(body);
5954                    if !parts.status.is_success() {
5955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5956                        let error = serde_json::from_str(&common::to_string(&bytes));
5957                        let response = common::to_response(parts, bytes.into());
5958
5959                        if let common::Retry::After(d) =
5960                            dlg.http_failure(&response, error.as_ref().ok())
5961                        {
5962                            sleep(d).await;
5963                            continue;
5964                        }
5965
5966                        dlg.finished(false);
5967
5968                        return Err(match error {
5969                            Ok(value) => common::Error::BadRequest(value),
5970                            _ => common::Error::Failure(response),
5971                        });
5972                    }
5973                    let response = {
5974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5975                        let encoded = common::to_string(&bytes);
5976                        match serde_json::from_str(&encoded) {
5977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5978                            Err(error) => {
5979                                dlg.response_json_decode_error(&encoded, &error);
5980                                return Err(common::Error::JsonDecodeError(
5981                                    encoded.to_string(),
5982                                    error,
5983                                ));
5984                            }
5985                        }
5986                    };
5987
5988                    dlg.finished(true);
5989                    return Ok(response);
5990                }
5991            }
5992        }
5993    }
5994
5995    ///
5996    /// Sets the *request* property to the given value.
5997    ///
5998    /// Even though the property as already been set when instantiating this call,
5999    /// we provide this method for API completeness.
6000    pub fn request(mut self, new_value: Folder) -> AccountContainerFolderUpdateCall<'a, C> {
6001        self._request = new_value;
6002        self
6003    }
6004    /// The GTM Account ID.
6005    ///
6006    /// Sets the *account id* path property to the given value.
6007    ///
6008    /// Even though the property as already been set when instantiating this call,
6009    /// we provide this method for API completeness.
6010    pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderUpdateCall<'a, C> {
6011        self._account_id = new_value.to_string();
6012        self
6013    }
6014    /// The GTM Container ID.
6015    ///
6016    /// Sets the *container id* path property to the given value.
6017    ///
6018    /// Even though the property as already been set when instantiating this call,
6019    /// we provide this method for API completeness.
6020    pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderUpdateCall<'a, C> {
6021        self._container_id = new_value.to_string();
6022        self
6023    }
6024    /// The GTM Folder ID.
6025    ///
6026    /// Sets the *folder id* path property to the given value.
6027    ///
6028    /// Even though the property as already been set when instantiating this call,
6029    /// we provide this method for API completeness.
6030    pub fn folder_id(mut self, new_value: &str) -> AccountContainerFolderUpdateCall<'a, C> {
6031        self._folder_id = new_value.to_string();
6032        self
6033    }
6034    /// When provided, this fingerprint must match the fingerprint of the folder in storage.
6035    ///
6036    /// Sets the *fingerprint* query property to the given value.
6037    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerFolderUpdateCall<'a, C> {
6038        self._fingerprint = Some(new_value.to_string());
6039        self
6040    }
6041    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6042    /// while executing the actual API request.
6043    ///
6044    /// ````text
6045    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6046    /// ````
6047    ///
6048    /// Sets the *delegate* property to the given value.
6049    pub fn delegate(
6050        mut self,
6051        new_value: &'a mut dyn common::Delegate,
6052    ) -> AccountContainerFolderUpdateCall<'a, C> {
6053        self._delegate = Some(new_value);
6054        self
6055    }
6056
6057    /// Set any additional parameter of the query string used in the request.
6058    /// It should be used to set parameters which are not yet available through their own
6059    /// setters.
6060    ///
6061    /// Please note that this method must not be used to set any of the known parameters
6062    /// which have their own setter method. If done anyway, the request will fail.
6063    ///
6064    /// # Additional Parameters
6065    ///
6066    /// * *$.xgafv* (query-string) - V1 error format.
6067    /// * *access_token* (query-string) - OAuth access token.
6068    /// * *alt* (query-string) - Data format for response.
6069    /// * *callback* (query-string) - JSONP
6070    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6071    /// * *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.
6072    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6073    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6074    /// * *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.
6075    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6076    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6077    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerFolderUpdateCall<'a, C>
6078    where
6079        T: AsRef<str>,
6080    {
6081        self._additional_params
6082            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6083        self
6084    }
6085
6086    /// Identifies the authorization scope for the method you are building.
6087    ///
6088    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6089    /// [`Scope::EditContainer`].
6090    ///
6091    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6092    /// tokens for more than one scope.
6093    ///
6094    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6095    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6096    /// sufficient, a read-write scope will do as well.
6097    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerFolderUpdateCall<'a, C>
6098    where
6099        St: AsRef<str>,
6100    {
6101        self._scopes.insert(String::from(scope.as_ref()));
6102        self
6103    }
6104    /// Identifies the authorization scope(s) for the method you are building.
6105    ///
6106    /// See [`Self::add_scope()`] for details.
6107    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerFolderUpdateCall<'a, C>
6108    where
6109        I: IntoIterator<Item = St>,
6110        St: AsRef<str>,
6111    {
6112        self._scopes
6113            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6114        self
6115    }
6116
6117    /// Removes all scopes, and no default scope will be used either.
6118    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6119    /// for details).
6120    pub fn clear_scopes(mut self) -> AccountContainerFolderUpdateCall<'a, C> {
6121        self._scopes.clear();
6122        self
6123    }
6124}
6125
6126/// Moves entities to a GTM Folder.
6127///
6128/// A builder for the *containers.move_folders.update* method supported by a *account* resource.
6129/// It is not used directly, but through a [`AccountMethods`] instance.
6130///
6131/// # Example
6132///
6133/// Instantiate a resource method builder
6134///
6135/// ```test_harness,no_run
6136/// # extern crate hyper;
6137/// # extern crate hyper_rustls;
6138/// # extern crate google_tagmanager1 as tagmanager1;
6139/// use tagmanager1::api::Folder;
6140/// # async fn dox() {
6141/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6142///
6143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6144/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6145/// #     .with_native_roots()
6146/// #     .unwrap()
6147/// #     .https_only()
6148/// #     .enable_http2()
6149/// #     .build();
6150///
6151/// # let executor = hyper_util::rt::TokioExecutor::new();
6152/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6153/// #     secret,
6154/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6155/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6156/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6157/// #     ),
6158/// # ).build().await.unwrap();
6159///
6160/// # let client = hyper_util::client::legacy::Client::builder(
6161/// #     hyper_util::rt::TokioExecutor::new()
6162/// # )
6163/// # .build(
6164/// #     hyper_rustls::HttpsConnectorBuilder::new()
6165/// #         .with_native_roots()
6166/// #         .unwrap()
6167/// #         .https_or_http()
6168/// #         .enable_http2()
6169/// #         .build()
6170/// # );
6171/// # let mut hub = TagManager::new(client, auth);
6172/// // As the method needs a request, you would usually fill it with the desired information
6173/// // into the respective structure. Some of the parts shown here might not be applicable !
6174/// // Values shown here are possibly random and not representative !
6175/// let mut req = Folder::default();
6176///
6177/// // You can configure optional parameters by calling the respective setters at will, and
6178/// // execute the final call using `doit()`.
6179/// // Values shown here are possibly random and not representative !
6180/// let result = hub.accounts().containers_move_folders_update(req, "accountId", "containerId", "folderId")
6181///              .add_variable_id("dolore")
6182///              .add_trigger_id("et")
6183///              .add_tag_id("voluptua.")
6184///              .doit().await;
6185/// # }
6186/// ```
6187pub struct AccountContainerMoveFolderUpdateCall<'a, C>
6188where
6189    C: 'a,
6190{
6191    hub: &'a TagManager<C>,
6192    _request: Folder,
6193    _account_id: String,
6194    _container_id: String,
6195    _folder_id: String,
6196    _variable_id: Vec<String>,
6197    _trigger_id: Vec<String>,
6198    _tag_id: Vec<String>,
6199    _delegate: Option<&'a mut dyn common::Delegate>,
6200    _additional_params: HashMap<String, String>,
6201    _scopes: BTreeSet<String>,
6202}
6203
6204impl<'a, C> common::CallBuilder for AccountContainerMoveFolderUpdateCall<'a, C> {}
6205
6206impl<'a, C> AccountContainerMoveFolderUpdateCall<'a, C>
6207where
6208    C: common::Connector,
6209{
6210    /// Perform the operation you have build so far.
6211    pub async fn doit(mut self) -> common::Result<common::Response> {
6212        use std::borrow::Cow;
6213        use std::io::{Read, Seek};
6214
6215        use common::{url::Params, ToParts};
6216        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6217
6218        let mut dd = common::DefaultDelegate;
6219        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6220        dlg.begin(common::MethodInfo {
6221            id: "tagmanager.accounts.containers.move_folders.update",
6222            http_method: hyper::Method::PUT,
6223        });
6224
6225        for &field in [
6226            "accountId",
6227            "containerId",
6228            "folderId",
6229            "variableId",
6230            "triggerId",
6231            "tagId",
6232        ]
6233        .iter()
6234        {
6235            if self._additional_params.contains_key(field) {
6236                dlg.finished(false);
6237                return Err(common::Error::FieldClash(field));
6238            }
6239        }
6240
6241        let mut params = Params::with_capacity(8 + self._additional_params.len());
6242        params.push("accountId", self._account_id);
6243        params.push("containerId", self._container_id);
6244        params.push("folderId", self._folder_id);
6245        if !self._variable_id.is_empty() {
6246            for f in self._variable_id.iter() {
6247                params.push("variableId", f);
6248            }
6249        }
6250        if !self._trigger_id.is_empty() {
6251            for f in self._trigger_id.iter() {
6252                params.push("triggerId", f);
6253            }
6254        }
6255        if !self._tag_id.is_empty() {
6256            for f in self._tag_id.iter() {
6257                params.push("tagId", f);
6258            }
6259        }
6260
6261        params.extend(self._additional_params.iter());
6262
6263        let mut url = self.hub._base_url.clone()
6264            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/move_folders/{folderId}";
6265        if self._scopes.is_empty() {
6266            self._scopes
6267                .insert(Scope::EditContainer.as_ref().to_string());
6268        }
6269
6270        #[allow(clippy::single_element_loop)]
6271        for &(find_this, param_name) in [
6272            ("{accountId}", "accountId"),
6273            ("{containerId}", "containerId"),
6274            ("{folderId}", "folderId"),
6275        ]
6276        .iter()
6277        {
6278            url = params.uri_replacement(url, param_name, find_this, false);
6279        }
6280        {
6281            let to_remove = ["folderId", "containerId", "accountId"];
6282            params.remove_params(&to_remove);
6283        }
6284
6285        let url = params.parse_with_url(&url);
6286
6287        let mut json_mime_type = mime::APPLICATION_JSON;
6288        let mut request_value_reader = {
6289            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6290            common::remove_json_null_values(&mut value);
6291            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6292            serde_json::to_writer(&mut dst, &value).unwrap();
6293            dst
6294        };
6295        let request_size = request_value_reader
6296            .seek(std::io::SeekFrom::End(0))
6297            .unwrap();
6298        request_value_reader
6299            .seek(std::io::SeekFrom::Start(0))
6300            .unwrap();
6301
6302        loop {
6303            let token = match self
6304                .hub
6305                .auth
6306                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6307                .await
6308            {
6309                Ok(token) => token,
6310                Err(e) => match dlg.token(e) {
6311                    Ok(token) => token,
6312                    Err(e) => {
6313                        dlg.finished(false);
6314                        return Err(common::Error::MissingToken(e));
6315                    }
6316                },
6317            };
6318            request_value_reader
6319                .seek(std::io::SeekFrom::Start(0))
6320                .unwrap();
6321            let mut req_result = {
6322                let client = &self.hub.client;
6323                dlg.pre_request();
6324                let mut req_builder = hyper::Request::builder()
6325                    .method(hyper::Method::PUT)
6326                    .uri(url.as_str())
6327                    .header(USER_AGENT, self.hub._user_agent.clone());
6328
6329                if let Some(token) = token.as_ref() {
6330                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6331                }
6332
6333                let request = req_builder
6334                    .header(CONTENT_TYPE, json_mime_type.to_string())
6335                    .header(CONTENT_LENGTH, request_size as u64)
6336                    .body(common::to_body(
6337                        request_value_reader.get_ref().clone().into(),
6338                    ));
6339
6340                client.request(request.unwrap()).await
6341            };
6342
6343            match req_result {
6344                Err(err) => {
6345                    if let common::Retry::After(d) = dlg.http_error(&err) {
6346                        sleep(d).await;
6347                        continue;
6348                    }
6349                    dlg.finished(false);
6350                    return Err(common::Error::HttpError(err));
6351                }
6352                Ok(res) => {
6353                    let (mut parts, body) = res.into_parts();
6354                    let mut body = common::Body::new(body);
6355                    if !parts.status.is_success() {
6356                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6357                        let error = serde_json::from_str(&common::to_string(&bytes));
6358                        let response = common::to_response(parts, bytes.into());
6359
6360                        if let common::Retry::After(d) =
6361                            dlg.http_failure(&response, error.as_ref().ok())
6362                        {
6363                            sleep(d).await;
6364                            continue;
6365                        }
6366
6367                        dlg.finished(false);
6368
6369                        return Err(match error {
6370                            Ok(value) => common::Error::BadRequest(value),
6371                            _ => common::Error::Failure(response),
6372                        });
6373                    }
6374                    let response = common::Response::from_parts(parts, body);
6375
6376                    dlg.finished(true);
6377                    return Ok(response);
6378                }
6379            }
6380        }
6381    }
6382
6383    ///
6384    /// Sets the *request* property to the given value.
6385    ///
6386    /// Even though the property as already been set when instantiating this call,
6387    /// we provide this method for API completeness.
6388    pub fn request(mut self, new_value: Folder) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6389        self._request = new_value;
6390        self
6391    }
6392    /// The GTM Account ID.
6393    ///
6394    /// Sets the *account id* path property to the given value.
6395    ///
6396    /// Even though the property as already been set when instantiating this call,
6397    /// we provide this method for API completeness.
6398    pub fn account_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6399        self._account_id = new_value.to_string();
6400        self
6401    }
6402    /// The GTM Container ID.
6403    ///
6404    /// Sets the *container id* path property to the given value.
6405    ///
6406    /// Even though the property as already been set when instantiating this call,
6407    /// we provide this method for API completeness.
6408    pub fn container_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6409        self._container_id = new_value.to_string();
6410        self
6411    }
6412    /// The GTM Folder ID.
6413    ///
6414    /// Sets the *folder id* path property to the given value.
6415    ///
6416    /// Even though the property as already been set when instantiating this call,
6417    /// we provide this method for API completeness.
6418    pub fn folder_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6419        self._folder_id = new_value.to_string();
6420        self
6421    }
6422    /// The variables to be moved to the folder.
6423    ///
6424    /// Append the given value to the *variable id* query property.
6425    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6426    pub fn add_variable_id(
6427        mut self,
6428        new_value: &str,
6429    ) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6430        self._variable_id.push(new_value.to_string());
6431        self
6432    }
6433    /// The triggers to be moved to the folder.
6434    ///
6435    /// Append the given value to the *trigger id* query property.
6436    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6437    pub fn add_trigger_id(
6438        mut self,
6439        new_value: &str,
6440    ) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6441        self._trigger_id.push(new_value.to_string());
6442        self
6443    }
6444    /// The tags to be moved to the folder.
6445    ///
6446    /// Append the given value to the *tag id* query property.
6447    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6448    pub fn add_tag_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6449        self._tag_id.push(new_value.to_string());
6450        self
6451    }
6452    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6453    /// while executing the actual API request.
6454    ///
6455    /// ````text
6456    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6457    /// ````
6458    ///
6459    /// Sets the *delegate* property to the given value.
6460    pub fn delegate(
6461        mut self,
6462        new_value: &'a mut dyn common::Delegate,
6463    ) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6464        self._delegate = Some(new_value);
6465        self
6466    }
6467
6468    /// Set any additional parameter of the query string used in the request.
6469    /// It should be used to set parameters which are not yet available through their own
6470    /// setters.
6471    ///
6472    /// Please note that this method must not be used to set any of the known parameters
6473    /// which have their own setter method. If done anyway, the request will fail.
6474    ///
6475    /// # Additional Parameters
6476    ///
6477    /// * *$.xgafv* (query-string) - V1 error format.
6478    /// * *access_token* (query-string) - OAuth access token.
6479    /// * *alt* (query-string) - Data format for response.
6480    /// * *callback* (query-string) - JSONP
6481    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6482    /// * *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.
6483    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6484    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6485    /// * *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.
6486    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6487    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6488    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerMoveFolderUpdateCall<'a, C>
6489    where
6490        T: AsRef<str>,
6491    {
6492        self._additional_params
6493            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6494        self
6495    }
6496
6497    /// Identifies the authorization scope for the method you are building.
6498    ///
6499    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6500    /// [`Scope::EditContainer`].
6501    ///
6502    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6503    /// tokens for more than one scope.
6504    ///
6505    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6506    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6507    /// sufficient, a read-write scope will do as well.
6508    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerMoveFolderUpdateCall<'a, C>
6509    where
6510        St: AsRef<str>,
6511    {
6512        self._scopes.insert(String::from(scope.as_ref()));
6513        self
6514    }
6515    /// Identifies the authorization scope(s) for the method you are building.
6516    ///
6517    /// See [`Self::add_scope()`] for details.
6518    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerMoveFolderUpdateCall<'a, C>
6519    where
6520        I: IntoIterator<Item = St>,
6521        St: AsRef<str>,
6522    {
6523        self._scopes
6524            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6525        self
6526    }
6527
6528    /// Removes all scopes, and no default scope will be used either.
6529    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6530    /// for details).
6531    pub fn clear_scopes(mut self) -> AccountContainerMoveFolderUpdateCall<'a, C> {
6532        self._scopes.clear();
6533        self
6534    }
6535}
6536
6537/// Re-generates the authorization code for a GTM Environment.
6538///
6539/// A builder for the *containers.reauthorize_environments.update* method supported by a *account* resource.
6540/// It is not used directly, but through a [`AccountMethods`] instance.
6541///
6542/// # Example
6543///
6544/// Instantiate a resource method builder
6545///
6546/// ```test_harness,no_run
6547/// # extern crate hyper;
6548/// # extern crate hyper_rustls;
6549/// # extern crate google_tagmanager1 as tagmanager1;
6550/// use tagmanager1::api::Environment;
6551/// # async fn dox() {
6552/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6553///
6554/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6555/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6556/// #     .with_native_roots()
6557/// #     .unwrap()
6558/// #     .https_only()
6559/// #     .enable_http2()
6560/// #     .build();
6561///
6562/// # let executor = hyper_util::rt::TokioExecutor::new();
6563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6564/// #     secret,
6565/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6566/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6567/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6568/// #     ),
6569/// # ).build().await.unwrap();
6570///
6571/// # let client = hyper_util::client::legacy::Client::builder(
6572/// #     hyper_util::rt::TokioExecutor::new()
6573/// # )
6574/// # .build(
6575/// #     hyper_rustls::HttpsConnectorBuilder::new()
6576/// #         .with_native_roots()
6577/// #         .unwrap()
6578/// #         .https_or_http()
6579/// #         .enable_http2()
6580/// #         .build()
6581/// # );
6582/// # let mut hub = TagManager::new(client, auth);
6583/// // As the method needs a request, you would usually fill it with the desired information
6584/// // into the respective structure. Some of the parts shown here might not be applicable !
6585/// // Values shown here are possibly random and not representative !
6586/// let mut req = Environment::default();
6587///
6588/// // You can configure optional parameters by calling the respective setters at will, and
6589/// // execute the final call using `doit()`.
6590/// // Values shown here are possibly random and not representative !
6591/// let result = hub.accounts().containers_reauthorize_environments_update(req, "accountId", "containerId", "environmentId")
6592///              .doit().await;
6593/// # }
6594/// ```
6595pub struct AccountContainerReauthorizeEnvironmentUpdateCall<'a, C>
6596where
6597    C: 'a,
6598{
6599    hub: &'a TagManager<C>,
6600    _request: Environment,
6601    _account_id: String,
6602    _container_id: String,
6603    _environment_id: String,
6604    _delegate: Option<&'a mut dyn common::Delegate>,
6605    _additional_params: HashMap<String, String>,
6606    _scopes: BTreeSet<String>,
6607}
6608
6609impl<'a, C> common::CallBuilder for AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {}
6610
6611impl<'a, C> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C>
6612where
6613    C: common::Connector,
6614{
6615    /// Perform the operation you have build so far.
6616    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
6617        use std::borrow::Cow;
6618        use std::io::{Read, Seek};
6619
6620        use common::{url::Params, ToParts};
6621        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6622
6623        let mut dd = common::DefaultDelegate;
6624        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6625        dlg.begin(common::MethodInfo {
6626            id: "tagmanager.accounts.containers.reauthorize_environments.update",
6627            http_method: hyper::Method::PUT,
6628        });
6629
6630        for &field in ["alt", "accountId", "containerId", "environmentId"].iter() {
6631            if self._additional_params.contains_key(field) {
6632                dlg.finished(false);
6633                return Err(common::Error::FieldClash(field));
6634            }
6635        }
6636
6637        let mut params = Params::with_capacity(6 + self._additional_params.len());
6638        params.push("accountId", self._account_id);
6639        params.push("containerId", self._container_id);
6640        params.push("environmentId", self._environment_id);
6641
6642        params.extend(self._additional_params.iter());
6643
6644        params.push("alt", "json");
6645        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/reauthorize_environments/{environmentId}";
6646        if self._scopes.is_empty() {
6647            self._scopes.insert(Scope::Publish.as_ref().to_string());
6648        }
6649
6650        #[allow(clippy::single_element_loop)]
6651        for &(find_this, param_name) in [
6652            ("{accountId}", "accountId"),
6653            ("{containerId}", "containerId"),
6654            ("{environmentId}", "environmentId"),
6655        ]
6656        .iter()
6657        {
6658            url = params.uri_replacement(url, param_name, find_this, false);
6659        }
6660        {
6661            let to_remove = ["environmentId", "containerId", "accountId"];
6662            params.remove_params(&to_remove);
6663        }
6664
6665        let url = params.parse_with_url(&url);
6666
6667        let mut json_mime_type = mime::APPLICATION_JSON;
6668        let mut request_value_reader = {
6669            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6670            common::remove_json_null_values(&mut value);
6671            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6672            serde_json::to_writer(&mut dst, &value).unwrap();
6673            dst
6674        };
6675        let request_size = request_value_reader
6676            .seek(std::io::SeekFrom::End(0))
6677            .unwrap();
6678        request_value_reader
6679            .seek(std::io::SeekFrom::Start(0))
6680            .unwrap();
6681
6682        loop {
6683            let token = match self
6684                .hub
6685                .auth
6686                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6687                .await
6688            {
6689                Ok(token) => token,
6690                Err(e) => match dlg.token(e) {
6691                    Ok(token) => token,
6692                    Err(e) => {
6693                        dlg.finished(false);
6694                        return Err(common::Error::MissingToken(e));
6695                    }
6696                },
6697            };
6698            request_value_reader
6699                .seek(std::io::SeekFrom::Start(0))
6700                .unwrap();
6701            let mut req_result = {
6702                let client = &self.hub.client;
6703                dlg.pre_request();
6704                let mut req_builder = hyper::Request::builder()
6705                    .method(hyper::Method::PUT)
6706                    .uri(url.as_str())
6707                    .header(USER_AGENT, self.hub._user_agent.clone());
6708
6709                if let Some(token) = token.as_ref() {
6710                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6711                }
6712
6713                let request = req_builder
6714                    .header(CONTENT_TYPE, json_mime_type.to_string())
6715                    .header(CONTENT_LENGTH, request_size as u64)
6716                    .body(common::to_body(
6717                        request_value_reader.get_ref().clone().into(),
6718                    ));
6719
6720                client.request(request.unwrap()).await
6721            };
6722
6723            match req_result {
6724                Err(err) => {
6725                    if let common::Retry::After(d) = dlg.http_error(&err) {
6726                        sleep(d).await;
6727                        continue;
6728                    }
6729                    dlg.finished(false);
6730                    return Err(common::Error::HttpError(err));
6731                }
6732                Ok(res) => {
6733                    let (mut parts, body) = res.into_parts();
6734                    let mut body = common::Body::new(body);
6735                    if !parts.status.is_success() {
6736                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6737                        let error = serde_json::from_str(&common::to_string(&bytes));
6738                        let response = common::to_response(parts, bytes.into());
6739
6740                        if let common::Retry::After(d) =
6741                            dlg.http_failure(&response, error.as_ref().ok())
6742                        {
6743                            sleep(d).await;
6744                            continue;
6745                        }
6746
6747                        dlg.finished(false);
6748
6749                        return Err(match error {
6750                            Ok(value) => common::Error::BadRequest(value),
6751                            _ => common::Error::Failure(response),
6752                        });
6753                    }
6754                    let response = {
6755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6756                        let encoded = common::to_string(&bytes);
6757                        match serde_json::from_str(&encoded) {
6758                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6759                            Err(error) => {
6760                                dlg.response_json_decode_error(&encoded, &error);
6761                                return Err(common::Error::JsonDecodeError(
6762                                    encoded.to_string(),
6763                                    error,
6764                                ));
6765                            }
6766                        }
6767                    };
6768
6769                    dlg.finished(true);
6770                    return Ok(response);
6771                }
6772            }
6773        }
6774    }
6775
6776    ///
6777    /// Sets the *request* property to the given value.
6778    ///
6779    /// Even though the property as already been set when instantiating this call,
6780    /// we provide this method for API completeness.
6781    pub fn request(
6782        mut self,
6783        new_value: Environment,
6784    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6785        self._request = new_value;
6786        self
6787    }
6788    /// The GTM Account ID.
6789    ///
6790    /// Sets the *account id* path property to the given value.
6791    ///
6792    /// Even though the property as already been set when instantiating this call,
6793    /// we provide this method for API completeness.
6794    pub fn account_id(
6795        mut self,
6796        new_value: &str,
6797    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6798        self._account_id = new_value.to_string();
6799        self
6800    }
6801    /// The GTM Container ID.
6802    ///
6803    /// Sets the *container id* path property to the given value.
6804    ///
6805    /// Even though the property as already been set when instantiating this call,
6806    /// we provide this method for API completeness.
6807    pub fn container_id(
6808        mut self,
6809        new_value: &str,
6810    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6811        self._container_id = new_value.to_string();
6812        self
6813    }
6814    /// The GTM Environment ID.
6815    ///
6816    /// Sets the *environment id* path property to the given value.
6817    ///
6818    /// Even though the property as already been set when instantiating this call,
6819    /// we provide this method for API completeness.
6820    pub fn environment_id(
6821        mut self,
6822        new_value: &str,
6823    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6824        self._environment_id = new_value.to_string();
6825        self
6826    }
6827    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6828    /// while executing the actual API request.
6829    ///
6830    /// ````text
6831    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6832    /// ````
6833    ///
6834    /// Sets the *delegate* property to the given value.
6835    pub fn delegate(
6836        mut self,
6837        new_value: &'a mut dyn common::Delegate,
6838    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6839        self._delegate = Some(new_value);
6840        self
6841    }
6842
6843    /// Set any additional parameter of the query string used in the request.
6844    /// It should be used to set parameters which are not yet available through their own
6845    /// setters.
6846    ///
6847    /// Please note that this method must not be used to set any of the known parameters
6848    /// which have their own setter method. If done anyway, the request will fail.
6849    ///
6850    /// # Additional Parameters
6851    ///
6852    /// * *$.xgafv* (query-string) - V1 error format.
6853    /// * *access_token* (query-string) - OAuth access token.
6854    /// * *alt* (query-string) - Data format for response.
6855    /// * *callback* (query-string) - JSONP
6856    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6857    /// * *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.
6858    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6859    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6860    /// * *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.
6861    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6862    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6863    pub fn param<T>(
6864        mut self,
6865        name: T,
6866        value: T,
6867    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C>
6868    where
6869        T: AsRef<str>,
6870    {
6871        self._additional_params
6872            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6873        self
6874    }
6875
6876    /// Identifies the authorization scope for the method you are building.
6877    ///
6878    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6879    /// [`Scope::Publish`].
6880    ///
6881    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6882    /// tokens for more than one scope.
6883    ///
6884    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6885    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6886    /// sufficient, a read-write scope will do as well.
6887    pub fn add_scope<St>(
6888        mut self,
6889        scope: St,
6890    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C>
6891    where
6892        St: AsRef<str>,
6893    {
6894        self._scopes.insert(String::from(scope.as_ref()));
6895        self
6896    }
6897    /// Identifies the authorization scope(s) for the method you are building.
6898    ///
6899    /// See [`Self::add_scope()`] for details.
6900    pub fn add_scopes<I, St>(
6901        mut self,
6902        scopes: I,
6903    ) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C>
6904    where
6905        I: IntoIterator<Item = St>,
6906        St: AsRef<str>,
6907    {
6908        self._scopes
6909            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6910        self
6911    }
6912
6913    /// Removes all scopes, and no default scope will be used either.
6914    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6915    /// for details).
6916    pub fn clear_scopes(mut self) -> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C> {
6917        self._scopes.clear();
6918        self
6919    }
6920}
6921
6922/// Creates a GTM Tag.
6923///
6924/// A builder for the *containers.tags.create* method supported by a *account* resource.
6925/// It is not used directly, but through a [`AccountMethods`] instance.
6926///
6927/// # Example
6928///
6929/// Instantiate a resource method builder
6930///
6931/// ```test_harness,no_run
6932/// # extern crate hyper;
6933/// # extern crate hyper_rustls;
6934/// # extern crate google_tagmanager1 as tagmanager1;
6935/// use tagmanager1::api::Tag;
6936/// # async fn dox() {
6937/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6938///
6939/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6940/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6941/// #     .with_native_roots()
6942/// #     .unwrap()
6943/// #     .https_only()
6944/// #     .enable_http2()
6945/// #     .build();
6946///
6947/// # let executor = hyper_util::rt::TokioExecutor::new();
6948/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6949/// #     secret,
6950/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6951/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6952/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6953/// #     ),
6954/// # ).build().await.unwrap();
6955///
6956/// # let client = hyper_util::client::legacy::Client::builder(
6957/// #     hyper_util::rt::TokioExecutor::new()
6958/// # )
6959/// # .build(
6960/// #     hyper_rustls::HttpsConnectorBuilder::new()
6961/// #         .with_native_roots()
6962/// #         .unwrap()
6963/// #         .https_or_http()
6964/// #         .enable_http2()
6965/// #         .build()
6966/// # );
6967/// # let mut hub = TagManager::new(client, auth);
6968/// // As the method needs a request, you would usually fill it with the desired information
6969/// // into the respective structure. Some of the parts shown here might not be applicable !
6970/// // Values shown here are possibly random and not representative !
6971/// let mut req = Tag::default();
6972///
6973/// // You can configure optional parameters by calling the respective setters at will, and
6974/// // execute the final call using `doit()`.
6975/// // Values shown here are possibly random and not representative !
6976/// let result = hub.accounts().containers_tags_create(req, "accountId", "containerId")
6977///              .doit().await;
6978/// # }
6979/// ```
6980pub struct AccountContainerTagCreateCall<'a, C>
6981where
6982    C: 'a,
6983{
6984    hub: &'a TagManager<C>,
6985    _request: Tag,
6986    _account_id: String,
6987    _container_id: String,
6988    _delegate: Option<&'a mut dyn common::Delegate>,
6989    _additional_params: HashMap<String, String>,
6990    _scopes: BTreeSet<String>,
6991}
6992
6993impl<'a, C> common::CallBuilder for AccountContainerTagCreateCall<'a, C> {}
6994
6995impl<'a, C> AccountContainerTagCreateCall<'a, C>
6996where
6997    C: common::Connector,
6998{
6999    /// Perform the operation you have build so far.
7000    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
7001        use std::borrow::Cow;
7002        use std::io::{Read, Seek};
7003
7004        use common::{url::Params, ToParts};
7005        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7006
7007        let mut dd = common::DefaultDelegate;
7008        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7009        dlg.begin(common::MethodInfo {
7010            id: "tagmanager.accounts.containers.tags.create",
7011            http_method: hyper::Method::POST,
7012        });
7013
7014        for &field in ["alt", "accountId", "containerId"].iter() {
7015            if self._additional_params.contains_key(field) {
7016                dlg.finished(false);
7017                return Err(common::Error::FieldClash(field));
7018            }
7019        }
7020
7021        let mut params = Params::with_capacity(5 + self._additional_params.len());
7022        params.push("accountId", self._account_id);
7023        params.push("containerId", self._container_id);
7024
7025        params.extend(self._additional_params.iter());
7026
7027        params.push("alt", "json");
7028        let mut url = self.hub._base_url.clone()
7029            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/tags";
7030        if self._scopes.is_empty() {
7031            self._scopes
7032                .insert(Scope::EditContainer.as_ref().to_string());
7033        }
7034
7035        #[allow(clippy::single_element_loop)]
7036        for &(find_this, param_name) in [
7037            ("{accountId}", "accountId"),
7038            ("{containerId}", "containerId"),
7039        ]
7040        .iter()
7041        {
7042            url = params.uri_replacement(url, param_name, find_this, false);
7043        }
7044        {
7045            let to_remove = ["containerId", "accountId"];
7046            params.remove_params(&to_remove);
7047        }
7048
7049        let url = params.parse_with_url(&url);
7050
7051        let mut json_mime_type = mime::APPLICATION_JSON;
7052        let mut request_value_reader = {
7053            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7054            common::remove_json_null_values(&mut value);
7055            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7056            serde_json::to_writer(&mut dst, &value).unwrap();
7057            dst
7058        };
7059        let request_size = request_value_reader
7060            .seek(std::io::SeekFrom::End(0))
7061            .unwrap();
7062        request_value_reader
7063            .seek(std::io::SeekFrom::Start(0))
7064            .unwrap();
7065
7066        loop {
7067            let token = match self
7068                .hub
7069                .auth
7070                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7071                .await
7072            {
7073                Ok(token) => token,
7074                Err(e) => match dlg.token(e) {
7075                    Ok(token) => token,
7076                    Err(e) => {
7077                        dlg.finished(false);
7078                        return Err(common::Error::MissingToken(e));
7079                    }
7080                },
7081            };
7082            request_value_reader
7083                .seek(std::io::SeekFrom::Start(0))
7084                .unwrap();
7085            let mut req_result = {
7086                let client = &self.hub.client;
7087                dlg.pre_request();
7088                let mut req_builder = hyper::Request::builder()
7089                    .method(hyper::Method::POST)
7090                    .uri(url.as_str())
7091                    .header(USER_AGENT, self.hub._user_agent.clone());
7092
7093                if let Some(token) = token.as_ref() {
7094                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7095                }
7096
7097                let request = req_builder
7098                    .header(CONTENT_TYPE, json_mime_type.to_string())
7099                    .header(CONTENT_LENGTH, request_size as u64)
7100                    .body(common::to_body(
7101                        request_value_reader.get_ref().clone().into(),
7102                    ));
7103
7104                client.request(request.unwrap()).await
7105            };
7106
7107            match req_result {
7108                Err(err) => {
7109                    if let common::Retry::After(d) = dlg.http_error(&err) {
7110                        sleep(d).await;
7111                        continue;
7112                    }
7113                    dlg.finished(false);
7114                    return Err(common::Error::HttpError(err));
7115                }
7116                Ok(res) => {
7117                    let (mut parts, body) = res.into_parts();
7118                    let mut body = common::Body::new(body);
7119                    if !parts.status.is_success() {
7120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7121                        let error = serde_json::from_str(&common::to_string(&bytes));
7122                        let response = common::to_response(parts, bytes.into());
7123
7124                        if let common::Retry::After(d) =
7125                            dlg.http_failure(&response, error.as_ref().ok())
7126                        {
7127                            sleep(d).await;
7128                            continue;
7129                        }
7130
7131                        dlg.finished(false);
7132
7133                        return Err(match error {
7134                            Ok(value) => common::Error::BadRequest(value),
7135                            _ => common::Error::Failure(response),
7136                        });
7137                    }
7138                    let response = {
7139                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7140                        let encoded = common::to_string(&bytes);
7141                        match serde_json::from_str(&encoded) {
7142                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7143                            Err(error) => {
7144                                dlg.response_json_decode_error(&encoded, &error);
7145                                return Err(common::Error::JsonDecodeError(
7146                                    encoded.to_string(),
7147                                    error,
7148                                ));
7149                            }
7150                        }
7151                    };
7152
7153                    dlg.finished(true);
7154                    return Ok(response);
7155                }
7156            }
7157        }
7158    }
7159
7160    ///
7161    /// Sets the *request* property to the given value.
7162    ///
7163    /// Even though the property as already been set when instantiating this call,
7164    /// we provide this method for API completeness.
7165    pub fn request(mut self, new_value: Tag) -> AccountContainerTagCreateCall<'a, C> {
7166        self._request = new_value;
7167        self
7168    }
7169    /// The GTM Account ID.
7170    ///
7171    /// Sets the *account id* path property to the given value.
7172    ///
7173    /// Even though the property as already been set when instantiating this call,
7174    /// we provide this method for API completeness.
7175    pub fn account_id(mut self, new_value: &str) -> AccountContainerTagCreateCall<'a, C> {
7176        self._account_id = new_value.to_string();
7177        self
7178    }
7179    /// The GTM Container ID.
7180    ///
7181    /// Sets the *container id* path property to the given value.
7182    ///
7183    /// Even though the property as already been set when instantiating this call,
7184    /// we provide this method for API completeness.
7185    pub fn container_id(mut self, new_value: &str) -> AccountContainerTagCreateCall<'a, C> {
7186        self._container_id = new_value.to_string();
7187        self
7188    }
7189    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7190    /// while executing the actual API request.
7191    ///
7192    /// ````text
7193    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7194    /// ````
7195    ///
7196    /// Sets the *delegate* property to the given value.
7197    pub fn delegate(
7198        mut self,
7199        new_value: &'a mut dyn common::Delegate,
7200    ) -> AccountContainerTagCreateCall<'a, C> {
7201        self._delegate = Some(new_value);
7202        self
7203    }
7204
7205    /// Set any additional parameter of the query string used in the request.
7206    /// It should be used to set parameters which are not yet available through their own
7207    /// setters.
7208    ///
7209    /// Please note that this method must not be used to set any of the known parameters
7210    /// which have their own setter method. If done anyway, the request will fail.
7211    ///
7212    /// # Additional Parameters
7213    ///
7214    /// * *$.xgafv* (query-string) - V1 error format.
7215    /// * *access_token* (query-string) - OAuth access token.
7216    /// * *alt* (query-string) - Data format for response.
7217    /// * *callback* (query-string) - JSONP
7218    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7219    /// * *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.
7220    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7221    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7222    /// * *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.
7223    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7224    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7225    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTagCreateCall<'a, C>
7226    where
7227        T: AsRef<str>,
7228    {
7229        self._additional_params
7230            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7231        self
7232    }
7233
7234    /// Identifies the authorization scope for the method you are building.
7235    ///
7236    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7237    /// [`Scope::EditContainer`].
7238    ///
7239    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7240    /// tokens for more than one scope.
7241    ///
7242    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7243    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7244    /// sufficient, a read-write scope will do as well.
7245    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTagCreateCall<'a, C>
7246    where
7247        St: AsRef<str>,
7248    {
7249        self._scopes.insert(String::from(scope.as_ref()));
7250        self
7251    }
7252    /// Identifies the authorization scope(s) for the method you are building.
7253    ///
7254    /// See [`Self::add_scope()`] for details.
7255    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTagCreateCall<'a, C>
7256    where
7257        I: IntoIterator<Item = St>,
7258        St: AsRef<str>,
7259    {
7260        self._scopes
7261            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7262        self
7263    }
7264
7265    /// Removes all scopes, and no default scope will be used either.
7266    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7267    /// for details).
7268    pub fn clear_scopes(mut self) -> AccountContainerTagCreateCall<'a, C> {
7269        self._scopes.clear();
7270        self
7271    }
7272}
7273
7274/// Deletes a GTM Tag.
7275///
7276/// A builder for the *containers.tags.delete* method supported by a *account* resource.
7277/// It is not used directly, but through a [`AccountMethods`] instance.
7278///
7279/// # Example
7280///
7281/// Instantiate a resource method builder
7282///
7283/// ```test_harness,no_run
7284/// # extern crate hyper;
7285/// # extern crate hyper_rustls;
7286/// # extern crate google_tagmanager1 as tagmanager1;
7287/// # async fn dox() {
7288/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7289///
7290/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7291/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7292/// #     .with_native_roots()
7293/// #     .unwrap()
7294/// #     .https_only()
7295/// #     .enable_http2()
7296/// #     .build();
7297///
7298/// # let executor = hyper_util::rt::TokioExecutor::new();
7299/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7300/// #     secret,
7301/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7302/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7303/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7304/// #     ),
7305/// # ).build().await.unwrap();
7306///
7307/// # let client = hyper_util::client::legacy::Client::builder(
7308/// #     hyper_util::rt::TokioExecutor::new()
7309/// # )
7310/// # .build(
7311/// #     hyper_rustls::HttpsConnectorBuilder::new()
7312/// #         .with_native_roots()
7313/// #         .unwrap()
7314/// #         .https_or_http()
7315/// #         .enable_http2()
7316/// #         .build()
7317/// # );
7318/// # let mut hub = TagManager::new(client, auth);
7319/// // You can configure optional parameters by calling the respective setters at will, and
7320/// // execute the final call using `doit()`.
7321/// // Values shown here are possibly random and not representative !
7322/// let result = hub.accounts().containers_tags_delete("accountId", "containerId", "tagId")
7323///              .doit().await;
7324/// # }
7325/// ```
7326pub struct AccountContainerTagDeleteCall<'a, C>
7327where
7328    C: 'a,
7329{
7330    hub: &'a TagManager<C>,
7331    _account_id: String,
7332    _container_id: String,
7333    _tag_id: String,
7334    _delegate: Option<&'a mut dyn common::Delegate>,
7335    _additional_params: HashMap<String, String>,
7336    _scopes: BTreeSet<String>,
7337}
7338
7339impl<'a, C> common::CallBuilder for AccountContainerTagDeleteCall<'a, C> {}
7340
7341impl<'a, C> AccountContainerTagDeleteCall<'a, C>
7342where
7343    C: common::Connector,
7344{
7345    /// Perform the operation you have build so far.
7346    pub async fn doit(mut self) -> common::Result<common::Response> {
7347        use std::borrow::Cow;
7348        use std::io::{Read, Seek};
7349
7350        use common::{url::Params, ToParts};
7351        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7352
7353        let mut dd = common::DefaultDelegate;
7354        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7355        dlg.begin(common::MethodInfo {
7356            id: "tagmanager.accounts.containers.tags.delete",
7357            http_method: hyper::Method::DELETE,
7358        });
7359
7360        for &field in ["accountId", "containerId", "tagId"].iter() {
7361            if self._additional_params.contains_key(field) {
7362                dlg.finished(false);
7363                return Err(common::Error::FieldClash(field));
7364            }
7365        }
7366
7367        let mut params = Params::with_capacity(4 + self._additional_params.len());
7368        params.push("accountId", self._account_id);
7369        params.push("containerId", self._container_id);
7370        params.push("tagId", self._tag_id);
7371
7372        params.extend(self._additional_params.iter());
7373
7374        let mut url = self.hub._base_url.clone()
7375            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/tags/{tagId}";
7376        if self._scopes.is_empty() {
7377            self._scopes
7378                .insert(Scope::EditContainer.as_ref().to_string());
7379        }
7380
7381        #[allow(clippy::single_element_loop)]
7382        for &(find_this, param_name) in [
7383            ("{accountId}", "accountId"),
7384            ("{containerId}", "containerId"),
7385            ("{tagId}", "tagId"),
7386        ]
7387        .iter()
7388        {
7389            url = params.uri_replacement(url, param_name, find_this, false);
7390        }
7391        {
7392            let to_remove = ["tagId", "containerId", "accountId"];
7393            params.remove_params(&to_remove);
7394        }
7395
7396        let url = params.parse_with_url(&url);
7397
7398        loop {
7399            let token = match self
7400                .hub
7401                .auth
7402                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7403                .await
7404            {
7405                Ok(token) => token,
7406                Err(e) => match dlg.token(e) {
7407                    Ok(token) => token,
7408                    Err(e) => {
7409                        dlg.finished(false);
7410                        return Err(common::Error::MissingToken(e));
7411                    }
7412                },
7413            };
7414            let mut req_result = {
7415                let client = &self.hub.client;
7416                dlg.pre_request();
7417                let mut req_builder = hyper::Request::builder()
7418                    .method(hyper::Method::DELETE)
7419                    .uri(url.as_str())
7420                    .header(USER_AGENT, self.hub._user_agent.clone());
7421
7422                if let Some(token) = token.as_ref() {
7423                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7424                }
7425
7426                let request = req_builder
7427                    .header(CONTENT_LENGTH, 0_u64)
7428                    .body(common::to_body::<String>(None));
7429
7430                client.request(request.unwrap()).await
7431            };
7432
7433            match req_result {
7434                Err(err) => {
7435                    if let common::Retry::After(d) = dlg.http_error(&err) {
7436                        sleep(d).await;
7437                        continue;
7438                    }
7439                    dlg.finished(false);
7440                    return Err(common::Error::HttpError(err));
7441                }
7442                Ok(res) => {
7443                    let (mut parts, body) = res.into_parts();
7444                    let mut body = common::Body::new(body);
7445                    if !parts.status.is_success() {
7446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7447                        let error = serde_json::from_str(&common::to_string(&bytes));
7448                        let response = common::to_response(parts, bytes.into());
7449
7450                        if let common::Retry::After(d) =
7451                            dlg.http_failure(&response, error.as_ref().ok())
7452                        {
7453                            sleep(d).await;
7454                            continue;
7455                        }
7456
7457                        dlg.finished(false);
7458
7459                        return Err(match error {
7460                            Ok(value) => common::Error::BadRequest(value),
7461                            _ => common::Error::Failure(response),
7462                        });
7463                    }
7464                    let response = common::Response::from_parts(parts, body);
7465
7466                    dlg.finished(true);
7467                    return Ok(response);
7468                }
7469            }
7470        }
7471    }
7472
7473    /// The GTM Account ID.
7474    ///
7475    /// Sets the *account id* path property to the given value.
7476    ///
7477    /// Even though the property as already been set when instantiating this call,
7478    /// we provide this method for API completeness.
7479    pub fn account_id(mut self, new_value: &str) -> AccountContainerTagDeleteCall<'a, C> {
7480        self._account_id = new_value.to_string();
7481        self
7482    }
7483    /// The GTM Container ID.
7484    ///
7485    /// Sets the *container id* path property to the given value.
7486    ///
7487    /// Even though the property as already been set when instantiating this call,
7488    /// we provide this method for API completeness.
7489    pub fn container_id(mut self, new_value: &str) -> AccountContainerTagDeleteCall<'a, C> {
7490        self._container_id = new_value.to_string();
7491        self
7492    }
7493    /// The GTM Tag ID.
7494    ///
7495    /// Sets the *tag id* path property to the given value.
7496    ///
7497    /// Even though the property as already been set when instantiating this call,
7498    /// we provide this method for API completeness.
7499    pub fn tag_id(mut self, new_value: &str) -> AccountContainerTagDeleteCall<'a, C> {
7500        self._tag_id = new_value.to_string();
7501        self
7502    }
7503    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7504    /// while executing the actual API request.
7505    ///
7506    /// ````text
7507    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7508    /// ````
7509    ///
7510    /// Sets the *delegate* property to the given value.
7511    pub fn delegate(
7512        mut self,
7513        new_value: &'a mut dyn common::Delegate,
7514    ) -> AccountContainerTagDeleteCall<'a, C> {
7515        self._delegate = Some(new_value);
7516        self
7517    }
7518
7519    /// Set any additional parameter of the query string used in the request.
7520    /// It should be used to set parameters which are not yet available through their own
7521    /// setters.
7522    ///
7523    /// Please note that this method must not be used to set any of the known parameters
7524    /// which have their own setter method. If done anyway, the request will fail.
7525    ///
7526    /// # Additional Parameters
7527    ///
7528    /// * *$.xgafv* (query-string) - V1 error format.
7529    /// * *access_token* (query-string) - OAuth access token.
7530    /// * *alt* (query-string) - Data format for response.
7531    /// * *callback* (query-string) - JSONP
7532    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7533    /// * *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.
7534    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7535    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7536    /// * *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.
7537    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7538    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7539    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTagDeleteCall<'a, C>
7540    where
7541        T: AsRef<str>,
7542    {
7543        self._additional_params
7544            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7545        self
7546    }
7547
7548    /// Identifies the authorization scope for the method you are building.
7549    ///
7550    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7551    /// [`Scope::EditContainer`].
7552    ///
7553    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7554    /// tokens for more than one scope.
7555    ///
7556    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7557    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7558    /// sufficient, a read-write scope will do as well.
7559    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTagDeleteCall<'a, C>
7560    where
7561        St: AsRef<str>,
7562    {
7563        self._scopes.insert(String::from(scope.as_ref()));
7564        self
7565    }
7566    /// Identifies the authorization scope(s) for the method you are building.
7567    ///
7568    /// See [`Self::add_scope()`] for details.
7569    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTagDeleteCall<'a, C>
7570    where
7571        I: IntoIterator<Item = St>,
7572        St: AsRef<str>,
7573    {
7574        self._scopes
7575            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7576        self
7577    }
7578
7579    /// Removes all scopes, and no default scope will be used either.
7580    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7581    /// for details).
7582    pub fn clear_scopes(mut self) -> AccountContainerTagDeleteCall<'a, C> {
7583        self._scopes.clear();
7584        self
7585    }
7586}
7587
7588/// Gets a GTM Tag.
7589///
7590/// A builder for the *containers.tags.get* method supported by a *account* resource.
7591/// It is not used directly, but through a [`AccountMethods`] instance.
7592///
7593/// # Example
7594///
7595/// Instantiate a resource method builder
7596///
7597/// ```test_harness,no_run
7598/// # extern crate hyper;
7599/// # extern crate hyper_rustls;
7600/// # extern crate google_tagmanager1 as tagmanager1;
7601/// # async fn dox() {
7602/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7603///
7604/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7605/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7606/// #     .with_native_roots()
7607/// #     .unwrap()
7608/// #     .https_only()
7609/// #     .enable_http2()
7610/// #     .build();
7611///
7612/// # let executor = hyper_util::rt::TokioExecutor::new();
7613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7614/// #     secret,
7615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7616/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7617/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7618/// #     ),
7619/// # ).build().await.unwrap();
7620///
7621/// # let client = hyper_util::client::legacy::Client::builder(
7622/// #     hyper_util::rt::TokioExecutor::new()
7623/// # )
7624/// # .build(
7625/// #     hyper_rustls::HttpsConnectorBuilder::new()
7626/// #         .with_native_roots()
7627/// #         .unwrap()
7628/// #         .https_or_http()
7629/// #         .enable_http2()
7630/// #         .build()
7631/// # );
7632/// # let mut hub = TagManager::new(client, auth);
7633/// // You can configure optional parameters by calling the respective setters at will, and
7634/// // execute the final call using `doit()`.
7635/// // Values shown here are possibly random and not representative !
7636/// let result = hub.accounts().containers_tags_get("accountId", "containerId", "tagId")
7637///              .doit().await;
7638/// # }
7639/// ```
7640pub struct AccountContainerTagGetCall<'a, C>
7641where
7642    C: 'a,
7643{
7644    hub: &'a TagManager<C>,
7645    _account_id: String,
7646    _container_id: String,
7647    _tag_id: String,
7648    _delegate: Option<&'a mut dyn common::Delegate>,
7649    _additional_params: HashMap<String, String>,
7650    _scopes: BTreeSet<String>,
7651}
7652
7653impl<'a, C> common::CallBuilder for AccountContainerTagGetCall<'a, C> {}
7654
7655impl<'a, C> AccountContainerTagGetCall<'a, C>
7656where
7657    C: common::Connector,
7658{
7659    /// Perform the operation you have build so far.
7660    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
7661        use std::borrow::Cow;
7662        use std::io::{Read, Seek};
7663
7664        use common::{url::Params, ToParts};
7665        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7666
7667        let mut dd = common::DefaultDelegate;
7668        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7669        dlg.begin(common::MethodInfo {
7670            id: "tagmanager.accounts.containers.tags.get",
7671            http_method: hyper::Method::GET,
7672        });
7673
7674        for &field in ["alt", "accountId", "containerId", "tagId"].iter() {
7675            if self._additional_params.contains_key(field) {
7676                dlg.finished(false);
7677                return Err(common::Error::FieldClash(field));
7678            }
7679        }
7680
7681        let mut params = Params::with_capacity(5 + self._additional_params.len());
7682        params.push("accountId", self._account_id);
7683        params.push("containerId", self._container_id);
7684        params.push("tagId", self._tag_id);
7685
7686        params.extend(self._additional_params.iter());
7687
7688        params.push("alt", "json");
7689        let mut url = self.hub._base_url.clone()
7690            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/tags/{tagId}";
7691        if self._scopes.is_empty() {
7692            self._scopes.insert(Scope::Readonly.as_ref().to_string());
7693        }
7694
7695        #[allow(clippy::single_element_loop)]
7696        for &(find_this, param_name) in [
7697            ("{accountId}", "accountId"),
7698            ("{containerId}", "containerId"),
7699            ("{tagId}", "tagId"),
7700        ]
7701        .iter()
7702        {
7703            url = params.uri_replacement(url, param_name, find_this, false);
7704        }
7705        {
7706            let to_remove = ["tagId", "containerId", "accountId"];
7707            params.remove_params(&to_remove);
7708        }
7709
7710        let url = params.parse_with_url(&url);
7711
7712        loop {
7713            let token = match self
7714                .hub
7715                .auth
7716                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7717                .await
7718            {
7719                Ok(token) => token,
7720                Err(e) => match dlg.token(e) {
7721                    Ok(token) => token,
7722                    Err(e) => {
7723                        dlg.finished(false);
7724                        return Err(common::Error::MissingToken(e));
7725                    }
7726                },
7727            };
7728            let mut req_result = {
7729                let client = &self.hub.client;
7730                dlg.pre_request();
7731                let mut req_builder = hyper::Request::builder()
7732                    .method(hyper::Method::GET)
7733                    .uri(url.as_str())
7734                    .header(USER_AGENT, self.hub._user_agent.clone());
7735
7736                if let Some(token) = token.as_ref() {
7737                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7738                }
7739
7740                let request = req_builder
7741                    .header(CONTENT_LENGTH, 0_u64)
7742                    .body(common::to_body::<String>(None));
7743
7744                client.request(request.unwrap()).await
7745            };
7746
7747            match req_result {
7748                Err(err) => {
7749                    if let common::Retry::After(d) = dlg.http_error(&err) {
7750                        sleep(d).await;
7751                        continue;
7752                    }
7753                    dlg.finished(false);
7754                    return Err(common::Error::HttpError(err));
7755                }
7756                Ok(res) => {
7757                    let (mut parts, body) = res.into_parts();
7758                    let mut body = common::Body::new(body);
7759                    if !parts.status.is_success() {
7760                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7761                        let error = serde_json::from_str(&common::to_string(&bytes));
7762                        let response = common::to_response(parts, bytes.into());
7763
7764                        if let common::Retry::After(d) =
7765                            dlg.http_failure(&response, error.as_ref().ok())
7766                        {
7767                            sleep(d).await;
7768                            continue;
7769                        }
7770
7771                        dlg.finished(false);
7772
7773                        return Err(match error {
7774                            Ok(value) => common::Error::BadRequest(value),
7775                            _ => common::Error::Failure(response),
7776                        });
7777                    }
7778                    let response = {
7779                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7780                        let encoded = common::to_string(&bytes);
7781                        match serde_json::from_str(&encoded) {
7782                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7783                            Err(error) => {
7784                                dlg.response_json_decode_error(&encoded, &error);
7785                                return Err(common::Error::JsonDecodeError(
7786                                    encoded.to_string(),
7787                                    error,
7788                                ));
7789                            }
7790                        }
7791                    };
7792
7793                    dlg.finished(true);
7794                    return Ok(response);
7795                }
7796            }
7797        }
7798    }
7799
7800    /// The GTM Account ID.
7801    ///
7802    /// Sets the *account id* path property to the given value.
7803    ///
7804    /// Even though the property as already been set when instantiating this call,
7805    /// we provide this method for API completeness.
7806    pub fn account_id(mut self, new_value: &str) -> AccountContainerTagGetCall<'a, C> {
7807        self._account_id = new_value.to_string();
7808        self
7809    }
7810    /// The GTM Container ID.
7811    ///
7812    /// Sets the *container id* path property to the given value.
7813    ///
7814    /// Even though the property as already been set when instantiating this call,
7815    /// we provide this method for API completeness.
7816    pub fn container_id(mut self, new_value: &str) -> AccountContainerTagGetCall<'a, C> {
7817        self._container_id = new_value.to_string();
7818        self
7819    }
7820    /// The GTM Tag ID.
7821    ///
7822    /// Sets the *tag id* path property to the given value.
7823    ///
7824    /// Even though the property as already been set when instantiating this call,
7825    /// we provide this method for API completeness.
7826    pub fn tag_id(mut self, new_value: &str) -> AccountContainerTagGetCall<'a, C> {
7827        self._tag_id = new_value.to_string();
7828        self
7829    }
7830    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7831    /// while executing the actual API request.
7832    ///
7833    /// ````text
7834    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7835    /// ````
7836    ///
7837    /// Sets the *delegate* property to the given value.
7838    pub fn delegate(
7839        mut self,
7840        new_value: &'a mut dyn common::Delegate,
7841    ) -> AccountContainerTagGetCall<'a, C> {
7842        self._delegate = Some(new_value);
7843        self
7844    }
7845
7846    /// Set any additional parameter of the query string used in the request.
7847    /// It should be used to set parameters which are not yet available through their own
7848    /// setters.
7849    ///
7850    /// Please note that this method must not be used to set any of the known parameters
7851    /// which have their own setter method. If done anyway, the request will fail.
7852    ///
7853    /// # Additional Parameters
7854    ///
7855    /// * *$.xgafv* (query-string) - V1 error format.
7856    /// * *access_token* (query-string) - OAuth access token.
7857    /// * *alt* (query-string) - Data format for response.
7858    /// * *callback* (query-string) - JSONP
7859    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7860    /// * *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.
7861    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7862    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7863    /// * *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.
7864    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7865    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7866    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTagGetCall<'a, C>
7867    where
7868        T: AsRef<str>,
7869    {
7870        self._additional_params
7871            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7872        self
7873    }
7874
7875    /// Identifies the authorization scope for the method you are building.
7876    ///
7877    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7878    /// [`Scope::Readonly`].
7879    ///
7880    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7881    /// tokens for more than one scope.
7882    ///
7883    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7884    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7885    /// sufficient, a read-write scope will do as well.
7886    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTagGetCall<'a, C>
7887    where
7888        St: AsRef<str>,
7889    {
7890        self._scopes.insert(String::from(scope.as_ref()));
7891        self
7892    }
7893    /// Identifies the authorization scope(s) for the method you are building.
7894    ///
7895    /// See [`Self::add_scope()`] for details.
7896    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTagGetCall<'a, C>
7897    where
7898        I: IntoIterator<Item = St>,
7899        St: AsRef<str>,
7900    {
7901        self._scopes
7902            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7903        self
7904    }
7905
7906    /// Removes all scopes, and no default scope will be used either.
7907    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7908    /// for details).
7909    pub fn clear_scopes(mut self) -> AccountContainerTagGetCall<'a, C> {
7910        self._scopes.clear();
7911        self
7912    }
7913}
7914
7915/// Lists all GTM Tags of a Container.
7916///
7917/// A builder for the *containers.tags.list* method supported by a *account* resource.
7918/// It is not used directly, but through a [`AccountMethods`] instance.
7919///
7920/// # Example
7921///
7922/// Instantiate a resource method builder
7923///
7924/// ```test_harness,no_run
7925/// # extern crate hyper;
7926/// # extern crate hyper_rustls;
7927/// # extern crate google_tagmanager1 as tagmanager1;
7928/// # async fn dox() {
7929/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7930///
7931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7933/// #     .with_native_roots()
7934/// #     .unwrap()
7935/// #     .https_only()
7936/// #     .enable_http2()
7937/// #     .build();
7938///
7939/// # let executor = hyper_util::rt::TokioExecutor::new();
7940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7941/// #     secret,
7942/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7943/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7944/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7945/// #     ),
7946/// # ).build().await.unwrap();
7947///
7948/// # let client = hyper_util::client::legacy::Client::builder(
7949/// #     hyper_util::rt::TokioExecutor::new()
7950/// # )
7951/// # .build(
7952/// #     hyper_rustls::HttpsConnectorBuilder::new()
7953/// #         .with_native_roots()
7954/// #         .unwrap()
7955/// #         .https_or_http()
7956/// #         .enable_http2()
7957/// #         .build()
7958/// # );
7959/// # let mut hub = TagManager::new(client, auth);
7960/// // You can configure optional parameters by calling the respective setters at will, and
7961/// // execute the final call using `doit()`.
7962/// // Values shown here are possibly random and not representative !
7963/// let result = hub.accounts().containers_tags_list("accountId", "containerId")
7964///              .doit().await;
7965/// # }
7966/// ```
7967pub struct AccountContainerTagListCall<'a, C>
7968where
7969    C: 'a,
7970{
7971    hub: &'a TagManager<C>,
7972    _account_id: String,
7973    _container_id: String,
7974    _delegate: Option<&'a mut dyn common::Delegate>,
7975    _additional_params: HashMap<String, String>,
7976    _scopes: BTreeSet<String>,
7977}
7978
7979impl<'a, C> common::CallBuilder for AccountContainerTagListCall<'a, C> {}
7980
7981impl<'a, C> AccountContainerTagListCall<'a, C>
7982where
7983    C: common::Connector,
7984{
7985    /// Perform the operation you have build so far.
7986    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagsResponse)> {
7987        use std::borrow::Cow;
7988        use std::io::{Read, Seek};
7989
7990        use common::{url::Params, ToParts};
7991        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7992
7993        let mut dd = common::DefaultDelegate;
7994        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7995        dlg.begin(common::MethodInfo {
7996            id: "tagmanager.accounts.containers.tags.list",
7997            http_method: hyper::Method::GET,
7998        });
7999
8000        for &field in ["alt", "accountId", "containerId"].iter() {
8001            if self._additional_params.contains_key(field) {
8002                dlg.finished(false);
8003                return Err(common::Error::FieldClash(field));
8004            }
8005        }
8006
8007        let mut params = Params::with_capacity(4 + self._additional_params.len());
8008        params.push("accountId", self._account_id);
8009        params.push("containerId", self._container_id);
8010
8011        params.extend(self._additional_params.iter());
8012
8013        params.push("alt", "json");
8014        let mut url = self.hub._base_url.clone()
8015            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/tags";
8016        if self._scopes.is_empty() {
8017            self._scopes.insert(Scope::Readonly.as_ref().to_string());
8018        }
8019
8020        #[allow(clippy::single_element_loop)]
8021        for &(find_this, param_name) in [
8022            ("{accountId}", "accountId"),
8023            ("{containerId}", "containerId"),
8024        ]
8025        .iter()
8026        {
8027            url = params.uri_replacement(url, param_name, find_this, false);
8028        }
8029        {
8030            let to_remove = ["containerId", "accountId"];
8031            params.remove_params(&to_remove);
8032        }
8033
8034        let url = params.parse_with_url(&url);
8035
8036        loop {
8037            let token = match self
8038                .hub
8039                .auth
8040                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8041                .await
8042            {
8043                Ok(token) => token,
8044                Err(e) => match dlg.token(e) {
8045                    Ok(token) => token,
8046                    Err(e) => {
8047                        dlg.finished(false);
8048                        return Err(common::Error::MissingToken(e));
8049                    }
8050                },
8051            };
8052            let mut req_result = {
8053                let client = &self.hub.client;
8054                dlg.pre_request();
8055                let mut req_builder = hyper::Request::builder()
8056                    .method(hyper::Method::GET)
8057                    .uri(url.as_str())
8058                    .header(USER_AGENT, self.hub._user_agent.clone());
8059
8060                if let Some(token) = token.as_ref() {
8061                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8062                }
8063
8064                let request = req_builder
8065                    .header(CONTENT_LENGTH, 0_u64)
8066                    .body(common::to_body::<String>(None));
8067
8068                client.request(request.unwrap()).await
8069            };
8070
8071            match req_result {
8072                Err(err) => {
8073                    if let common::Retry::After(d) = dlg.http_error(&err) {
8074                        sleep(d).await;
8075                        continue;
8076                    }
8077                    dlg.finished(false);
8078                    return Err(common::Error::HttpError(err));
8079                }
8080                Ok(res) => {
8081                    let (mut parts, body) = res.into_parts();
8082                    let mut body = common::Body::new(body);
8083                    if !parts.status.is_success() {
8084                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8085                        let error = serde_json::from_str(&common::to_string(&bytes));
8086                        let response = common::to_response(parts, bytes.into());
8087
8088                        if let common::Retry::After(d) =
8089                            dlg.http_failure(&response, error.as_ref().ok())
8090                        {
8091                            sleep(d).await;
8092                            continue;
8093                        }
8094
8095                        dlg.finished(false);
8096
8097                        return Err(match error {
8098                            Ok(value) => common::Error::BadRequest(value),
8099                            _ => common::Error::Failure(response),
8100                        });
8101                    }
8102                    let response = {
8103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8104                        let encoded = common::to_string(&bytes);
8105                        match serde_json::from_str(&encoded) {
8106                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8107                            Err(error) => {
8108                                dlg.response_json_decode_error(&encoded, &error);
8109                                return Err(common::Error::JsonDecodeError(
8110                                    encoded.to_string(),
8111                                    error,
8112                                ));
8113                            }
8114                        }
8115                    };
8116
8117                    dlg.finished(true);
8118                    return Ok(response);
8119                }
8120            }
8121        }
8122    }
8123
8124    /// The GTM Account ID.
8125    ///
8126    /// Sets the *account id* path property to the given value.
8127    ///
8128    /// Even though the property as already been set when instantiating this call,
8129    /// we provide this method for API completeness.
8130    pub fn account_id(mut self, new_value: &str) -> AccountContainerTagListCall<'a, C> {
8131        self._account_id = new_value.to_string();
8132        self
8133    }
8134    /// The GTM Container ID.
8135    ///
8136    /// Sets the *container id* path property to the given value.
8137    ///
8138    /// Even though the property as already been set when instantiating this call,
8139    /// we provide this method for API completeness.
8140    pub fn container_id(mut self, new_value: &str) -> AccountContainerTagListCall<'a, C> {
8141        self._container_id = new_value.to_string();
8142        self
8143    }
8144    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8145    /// while executing the actual API request.
8146    ///
8147    /// ````text
8148    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8149    /// ````
8150    ///
8151    /// Sets the *delegate* property to the given value.
8152    pub fn delegate(
8153        mut self,
8154        new_value: &'a mut dyn common::Delegate,
8155    ) -> AccountContainerTagListCall<'a, C> {
8156        self._delegate = Some(new_value);
8157        self
8158    }
8159
8160    /// Set any additional parameter of the query string used in the request.
8161    /// It should be used to set parameters which are not yet available through their own
8162    /// setters.
8163    ///
8164    /// Please note that this method must not be used to set any of the known parameters
8165    /// which have their own setter method. If done anyway, the request will fail.
8166    ///
8167    /// # Additional Parameters
8168    ///
8169    /// * *$.xgafv* (query-string) - V1 error format.
8170    /// * *access_token* (query-string) - OAuth access token.
8171    /// * *alt* (query-string) - Data format for response.
8172    /// * *callback* (query-string) - JSONP
8173    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8174    /// * *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.
8175    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8176    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8177    /// * *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.
8178    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8179    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8180    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTagListCall<'a, C>
8181    where
8182        T: AsRef<str>,
8183    {
8184        self._additional_params
8185            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8186        self
8187    }
8188
8189    /// Identifies the authorization scope for the method you are building.
8190    ///
8191    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8192    /// [`Scope::Readonly`].
8193    ///
8194    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8195    /// tokens for more than one scope.
8196    ///
8197    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8198    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8199    /// sufficient, a read-write scope will do as well.
8200    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTagListCall<'a, C>
8201    where
8202        St: AsRef<str>,
8203    {
8204        self._scopes.insert(String::from(scope.as_ref()));
8205        self
8206    }
8207    /// Identifies the authorization scope(s) for the method you are building.
8208    ///
8209    /// See [`Self::add_scope()`] for details.
8210    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTagListCall<'a, C>
8211    where
8212        I: IntoIterator<Item = St>,
8213        St: AsRef<str>,
8214    {
8215        self._scopes
8216            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8217        self
8218    }
8219
8220    /// Removes all scopes, and no default scope will be used either.
8221    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8222    /// for details).
8223    pub fn clear_scopes(mut self) -> AccountContainerTagListCall<'a, C> {
8224        self._scopes.clear();
8225        self
8226    }
8227}
8228
8229/// Updates a GTM Tag.
8230///
8231/// A builder for the *containers.tags.update* method supported by a *account* resource.
8232/// It is not used directly, but through a [`AccountMethods`] instance.
8233///
8234/// # Example
8235///
8236/// Instantiate a resource method builder
8237///
8238/// ```test_harness,no_run
8239/// # extern crate hyper;
8240/// # extern crate hyper_rustls;
8241/// # extern crate google_tagmanager1 as tagmanager1;
8242/// use tagmanager1::api::Tag;
8243/// # async fn dox() {
8244/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8245///
8246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8247/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8248/// #     .with_native_roots()
8249/// #     .unwrap()
8250/// #     .https_only()
8251/// #     .enable_http2()
8252/// #     .build();
8253///
8254/// # let executor = hyper_util::rt::TokioExecutor::new();
8255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8256/// #     secret,
8257/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8258/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8259/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8260/// #     ),
8261/// # ).build().await.unwrap();
8262///
8263/// # let client = hyper_util::client::legacy::Client::builder(
8264/// #     hyper_util::rt::TokioExecutor::new()
8265/// # )
8266/// # .build(
8267/// #     hyper_rustls::HttpsConnectorBuilder::new()
8268/// #         .with_native_roots()
8269/// #         .unwrap()
8270/// #         .https_or_http()
8271/// #         .enable_http2()
8272/// #         .build()
8273/// # );
8274/// # let mut hub = TagManager::new(client, auth);
8275/// // As the method needs a request, you would usually fill it with the desired information
8276/// // into the respective structure. Some of the parts shown here might not be applicable !
8277/// // Values shown here are possibly random and not representative !
8278/// let mut req = Tag::default();
8279///
8280/// // You can configure optional parameters by calling the respective setters at will, and
8281/// // execute the final call using `doit()`.
8282/// // Values shown here are possibly random and not representative !
8283/// let result = hub.accounts().containers_tags_update(req, "accountId", "containerId", "tagId")
8284///              .fingerprint("Lorem")
8285///              .doit().await;
8286/// # }
8287/// ```
8288pub struct AccountContainerTagUpdateCall<'a, C>
8289where
8290    C: 'a,
8291{
8292    hub: &'a TagManager<C>,
8293    _request: Tag,
8294    _account_id: String,
8295    _container_id: String,
8296    _tag_id: String,
8297    _fingerprint: Option<String>,
8298    _delegate: Option<&'a mut dyn common::Delegate>,
8299    _additional_params: HashMap<String, String>,
8300    _scopes: BTreeSet<String>,
8301}
8302
8303impl<'a, C> common::CallBuilder for AccountContainerTagUpdateCall<'a, C> {}
8304
8305impl<'a, C> AccountContainerTagUpdateCall<'a, C>
8306where
8307    C: common::Connector,
8308{
8309    /// Perform the operation you have build so far.
8310    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
8311        use std::borrow::Cow;
8312        use std::io::{Read, Seek};
8313
8314        use common::{url::Params, ToParts};
8315        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8316
8317        let mut dd = common::DefaultDelegate;
8318        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8319        dlg.begin(common::MethodInfo {
8320            id: "tagmanager.accounts.containers.tags.update",
8321            http_method: hyper::Method::PUT,
8322        });
8323
8324        for &field in ["alt", "accountId", "containerId", "tagId", "fingerprint"].iter() {
8325            if self._additional_params.contains_key(field) {
8326                dlg.finished(false);
8327                return Err(common::Error::FieldClash(field));
8328            }
8329        }
8330
8331        let mut params = Params::with_capacity(7 + self._additional_params.len());
8332        params.push("accountId", self._account_id);
8333        params.push("containerId", self._container_id);
8334        params.push("tagId", self._tag_id);
8335        if let Some(value) = self._fingerprint.as_ref() {
8336            params.push("fingerprint", value);
8337        }
8338
8339        params.extend(self._additional_params.iter());
8340
8341        params.push("alt", "json");
8342        let mut url = self.hub._base_url.clone()
8343            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/tags/{tagId}";
8344        if self._scopes.is_empty() {
8345            self._scopes
8346                .insert(Scope::EditContainer.as_ref().to_string());
8347        }
8348
8349        #[allow(clippy::single_element_loop)]
8350        for &(find_this, param_name) in [
8351            ("{accountId}", "accountId"),
8352            ("{containerId}", "containerId"),
8353            ("{tagId}", "tagId"),
8354        ]
8355        .iter()
8356        {
8357            url = params.uri_replacement(url, param_name, find_this, false);
8358        }
8359        {
8360            let to_remove = ["tagId", "containerId", "accountId"];
8361            params.remove_params(&to_remove);
8362        }
8363
8364        let url = params.parse_with_url(&url);
8365
8366        let mut json_mime_type = mime::APPLICATION_JSON;
8367        let mut request_value_reader = {
8368            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8369            common::remove_json_null_values(&mut value);
8370            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8371            serde_json::to_writer(&mut dst, &value).unwrap();
8372            dst
8373        };
8374        let request_size = request_value_reader
8375            .seek(std::io::SeekFrom::End(0))
8376            .unwrap();
8377        request_value_reader
8378            .seek(std::io::SeekFrom::Start(0))
8379            .unwrap();
8380
8381        loop {
8382            let token = match self
8383                .hub
8384                .auth
8385                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8386                .await
8387            {
8388                Ok(token) => token,
8389                Err(e) => match dlg.token(e) {
8390                    Ok(token) => token,
8391                    Err(e) => {
8392                        dlg.finished(false);
8393                        return Err(common::Error::MissingToken(e));
8394                    }
8395                },
8396            };
8397            request_value_reader
8398                .seek(std::io::SeekFrom::Start(0))
8399                .unwrap();
8400            let mut req_result = {
8401                let client = &self.hub.client;
8402                dlg.pre_request();
8403                let mut req_builder = hyper::Request::builder()
8404                    .method(hyper::Method::PUT)
8405                    .uri(url.as_str())
8406                    .header(USER_AGENT, self.hub._user_agent.clone());
8407
8408                if let Some(token) = token.as_ref() {
8409                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8410                }
8411
8412                let request = req_builder
8413                    .header(CONTENT_TYPE, json_mime_type.to_string())
8414                    .header(CONTENT_LENGTH, request_size as u64)
8415                    .body(common::to_body(
8416                        request_value_reader.get_ref().clone().into(),
8417                    ));
8418
8419                client.request(request.unwrap()).await
8420            };
8421
8422            match req_result {
8423                Err(err) => {
8424                    if let common::Retry::After(d) = dlg.http_error(&err) {
8425                        sleep(d).await;
8426                        continue;
8427                    }
8428                    dlg.finished(false);
8429                    return Err(common::Error::HttpError(err));
8430                }
8431                Ok(res) => {
8432                    let (mut parts, body) = res.into_parts();
8433                    let mut body = common::Body::new(body);
8434                    if !parts.status.is_success() {
8435                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8436                        let error = serde_json::from_str(&common::to_string(&bytes));
8437                        let response = common::to_response(parts, bytes.into());
8438
8439                        if let common::Retry::After(d) =
8440                            dlg.http_failure(&response, error.as_ref().ok())
8441                        {
8442                            sleep(d).await;
8443                            continue;
8444                        }
8445
8446                        dlg.finished(false);
8447
8448                        return Err(match error {
8449                            Ok(value) => common::Error::BadRequest(value),
8450                            _ => common::Error::Failure(response),
8451                        });
8452                    }
8453                    let response = {
8454                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8455                        let encoded = common::to_string(&bytes);
8456                        match serde_json::from_str(&encoded) {
8457                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8458                            Err(error) => {
8459                                dlg.response_json_decode_error(&encoded, &error);
8460                                return Err(common::Error::JsonDecodeError(
8461                                    encoded.to_string(),
8462                                    error,
8463                                ));
8464                            }
8465                        }
8466                    };
8467
8468                    dlg.finished(true);
8469                    return Ok(response);
8470                }
8471            }
8472        }
8473    }
8474
8475    ///
8476    /// Sets the *request* property to the given value.
8477    ///
8478    /// Even though the property as already been set when instantiating this call,
8479    /// we provide this method for API completeness.
8480    pub fn request(mut self, new_value: Tag) -> AccountContainerTagUpdateCall<'a, C> {
8481        self._request = new_value;
8482        self
8483    }
8484    /// The GTM Account ID.
8485    ///
8486    /// Sets the *account id* path property to the given value.
8487    ///
8488    /// Even though the property as already been set when instantiating this call,
8489    /// we provide this method for API completeness.
8490    pub fn account_id(mut self, new_value: &str) -> AccountContainerTagUpdateCall<'a, C> {
8491        self._account_id = new_value.to_string();
8492        self
8493    }
8494    /// The GTM Container ID.
8495    ///
8496    /// Sets the *container id* path property to the given value.
8497    ///
8498    /// Even though the property as already been set when instantiating this call,
8499    /// we provide this method for API completeness.
8500    pub fn container_id(mut self, new_value: &str) -> AccountContainerTagUpdateCall<'a, C> {
8501        self._container_id = new_value.to_string();
8502        self
8503    }
8504    /// The GTM Tag ID.
8505    ///
8506    /// Sets the *tag id* path property to the given value.
8507    ///
8508    /// Even though the property as already been set when instantiating this call,
8509    /// we provide this method for API completeness.
8510    pub fn tag_id(mut self, new_value: &str) -> AccountContainerTagUpdateCall<'a, C> {
8511        self._tag_id = new_value.to_string();
8512        self
8513    }
8514    /// When provided, this fingerprint must match the fingerprint of the tag in storage.
8515    ///
8516    /// Sets the *fingerprint* query property to the given value.
8517    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerTagUpdateCall<'a, C> {
8518        self._fingerprint = Some(new_value.to_string());
8519        self
8520    }
8521    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8522    /// while executing the actual API request.
8523    ///
8524    /// ````text
8525    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8526    /// ````
8527    ///
8528    /// Sets the *delegate* property to the given value.
8529    pub fn delegate(
8530        mut self,
8531        new_value: &'a mut dyn common::Delegate,
8532    ) -> AccountContainerTagUpdateCall<'a, C> {
8533        self._delegate = Some(new_value);
8534        self
8535    }
8536
8537    /// Set any additional parameter of the query string used in the request.
8538    /// It should be used to set parameters which are not yet available through their own
8539    /// setters.
8540    ///
8541    /// Please note that this method must not be used to set any of the known parameters
8542    /// which have their own setter method. If done anyway, the request will fail.
8543    ///
8544    /// # Additional Parameters
8545    ///
8546    /// * *$.xgafv* (query-string) - V1 error format.
8547    /// * *access_token* (query-string) - OAuth access token.
8548    /// * *alt* (query-string) - Data format for response.
8549    /// * *callback* (query-string) - JSONP
8550    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8551    /// * *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.
8552    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8553    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8554    /// * *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.
8555    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8556    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8557    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTagUpdateCall<'a, C>
8558    where
8559        T: AsRef<str>,
8560    {
8561        self._additional_params
8562            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8563        self
8564    }
8565
8566    /// Identifies the authorization scope for the method you are building.
8567    ///
8568    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8569    /// [`Scope::EditContainer`].
8570    ///
8571    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8572    /// tokens for more than one scope.
8573    ///
8574    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8575    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8576    /// sufficient, a read-write scope will do as well.
8577    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTagUpdateCall<'a, C>
8578    where
8579        St: AsRef<str>,
8580    {
8581        self._scopes.insert(String::from(scope.as_ref()));
8582        self
8583    }
8584    /// Identifies the authorization scope(s) for the method you are building.
8585    ///
8586    /// See [`Self::add_scope()`] for details.
8587    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTagUpdateCall<'a, C>
8588    where
8589        I: IntoIterator<Item = St>,
8590        St: AsRef<str>,
8591    {
8592        self._scopes
8593            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8594        self
8595    }
8596
8597    /// Removes all scopes, and no default scope will be used either.
8598    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8599    /// for details).
8600    pub fn clear_scopes(mut self) -> AccountContainerTagUpdateCall<'a, C> {
8601        self._scopes.clear();
8602        self
8603    }
8604}
8605
8606/// Creates a GTM Trigger.
8607///
8608/// A builder for the *containers.triggers.create* method supported by a *account* resource.
8609/// It is not used directly, but through a [`AccountMethods`] instance.
8610///
8611/// # Example
8612///
8613/// Instantiate a resource method builder
8614///
8615/// ```test_harness,no_run
8616/// # extern crate hyper;
8617/// # extern crate hyper_rustls;
8618/// # extern crate google_tagmanager1 as tagmanager1;
8619/// use tagmanager1::api::Trigger;
8620/// # async fn dox() {
8621/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8622///
8623/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8624/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8625/// #     .with_native_roots()
8626/// #     .unwrap()
8627/// #     .https_only()
8628/// #     .enable_http2()
8629/// #     .build();
8630///
8631/// # let executor = hyper_util::rt::TokioExecutor::new();
8632/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8633/// #     secret,
8634/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8635/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8636/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8637/// #     ),
8638/// # ).build().await.unwrap();
8639///
8640/// # let client = hyper_util::client::legacy::Client::builder(
8641/// #     hyper_util::rt::TokioExecutor::new()
8642/// # )
8643/// # .build(
8644/// #     hyper_rustls::HttpsConnectorBuilder::new()
8645/// #         .with_native_roots()
8646/// #         .unwrap()
8647/// #         .https_or_http()
8648/// #         .enable_http2()
8649/// #         .build()
8650/// # );
8651/// # let mut hub = TagManager::new(client, auth);
8652/// // As the method needs a request, you would usually fill it with the desired information
8653/// // into the respective structure. Some of the parts shown here might not be applicable !
8654/// // Values shown here are possibly random and not representative !
8655/// let mut req = Trigger::default();
8656///
8657/// // You can configure optional parameters by calling the respective setters at will, and
8658/// // execute the final call using `doit()`.
8659/// // Values shown here are possibly random and not representative !
8660/// let result = hub.accounts().containers_triggers_create(req, "accountId", "containerId")
8661///              .doit().await;
8662/// # }
8663/// ```
8664pub struct AccountContainerTriggerCreateCall<'a, C>
8665where
8666    C: 'a,
8667{
8668    hub: &'a TagManager<C>,
8669    _request: Trigger,
8670    _account_id: String,
8671    _container_id: String,
8672    _delegate: Option<&'a mut dyn common::Delegate>,
8673    _additional_params: HashMap<String, String>,
8674    _scopes: BTreeSet<String>,
8675}
8676
8677impl<'a, C> common::CallBuilder for AccountContainerTriggerCreateCall<'a, C> {}
8678
8679impl<'a, C> AccountContainerTriggerCreateCall<'a, C>
8680where
8681    C: common::Connector,
8682{
8683    /// Perform the operation you have build so far.
8684    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
8685        use std::borrow::Cow;
8686        use std::io::{Read, Seek};
8687
8688        use common::{url::Params, ToParts};
8689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8690
8691        let mut dd = common::DefaultDelegate;
8692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8693        dlg.begin(common::MethodInfo {
8694            id: "tagmanager.accounts.containers.triggers.create",
8695            http_method: hyper::Method::POST,
8696        });
8697
8698        for &field in ["alt", "accountId", "containerId"].iter() {
8699            if self._additional_params.contains_key(field) {
8700                dlg.finished(false);
8701                return Err(common::Error::FieldClash(field));
8702            }
8703        }
8704
8705        let mut params = Params::with_capacity(5 + self._additional_params.len());
8706        params.push("accountId", self._account_id);
8707        params.push("containerId", self._container_id);
8708
8709        params.extend(self._additional_params.iter());
8710
8711        params.push("alt", "json");
8712        let mut url = self.hub._base_url.clone()
8713            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/triggers";
8714        if self._scopes.is_empty() {
8715            self._scopes
8716                .insert(Scope::EditContainer.as_ref().to_string());
8717        }
8718
8719        #[allow(clippy::single_element_loop)]
8720        for &(find_this, param_name) in [
8721            ("{accountId}", "accountId"),
8722            ("{containerId}", "containerId"),
8723        ]
8724        .iter()
8725        {
8726            url = params.uri_replacement(url, param_name, find_this, false);
8727        }
8728        {
8729            let to_remove = ["containerId", "accountId"];
8730            params.remove_params(&to_remove);
8731        }
8732
8733        let url = params.parse_with_url(&url);
8734
8735        let mut json_mime_type = mime::APPLICATION_JSON;
8736        let mut request_value_reader = {
8737            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8738            common::remove_json_null_values(&mut value);
8739            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8740            serde_json::to_writer(&mut dst, &value).unwrap();
8741            dst
8742        };
8743        let request_size = request_value_reader
8744            .seek(std::io::SeekFrom::End(0))
8745            .unwrap();
8746        request_value_reader
8747            .seek(std::io::SeekFrom::Start(0))
8748            .unwrap();
8749
8750        loop {
8751            let token = match self
8752                .hub
8753                .auth
8754                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8755                .await
8756            {
8757                Ok(token) => token,
8758                Err(e) => match dlg.token(e) {
8759                    Ok(token) => token,
8760                    Err(e) => {
8761                        dlg.finished(false);
8762                        return Err(common::Error::MissingToken(e));
8763                    }
8764                },
8765            };
8766            request_value_reader
8767                .seek(std::io::SeekFrom::Start(0))
8768                .unwrap();
8769            let mut req_result = {
8770                let client = &self.hub.client;
8771                dlg.pre_request();
8772                let mut req_builder = hyper::Request::builder()
8773                    .method(hyper::Method::POST)
8774                    .uri(url.as_str())
8775                    .header(USER_AGENT, self.hub._user_agent.clone());
8776
8777                if let Some(token) = token.as_ref() {
8778                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8779                }
8780
8781                let request = req_builder
8782                    .header(CONTENT_TYPE, json_mime_type.to_string())
8783                    .header(CONTENT_LENGTH, request_size as u64)
8784                    .body(common::to_body(
8785                        request_value_reader.get_ref().clone().into(),
8786                    ));
8787
8788                client.request(request.unwrap()).await
8789            };
8790
8791            match req_result {
8792                Err(err) => {
8793                    if let common::Retry::After(d) = dlg.http_error(&err) {
8794                        sleep(d).await;
8795                        continue;
8796                    }
8797                    dlg.finished(false);
8798                    return Err(common::Error::HttpError(err));
8799                }
8800                Ok(res) => {
8801                    let (mut parts, body) = res.into_parts();
8802                    let mut body = common::Body::new(body);
8803                    if !parts.status.is_success() {
8804                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8805                        let error = serde_json::from_str(&common::to_string(&bytes));
8806                        let response = common::to_response(parts, bytes.into());
8807
8808                        if let common::Retry::After(d) =
8809                            dlg.http_failure(&response, error.as_ref().ok())
8810                        {
8811                            sleep(d).await;
8812                            continue;
8813                        }
8814
8815                        dlg.finished(false);
8816
8817                        return Err(match error {
8818                            Ok(value) => common::Error::BadRequest(value),
8819                            _ => common::Error::Failure(response),
8820                        });
8821                    }
8822                    let response = {
8823                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8824                        let encoded = common::to_string(&bytes);
8825                        match serde_json::from_str(&encoded) {
8826                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8827                            Err(error) => {
8828                                dlg.response_json_decode_error(&encoded, &error);
8829                                return Err(common::Error::JsonDecodeError(
8830                                    encoded.to_string(),
8831                                    error,
8832                                ));
8833                            }
8834                        }
8835                    };
8836
8837                    dlg.finished(true);
8838                    return Ok(response);
8839                }
8840            }
8841        }
8842    }
8843
8844    ///
8845    /// Sets the *request* property to the given value.
8846    ///
8847    /// Even though the property as already been set when instantiating this call,
8848    /// we provide this method for API completeness.
8849    pub fn request(mut self, new_value: Trigger) -> AccountContainerTriggerCreateCall<'a, C> {
8850        self._request = new_value;
8851        self
8852    }
8853    /// The GTM Account ID.
8854    ///
8855    /// Sets the *account id* path property to the given value.
8856    ///
8857    /// Even though the property as already been set when instantiating this call,
8858    /// we provide this method for API completeness.
8859    pub fn account_id(mut self, new_value: &str) -> AccountContainerTriggerCreateCall<'a, C> {
8860        self._account_id = new_value.to_string();
8861        self
8862    }
8863    /// The GTM Container ID.
8864    ///
8865    /// Sets the *container id* path property to the given value.
8866    ///
8867    /// Even though the property as already been set when instantiating this call,
8868    /// we provide this method for API completeness.
8869    pub fn container_id(mut self, new_value: &str) -> AccountContainerTriggerCreateCall<'a, C> {
8870        self._container_id = new_value.to_string();
8871        self
8872    }
8873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8874    /// while executing the actual API request.
8875    ///
8876    /// ````text
8877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8878    /// ````
8879    ///
8880    /// Sets the *delegate* property to the given value.
8881    pub fn delegate(
8882        mut self,
8883        new_value: &'a mut dyn common::Delegate,
8884    ) -> AccountContainerTriggerCreateCall<'a, C> {
8885        self._delegate = Some(new_value);
8886        self
8887    }
8888
8889    /// Set any additional parameter of the query string used in the request.
8890    /// It should be used to set parameters which are not yet available through their own
8891    /// setters.
8892    ///
8893    /// Please note that this method must not be used to set any of the known parameters
8894    /// which have their own setter method. If done anyway, the request will fail.
8895    ///
8896    /// # Additional Parameters
8897    ///
8898    /// * *$.xgafv* (query-string) - V1 error format.
8899    /// * *access_token* (query-string) - OAuth access token.
8900    /// * *alt* (query-string) - Data format for response.
8901    /// * *callback* (query-string) - JSONP
8902    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8903    /// * *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.
8904    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8905    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8906    /// * *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.
8907    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8908    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8909    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTriggerCreateCall<'a, C>
8910    where
8911        T: AsRef<str>,
8912    {
8913        self._additional_params
8914            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8915        self
8916    }
8917
8918    /// Identifies the authorization scope for the method you are building.
8919    ///
8920    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8921    /// [`Scope::EditContainer`].
8922    ///
8923    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8924    /// tokens for more than one scope.
8925    ///
8926    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8927    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8928    /// sufficient, a read-write scope will do as well.
8929    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTriggerCreateCall<'a, C>
8930    where
8931        St: AsRef<str>,
8932    {
8933        self._scopes.insert(String::from(scope.as_ref()));
8934        self
8935    }
8936    /// Identifies the authorization scope(s) for the method you are building.
8937    ///
8938    /// See [`Self::add_scope()`] for details.
8939    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTriggerCreateCall<'a, C>
8940    where
8941        I: IntoIterator<Item = St>,
8942        St: AsRef<str>,
8943    {
8944        self._scopes
8945            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8946        self
8947    }
8948
8949    /// Removes all scopes, and no default scope will be used either.
8950    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8951    /// for details).
8952    pub fn clear_scopes(mut self) -> AccountContainerTriggerCreateCall<'a, C> {
8953        self._scopes.clear();
8954        self
8955    }
8956}
8957
8958/// Deletes a GTM Trigger.
8959///
8960/// A builder for the *containers.triggers.delete* method supported by a *account* resource.
8961/// It is not used directly, but through a [`AccountMethods`] instance.
8962///
8963/// # Example
8964///
8965/// Instantiate a resource method builder
8966///
8967/// ```test_harness,no_run
8968/// # extern crate hyper;
8969/// # extern crate hyper_rustls;
8970/// # extern crate google_tagmanager1 as tagmanager1;
8971/// # async fn dox() {
8972/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8973///
8974/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8975/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8976/// #     .with_native_roots()
8977/// #     .unwrap()
8978/// #     .https_only()
8979/// #     .enable_http2()
8980/// #     .build();
8981///
8982/// # let executor = hyper_util::rt::TokioExecutor::new();
8983/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8984/// #     secret,
8985/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8986/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8987/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8988/// #     ),
8989/// # ).build().await.unwrap();
8990///
8991/// # let client = hyper_util::client::legacy::Client::builder(
8992/// #     hyper_util::rt::TokioExecutor::new()
8993/// # )
8994/// # .build(
8995/// #     hyper_rustls::HttpsConnectorBuilder::new()
8996/// #         .with_native_roots()
8997/// #         .unwrap()
8998/// #         .https_or_http()
8999/// #         .enable_http2()
9000/// #         .build()
9001/// # );
9002/// # let mut hub = TagManager::new(client, auth);
9003/// // You can configure optional parameters by calling the respective setters at will, and
9004/// // execute the final call using `doit()`.
9005/// // Values shown here are possibly random and not representative !
9006/// let result = hub.accounts().containers_triggers_delete("accountId", "containerId", "triggerId")
9007///              .doit().await;
9008/// # }
9009/// ```
9010pub struct AccountContainerTriggerDeleteCall<'a, C>
9011where
9012    C: 'a,
9013{
9014    hub: &'a TagManager<C>,
9015    _account_id: String,
9016    _container_id: String,
9017    _trigger_id: String,
9018    _delegate: Option<&'a mut dyn common::Delegate>,
9019    _additional_params: HashMap<String, String>,
9020    _scopes: BTreeSet<String>,
9021}
9022
9023impl<'a, C> common::CallBuilder for AccountContainerTriggerDeleteCall<'a, C> {}
9024
9025impl<'a, C> AccountContainerTriggerDeleteCall<'a, C>
9026where
9027    C: common::Connector,
9028{
9029    /// Perform the operation you have build so far.
9030    pub async fn doit(mut self) -> common::Result<common::Response> {
9031        use std::borrow::Cow;
9032        use std::io::{Read, Seek};
9033
9034        use common::{url::Params, ToParts};
9035        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9036
9037        let mut dd = common::DefaultDelegate;
9038        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9039        dlg.begin(common::MethodInfo {
9040            id: "tagmanager.accounts.containers.triggers.delete",
9041            http_method: hyper::Method::DELETE,
9042        });
9043
9044        for &field in ["accountId", "containerId", "triggerId"].iter() {
9045            if self._additional_params.contains_key(field) {
9046                dlg.finished(false);
9047                return Err(common::Error::FieldClash(field));
9048            }
9049        }
9050
9051        let mut params = Params::with_capacity(4 + self._additional_params.len());
9052        params.push("accountId", self._account_id);
9053        params.push("containerId", self._container_id);
9054        params.push("triggerId", self._trigger_id);
9055
9056        params.extend(self._additional_params.iter());
9057
9058        let mut url = self.hub._base_url.clone()
9059            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/triggers/{triggerId}";
9060        if self._scopes.is_empty() {
9061            self._scopes
9062                .insert(Scope::EditContainer.as_ref().to_string());
9063        }
9064
9065        #[allow(clippy::single_element_loop)]
9066        for &(find_this, param_name) in [
9067            ("{accountId}", "accountId"),
9068            ("{containerId}", "containerId"),
9069            ("{triggerId}", "triggerId"),
9070        ]
9071        .iter()
9072        {
9073            url = params.uri_replacement(url, param_name, find_this, false);
9074        }
9075        {
9076            let to_remove = ["triggerId", "containerId", "accountId"];
9077            params.remove_params(&to_remove);
9078        }
9079
9080        let url = params.parse_with_url(&url);
9081
9082        loop {
9083            let token = match self
9084                .hub
9085                .auth
9086                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9087                .await
9088            {
9089                Ok(token) => token,
9090                Err(e) => match dlg.token(e) {
9091                    Ok(token) => token,
9092                    Err(e) => {
9093                        dlg.finished(false);
9094                        return Err(common::Error::MissingToken(e));
9095                    }
9096                },
9097            };
9098            let mut req_result = {
9099                let client = &self.hub.client;
9100                dlg.pre_request();
9101                let mut req_builder = hyper::Request::builder()
9102                    .method(hyper::Method::DELETE)
9103                    .uri(url.as_str())
9104                    .header(USER_AGENT, self.hub._user_agent.clone());
9105
9106                if let Some(token) = token.as_ref() {
9107                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9108                }
9109
9110                let request = req_builder
9111                    .header(CONTENT_LENGTH, 0_u64)
9112                    .body(common::to_body::<String>(None));
9113
9114                client.request(request.unwrap()).await
9115            };
9116
9117            match req_result {
9118                Err(err) => {
9119                    if let common::Retry::After(d) = dlg.http_error(&err) {
9120                        sleep(d).await;
9121                        continue;
9122                    }
9123                    dlg.finished(false);
9124                    return Err(common::Error::HttpError(err));
9125                }
9126                Ok(res) => {
9127                    let (mut parts, body) = res.into_parts();
9128                    let mut body = common::Body::new(body);
9129                    if !parts.status.is_success() {
9130                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9131                        let error = serde_json::from_str(&common::to_string(&bytes));
9132                        let response = common::to_response(parts, bytes.into());
9133
9134                        if let common::Retry::After(d) =
9135                            dlg.http_failure(&response, error.as_ref().ok())
9136                        {
9137                            sleep(d).await;
9138                            continue;
9139                        }
9140
9141                        dlg.finished(false);
9142
9143                        return Err(match error {
9144                            Ok(value) => common::Error::BadRequest(value),
9145                            _ => common::Error::Failure(response),
9146                        });
9147                    }
9148                    let response = common::Response::from_parts(parts, body);
9149
9150                    dlg.finished(true);
9151                    return Ok(response);
9152                }
9153            }
9154        }
9155    }
9156
9157    /// The GTM Account ID.
9158    ///
9159    /// Sets the *account id* path property to the given value.
9160    ///
9161    /// Even though the property as already been set when instantiating this call,
9162    /// we provide this method for API completeness.
9163    pub fn account_id(mut self, new_value: &str) -> AccountContainerTriggerDeleteCall<'a, C> {
9164        self._account_id = new_value.to_string();
9165        self
9166    }
9167    /// The GTM Container ID.
9168    ///
9169    /// Sets the *container id* path property to the given value.
9170    ///
9171    /// Even though the property as already been set when instantiating this call,
9172    /// we provide this method for API completeness.
9173    pub fn container_id(mut self, new_value: &str) -> AccountContainerTriggerDeleteCall<'a, C> {
9174        self._container_id = new_value.to_string();
9175        self
9176    }
9177    /// The GTM Trigger ID.
9178    ///
9179    /// Sets the *trigger id* path property to the given value.
9180    ///
9181    /// Even though the property as already been set when instantiating this call,
9182    /// we provide this method for API completeness.
9183    pub fn trigger_id(mut self, new_value: &str) -> AccountContainerTriggerDeleteCall<'a, C> {
9184        self._trigger_id = new_value.to_string();
9185        self
9186    }
9187    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9188    /// while executing the actual API request.
9189    ///
9190    /// ````text
9191    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9192    /// ````
9193    ///
9194    /// Sets the *delegate* property to the given value.
9195    pub fn delegate(
9196        mut self,
9197        new_value: &'a mut dyn common::Delegate,
9198    ) -> AccountContainerTriggerDeleteCall<'a, C> {
9199        self._delegate = Some(new_value);
9200        self
9201    }
9202
9203    /// Set any additional parameter of the query string used in the request.
9204    /// It should be used to set parameters which are not yet available through their own
9205    /// setters.
9206    ///
9207    /// Please note that this method must not be used to set any of the known parameters
9208    /// which have their own setter method. If done anyway, the request will fail.
9209    ///
9210    /// # Additional Parameters
9211    ///
9212    /// * *$.xgafv* (query-string) - V1 error format.
9213    /// * *access_token* (query-string) - OAuth access token.
9214    /// * *alt* (query-string) - Data format for response.
9215    /// * *callback* (query-string) - JSONP
9216    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9217    /// * *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.
9218    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9219    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9220    /// * *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.
9221    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9222    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9223    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTriggerDeleteCall<'a, C>
9224    where
9225        T: AsRef<str>,
9226    {
9227        self._additional_params
9228            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9229        self
9230    }
9231
9232    /// Identifies the authorization scope for the method you are building.
9233    ///
9234    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9235    /// [`Scope::EditContainer`].
9236    ///
9237    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9238    /// tokens for more than one scope.
9239    ///
9240    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9241    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9242    /// sufficient, a read-write scope will do as well.
9243    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTriggerDeleteCall<'a, C>
9244    where
9245        St: AsRef<str>,
9246    {
9247        self._scopes.insert(String::from(scope.as_ref()));
9248        self
9249    }
9250    /// Identifies the authorization scope(s) for the method you are building.
9251    ///
9252    /// See [`Self::add_scope()`] for details.
9253    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTriggerDeleteCall<'a, C>
9254    where
9255        I: IntoIterator<Item = St>,
9256        St: AsRef<str>,
9257    {
9258        self._scopes
9259            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9260        self
9261    }
9262
9263    /// Removes all scopes, and no default scope will be used either.
9264    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9265    /// for details).
9266    pub fn clear_scopes(mut self) -> AccountContainerTriggerDeleteCall<'a, C> {
9267        self._scopes.clear();
9268        self
9269    }
9270}
9271
9272/// Gets a GTM Trigger.
9273///
9274/// A builder for the *containers.triggers.get* method supported by a *account* resource.
9275/// It is not used directly, but through a [`AccountMethods`] instance.
9276///
9277/// # Example
9278///
9279/// Instantiate a resource method builder
9280///
9281/// ```test_harness,no_run
9282/// # extern crate hyper;
9283/// # extern crate hyper_rustls;
9284/// # extern crate google_tagmanager1 as tagmanager1;
9285/// # async fn dox() {
9286/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9287///
9288/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9289/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9290/// #     .with_native_roots()
9291/// #     .unwrap()
9292/// #     .https_only()
9293/// #     .enable_http2()
9294/// #     .build();
9295///
9296/// # let executor = hyper_util::rt::TokioExecutor::new();
9297/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9298/// #     secret,
9299/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9300/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9301/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9302/// #     ),
9303/// # ).build().await.unwrap();
9304///
9305/// # let client = hyper_util::client::legacy::Client::builder(
9306/// #     hyper_util::rt::TokioExecutor::new()
9307/// # )
9308/// # .build(
9309/// #     hyper_rustls::HttpsConnectorBuilder::new()
9310/// #         .with_native_roots()
9311/// #         .unwrap()
9312/// #         .https_or_http()
9313/// #         .enable_http2()
9314/// #         .build()
9315/// # );
9316/// # let mut hub = TagManager::new(client, auth);
9317/// // You can configure optional parameters by calling the respective setters at will, and
9318/// // execute the final call using `doit()`.
9319/// // Values shown here are possibly random and not representative !
9320/// let result = hub.accounts().containers_triggers_get("accountId", "containerId", "triggerId")
9321///              .doit().await;
9322/// # }
9323/// ```
9324pub struct AccountContainerTriggerGetCall<'a, C>
9325where
9326    C: 'a,
9327{
9328    hub: &'a TagManager<C>,
9329    _account_id: String,
9330    _container_id: String,
9331    _trigger_id: String,
9332    _delegate: Option<&'a mut dyn common::Delegate>,
9333    _additional_params: HashMap<String, String>,
9334    _scopes: BTreeSet<String>,
9335}
9336
9337impl<'a, C> common::CallBuilder for AccountContainerTriggerGetCall<'a, C> {}
9338
9339impl<'a, C> AccountContainerTriggerGetCall<'a, C>
9340where
9341    C: common::Connector,
9342{
9343    /// Perform the operation you have build so far.
9344    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
9345        use std::borrow::Cow;
9346        use std::io::{Read, Seek};
9347
9348        use common::{url::Params, ToParts};
9349        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9350
9351        let mut dd = common::DefaultDelegate;
9352        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9353        dlg.begin(common::MethodInfo {
9354            id: "tagmanager.accounts.containers.triggers.get",
9355            http_method: hyper::Method::GET,
9356        });
9357
9358        for &field in ["alt", "accountId", "containerId", "triggerId"].iter() {
9359            if self._additional_params.contains_key(field) {
9360                dlg.finished(false);
9361                return Err(common::Error::FieldClash(field));
9362            }
9363        }
9364
9365        let mut params = Params::with_capacity(5 + self._additional_params.len());
9366        params.push("accountId", self._account_id);
9367        params.push("containerId", self._container_id);
9368        params.push("triggerId", self._trigger_id);
9369
9370        params.extend(self._additional_params.iter());
9371
9372        params.push("alt", "json");
9373        let mut url = self.hub._base_url.clone()
9374            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/triggers/{triggerId}";
9375        if self._scopes.is_empty() {
9376            self._scopes.insert(Scope::Readonly.as_ref().to_string());
9377        }
9378
9379        #[allow(clippy::single_element_loop)]
9380        for &(find_this, param_name) in [
9381            ("{accountId}", "accountId"),
9382            ("{containerId}", "containerId"),
9383            ("{triggerId}", "triggerId"),
9384        ]
9385        .iter()
9386        {
9387            url = params.uri_replacement(url, param_name, find_this, false);
9388        }
9389        {
9390            let to_remove = ["triggerId", "containerId", "accountId"];
9391            params.remove_params(&to_remove);
9392        }
9393
9394        let url = params.parse_with_url(&url);
9395
9396        loop {
9397            let token = match self
9398                .hub
9399                .auth
9400                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9401                .await
9402            {
9403                Ok(token) => token,
9404                Err(e) => match dlg.token(e) {
9405                    Ok(token) => token,
9406                    Err(e) => {
9407                        dlg.finished(false);
9408                        return Err(common::Error::MissingToken(e));
9409                    }
9410                },
9411            };
9412            let mut req_result = {
9413                let client = &self.hub.client;
9414                dlg.pre_request();
9415                let mut req_builder = hyper::Request::builder()
9416                    .method(hyper::Method::GET)
9417                    .uri(url.as_str())
9418                    .header(USER_AGENT, self.hub._user_agent.clone());
9419
9420                if let Some(token) = token.as_ref() {
9421                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9422                }
9423
9424                let request = req_builder
9425                    .header(CONTENT_LENGTH, 0_u64)
9426                    .body(common::to_body::<String>(None));
9427
9428                client.request(request.unwrap()).await
9429            };
9430
9431            match req_result {
9432                Err(err) => {
9433                    if let common::Retry::After(d) = dlg.http_error(&err) {
9434                        sleep(d).await;
9435                        continue;
9436                    }
9437                    dlg.finished(false);
9438                    return Err(common::Error::HttpError(err));
9439                }
9440                Ok(res) => {
9441                    let (mut parts, body) = res.into_parts();
9442                    let mut body = common::Body::new(body);
9443                    if !parts.status.is_success() {
9444                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9445                        let error = serde_json::from_str(&common::to_string(&bytes));
9446                        let response = common::to_response(parts, bytes.into());
9447
9448                        if let common::Retry::After(d) =
9449                            dlg.http_failure(&response, error.as_ref().ok())
9450                        {
9451                            sleep(d).await;
9452                            continue;
9453                        }
9454
9455                        dlg.finished(false);
9456
9457                        return Err(match error {
9458                            Ok(value) => common::Error::BadRequest(value),
9459                            _ => common::Error::Failure(response),
9460                        });
9461                    }
9462                    let response = {
9463                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9464                        let encoded = common::to_string(&bytes);
9465                        match serde_json::from_str(&encoded) {
9466                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9467                            Err(error) => {
9468                                dlg.response_json_decode_error(&encoded, &error);
9469                                return Err(common::Error::JsonDecodeError(
9470                                    encoded.to_string(),
9471                                    error,
9472                                ));
9473                            }
9474                        }
9475                    };
9476
9477                    dlg.finished(true);
9478                    return Ok(response);
9479                }
9480            }
9481        }
9482    }
9483
9484    /// The GTM Account ID.
9485    ///
9486    /// Sets the *account id* path property to the given value.
9487    ///
9488    /// Even though the property as already been set when instantiating this call,
9489    /// we provide this method for API completeness.
9490    pub fn account_id(mut self, new_value: &str) -> AccountContainerTriggerGetCall<'a, C> {
9491        self._account_id = new_value.to_string();
9492        self
9493    }
9494    /// The GTM Container ID.
9495    ///
9496    /// Sets the *container id* path property to the given value.
9497    ///
9498    /// Even though the property as already been set when instantiating this call,
9499    /// we provide this method for API completeness.
9500    pub fn container_id(mut self, new_value: &str) -> AccountContainerTriggerGetCall<'a, C> {
9501        self._container_id = new_value.to_string();
9502        self
9503    }
9504    /// The GTM Trigger ID.
9505    ///
9506    /// Sets the *trigger id* path property to the given value.
9507    ///
9508    /// Even though the property as already been set when instantiating this call,
9509    /// we provide this method for API completeness.
9510    pub fn trigger_id(mut self, new_value: &str) -> AccountContainerTriggerGetCall<'a, C> {
9511        self._trigger_id = new_value.to_string();
9512        self
9513    }
9514    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9515    /// while executing the actual API request.
9516    ///
9517    /// ````text
9518    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9519    /// ````
9520    ///
9521    /// Sets the *delegate* property to the given value.
9522    pub fn delegate(
9523        mut self,
9524        new_value: &'a mut dyn common::Delegate,
9525    ) -> AccountContainerTriggerGetCall<'a, C> {
9526        self._delegate = Some(new_value);
9527        self
9528    }
9529
9530    /// Set any additional parameter of the query string used in the request.
9531    /// It should be used to set parameters which are not yet available through their own
9532    /// setters.
9533    ///
9534    /// Please note that this method must not be used to set any of the known parameters
9535    /// which have their own setter method. If done anyway, the request will fail.
9536    ///
9537    /// # Additional Parameters
9538    ///
9539    /// * *$.xgafv* (query-string) - V1 error format.
9540    /// * *access_token* (query-string) - OAuth access token.
9541    /// * *alt* (query-string) - Data format for response.
9542    /// * *callback* (query-string) - JSONP
9543    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9544    /// * *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.
9545    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9546    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9547    /// * *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.
9548    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9549    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9550    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTriggerGetCall<'a, C>
9551    where
9552        T: AsRef<str>,
9553    {
9554        self._additional_params
9555            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9556        self
9557    }
9558
9559    /// Identifies the authorization scope for the method you are building.
9560    ///
9561    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9562    /// [`Scope::Readonly`].
9563    ///
9564    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9565    /// tokens for more than one scope.
9566    ///
9567    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9568    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9569    /// sufficient, a read-write scope will do as well.
9570    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTriggerGetCall<'a, C>
9571    where
9572        St: AsRef<str>,
9573    {
9574        self._scopes.insert(String::from(scope.as_ref()));
9575        self
9576    }
9577    /// Identifies the authorization scope(s) for the method you are building.
9578    ///
9579    /// See [`Self::add_scope()`] for details.
9580    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTriggerGetCall<'a, C>
9581    where
9582        I: IntoIterator<Item = St>,
9583        St: AsRef<str>,
9584    {
9585        self._scopes
9586            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9587        self
9588    }
9589
9590    /// Removes all scopes, and no default scope will be used either.
9591    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9592    /// for details).
9593    pub fn clear_scopes(mut self) -> AccountContainerTriggerGetCall<'a, C> {
9594        self._scopes.clear();
9595        self
9596    }
9597}
9598
9599/// Lists all GTM Triggers of a Container.
9600///
9601/// A builder for the *containers.triggers.list* method supported by a *account* resource.
9602/// It is not used directly, but through a [`AccountMethods`] instance.
9603///
9604/// # Example
9605///
9606/// Instantiate a resource method builder
9607///
9608/// ```test_harness,no_run
9609/// # extern crate hyper;
9610/// # extern crate hyper_rustls;
9611/// # extern crate google_tagmanager1 as tagmanager1;
9612/// # async fn dox() {
9613/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9614///
9615/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9616/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9617/// #     .with_native_roots()
9618/// #     .unwrap()
9619/// #     .https_only()
9620/// #     .enable_http2()
9621/// #     .build();
9622///
9623/// # let executor = hyper_util::rt::TokioExecutor::new();
9624/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9625/// #     secret,
9626/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9627/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9628/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9629/// #     ),
9630/// # ).build().await.unwrap();
9631///
9632/// # let client = hyper_util::client::legacy::Client::builder(
9633/// #     hyper_util::rt::TokioExecutor::new()
9634/// # )
9635/// # .build(
9636/// #     hyper_rustls::HttpsConnectorBuilder::new()
9637/// #         .with_native_roots()
9638/// #         .unwrap()
9639/// #         .https_or_http()
9640/// #         .enable_http2()
9641/// #         .build()
9642/// # );
9643/// # let mut hub = TagManager::new(client, auth);
9644/// // You can configure optional parameters by calling the respective setters at will, and
9645/// // execute the final call using `doit()`.
9646/// // Values shown here are possibly random and not representative !
9647/// let result = hub.accounts().containers_triggers_list("accountId", "containerId")
9648///              .doit().await;
9649/// # }
9650/// ```
9651pub struct AccountContainerTriggerListCall<'a, C>
9652where
9653    C: 'a,
9654{
9655    hub: &'a TagManager<C>,
9656    _account_id: String,
9657    _container_id: String,
9658    _delegate: Option<&'a mut dyn common::Delegate>,
9659    _additional_params: HashMap<String, String>,
9660    _scopes: BTreeSet<String>,
9661}
9662
9663impl<'a, C> common::CallBuilder for AccountContainerTriggerListCall<'a, C> {}
9664
9665impl<'a, C> AccountContainerTriggerListCall<'a, C>
9666where
9667    C: common::Connector,
9668{
9669    /// Perform the operation you have build so far.
9670    pub async fn doit(mut self) -> common::Result<(common::Response, ListTriggersResponse)> {
9671        use std::borrow::Cow;
9672        use std::io::{Read, Seek};
9673
9674        use common::{url::Params, ToParts};
9675        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9676
9677        let mut dd = common::DefaultDelegate;
9678        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9679        dlg.begin(common::MethodInfo {
9680            id: "tagmanager.accounts.containers.triggers.list",
9681            http_method: hyper::Method::GET,
9682        });
9683
9684        for &field in ["alt", "accountId", "containerId"].iter() {
9685            if self._additional_params.contains_key(field) {
9686                dlg.finished(false);
9687                return Err(common::Error::FieldClash(field));
9688            }
9689        }
9690
9691        let mut params = Params::with_capacity(4 + self._additional_params.len());
9692        params.push("accountId", self._account_id);
9693        params.push("containerId", self._container_id);
9694
9695        params.extend(self._additional_params.iter());
9696
9697        params.push("alt", "json");
9698        let mut url = self.hub._base_url.clone()
9699            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/triggers";
9700        if self._scopes.is_empty() {
9701            self._scopes.insert(Scope::Readonly.as_ref().to_string());
9702        }
9703
9704        #[allow(clippy::single_element_loop)]
9705        for &(find_this, param_name) in [
9706            ("{accountId}", "accountId"),
9707            ("{containerId}", "containerId"),
9708        ]
9709        .iter()
9710        {
9711            url = params.uri_replacement(url, param_name, find_this, false);
9712        }
9713        {
9714            let to_remove = ["containerId", "accountId"];
9715            params.remove_params(&to_remove);
9716        }
9717
9718        let url = params.parse_with_url(&url);
9719
9720        loop {
9721            let token = match self
9722                .hub
9723                .auth
9724                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9725                .await
9726            {
9727                Ok(token) => token,
9728                Err(e) => match dlg.token(e) {
9729                    Ok(token) => token,
9730                    Err(e) => {
9731                        dlg.finished(false);
9732                        return Err(common::Error::MissingToken(e));
9733                    }
9734                },
9735            };
9736            let mut req_result = {
9737                let client = &self.hub.client;
9738                dlg.pre_request();
9739                let mut req_builder = hyper::Request::builder()
9740                    .method(hyper::Method::GET)
9741                    .uri(url.as_str())
9742                    .header(USER_AGENT, self.hub._user_agent.clone());
9743
9744                if let Some(token) = token.as_ref() {
9745                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9746                }
9747
9748                let request = req_builder
9749                    .header(CONTENT_LENGTH, 0_u64)
9750                    .body(common::to_body::<String>(None));
9751
9752                client.request(request.unwrap()).await
9753            };
9754
9755            match req_result {
9756                Err(err) => {
9757                    if let common::Retry::After(d) = dlg.http_error(&err) {
9758                        sleep(d).await;
9759                        continue;
9760                    }
9761                    dlg.finished(false);
9762                    return Err(common::Error::HttpError(err));
9763                }
9764                Ok(res) => {
9765                    let (mut parts, body) = res.into_parts();
9766                    let mut body = common::Body::new(body);
9767                    if !parts.status.is_success() {
9768                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9769                        let error = serde_json::from_str(&common::to_string(&bytes));
9770                        let response = common::to_response(parts, bytes.into());
9771
9772                        if let common::Retry::After(d) =
9773                            dlg.http_failure(&response, error.as_ref().ok())
9774                        {
9775                            sleep(d).await;
9776                            continue;
9777                        }
9778
9779                        dlg.finished(false);
9780
9781                        return Err(match error {
9782                            Ok(value) => common::Error::BadRequest(value),
9783                            _ => common::Error::Failure(response),
9784                        });
9785                    }
9786                    let response = {
9787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9788                        let encoded = common::to_string(&bytes);
9789                        match serde_json::from_str(&encoded) {
9790                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9791                            Err(error) => {
9792                                dlg.response_json_decode_error(&encoded, &error);
9793                                return Err(common::Error::JsonDecodeError(
9794                                    encoded.to_string(),
9795                                    error,
9796                                ));
9797                            }
9798                        }
9799                    };
9800
9801                    dlg.finished(true);
9802                    return Ok(response);
9803                }
9804            }
9805        }
9806    }
9807
9808    /// The GTM Account ID.
9809    ///
9810    /// Sets the *account id* path property to the given value.
9811    ///
9812    /// Even though the property as already been set when instantiating this call,
9813    /// we provide this method for API completeness.
9814    pub fn account_id(mut self, new_value: &str) -> AccountContainerTriggerListCall<'a, C> {
9815        self._account_id = new_value.to_string();
9816        self
9817    }
9818    /// The GTM Container ID.
9819    ///
9820    /// Sets the *container id* path property to the given value.
9821    ///
9822    /// Even though the property as already been set when instantiating this call,
9823    /// we provide this method for API completeness.
9824    pub fn container_id(mut self, new_value: &str) -> AccountContainerTriggerListCall<'a, C> {
9825        self._container_id = new_value.to_string();
9826        self
9827    }
9828    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9829    /// while executing the actual API request.
9830    ///
9831    /// ````text
9832    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9833    /// ````
9834    ///
9835    /// Sets the *delegate* property to the given value.
9836    pub fn delegate(
9837        mut self,
9838        new_value: &'a mut dyn common::Delegate,
9839    ) -> AccountContainerTriggerListCall<'a, C> {
9840        self._delegate = Some(new_value);
9841        self
9842    }
9843
9844    /// Set any additional parameter of the query string used in the request.
9845    /// It should be used to set parameters which are not yet available through their own
9846    /// setters.
9847    ///
9848    /// Please note that this method must not be used to set any of the known parameters
9849    /// which have their own setter method. If done anyway, the request will fail.
9850    ///
9851    /// # Additional Parameters
9852    ///
9853    /// * *$.xgafv* (query-string) - V1 error format.
9854    /// * *access_token* (query-string) - OAuth access token.
9855    /// * *alt* (query-string) - Data format for response.
9856    /// * *callback* (query-string) - JSONP
9857    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9858    /// * *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.
9859    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9860    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9861    /// * *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.
9862    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9863    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9864    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTriggerListCall<'a, C>
9865    where
9866        T: AsRef<str>,
9867    {
9868        self._additional_params
9869            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9870        self
9871    }
9872
9873    /// Identifies the authorization scope for the method you are building.
9874    ///
9875    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9876    /// [`Scope::Readonly`].
9877    ///
9878    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9879    /// tokens for more than one scope.
9880    ///
9881    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9882    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9883    /// sufficient, a read-write scope will do as well.
9884    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTriggerListCall<'a, C>
9885    where
9886        St: AsRef<str>,
9887    {
9888        self._scopes.insert(String::from(scope.as_ref()));
9889        self
9890    }
9891    /// Identifies the authorization scope(s) for the method you are building.
9892    ///
9893    /// See [`Self::add_scope()`] for details.
9894    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTriggerListCall<'a, C>
9895    where
9896        I: IntoIterator<Item = St>,
9897        St: AsRef<str>,
9898    {
9899        self._scopes
9900            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9901        self
9902    }
9903
9904    /// Removes all scopes, and no default scope will be used either.
9905    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9906    /// for details).
9907    pub fn clear_scopes(mut self) -> AccountContainerTriggerListCall<'a, C> {
9908        self._scopes.clear();
9909        self
9910    }
9911}
9912
9913/// Updates a GTM Trigger.
9914///
9915/// A builder for the *containers.triggers.update* method supported by a *account* resource.
9916/// It is not used directly, but through a [`AccountMethods`] instance.
9917///
9918/// # Example
9919///
9920/// Instantiate a resource method builder
9921///
9922/// ```test_harness,no_run
9923/// # extern crate hyper;
9924/// # extern crate hyper_rustls;
9925/// # extern crate google_tagmanager1 as tagmanager1;
9926/// use tagmanager1::api::Trigger;
9927/// # async fn dox() {
9928/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9929///
9930/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9931/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9932/// #     .with_native_roots()
9933/// #     .unwrap()
9934/// #     .https_only()
9935/// #     .enable_http2()
9936/// #     .build();
9937///
9938/// # let executor = hyper_util::rt::TokioExecutor::new();
9939/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9940/// #     secret,
9941/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9942/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9943/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9944/// #     ),
9945/// # ).build().await.unwrap();
9946///
9947/// # let client = hyper_util::client::legacy::Client::builder(
9948/// #     hyper_util::rt::TokioExecutor::new()
9949/// # )
9950/// # .build(
9951/// #     hyper_rustls::HttpsConnectorBuilder::new()
9952/// #         .with_native_roots()
9953/// #         .unwrap()
9954/// #         .https_or_http()
9955/// #         .enable_http2()
9956/// #         .build()
9957/// # );
9958/// # let mut hub = TagManager::new(client, auth);
9959/// // As the method needs a request, you would usually fill it with the desired information
9960/// // into the respective structure. Some of the parts shown here might not be applicable !
9961/// // Values shown here are possibly random and not representative !
9962/// let mut req = Trigger::default();
9963///
9964/// // You can configure optional parameters by calling the respective setters at will, and
9965/// // execute the final call using `doit()`.
9966/// // Values shown here are possibly random and not representative !
9967/// let result = hub.accounts().containers_triggers_update(req, "accountId", "containerId", "triggerId")
9968///              .fingerprint("dolores")
9969///              .doit().await;
9970/// # }
9971/// ```
9972pub struct AccountContainerTriggerUpdateCall<'a, C>
9973where
9974    C: 'a,
9975{
9976    hub: &'a TagManager<C>,
9977    _request: Trigger,
9978    _account_id: String,
9979    _container_id: String,
9980    _trigger_id: String,
9981    _fingerprint: Option<String>,
9982    _delegate: Option<&'a mut dyn common::Delegate>,
9983    _additional_params: HashMap<String, String>,
9984    _scopes: BTreeSet<String>,
9985}
9986
9987impl<'a, C> common::CallBuilder for AccountContainerTriggerUpdateCall<'a, C> {}
9988
9989impl<'a, C> AccountContainerTriggerUpdateCall<'a, C>
9990where
9991    C: common::Connector,
9992{
9993    /// Perform the operation you have build so far.
9994    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
9995        use std::borrow::Cow;
9996        use std::io::{Read, Seek};
9997
9998        use common::{url::Params, ToParts};
9999        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10000
10001        let mut dd = common::DefaultDelegate;
10002        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10003        dlg.begin(common::MethodInfo {
10004            id: "tagmanager.accounts.containers.triggers.update",
10005            http_method: hyper::Method::PUT,
10006        });
10007
10008        for &field in [
10009            "alt",
10010            "accountId",
10011            "containerId",
10012            "triggerId",
10013            "fingerprint",
10014        ]
10015        .iter()
10016        {
10017            if self._additional_params.contains_key(field) {
10018                dlg.finished(false);
10019                return Err(common::Error::FieldClash(field));
10020            }
10021        }
10022
10023        let mut params = Params::with_capacity(7 + self._additional_params.len());
10024        params.push("accountId", self._account_id);
10025        params.push("containerId", self._container_id);
10026        params.push("triggerId", self._trigger_id);
10027        if let Some(value) = self._fingerprint.as_ref() {
10028            params.push("fingerprint", value);
10029        }
10030
10031        params.extend(self._additional_params.iter());
10032
10033        params.push("alt", "json");
10034        let mut url = self.hub._base_url.clone()
10035            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/triggers/{triggerId}";
10036        if self._scopes.is_empty() {
10037            self._scopes
10038                .insert(Scope::EditContainer.as_ref().to_string());
10039        }
10040
10041        #[allow(clippy::single_element_loop)]
10042        for &(find_this, param_name) in [
10043            ("{accountId}", "accountId"),
10044            ("{containerId}", "containerId"),
10045            ("{triggerId}", "triggerId"),
10046        ]
10047        .iter()
10048        {
10049            url = params.uri_replacement(url, param_name, find_this, false);
10050        }
10051        {
10052            let to_remove = ["triggerId", "containerId", "accountId"];
10053            params.remove_params(&to_remove);
10054        }
10055
10056        let url = params.parse_with_url(&url);
10057
10058        let mut json_mime_type = mime::APPLICATION_JSON;
10059        let mut request_value_reader = {
10060            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10061            common::remove_json_null_values(&mut value);
10062            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10063            serde_json::to_writer(&mut dst, &value).unwrap();
10064            dst
10065        };
10066        let request_size = request_value_reader
10067            .seek(std::io::SeekFrom::End(0))
10068            .unwrap();
10069        request_value_reader
10070            .seek(std::io::SeekFrom::Start(0))
10071            .unwrap();
10072
10073        loop {
10074            let token = match self
10075                .hub
10076                .auth
10077                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10078                .await
10079            {
10080                Ok(token) => token,
10081                Err(e) => match dlg.token(e) {
10082                    Ok(token) => token,
10083                    Err(e) => {
10084                        dlg.finished(false);
10085                        return Err(common::Error::MissingToken(e));
10086                    }
10087                },
10088            };
10089            request_value_reader
10090                .seek(std::io::SeekFrom::Start(0))
10091                .unwrap();
10092            let mut req_result = {
10093                let client = &self.hub.client;
10094                dlg.pre_request();
10095                let mut req_builder = hyper::Request::builder()
10096                    .method(hyper::Method::PUT)
10097                    .uri(url.as_str())
10098                    .header(USER_AGENT, self.hub._user_agent.clone());
10099
10100                if let Some(token) = token.as_ref() {
10101                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10102                }
10103
10104                let request = req_builder
10105                    .header(CONTENT_TYPE, json_mime_type.to_string())
10106                    .header(CONTENT_LENGTH, request_size as u64)
10107                    .body(common::to_body(
10108                        request_value_reader.get_ref().clone().into(),
10109                    ));
10110
10111                client.request(request.unwrap()).await
10112            };
10113
10114            match req_result {
10115                Err(err) => {
10116                    if let common::Retry::After(d) = dlg.http_error(&err) {
10117                        sleep(d).await;
10118                        continue;
10119                    }
10120                    dlg.finished(false);
10121                    return Err(common::Error::HttpError(err));
10122                }
10123                Ok(res) => {
10124                    let (mut parts, body) = res.into_parts();
10125                    let mut body = common::Body::new(body);
10126                    if !parts.status.is_success() {
10127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10128                        let error = serde_json::from_str(&common::to_string(&bytes));
10129                        let response = common::to_response(parts, bytes.into());
10130
10131                        if let common::Retry::After(d) =
10132                            dlg.http_failure(&response, error.as_ref().ok())
10133                        {
10134                            sleep(d).await;
10135                            continue;
10136                        }
10137
10138                        dlg.finished(false);
10139
10140                        return Err(match error {
10141                            Ok(value) => common::Error::BadRequest(value),
10142                            _ => common::Error::Failure(response),
10143                        });
10144                    }
10145                    let response = {
10146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10147                        let encoded = common::to_string(&bytes);
10148                        match serde_json::from_str(&encoded) {
10149                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10150                            Err(error) => {
10151                                dlg.response_json_decode_error(&encoded, &error);
10152                                return Err(common::Error::JsonDecodeError(
10153                                    encoded.to_string(),
10154                                    error,
10155                                ));
10156                            }
10157                        }
10158                    };
10159
10160                    dlg.finished(true);
10161                    return Ok(response);
10162                }
10163            }
10164        }
10165    }
10166
10167    ///
10168    /// Sets the *request* property to the given value.
10169    ///
10170    /// Even though the property as already been set when instantiating this call,
10171    /// we provide this method for API completeness.
10172    pub fn request(mut self, new_value: Trigger) -> AccountContainerTriggerUpdateCall<'a, C> {
10173        self._request = new_value;
10174        self
10175    }
10176    /// The GTM Account ID.
10177    ///
10178    /// Sets the *account id* path property to the given value.
10179    ///
10180    /// Even though the property as already been set when instantiating this call,
10181    /// we provide this method for API completeness.
10182    pub fn account_id(mut self, new_value: &str) -> AccountContainerTriggerUpdateCall<'a, C> {
10183        self._account_id = new_value.to_string();
10184        self
10185    }
10186    /// The GTM Container ID.
10187    ///
10188    /// Sets the *container id* path property to the given value.
10189    ///
10190    /// Even though the property as already been set when instantiating this call,
10191    /// we provide this method for API completeness.
10192    pub fn container_id(mut self, new_value: &str) -> AccountContainerTriggerUpdateCall<'a, C> {
10193        self._container_id = new_value.to_string();
10194        self
10195    }
10196    /// The GTM Trigger ID.
10197    ///
10198    /// Sets the *trigger id* path property to the given value.
10199    ///
10200    /// Even though the property as already been set when instantiating this call,
10201    /// we provide this method for API completeness.
10202    pub fn trigger_id(mut self, new_value: &str) -> AccountContainerTriggerUpdateCall<'a, C> {
10203        self._trigger_id = new_value.to_string();
10204        self
10205    }
10206    /// When provided, this fingerprint must match the fingerprint of the trigger in storage.
10207    ///
10208    /// Sets the *fingerprint* query property to the given value.
10209    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerTriggerUpdateCall<'a, C> {
10210        self._fingerprint = Some(new_value.to_string());
10211        self
10212    }
10213    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10214    /// while executing the actual API request.
10215    ///
10216    /// ````text
10217    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10218    /// ````
10219    ///
10220    /// Sets the *delegate* property to the given value.
10221    pub fn delegate(
10222        mut self,
10223        new_value: &'a mut dyn common::Delegate,
10224    ) -> AccountContainerTriggerUpdateCall<'a, C> {
10225        self._delegate = Some(new_value);
10226        self
10227    }
10228
10229    /// Set any additional parameter of the query string used in the request.
10230    /// It should be used to set parameters which are not yet available through their own
10231    /// setters.
10232    ///
10233    /// Please note that this method must not be used to set any of the known parameters
10234    /// which have their own setter method. If done anyway, the request will fail.
10235    ///
10236    /// # Additional Parameters
10237    ///
10238    /// * *$.xgafv* (query-string) - V1 error format.
10239    /// * *access_token* (query-string) - OAuth access token.
10240    /// * *alt* (query-string) - Data format for response.
10241    /// * *callback* (query-string) - JSONP
10242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10243    /// * *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.
10244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10246    /// * *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.
10247    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10248    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10249    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerTriggerUpdateCall<'a, C>
10250    where
10251        T: AsRef<str>,
10252    {
10253        self._additional_params
10254            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10255        self
10256    }
10257
10258    /// Identifies the authorization scope for the method you are building.
10259    ///
10260    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10261    /// [`Scope::EditContainer`].
10262    ///
10263    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10264    /// tokens for more than one scope.
10265    ///
10266    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10267    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10268    /// sufficient, a read-write scope will do as well.
10269    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerTriggerUpdateCall<'a, C>
10270    where
10271        St: AsRef<str>,
10272    {
10273        self._scopes.insert(String::from(scope.as_ref()));
10274        self
10275    }
10276    /// Identifies the authorization scope(s) for the method you are building.
10277    ///
10278    /// See [`Self::add_scope()`] for details.
10279    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerTriggerUpdateCall<'a, C>
10280    where
10281        I: IntoIterator<Item = St>,
10282        St: AsRef<str>,
10283    {
10284        self._scopes
10285            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10286        self
10287    }
10288
10289    /// Removes all scopes, and no default scope will be used either.
10290    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10291    /// for details).
10292    pub fn clear_scopes(mut self) -> AccountContainerTriggerUpdateCall<'a, C> {
10293        self._scopes.clear();
10294        self
10295    }
10296}
10297
10298/// Creates a GTM Variable.
10299///
10300/// A builder for the *containers.variables.create* method supported by a *account* resource.
10301/// It is not used directly, but through a [`AccountMethods`] instance.
10302///
10303/// # Example
10304///
10305/// Instantiate a resource method builder
10306///
10307/// ```test_harness,no_run
10308/// # extern crate hyper;
10309/// # extern crate hyper_rustls;
10310/// # extern crate google_tagmanager1 as tagmanager1;
10311/// use tagmanager1::api::Variable;
10312/// # async fn dox() {
10313/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10314///
10315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10317/// #     .with_native_roots()
10318/// #     .unwrap()
10319/// #     .https_only()
10320/// #     .enable_http2()
10321/// #     .build();
10322///
10323/// # let executor = hyper_util::rt::TokioExecutor::new();
10324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10325/// #     secret,
10326/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10327/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10328/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10329/// #     ),
10330/// # ).build().await.unwrap();
10331///
10332/// # let client = hyper_util::client::legacy::Client::builder(
10333/// #     hyper_util::rt::TokioExecutor::new()
10334/// # )
10335/// # .build(
10336/// #     hyper_rustls::HttpsConnectorBuilder::new()
10337/// #         .with_native_roots()
10338/// #         .unwrap()
10339/// #         .https_or_http()
10340/// #         .enable_http2()
10341/// #         .build()
10342/// # );
10343/// # let mut hub = TagManager::new(client, auth);
10344/// // As the method needs a request, you would usually fill it with the desired information
10345/// // into the respective structure. Some of the parts shown here might not be applicable !
10346/// // Values shown here are possibly random and not representative !
10347/// let mut req = Variable::default();
10348///
10349/// // You can configure optional parameters by calling the respective setters at will, and
10350/// // execute the final call using `doit()`.
10351/// // Values shown here are possibly random and not representative !
10352/// let result = hub.accounts().containers_variables_create(req, "accountId", "containerId")
10353///              .doit().await;
10354/// # }
10355/// ```
10356pub struct AccountContainerVariableCreateCall<'a, C>
10357where
10358    C: 'a,
10359{
10360    hub: &'a TagManager<C>,
10361    _request: Variable,
10362    _account_id: String,
10363    _container_id: String,
10364    _delegate: Option<&'a mut dyn common::Delegate>,
10365    _additional_params: HashMap<String, String>,
10366    _scopes: BTreeSet<String>,
10367}
10368
10369impl<'a, C> common::CallBuilder for AccountContainerVariableCreateCall<'a, C> {}
10370
10371impl<'a, C> AccountContainerVariableCreateCall<'a, C>
10372where
10373    C: common::Connector,
10374{
10375    /// Perform the operation you have build so far.
10376    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
10377        use std::borrow::Cow;
10378        use std::io::{Read, Seek};
10379
10380        use common::{url::Params, ToParts};
10381        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10382
10383        let mut dd = common::DefaultDelegate;
10384        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10385        dlg.begin(common::MethodInfo {
10386            id: "tagmanager.accounts.containers.variables.create",
10387            http_method: hyper::Method::POST,
10388        });
10389
10390        for &field in ["alt", "accountId", "containerId"].iter() {
10391            if self._additional_params.contains_key(field) {
10392                dlg.finished(false);
10393                return Err(common::Error::FieldClash(field));
10394            }
10395        }
10396
10397        let mut params = Params::with_capacity(5 + self._additional_params.len());
10398        params.push("accountId", self._account_id);
10399        params.push("containerId", self._container_id);
10400
10401        params.extend(self._additional_params.iter());
10402
10403        params.push("alt", "json");
10404        let mut url = self.hub._base_url.clone()
10405            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/variables";
10406        if self._scopes.is_empty() {
10407            self._scopes
10408                .insert(Scope::EditContainer.as_ref().to_string());
10409        }
10410
10411        #[allow(clippy::single_element_loop)]
10412        for &(find_this, param_name) in [
10413            ("{accountId}", "accountId"),
10414            ("{containerId}", "containerId"),
10415        ]
10416        .iter()
10417        {
10418            url = params.uri_replacement(url, param_name, find_this, false);
10419        }
10420        {
10421            let to_remove = ["containerId", "accountId"];
10422            params.remove_params(&to_remove);
10423        }
10424
10425        let url = params.parse_with_url(&url);
10426
10427        let mut json_mime_type = mime::APPLICATION_JSON;
10428        let mut request_value_reader = {
10429            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10430            common::remove_json_null_values(&mut value);
10431            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10432            serde_json::to_writer(&mut dst, &value).unwrap();
10433            dst
10434        };
10435        let request_size = request_value_reader
10436            .seek(std::io::SeekFrom::End(0))
10437            .unwrap();
10438        request_value_reader
10439            .seek(std::io::SeekFrom::Start(0))
10440            .unwrap();
10441
10442        loop {
10443            let token = match self
10444                .hub
10445                .auth
10446                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10447                .await
10448            {
10449                Ok(token) => token,
10450                Err(e) => match dlg.token(e) {
10451                    Ok(token) => token,
10452                    Err(e) => {
10453                        dlg.finished(false);
10454                        return Err(common::Error::MissingToken(e));
10455                    }
10456                },
10457            };
10458            request_value_reader
10459                .seek(std::io::SeekFrom::Start(0))
10460                .unwrap();
10461            let mut req_result = {
10462                let client = &self.hub.client;
10463                dlg.pre_request();
10464                let mut req_builder = hyper::Request::builder()
10465                    .method(hyper::Method::POST)
10466                    .uri(url.as_str())
10467                    .header(USER_AGENT, self.hub._user_agent.clone());
10468
10469                if let Some(token) = token.as_ref() {
10470                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10471                }
10472
10473                let request = req_builder
10474                    .header(CONTENT_TYPE, json_mime_type.to_string())
10475                    .header(CONTENT_LENGTH, request_size as u64)
10476                    .body(common::to_body(
10477                        request_value_reader.get_ref().clone().into(),
10478                    ));
10479
10480                client.request(request.unwrap()).await
10481            };
10482
10483            match req_result {
10484                Err(err) => {
10485                    if let common::Retry::After(d) = dlg.http_error(&err) {
10486                        sleep(d).await;
10487                        continue;
10488                    }
10489                    dlg.finished(false);
10490                    return Err(common::Error::HttpError(err));
10491                }
10492                Ok(res) => {
10493                    let (mut parts, body) = res.into_parts();
10494                    let mut body = common::Body::new(body);
10495                    if !parts.status.is_success() {
10496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10497                        let error = serde_json::from_str(&common::to_string(&bytes));
10498                        let response = common::to_response(parts, bytes.into());
10499
10500                        if let common::Retry::After(d) =
10501                            dlg.http_failure(&response, error.as_ref().ok())
10502                        {
10503                            sleep(d).await;
10504                            continue;
10505                        }
10506
10507                        dlg.finished(false);
10508
10509                        return Err(match error {
10510                            Ok(value) => common::Error::BadRequest(value),
10511                            _ => common::Error::Failure(response),
10512                        });
10513                    }
10514                    let response = {
10515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10516                        let encoded = common::to_string(&bytes);
10517                        match serde_json::from_str(&encoded) {
10518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10519                            Err(error) => {
10520                                dlg.response_json_decode_error(&encoded, &error);
10521                                return Err(common::Error::JsonDecodeError(
10522                                    encoded.to_string(),
10523                                    error,
10524                                ));
10525                            }
10526                        }
10527                    };
10528
10529                    dlg.finished(true);
10530                    return Ok(response);
10531                }
10532            }
10533        }
10534    }
10535
10536    ///
10537    /// Sets the *request* property to the given value.
10538    ///
10539    /// Even though the property as already been set when instantiating this call,
10540    /// we provide this method for API completeness.
10541    pub fn request(mut self, new_value: Variable) -> AccountContainerVariableCreateCall<'a, C> {
10542        self._request = new_value;
10543        self
10544    }
10545    /// The GTM Account ID.
10546    ///
10547    /// Sets the *account id* path property to the given value.
10548    ///
10549    /// Even though the property as already been set when instantiating this call,
10550    /// we provide this method for API completeness.
10551    pub fn account_id(mut self, new_value: &str) -> AccountContainerVariableCreateCall<'a, C> {
10552        self._account_id = new_value.to_string();
10553        self
10554    }
10555    /// The GTM Container ID.
10556    ///
10557    /// Sets the *container id* path property to the given value.
10558    ///
10559    /// Even though the property as already been set when instantiating this call,
10560    /// we provide this method for API completeness.
10561    pub fn container_id(mut self, new_value: &str) -> AccountContainerVariableCreateCall<'a, C> {
10562        self._container_id = new_value.to_string();
10563        self
10564    }
10565    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10566    /// while executing the actual API request.
10567    ///
10568    /// ````text
10569    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10570    /// ````
10571    ///
10572    /// Sets the *delegate* property to the given value.
10573    pub fn delegate(
10574        mut self,
10575        new_value: &'a mut dyn common::Delegate,
10576    ) -> AccountContainerVariableCreateCall<'a, C> {
10577        self._delegate = Some(new_value);
10578        self
10579    }
10580
10581    /// Set any additional parameter of the query string used in the request.
10582    /// It should be used to set parameters which are not yet available through their own
10583    /// setters.
10584    ///
10585    /// Please note that this method must not be used to set any of the known parameters
10586    /// which have their own setter method. If done anyway, the request will fail.
10587    ///
10588    /// # Additional Parameters
10589    ///
10590    /// * *$.xgafv* (query-string) - V1 error format.
10591    /// * *access_token* (query-string) - OAuth access token.
10592    /// * *alt* (query-string) - Data format for response.
10593    /// * *callback* (query-string) - JSONP
10594    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10595    /// * *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.
10596    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10597    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10598    /// * *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.
10599    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10600    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10601    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVariableCreateCall<'a, C>
10602    where
10603        T: AsRef<str>,
10604    {
10605        self._additional_params
10606            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10607        self
10608    }
10609
10610    /// Identifies the authorization scope for the method you are building.
10611    ///
10612    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10613    /// [`Scope::EditContainer`].
10614    ///
10615    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10616    /// tokens for more than one scope.
10617    ///
10618    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10619    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10620    /// sufficient, a read-write scope will do as well.
10621    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVariableCreateCall<'a, C>
10622    where
10623        St: AsRef<str>,
10624    {
10625        self._scopes.insert(String::from(scope.as_ref()));
10626        self
10627    }
10628    /// Identifies the authorization scope(s) for the method you are building.
10629    ///
10630    /// See [`Self::add_scope()`] for details.
10631    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVariableCreateCall<'a, C>
10632    where
10633        I: IntoIterator<Item = St>,
10634        St: AsRef<str>,
10635    {
10636        self._scopes
10637            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10638        self
10639    }
10640
10641    /// Removes all scopes, and no default scope will be used either.
10642    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10643    /// for details).
10644    pub fn clear_scopes(mut self) -> AccountContainerVariableCreateCall<'a, C> {
10645        self._scopes.clear();
10646        self
10647    }
10648}
10649
10650/// Deletes a GTM Variable.
10651///
10652/// A builder for the *containers.variables.delete* method supported by a *account* resource.
10653/// It is not used directly, but through a [`AccountMethods`] instance.
10654///
10655/// # Example
10656///
10657/// Instantiate a resource method builder
10658///
10659/// ```test_harness,no_run
10660/// # extern crate hyper;
10661/// # extern crate hyper_rustls;
10662/// # extern crate google_tagmanager1 as tagmanager1;
10663/// # async fn dox() {
10664/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10665///
10666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10668/// #     .with_native_roots()
10669/// #     .unwrap()
10670/// #     .https_only()
10671/// #     .enable_http2()
10672/// #     .build();
10673///
10674/// # let executor = hyper_util::rt::TokioExecutor::new();
10675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10676/// #     secret,
10677/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10678/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10679/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10680/// #     ),
10681/// # ).build().await.unwrap();
10682///
10683/// # let client = hyper_util::client::legacy::Client::builder(
10684/// #     hyper_util::rt::TokioExecutor::new()
10685/// # )
10686/// # .build(
10687/// #     hyper_rustls::HttpsConnectorBuilder::new()
10688/// #         .with_native_roots()
10689/// #         .unwrap()
10690/// #         .https_or_http()
10691/// #         .enable_http2()
10692/// #         .build()
10693/// # );
10694/// # let mut hub = TagManager::new(client, auth);
10695/// // You can configure optional parameters by calling the respective setters at will, and
10696/// // execute the final call using `doit()`.
10697/// // Values shown here are possibly random and not representative !
10698/// let result = hub.accounts().containers_variables_delete("accountId", "containerId", "variableId")
10699///              .doit().await;
10700/// # }
10701/// ```
10702pub struct AccountContainerVariableDeleteCall<'a, C>
10703where
10704    C: 'a,
10705{
10706    hub: &'a TagManager<C>,
10707    _account_id: String,
10708    _container_id: String,
10709    _variable_id: String,
10710    _delegate: Option<&'a mut dyn common::Delegate>,
10711    _additional_params: HashMap<String, String>,
10712    _scopes: BTreeSet<String>,
10713}
10714
10715impl<'a, C> common::CallBuilder for AccountContainerVariableDeleteCall<'a, C> {}
10716
10717impl<'a, C> AccountContainerVariableDeleteCall<'a, C>
10718where
10719    C: common::Connector,
10720{
10721    /// Perform the operation you have build so far.
10722    pub async fn doit(mut self) -> common::Result<common::Response> {
10723        use std::borrow::Cow;
10724        use std::io::{Read, Seek};
10725
10726        use common::{url::Params, ToParts};
10727        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10728
10729        let mut dd = common::DefaultDelegate;
10730        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10731        dlg.begin(common::MethodInfo {
10732            id: "tagmanager.accounts.containers.variables.delete",
10733            http_method: hyper::Method::DELETE,
10734        });
10735
10736        for &field in ["accountId", "containerId", "variableId"].iter() {
10737            if self._additional_params.contains_key(field) {
10738                dlg.finished(false);
10739                return Err(common::Error::FieldClash(field));
10740            }
10741        }
10742
10743        let mut params = Params::with_capacity(4 + self._additional_params.len());
10744        params.push("accountId", self._account_id);
10745        params.push("containerId", self._container_id);
10746        params.push("variableId", self._variable_id);
10747
10748        params.extend(self._additional_params.iter());
10749
10750        let mut url = self.hub._base_url.clone()
10751            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/variables/{variableId}";
10752        if self._scopes.is_empty() {
10753            self._scopes
10754                .insert(Scope::EditContainer.as_ref().to_string());
10755        }
10756
10757        #[allow(clippy::single_element_loop)]
10758        for &(find_this, param_name) in [
10759            ("{accountId}", "accountId"),
10760            ("{containerId}", "containerId"),
10761            ("{variableId}", "variableId"),
10762        ]
10763        .iter()
10764        {
10765            url = params.uri_replacement(url, param_name, find_this, false);
10766        }
10767        {
10768            let to_remove = ["variableId", "containerId", "accountId"];
10769            params.remove_params(&to_remove);
10770        }
10771
10772        let url = params.parse_with_url(&url);
10773
10774        loop {
10775            let token = match self
10776                .hub
10777                .auth
10778                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10779                .await
10780            {
10781                Ok(token) => token,
10782                Err(e) => match dlg.token(e) {
10783                    Ok(token) => token,
10784                    Err(e) => {
10785                        dlg.finished(false);
10786                        return Err(common::Error::MissingToken(e));
10787                    }
10788                },
10789            };
10790            let mut req_result = {
10791                let client = &self.hub.client;
10792                dlg.pre_request();
10793                let mut req_builder = hyper::Request::builder()
10794                    .method(hyper::Method::DELETE)
10795                    .uri(url.as_str())
10796                    .header(USER_AGENT, self.hub._user_agent.clone());
10797
10798                if let Some(token) = token.as_ref() {
10799                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10800                }
10801
10802                let request = req_builder
10803                    .header(CONTENT_LENGTH, 0_u64)
10804                    .body(common::to_body::<String>(None));
10805
10806                client.request(request.unwrap()).await
10807            };
10808
10809            match req_result {
10810                Err(err) => {
10811                    if let common::Retry::After(d) = dlg.http_error(&err) {
10812                        sleep(d).await;
10813                        continue;
10814                    }
10815                    dlg.finished(false);
10816                    return Err(common::Error::HttpError(err));
10817                }
10818                Ok(res) => {
10819                    let (mut parts, body) = res.into_parts();
10820                    let mut body = common::Body::new(body);
10821                    if !parts.status.is_success() {
10822                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10823                        let error = serde_json::from_str(&common::to_string(&bytes));
10824                        let response = common::to_response(parts, bytes.into());
10825
10826                        if let common::Retry::After(d) =
10827                            dlg.http_failure(&response, error.as_ref().ok())
10828                        {
10829                            sleep(d).await;
10830                            continue;
10831                        }
10832
10833                        dlg.finished(false);
10834
10835                        return Err(match error {
10836                            Ok(value) => common::Error::BadRequest(value),
10837                            _ => common::Error::Failure(response),
10838                        });
10839                    }
10840                    let response = common::Response::from_parts(parts, body);
10841
10842                    dlg.finished(true);
10843                    return Ok(response);
10844                }
10845            }
10846        }
10847    }
10848
10849    /// The GTM Account ID.
10850    ///
10851    /// Sets the *account id* path property to the given value.
10852    ///
10853    /// Even though the property as already been set when instantiating this call,
10854    /// we provide this method for API completeness.
10855    pub fn account_id(mut self, new_value: &str) -> AccountContainerVariableDeleteCall<'a, C> {
10856        self._account_id = new_value.to_string();
10857        self
10858    }
10859    /// The GTM Container ID.
10860    ///
10861    /// Sets the *container id* path property to the given value.
10862    ///
10863    /// Even though the property as already been set when instantiating this call,
10864    /// we provide this method for API completeness.
10865    pub fn container_id(mut self, new_value: &str) -> AccountContainerVariableDeleteCall<'a, C> {
10866        self._container_id = new_value.to_string();
10867        self
10868    }
10869    /// The GTM Variable ID.
10870    ///
10871    /// Sets the *variable id* path property to the given value.
10872    ///
10873    /// Even though the property as already been set when instantiating this call,
10874    /// we provide this method for API completeness.
10875    pub fn variable_id(mut self, new_value: &str) -> AccountContainerVariableDeleteCall<'a, C> {
10876        self._variable_id = new_value.to_string();
10877        self
10878    }
10879    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10880    /// while executing the actual API request.
10881    ///
10882    /// ````text
10883    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10884    /// ````
10885    ///
10886    /// Sets the *delegate* property to the given value.
10887    pub fn delegate(
10888        mut self,
10889        new_value: &'a mut dyn common::Delegate,
10890    ) -> AccountContainerVariableDeleteCall<'a, C> {
10891        self._delegate = Some(new_value);
10892        self
10893    }
10894
10895    /// Set any additional parameter of the query string used in the request.
10896    /// It should be used to set parameters which are not yet available through their own
10897    /// setters.
10898    ///
10899    /// Please note that this method must not be used to set any of the known parameters
10900    /// which have their own setter method. If done anyway, the request will fail.
10901    ///
10902    /// # Additional Parameters
10903    ///
10904    /// * *$.xgafv* (query-string) - V1 error format.
10905    /// * *access_token* (query-string) - OAuth access token.
10906    /// * *alt* (query-string) - Data format for response.
10907    /// * *callback* (query-string) - JSONP
10908    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10909    /// * *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.
10910    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10911    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10912    /// * *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.
10913    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10914    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10915    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVariableDeleteCall<'a, C>
10916    where
10917        T: AsRef<str>,
10918    {
10919        self._additional_params
10920            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10921        self
10922    }
10923
10924    /// Identifies the authorization scope for the method you are building.
10925    ///
10926    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10927    /// [`Scope::EditContainer`].
10928    ///
10929    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10930    /// tokens for more than one scope.
10931    ///
10932    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10933    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10934    /// sufficient, a read-write scope will do as well.
10935    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVariableDeleteCall<'a, C>
10936    where
10937        St: AsRef<str>,
10938    {
10939        self._scopes.insert(String::from(scope.as_ref()));
10940        self
10941    }
10942    /// Identifies the authorization scope(s) for the method you are building.
10943    ///
10944    /// See [`Self::add_scope()`] for details.
10945    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVariableDeleteCall<'a, C>
10946    where
10947        I: IntoIterator<Item = St>,
10948        St: AsRef<str>,
10949    {
10950        self._scopes
10951            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10952        self
10953    }
10954
10955    /// Removes all scopes, and no default scope will be used either.
10956    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10957    /// for details).
10958    pub fn clear_scopes(mut self) -> AccountContainerVariableDeleteCall<'a, C> {
10959        self._scopes.clear();
10960        self
10961    }
10962}
10963
10964/// Gets a GTM Variable.
10965///
10966/// A builder for the *containers.variables.get* method supported by a *account* resource.
10967/// It is not used directly, but through a [`AccountMethods`] instance.
10968///
10969/// # Example
10970///
10971/// Instantiate a resource method builder
10972///
10973/// ```test_harness,no_run
10974/// # extern crate hyper;
10975/// # extern crate hyper_rustls;
10976/// # extern crate google_tagmanager1 as tagmanager1;
10977/// # async fn dox() {
10978/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10979///
10980/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10981/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10982/// #     .with_native_roots()
10983/// #     .unwrap()
10984/// #     .https_only()
10985/// #     .enable_http2()
10986/// #     .build();
10987///
10988/// # let executor = hyper_util::rt::TokioExecutor::new();
10989/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10990/// #     secret,
10991/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10992/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10993/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10994/// #     ),
10995/// # ).build().await.unwrap();
10996///
10997/// # let client = hyper_util::client::legacy::Client::builder(
10998/// #     hyper_util::rt::TokioExecutor::new()
10999/// # )
11000/// # .build(
11001/// #     hyper_rustls::HttpsConnectorBuilder::new()
11002/// #         .with_native_roots()
11003/// #         .unwrap()
11004/// #         .https_or_http()
11005/// #         .enable_http2()
11006/// #         .build()
11007/// # );
11008/// # let mut hub = TagManager::new(client, auth);
11009/// // You can configure optional parameters by calling the respective setters at will, and
11010/// // execute the final call using `doit()`.
11011/// // Values shown here are possibly random and not representative !
11012/// let result = hub.accounts().containers_variables_get("accountId", "containerId", "variableId")
11013///              .doit().await;
11014/// # }
11015/// ```
11016pub struct AccountContainerVariableGetCall<'a, C>
11017where
11018    C: 'a,
11019{
11020    hub: &'a TagManager<C>,
11021    _account_id: String,
11022    _container_id: String,
11023    _variable_id: String,
11024    _delegate: Option<&'a mut dyn common::Delegate>,
11025    _additional_params: HashMap<String, String>,
11026    _scopes: BTreeSet<String>,
11027}
11028
11029impl<'a, C> common::CallBuilder for AccountContainerVariableGetCall<'a, C> {}
11030
11031impl<'a, C> AccountContainerVariableGetCall<'a, C>
11032where
11033    C: common::Connector,
11034{
11035    /// Perform the operation you have build so far.
11036    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
11037        use std::borrow::Cow;
11038        use std::io::{Read, Seek};
11039
11040        use common::{url::Params, ToParts};
11041        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11042
11043        let mut dd = common::DefaultDelegate;
11044        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11045        dlg.begin(common::MethodInfo {
11046            id: "tagmanager.accounts.containers.variables.get",
11047            http_method: hyper::Method::GET,
11048        });
11049
11050        for &field in ["alt", "accountId", "containerId", "variableId"].iter() {
11051            if self._additional_params.contains_key(field) {
11052                dlg.finished(false);
11053                return Err(common::Error::FieldClash(field));
11054            }
11055        }
11056
11057        let mut params = Params::with_capacity(5 + self._additional_params.len());
11058        params.push("accountId", self._account_id);
11059        params.push("containerId", self._container_id);
11060        params.push("variableId", self._variable_id);
11061
11062        params.extend(self._additional_params.iter());
11063
11064        params.push("alt", "json");
11065        let mut url = self.hub._base_url.clone()
11066            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/variables/{variableId}";
11067        if self._scopes.is_empty() {
11068            self._scopes.insert(Scope::Readonly.as_ref().to_string());
11069        }
11070
11071        #[allow(clippy::single_element_loop)]
11072        for &(find_this, param_name) in [
11073            ("{accountId}", "accountId"),
11074            ("{containerId}", "containerId"),
11075            ("{variableId}", "variableId"),
11076        ]
11077        .iter()
11078        {
11079            url = params.uri_replacement(url, param_name, find_this, false);
11080        }
11081        {
11082            let to_remove = ["variableId", "containerId", "accountId"];
11083            params.remove_params(&to_remove);
11084        }
11085
11086        let url = params.parse_with_url(&url);
11087
11088        loop {
11089            let token = match self
11090                .hub
11091                .auth
11092                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11093                .await
11094            {
11095                Ok(token) => token,
11096                Err(e) => match dlg.token(e) {
11097                    Ok(token) => token,
11098                    Err(e) => {
11099                        dlg.finished(false);
11100                        return Err(common::Error::MissingToken(e));
11101                    }
11102                },
11103            };
11104            let mut req_result = {
11105                let client = &self.hub.client;
11106                dlg.pre_request();
11107                let mut req_builder = hyper::Request::builder()
11108                    .method(hyper::Method::GET)
11109                    .uri(url.as_str())
11110                    .header(USER_AGENT, self.hub._user_agent.clone());
11111
11112                if let Some(token) = token.as_ref() {
11113                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11114                }
11115
11116                let request = req_builder
11117                    .header(CONTENT_LENGTH, 0_u64)
11118                    .body(common::to_body::<String>(None));
11119
11120                client.request(request.unwrap()).await
11121            };
11122
11123            match req_result {
11124                Err(err) => {
11125                    if let common::Retry::After(d) = dlg.http_error(&err) {
11126                        sleep(d).await;
11127                        continue;
11128                    }
11129                    dlg.finished(false);
11130                    return Err(common::Error::HttpError(err));
11131                }
11132                Ok(res) => {
11133                    let (mut parts, body) = res.into_parts();
11134                    let mut body = common::Body::new(body);
11135                    if !parts.status.is_success() {
11136                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11137                        let error = serde_json::from_str(&common::to_string(&bytes));
11138                        let response = common::to_response(parts, bytes.into());
11139
11140                        if let common::Retry::After(d) =
11141                            dlg.http_failure(&response, error.as_ref().ok())
11142                        {
11143                            sleep(d).await;
11144                            continue;
11145                        }
11146
11147                        dlg.finished(false);
11148
11149                        return Err(match error {
11150                            Ok(value) => common::Error::BadRequest(value),
11151                            _ => common::Error::Failure(response),
11152                        });
11153                    }
11154                    let response = {
11155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11156                        let encoded = common::to_string(&bytes);
11157                        match serde_json::from_str(&encoded) {
11158                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11159                            Err(error) => {
11160                                dlg.response_json_decode_error(&encoded, &error);
11161                                return Err(common::Error::JsonDecodeError(
11162                                    encoded.to_string(),
11163                                    error,
11164                                ));
11165                            }
11166                        }
11167                    };
11168
11169                    dlg.finished(true);
11170                    return Ok(response);
11171                }
11172            }
11173        }
11174    }
11175
11176    /// The GTM Account ID.
11177    ///
11178    /// Sets the *account id* path property to the given value.
11179    ///
11180    /// Even though the property as already been set when instantiating this call,
11181    /// we provide this method for API completeness.
11182    pub fn account_id(mut self, new_value: &str) -> AccountContainerVariableGetCall<'a, C> {
11183        self._account_id = new_value.to_string();
11184        self
11185    }
11186    /// The GTM Container ID.
11187    ///
11188    /// Sets the *container id* path property to the given value.
11189    ///
11190    /// Even though the property as already been set when instantiating this call,
11191    /// we provide this method for API completeness.
11192    pub fn container_id(mut self, new_value: &str) -> AccountContainerVariableGetCall<'a, C> {
11193        self._container_id = new_value.to_string();
11194        self
11195    }
11196    /// The GTM Variable ID.
11197    ///
11198    /// Sets the *variable id* path property to the given value.
11199    ///
11200    /// Even though the property as already been set when instantiating this call,
11201    /// we provide this method for API completeness.
11202    pub fn variable_id(mut self, new_value: &str) -> AccountContainerVariableGetCall<'a, C> {
11203        self._variable_id = new_value.to_string();
11204        self
11205    }
11206    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11207    /// while executing the actual API request.
11208    ///
11209    /// ````text
11210    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11211    /// ````
11212    ///
11213    /// Sets the *delegate* property to the given value.
11214    pub fn delegate(
11215        mut self,
11216        new_value: &'a mut dyn common::Delegate,
11217    ) -> AccountContainerVariableGetCall<'a, C> {
11218        self._delegate = Some(new_value);
11219        self
11220    }
11221
11222    /// Set any additional parameter of the query string used in the request.
11223    /// It should be used to set parameters which are not yet available through their own
11224    /// setters.
11225    ///
11226    /// Please note that this method must not be used to set any of the known parameters
11227    /// which have their own setter method. If done anyway, the request will fail.
11228    ///
11229    /// # Additional Parameters
11230    ///
11231    /// * *$.xgafv* (query-string) - V1 error format.
11232    /// * *access_token* (query-string) - OAuth access token.
11233    /// * *alt* (query-string) - Data format for response.
11234    /// * *callback* (query-string) - JSONP
11235    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11236    /// * *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.
11237    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11238    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11239    /// * *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.
11240    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11241    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11242    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVariableGetCall<'a, C>
11243    where
11244        T: AsRef<str>,
11245    {
11246        self._additional_params
11247            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11248        self
11249    }
11250
11251    /// Identifies the authorization scope for the method you are building.
11252    ///
11253    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11254    /// [`Scope::Readonly`].
11255    ///
11256    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11257    /// tokens for more than one scope.
11258    ///
11259    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11260    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11261    /// sufficient, a read-write scope will do as well.
11262    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVariableGetCall<'a, C>
11263    where
11264        St: AsRef<str>,
11265    {
11266        self._scopes.insert(String::from(scope.as_ref()));
11267        self
11268    }
11269    /// Identifies the authorization scope(s) for the method you are building.
11270    ///
11271    /// See [`Self::add_scope()`] for details.
11272    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVariableGetCall<'a, C>
11273    where
11274        I: IntoIterator<Item = St>,
11275        St: AsRef<str>,
11276    {
11277        self._scopes
11278            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11279        self
11280    }
11281
11282    /// Removes all scopes, and no default scope will be used either.
11283    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11284    /// for details).
11285    pub fn clear_scopes(mut self) -> AccountContainerVariableGetCall<'a, C> {
11286        self._scopes.clear();
11287        self
11288    }
11289}
11290
11291/// Lists all GTM Variables of a Container.
11292///
11293/// A builder for the *containers.variables.list* method supported by a *account* resource.
11294/// It is not used directly, but through a [`AccountMethods`] instance.
11295///
11296/// # Example
11297///
11298/// Instantiate a resource method builder
11299///
11300/// ```test_harness,no_run
11301/// # extern crate hyper;
11302/// # extern crate hyper_rustls;
11303/// # extern crate google_tagmanager1 as tagmanager1;
11304/// # async fn dox() {
11305/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11306///
11307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11308/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11309/// #     .with_native_roots()
11310/// #     .unwrap()
11311/// #     .https_only()
11312/// #     .enable_http2()
11313/// #     .build();
11314///
11315/// # let executor = hyper_util::rt::TokioExecutor::new();
11316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11317/// #     secret,
11318/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11319/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11320/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11321/// #     ),
11322/// # ).build().await.unwrap();
11323///
11324/// # let client = hyper_util::client::legacy::Client::builder(
11325/// #     hyper_util::rt::TokioExecutor::new()
11326/// # )
11327/// # .build(
11328/// #     hyper_rustls::HttpsConnectorBuilder::new()
11329/// #         .with_native_roots()
11330/// #         .unwrap()
11331/// #         .https_or_http()
11332/// #         .enable_http2()
11333/// #         .build()
11334/// # );
11335/// # let mut hub = TagManager::new(client, auth);
11336/// // You can configure optional parameters by calling the respective setters at will, and
11337/// // execute the final call using `doit()`.
11338/// // Values shown here are possibly random and not representative !
11339/// let result = hub.accounts().containers_variables_list("accountId", "containerId")
11340///              .doit().await;
11341/// # }
11342/// ```
11343pub struct AccountContainerVariableListCall<'a, C>
11344where
11345    C: 'a,
11346{
11347    hub: &'a TagManager<C>,
11348    _account_id: String,
11349    _container_id: String,
11350    _delegate: Option<&'a mut dyn common::Delegate>,
11351    _additional_params: HashMap<String, String>,
11352    _scopes: BTreeSet<String>,
11353}
11354
11355impl<'a, C> common::CallBuilder for AccountContainerVariableListCall<'a, C> {}
11356
11357impl<'a, C> AccountContainerVariableListCall<'a, C>
11358where
11359    C: common::Connector,
11360{
11361    /// Perform the operation you have build so far.
11362    pub async fn doit(mut self) -> common::Result<(common::Response, ListVariablesResponse)> {
11363        use std::borrow::Cow;
11364        use std::io::{Read, Seek};
11365
11366        use common::{url::Params, ToParts};
11367        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11368
11369        let mut dd = common::DefaultDelegate;
11370        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11371        dlg.begin(common::MethodInfo {
11372            id: "tagmanager.accounts.containers.variables.list",
11373            http_method: hyper::Method::GET,
11374        });
11375
11376        for &field in ["alt", "accountId", "containerId"].iter() {
11377            if self._additional_params.contains_key(field) {
11378                dlg.finished(false);
11379                return Err(common::Error::FieldClash(field));
11380            }
11381        }
11382
11383        let mut params = Params::with_capacity(4 + self._additional_params.len());
11384        params.push("accountId", self._account_id);
11385        params.push("containerId", self._container_id);
11386
11387        params.extend(self._additional_params.iter());
11388
11389        params.push("alt", "json");
11390        let mut url = self.hub._base_url.clone()
11391            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/variables";
11392        if self._scopes.is_empty() {
11393            self._scopes.insert(Scope::Readonly.as_ref().to_string());
11394        }
11395
11396        #[allow(clippy::single_element_loop)]
11397        for &(find_this, param_name) in [
11398            ("{accountId}", "accountId"),
11399            ("{containerId}", "containerId"),
11400        ]
11401        .iter()
11402        {
11403            url = params.uri_replacement(url, param_name, find_this, false);
11404        }
11405        {
11406            let to_remove = ["containerId", "accountId"];
11407            params.remove_params(&to_remove);
11408        }
11409
11410        let url = params.parse_with_url(&url);
11411
11412        loop {
11413            let token = match self
11414                .hub
11415                .auth
11416                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11417                .await
11418            {
11419                Ok(token) => token,
11420                Err(e) => match dlg.token(e) {
11421                    Ok(token) => token,
11422                    Err(e) => {
11423                        dlg.finished(false);
11424                        return Err(common::Error::MissingToken(e));
11425                    }
11426                },
11427            };
11428            let mut req_result = {
11429                let client = &self.hub.client;
11430                dlg.pre_request();
11431                let mut req_builder = hyper::Request::builder()
11432                    .method(hyper::Method::GET)
11433                    .uri(url.as_str())
11434                    .header(USER_AGENT, self.hub._user_agent.clone());
11435
11436                if let Some(token) = token.as_ref() {
11437                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11438                }
11439
11440                let request = req_builder
11441                    .header(CONTENT_LENGTH, 0_u64)
11442                    .body(common::to_body::<String>(None));
11443
11444                client.request(request.unwrap()).await
11445            };
11446
11447            match req_result {
11448                Err(err) => {
11449                    if let common::Retry::After(d) = dlg.http_error(&err) {
11450                        sleep(d).await;
11451                        continue;
11452                    }
11453                    dlg.finished(false);
11454                    return Err(common::Error::HttpError(err));
11455                }
11456                Ok(res) => {
11457                    let (mut parts, body) = res.into_parts();
11458                    let mut body = common::Body::new(body);
11459                    if !parts.status.is_success() {
11460                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11461                        let error = serde_json::from_str(&common::to_string(&bytes));
11462                        let response = common::to_response(parts, bytes.into());
11463
11464                        if let common::Retry::After(d) =
11465                            dlg.http_failure(&response, error.as_ref().ok())
11466                        {
11467                            sleep(d).await;
11468                            continue;
11469                        }
11470
11471                        dlg.finished(false);
11472
11473                        return Err(match error {
11474                            Ok(value) => common::Error::BadRequest(value),
11475                            _ => common::Error::Failure(response),
11476                        });
11477                    }
11478                    let response = {
11479                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11480                        let encoded = common::to_string(&bytes);
11481                        match serde_json::from_str(&encoded) {
11482                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11483                            Err(error) => {
11484                                dlg.response_json_decode_error(&encoded, &error);
11485                                return Err(common::Error::JsonDecodeError(
11486                                    encoded.to_string(),
11487                                    error,
11488                                ));
11489                            }
11490                        }
11491                    };
11492
11493                    dlg.finished(true);
11494                    return Ok(response);
11495                }
11496            }
11497        }
11498    }
11499
11500    /// The GTM Account ID.
11501    ///
11502    /// Sets the *account id* path property to the given value.
11503    ///
11504    /// Even though the property as already been set when instantiating this call,
11505    /// we provide this method for API completeness.
11506    pub fn account_id(mut self, new_value: &str) -> AccountContainerVariableListCall<'a, C> {
11507        self._account_id = new_value.to_string();
11508        self
11509    }
11510    /// The GTM Container ID.
11511    ///
11512    /// Sets the *container id* path property to the given value.
11513    ///
11514    /// Even though the property as already been set when instantiating this call,
11515    /// we provide this method for API completeness.
11516    pub fn container_id(mut self, new_value: &str) -> AccountContainerVariableListCall<'a, C> {
11517        self._container_id = new_value.to_string();
11518        self
11519    }
11520    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11521    /// while executing the actual API request.
11522    ///
11523    /// ````text
11524    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11525    /// ````
11526    ///
11527    /// Sets the *delegate* property to the given value.
11528    pub fn delegate(
11529        mut self,
11530        new_value: &'a mut dyn common::Delegate,
11531    ) -> AccountContainerVariableListCall<'a, C> {
11532        self._delegate = Some(new_value);
11533        self
11534    }
11535
11536    /// Set any additional parameter of the query string used in the request.
11537    /// It should be used to set parameters which are not yet available through their own
11538    /// setters.
11539    ///
11540    /// Please note that this method must not be used to set any of the known parameters
11541    /// which have their own setter method. If done anyway, the request will fail.
11542    ///
11543    /// # Additional Parameters
11544    ///
11545    /// * *$.xgafv* (query-string) - V1 error format.
11546    /// * *access_token* (query-string) - OAuth access token.
11547    /// * *alt* (query-string) - Data format for response.
11548    /// * *callback* (query-string) - JSONP
11549    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11550    /// * *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.
11551    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11552    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11553    /// * *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.
11554    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11555    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11556    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVariableListCall<'a, C>
11557    where
11558        T: AsRef<str>,
11559    {
11560        self._additional_params
11561            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11562        self
11563    }
11564
11565    /// Identifies the authorization scope for the method you are building.
11566    ///
11567    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11568    /// [`Scope::Readonly`].
11569    ///
11570    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11571    /// tokens for more than one scope.
11572    ///
11573    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11574    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11575    /// sufficient, a read-write scope will do as well.
11576    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVariableListCall<'a, C>
11577    where
11578        St: AsRef<str>,
11579    {
11580        self._scopes.insert(String::from(scope.as_ref()));
11581        self
11582    }
11583    /// Identifies the authorization scope(s) for the method you are building.
11584    ///
11585    /// See [`Self::add_scope()`] for details.
11586    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVariableListCall<'a, C>
11587    where
11588        I: IntoIterator<Item = St>,
11589        St: AsRef<str>,
11590    {
11591        self._scopes
11592            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11593        self
11594    }
11595
11596    /// Removes all scopes, and no default scope will be used either.
11597    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11598    /// for details).
11599    pub fn clear_scopes(mut self) -> AccountContainerVariableListCall<'a, C> {
11600        self._scopes.clear();
11601        self
11602    }
11603}
11604
11605/// Updates a GTM Variable.
11606///
11607/// A builder for the *containers.variables.update* method supported by a *account* resource.
11608/// It is not used directly, but through a [`AccountMethods`] instance.
11609///
11610/// # Example
11611///
11612/// Instantiate a resource method builder
11613///
11614/// ```test_harness,no_run
11615/// # extern crate hyper;
11616/// # extern crate hyper_rustls;
11617/// # extern crate google_tagmanager1 as tagmanager1;
11618/// use tagmanager1::api::Variable;
11619/// # async fn dox() {
11620/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11621///
11622/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11623/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11624/// #     .with_native_roots()
11625/// #     .unwrap()
11626/// #     .https_only()
11627/// #     .enable_http2()
11628/// #     .build();
11629///
11630/// # let executor = hyper_util::rt::TokioExecutor::new();
11631/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11632/// #     secret,
11633/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11634/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11635/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11636/// #     ),
11637/// # ).build().await.unwrap();
11638///
11639/// # let client = hyper_util::client::legacy::Client::builder(
11640/// #     hyper_util::rt::TokioExecutor::new()
11641/// # )
11642/// # .build(
11643/// #     hyper_rustls::HttpsConnectorBuilder::new()
11644/// #         .with_native_roots()
11645/// #         .unwrap()
11646/// #         .https_or_http()
11647/// #         .enable_http2()
11648/// #         .build()
11649/// # );
11650/// # let mut hub = TagManager::new(client, auth);
11651/// // As the method needs a request, you would usually fill it with the desired information
11652/// // into the respective structure. Some of the parts shown here might not be applicable !
11653/// // Values shown here are possibly random and not representative !
11654/// let mut req = Variable::default();
11655///
11656/// // You can configure optional parameters by calling the respective setters at will, and
11657/// // execute the final call using `doit()`.
11658/// // Values shown here are possibly random and not representative !
11659/// let result = hub.accounts().containers_variables_update(req, "accountId", "containerId", "variableId")
11660///              .fingerprint("no")
11661///              .doit().await;
11662/// # }
11663/// ```
11664pub struct AccountContainerVariableUpdateCall<'a, C>
11665where
11666    C: 'a,
11667{
11668    hub: &'a TagManager<C>,
11669    _request: Variable,
11670    _account_id: String,
11671    _container_id: String,
11672    _variable_id: String,
11673    _fingerprint: Option<String>,
11674    _delegate: Option<&'a mut dyn common::Delegate>,
11675    _additional_params: HashMap<String, String>,
11676    _scopes: BTreeSet<String>,
11677}
11678
11679impl<'a, C> common::CallBuilder for AccountContainerVariableUpdateCall<'a, C> {}
11680
11681impl<'a, C> AccountContainerVariableUpdateCall<'a, C>
11682where
11683    C: common::Connector,
11684{
11685    /// Perform the operation you have build so far.
11686    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
11687        use std::borrow::Cow;
11688        use std::io::{Read, Seek};
11689
11690        use common::{url::Params, ToParts};
11691        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11692
11693        let mut dd = common::DefaultDelegate;
11694        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11695        dlg.begin(common::MethodInfo {
11696            id: "tagmanager.accounts.containers.variables.update",
11697            http_method: hyper::Method::PUT,
11698        });
11699
11700        for &field in [
11701            "alt",
11702            "accountId",
11703            "containerId",
11704            "variableId",
11705            "fingerprint",
11706        ]
11707        .iter()
11708        {
11709            if self._additional_params.contains_key(field) {
11710                dlg.finished(false);
11711                return Err(common::Error::FieldClash(field));
11712            }
11713        }
11714
11715        let mut params = Params::with_capacity(7 + self._additional_params.len());
11716        params.push("accountId", self._account_id);
11717        params.push("containerId", self._container_id);
11718        params.push("variableId", self._variable_id);
11719        if let Some(value) = self._fingerprint.as_ref() {
11720            params.push("fingerprint", value);
11721        }
11722
11723        params.extend(self._additional_params.iter());
11724
11725        params.push("alt", "json");
11726        let mut url = self.hub._base_url.clone()
11727            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/variables/{variableId}";
11728        if self._scopes.is_empty() {
11729            self._scopes
11730                .insert(Scope::EditContainer.as_ref().to_string());
11731        }
11732
11733        #[allow(clippy::single_element_loop)]
11734        for &(find_this, param_name) in [
11735            ("{accountId}", "accountId"),
11736            ("{containerId}", "containerId"),
11737            ("{variableId}", "variableId"),
11738        ]
11739        .iter()
11740        {
11741            url = params.uri_replacement(url, param_name, find_this, false);
11742        }
11743        {
11744            let to_remove = ["variableId", "containerId", "accountId"];
11745            params.remove_params(&to_remove);
11746        }
11747
11748        let url = params.parse_with_url(&url);
11749
11750        let mut json_mime_type = mime::APPLICATION_JSON;
11751        let mut request_value_reader = {
11752            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11753            common::remove_json_null_values(&mut value);
11754            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11755            serde_json::to_writer(&mut dst, &value).unwrap();
11756            dst
11757        };
11758        let request_size = request_value_reader
11759            .seek(std::io::SeekFrom::End(0))
11760            .unwrap();
11761        request_value_reader
11762            .seek(std::io::SeekFrom::Start(0))
11763            .unwrap();
11764
11765        loop {
11766            let token = match self
11767                .hub
11768                .auth
11769                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11770                .await
11771            {
11772                Ok(token) => token,
11773                Err(e) => match dlg.token(e) {
11774                    Ok(token) => token,
11775                    Err(e) => {
11776                        dlg.finished(false);
11777                        return Err(common::Error::MissingToken(e));
11778                    }
11779                },
11780            };
11781            request_value_reader
11782                .seek(std::io::SeekFrom::Start(0))
11783                .unwrap();
11784            let mut req_result = {
11785                let client = &self.hub.client;
11786                dlg.pre_request();
11787                let mut req_builder = hyper::Request::builder()
11788                    .method(hyper::Method::PUT)
11789                    .uri(url.as_str())
11790                    .header(USER_AGENT, self.hub._user_agent.clone());
11791
11792                if let Some(token) = token.as_ref() {
11793                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11794                }
11795
11796                let request = req_builder
11797                    .header(CONTENT_TYPE, json_mime_type.to_string())
11798                    .header(CONTENT_LENGTH, request_size as u64)
11799                    .body(common::to_body(
11800                        request_value_reader.get_ref().clone().into(),
11801                    ));
11802
11803                client.request(request.unwrap()).await
11804            };
11805
11806            match req_result {
11807                Err(err) => {
11808                    if let common::Retry::After(d) = dlg.http_error(&err) {
11809                        sleep(d).await;
11810                        continue;
11811                    }
11812                    dlg.finished(false);
11813                    return Err(common::Error::HttpError(err));
11814                }
11815                Ok(res) => {
11816                    let (mut parts, body) = res.into_parts();
11817                    let mut body = common::Body::new(body);
11818                    if !parts.status.is_success() {
11819                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11820                        let error = serde_json::from_str(&common::to_string(&bytes));
11821                        let response = common::to_response(parts, bytes.into());
11822
11823                        if let common::Retry::After(d) =
11824                            dlg.http_failure(&response, error.as_ref().ok())
11825                        {
11826                            sleep(d).await;
11827                            continue;
11828                        }
11829
11830                        dlg.finished(false);
11831
11832                        return Err(match error {
11833                            Ok(value) => common::Error::BadRequest(value),
11834                            _ => common::Error::Failure(response),
11835                        });
11836                    }
11837                    let response = {
11838                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11839                        let encoded = common::to_string(&bytes);
11840                        match serde_json::from_str(&encoded) {
11841                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11842                            Err(error) => {
11843                                dlg.response_json_decode_error(&encoded, &error);
11844                                return Err(common::Error::JsonDecodeError(
11845                                    encoded.to_string(),
11846                                    error,
11847                                ));
11848                            }
11849                        }
11850                    };
11851
11852                    dlg.finished(true);
11853                    return Ok(response);
11854                }
11855            }
11856        }
11857    }
11858
11859    ///
11860    /// Sets the *request* property to the given value.
11861    ///
11862    /// Even though the property as already been set when instantiating this call,
11863    /// we provide this method for API completeness.
11864    pub fn request(mut self, new_value: Variable) -> AccountContainerVariableUpdateCall<'a, C> {
11865        self._request = new_value;
11866        self
11867    }
11868    /// The GTM Account ID.
11869    ///
11870    /// Sets the *account id* path property to the given value.
11871    ///
11872    /// Even though the property as already been set when instantiating this call,
11873    /// we provide this method for API completeness.
11874    pub fn account_id(mut self, new_value: &str) -> AccountContainerVariableUpdateCall<'a, C> {
11875        self._account_id = new_value.to_string();
11876        self
11877    }
11878    /// The GTM Container ID.
11879    ///
11880    /// Sets the *container id* path property to the given value.
11881    ///
11882    /// Even though the property as already been set when instantiating this call,
11883    /// we provide this method for API completeness.
11884    pub fn container_id(mut self, new_value: &str) -> AccountContainerVariableUpdateCall<'a, C> {
11885        self._container_id = new_value.to_string();
11886        self
11887    }
11888    /// The GTM Variable ID.
11889    ///
11890    /// Sets the *variable id* path property to the given value.
11891    ///
11892    /// Even though the property as already been set when instantiating this call,
11893    /// we provide this method for API completeness.
11894    pub fn variable_id(mut self, new_value: &str) -> AccountContainerVariableUpdateCall<'a, C> {
11895        self._variable_id = new_value.to_string();
11896        self
11897    }
11898    /// When provided, this fingerprint must match the fingerprint of the variable in storage.
11899    ///
11900    /// Sets the *fingerprint* query property to the given value.
11901    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVariableUpdateCall<'a, C> {
11902        self._fingerprint = Some(new_value.to_string());
11903        self
11904    }
11905    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11906    /// while executing the actual API request.
11907    ///
11908    /// ````text
11909    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11910    /// ````
11911    ///
11912    /// Sets the *delegate* property to the given value.
11913    pub fn delegate(
11914        mut self,
11915        new_value: &'a mut dyn common::Delegate,
11916    ) -> AccountContainerVariableUpdateCall<'a, C> {
11917        self._delegate = Some(new_value);
11918        self
11919    }
11920
11921    /// Set any additional parameter of the query string used in the request.
11922    /// It should be used to set parameters which are not yet available through their own
11923    /// setters.
11924    ///
11925    /// Please note that this method must not be used to set any of the known parameters
11926    /// which have their own setter method. If done anyway, the request will fail.
11927    ///
11928    /// # Additional Parameters
11929    ///
11930    /// * *$.xgafv* (query-string) - V1 error format.
11931    /// * *access_token* (query-string) - OAuth access token.
11932    /// * *alt* (query-string) - Data format for response.
11933    /// * *callback* (query-string) - JSONP
11934    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11935    /// * *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.
11936    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11937    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11938    /// * *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.
11939    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11940    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11941    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVariableUpdateCall<'a, C>
11942    where
11943        T: AsRef<str>,
11944    {
11945        self._additional_params
11946            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11947        self
11948    }
11949
11950    /// Identifies the authorization scope for the method you are building.
11951    ///
11952    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11953    /// [`Scope::EditContainer`].
11954    ///
11955    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11956    /// tokens for more than one scope.
11957    ///
11958    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11959    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11960    /// sufficient, a read-write scope will do as well.
11961    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVariableUpdateCall<'a, C>
11962    where
11963        St: AsRef<str>,
11964    {
11965        self._scopes.insert(String::from(scope.as_ref()));
11966        self
11967    }
11968    /// Identifies the authorization scope(s) for the method you are building.
11969    ///
11970    /// See [`Self::add_scope()`] for details.
11971    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVariableUpdateCall<'a, C>
11972    where
11973        I: IntoIterator<Item = St>,
11974        St: AsRef<str>,
11975    {
11976        self._scopes
11977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11978        self
11979    }
11980
11981    /// Removes all scopes, and no default scope will be used either.
11982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11983    /// for details).
11984    pub fn clear_scopes(mut self) -> AccountContainerVariableUpdateCall<'a, C> {
11985        self._scopes.clear();
11986        self
11987    }
11988}
11989
11990/// Creates a Container Version.
11991///
11992/// A builder for the *containers.versions.create* method supported by a *account* resource.
11993/// It is not used directly, but through a [`AccountMethods`] instance.
11994///
11995/// # Example
11996///
11997/// Instantiate a resource method builder
11998///
11999/// ```test_harness,no_run
12000/// # extern crate hyper;
12001/// # extern crate hyper_rustls;
12002/// # extern crate google_tagmanager1 as tagmanager1;
12003/// use tagmanager1::api::CreateContainerVersionRequestVersionOptions;
12004/// # async fn dox() {
12005/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12006///
12007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12008/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12009/// #     .with_native_roots()
12010/// #     .unwrap()
12011/// #     .https_only()
12012/// #     .enable_http2()
12013/// #     .build();
12014///
12015/// # let executor = hyper_util::rt::TokioExecutor::new();
12016/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12017/// #     secret,
12018/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12019/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12020/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12021/// #     ),
12022/// # ).build().await.unwrap();
12023///
12024/// # let client = hyper_util::client::legacy::Client::builder(
12025/// #     hyper_util::rt::TokioExecutor::new()
12026/// # )
12027/// # .build(
12028/// #     hyper_rustls::HttpsConnectorBuilder::new()
12029/// #         .with_native_roots()
12030/// #         .unwrap()
12031/// #         .https_or_http()
12032/// #         .enable_http2()
12033/// #         .build()
12034/// # );
12035/// # let mut hub = TagManager::new(client, auth);
12036/// // As the method needs a request, you would usually fill it with the desired information
12037/// // into the respective structure. Some of the parts shown here might not be applicable !
12038/// // Values shown here are possibly random and not representative !
12039/// let mut req = CreateContainerVersionRequestVersionOptions::default();
12040///
12041/// // You can configure optional parameters by calling the respective setters at will, and
12042/// // execute the final call using `doit()`.
12043/// // Values shown here are possibly random and not representative !
12044/// let result = hub.accounts().containers_versions_create(req, "accountId", "containerId")
12045///              .doit().await;
12046/// # }
12047/// ```
12048pub struct AccountContainerVersionCreateCall<'a, C>
12049where
12050    C: 'a,
12051{
12052    hub: &'a TagManager<C>,
12053    _request: CreateContainerVersionRequestVersionOptions,
12054    _account_id: String,
12055    _container_id: String,
12056    _delegate: Option<&'a mut dyn common::Delegate>,
12057    _additional_params: HashMap<String, String>,
12058    _scopes: BTreeSet<String>,
12059}
12060
12061impl<'a, C> common::CallBuilder for AccountContainerVersionCreateCall<'a, C> {}
12062
12063impl<'a, C> AccountContainerVersionCreateCall<'a, C>
12064where
12065    C: common::Connector,
12066{
12067    /// Perform the operation you have build so far.
12068    pub async fn doit(
12069        mut self,
12070    ) -> common::Result<(common::Response, CreateContainerVersionResponse)> {
12071        use std::borrow::Cow;
12072        use std::io::{Read, Seek};
12073
12074        use common::{url::Params, ToParts};
12075        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12076
12077        let mut dd = common::DefaultDelegate;
12078        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12079        dlg.begin(common::MethodInfo {
12080            id: "tagmanager.accounts.containers.versions.create",
12081            http_method: hyper::Method::POST,
12082        });
12083
12084        for &field in ["alt", "accountId", "containerId"].iter() {
12085            if self._additional_params.contains_key(field) {
12086                dlg.finished(false);
12087                return Err(common::Error::FieldClash(field));
12088            }
12089        }
12090
12091        let mut params = Params::with_capacity(5 + self._additional_params.len());
12092        params.push("accountId", self._account_id);
12093        params.push("containerId", self._container_id);
12094
12095        params.extend(self._additional_params.iter());
12096
12097        params.push("alt", "json");
12098        let mut url = self.hub._base_url.clone()
12099            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions";
12100        if self._scopes.is_empty() {
12101            self._scopes
12102                .insert(Scope::EditContainerversion.as_ref().to_string());
12103        }
12104
12105        #[allow(clippy::single_element_loop)]
12106        for &(find_this, param_name) in [
12107            ("{accountId}", "accountId"),
12108            ("{containerId}", "containerId"),
12109        ]
12110        .iter()
12111        {
12112            url = params.uri_replacement(url, param_name, find_this, false);
12113        }
12114        {
12115            let to_remove = ["containerId", "accountId"];
12116            params.remove_params(&to_remove);
12117        }
12118
12119        let url = params.parse_with_url(&url);
12120
12121        let mut json_mime_type = mime::APPLICATION_JSON;
12122        let mut request_value_reader = {
12123            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12124            common::remove_json_null_values(&mut value);
12125            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12126            serde_json::to_writer(&mut dst, &value).unwrap();
12127            dst
12128        };
12129        let request_size = request_value_reader
12130            .seek(std::io::SeekFrom::End(0))
12131            .unwrap();
12132        request_value_reader
12133            .seek(std::io::SeekFrom::Start(0))
12134            .unwrap();
12135
12136        loop {
12137            let token = match self
12138                .hub
12139                .auth
12140                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12141                .await
12142            {
12143                Ok(token) => token,
12144                Err(e) => match dlg.token(e) {
12145                    Ok(token) => token,
12146                    Err(e) => {
12147                        dlg.finished(false);
12148                        return Err(common::Error::MissingToken(e));
12149                    }
12150                },
12151            };
12152            request_value_reader
12153                .seek(std::io::SeekFrom::Start(0))
12154                .unwrap();
12155            let mut req_result = {
12156                let client = &self.hub.client;
12157                dlg.pre_request();
12158                let mut req_builder = hyper::Request::builder()
12159                    .method(hyper::Method::POST)
12160                    .uri(url.as_str())
12161                    .header(USER_AGENT, self.hub._user_agent.clone());
12162
12163                if let Some(token) = token.as_ref() {
12164                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12165                }
12166
12167                let request = req_builder
12168                    .header(CONTENT_TYPE, json_mime_type.to_string())
12169                    .header(CONTENT_LENGTH, request_size as u64)
12170                    .body(common::to_body(
12171                        request_value_reader.get_ref().clone().into(),
12172                    ));
12173
12174                client.request(request.unwrap()).await
12175            };
12176
12177            match req_result {
12178                Err(err) => {
12179                    if let common::Retry::After(d) = dlg.http_error(&err) {
12180                        sleep(d).await;
12181                        continue;
12182                    }
12183                    dlg.finished(false);
12184                    return Err(common::Error::HttpError(err));
12185                }
12186                Ok(res) => {
12187                    let (mut parts, body) = res.into_parts();
12188                    let mut body = common::Body::new(body);
12189                    if !parts.status.is_success() {
12190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12191                        let error = serde_json::from_str(&common::to_string(&bytes));
12192                        let response = common::to_response(parts, bytes.into());
12193
12194                        if let common::Retry::After(d) =
12195                            dlg.http_failure(&response, error.as_ref().ok())
12196                        {
12197                            sleep(d).await;
12198                            continue;
12199                        }
12200
12201                        dlg.finished(false);
12202
12203                        return Err(match error {
12204                            Ok(value) => common::Error::BadRequest(value),
12205                            _ => common::Error::Failure(response),
12206                        });
12207                    }
12208                    let response = {
12209                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12210                        let encoded = common::to_string(&bytes);
12211                        match serde_json::from_str(&encoded) {
12212                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12213                            Err(error) => {
12214                                dlg.response_json_decode_error(&encoded, &error);
12215                                return Err(common::Error::JsonDecodeError(
12216                                    encoded.to_string(),
12217                                    error,
12218                                ));
12219                            }
12220                        }
12221                    };
12222
12223                    dlg.finished(true);
12224                    return Ok(response);
12225                }
12226            }
12227        }
12228    }
12229
12230    ///
12231    /// Sets the *request* property to the given value.
12232    ///
12233    /// Even though the property as already been set when instantiating this call,
12234    /// we provide this method for API completeness.
12235    pub fn request(
12236        mut self,
12237        new_value: CreateContainerVersionRequestVersionOptions,
12238    ) -> AccountContainerVersionCreateCall<'a, C> {
12239        self._request = new_value;
12240        self
12241    }
12242    /// The GTM Account ID.
12243    ///
12244    /// Sets the *account id* path property to the given value.
12245    ///
12246    /// Even though the property as already been set when instantiating this call,
12247    /// we provide this method for API completeness.
12248    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionCreateCall<'a, C> {
12249        self._account_id = new_value.to_string();
12250        self
12251    }
12252    /// The GTM Container ID.
12253    ///
12254    /// Sets the *container id* path property to the given value.
12255    ///
12256    /// Even though the property as already been set when instantiating this call,
12257    /// we provide this method for API completeness.
12258    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionCreateCall<'a, C> {
12259        self._container_id = new_value.to_string();
12260        self
12261    }
12262    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12263    /// while executing the actual API request.
12264    ///
12265    /// ````text
12266    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12267    /// ````
12268    ///
12269    /// Sets the *delegate* property to the given value.
12270    pub fn delegate(
12271        mut self,
12272        new_value: &'a mut dyn common::Delegate,
12273    ) -> AccountContainerVersionCreateCall<'a, C> {
12274        self._delegate = Some(new_value);
12275        self
12276    }
12277
12278    /// Set any additional parameter of the query string used in the request.
12279    /// It should be used to set parameters which are not yet available through their own
12280    /// setters.
12281    ///
12282    /// Please note that this method must not be used to set any of the known parameters
12283    /// which have their own setter method. If done anyway, the request will fail.
12284    ///
12285    /// # Additional Parameters
12286    ///
12287    /// * *$.xgafv* (query-string) - V1 error format.
12288    /// * *access_token* (query-string) - OAuth access token.
12289    /// * *alt* (query-string) - Data format for response.
12290    /// * *callback* (query-string) - JSONP
12291    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12292    /// * *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.
12293    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12294    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12295    /// * *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.
12296    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12297    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12298    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionCreateCall<'a, C>
12299    where
12300        T: AsRef<str>,
12301    {
12302        self._additional_params
12303            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12304        self
12305    }
12306
12307    /// Identifies the authorization scope for the method you are building.
12308    ///
12309    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12310    /// [`Scope::EditContainerversion`].
12311    ///
12312    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12313    /// tokens for more than one scope.
12314    ///
12315    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12316    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12317    /// sufficient, a read-write scope will do as well.
12318    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionCreateCall<'a, C>
12319    where
12320        St: AsRef<str>,
12321    {
12322        self._scopes.insert(String::from(scope.as_ref()));
12323        self
12324    }
12325    /// Identifies the authorization scope(s) for the method you are building.
12326    ///
12327    /// See [`Self::add_scope()`] for details.
12328    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionCreateCall<'a, C>
12329    where
12330        I: IntoIterator<Item = St>,
12331        St: AsRef<str>,
12332    {
12333        self._scopes
12334            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12335        self
12336    }
12337
12338    /// Removes all scopes, and no default scope will be used either.
12339    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12340    /// for details).
12341    pub fn clear_scopes(mut self) -> AccountContainerVersionCreateCall<'a, C> {
12342        self._scopes.clear();
12343        self
12344    }
12345}
12346
12347/// Deletes a Container Version.
12348///
12349/// A builder for the *containers.versions.delete* method supported by a *account* resource.
12350/// It is not used directly, but through a [`AccountMethods`] instance.
12351///
12352/// # Example
12353///
12354/// Instantiate a resource method builder
12355///
12356/// ```test_harness,no_run
12357/// # extern crate hyper;
12358/// # extern crate hyper_rustls;
12359/// # extern crate google_tagmanager1 as tagmanager1;
12360/// # async fn dox() {
12361/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12362///
12363/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12364/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12365/// #     .with_native_roots()
12366/// #     .unwrap()
12367/// #     .https_only()
12368/// #     .enable_http2()
12369/// #     .build();
12370///
12371/// # let executor = hyper_util::rt::TokioExecutor::new();
12372/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12373/// #     secret,
12374/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12375/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12376/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12377/// #     ),
12378/// # ).build().await.unwrap();
12379///
12380/// # let client = hyper_util::client::legacy::Client::builder(
12381/// #     hyper_util::rt::TokioExecutor::new()
12382/// # )
12383/// # .build(
12384/// #     hyper_rustls::HttpsConnectorBuilder::new()
12385/// #         .with_native_roots()
12386/// #         .unwrap()
12387/// #         .https_or_http()
12388/// #         .enable_http2()
12389/// #         .build()
12390/// # );
12391/// # let mut hub = TagManager::new(client, auth);
12392/// // You can configure optional parameters by calling the respective setters at will, and
12393/// // execute the final call using `doit()`.
12394/// // Values shown here are possibly random and not representative !
12395/// let result = hub.accounts().containers_versions_delete("accountId", "containerId", "containerVersionId")
12396///              .doit().await;
12397/// # }
12398/// ```
12399pub struct AccountContainerVersionDeleteCall<'a, C>
12400where
12401    C: 'a,
12402{
12403    hub: &'a TagManager<C>,
12404    _account_id: String,
12405    _container_id: String,
12406    _container_version_id: String,
12407    _delegate: Option<&'a mut dyn common::Delegate>,
12408    _additional_params: HashMap<String, String>,
12409    _scopes: BTreeSet<String>,
12410}
12411
12412impl<'a, C> common::CallBuilder for AccountContainerVersionDeleteCall<'a, C> {}
12413
12414impl<'a, C> AccountContainerVersionDeleteCall<'a, C>
12415where
12416    C: common::Connector,
12417{
12418    /// Perform the operation you have build so far.
12419    pub async fn doit(mut self) -> common::Result<common::Response> {
12420        use std::borrow::Cow;
12421        use std::io::{Read, Seek};
12422
12423        use common::{url::Params, ToParts};
12424        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12425
12426        let mut dd = common::DefaultDelegate;
12427        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12428        dlg.begin(common::MethodInfo {
12429            id: "tagmanager.accounts.containers.versions.delete",
12430            http_method: hyper::Method::DELETE,
12431        });
12432
12433        for &field in ["accountId", "containerId", "containerVersionId"].iter() {
12434            if self._additional_params.contains_key(field) {
12435                dlg.finished(false);
12436                return Err(common::Error::FieldClash(field));
12437            }
12438        }
12439
12440        let mut params = Params::with_capacity(4 + self._additional_params.len());
12441        params.push("accountId", self._account_id);
12442        params.push("containerId", self._container_id);
12443        params.push("containerVersionId", self._container_version_id);
12444
12445        params.extend(self._additional_params.iter());
12446
12447        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}";
12448        if self._scopes.is_empty() {
12449            self._scopes
12450                .insert(Scope::EditContainerversion.as_ref().to_string());
12451        }
12452
12453        #[allow(clippy::single_element_loop)]
12454        for &(find_this, param_name) in [
12455            ("{accountId}", "accountId"),
12456            ("{containerId}", "containerId"),
12457            ("{containerVersionId}", "containerVersionId"),
12458        ]
12459        .iter()
12460        {
12461            url = params.uri_replacement(url, param_name, find_this, false);
12462        }
12463        {
12464            let to_remove = ["containerVersionId", "containerId", "accountId"];
12465            params.remove_params(&to_remove);
12466        }
12467
12468        let url = params.parse_with_url(&url);
12469
12470        loop {
12471            let token = match self
12472                .hub
12473                .auth
12474                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12475                .await
12476            {
12477                Ok(token) => token,
12478                Err(e) => match dlg.token(e) {
12479                    Ok(token) => token,
12480                    Err(e) => {
12481                        dlg.finished(false);
12482                        return Err(common::Error::MissingToken(e));
12483                    }
12484                },
12485            };
12486            let mut req_result = {
12487                let client = &self.hub.client;
12488                dlg.pre_request();
12489                let mut req_builder = hyper::Request::builder()
12490                    .method(hyper::Method::DELETE)
12491                    .uri(url.as_str())
12492                    .header(USER_AGENT, self.hub._user_agent.clone());
12493
12494                if let Some(token) = token.as_ref() {
12495                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12496                }
12497
12498                let request = req_builder
12499                    .header(CONTENT_LENGTH, 0_u64)
12500                    .body(common::to_body::<String>(None));
12501
12502                client.request(request.unwrap()).await
12503            };
12504
12505            match req_result {
12506                Err(err) => {
12507                    if let common::Retry::After(d) = dlg.http_error(&err) {
12508                        sleep(d).await;
12509                        continue;
12510                    }
12511                    dlg.finished(false);
12512                    return Err(common::Error::HttpError(err));
12513                }
12514                Ok(res) => {
12515                    let (mut parts, body) = res.into_parts();
12516                    let mut body = common::Body::new(body);
12517                    if !parts.status.is_success() {
12518                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12519                        let error = serde_json::from_str(&common::to_string(&bytes));
12520                        let response = common::to_response(parts, bytes.into());
12521
12522                        if let common::Retry::After(d) =
12523                            dlg.http_failure(&response, error.as_ref().ok())
12524                        {
12525                            sleep(d).await;
12526                            continue;
12527                        }
12528
12529                        dlg.finished(false);
12530
12531                        return Err(match error {
12532                            Ok(value) => common::Error::BadRequest(value),
12533                            _ => common::Error::Failure(response),
12534                        });
12535                    }
12536                    let response = common::Response::from_parts(parts, body);
12537
12538                    dlg.finished(true);
12539                    return Ok(response);
12540                }
12541            }
12542        }
12543    }
12544
12545    /// The GTM Account ID.
12546    ///
12547    /// Sets the *account id* path property to the given value.
12548    ///
12549    /// Even though the property as already been set when instantiating this call,
12550    /// we provide this method for API completeness.
12551    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C> {
12552        self._account_id = new_value.to_string();
12553        self
12554    }
12555    /// The GTM Container ID.
12556    ///
12557    /// Sets the *container id* path property to the given value.
12558    ///
12559    /// Even though the property as already been set when instantiating this call,
12560    /// we provide this method for API completeness.
12561    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C> {
12562        self._container_id = new_value.to_string();
12563        self
12564    }
12565    /// The GTM Container Version ID.
12566    ///
12567    /// Sets the *container version id* path property to the given value.
12568    ///
12569    /// Even though the property as already been set when instantiating this call,
12570    /// we provide this method for API completeness.
12571    pub fn container_version_id(
12572        mut self,
12573        new_value: &str,
12574    ) -> AccountContainerVersionDeleteCall<'a, C> {
12575        self._container_version_id = new_value.to_string();
12576        self
12577    }
12578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12579    /// while executing the actual API request.
12580    ///
12581    /// ````text
12582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12583    /// ````
12584    ///
12585    /// Sets the *delegate* property to the given value.
12586    pub fn delegate(
12587        mut self,
12588        new_value: &'a mut dyn common::Delegate,
12589    ) -> AccountContainerVersionDeleteCall<'a, C> {
12590        self._delegate = Some(new_value);
12591        self
12592    }
12593
12594    /// Set any additional parameter of the query string used in the request.
12595    /// It should be used to set parameters which are not yet available through their own
12596    /// setters.
12597    ///
12598    /// Please note that this method must not be used to set any of the known parameters
12599    /// which have their own setter method. If done anyway, the request will fail.
12600    ///
12601    /// # Additional Parameters
12602    ///
12603    /// * *$.xgafv* (query-string) - V1 error format.
12604    /// * *access_token* (query-string) - OAuth access token.
12605    /// * *alt* (query-string) - Data format for response.
12606    /// * *callback* (query-string) - JSONP
12607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12608    /// * *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.
12609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12611    /// * *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.
12612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12614    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionDeleteCall<'a, C>
12615    where
12616        T: AsRef<str>,
12617    {
12618        self._additional_params
12619            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12620        self
12621    }
12622
12623    /// Identifies the authorization scope for the method you are building.
12624    ///
12625    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12626    /// [`Scope::EditContainerversion`].
12627    ///
12628    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12629    /// tokens for more than one scope.
12630    ///
12631    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12632    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12633    /// sufficient, a read-write scope will do as well.
12634    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionDeleteCall<'a, C>
12635    where
12636        St: AsRef<str>,
12637    {
12638        self._scopes.insert(String::from(scope.as_ref()));
12639        self
12640    }
12641    /// Identifies the authorization scope(s) for the method you are building.
12642    ///
12643    /// See [`Self::add_scope()`] for details.
12644    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionDeleteCall<'a, C>
12645    where
12646        I: IntoIterator<Item = St>,
12647        St: AsRef<str>,
12648    {
12649        self._scopes
12650            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12651        self
12652    }
12653
12654    /// Removes all scopes, and no default scope will be used either.
12655    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12656    /// for details).
12657    pub fn clear_scopes(mut self) -> AccountContainerVersionDeleteCall<'a, C> {
12658        self._scopes.clear();
12659        self
12660    }
12661}
12662
12663/// Gets a Container Version.
12664///
12665/// A builder for the *containers.versions.get* method supported by a *account* resource.
12666/// It is not used directly, but through a [`AccountMethods`] instance.
12667///
12668/// # Example
12669///
12670/// Instantiate a resource method builder
12671///
12672/// ```test_harness,no_run
12673/// # extern crate hyper;
12674/// # extern crate hyper_rustls;
12675/// # extern crate google_tagmanager1 as tagmanager1;
12676/// # async fn dox() {
12677/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12678///
12679/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12680/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12681/// #     .with_native_roots()
12682/// #     .unwrap()
12683/// #     .https_only()
12684/// #     .enable_http2()
12685/// #     .build();
12686///
12687/// # let executor = hyper_util::rt::TokioExecutor::new();
12688/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12689/// #     secret,
12690/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12691/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12692/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12693/// #     ),
12694/// # ).build().await.unwrap();
12695///
12696/// # let client = hyper_util::client::legacy::Client::builder(
12697/// #     hyper_util::rt::TokioExecutor::new()
12698/// # )
12699/// # .build(
12700/// #     hyper_rustls::HttpsConnectorBuilder::new()
12701/// #         .with_native_roots()
12702/// #         .unwrap()
12703/// #         .https_or_http()
12704/// #         .enable_http2()
12705/// #         .build()
12706/// # );
12707/// # let mut hub = TagManager::new(client, auth);
12708/// // You can configure optional parameters by calling the respective setters at will, and
12709/// // execute the final call using `doit()`.
12710/// // Values shown here are possibly random and not representative !
12711/// let result = hub.accounts().containers_versions_get("accountId", "containerId", "containerVersionId")
12712///              .doit().await;
12713/// # }
12714/// ```
12715pub struct AccountContainerVersionGetCall<'a, C>
12716where
12717    C: 'a,
12718{
12719    hub: &'a TagManager<C>,
12720    _account_id: String,
12721    _container_id: String,
12722    _container_version_id: String,
12723    _delegate: Option<&'a mut dyn common::Delegate>,
12724    _additional_params: HashMap<String, String>,
12725    _scopes: BTreeSet<String>,
12726}
12727
12728impl<'a, C> common::CallBuilder for AccountContainerVersionGetCall<'a, C> {}
12729
12730impl<'a, C> AccountContainerVersionGetCall<'a, C>
12731where
12732    C: common::Connector,
12733{
12734    /// Perform the operation you have build so far.
12735    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
12736        use std::borrow::Cow;
12737        use std::io::{Read, Seek};
12738
12739        use common::{url::Params, ToParts};
12740        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12741
12742        let mut dd = common::DefaultDelegate;
12743        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12744        dlg.begin(common::MethodInfo {
12745            id: "tagmanager.accounts.containers.versions.get",
12746            http_method: hyper::Method::GET,
12747        });
12748
12749        for &field in ["alt", "accountId", "containerId", "containerVersionId"].iter() {
12750            if self._additional_params.contains_key(field) {
12751                dlg.finished(false);
12752                return Err(common::Error::FieldClash(field));
12753            }
12754        }
12755
12756        let mut params = Params::with_capacity(5 + self._additional_params.len());
12757        params.push("accountId", self._account_id);
12758        params.push("containerId", self._container_id);
12759        params.push("containerVersionId", self._container_version_id);
12760
12761        params.extend(self._additional_params.iter());
12762
12763        params.push("alt", "json");
12764        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}";
12765        if self._scopes.is_empty() {
12766            self._scopes.insert(Scope::Readonly.as_ref().to_string());
12767        }
12768
12769        #[allow(clippy::single_element_loop)]
12770        for &(find_this, param_name) in [
12771            ("{accountId}", "accountId"),
12772            ("{containerId}", "containerId"),
12773            ("{containerVersionId}", "containerVersionId"),
12774        ]
12775        .iter()
12776        {
12777            url = params.uri_replacement(url, param_name, find_this, false);
12778        }
12779        {
12780            let to_remove = ["containerVersionId", "containerId", "accountId"];
12781            params.remove_params(&to_remove);
12782        }
12783
12784        let url = params.parse_with_url(&url);
12785
12786        loop {
12787            let token = match self
12788                .hub
12789                .auth
12790                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12791                .await
12792            {
12793                Ok(token) => token,
12794                Err(e) => match dlg.token(e) {
12795                    Ok(token) => token,
12796                    Err(e) => {
12797                        dlg.finished(false);
12798                        return Err(common::Error::MissingToken(e));
12799                    }
12800                },
12801            };
12802            let mut req_result = {
12803                let client = &self.hub.client;
12804                dlg.pre_request();
12805                let mut req_builder = hyper::Request::builder()
12806                    .method(hyper::Method::GET)
12807                    .uri(url.as_str())
12808                    .header(USER_AGENT, self.hub._user_agent.clone());
12809
12810                if let Some(token) = token.as_ref() {
12811                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12812                }
12813
12814                let request = req_builder
12815                    .header(CONTENT_LENGTH, 0_u64)
12816                    .body(common::to_body::<String>(None));
12817
12818                client.request(request.unwrap()).await
12819            };
12820
12821            match req_result {
12822                Err(err) => {
12823                    if let common::Retry::After(d) = dlg.http_error(&err) {
12824                        sleep(d).await;
12825                        continue;
12826                    }
12827                    dlg.finished(false);
12828                    return Err(common::Error::HttpError(err));
12829                }
12830                Ok(res) => {
12831                    let (mut parts, body) = res.into_parts();
12832                    let mut body = common::Body::new(body);
12833                    if !parts.status.is_success() {
12834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12835                        let error = serde_json::from_str(&common::to_string(&bytes));
12836                        let response = common::to_response(parts, bytes.into());
12837
12838                        if let common::Retry::After(d) =
12839                            dlg.http_failure(&response, error.as_ref().ok())
12840                        {
12841                            sleep(d).await;
12842                            continue;
12843                        }
12844
12845                        dlg.finished(false);
12846
12847                        return Err(match error {
12848                            Ok(value) => common::Error::BadRequest(value),
12849                            _ => common::Error::Failure(response),
12850                        });
12851                    }
12852                    let response = {
12853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12854                        let encoded = common::to_string(&bytes);
12855                        match serde_json::from_str(&encoded) {
12856                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12857                            Err(error) => {
12858                                dlg.response_json_decode_error(&encoded, &error);
12859                                return Err(common::Error::JsonDecodeError(
12860                                    encoded.to_string(),
12861                                    error,
12862                                ));
12863                            }
12864                        }
12865                    };
12866
12867                    dlg.finished(true);
12868                    return Ok(response);
12869                }
12870            }
12871        }
12872    }
12873
12874    /// The GTM Account ID.
12875    ///
12876    /// Sets the *account id* path property to the given value.
12877    ///
12878    /// Even though the property as already been set when instantiating this call,
12879    /// we provide this method for API completeness.
12880    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionGetCall<'a, C> {
12881        self._account_id = new_value.to_string();
12882        self
12883    }
12884    /// The GTM Container ID.
12885    ///
12886    /// Sets the *container id* path property to the given value.
12887    ///
12888    /// Even though the property as already been set when instantiating this call,
12889    /// we provide this method for API completeness.
12890    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionGetCall<'a, C> {
12891        self._container_id = new_value.to_string();
12892        self
12893    }
12894    /// The GTM Container Version ID. Specify published to retrieve the currently published version.
12895    ///
12896    /// Sets the *container version id* path property to the given value.
12897    ///
12898    /// Even though the property as already been set when instantiating this call,
12899    /// we provide this method for API completeness.
12900    pub fn container_version_id(
12901        mut self,
12902        new_value: &str,
12903    ) -> AccountContainerVersionGetCall<'a, C> {
12904        self._container_version_id = new_value.to_string();
12905        self
12906    }
12907    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12908    /// while executing the actual API request.
12909    ///
12910    /// ````text
12911    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12912    /// ````
12913    ///
12914    /// Sets the *delegate* property to the given value.
12915    pub fn delegate(
12916        mut self,
12917        new_value: &'a mut dyn common::Delegate,
12918    ) -> AccountContainerVersionGetCall<'a, C> {
12919        self._delegate = Some(new_value);
12920        self
12921    }
12922
12923    /// Set any additional parameter of the query string used in the request.
12924    /// It should be used to set parameters which are not yet available through their own
12925    /// setters.
12926    ///
12927    /// Please note that this method must not be used to set any of the known parameters
12928    /// which have their own setter method. If done anyway, the request will fail.
12929    ///
12930    /// # Additional Parameters
12931    ///
12932    /// * *$.xgafv* (query-string) - V1 error format.
12933    /// * *access_token* (query-string) - OAuth access token.
12934    /// * *alt* (query-string) - Data format for response.
12935    /// * *callback* (query-string) - JSONP
12936    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12937    /// * *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.
12938    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12939    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12940    /// * *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.
12941    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12942    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12943    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionGetCall<'a, C>
12944    where
12945        T: AsRef<str>,
12946    {
12947        self._additional_params
12948            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12949        self
12950    }
12951
12952    /// Identifies the authorization scope for the method you are building.
12953    ///
12954    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12955    /// [`Scope::Readonly`].
12956    ///
12957    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12958    /// tokens for more than one scope.
12959    ///
12960    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12961    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12962    /// sufficient, a read-write scope will do as well.
12963    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionGetCall<'a, C>
12964    where
12965        St: AsRef<str>,
12966    {
12967        self._scopes.insert(String::from(scope.as_ref()));
12968        self
12969    }
12970    /// Identifies the authorization scope(s) for the method you are building.
12971    ///
12972    /// See [`Self::add_scope()`] for details.
12973    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionGetCall<'a, C>
12974    where
12975        I: IntoIterator<Item = St>,
12976        St: AsRef<str>,
12977    {
12978        self._scopes
12979            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12980        self
12981    }
12982
12983    /// Removes all scopes, and no default scope will be used either.
12984    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12985    /// for details).
12986    pub fn clear_scopes(mut self) -> AccountContainerVersionGetCall<'a, C> {
12987        self._scopes.clear();
12988        self
12989    }
12990}
12991
12992/// Lists all Container Versions of a GTM Container.
12993///
12994/// A builder for the *containers.versions.list* method supported by a *account* resource.
12995/// It is not used directly, but through a [`AccountMethods`] instance.
12996///
12997/// # Example
12998///
12999/// Instantiate a resource method builder
13000///
13001/// ```test_harness,no_run
13002/// # extern crate hyper;
13003/// # extern crate hyper_rustls;
13004/// # extern crate google_tagmanager1 as tagmanager1;
13005/// # async fn dox() {
13006/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13007///
13008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13010/// #     .with_native_roots()
13011/// #     .unwrap()
13012/// #     .https_only()
13013/// #     .enable_http2()
13014/// #     .build();
13015///
13016/// # let executor = hyper_util::rt::TokioExecutor::new();
13017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13018/// #     secret,
13019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13020/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13021/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13022/// #     ),
13023/// # ).build().await.unwrap();
13024///
13025/// # let client = hyper_util::client::legacy::Client::builder(
13026/// #     hyper_util::rt::TokioExecutor::new()
13027/// # )
13028/// # .build(
13029/// #     hyper_rustls::HttpsConnectorBuilder::new()
13030/// #         .with_native_roots()
13031/// #         .unwrap()
13032/// #         .https_or_http()
13033/// #         .enable_http2()
13034/// #         .build()
13035/// # );
13036/// # let mut hub = TagManager::new(client, auth);
13037/// // You can configure optional parameters by calling the respective setters at will, and
13038/// // execute the final call using `doit()`.
13039/// // Values shown here are possibly random and not representative !
13040/// let result = hub.accounts().containers_versions_list("accountId", "containerId")
13041///              .include_deleted(true)
13042///              .headers(true)
13043///              .doit().await;
13044/// # }
13045/// ```
13046pub struct AccountContainerVersionListCall<'a, C>
13047where
13048    C: 'a,
13049{
13050    hub: &'a TagManager<C>,
13051    _account_id: String,
13052    _container_id: String,
13053    _include_deleted: Option<bool>,
13054    _headers: Option<bool>,
13055    _delegate: Option<&'a mut dyn common::Delegate>,
13056    _additional_params: HashMap<String, String>,
13057    _scopes: BTreeSet<String>,
13058}
13059
13060impl<'a, C> common::CallBuilder for AccountContainerVersionListCall<'a, C> {}
13061
13062impl<'a, C> AccountContainerVersionListCall<'a, C>
13063where
13064    C: common::Connector,
13065{
13066    /// Perform the operation you have build so far.
13067    pub async fn doit(
13068        mut self,
13069    ) -> common::Result<(common::Response, ListContainerVersionsResponse)> {
13070        use std::borrow::Cow;
13071        use std::io::{Read, Seek};
13072
13073        use common::{url::Params, ToParts};
13074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13075
13076        let mut dd = common::DefaultDelegate;
13077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13078        dlg.begin(common::MethodInfo {
13079            id: "tagmanager.accounts.containers.versions.list",
13080            http_method: hyper::Method::GET,
13081        });
13082
13083        for &field in [
13084            "alt",
13085            "accountId",
13086            "containerId",
13087            "includeDeleted",
13088            "headers",
13089        ]
13090        .iter()
13091        {
13092            if self._additional_params.contains_key(field) {
13093                dlg.finished(false);
13094                return Err(common::Error::FieldClash(field));
13095            }
13096        }
13097
13098        let mut params = Params::with_capacity(6 + self._additional_params.len());
13099        params.push("accountId", self._account_id);
13100        params.push("containerId", self._container_id);
13101        if let Some(value) = self._include_deleted.as_ref() {
13102            params.push("includeDeleted", value.to_string());
13103        }
13104        if let Some(value) = self._headers.as_ref() {
13105            params.push("headers", value.to_string());
13106        }
13107
13108        params.extend(self._additional_params.iter());
13109
13110        params.push("alt", "json");
13111        let mut url = self.hub._base_url.clone()
13112            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions";
13113        if self._scopes.is_empty() {
13114            self._scopes.insert(Scope::Readonly.as_ref().to_string());
13115        }
13116
13117        #[allow(clippy::single_element_loop)]
13118        for &(find_this, param_name) in [
13119            ("{accountId}", "accountId"),
13120            ("{containerId}", "containerId"),
13121        ]
13122        .iter()
13123        {
13124            url = params.uri_replacement(url, param_name, find_this, false);
13125        }
13126        {
13127            let to_remove = ["containerId", "accountId"];
13128            params.remove_params(&to_remove);
13129        }
13130
13131        let url = params.parse_with_url(&url);
13132
13133        loop {
13134            let token = match self
13135                .hub
13136                .auth
13137                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13138                .await
13139            {
13140                Ok(token) => token,
13141                Err(e) => match dlg.token(e) {
13142                    Ok(token) => token,
13143                    Err(e) => {
13144                        dlg.finished(false);
13145                        return Err(common::Error::MissingToken(e));
13146                    }
13147                },
13148            };
13149            let mut req_result = {
13150                let client = &self.hub.client;
13151                dlg.pre_request();
13152                let mut req_builder = hyper::Request::builder()
13153                    .method(hyper::Method::GET)
13154                    .uri(url.as_str())
13155                    .header(USER_AGENT, self.hub._user_agent.clone());
13156
13157                if let Some(token) = token.as_ref() {
13158                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13159                }
13160
13161                let request = req_builder
13162                    .header(CONTENT_LENGTH, 0_u64)
13163                    .body(common::to_body::<String>(None));
13164
13165                client.request(request.unwrap()).await
13166            };
13167
13168            match req_result {
13169                Err(err) => {
13170                    if let common::Retry::After(d) = dlg.http_error(&err) {
13171                        sleep(d).await;
13172                        continue;
13173                    }
13174                    dlg.finished(false);
13175                    return Err(common::Error::HttpError(err));
13176                }
13177                Ok(res) => {
13178                    let (mut parts, body) = res.into_parts();
13179                    let mut body = common::Body::new(body);
13180                    if !parts.status.is_success() {
13181                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13182                        let error = serde_json::from_str(&common::to_string(&bytes));
13183                        let response = common::to_response(parts, bytes.into());
13184
13185                        if let common::Retry::After(d) =
13186                            dlg.http_failure(&response, error.as_ref().ok())
13187                        {
13188                            sleep(d).await;
13189                            continue;
13190                        }
13191
13192                        dlg.finished(false);
13193
13194                        return Err(match error {
13195                            Ok(value) => common::Error::BadRequest(value),
13196                            _ => common::Error::Failure(response),
13197                        });
13198                    }
13199                    let response = {
13200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13201                        let encoded = common::to_string(&bytes);
13202                        match serde_json::from_str(&encoded) {
13203                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13204                            Err(error) => {
13205                                dlg.response_json_decode_error(&encoded, &error);
13206                                return Err(common::Error::JsonDecodeError(
13207                                    encoded.to_string(),
13208                                    error,
13209                                ));
13210                            }
13211                        }
13212                    };
13213
13214                    dlg.finished(true);
13215                    return Ok(response);
13216                }
13217            }
13218        }
13219    }
13220
13221    /// The GTM Account ID.
13222    ///
13223    /// Sets the *account id* path property to the given value.
13224    ///
13225    /// Even though the property as already been set when instantiating this call,
13226    /// we provide this method for API completeness.
13227    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionListCall<'a, C> {
13228        self._account_id = new_value.to_string();
13229        self
13230    }
13231    /// The GTM Container ID.
13232    ///
13233    /// Sets the *container id* path property to the given value.
13234    ///
13235    /// Even though the property as already been set when instantiating this call,
13236    /// we provide this method for API completeness.
13237    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionListCall<'a, C> {
13238        self._container_id = new_value.to_string();
13239        self
13240    }
13241    /// Also retrieve deleted (archived) versions when true.
13242    ///
13243    /// Sets the *include deleted* query property to the given value.
13244    pub fn include_deleted(mut self, new_value: bool) -> AccountContainerVersionListCall<'a, C> {
13245        self._include_deleted = Some(new_value);
13246        self
13247    }
13248    /// Retrieve headers only when true.
13249    ///
13250    /// Sets the *headers* query property to the given value.
13251    pub fn headers(mut self, new_value: bool) -> AccountContainerVersionListCall<'a, C> {
13252        self._headers = Some(new_value);
13253        self
13254    }
13255    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13256    /// while executing the actual API request.
13257    ///
13258    /// ````text
13259    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13260    /// ````
13261    ///
13262    /// Sets the *delegate* property to the given value.
13263    pub fn delegate(
13264        mut self,
13265        new_value: &'a mut dyn common::Delegate,
13266    ) -> AccountContainerVersionListCall<'a, C> {
13267        self._delegate = Some(new_value);
13268        self
13269    }
13270
13271    /// Set any additional parameter of the query string used in the request.
13272    /// It should be used to set parameters which are not yet available through their own
13273    /// setters.
13274    ///
13275    /// Please note that this method must not be used to set any of the known parameters
13276    /// which have their own setter method. If done anyway, the request will fail.
13277    ///
13278    /// # Additional Parameters
13279    ///
13280    /// * *$.xgafv* (query-string) - V1 error format.
13281    /// * *access_token* (query-string) - OAuth access token.
13282    /// * *alt* (query-string) - Data format for response.
13283    /// * *callback* (query-string) - JSONP
13284    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13285    /// * *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.
13286    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13287    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13288    /// * *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.
13289    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13290    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13291    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionListCall<'a, C>
13292    where
13293        T: AsRef<str>,
13294    {
13295        self._additional_params
13296            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13297        self
13298    }
13299
13300    /// Identifies the authorization scope for the method you are building.
13301    ///
13302    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13303    /// [`Scope::Readonly`].
13304    ///
13305    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13306    /// tokens for more than one scope.
13307    ///
13308    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13309    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13310    /// sufficient, a read-write scope will do as well.
13311    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionListCall<'a, C>
13312    where
13313        St: AsRef<str>,
13314    {
13315        self._scopes.insert(String::from(scope.as_ref()));
13316        self
13317    }
13318    /// Identifies the authorization scope(s) for the method you are building.
13319    ///
13320    /// See [`Self::add_scope()`] for details.
13321    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionListCall<'a, C>
13322    where
13323        I: IntoIterator<Item = St>,
13324        St: AsRef<str>,
13325    {
13326        self._scopes
13327            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13328        self
13329    }
13330
13331    /// Removes all scopes, and no default scope will be used either.
13332    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13333    /// for details).
13334    pub fn clear_scopes(mut self) -> AccountContainerVersionListCall<'a, C> {
13335        self._scopes.clear();
13336        self
13337    }
13338}
13339
13340/// Publishes a Container Version.
13341///
13342/// A builder for the *containers.versions.publish* method supported by a *account* resource.
13343/// It is not used directly, but through a [`AccountMethods`] instance.
13344///
13345/// # Example
13346///
13347/// Instantiate a resource method builder
13348///
13349/// ```test_harness,no_run
13350/// # extern crate hyper;
13351/// # extern crate hyper_rustls;
13352/// # extern crate google_tagmanager1 as tagmanager1;
13353/// # async fn dox() {
13354/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13355///
13356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13357/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13358/// #     .with_native_roots()
13359/// #     .unwrap()
13360/// #     .https_only()
13361/// #     .enable_http2()
13362/// #     .build();
13363///
13364/// # let executor = hyper_util::rt::TokioExecutor::new();
13365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13366/// #     secret,
13367/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13368/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13369/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13370/// #     ),
13371/// # ).build().await.unwrap();
13372///
13373/// # let client = hyper_util::client::legacy::Client::builder(
13374/// #     hyper_util::rt::TokioExecutor::new()
13375/// # )
13376/// # .build(
13377/// #     hyper_rustls::HttpsConnectorBuilder::new()
13378/// #         .with_native_roots()
13379/// #         .unwrap()
13380/// #         .https_or_http()
13381/// #         .enable_http2()
13382/// #         .build()
13383/// # );
13384/// # let mut hub = TagManager::new(client, auth);
13385/// // You can configure optional parameters by calling the respective setters at will, and
13386/// // execute the final call using `doit()`.
13387/// // Values shown here are possibly random and not representative !
13388/// let result = hub.accounts().containers_versions_publish("accountId", "containerId", "containerVersionId")
13389///              .fingerprint("et")
13390///              .doit().await;
13391/// # }
13392/// ```
13393pub struct AccountContainerVersionPublishCall<'a, C>
13394where
13395    C: 'a,
13396{
13397    hub: &'a TagManager<C>,
13398    _account_id: String,
13399    _container_id: String,
13400    _container_version_id: String,
13401    _fingerprint: Option<String>,
13402    _delegate: Option<&'a mut dyn common::Delegate>,
13403    _additional_params: HashMap<String, String>,
13404    _scopes: BTreeSet<String>,
13405}
13406
13407impl<'a, C> common::CallBuilder for AccountContainerVersionPublishCall<'a, C> {}
13408
13409impl<'a, C> AccountContainerVersionPublishCall<'a, C>
13410where
13411    C: common::Connector,
13412{
13413    /// Perform the operation you have build so far.
13414    pub async fn doit(
13415        mut self,
13416    ) -> common::Result<(common::Response, PublishContainerVersionResponse)> {
13417        use std::borrow::Cow;
13418        use std::io::{Read, Seek};
13419
13420        use common::{url::Params, ToParts};
13421        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13422
13423        let mut dd = common::DefaultDelegate;
13424        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13425        dlg.begin(common::MethodInfo {
13426            id: "tagmanager.accounts.containers.versions.publish",
13427            http_method: hyper::Method::POST,
13428        });
13429
13430        for &field in [
13431            "alt",
13432            "accountId",
13433            "containerId",
13434            "containerVersionId",
13435            "fingerprint",
13436        ]
13437        .iter()
13438        {
13439            if self._additional_params.contains_key(field) {
13440                dlg.finished(false);
13441                return Err(common::Error::FieldClash(field));
13442            }
13443        }
13444
13445        let mut params = Params::with_capacity(6 + self._additional_params.len());
13446        params.push("accountId", self._account_id);
13447        params.push("containerId", self._container_id);
13448        params.push("containerVersionId", self._container_version_id);
13449        if let Some(value) = self._fingerprint.as_ref() {
13450            params.push("fingerprint", value);
13451        }
13452
13453        params.extend(self._additional_params.iter());
13454
13455        params.push("alt", "json");
13456        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}/publish";
13457        if self._scopes.is_empty() {
13458            self._scopes.insert(Scope::Publish.as_ref().to_string());
13459        }
13460
13461        #[allow(clippy::single_element_loop)]
13462        for &(find_this, param_name) in [
13463            ("{accountId}", "accountId"),
13464            ("{containerId}", "containerId"),
13465            ("{containerVersionId}", "containerVersionId"),
13466        ]
13467        .iter()
13468        {
13469            url = params.uri_replacement(url, param_name, find_this, false);
13470        }
13471        {
13472            let to_remove = ["containerVersionId", "containerId", "accountId"];
13473            params.remove_params(&to_remove);
13474        }
13475
13476        let url = params.parse_with_url(&url);
13477
13478        loop {
13479            let token = match self
13480                .hub
13481                .auth
13482                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13483                .await
13484            {
13485                Ok(token) => token,
13486                Err(e) => match dlg.token(e) {
13487                    Ok(token) => token,
13488                    Err(e) => {
13489                        dlg.finished(false);
13490                        return Err(common::Error::MissingToken(e));
13491                    }
13492                },
13493            };
13494            let mut req_result = {
13495                let client = &self.hub.client;
13496                dlg.pre_request();
13497                let mut req_builder = hyper::Request::builder()
13498                    .method(hyper::Method::POST)
13499                    .uri(url.as_str())
13500                    .header(USER_AGENT, self.hub._user_agent.clone());
13501
13502                if let Some(token) = token.as_ref() {
13503                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13504                }
13505
13506                let request = req_builder
13507                    .header(CONTENT_LENGTH, 0_u64)
13508                    .body(common::to_body::<String>(None));
13509
13510                client.request(request.unwrap()).await
13511            };
13512
13513            match req_result {
13514                Err(err) => {
13515                    if let common::Retry::After(d) = dlg.http_error(&err) {
13516                        sleep(d).await;
13517                        continue;
13518                    }
13519                    dlg.finished(false);
13520                    return Err(common::Error::HttpError(err));
13521                }
13522                Ok(res) => {
13523                    let (mut parts, body) = res.into_parts();
13524                    let mut body = common::Body::new(body);
13525                    if !parts.status.is_success() {
13526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13527                        let error = serde_json::from_str(&common::to_string(&bytes));
13528                        let response = common::to_response(parts, bytes.into());
13529
13530                        if let common::Retry::After(d) =
13531                            dlg.http_failure(&response, error.as_ref().ok())
13532                        {
13533                            sleep(d).await;
13534                            continue;
13535                        }
13536
13537                        dlg.finished(false);
13538
13539                        return Err(match error {
13540                            Ok(value) => common::Error::BadRequest(value),
13541                            _ => common::Error::Failure(response),
13542                        });
13543                    }
13544                    let response = {
13545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13546                        let encoded = common::to_string(&bytes);
13547                        match serde_json::from_str(&encoded) {
13548                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13549                            Err(error) => {
13550                                dlg.response_json_decode_error(&encoded, &error);
13551                                return Err(common::Error::JsonDecodeError(
13552                                    encoded.to_string(),
13553                                    error,
13554                                ));
13555                            }
13556                        }
13557                    };
13558
13559                    dlg.finished(true);
13560                    return Ok(response);
13561                }
13562            }
13563        }
13564    }
13565
13566    /// The GTM Account ID.
13567    ///
13568    /// Sets the *account id* path property to the given value.
13569    ///
13570    /// Even though the property as already been set when instantiating this call,
13571    /// we provide this method for API completeness.
13572    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
13573        self._account_id = new_value.to_string();
13574        self
13575    }
13576    /// The GTM Container ID.
13577    ///
13578    /// Sets the *container id* path property to the given value.
13579    ///
13580    /// Even though the property as already been set when instantiating this call,
13581    /// we provide this method for API completeness.
13582    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
13583        self._container_id = new_value.to_string();
13584        self
13585    }
13586    /// The GTM Container Version ID.
13587    ///
13588    /// Sets the *container version id* path property to the given value.
13589    ///
13590    /// Even though the property as already been set when instantiating this call,
13591    /// we provide this method for API completeness.
13592    pub fn container_version_id(
13593        mut self,
13594        new_value: &str,
13595    ) -> AccountContainerVersionPublishCall<'a, C> {
13596        self._container_version_id = new_value.to_string();
13597        self
13598    }
13599    /// When provided, this fingerprint must match the fingerprint of the container version in storage.
13600    ///
13601    /// Sets the *fingerprint* query property to the given value.
13602    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
13603        self._fingerprint = Some(new_value.to_string());
13604        self
13605    }
13606    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13607    /// while executing the actual API request.
13608    ///
13609    /// ````text
13610    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13611    /// ````
13612    ///
13613    /// Sets the *delegate* property to the given value.
13614    pub fn delegate(
13615        mut self,
13616        new_value: &'a mut dyn common::Delegate,
13617    ) -> AccountContainerVersionPublishCall<'a, C> {
13618        self._delegate = Some(new_value);
13619        self
13620    }
13621
13622    /// Set any additional parameter of the query string used in the request.
13623    /// It should be used to set parameters which are not yet available through their own
13624    /// setters.
13625    ///
13626    /// Please note that this method must not be used to set any of the known parameters
13627    /// which have their own setter method. If done anyway, the request will fail.
13628    ///
13629    /// # Additional Parameters
13630    ///
13631    /// * *$.xgafv* (query-string) - V1 error format.
13632    /// * *access_token* (query-string) - OAuth access token.
13633    /// * *alt* (query-string) - Data format for response.
13634    /// * *callback* (query-string) - JSONP
13635    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13636    /// * *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.
13637    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13638    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13639    /// * *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.
13640    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13641    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13642    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionPublishCall<'a, C>
13643    where
13644        T: AsRef<str>,
13645    {
13646        self._additional_params
13647            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13648        self
13649    }
13650
13651    /// Identifies the authorization scope for the method you are building.
13652    ///
13653    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13654    /// [`Scope::Publish`].
13655    ///
13656    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13657    /// tokens for more than one scope.
13658    ///
13659    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13660    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13661    /// sufficient, a read-write scope will do as well.
13662    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionPublishCall<'a, C>
13663    where
13664        St: AsRef<str>,
13665    {
13666        self._scopes.insert(String::from(scope.as_ref()));
13667        self
13668    }
13669    /// Identifies the authorization scope(s) for the method you are building.
13670    ///
13671    /// See [`Self::add_scope()`] for details.
13672    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionPublishCall<'a, C>
13673    where
13674        I: IntoIterator<Item = St>,
13675        St: AsRef<str>,
13676    {
13677        self._scopes
13678            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13679        self
13680    }
13681
13682    /// Removes all scopes, and no default scope will be used either.
13683    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13684    /// for details).
13685    pub fn clear_scopes(mut self) -> AccountContainerVersionPublishCall<'a, C> {
13686        self._scopes.clear();
13687        self
13688    }
13689}
13690
13691/// Restores a Container Version. This will overwrite the container's current configuration (including its variables, triggers and tags). The operation will not have any effect on the version that is being served (i.e. the published version).
13692///
13693/// A builder for the *containers.versions.restore* method supported by a *account* resource.
13694/// It is not used directly, but through a [`AccountMethods`] instance.
13695///
13696/// # Example
13697///
13698/// Instantiate a resource method builder
13699///
13700/// ```test_harness,no_run
13701/// # extern crate hyper;
13702/// # extern crate hyper_rustls;
13703/// # extern crate google_tagmanager1 as tagmanager1;
13704/// # async fn dox() {
13705/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13706///
13707/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13708/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13709/// #     .with_native_roots()
13710/// #     .unwrap()
13711/// #     .https_only()
13712/// #     .enable_http2()
13713/// #     .build();
13714///
13715/// # let executor = hyper_util::rt::TokioExecutor::new();
13716/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13717/// #     secret,
13718/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13719/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13720/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13721/// #     ),
13722/// # ).build().await.unwrap();
13723///
13724/// # let client = hyper_util::client::legacy::Client::builder(
13725/// #     hyper_util::rt::TokioExecutor::new()
13726/// # )
13727/// # .build(
13728/// #     hyper_rustls::HttpsConnectorBuilder::new()
13729/// #         .with_native_roots()
13730/// #         .unwrap()
13731/// #         .https_or_http()
13732/// #         .enable_http2()
13733/// #         .build()
13734/// # );
13735/// # let mut hub = TagManager::new(client, auth);
13736/// // You can configure optional parameters by calling the respective setters at will, and
13737/// // execute the final call using `doit()`.
13738/// // Values shown here are possibly random and not representative !
13739/// let result = hub.accounts().containers_versions_restore("accountId", "containerId", "containerVersionId")
13740///              .doit().await;
13741/// # }
13742/// ```
13743pub struct AccountContainerVersionRestoreCall<'a, C>
13744where
13745    C: 'a,
13746{
13747    hub: &'a TagManager<C>,
13748    _account_id: String,
13749    _container_id: String,
13750    _container_version_id: String,
13751    _delegate: Option<&'a mut dyn common::Delegate>,
13752    _additional_params: HashMap<String, String>,
13753    _scopes: BTreeSet<String>,
13754}
13755
13756impl<'a, C> common::CallBuilder for AccountContainerVersionRestoreCall<'a, C> {}
13757
13758impl<'a, C> AccountContainerVersionRestoreCall<'a, C>
13759where
13760    C: common::Connector,
13761{
13762    /// Perform the operation you have build so far.
13763    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
13764        use std::borrow::Cow;
13765        use std::io::{Read, Seek};
13766
13767        use common::{url::Params, ToParts};
13768        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13769
13770        let mut dd = common::DefaultDelegate;
13771        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13772        dlg.begin(common::MethodInfo {
13773            id: "tagmanager.accounts.containers.versions.restore",
13774            http_method: hyper::Method::POST,
13775        });
13776
13777        for &field in ["alt", "accountId", "containerId", "containerVersionId"].iter() {
13778            if self._additional_params.contains_key(field) {
13779                dlg.finished(false);
13780                return Err(common::Error::FieldClash(field));
13781            }
13782        }
13783
13784        let mut params = Params::with_capacity(5 + self._additional_params.len());
13785        params.push("accountId", self._account_id);
13786        params.push("containerId", self._container_id);
13787        params.push("containerVersionId", self._container_version_id);
13788
13789        params.extend(self._additional_params.iter());
13790
13791        params.push("alt", "json");
13792        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}/restore";
13793        if self._scopes.is_empty() {
13794            self._scopes
13795                .insert(Scope::EditContainer.as_ref().to_string());
13796        }
13797
13798        #[allow(clippy::single_element_loop)]
13799        for &(find_this, param_name) in [
13800            ("{accountId}", "accountId"),
13801            ("{containerId}", "containerId"),
13802            ("{containerVersionId}", "containerVersionId"),
13803        ]
13804        .iter()
13805        {
13806            url = params.uri_replacement(url, param_name, find_this, false);
13807        }
13808        {
13809            let to_remove = ["containerVersionId", "containerId", "accountId"];
13810            params.remove_params(&to_remove);
13811        }
13812
13813        let url = params.parse_with_url(&url);
13814
13815        loop {
13816            let token = match self
13817                .hub
13818                .auth
13819                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13820                .await
13821            {
13822                Ok(token) => token,
13823                Err(e) => match dlg.token(e) {
13824                    Ok(token) => token,
13825                    Err(e) => {
13826                        dlg.finished(false);
13827                        return Err(common::Error::MissingToken(e));
13828                    }
13829                },
13830            };
13831            let mut req_result = {
13832                let client = &self.hub.client;
13833                dlg.pre_request();
13834                let mut req_builder = hyper::Request::builder()
13835                    .method(hyper::Method::POST)
13836                    .uri(url.as_str())
13837                    .header(USER_AGENT, self.hub._user_agent.clone());
13838
13839                if let Some(token) = token.as_ref() {
13840                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13841                }
13842
13843                let request = req_builder
13844                    .header(CONTENT_LENGTH, 0_u64)
13845                    .body(common::to_body::<String>(None));
13846
13847                client.request(request.unwrap()).await
13848            };
13849
13850            match req_result {
13851                Err(err) => {
13852                    if let common::Retry::After(d) = dlg.http_error(&err) {
13853                        sleep(d).await;
13854                        continue;
13855                    }
13856                    dlg.finished(false);
13857                    return Err(common::Error::HttpError(err));
13858                }
13859                Ok(res) => {
13860                    let (mut parts, body) = res.into_parts();
13861                    let mut body = common::Body::new(body);
13862                    if !parts.status.is_success() {
13863                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13864                        let error = serde_json::from_str(&common::to_string(&bytes));
13865                        let response = common::to_response(parts, bytes.into());
13866
13867                        if let common::Retry::After(d) =
13868                            dlg.http_failure(&response, error.as_ref().ok())
13869                        {
13870                            sleep(d).await;
13871                            continue;
13872                        }
13873
13874                        dlg.finished(false);
13875
13876                        return Err(match error {
13877                            Ok(value) => common::Error::BadRequest(value),
13878                            _ => common::Error::Failure(response),
13879                        });
13880                    }
13881                    let response = {
13882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13883                        let encoded = common::to_string(&bytes);
13884                        match serde_json::from_str(&encoded) {
13885                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13886                            Err(error) => {
13887                                dlg.response_json_decode_error(&encoded, &error);
13888                                return Err(common::Error::JsonDecodeError(
13889                                    encoded.to_string(),
13890                                    error,
13891                                ));
13892                            }
13893                        }
13894                    };
13895
13896                    dlg.finished(true);
13897                    return Ok(response);
13898                }
13899            }
13900        }
13901    }
13902
13903    /// The GTM Account ID.
13904    ///
13905    /// Sets the *account id* path property to the given value.
13906    ///
13907    /// Even though the property as already been set when instantiating this call,
13908    /// we provide this method for API completeness.
13909    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionRestoreCall<'a, C> {
13910        self._account_id = new_value.to_string();
13911        self
13912    }
13913    /// The GTM Container ID.
13914    ///
13915    /// Sets the *container id* path property to the given value.
13916    ///
13917    /// Even though the property as already been set when instantiating this call,
13918    /// we provide this method for API completeness.
13919    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionRestoreCall<'a, C> {
13920        self._container_id = new_value.to_string();
13921        self
13922    }
13923    /// The GTM Container Version ID.
13924    ///
13925    /// Sets the *container version id* path property to the given value.
13926    ///
13927    /// Even though the property as already been set when instantiating this call,
13928    /// we provide this method for API completeness.
13929    pub fn container_version_id(
13930        mut self,
13931        new_value: &str,
13932    ) -> AccountContainerVersionRestoreCall<'a, C> {
13933        self._container_version_id = new_value.to_string();
13934        self
13935    }
13936    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13937    /// while executing the actual API request.
13938    ///
13939    /// ````text
13940    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13941    /// ````
13942    ///
13943    /// Sets the *delegate* property to the given value.
13944    pub fn delegate(
13945        mut self,
13946        new_value: &'a mut dyn common::Delegate,
13947    ) -> AccountContainerVersionRestoreCall<'a, C> {
13948        self._delegate = Some(new_value);
13949        self
13950    }
13951
13952    /// Set any additional parameter of the query string used in the request.
13953    /// It should be used to set parameters which are not yet available through their own
13954    /// setters.
13955    ///
13956    /// Please note that this method must not be used to set any of the known parameters
13957    /// which have their own setter method. If done anyway, the request will fail.
13958    ///
13959    /// # Additional Parameters
13960    ///
13961    /// * *$.xgafv* (query-string) - V1 error format.
13962    /// * *access_token* (query-string) - OAuth access token.
13963    /// * *alt* (query-string) - Data format for response.
13964    /// * *callback* (query-string) - JSONP
13965    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13966    /// * *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.
13967    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13968    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13969    /// * *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.
13970    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13971    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13972    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionRestoreCall<'a, C>
13973    where
13974        T: AsRef<str>,
13975    {
13976        self._additional_params
13977            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13978        self
13979    }
13980
13981    /// Identifies the authorization scope for the method you are building.
13982    ///
13983    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13984    /// [`Scope::EditContainer`].
13985    ///
13986    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13987    /// tokens for more than one scope.
13988    ///
13989    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13990    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13991    /// sufficient, a read-write scope will do as well.
13992    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionRestoreCall<'a, C>
13993    where
13994        St: AsRef<str>,
13995    {
13996        self._scopes.insert(String::from(scope.as_ref()));
13997        self
13998    }
13999    /// Identifies the authorization scope(s) for the method you are building.
14000    ///
14001    /// See [`Self::add_scope()`] for details.
14002    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionRestoreCall<'a, C>
14003    where
14004        I: IntoIterator<Item = St>,
14005        St: AsRef<str>,
14006    {
14007        self._scopes
14008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14009        self
14010    }
14011
14012    /// Removes all scopes, and no default scope will be used either.
14013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14014    /// for details).
14015    pub fn clear_scopes(mut self) -> AccountContainerVersionRestoreCall<'a, C> {
14016        self._scopes.clear();
14017        self
14018    }
14019}
14020
14021/// Undeletes a Container Version.
14022///
14023/// A builder for the *containers.versions.undelete* method supported by a *account* resource.
14024/// It is not used directly, but through a [`AccountMethods`] instance.
14025///
14026/// # Example
14027///
14028/// Instantiate a resource method builder
14029///
14030/// ```test_harness,no_run
14031/// # extern crate hyper;
14032/// # extern crate hyper_rustls;
14033/// # extern crate google_tagmanager1 as tagmanager1;
14034/// # async fn dox() {
14035/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14036///
14037/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14038/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14039/// #     .with_native_roots()
14040/// #     .unwrap()
14041/// #     .https_only()
14042/// #     .enable_http2()
14043/// #     .build();
14044///
14045/// # let executor = hyper_util::rt::TokioExecutor::new();
14046/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14047/// #     secret,
14048/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14049/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14050/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14051/// #     ),
14052/// # ).build().await.unwrap();
14053///
14054/// # let client = hyper_util::client::legacy::Client::builder(
14055/// #     hyper_util::rt::TokioExecutor::new()
14056/// # )
14057/// # .build(
14058/// #     hyper_rustls::HttpsConnectorBuilder::new()
14059/// #         .with_native_roots()
14060/// #         .unwrap()
14061/// #         .https_or_http()
14062/// #         .enable_http2()
14063/// #         .build()
14064/// # );
14065/// # let mut hub = TagManager::new(client, auth);
14066/// // You can configure optional parameters by calling the respective setters at will, and
14067/// // execute the final call using `doit()`.
14068/// // Values shown here are possibly random and not representative !
14069/// let result = hub.accounts().containers_versions_undelete("accountId", "containerId", "containerVersionId")
14070///              .doit().await;
14071/// # }
14072/// ```
14073pub struct AccountContainerVersionUndeleteCall<'a, C>
14074where
14075    C: 'a,
14076{
14077    hub: &'a TagManager<C>,
14078    _account_id: String,
14079    _container_id: String,
14080    _container_version_id: String,
14081    _delegate: Option<&'a mut dyn common::Delegate>,
14082    _additional_params: HashMap<String, String>,
14083    _scopes: BTreeSet<String>,
14084}
14085
14086impl<'a, C> common::CallBuilder for AccountContainerVersionUndeleteCall<'a, C> {}
14087
14088impl<'a, C> AccountContainerVersionUndeleteCall<'a, C>
14089where
14090    C: common::Connector,
14091{
14092    /// Perform the operation you have build so far.
14093    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
14094        use std::borrow::Cow;
14095        use std::io::{Read, Seek};
14096
14097        use common::{url::Params, ToParts};
14098        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14099
14100        let mut dd = common::DefaultDelegate;
14101        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14102        dlg.begin(common::MethodInfo {
14103            id: "tagmanager.accounts.containers.versions.undelete",
14104            http_method: hyper::Method::POST,
14105        });
14106
14107        for &field in ["alt", "accountId", "containerId", "containerVersionId"].iter() {
14108            if self._additional_params.contains_key(field) {
14109                dlg.finished(false);
14110                return Err(common::Error::FieldClash(field));
14111            }
14112        }
14113
14114        let mut params = Params::with_capacity(5 + self._additional_params.len());
14115        params.push("accountId", self._account_id);
14116        params.push("containerId", self._container_id);
14117        params.push("containerVersionId", self._container_version_id);
14118
14119        params.extend(self._additional_params.iter());
14120
14121        params.push("alt", "json");
14122        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}/undelete";
14123        if self._scopes.is_empty() {
14124            self._scopes
14125                .insert(Scope::EditContainerversion.as_ref().to_string());
14126        }
14127
14128        #[allow(clippy::single_element_loop)]
14129        for &(find_this, param_name) in [
14130            ("{accountId}", "accountId"),
14131            ("{containerId}", "containerId"),
14132            ("{containerVersionId}", "containerVersionId"),
14133        ]
14134        .iter()
14135        {
14136            url = params.uri_replacement(url, param_name, find_this, false);
14137        }
14138        {
14139            let to_remove = ["containerVersionId", "containerId", "accountId"];
14140            params.remove_params(&to_remove);
14141        }
14142
14143        let url = params.parse_with_url(&url);
14144
14145        loop {
14146            let token = match self
14147                .hub
14148                .auth
14149                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14150                .await
14151            {
14152                Ok(token) => token,
14153                Err(e) => match dlg.token(e) {
14154                    Ok(token) => token,
14155                    Err(e) => {
14156                        dlg.finished(false);
14157                        return Err(common::Error::MissingToken(e));
14158                    }
14159                },
14160            };
14161            let mut req_result = {
14162                let client = &self.hub.client;
14163                dlg.pre_request();
14164                let mut req_builder = hyper::Request::builder()
14165                    .method(hyper::Method::POST)
14166                    .uri(url.as_str())
14167                    .header(USER_AGENT, self.hub._user_agent.clone());
14168
14169                if let Some(token) = token.as_ref() {
14170                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14171                }
14172
14173                let request = req_builder
14174                    .header(CONTENT_LENGTH, 0_u64)
14175                    .body(common::to_body::<String>(None));
14176
14177                client.request(request.unwrap()).await
14178            };
14179
14180            match req_result {
14181                Err(err) => {
14182                    if let common::Retry::After(d) = dlg.http_error(&err) {
14183                        sleep(d).await;
14184                        continue;
14185                    }
14186                    dlg.finished(false);
14187                    return Err(common::Error::HttpError(err));
14188                }
14189                Ok(res) => {
14190                    let (mut parts, body) = res.into_parts();
14191                    let mut body = common::Body::new(body);
14192                    if !parts.status.is_success() {
14193                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14194                        let error = serde_json::from_str(&common::to_string(&bytes));
14195                        let response = common::to_response(parts, bytes.into());
14196
14197                        if let common::Retry::After(d) =
14198                            dlg.http_failure(&response, error.as_ref().ok())
14199                        {
14200                            sleep(d).await;
14201                            continue;
14202                        }
14203
14204                        dlg.finished(false);
14205
14206                        return Err(match error {
14207                            Ok(value) => common::Error::BadRequest(value),
14208                            _ => common::Error::Failure(response),
14209                        });
14210                    }
14211                    let response = {
14212                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14213                        let encoded = common::to_string(&bytes);
14214                        match serde_json::from_str(&encoded) {
14215                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14216                            Err(error) => {
14217                                dlg.response_json_decode_error(&encoded, &error);
14218                                return Err(common::Error::JsonDecodeError(
14219                                    encoded.to_string(),
14220                                    error,
14221                                ));
14222                            }
14223                        }
14224                    };
14225
14226                    dlg.finished(true);
14227                    return Ok(response);
14228                }
14229            }
14230        }
14231    }
14232
14233    /// The GTM Account ID.
14234    ///
14235    /// Sets the *account id* path property to the given value.
14236    ///
14237    /// Even though the property as already been set when instantiating this call,
14238    /// we provide this method for API completeness.
14239    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C> {
14240        self._account_id = new_value.to_string();
14241        self
14242    }
14243    /// The GTM Container ID.
14244    ///
14245    /// Sets the *container id* path property to the given value.
14246    ///
14247    /// Even though the property as already been set when instantiating this call,
14248    /// we provide this method for API completeness.
14249    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C> {
14250        self._container_id = new_value.to_string();
14251        self
14252    }
14253    /// The GTM Container Version ID.
14254    ///
14255    /// Sets the *container version id* path property to the given value.
14256    ///
14257    /// Even though the property as already been set when instantiating this call,
14258    /// we provide this method for API completeness.
14259    pub fn container_version_id(
14260        mut self,
14261        new_value: &str,
14262    ) -> AccountContainerVersionUndeleteCall<'a, C> {
14263        self._container_version_id = new_value.to_string();
14264        self
14265    }
14266    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14267    /// while executing the actual API request.
14268    ///
14269    /// ````text
14270    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14271    /// ````
14272    ///
14273    /// Sets the *delegate* property to the given value.
14274    pub fn delegate(
14275        mut self,
14276        new_value: &'a mut dyn common::Delegate,
14277    ) -> AccountContainerVersionUndeleteCall<'a, C> {
14278        self._delegate = Some(new_value);
14279        self
14280    }
14281
14282    /// Set any additional parameter of the query string used in the request.
14283    /// It should be used to set parameters which are not yet available through their own
14284    /// setters.
14285    ///
14286    /// Please note that this method must not be used to set any of the known parameters
14287    /// which have their own setter method. If done anyway, the request will fail.
14288    ///
14289    /// # Additional Parameters
14290    ///
14291    /// * *$.xgafv* (query-string) - V1 error format.
14292    /// * *access_token* (query-string) - OAuth access token.
14293    /// * *alt* (query-string) - Data format for response.
14294    /// * *callback* (query-string) - JSONP
14295    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14296    /// * *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.
14297    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14298    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14299    /// * *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.
14300    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14301    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14302    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUndeleteCall<'a, C>
14303    where
14304        T: AsRef<str>,
14305    {
14306        self._additional_params
14307            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14308        self
14309    }
14310
14311    /// Identifies the authorization scope for the method you are building.
14312    ///
14313    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14314    /// [`Scope::EditContainerversion`].
14315    ///
14316    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14317    /// tokens for more than one scope.
14318    ///
14319    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14320    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14321    /// sufficient, a read-write scope will do as well.
14322    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUndeleteCall<'a, C>
14323    where
14324        St: AsRef<str>,
14325    {
14326        self._scopes.insert(String::from(scope.as_ref()));
14327        self
14328    }
14329    /// Identifies the authorization scope(s) for the method you are building.
14330    ///
14331    /// See [`Self::add_scope()`] for details.
14332    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUndeleteCall<'a, C>
14333    where
14334        I: IntoIterator<Item = St>,
14335        St: AsRef<str>,
14336    {
14337        self._scopes
14338            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14339        self
14340    }
14341
14342    /// Removes all scopes, and no default scope will be used either.
14343    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14344    /// for details).
14345    pub fn clear_scopes(mut self) -> AccountContainerVersionUndeleteCall<'a, C> {
14346        self._scopes.clear();
14347        self
14348    }
14349}
14350
14351/// Updates a Container Version.
14352///
14353/// A builder for the *containers.versions.update* method supported by a *account* resource.
14354/// It is not used directly, but through a [`AccountMethods`] instance.
14355///
14356/// # Example
14357///
14358/// Instantiate a resource method builder
14359///
14360/// ```test_harness,no_run
14361/// # extern crate hyper;
14362/// # extern crate hyper_rustls;
14363/// # extern crate google_tagmanager1 as tagmanager1;
14364/// use tagmanager1::api::ContainerVersion;
14365/// # async fn dox() {
14366/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14367///
14368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14370/// #     .with_native_roots()
14371/// #     .unwrap()
14372/// #     .https_only()
14373/// #     .enable_http2()
14374/// #     .build();
14375///
14376/// # let executor = hyper_util::rt::TokioExecutor::new();
14377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14378/// #     secret,
14379/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14380/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14381/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14382/// #     ),
14383/// # ).build().await.unwrap();
14384///
14385/// # let client = hyper_util::client::legacy::Client::builder(
14386/// #     hyper_util::rt::TokioExecutor::new()
14387/// # )
14388/// # .build(
14389/// #     hyper_rustls::HttpsConnectorBuilder::new()
14390/// #         .with_native_roots()
14391/// #         .unwrap()
14392/// #         .https_or_http()
14393/// #         .enable_http2()
14394/// #         .build()
14395/// # );
14396/// # let mut hub = TagManager::new(client, auth);
14397/// // As the method needs a request, you would usually fill it with the desired information
14398/// // into the respective structure. Some of the parts shown here might not be applicable !
14399/// // Values shown here are possibly random and not representative !
14400/// let mut req = ContainerVersion::default();
14401///
14402/// // You can configure optional parameters by calling the respective setters at will, and
14403/// // execute the final call using `doit()`.
14404/// // Values shown here are possibly random and not representative !
14405/// let result = hub.accounts().containers_versions_update(req, "accountId", "containerId", "containerVersionId")
14406///              .fingerprint("erat")
14407///              .doit().await;
14408/// # }
14409/// ```
14410pub struct AccountContainerVersionUpdateCall<'a, C>
14411where
14412    C: 'a,
14413{
14414    hub: &'a TagManager<C>,
14415    _request: ContainerVersion,
14416    _account_id: String,
14417    _container_id: String,
14418    _container_version_id: String,
14419    _fingerprint: Option<String>,
14420    _delegate: Option<&'a mut dyn common::Delegate>,
14421    _additional_params: HashMap<String, String>,
14422    _scopes: BTreeSet<String>,
14423}
14424
14425impl<'a, C> common::CallBuilder for AccountContainerVersionUpdateCall<'a, C> {}
14426
14427impl<'a, C> AccountContainerVersionUpdateCall<'a, C>
14428where
14429    C: common::Connector,
14430{
14431    /// Perform the operation you have build so far.
14432    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
14433        use std::borrow::Cow;
14434        use std::io::{Read, Seek};
14435
14436        use common::{url::Params, ToParts};
14437        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14438
14439        let mut dd = common::DefaultDelegate;
14440        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14441        dlg.begin(common::MethodInfo {
14442            id: "tagmanager.accounts.containers.versions.update",
14443            http_method: hyper::Method::PUT,
14444        });
14445
14446        for &field in [
14447            "alt",
14448            "accountId",
14449            "containerId",
14450            "containerVersionId",
14451            "fingerprint",
14452        ]
14453        .iter()
14454        {
14455            if self._additional_params.contains_key(field) {
14456                dlg.finished(false);
14457                return Err(common::Error::FieldClash(field));
14458            }
14459        }
14460
14461        let mut params = Params::with_capacity(7 + self._additional_params.len());
14462        params.push("accountId", self._account_id);
14463        params.push("containerId", self._container_id);
14464        params.push("containerVersionId", self._container_version_id);
14465        if let Some(value) = self._fingerprint.as_ref() {
14466            params.push("fingerprint", value);
14467        }
14468
14469        params.extend(self._additional_params.iter());
14470
14471        params.push("alt", "json");
14472        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers/{containerId}/versions/{containerVersionId}";
14473        if self._scopes.is_empty() {
14474            self._scopes
14475                .insert(Scope::EditContainerversion.as_ref().to_string());
14476        }
14477
14478        #[allow(clippy::single_element_loop)]
14479        for &(find_this, param_name) in [
14480            ("{accountId}", "accountId"),
14481            ("{containerId}", "containerId"),
14482            ("{containerVersionId}", "containerVersionId"),
14483        ]
14484        .iter()
14485        {
14486            url = params.uri_replacement(url, param_name, find_this, false);
14487        }
14488        {
14489            let to_remove = ["containerVersionId", "containerId", "accountId"];
14490            params.remove_params(&to_remove);
14491        }
14492
14493        let url = params.parse_with_url(&url);
14494
14495        let mut json_mime_type = mime::APPLICATION_JSON;
14496        let mut request_value_reader = {
14497            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14498            common::remove_json_null_values(&mut value);
14499            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14500            serde_json::to_writer(&mut dst, &value).unwrap();
14501            dst
14502        };
14503        let request_size = request_value_reader
14504            .seek(std::io::SeekFrom::End(0))
14505            .unwrap();
14506        request_value_reader
14507            .seek(std::io::SeekFrom::Start(0))
14508            .unwrap();
14509
14510        loop {
14511            let token = match self
14512                .hub
14513                .auth
14514                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14515                .await
14516            {
14517                Ok(token) => token,
14518                Err(e) => match dlg.token(e) {
14519                    Ok(token) => token,
14520                    Err(e) => {
14521                        dlg.finished(false);
14522                        return Err(common::Error::MissingToken(e));
14523                    }
14524                },
14525            };
14526            request_value_reader
14527                .seek(std::io::SeekFrom::Start(0))
14528                .unwrap();
14529            let mut req_result = {
14530                let client = &self.hub.client;
14531                dlg.pre_request();
14532                let mut req_builder = hyper::Request::builder()
14533                    .method(hyper::Method::PUT)
14534                    .uri(url.as_str())
14535                    .header(USER_AGENT, self.hub._user_agent.clone());
14536
14537                if let Some(token) = token.as_ref() {
14538                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14539                }
14540
14541                let request = req_builder
14542                    .header(CONTENT_TYPE, json_mime_type.to_string())
14543                    .header(CONTENT_LENGTH, request_size as u64)
14544                    .body(common::to_body(
14545                        request_value_reader.get_ref().clone().into(),
14546                    ));
14547
14548                client.request(request.unwrap()).await
14549            };
14550
14551            match req_result {
14552                Err(err) => {
14553                    if let common::Retry::After(d) = dlg.http_error(&err) {
14554                        sleep(d).await;
14555                        continue;
14556                    }
14557                    dlg.finished(false);
14558                    return Err(common::Error::HttpError(err));
14559                }
14560                Ok(res) => {
14561                    let (mut parts, body) = res.into_parts();
14562                    let mut body = common::Body::new(body);
14563                    if !parts.status.is_success() {
14564                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14565                        let error = serde_json::from_str(&common::to_string(&bytes));
14566                        let response = common::to_response(parts, bytes.into());
14567
14568                        if let common::Retry::After(d) =
14569                            dlg.http_failure(&response, error.as_ref().ok())
14570                        {
14571                            sleep(d).await;
14572                            continue;
14573                        }
14574
14575                        dlg.finished(false);
14576
14577                        return Err(match error {
14578                            Ok(value) => common::Error::BadRequest(value),
14579                            _ => common::Error::Failure(response),
14580                        });
14581                    }
14582                    let response = {
14583                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14584                        let encoded = common::to_string(&bytes);
14585                        match serde_json::from_str(&encoded) {
14586                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14587                            Err(error) => {
14588                                dlg.response_json_decode_error(&encoded, &error);
14589                                return Err(common::Error::JsonDecodeError(
14590                                    encoded.to_string(),
14591                                    error,
14592                                ));
14593                            }
14594                        }
14595                    };
14596
14597                    dlg.finished(true);
14598                    return Ok(response);
14599                }
14600            }
14601        }
14602    }
14603
14604    ///
14605    /// Sets the *request* property to the given value.
14606    ///
14607    /// Even though the property as already been set when instantiating this call,
14608    /// we provide this method for API completeness.
14609    pub fn request(
14610        mut self,
14611        new_value: ContainerVersion,
14612    ) -> AccountContainerVersionUpdateCall<'a, C> {
14613        self._request = new_value;
14614        self
14615    }
14616    /// The GTM Account ID.
14617    ///
14618    /// Sets the *account id* path property to the given value.
14619    ///
14620    /// Even though the property as already been set when instantiating this call,
14621    /// we provide this method for API completeness.
14622    pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
14623        self._account_id = new_value.to_string();
14624        self
14625    }
14626    /// The GTM Container ID.
14627    ///
14628    /// Sets the *container id* path property to the given value.
14629    ///
14630    /// Even though the property as already been set when instantiating this call,
14631    /// we provide this method for API completeness.
14632    pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
14633        self._container_id = new_value.to_string();
14634        self
14635    }
14636    /// The GTM Container Version ID.
14637    ///
14638    /// Sets the *container version id* path property to the given value.
14639    ///
14640    /// Even though the property as already been set when instantiating this call,
14641    /// we provide this method for API completeness.
14642    pub fn container_version_id(
14643        mut self,
14644        new_value: &str,
14645    ) -> AccountContainerVersionUpdateCall<'a, C> {
14646        self._container_version_id = new_value.to_string();
14647        self
14648    }
14649    /// When provided, this fingerprint must match the fingerprint of the container version in storage.
14650    ///
14651    /// Sets the *fingerprint* query property to the given value.
14652    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
14653        self._fingerprint = Some(new_value.to_string());
14654        self
14655    }
14656    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14657    /// while executing the actual API request.
14658    ///
14659    /// ````text
14660    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14661    /// ````
14662    ///
14663    /// Sets the *delegate* property to the given value.
14664    pub fn delegate(
14665        mut self,
14666        new_value: &'a mut dyn common::Delegate,
14667    ) -> AccountContainerVersionUpdateCall<'a, C> {
14668        self._delegate = Some(new_value);
14669        self
14670    }
14671
14672    /// Set any additional parameter of the query string used in the request.
14673    /// It should be used to set parameters which are not yet available through their own
14674    /// setters.
14675    ///
14676    /// Please note that this method must not be used to set any of the known parameters
14677    /// which have their own setter method. If done anyway, the request will fail.
14678    ///
14679    /// # Additional Parameters
14680    ///
14681    /// * *$.xgafv* (query-string) - V1 error format.
14682    /// * *access_token* (query-string) - OAuth access token.
14683    /// * *alt* (query-string) - Data format for response.
14684    /// * *callback* (query-string) - JSONP
14685    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14686    /// * *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.
14687    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14688    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14689    /// * *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.
14690    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14691    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14692    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUpdateCall<'a, C>
14693    where
14694        T: AsRef<str>,
14695    {
14696        self._additional_params
14697            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14698        self
14699    }
14700
14701    /// Identifies the authorization scope for the method you are building.
14702    ///
14703    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14704    /// [`Scope::EditContainerversion`].
14705    ///
14706    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14707    /// tokens for more than one scope.
14708    ///
14709    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14710    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14711    /// sufficient, a read-write scope will do as well.
14712    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUpdateCall<'a, C>
14713    where
14714        St: AsRef<str>,
14715    {
14716        self._scopes.insert(String::from(scope.as_ref()));
14717        self
14718    }
14719    /// Identifies the authorization scope(s) for the method you are building.
14720    ///
14721    /// See [`Self::add_scope()`] for details.
14722    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUpdateCall<'a, C>
14723    where
14724        I: IntoIterator<Item = St>,
14725        St: AsRef<str>,
14726    {
14727        self._scopes
14728            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14729        self
14730    }
14731
14732    /// Removes all scopes, and no default scope will be used either.
14733    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14734    /// for details).
14735    pub fn clear_scopes(mut self) -> AccountContainerVersionUpdateCall<'a, C> {
14736        self._scopes.clear();
14737        self
14738    }
14739}
14740
14741/// Creates a Container.
14742///
14743/// A builder for the *containers.create* method supported by a *account* resource.
14744/// It is not used directly, but through a [`AccountMethods`] instance.
14745///
14746/// # Example
14747///
14748/// Instantiate a resource method builder
14749///
14750/// ```test_harness,no_run
14751/// # extern crate hyper;
14752/// # extern crate hyper_rustls;
14753/// # extern crate google_tagmanager1 as tagmanager1;
14754/// use tagmanager1::api::Container;
14755/// # async fn dox() {
14756/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14757///
14758/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14759/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14760/// #     .with_native_roots()
14761/// #     .unwrap()
14762/// #     .https_only()
14763/// #     .enable_http2()
14764/// #     .build();
14765///
14766/// # let executor = hyper_util::rt::TokioExecutor::new();
14767/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14768/// #     secret,
14769/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14770/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14771/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14772/// #     ),
14773/// # ).build().await.unwrap();
14774///
14775/// # let client = hyper_util::client::legacy::Client::builder(
14776/// #     hyper_util::rt::TokioExecutor::new()
14777/// # )
14778/// # .build(
14779/// #     hyper_rustls::HttpsConnectorBuilder::new()
14780/// #         .with_native_roots()
14781/// #         .unwrap()
14782/// #         .https_or_http()
14783/// #         .enable_http2()
14784/// #         .build()
14785/// # );
14786/// # let mut hub = TagManager::new(client, auth);
14787/// // As the method needs a request, you would usually fill it with the desired information
14788/// // into the respective structure. Some of the parts shown here might not be applicable !
14789/// // Values shown here are possibly random and not representative !
14790/// let mut req = Container::default();
14791///
14792/// // You can configure optional parameters by calling the respective setters at will, and
14793/// // execute the final call using `doit()`.
14794/// // Values shown here are possibly random and not representative !
14795/// let result = hub.accounts().containers_create(req, "accountId")
14796///              .doit().await;
14797/// # }
14798/// ```
14799pub struct AccountContainerCreateCall<'a, C>
14800where
14801    C: 'a,
14802{
14803    hub: &'a TagManager<C>,
14804    _request: Container,
14805    _account_id: String,
14806    _delegate: Option<&'a mut dyn common::Delegate>,
14807    _additional_params: HashMap<String, String>,
14808    _scopes: BTreeSet<String>,
14809}
14810
14811impl<'a, C> common::CallBuilder for AccountContainerCreateCall<'a, C> {}
14812
14813impl<'a, C> AccountContainerCreateCall<'a, C>
14814where
14815    C: common::Connector,
14816{
14817    /// Perform the operation you have build so far.
14818    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
14819        use std::borrow::Cow;
14820        use std::io::{Read, Seek};
14821
14822        use common::{url::Params, ToParts};
14823        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14824
14825        let mut dd = common::DefaultDelegate;
14826        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14827        dlg.begin(common::MethodInfo {
14828            id: "tagmanager.accounts.containers.create",
14829            http_method: hyper::Method::POST,
14830        });
14831
14832        for &field in ["alt", "accountId"].iter() {
14833            if self._additional_params.contains_key(field) {
14834                dlg.finished(false);
14835                return Err(common::Error::FieldClash(field));
14836            }
14837        }
14838
14839        let mut params = Params::with_capacity(4 + self._additional_params.len());
14840        params.push("accountId", self._account_id);
14841
14842        params.extend(self._additional_params.iter());
14843
14844        params.push("alt", "json");
14845        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers";
14846        if self._scopes.is_empty() {
14847            self._scopes
14848                .insert(Scope::EditContainer.as_ref().to_string());
14849        }
14850
14851        #[allow(clippy::single_element_loop)]
14852        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
14853            url = params.uri_replacement(url, param_name, find_this, false);
14854        }
14855        {
14856            let to_remove = ["accountId"];
14857            params.remove_params(&to_remove);
14858        }
14859
14860        let url = params.parse_with_url(&url);
14861
14862        let mut json_mime_type = mime::APPLICATION_JSON;
14863        let mut request_value_reader = {
14864            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14865            common::remove_json_null_values(&mut value);
14866            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14867            serde_json::to_writer(&mut dst, &value).unwrap();
14868            dst
14869        };
14870        let request_size = request_value_reader
14871            .seek(std::io::SeekFrom::End(0))
14872            .unwrap();
14873        request_value_reader
14874            .seek(std::io::SeekFrom::Start(0))
14875            .unwrap();
14876
14877        loop {
14878            let token = match self
14879                .hub
14880                .auth
14881                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14882                .await
14883            {
14884                Ok(token) => token,
14885                Err(e) => match dlg.token(e) {
14886                    Ok(token) => token,
14887                    Err(e) => {
14888                        dlg.finished(false);
14889                        return Err(common::Error::MissingToken(e));
14890                    }
14891                },
14892            };
14893            request_value_reader
14894                .seek(std::io::SeekFrom::Start(0))
14895                .unwrap();
14896            let mut req_result = {
14897                let client = &self.hub.client;
14898                dlg.pre_request();
14899                let mut req_builder = hyper::Request::builder()
14900                    .method(hyper::Method::POST)
14901                    .uri(url.as_str())
14902                    .header(USER_AGENT, self.hub._user_agent.clone());
14903
14904                if let Some(token) = token.as_ref() {
14905                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14906                }
14907
14908                let request = req_builder
14909                    .header(CONTENT_TYPE, json_mime_type.to_string())
14910                    .header(CONTENT_LENGTH, request_size as u64)
14911                    .body(common::to_body(
14912                        request_value_reader.get_ref().clone().into(),
14913                    ));
14914
14915                client.request(request.unwrap()).await
14916            };
14917
14918            match req_result {
14919                Err(err) => {
14920                    if let common::Retry::After(d) = dlg.http_error(&err) {
14921                        sleep(d).await;
14922                        continue;
14923                    }
14924                    dlg.finished(false);
14925                    return Err(common::Error::HttpError(err));
14926                }
14927                Ok(res) => {
14928                    let (mut parts, body) = res.into_parts();
14929                    let mut body = common::Body::new(body);
14930                    if !parts.status.is_success() {
14931                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14932                        let error = serde_json::from_str(&common::to_string(&bytes));
14933                        let response = common::to_response(parts, bytes.into());
14934
14935                        if let common::Retry::After(d) =
14936                            dlg.http_failure(&response, error.as_ref().ok())
14937                        {
14938                            sleep(d).await;
14939                            continue;
14940                        }
14941
14942                        dlg.finished(false);
14943
14944                        return Err(match error {
14945                            Ok(value) => common::Error::BadRequest(value),
14946                            _ => common::Error::Failure(response),
14947                        });
14948                    }
14949                    let response = {
14950                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14951                        let encoded = common::to_string(&bytes);
14952                        match serde_json::from_str(&encoded) {
14953                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14954                            Err(error) => {
14955                                dlg.response_json_decode_error(&encoded, &error);
14956                                return Err(common::Error::JsonDecodeError(
14957                                    encoded.to_string(),
14958                                    error,
14959                                ));
14960                            }
14961                        }
14962                    };
14963
14964                    dlg.finished(true);
14965                    return Ok(response);
14966                }
14967            }
14968        }
14969    }
14970
14971    ///
14972    /// Sets the *request* property to the given value.
14973    ///
14974    /// Even though the property as already been set when instantiating this call,
14975    /// we provide this method for API completeness.
14976    pub fn request(mut self, new_value: Container) -> AccountContainerCreateCall<'a, C> {
14977        self._request = new_value;
14978        self
14979    }
14980    /// The GTM Account ID.
14981    ///
14982    /// Sets the *account id* path property to the given value.
14983    ///
14984    /// Even though the property as already been set when instantiating this call,
14985    /// we provide this method for API completeness.
14986    pub fn account_id(mut self, new_value: &str) -> AccountContainerCreateCall<'a, C> {
14987        self._account_id = new_value.to_string();
14988        self
14989    }
14990    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14991    /// while executing the actual API request.
14992    ///
14993    /// ````text
14994    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14995    /// ````
14996    ///
14997    /// Sets the *delegate* property to the given value.
14998    pub fn delegate(
14999        mut self,
15000        new_value: &'a mut dyn common::Delegate,
15001    ) -> AccountContainerCreateCall<'a, C> {
15002        self._delegate = Some(new_value);
15003        self
15004    }
15005
15006    /// Set any additional parameter of the query string used in the request.
15007    /// It should be used to set parameters which are not yet available through their own
15008    /// setters.
15009    ///
15010    /// Please note that this method must not be used to set any of the known parameters
15011    /// which have their own setter method. If done anyway, the request will fail.
15012    ///
15013    /// # Additional Parameters
15014    ///
15015    /// * *$.xgafv* (query-string) - V1 error format.
15016    /// * *access_token* (query-string) - OAuth access token.
15017    /// * *alt* (query-string) - Data format for response.
15018    /// * *callback* (query-string) - JSONP
15019    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15020    /// * *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.
15021    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15022    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15023    /// * *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.
15024    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15025    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15026    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerCreateCall<'a, C>
15027    where
15028        T: AsRef<str>,
15029    {
15030        self._additional_params
15031            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15032        self
15033    }
15034
15035    /// Identifies the authorization scope for the method you are building.
15036    ///
15037    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15038    /// [`Scope::EditContainer`].
15039    ///
15040    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15041    /// tokens for more than one scope.
15042    ///
15043    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15044    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15045    /// sufficient, a read-write scope will do as well.
15046    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerCreateCall<'a, C>
15047    where
15048        St: AsRef<str>,
15049    {
15050        self._scopes.insert(String::from(scope.as_ref()));
15051        self
15052    }
15053    /// Identifies the authorization scope(s) for the method you are building.
15054    ///
15055    /// See [`Self::add_scope()`] for details.
15056    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerCreateCall<'a, C>
15057    where
15058        I: IntoIterator<Item = St>,
15059        St: AsRef<str>,
15060    {
15061        self._scopes
15062            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15063        self
15064    }
15065
15066    /// Removes all scopes, and no default scope will be used either.
15067    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15068    /// for details).
15069    pub fn clear_scopes(mut self) -> AccountContainerCreateCall<'a, C> {
15070        self._scopes.clear();
15071        self
15072    }
15073}
15074
15075/// Deletes a Container.
15076///
15077/// A builder for the *containers.delete* method supported by a *account* resource.
15078/// It is not used directly, but through a [`AccountMethods`] instance.
15079///
15080/// # Example
15081///
15082/// Instantiate a resource method builder
15083///
15084/// ```test_harness,no_run
15085/// # extern crate hyper;
15086/// # extern crate hyper_rustls;
15087/// # extern crate google_tagmanager1 as tagmanager1;
15088/// # async fn dox() {
15089/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15090///
15091/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15092/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15093/// #     .with_native_roots()
15094/// #     .unwrap()
15095/// #     .https_only()
15096/// #     .enable_http2()
15097/// #     .build();
15098///
15099/// # let executor = hyper_util::rt::TokioExecutor::new();
15100/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15101/// #     secret,
15102/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15103/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15104/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15105/// #     ),
15106/// # ).build().await.unwrap();
15107///
15108/// # let client = hyper_util::client::legacy::Client::builder(
15109/// #     hyper_util::rt::TokioExecutor::new()
15110/// # )
15111/// # .build(
15112/// #     hyper_rustls::HttpsConnectorBuilder::new()
15113/// #         .with_native_roots()
15114/// #         .unwrap()
15115/// #         .https_or_http()
15116/// #         .enable_http2()
15117/// #         .build()
15118/// # );
15119/// # let mut hub = TagManager::new(client, auth);
15120/// // You can configure optional parameters by calling the respective setters at will, and
15121/// // execute the final call using `doit()`.
15122/// // Values shown here are possibly random and not representative !
15123/// let result = hub.accounts().containers_delete("accountId", "containerId")
15124///              .doit().await;
15125/// # }
15126/// ```
15127pub struct AccountContainerDeleteCall<'a, C>
15128where
15129    C: 'a,
15130{
15131    hub: &'a TagManager<C>,
15132    _account_id: String,
15133    _container_id: String,
15134    _delegate: Option<&'a mut dyn common::Delegate>,
15135    _additional_params: HashMap<String, String>,
15136    _scopes: BTreeSet<String>,
15137}
15138
15139impl<'a, C> common::CallBuilder for AccountContainerDeleteCall<'a, C> {}
15140
15141impl<'a, C> AccountContainerDeleteCall<'a, C>
15142where
15143    C: common::Connector,
15144{
15145    /// Perform the operation you have build so far.
15146    pub async fn doit(mut self) -> common::Result<common::Response> {
15147        use std::borrow::Cow;
15148        use std::io::{Read, Seek};
15149
15150        use common::{url::Params, ToParts};
15151        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15152
15153        let mut dd = common::DefaultDelegate;
15154        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15155        dlg.begin(common::MethodInfo {
15156            id: "tagmanager.accounts.containers.delete",
15157            http_method: hyper::Method::DELETE,
15158        });
15159
15160        for &field in ["accountId", "containerId"].iter() {
15161            if self._additional_params.contains_key(field) {
15162                dlg.finished(false);
15163                return Err(common::Error::FieldClash(field));
15164            }
15165        }
15166
15167        let mut params = Params::with_capacity(3 + self._additional_params.len());
15168        params.push("accountId", self._account_id);
15169        params.push("containerId", self._container_id);
15170
15171        params.extend(self._additional_params.iter());
15172
15173        let mut url = self.hub._base_url.clone()
15174            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}";
15175        if self._scopes.is_empty() {
15176            self._scopes
15177                .insert(Scope::DeleteContainer.as_ref().to_string());
15178        }
15179
15180        #[allow(clippy::single_element_loop)]
15181        for &(find_this, param_name) in [
15182            ("{accountId}", "accountId"),
15183            ("{containerId}", "containerId"),
15184        ]
15185        .iter()
15186        {
15187            url = params.uri_replacement(url, param_name, find_this, false);
15188        }
15189        {
15190            let to_remove = ["containerId", "accountId"];
15191            params.remove_params(&to_remove);
15192        }
15193
15194        let url = params.parse_with_url(&url);
15195
15196        loop {
15197            let token = match self
15198                .hub
15199                .auth
15200                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15201                .await
15202            {
15203                Ok(token) => token,
15204                Err(e) => match dlg.token(e) {
15205                    Ok(token) => token,
15206                    Err(e) => {
15207                        dlg.finished(false);
15208                        return Err(common::Error::MissingToken(e));
15209                    }
15210                },
15211            };
15212            let mut req_result = {
15213                let client = &self.hub.client;
15214                dlg.pre_request();
15215                let mut req_builder = hyper::Request::builder()
15216                    .method(hyper::Method::DELETE)
15217                    .uri(url.as_str())
15218                    .header(USER_AGENT, self.hub._user_agent.clone());
15219
15220                if let Some(token) = token.as_ref() {
15221                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15222                }
15223
15224                let request = req_builder
15225                    .header(CONTENT_LENGTH, 0_u64)
15226                    .body(common::to_body::<String>(None));
15227
15228                client.request(request.unwrap()).await
15229            };
15230
15231            match req_result {
15232                Err(err) => {
15233                    if let common::Retry::After(d) = dlg.http_error(&err) {
15234                        sleep(d).await;
15235                        continue;
15236                    }
15237                    dlg.finished(false);
15238                    return Err(common::Error::HttpError(err));
15239                }
15240                Ok(res) => {
15241                    let (mut parts, body) = res.into_parts();
15242                    let mut body = common::Body::new(body);
15243                    if !parts.status.is_success() {
15244                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15245                        let error = serde_json::from_str(&common::to_string(&bytes));
15246                        let response = common::to_response(parts, bytes.into());
15247
15248                        if let common::Retry::After(d) =
15249                            dlg.http_failure(&response, error.as_ref().ok())
15250                        {
15251                            sleep(d).await;
15252                            continue;
15253                        }
15254
15255                        dlg.finished(false);
15256
15257                        return Err(match error {
15258                            Ok(value) => common::Error::BadRequest(value),
15259                            _ => common::Error::Failure(response),
15260                        });
15261                    }
15262                    let response = common::Response::from_parts(parts, body);
15263
15264                    dlg.finished(true);
15265                    return Ok(response);
15266                }
15267            }
15268        }
15269    }
15270
15271    /// The GTM Account ID.
15272    ///
15273    /// Sets the *account id* path property to the given value.
15274    ///
15275    /// Even though the property as already been set when instantiating this call,
15276    /// we provide this method for API completeness.
15277    pub fn account_id(mut self, new_value: &str) -> AccountContainerDeleteCall<'a, C> {
15278        self._account_id = new_value.to_string();
15279        self
15280    }
15281    /// The GTM Container ID.
15282    ///
15283    /// Sets the *container id* path property to the given value.
15284    ///
15285    /// Even though the property as already been set when instantiating this call,
15286    /// we provide this method for API completeness.
15287    pub fn container_id(mut self, new_value: &str) -> AccountContainerDeleteCall<'a, C> {
15288        self._container_id = new_value.to_string();
15289        self
15290    }
15291    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15292    /// while executing the actual API request.
15293    ///
15294    /// ````text
15295    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15296    /// ````
15297    ///
15298    /// Sets the *delegate* property to the given value.
15299    pub fn delegate(
15300        mut self,
15301        new_value: &'a mut dyn common::Delegate,
15302    ) -> AccountContainerDeleteCall<'a, C> {
15303        self._delegate = Some(new_value);
15304        self
15305    }
15306
15307    /// Set any additional parameter of the query string used in the request.
15308    /// It should be used to set parameters which are not yet available through their own
15309    /// setters.
15310    ///
15311    /// Please note that this method must not be used to set any of the known parameters
15312    /// which have their own setter method. If done anyway, the request will fail.
15313    ///
15314    /// # Additional Parameters
15315    ///
15316    /// * *$.xgafv* (query-string) - V1 error format.
15317    /// * *access_token* (query-string) - OAuth access token.
15318    /// * *alt* (query-string) - Data format for response.
15319    /// * *callback* (query-string) - JSONP
15320    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15321    /// * *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.
15322    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15323    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15324    /// * *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.
15325    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15326    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15327    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDeleteCall<'a, C>
15328    where
15329        T: AsRef<str>,
15330    {
15331        self._additional_params
15332            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15333        self
15334    }
15335
15336    /// Identifies the authorization scope for the method you are building.
15337    ///
15338    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15339    /// [`Scope::DeleteContainer`].
15340    ///
15341    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15342    /// tokens for more than one scope.
15343    ///
15344    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15345    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15346    /// sufficient, a read-write scope will do as well.
15347    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDeleteCall<'a, C>
15348    where
15349        St: AsRef<str>,
15350    {
15351        self._scopes.insert(String::from(scope.as_ref()));
15352        self
15353    }
15354    /// Identifies the authorization scope(s) for the method you are building.
15355    ///
15356    /// See [`Self::add_scope()`] for details.
15357    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDeleteCall<'a, C>
15358    where
15359        I: IntoIterator<Item = St>,
15360        St: AsRef<str>,
15361    {
15362        self._scopes
15363            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15364        self
15365    }
15366
15367    /// Removes all scopes, and no default scope will be used either.
15368    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15369    /// for details).
15370    pub fn clear_scopes(mut self) -> AccountContainerDeleteCall<'a, C> {
15371        self._scopes.clear();
15372        self
15373    }
15374}
15375
15376/// Gets a Container.
15377///
15378/// A builder for the *containers.get* method supported by a *account* resource.
15379/// It is not used directly, but through a [`AccountMethods`] instance.
15380///
15381/// # Example
15382///
15383/// Instantiate a resource method builder
15384///
15385/// ```test_harness,no_run
15386/// # extern crate hyper;
15387/// # extern crate hyper_rustls;
15388/// # extern crate google_tagmanager1 as tagmanager1;
15389/// # async fn dox() {
15390/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15391///
15392/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15393/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15394/// #     .with_native_roots()
15395/// #     .unwrap()
15396/// #     .https_only()
15397/// #     .enable_http2()
15398/// #     .build();
15399///
15400/// # let executor = hyper_util::rt::TokioExecutor::new();
15401/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15402/// #     secret,
15403/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15404/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15405/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15406/// #     ),
15407/// # ).build().await.unwrap();
15408///
15409/// # let client = hyper_util::client::legacy::Client::builder(
15410/// #     hyper_util::rt::TokioExecutor::new()
15411/// # )
15412/// # .build(
15413/// #     hyper_rustls::HttpsConnectorBuilder::new()
15414/// #         .with_native_roots()
15415/// #         .unwrap()
15416/// #         .https_or_http()
15417/// #         .enable_http2()
15418/// #         .build()
15419/// # );
15420/// # let mut hub = TagManager::new(client, auth);
15421/// // You can configure optional parameters by calling the respective setters at will, and
15422/// // execute the final call using `doit()`.
15423/// // Values shown here are possibly random and not representative !
15424/// let result = hub.accounts().containers_get("accountId", "containerId")
15425///              .doit().await;
15426/// # }
15427/// ```
15428pub struct AccountContainerGetCall<'a, C>
15429where
15430    C: 'a,
15431{
15432    hub: &'a TagManager<C>,
15433    _account_id: String,
15434    _container_id: String,
15435    _delegate: Option<&'a mut dyn common::Delegate>,
15436    _additional_params: HashMap<String, String>,
15437    _scopes: BTreeSet<String>,
15438}
15439
15440impl<'a, C> common::CallBuilder for AccountContainerGetCall<'a, C> {}
15441
15442impl<'a, C> AccountContainerGetCall<'a, C>
15443where
15444    C: common::Connector,
15445{
15446    /// Perform the operation you have build so far.
15447    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
15448        use std::borrow::Cow;
15449        use std::io::{Read, Seek};
15450
15451        use common::{url::Params, ToParts};
15452        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15453
15454        let mut dd = common::DefaultDelegate;
15455        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15456        dlg.begin(common::MethodInfo {
15457            id: "tagmanager.accounts.containers.get",
15458            http_method: hyper::Method::GET,
15459        });
15460
15461        for &field in ["alt", "accountId", "containerId"].iter() {
15462            if self._additional_params.contains_key(field) {
15463                dlg.finished(false);
15464                return Err(common::Error::FieldClash(field));
15465            }
15466        }
15467
15468        let mut params = Params::with_capacity(4 + self._additional_params.len());
15469        params.push("accountId", self._account_id);
15470        params.push("containerId", self._container_id);
15471
15472        params.extend(self._additional_params.iter());
15473
15474        params.push("alt", "json");
15475        let mut url = self.hub._base_url.clone()
15476            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}";
15477        if self._scopes.is_empty() {
15478            self._scopes.insert(Scope::Readonly.as_ref().to_string());
15479        }
15480
15481        #[allow(clippy::single_element_loop)]
15482        for &(find_this, param_name) in [
15483            ("{accountId}", "accountId"),
15484            ("{containerId}", "containerId"),
15485        ]
15486        .iter()
15487        {
15488            url = params.uri_replacement(url, param_name, find_this, false);
15489        }
15490        {
15491            let to_remove = ["containerId", "accountId"];
15492            params.remove_params(&to_remove);
15493        }
15494
15495        let url = params.parse_with_url(&url);
15496
15497        loop {
15498            let token = match self
15499                .hub
15500                .auth
15501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15502                .await
15503            {
15504                Ok(token) => token,
15505                Err(e) => match dlg.token(e) {
15506                    Ok(token) => token,
15507                    Err(e) => {
15508                        dlg.finished(false);
15509                        return Err(common::Error::MissingToken(e));
15510                    }
15511                },
15512            };
15513            let mut req_result = {
15514                let client = &self.hub.client;
15515                dlg.pre_request();
15516                let mut req_builder = hyper::Request::builder()
15517                    .method(hyper::Method::GET)
15518                    .uri(url.as_str())
15519                    .header(USER_AGENT, self.hub._user_agent.clone());
15520
15521                if let Some(token) = token.as_ref() {
15522                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15523                }
15524
15525                let request = req_builder
15526                    .header(CONTENT_LENGTH, 0_u64)
15527                    .body(common::to_body::<String>(None));
15528
15529                client.request(request.unwrap()).await
15530            };
15531
15532            match req_result {
15533                Err(err) => {
15534                    if let common::Retry::After(d) = dlg.http_error(&err) {
15535                        sleep(d).await;
15536                        continue;
15537                    }
15538                    dlg.finished(false);
15539                    return Err(common::Error::HttpError(err));
15540                }
15541                Ok(res) => {
15542                    let (mut parts, body) = res.into_parts();
15543                    let mut body = common::Body::new(body);
15544                    if !parts.status.is_success() {
15545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15546                        let error = serde_json::from_str(&common::to_string(&bytes));
15547                        let response = common::to_response(parts, bytes.into());
15548
15549                        if let common::Retry::After(d) =
15550                            dlg.http_failure(&response, error.as_ref().ok())
15551                        {
15552                            sleep(d).await;
15553                            continue;
15554                        }
15555
15556                        dlg.finished(false);
15557
15558                        return Err(match error {
15559                            Ok(value) => common::Error::BadRequest(value),
15560                            _ => common::Error::Failure(response),
15561                        });
15562                    }
15563                    let response = {
15564                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15565                        let encoded = common::to_string(&bytes);
15566                        match serde_json::from_str(&encoded) {
15567                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15568                            Err(error) => {
15569                                dlg.response_json_decode_error(&encoded, &error);
15570                                return Err(common::Error::JsonDecodeError(
15571                                    encoded.to_string(),
15572                                    error,
15573                                ));
15574                            }
15575                        }
15576                    };
15577
15578                    dlg.finished(true);
15579                    return Ok(response);
15580                }
15581            }
15582        }
15583    }
15584
15585    /// The GTM Account ID.
15586    ///
15587    /// Sets the *account id* path property to the given value.
15588    ///
15589    /// Even though the property as already been set when instantiating this call,
15590    /// we provide this method for API completeness.
15591    pub fn account_id(mut self, new_value: &str) -> AccountContainerGetCall<'a, C> {
15592        self._account_id = new_value.to_string();
15593        self
15594    }
15595    /// The GTM Container ID.
15596    ///
15597    /// Sets the *container id* path property to the given value.
15598    ///
15599    /// Even though the property as already been set when instantiating this call,
15600    /// we provide this method for API completeness.
15601    pub fn container_id(mut self, new_value: &str) -> AccountContainerGetCall<'a, C> {
15602        self._container_id = new_value.to_string();
15603        self
15604    }
15605    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15606    /// while executing the actual API request.
15607    ///
15608    /// ````text
15609    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15610    /// ````
15611    ///
15612    /// Sets the *delegate* property to the given value.
15613    pub fn delegate(
15614        mut self,
15615        new_value: &'a mut dyn common::Delegate,
15616    ) -> AccountContainerGetCall<'a, C> {
15617        self._delegate = Some(new_value);
15618        self
15619    }
15620
15621    /// Set any additional parameter of the query string used in the request.
15622    /// It should be used to set parameters which are not yet available through their own
15623    /// setters.
15624    ///
15625    /// Please note that this method must not be used to set any of the known parameters
15626    /// which have their own setter method. If done anyway, the request will fail.
15627    ///
15628    /// # Additional Parameters
15629    ///
15630    /// * *$.xgafv* (query-string) - V1 error format.
15631    /// * *access_token* (query-string) - OAuth access token.
15632    /// * *alt* (query-string) - Data format for response.
15633    /// * *callback* (query-string) - JSONP
15634    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15635    /// * *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.
15636    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15637    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15638    /// * *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.
15639    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15640    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15641    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerGetCall<'a, C>
15642    where
15643        T: AsRef<str>,
15644    {
15645        self._additional_params
15646            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15647        self
15648    }
15649
15650    /// Identifies the authorization scope for the method you are building.
15651    ///
15652    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15653    /// [`Scope::Readonly`].
15654    ///
15655    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15656    /// tokens for more than one scope.
15657    ///
15658    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15659    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15660    /// sufficient, a read-write scope will do as well.
15661    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerGetCall<'a, C>
15662    where
15663        St: AsRef<str>,
15664    {
15665        self._scopes.insert(String::from(scope.as_ref()));
15666        self
15667    }
15668    /// Identifies the authorization scope(s) for the method you are building.
15669    ///
15670    /// See [`Self::add_scope()`] for details.
15671    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerGetCall<'a, C>
15672    where
15673        I: IntoIterator<Item = St>,
15674        St: AsRef<str>,
15675    {
15676        self._scopes
15677            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15678        self
15679    }
15680
15681    /// Removes all scopes, and no default scope will be used either.
15682    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15683    /// for details).
15684    pub fn clear_scopes(mut self) -> AccountContainerGetCall<'a, C> {
15685        self._scopes.clear();
15686        self
15687    }
15688}
15689
15690/// Lists all Containers that belongs to a GTM Account.
15691///
15692/// A builder for the *containers.list* method supported by a *account* resource.
15693/// It is not used directly, but through a [`AccountMethods`] instance.
15694///
15695/// # Example
15696///
15697/// Instantiate a resource method builder
15698///
15699/// ```test_harness,no_run
15700/// # extern crate hyper;
15701/// # extern crate hyper_rustls;
15702/// # extern crate google_tagmanager1 as tagmanager1;
15703/// # async fn dox() {
15704/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15705///
15706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15708/// #     .with_native_roots()
15709/// #     .unwrap()
15710/// #     .https_only()
15711/// #     .enable_http2()
15712/// #     .build();
15713///
15714/// # let executor = hyper_util::rt::TokioExecutor::new();
15715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15716/// #     secret,
15717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15718/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15719/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15720/// #     ),
15721/// # ).build().await.unwrap();
15722///
15723/// # let client = hyper_util::client::legacy::Client::builder(
15724/// #     hyper_util::rt::TokioExecutor::new()
15725/// # )
15726/// # .build(
15727/// #     hyper_rustls::HttpsConnectorBuilder::new()
15728/// #         .with_native_roots()
15729/// #         .unwrap()
15730/// #         .https_or_http()
15731/// #         .enable_http2()
15732/// #         .build()
15733/// # );
15734/// # let mut hub = TagManager::new(client, auth);
15735/// // You can configure optional parameters by calling the respective setters at will, and
15736/// // execute the final call using `doit()`.
15737/// // Values shown here are possibly random and not representative !
15738/// let result = hub.accounts().containers_list("accountId")
15739///              .doit().await;
15740/// # }
15741/// ```
15742pub struct AccountContainerListCall<'a, C>
15743where
15744    C: 'a,
15745{
15746    hub: &'a TagManager<C>,
15747    _account_id: String,
15748    _delegate: Option<&'a mut dyn common::Delegate>,
15749    _additional_params: HashMap<String, String>,
15750    _scopes: BTreeSet<String>,
15751}
15752
15753impl<'a, C> common::CallBuilder for AccountContainerListCall<'a, C> {}
15754
15755impl<'a, C> AccountContainerListCall<'a, C>
15756where
15757    C: common::Connector,
15758{
15759    /// Perform the operation you have build so far.
15760    pub async fn doit(mut self) -> common::Result<(common::Response, ListContainersResponse)> {
15761        use std::borrow::Cow;
15762        use std::io::{Read, Seek};
15763
15764        use common::{url::Params, ToParts};
15765        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15766
15767        let mut dd = common::DefaultDelegate;
15768        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15769        dlg.begin(common::MethodInfo {
15770            id: "tagmanager.accounts.containers.list",
15771            http_method: hyper::Method::GET,
15772        });
15773
15774        for &field in ["alt", "accountId"].iter() {
15775            if self._additional_params.contains_key(field) {
15776                dlg.finished(false);
15777                return Err(common::Error::FieldClash(field));
15778            }
15779        }
15780
15781        let mut params = Params::with_capacity(3 + self._additional_params.len());
15782        params.push("accountId", self._account_id);
15783
15784        params.extend(self._additional_params.iter());
15785
15786        params.push("alt", "json");
15787        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/containers";
15788        if self._scopes.is_empty() {
15789            self._scopes.insert(Scope::Readonly.as_ref().to_string());
15790        }
15791
15792        #[allow(clippy::single_element_loop)]
15793        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
15794            url = params.uri_replacement(url, param_name, find_this, false);
15795        }
15796        {
15797            let to_remove = ["accountId"];
15798            params.remove_params(&to_remove);
15799        }
15800
15801        let url = params.parse_with_url(&url);
15802
15803        loop {
15804            let token = match self
15805                .hub
15806                .auth
15807                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15808                .await
15809            {
15810                Ok(token) => token,
15811                Err(e) => match dlg.token(e) {
15812                    Ok(token) => token,
15813                    Err(e) => {
15814                        dlg.finished(false);
15815                        return Err(common::Error::MissingToken(e));
15816                    }
15817                },
15818            };
15819            let mut req_result = {
15820                let client = &self.hub.client;
15821                dlg.pre_request();
15822                let mut req_builder = hyper::Request::builder()
15823                    .method(hyper::Method::GET)
15824                    .uri(url.as_str())
15825                    .header(USER_AGENT, self.hub._user_agent.clone());
15826
15827                if let Some(token) = token.as_ref() {
15828                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15829                }
15830
15831                let request = req_builder
15832                    .header(CONTENT_LENGTH, 0_u64)
15833                    .body(common::to_body::<String>(None));
15834
15835                client.request(request.unwrap()).await
15836            };
15837
15838            match req_result {
15839                Err(err) => {
15840                    if let common::Retry::After(d) = dlg.http_error(&err) {
15841                        sleep(d).await;
15842                        continue;
15843                    }
15844                    dlg.finished(false);
15845                    return Err(common::Error::HttpError(err));
15846                }
15847                Ok(res) => {
15848                    let (mut parts, body) = res.into_parts();
15849                    let mut body = common::Body::new(body);
15850                    if !parts.status.is_success() {
15851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15852                        let error = serde_json::from_str(&common::to_string(&bytes));
15853                        let response = common::to_response(parts, bytes.into());
15854
15855                        if let common::Retry::After(d) =
15856                            dlg.http_failure(&response, error.as_ref().ok())
15857                        {
15858                            sleep(d).await;
15859                            continue;
15860                        }
15861
15862                        dlg.finished(false);
15863
15864                        return Err(match error {
15865                            Ok(value) => common::Error::BadRequest(value),
15866                            _ => common::Error::Failure(response),
15867                        });
15868                    }
15869                    let response = {
15870                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15871                        let encoded = common::to_string(&bytes);
15872                        match serde_json::from_str(&encoded) {
15873                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15874                            Err(error) => {
15875                                dlg.response_json_decode_error(&encoded, &error);
15876                                return Err(common::Error::JsonDecodeError(
15877                                    encoded.to_string(),
15878                                    error,
15879                                ));
15880                            }
15881                        }
15882                    };
15883
15884                    dlg.finished(true);
15885                    return Ok(response);
15886                }
15887            }
15888        }
15889    }
15890
15891    /// The GTM Account ID.
15892    ///
15893    /// Sets the *account id* path property to the given value.
15894    ///
15895    /// Even though the property as already been set when instantiating this call,
15896    /// we provide this method for API completeness.
15897    pub fn account_id(mut self, new_value: &str) -> AccountContainerListCall<'a, C> {
15898        self._account_id = new_value.to_string();
15899        self
15900    }
15901    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15902    /// while executing the actual API request.
15903    ///
15904    /// ````text
15905    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15906    /// ````
15907    ///
15908    /// Sets the *delegate* property to the given value.
15909    pub fn delegate(
15910        mut self,
15911        new_value: &'a mut dyn common::Delegate,
15912    ) -> AccountContainerListCall<'a, C> {
15913        self._delegate = Some(new_value);
15914        self
15915    }
15916
15917    /// Set any additional parameter of the query string used in the request.
15918    /// It should be used to set parameters which are not yet available through their own
15919    /// setters.
15920    ///
15921    /// Please note that this method must not be used to set any of the known parameters
15922    /// which have their own setter method. If done anyway, the request will fail.
15923    ///
15924    /// # Additional Parameters
15925    ///
15926    /// * *$.xgafv* (query-string) - V1 error format.
15927    /// * *access_token* (query-string) - OAuth access token.
15928    /// * *alt* (query-string) - Data format for response.
15929    /// * *callback* (query-string) - JSONP
15930    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15931    /// * *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.
15932    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15933    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15934    /// * *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.
15935    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15936    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15937    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerListCall<'a, C>
15938    where
15939        T: AsRef<str>,
15940    {
15941        self._additional_params
15942            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15943        self
15944    }
15945
15946    /// Identifies the authorization scope for the method you are building.
15947    ///
15948    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15949    /// [`Scope::Readonly`].
15950    ///
15951    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15952    /// tokens for more than one scope.
15953    ///
15954    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15955    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15956    /// sufficient, a read-write scope will do as well.
15957    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerListCall<'a, C>
15958    where
15959        St: AsRef<str>,
15960    {
15961        self._scopes.insert(String::from(scope.as_ref()));
15962        self
15963    }
15964    /// Identifies the authorization scope(s) for the method you are building.
15965    ///
15966    /// See [`Self::add_scope()`] for details.
15967    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerListCall<'a, C>
15968    where
15969        I: IntoIterator<Item = St>,
15970        St: AsRef<str>,
15971    {
15972        self._scopes
15973            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15974        self
15975    }
15976
15977    /// Removes all scopes, and no default scope will be used either.
15978    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15979    /// for details).
15980    pub fn clear_scopes(mut self) -> AccountContainerListCall<'a, C> {
15981        self._scopes.clear();
15982        self
15983    }
15984}
15985
15986/// Updates a Container.
15987///
15988/// A builder for the *containers.update* method supported by a *account* resource.
15989/// It is not used directly, but through a [`AccountMethods`] instance.
15990///
15991/// # Example
15992///
15993/// Instantiate a resource method builder
15994///
15995/// ```test_harness,no_run
15996/// # extern crate hyper;
15997/// # extern crate hyper_rustls;
15998/// # extern crate google_tagmanager1 as tagmanager1;
15999/// use tagmanager1::api::Container;
16000/// # async fn dox() {
16001/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16002///
16003/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16004/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16005/// #     .with_native_roots()
16006/// #     .unwrap()
16007/// #     .https_only()
16008/// #     .enable_http2()
16009/// #     .build();
16010///
16011/// # let executor = hyper_util::rt::TokioExecutor::new();
16012/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16013/// #     secret,
16014/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16015/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16016/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16017/// #     ),
16018/// # ).build().await.unwrap();
16019///
16020/// # let client = hyper_util::client::legacy::Client::builder(
16021/// #     hyper_util::rt::TokioExecutor::new()
16022/// # )
16023/// # .build(
16024/// #     hyper_rustls::HttpsConnectorBuilder::new()
16025/// #         .with_native_roots()
16026/// #         .unwrap()
16027/// #         .https_or_http()
16028/// #         .enable_http2()
16029/// #         .build()
16030/// # );
16031/// # let mut hub = TagManager::new(client, auth);
16032/// // As the method needs a request, you would usually fill it with the desired information
16033/// // into the respective structure. Some of the parts shown here might not be applicable !
16034/// // Values shown here are possibly random and not representative !
16035/// let mut req = Container::default();
16036///
16037/// // You can configure optional parameters by calling the respective setters at will, and
16038/// // execute the final call using `doit()`.
16039/// // Values shown here are possibly random and not representative !
16040/// let result = hub.accounts().containers_update(req, "accountId", "containerId")
16041///              .fingerprint("est")
16042///              .doit().await;
16043/// # }
16044/// ```
16045pub struct AccountContainerUpdateCall<'a, C>
16046where
16047    C: 'a,
16048{
16049    hub: &'a TagManager<C>,
16050    _request: Container,
16051    _account_id: String,
16052    _container_id: String,
16053    _fingerprint: Option<String>,
16054    _delegate: Option<&'a mut dyn common::Delegate>,
16055    _additional_params: HashMap<String, String>,
16056    _scopes: BTreeSet<String>,
16057}
16058
16059impl<'a, C> common::CallBuilder for AccountContainerUpdateCall<'a, C> {}
16060
16061impl<'a, C> AccountContainerUpdateCall<'a, C>
16062where
16063    C: common::Connector,
16064{
16065    /// Perform the operation you have build so far.
16066    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
16067        use std::borrow::Cow;
16068        use std::io::{Read, Seek};
16069
16070        use common::{url::Params, ToParts};
16071        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16072
16073        let mut dd = common::DefaultDelegate;
16074        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16075        dlg.begin(common::MethodInfo {
16076            id: "tagmanager.accounts.containers.update",
16077            http_method: hyper::Method::PUT,
16078        });
16079
16080        for &field in ["alt", "accountId", "containerId", "fingerprint"].iter() {
16081            if self._additional_params.contains_key(field) {
16082                dlg.finished(false);
16083                return Err(common::Error::FieldClash(field));
16084            }
16085        }
16086
16087        let mut params = Params::with_capacity(6 + self._additional_params.len());
16088        params.push("accountId", self._account_id);
16089        params.push("containerId", self._container_id);
16090        if let Some(value) = self._fingerprint.as_ref() {
16091            params.push("fingerprint", value);
16092        }
16093
16094        params.extend(self._additional_params.iter());
16095
16096        params.push("alt", "json");
16097        let mut url = self.hub._base_url.clone()
16098            + "tagmanager/v1/accounts/{accountId}/containers/{containerId}";
16099        if self._scopes.is_empty() {
16100            self._scopes
16101                .insert(Scope::EditContainer.as_ref().to_string());
16102        }
16103
16104        #[allow(clippy::single_element_loop)]
16105        for &(find_this, param_name) in [
16106            ("{accountId}", "accountId"),
16107            ("{containerId}", "containerId"),
16108        ]
16109        .iter()
16110        {
16111            url = params.uri_replacement(url, param_name, find_this, false);
16112        }
16113        {
16114            let to_remove = ["containerId", "accountId"];
16115            params.remove_params(&to_remove);
16116        }
16117
16118        let url = params.parse_with_url(&url);
16119
16120        let mut json_mime_type = mime::APPLICATION_JSON;
16121        let mut request_value_reader = {
16122            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16123            common::remove_json_null_values(&mut value);
16124            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16125            serde_json::to_writer(&mut dst, &value).unwrap();
16126            dst
16127        };
16128        let request_size = request_value_reader
16129            .seek(std::io::SeekFrom::End(0))
16130            .unwrap();
16131        request_value_reader
16132            .seek(std::io::SeekFrom::Start(0))
16133            .unwrap();
16134
16135        loop {
16136            let token = match self
16137                .hub
16138                .auth
16139                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16140                .await
16141            {
16142                Ok(token) => token,
16143                Err(e) => match dlg.token(e) {
16144                    Ok(token) => token,
16145                    Err(e) => {
16146                        dlg.finished(false);
16147                        return Err(common::Error::MissingToken(e));
16148                    }
16149                },
16150            };
16151            request_value_reader
16152                .seek(std::io::SeekFrom::Start(0))
16153                .unwrap();
16154            let mut req_result = {
16155                let client = &self.hub.client;
16156                dlg.pre_request();
16157                let mut req_builder = hyper::Request::builder()
16158                    .method(hyper::Method::PUT)
16159                    .uri(url.as_str())
16160                    .header(USER_AGENT, self.hub._user_agent.clone());
16161
16162                if let Some(token) = token.as_ref() {
16163                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16164                }
16165
16166                let request = req_builder
16167                    .header(CONTENT_TYPE, json_mime_type.to_string())
16168                    .header(CONTENT_LENGTH, request_size as u64)
16169                    .body(common::to_body(
16170                        request_value_reader.get_ref().clone().into(),
16171                    ));
16172
16173                client.request(request.unwrap()).await
16174            };
16175
16176            match req_result {
16177                Err(err) => {
16178                    if let common::Retry::After(d) = dlg.http_error(&err) {
16179                        sleep(d).await;
16180                        continue;
16181                    }
16182                    dlg.finished(false);
16183                    return Err(common::Error::HttpError(err));
16184                }
16185                Ok(res) => {
16186                    let (mut parts, body) = res.into_parts();
16187                    let mut body = common::Body::new(body);
16188                    if !parts.status.is_success() {
16189                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16190                        let error = serde_json::from_str(&common::to_string(&bytes));
16191                        let response = common::to_response(parts, bytes.into());
16192
16193                        if let common::Retry::After(d) =
16194                            dlg.http_failure(&response, error.as_ref().ok())
16195                        {
16196                            sleep(d).await;
16197                            continue;
16198                        }
16199
16200                        dlg.finished(false);
16201
16202                        return Err(match error {
16203                            Ok(value) => common::Error::BadRequest(value),
16204                            _ => common::Error::Failure(response),
16205                        });
16206                    }
16207                    let response = {
16208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16209                        let encoded = common::to_string(&bytes);
16210                        match serde_json::from_str(&encoded) {
16211                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16212                            Err(error) => {
16213                                dlg.response_json_decode_error(&encoded, &error);
16214                                return Err(common::Error::JsonDecodeError(
16215                                    encoded.to_string(),
16216                                    error,
16217                                ));
16218                            }
16219                        }
16220                    };
16221
16222                    dlg.finished(true);
16223                    return Ok(response);
16224                }
16225            }
16226        }
16227    }
16228
16229    ///
16230    /// Sets the *request* property to the given value.
16231    ///
16232    /// Even though the property as already been set when instantiating this call,
16233    /// we provide this method for API completeness.
16234    pub fn request(mut self, new_value: Container) -> AccountContainerUpdateCall<'a, C> {
16235        self._request = new_value;
16236        self
16237    }
16238    /// The GTM Account ID.
16239    ///
16240    /// Sets the *account id* path property to the given value.
16241    ///
16242    /// Even though the property as already been set when instantiating this call,
16243    /// we provide this method for API completeness.
16244    pub fn account_id(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
16245        self._account_id = new_value.to_string();
16246        self
16247    }
16248    /// The GTM Container ID.
16249    ///
16250    /// Sets the *container id* path property to the given value.
16251    ///
16252    /// Even though the property as already been set when instantiating this call,
16253    /// we provide this method for API completeness.
16254    pub fn container_id(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
16255        self._container_id = new_value.to_string();
16256        self
16257    }
16258    /// When provided, this fingerprint must match the fingerprint of the container in storage.
16259    ///
16260    /// Sets the *fingerprint* query property to the given value.
16261    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
16262        self._fingerprint = Some(new_value.to_string());
16263        self
16264    }
16265    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16266    /// while executing the actual API request.
16267    ///
16268    /// ````text
16269    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16270    /// ````
16271    ///
16272    /// Sets the *delegate* property to the given value.
16273    pub fn delegate(
16274        mut self,
16275        new_value: &'a mut dyn common::Delegate,
16276    ) -> AccountContainerUpdateCall<'a, C> {
16277        self._delegate = Some(new_value);
16278        self
16279    }
16280
16281    /// Set any additional parameter of the query string used in the request.
16282    /// It should be used to set parameters which are not yet available through their own
16283    /// setters.
16284    ///
16285    /// Please note that this method must not be used to set any of the known parameters
16286    /// which have their own setter method. If done anyway, the request will fail.
16287    ///
16288    /// # Additional Parameters
16289    ///
16290    /// * *$.xgafv* (query-string) - V1 error format.
16291    /// * *access_token* (query-string) - OAuth access token.
16292    /// * *alt* (query-string) - Data format for response.
16293    /// * *callback* (query-string) - JSONP
16294    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16295    /// * *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.
16296    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16297    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16298    /// * *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.
16299    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16300    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16301    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerUpdateCall<'a, C>
16302    where
16303        T: AsRef<str>,
16304    {
16305        self._additional_params
16306            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16307        self
16308    }
16309
16310    /// Identifies the authorization scope for the method you are building.
16311    ///
16312    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16313    /// [`Scope::EditContainer`].
16314    ///
16315    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16316    /// tokens for more than one scope.
16317    ///
16318    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16319    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16320    /// sufficient, a read-write scope will do as well.
16321    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerUpdateCall<'a, C>
16322    where
16323        St: AsRef<str>,
16324    {
16325        self._scopes.insert(String::from(scope.as_ref()));
16326        self
16327    }
16328    /// Identifies the authorization scope(s) for the method you are building.
16329    ///
16330    /// See [`Self::add_scope()`] for details.
16331    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerUpdateCall<'a, C>
16332    where
16333        I: IntoIterator<Item = St>,
16334        St: AsRef<str>,
16335    {
16336        self._scopes
16337            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16338        self
16339    }
16340
16341    /// Removes all scopes, and no default scope will be used either.
16342    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16343    /// for details).
16344    pub fn clear_scopes(mut self) -> AccountContainerUpdateCall<'a, C> {
16345        self._scopes.clear();
16346        self
16347    }
16348}
16349
16350/// Creates a user's Account & Container Permissions.
16351///
16352/// A builder for the *permissions.create* method supported by a *account* resource.
16353/// It is not used directly, but through a [`AccountMethods`] instance.
16354///
16355/// # Example
16356///
16357/// Instantiate a resource method builder
16358///
16359/// ```test_harness,no_run
16360/// # extern crate hyper;
16361/// # extern crate hyper_rustls;
16362/// # extern crate google_tagmanager1 as tagmanager1;
16363/// use tagmanager1::api::UserAccess;
16364/// # async fn dox() {
16365/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16366///
16367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16368/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16369/// #     .with_native_roots()
16370/// #     .unwrap()
16371/// #     .https_only()
16372/// #     .enable_http2()
16373/// #     .build();
16374///
16375/// # let executor = hyper_util::rt::TokioExecutor::new();
16376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16377/// #     secret,
16378/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16379/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16380/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16381/// #     ),
16382/// # ).build().await.unwrap();
16383///
16384/// # let client = hyper_util::client::legacy::Client::builder(
16385/// #     hyper_util::rt::TokioExecutor::new()
16386/// # )
16387/// # .build(
16388/// #     hyper_rustls::HttpsConnectorBuilder::new()
16389/// #         .with_native_roots()
16390/// #         .unwrap()
16391/// #         .https_or_http()
16392/// #         .enable_http2()
16393/// #         .build()
16394/// # );
16395/// # let mut hub = TagManager::new(client, auth);
16396/// // As the method needs a request, you would usually fill it with the desired information
16397/// // into the respective structure. Some of the parts shown here might not be applicable !
16398/// // Values shown here are possibly random and not representative !
16399/// let mut req = UserAccess::default();
16400///
16401/// // You can configure optional parameters by calling the respective setters at will, and
16402/// // execute the final call using `doit()`.
16403/// // Values shown here are possibly random and not representative !
16404/// let result = hub.accounts().permissions_create(req, "accountId")
16405///              .doit().await;
16406/// # }
16407/// ```
16408pub struct AccountPermissionCreateCall<'a, C>
16409where
16410    C: 'a,
16411{
16412    hub: &'a TagManager<C>,
16413    _request: UserAccess,
16414    _account_id: String,
16415    _delegate: Option<&'a mut dyn common::Delegate>,
16416    _additional_params: HashMap<String, String>,
16417    _scopes: BTreeSet<String>,
16418}
16419
16420impl<'a, C> common::CallBuilder for AccountPermissionCreateCall<'a, C> {}
16421
16422impl<'a, C> AccountPermissionCreateCall<'a, C>
16423where
16424    C: common::Connector,
16425{
16426    /// Perform the operation you have build so far.
16427    pub async fn doit(mut self) -> common::Result<(common::Response, UserAccess)> {
16428        use std::borrow::Cow;
16429        use std::io::{Read, Seek};
16430
16431        use common::{url::Params, ToParts};
16432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16433
16434        let mut dd = common::DefaultDelegate;
16435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16436        dlg.begin(common::MethodInfo {
16437            id: "tagmanager.accounts.permissions.create",
16438            http_method: hyper::Method::POST,
16439        });
16440
16441        for &field in ["alt", "accountId"].iter() {
16442            if self._additional_params.contains_key(field) {
16443                dlg.finished(false);
16444                return Err(common::Error::FieldClash(field));
16445            }
16446        }
16447
16448        let mut params = Params::with_capacity(4 + self._additional_params.len());
16449        params.push("accountId", self._account_id);
16450
16451        params.extend(self._additional_params.iter());
16452
16453        params.push("alt", "json");
16454        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/permissions";
16455        if self._scopes.is_empty() {
16456            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
16457        }
16458
16459        #[allow(clippy::single_element_loop)]
16460        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
16461            url = params.uri_replacement(url, param_name, find_this, false);
16462        }
16463        {
16464            let to_remove = ["accountId"];
16465            params.remove_params(&to_remove);
16466        }
16467
16468        let url = params.parse_with_url(&url);
16469
16470        let mut json_mime_type = mime::APPLICATION_JSON;
16471        let mut request_value_reader = {
16472            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16473            common::remove_json_null_values(&mut value);
16474            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16475            serde_json::to_writer(&mut dst, &value).unwrap();
16476            dst
16477        };
16478        let request_size = request_value_reader
16479            .seek(std::io::SeekFrom::End(0))
16480            .unwrap();
16481        request_value_reader
16482            .seek(std::io::SeekFrom::Start(0))
16483            .unwrap();
16484
16485        loop {
16486            let token = match self
16487                .hub
16488                .auth
16489                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16490                .await
16491            {
16492                Ok(token) => token,
16493                Err(e) => match dlg.token(e) {
16494                    Ok(token) => token,
16495                    Err(e) => {
16496                        dlg.finished(false);
16497                        return Err(common::Error::MissingToken(e));
16498                    }
16499                },
16500            };
16501            request_value_reader
16502                .seek(std::io::SeekFrom::Start(0))
16503                .unwrap();
16504            let mut req_result = {
16505                let client = &self.hub.client;
16506                dlg.pre_request();
16507                let mut req_builder = hyper::Request::builder()
16508                    .method(hyper::Method::POST)
16509                    .uri(url.as_str())
16510                    .header(USER_AGENT, self.hub._user_agent.clone());
16511
16512                if let Some(token) = token.as_ref() {
16513                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16514                }
16515
16516                let request = req_builder
16517                    .header(CONTENT_TYPE, json_mime_type.to_string())
16518                    .header(CONTENT_LENGTH, request_size as u64)
16519                    .body(common::to_body(
16520                        request_value_reader.get_ref().clone().into(),
16521                    ));
16522
16523                client.request(request.unwrap()).await
16524            };
16525
16526            match req_result {
16527                Err(err) => {
16528                    if let common::Retry::After(d) = dlg.http_error(&err) {
16529                        sleep(d).await;
16530                        continue;
16531                    }
16532                    dlg.finished(false);
16533                    return Err(common::Error::HttpError(err));
16534                }
16535                Ok(res) => {
16536                    let (mut parts, body) = res.into_parts();
16537                    let mut body = common::Body::new(body);
16538                    if !parts.status.is_success() {
16539                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16540                        let error = serde_json::from_str(&common::to_string(&bytes));
16541                        let response = common::to_response(parts, bytes.into());
16542
16543                        if let common::Retry::After(d) =
16544                            dlg.http_failure(&response, error.as_ref().ok())
16545                        {
16546                            sleep(d).await;
16547                            continue;
16548                        }
16549
16550                        dlg.finished(false);
16551
16552                        return Err(match error {
16553                            Ok(value) => common::Error::BadRequest(value),
16554                            _ => common::Error::Failure(response),
16555                        });
16556                    }
16557                    let response = {
16558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16559                        let encoded = common::to_string(&bytes);
16560                        match serde_json::from_str(&encoded) {
16561                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16562                            Err(error) => {
16563                                dlg.response_json_decode_error(&encoded, &error);
16564                                return Err(common::Error::JsonDecodeError(
16565                                    encoded.to_string(),
16566                                    error,
16567                                ));
16568                            }
16569                        }
16570                    };
16571
16572                    dlg.finished(true);
16573                    return Ok(response);
16574                }
16575            }
16576        }
16577    }
16578
16579    ///
16580    /// Sets the *request* property to the given value.
16581    ///
16582    /// Even though the property as already been set when instantiating this call,
16583    /// we provide this method for API completeness.
16584    pub fn request(mut self, new_value: UserAccess) -> AccountPermissionCreateCall<'a, C> {
16585        self._request = new_value;
16586        self
16587    }
16588    /// The GTM Account ID.
16589    ///
16590    /// Sets the *account id* path property to the given value.
16591    ///
16592    /// Even though the property as already been set when instantiating this call,
16593    /// we provide this method for API completeness.
16594    pub fn account_id(mut self, new_value: &str) -> AccountPermissionCreateCall<'a, C> {
16595        self._account_id = new_value.to_string();
16596        self
16597    }
16598    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16599    /// while executing the actual API request.
16600    ///
16601    /// ````text
16602    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16603    /// ````
16604    ///
16605    /// Sets the *delegate* property to the given value.
16606    pub fn delegate(
16607        mut self,
16608        new_value: &'a mut dyn common::Delegate,
16609    ) -> AccountPermissionCreateCall<'a, C> {
16610        self._delegate = Some(new_value);
16611        self
16612    }
16613
16614    /// Set any additional parameter of the query string used in the request.
16615    /// It should be used to set parameters which are not yet available through their own
16616    /// setters.
16617    ///
16618    /// Please note that this method must not be used to set any of the known parameters
16619    /// which have their own setter method. If done anyway, the request will fail.
16620    ///
16621    /// # Additional Parameters
16622    ///
16623    /// * *$.xgafv* (query-string) - V1 error format.
16624    /// * *access_token* (query-string) - OAuth access token.
16625    /// * *alt* (query-string) - Data format for response.
16626    /// * *callback* (query-string) - JSONP
16627    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16628    /// * *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.
16629    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16630    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16631    /// * *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.
16632    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16633    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16634    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionCreateCall<'a, C>
16635    where
16636        T: AsRef<str>,
16637    {
16638        self._additional_params
16639            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16640        self
16641    }
16642
16643    /// Identifies the authorization scope for the method you are building.
16644    ///
16645    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16646    /// [`Scope::ManageUser`].
16647    ///
16648    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16649    /// tokens for more than one scope.
16650    ///
16651    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16652    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16653    /// sufficient, a read-write scope will do as well.
16654    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionCreateCall<'a, C>
16655    where
16656        St: AsRef<str>,
16657    {
16658        self._scopes.insert(String::from(scope.as_ref()));
16659        self
16660    }
16661    /// Identifies the authorization scope(s) for the method you are building.
16662    ///
16663    /// See [`Self::add_scope()`] for details.
16664    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionCreateCall<'a, C>
16665    where
16666        I: IntoIterator<Item = St>,
16667        St: AsRef<str>,
16668    {
16669        self._scopes
16670            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16671        self
16672    }
16673
16674    /// Removes all scopes, and no default scope will be used either.
16675    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16676    /// for details).
16677    pub fn clear_scopes(mut self) -> AccountPermissionCreateCall<'a, C> {
16678        self._scopes.clear();
16679        self
16680    }
16681}
16682
16683/// Removes a user from the account, revoking access to it and all of its containers.
16684///
16685/// A builder for the *permissions.delete* method supported by a *account* resource.
16686/// It is not used directly, but through a [`AccountMethods`] instance.
16687///
16688/// # Example
16689///
16690/// Instantiate a resource method builder
16691///
16692/// ```test_harness,no_run
16693/// # extern crate hyper;
16694/// # extern crate hyper_rustls;
16695/// # extern crate google_tagmanager1 as tagmanager1;
16696/// # async fn dox() {
16697/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16698///
16699/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16700/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16701/// #     .with_native_roots()
16702/// #     .unwrap()
16703/// #     .https_only()
16704/// #     .enable_http2()
16705/// #     .build();
16706///
16707/// # let executor = hyper_util::rt::TokioExecutor::new();
16708/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16709/// #     secret,
16710/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16711/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16712/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16713/// #     ),
16714/// # ).build().await.unwrap();
16715///
16716/// # let client = hyper_util::client::legacy::Client::builder(
16717/// #     hyper_util::rt::TokioExecutor::new()
16718/// # )
16719/// # .build(
16720/// #     hyper_rustls::HttpsConnectorBuilder::new()
16721/// #         .with_native_roots()
16722/// #         .unwrap()
16723/// #         .https_or_http()
16724/// #         .enable_http2()
16725/// #         .build()
16726/// # );
16727/// # let mut hub = TagManager::new(client, auth);
16728/// // You can configure optional parameters by calling the respective setters at will, and
16729/// // execute the final call using `doit()`.
16730/// // Values shown here are possibly random and not representative !
16731/// let result = hub.accounts().permissions_delete("accountId", "permissionId")
16732///              .doit().await;
16733/// # }
16734/// ```
16735pub struct AccountPermissionDeleteCall<'a, C>
16736where
16737    C: 'a,
16738{
16739    hub: &'a TagManager<C>,
16740    _account_id: String,
16741    _permission_id: String,
16742    _delegate: Option<&'a mut dyn common::Delegate>,
16743    _additional_params: HashMap<String, String>,
16744    _scopes: BTreeSet<String>,
16745}
16746
16747impl<'a, C> common::CallBuilder for AccountPermissionDeleteCall<'a, C> {}
16748
16749impl<'a, C> AccountPermissionDeleteCall<'a, C>
16750where
16751    C: common::Connector,
16752{
16753    /// Perform the operation you have build so far.
16754    pub async fn doit(mut self) -> common::Result<common::Response> {
16755        use std::borrow::Cow;
16756        use std::io::{Read, Seek};
16757
16758        use common::{url::Params, ToParts};
16759        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16760
16761        let mut dd = common::DefaultDelegate;
16762        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16763        dlg.begin(common::MethodInfo {
16764            id: "tagmanager.accounts.permissions.delete",
16765            http_method: hyper::Method::DELETE,
16766        });
16767
16768        for &field in ["accountId", "permissionId"].iter() {
16769            if self._additional_params.contains_key(field) {
16770                dlg.finished(false);
16771                return Err(common::Error::FieldClash(field));
16772            }
16773        }
16774
16775        let mut params = Params::with_capacity(3 + self._additional_params.len());
16776        params.push("accountId", self._account_id);
16777        params.push("permissionId", self._permission_id);
16778
16779        params.extend(self._additional_params.iter());
16780
16781        let mut url = self.hub._base_url.clone()
16782            + "tagmanager/v1/accounts/{accountId}/permissions/{permissionId}";
16783        if self._scopes.is_empty() {
16784            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
16785        }
16786
16787        #[allow(clippy::single_element_loop)]
16788        for &(find_this, param_name) in [
16789            ("{accountId}", "accountId"),
16790            ("{permissionId}", "permissionId"),
16791        ]
16792        .iter()
16793        {
16794            url = params.uri_replacement(url, param_name, find_this, false);
16795        }
16796        {
16797            let to_remove = ["permissionId", "accountId"];
16798            params.remove_params(&to_remove);
16799        }
16800
16801        let url = params.parse_with_url(&url);
16802
16803        loop {
16804            let token = match self
16805                .hub
16806                .auth
16807                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16808                .await
16809            {
16810                Ok(token) => token,
16811                Err(e) => match dlg.token(e) {
16812                    Ok(token) => token,
16813                    Err(e) => {
16814                        dlg.finished(false);
16815                        return Err(common::Error::MissingToken(e));
16816                    }
16817                },
16818            };
16819            let mut req_result = {
16820                let client = &self.hub.client;
16821                dlg.pre_request();
16822                let mut req_builder = hyper::Request::builder()
16823                    .method(hyper::Method::DELETE)
16824                    .uri(url.as_str())
16825                    .header(USER_AGENT, self.hub._user_agent.clone());
16826
16827                if let Some(token) = token.as_ref() {
16828                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16829                }
16830
16831                let request = req_builder
16832                    .header(CONTENT_LENGTH, 0_u64)
16833                    .body(common::to_body::<String>(None));
16834
16835                client.request(request.unwrap()).await
16836            };
16837
16838            match req_result {
16839                Err(err) => {
16840                    if let common::Retry::After(d) = dlg.http_error(&err) {
16841                        sleep(d).await;
16842                        continue;
16843                    }
16844                    dlg.finished(false);
16845                    return Err(common::Error::HttpError(err));
16846                }
16847                Ok(res) => {
16848                    let (mut parts, body) = res.into_parts();
16849                    let mut body = common::Body::new(body);
16850                    if !parts.status.is_success() {
16851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16852                        let error = serde_json::from_str(&common::to_string(&bytes));
16853                        let response = common::to_response(parts, bytes.into());
16854
16855                        if let common::Retry::After(d) =
16856                            dlg.http_failure(&response, error.as_ref().ok())
16857                        {
16858                            sleep(d).await;
16859                            continue;
16860                        }
16861
16862                        dlg.finished(false);
16863
16864                        return Err(match error {
16865                            Ok(value) => common::Error::BadRequest(value),
16866                            _ => common::Error::Failure(response),
16867                        });
16868                    }
16869                    let response = common::Response::from_parts(parts, body);
16870
16871                    dlg.finished(true);
16872                    return Ok(response);
16873                }
16874            }
16875        }
16876    }
16877
16878    /// The GTM Account ID.
16879    ///
16880    /// Sets the *account id* path property to the given value.
16881    ///
16882    /// Even though the property as already been set when instantiating this call,
16883    /// we provide this method for API completeness.
16884    pub fn account_id(mut self, new_value: &str) -> AccountPermissionDeleteCall<'a, C> {
16885        self._account_id = new_value.to_string();
16886        self
16887    }
16888    /// The GTM User ID.
16889    ///
16890    /// Sets the *permission id* path property to the given value.
16891    ///
16892    /// Even though the property as already been set when instantiating this call,
16893    /// we provide this method for API completeness.
16894    pub fn permission_id(mut self, new_value: &str) -> AccountPermissionDeleteCall<'a, C> {
16895        self._permission_id = new_value.to_string();
16896        self
16897    }
16898    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16899    /// while executing the actual API request.
16900    ///
16901    /// ````text
16902    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16903    /// ````
16904    ///
16905    /// Sets the *delegate* property to the given value.
16906    pub fn delegate(
16907        mut self,
16908        new_value: &'a mut dyn common::Delegate,
16909    ) -> AccountPermissionDeleteCall<'a, C> {
16910        self._delegate = Some(new_value);
16911        self
16912    }
16913
16914    /// Set any additional parameter of the query string used in the request.
16915    /// It should be used to set parameters which are not yet available through their own
16916    /// setters.
16917    ///
16918    /// Please note that this method must not be used to set any of the known parameters
16919    /// which have their own setter method. If done anyway, the request will fail.
16920    ///
16921    /// # Additional Parameters
16922    ///
16923    /// * *$.xgafv* (query-string) - V1 error format.
16924    /// * *access_token* (query-string) - OAuth access token.
16925    /// * *alt* (query-string) - Data format for response.
16926    /// * *callback* (query-string) - JSONP
16927    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16928    /// * *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.
16929    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16930    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16931    /// * *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.
16932    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16933    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16934    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionDeleteCall<'a, C>
16935    where
16936        T: AsRef<str>,
16937    {
16938        self._additional_params
16939            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16940        self
16941    }
16942
16943    /// Identifies the authorization scope for the method you are building.
16944    ///
16945    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16946    /// [`Scope::ManageUser`].
16947    ///
16948    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16949    /// tokens for more than one scope.
16950    ///
16951    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16952    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16953    /// sufficient, a read-write scope will do as well.
16954    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionDeleteCall<'a, C>
16955    where
16956        St: AsRef<str>,
16957    {
16958        self._scopes.insert(String::from(scope.as_ref()));
16959        self
16960    }
16961    /// Identifies the authorization scope(s) for the method you are building.
16962    ///
16963    /// See [`Self::add_scope()`] for details.
16964    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionDeleteCall<'a, C>
16965    where
16966        I: IntoIterator<Item = St>,
16967        St: AsRef<str>,
16968    {
16969        self._scopes
16970            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16971        self
16972    }
16973
16974    /// Removes all scopes, and no default scope will be used either.
16975    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16976    /// for details).
16977    pub fn clear_scopes(mut self) -> AccountPermissionDeleteCall<'a, C> {
16978        self._scopes.clear();
16979        self
16980    }
16981}
16982
16983/// Gets a user's Account & Container Permissions.
16984///
16985/// A builder for the *permissions.get* method supported by a *account* resource.
16986/// It is not used directly, but through a [`AccountMethods`] instance.
16987///
16988/// # Example
16989///
16990/// Instantiate a resource method builder
16991///
16992/// ```test_harness,no_run
16993/// # extern crate hyper;
16994/// # extern crate hyper_rustls;
16995/// # extern crate google_tagmanager1 as tagmanager1;
16996/// # async fn dox() {
16997/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16998///
16999/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17000/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17001/// #     .with_native_roots()
17002/// #     .unwrap()
17003/// #     .https_only()
17004/// #     .enable_http2()
17005/// #     .build();
17006///
17007/// # let executor = hyper_util::rt::TokioExecutor::new();
17008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17009/// #     secret,
17010/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17011/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17012/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17013/// #     ),
17014/// # ).build().await.unwrap();
17015///
17016/// # let client = hyper_util::client::legacy::Client::builder(
17017/// #     hyper_util::rt::TokioExecutor::new()
17018/// # )
17019/// # .build(
17020/// #     hyper_rustls::HttpsConnectorBuilder::new()
17021/// #         .with_native_roots()
17022/// #         .unwrap()
17023/// #         .https_or_http()
17024/// #         .enable_http2()
17025/// #         .build()
17026/// # );
17027/// # let mut hub = TagManager::new(client, auth);
17028/// // You can configure optional parameters by calling the respective setters at will, and
17029/// // execute the final call using `doit()`.
17030/// // Values shown here are possibly random and not representative !
17031/// let result = hub.accounts().permissions_get("accountId", "permissionId")
17032///              .doit().await;
17033/// # }
17034/// ```
17035pub struct AccountPermissionGetCall<'a, C>
17036where
17037    C: 'a,
17038{
17039    hub: &'a TagManager<C>,
17040    _account_id: String,
17041    _permission_id: String,
17042    _delegate: Option<&'a mut dyn common::Delegate>,
17043    _additional_params: HashMap<String, String>,
17044    _scopes: BTreeSet<String>,
17045}
17046
17047impl<'a, C> common::CallBuilder for AccountPermissionGetCall<'a, C> {}
17048
17049impl<'a, C> AccountPermissionGetCall<'a, C>
17050where
17051    C: common::Connector,
17052{
17053    /// Perform the operation you have build so far.
17054    pub async fn doit(mut self) -> common::Result<(common::Response, UserAccess)> {
17055        use std::borrow::Cow;
17056        use std::io::{Read, Seek};
17057
17058        use common::{url::Params, ToParts};
17059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17060
17061        let mut dd = common::DefaultDelegate;
17062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17063        dlg.begin(common::MethodInfo {
17064            id: "tagmanager.accounts.permissions.get",
17065            http_method: hyper::Method::GET,
17066        });
17067
17068        for &field in ["alt", "accountId", "permissionId"].iter() {
17069            if self._additional_params.contains_key(field) {
17070                dlg.finished(false);
17071                return Err(common::Error::FieldClash(field));
17072            }
17073        }
17074
17075        let mut params = Params::with_capacity(4 + self._additional_params.len());
17076        params.push("accountId", self._account_id);
17077        params.push("permissionId", self._permission_id);
17078
17079        params.extend(self._additional_params.iter());
17080
17081        params.push("alt", "json");
17082        let mut url = self.hub._base_url.clone()
17083            + "tagmanager/v1/accounts/{accountId}/permissions/{permissionId}";
17084        if self._scopes.is_empty() {
17085            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
17086        }
17087
17088        #[allow(clippy::single_element_loop)]
17089        for &(find_this, param_name) in [
17090            ("{accountId}", "accountId"),
17091            ("{permissionId}", "permissionId"),
17092        ]
17093        .iter()
17094        {
17095            url = params.uri_replacement(url, param_name, find_this, false);
17096        }
17097        {
17098            let to_remove = ["permissionId", "accountId"];
17099            params.remove_params(&to_remove);
17100        }
17101
17102        let url = params.parse_with_url(&url);
17103
17104        loop {
17105            let token = match self
17106                .hub
17107                .auth
17108                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17109                .await
17110            {
17111                Ok(token) => token,
17112                Err(e) => match dlg.token(e) {
17113                    Ok(token) => token,
17114                    Err(e) => {
17115                        dlg.finished(false);
17116                        return Err(common::Error::MissingToken(e));
17117                    }
17118                },
17119            };
17120            let mut req_result = {
17121                let client = &self.hub.client;
17122                dlg.pre_request();
17123                let mut req_builder = hyper::Request::builder()
17124                    .method(hyper::Method::GET)
17125                    .uri(url.as_str())
17126                    .header(USER_AGENT, self.hub._user_agent.clone());
17127
17128                if let Some(token) = token.as_ref() {
17129                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17130                }
17131
17132                let request = req_builder
17133                    .header(CONTENT_LENGTH, 0_u64)
17134                    .body(common::to_body::<String>(None));
17135
17136                client.request(request.unwrap()).await
17137            };
17138
17139            match req_result {
17140                Err(err) => {
17141                    if let common::Retry::After(d) = dlg.http_error(&err) {
17142                        sleep(d).await;
17143                        continue;
17144                    }
17145                    dlg.finished(false);
17146                    return Err(common::Error::HttpError(err));
17147                }
17148                Ok(res) => {
17149                    let (mut parts, body) = res.into_parts();
17150                    let mut body = common::Body::new(body);
17151                    if !parts.status.is_success() {
17152                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17153                        let error = serde_json::from_str(&common::to_string(&bytes));
17154                        let response = common::to_response(parts, bytes.into());
17155
17156                        if let common::Retry::After(d) =
17157                            dlg.http_failure(&response, error.as_ref().ok())
17158                        {
17159                            sleep(d).await;
17160                            continue;
17161                        }
17162
17163                        dlg.finished(false);
17164
17165                        return Err(match error {
17166                            Ok(value) => common::Error::BadRequest(value),
17167                            _ => common::Error::Failure(response),
17168                        });
17169                    }
17170                    let response = {
17171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17172                        let encoded = common::to_string(&bytes);
17173                        match serde_json::from_str(&encoded) {
17174                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17175                            Err(error) => {
17176                                dlg.response_json_decode_error(&encoded, &error);
17177                                return Err(common::Error::JsonDecodeError(
17178                                    encoded.to_string(),
17179                                    error,
17180                                ));
17181                            }
17182                        }
17183                    };
17184
17185                    dlg.finished(true);
17186                    return Ok(response);
17187                }
17188            }
17189        }
17190    }
17191
17192    /// The GTM Account ID.
17193    ///
17194    /// Sets the *account id* path property to the given value.
17195    ///
17196    /// Even though the property as already been set when instantiating this call,
17197    /// we provide this method for API completeness.
17198    pub fn account_id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C> {
17199        self._account_id = new_value.to_string();
17200        self
17201    }
17202    /// The GTM User ID.
17203    ///
17204    /// Sets the *permission id* path property to the given value.
17205    ///
17206    /// Even though the property as already been set when instantiating this call,
17207    /// we provide this method for API completeness.
17208    pub fn permission_id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C> {
17209        self._permission_id = new_value.to_string();
17210        self
17211    }
17212    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17213    /// while executing the actual API request.
17214    ///
17215    /// ````text
17216    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17217    /// ````
17218    ///
17219    /// Sets the *delegate* property to the given value.
17220    pub fn delegate(
17221        mut self,
17222        new_value: &'a mut dyn common::Delegate,
17223    ) -> AccountPermissionGetCall<'a, C> {
17224        self._delegate = Some(new_value);
17225        self
17226    }
17227
17228    /// Set any additional parameter of the query string used in the request.
17229    /// It should be used to set parameters which are not yet available through their own
17230    /// setters.
17231    ///
17232    /// Please note that this method must not be used to set any of the known parameters
17233    /// which have their own setter method. If done anyway, the request will fail.
17234    ///
17235    /// # Additional Parameters
17236    ///
17237    /// * *$.xgafv* (query-string) - V1 error format.
17238    /// * *access_token* (query-string) - OAuth access token.
17239    /// * *alt* (query-string) - Data format for response.
17240    /// * *callback* (query-string) - JSONP
17241    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17242    /// * *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.
17243    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17244    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17245    /// * *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.
17246    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17247    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17248    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionGetCall<'a, C>
17249    where
17250        T: AsRef<str>,
17251    {
17252        self._additional_params
17253            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17254        self
17255    }
17256
17257    /// Identifies the authorization scope for the method you are building.
17258    ///
17259    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17260    /// [`Scope::ManageUser`].
17261    ///
17262    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17263    /// tokens for more than one scope.
17264    ///
17265    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17266    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17267    /// sufficient, a read-write scope will do as well.
17268    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionGetCall<'a, C>
17269    where
17270        St: AsRef<str>,
17271    {
17272        self._scopes.insert(String::from(scope.as_ref()));
17273        self
17274    }
17275    /// Identifies the authorization scope(s) for the method you are building.
17276    ///
17277    /// See [`Self::add_scope()`] for details.
17278    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionGetCall<'a, C>
17279    where
17280        I: IntoIterator<Item = St>,
17281        St: AsRef<str>,
17282    {
17283        self._scopes
17284            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17285        self
17286    }
17287
17288    /// Removes all scopes, and no default scope will be used either.
17289    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17290    /// for details).
17291    pub fn clear_scopes(mut self) -> AccountPermissionGetCall<'a, C> {
17292        self._scopes.clear();
17293        self
17294    }
17295}
17296
17297/// List all users that have access to the account along with Account and Container Permissions granted to each of them.
17298///
17299/// A builder for the *permissions.list* method supported by a *account* resource.
17300/// It is not used directly, but through a [`AccountMethods`] instance.
17301///
17302/// # Example
17303///
17304/// Instantiate a resource method builder
17305///
17306/// ```test_harness,no_run
17307/// # extern crate hyper;
17308/// # extern crate hyper_rustls;
17309/// # extern crate google_tagmanager1 as tagmanager1;
17310/// # async fn dox() {
17311/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17312///
17313/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17314/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17315/// #     .with_native_roots()
17316/// #     .unwrap()
17317/// #     .https_only()
17318/// #     .enable_http2()
17319/// #     .build();
17320///
17321/// # let executor = hyper_util::rt::TokioExecutor::new();
17322/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17323/// #     secret,
17324/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17325/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17326/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17327/// #     ),
17328/// # ).build().await.unwrap();
17329///
17330/// # let client = hyper_util::client::legacy::Client::builder(
17331/// #     hyper_util::rt::TokioExecutor::new()
17332/// # )
17333/// # .build(
17334/// #     hyper_rustls::HttpsConnectorBuilder::new()
17335/// #         .with_native_roots()
17336/// #         .unwrap()
17337/// #         .https_or_http()
17338/// #         .enable_http2()
17339/// #         .build()
17340/// # );
17341/// # let mut hub = TagManager::new(client, auth);
17342/// // You can configure optional parameters by calling the respective setters at will, and
17343/// // execute the final call using `doit()`.
17344/// // Values shown here are possibly random and not representative !
17345/// let result = hub.accounts().permissions_list("accountId")
17346///              .doit().await;
17347/// # }
17348/// ```
17349pub struct AccountPermissionListCall<'a, C>
17350where
17351    C: 'a,
17352{
17353    hub: &'a TagManager<C>,
17354    _account_id: String,
17355    _delegate: Option<&'a mut dyn common::Delegate>,
17356    _additional_params: HashMap<String, String>,
17357    _scopes: BTreeSet<String>,
17358}
17359
17360impl<'a, C> common::CallBuilder for AccountPermissionListCall<'a, C> {}
17361
17362impl<'a, C> AccountPermissionListCall<'a, C>
17363where
17364    C: common::Connector,
17365{
17366    /// Perform the operation you have build so far.
17367    pub async fn doit(mut self) -> common::Result<(common::Response, ListAccountUsersResponse)> {
17368        use std::borrow::Cow;
17369        use std::io::{Read, Seek};
17370
17371        use common::{url::Params, ToParts};
17372        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17373
17374        let mut dd = common::DefaultDelegate;
17375        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17376        dlg.begin(common::MethodInfo {
17377            id: "tagmanager.accounts.permissions.list",
17378            http_method: hyper::Method::GET,
17379        });
17380
17381        for &field in ["alt", "accountId"].iter() {
17382            if self._additional_params.contains_key(field) {
17383                dlg.finished(false);
17384                return Err(common::Error::FieldClash(field));
17385            }
17386        }
17387
17388        let mut params = Params::with_capacity(3 + self._additional_params.len());
17389        params.push("accountId", self._account_id);
17390
17391        params.extend(self._additional_params.iter());
17392
17393        params.push("alt", "json");
17394        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}/permissions";
17395        if self._scopes.is_empty() {
17396            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
17397        }
17398
17399        #[allow(clippy::single_element_loop)]
17400        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
17401            url = params.uri_replacement(url, param_name, find_this, false);
17402        }
17403        {
17404            let to_remove = ["accountId"];
17405            params.remove_params(&to_remove);
17406        }
17407
17408        let url = params.parse_with_url(&url);
17409
17410        loop {
17411            let token = match self
17412                .hub
17413                .auth
17414                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17415                .await
17416            {
17417                Ok(token) => token,
17418                Err(e) => match dlg.token(e) {
17419                    Ok(token) => token,
17420                    Err(e) => {
17421                        dlg.finished(false);
17422                        return Err(common::Error::MissingToken(e));
17423                    }
17424                },
17425            };
17426            let mut req_result = {
17427                let client = &self.hub.client;
17428                dlg.pre_request();
17429                let mut req_builder = hyper::Request::builder()
17430                    .method(hyper::Method::GET)
17431                    .uri(url.as_str())
17432                    .header(USER_AGENT, self.hub._user_agent.clone());
17433
17434                if let Some(token) = token.as_ref() {
17435                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17436                }
17437
17438                let request = req_builder
17439                    .header(CONTENT_LENGTH, 0_u64)
17440                    .body(common::to_body::<String>(None));
17441
17442                client.request(request.unwrap()).await
17443            };
17444
17445            match req_result {
17446                Err(err) => {
17447                    if let common::Retry::After(d) = dlg.http_error(&err) {
17448                        sleep(d).await;
17449                        continue;
17450                    }
17451                    dlg.finished(false);
17452                    return Err(common::Error::HttpError(err));
17453                }
17454                Ok(res) => {
17455                    let (mut parts, body) = res.into_parts();
17456                    let mut body = common::Body::new(body);
17457                    if !parts.status.is_success() {
17458                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17459                        let error = serde_json::from_str(&common::to_string(&bytes));
17460                        let response = common::to_response(parts, bytes.into());
17461
17462                        if let common::Retry::After(d) =
17463                            dlg.http_failure(&response, error.as_ref().ok())
17464                        {
17465                            sleep(d).await;
17466                            continue;
17467                        }
17468
17469                        dlg.finished(false);
17470
17471                        return Err(match error {
17472                            Ok(value) => common::Error::BadRequest(value),
17473                            _ => common::Error::Failure(response),
17474                        });
17475                    }
17476                    let response = {
17477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17478                        let encoded = common::to_string(&bytes);
17479                        match serde_json::from_str(&encoded) {
17480                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17481                            Err(error) => {
17482                                dlg.response_json_decode_error(&encoded, &error);
17483                                return Err(common::Error::JsonDecodeError(
17484                                    encoded.to_string(),
17485                                    error,
17486                                ));
17487                            }
17488                        }
17489                    };
17490
17491                    dlg.finished(true);
17492                    return Ok(response);
17493                }
17494            }
17495        }
17496    }
17497
17498    /// The GTM Account ID.
17499    ///
17500    /// Sets the *account id* path property to the given value.
17501    ///
17502    /// Even though the property as already been set when instantiating this call,
17503    /// we provide this method for API completeness.
17504    pub fn account_id(mut self, new_value: &str) -> AccountPermissionListCall<'a, C> {
17505        self._account_id = new_value.to_string();
17506        self
17507    }
17508    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17509    /// while executing the actual API request.
17510    ///
17511    /// ````text
17512    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17513    /// ````
17514    ///
17515    /// Sets the *delegate* property to the given value.
17516    pub fn delegate(
17517        mut self,
17518        new_value: &'a mut dyn common::Delegate,
17519    ) -> AccountPermissionListCall<'a, C> {
17520        self._delegate = Some(new_value);
17521        self
17522    }
17523
17524    /// Set any additional parameter of the query string used in the request.
17525    /// It should be used to set parameters which are not yet available through their own
17526    /// setters.
17527    ///
17528    /// Please note that this method must not be used to set any of the known parameters
17529    /// which have their own setter method. If done anyway, the request will fail.
17530    ///
17531    /// # Additional Parameters
17532    ///
17533    /// * *$.xgafv* (query-string) - V1 error format.
17534    /// * *access_token* (query-string) - OAuth access token.
17535    /// * *alt* (query-string) - Data format for response.
17536    /// * *callback* (query-string) - JSONP
17537    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17538    /// * *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.
17539    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17540    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17541    /// * *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.
17542    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17543    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17544    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionListCall<'a, C>
17545    where
17546        T: AsRef<str>,
17547    {
17548        self._additional_params
17549            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17550        self
17551    }
17552
17553    /// Identifies the authorization scope for the method you are building.
17554    ///
17555    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17556    /// [`Scope::ManageUser`].
17557    ///
17558    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17559    /// tokens for more than one scope.
17560    ///
17561    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17562    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17563    /// sufficient, a read-write scope will do as well.
17564    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionListCall<'a, C>
17565    where
17566        St: AsRef<str>,
17567    {
17568        self._scopes.insert(String::from(scope.as_ref()));
17569        self
17570    }
17571    /// Identifies the authorization scope(s) for the method you are building.
17572    ///
17573    /// See [`Self::add_scope()`] for details.
17574    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionListCall<'a, C>
17575    where
17576        I: IntoIterator<Item = St>,
17577        St: AsRef<str>,
17578    {
17579        self._scopes
17580            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17581        self
17582    }
17583
17584    /// Removes all scopes, and no default scope will be used either.
17585    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17586    /// for details).
17587    pub fn clear_scopes(mut self) -> AccountPermissionListCall<'a, C> {
17588        self._scopes.clear();
17589        self
17590    }
17591}
17592
17593/// Updates a user's Account & Container Permissions.
17594///
17595/// A builder for the *permissions.update* method supported by a *account* resource.
17596/// It is not used directly, but through a [`AccountMethods`] instance.
17597///
17598/// # Example
17599///
17600/// Instantiate a resource method builder
17601///
17602/// ```test_harness,no_run
17603/// # extern crate hyper;
17604/// # extern crate hyper_rustls;
17605/// # extern crate google_tagmanager1 as tagmanager1;
17606/// use tagmanager1::api::UserAccess;
17607/// # async fn dox() {
17608/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17609///
17610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17612/// #     .with_native_roots()
17613/// #     .unwrap()
17614/// #     .https_only()
17615/// #     .enable_http2()
17616/// #     .build();
17617///
17618/// # let executor = hyper_util::rt::TokioExecutor::new();
17619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17620/// #     secret,
17621/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17622/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17623/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17624/// #     ),
17625/// # ).build().await.unwrap();
17626///
17627/// # let client = hyper_util::client::legacy::Client::builder(
17628/// #     hyper_util::rt::TokioExecutor::new()
17629/// # )
17630/// # .build(
17631/// #     hyper_rustls::HttpsConnectorBuilder::new()
17632/// #         .with_native_roots()
17633/// #         .unwrap()
17634/// #         .https_or_http()
17635/// #         .enable_http2()
17636/// #         .build()
17637/// # );
17638/// # let mut hub = TagManager::new(client, auth);
17639/// // As the method needs a request, you would usually fill it with the desired information
17640/// // into the respective structure. Some of the parts shown here might not be applicable !
17641/// // Values shown here are possibly random and not representative !
17642/// let mut req = UserAccess::default();
17643///
17644/// // You can configure optional parameters by calling the respective setters at will, and
17645/// // execute the final call using `doit()`.
17646/// // Values shown here are possibly random and not representative !
17647/// let result = hub.accounts().permissions_update(req, "accountId", "permissionId")
17648///              .doit().await;
17649/// # }
17650/// ```
17651pub struct AccountPermissionUpdateCall<'a, C>
17652where
17653    C: 'a,
17654{
17655    hub: &'a TagManager<C>,
17656    _request: UserAccess,
17657    _account_id: String,
17658    _permission_id: String,
17659    _delegate: Option<&'a mut dyn common::Delegate>,
17660    _additional_params: HashMap<String, String>,
17661    _scopes: BTreeSet<String>,
17662}
17663
17664impl<'a, C> common::CallBuilder for AccountPermissionUpdateCall<'a, C> {}
17665
17666impl<'a, C> AccountPermissionUpdateCall<'a, C>
17667where
17668    C: common::Connector,
17669{
17670    /// Perform the operation you have build so far.
17671    pub async fn doit(mut self) -> common::Result<(common::Response, UserAccess)> {
17672        use std::borrow::Cow;
17673        use std::io::{Read, Seek};
17674
17675        use common::{url::Params, ToParts};
17676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17677
17678        let mut dd = common::DefaultDelegate;
17679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17680        dlg.begin(common::MethodInfo {
17681            id: "tagmanager.accounts.permissions.update",
17682            http_method: hyper::Method::PUT,
17683        });
17684
17685        for &field in ["alt", "accountId", "permissionId"].iter() {
17686            if self._additional_params.contains_key(field) {
17687                dlg.finished(false);
17688                return Err(common::Error::FieldClash(field));
17689            }
17690        }
17691
17692        let mut params = Params::with_capacity(5 + self._additional_params.len());
17693        params.push("accountId", self._account_id);
17694        params.push("permissionId", self._permission_id);
17695
17696        params.extend(self._additional_params.iter());
17697
17698        params.push("alt", "json");
17699        let mut url = self.hub._base_url.clone()
17700            + "tagmanager/v1/accounts/{accountId}/permissions/{permissionId}";
17701        if self._scopes.is_empty() {
17702            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
17703        }
17704
17705        #[allow(clippy::single_element_loop)]
17706        for &(find_this, param_name) in [
17707            ("{accountId}", "accountId"),
17708            ("{permissionId}", "permissionId"),
17709        ]
17710        .iter()
17711        {
17712            url = params.uri_replacement(url, param_name, find_this, false);
17713        }
17714        {
17715            let to_remove = ["permissionId", "accountId"];
17716            params.remove_params(&to_remove);
17717        }
17718
17719        let url = params.parse_with_url(&url);
17720
17721        let mut json_mime_type = mime::APPLICATION_JSON;
17722        let mut request_value_reader = {
17723            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17724            common::remove_json_null_values(&mut value);
17725            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17726            serde_json::to_writer(&mut dst, &value).unwrap();
17727            dst
17728        };
17729        let request_size = request_value_reader
17730            .seek(std::io::SeekFrom::End(0))
17731            .unwrap();
17732        request_value_reader
17733            .seek(std::io::SeekFrom::Start(0))
17734            .unwrap();
17735
17736        loop {
17737            let token = match self
17738                .hub
17739                .auth
17740                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17741                .await
17742            {
17743                Ok(token) => token,
17744                Err(e) => match dlg.token(e) {
17745                    Ok(token) => token,
17746                    Err(e) => {
17747                        dlg.finished(false);
17748                        return Err(common::Error::MissingToken(e));
17749                    }
17750                },
17751            };
17752            request_value_reader
17753                .seek(std::io::SeekFrom::Start(0))
17754                .unwrap();
17755            let mut req_result = {
17756                let client = &self.hub.client;
17757                dlg.pre_request();
17758                let mut req_builder = hyper::Request::builder()
17759                    .method(hyper::Method::PUT)
17760                    .uri(url.as_str())
17761                    .header(USER_AGENT, self.hub._user_agent.clone());
17762
17763                if let Some(token) = token.as_ref() {
17764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17765                }
17766
17767                let request = req_builder
17768                    .header(CONTENT_TYPE, json_mime_type.to_string())
17769                    .header(CONTENT_LENGTH, request_size as u64)
17770                    .body(common::to_body(
17771                        request_value_reader.get_ref().clone().into(),
17772                    ));
17773
17774                client.request(request.unwrap()).await
17775            };
17776
17777            match req_result {
17778                Err(err) => {
17779                    if let common::Retry::After(d) = dlg.http_error(&err) {
17780                        sleep(d).await;
17781                        continue;
17782                    }
17783                    dlg.finished(false);
17784                    return Err(common::Error::HttpError(err));
17785                }
17786                Ok(res) => {
17787                    let (mut parts, body) = res.into_parts();
17788                    let mut body = common::Body::new(body);
17789                    if !parts.status.is_success() {
17790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17791                        let error = serde_json::from_str(&common::to_string(&bytes));
17792                        let response = common::to_response(parts, bytes.into());
17793
17794                        if let common::Retry::After(d) =
17795                            dlg.http_failure(&response, error.as_ref().ok())
17796                        {
17797                            sleep(d).await;
17798                            continue;
17799                        }
17800
17801                        dlg.finished(false);
17802
17803                        return Err(match error {
17804                            Ok(value) => common::Error::BadRequest(value),
17805                            _ => common::Error::Failure(response),
17806                        });
17807                    }
17808                    let response = {
17809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17810                        let encoded = common::to_string(&bytes);
17811                        match serde_json::from_str(&encoded) {
17812                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17813                            Err(error) => {
17814                                dlg.response_json_decode_error(&encoded, &error);
17815                                return Err(common::Error::JsonDecodeError(
17816                                    encoded.to_string(),
17817                                    error,
17818                                ));
17819                            }
17820                        }
17821                    };
17822
17823                    dlg.finished(true);
17824                    return Ok(response);
17825                }
17826            }
17827        }
17828    }
17829
17830    ///
17831    /// Sets the *request* property to the given value.
17832    ///
17833    /// Even though the property as already been set when instantiating this call,
17834    /// we provide this method for API completeness.
17835    pub fn request(mut self, new_value: UserAccess) -> AccountPermissionUpdateCall<'a, C> {
17836        self._request = new_value;
17837        self
17838    }
17839    /// The GTM Account ID.
17840    ///
17841    /// Sets the *account id* path property to the given value.
17842    ///
17843    /// Even though the property as already been set when instantiating this call,
17844    /// we provide this method for API completeness.
17845    pub fn account_id(mut self, new_value: &str) -> AccountPermissionUpdateCall<'a, C> {
17846        self._account_id = new_value.to_string();
17847        self
17848    }
17849    /// The GTM User ID.
17850    ///
17851    /// Sets the *permission id* path property to the given value.
17852    ///
17853    /// Even though the property as already been set when instantiating this call,
17854    /// we provide this method for API completeness.
17855    pub fn permission_id(mut self, new_value: &str) -> AccountPermissionUpdateCall<'a, C> {
17856        self._permission_id = new_value.to_string();
17857        self
17858    }
17859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17860    /// while executing the actual API request.
17861    ///
17862    /// ````text
17863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17864    /// ````
17865    ///
17866    /// Sets the *delegate* property to the given value.
17867    pub fn delegate(
17868        mut self,
17869        new_value: &'a mut dyn common::Delegate,
17870    ) -> AccountPermissionUpdateCall<'a, C> {
17871        self._delegate = Some(new_value);
17872        self
17873    }
17874
17875    /// Set any additional parameter of the query string used in the request.
17876    /// It should be used to set parameters which are not yet available through their own
17877    /// setters.
17878    ///
17879    /// Please note that this method must not be used to set any of the known parameters
17880    /// which have their own setter method. If done anyway, the request will fail.
17881    ///
17882    /// # Additional Parameters
17883    ///
17884    /// * *$.xgafv* (query-string) - V1 error format.
17885    /// * *access_token* (query-string) - OAuth access token.
17886    /// * *alt* (query-string) - Data format for response.
17887    /// * *callback* (query-string) - JSONP
17888    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17889    /// * *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.
17890    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17891    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17892    /// * *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.
17893    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17894    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17895    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionUpdateCall<'a, C>
17896    where
17897        T: AsRef<str>,
17898    {
17899        self._additional_params
17900            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17901        self
17902    }
17903
17904    /// Identifies the authorization scope for the method you are building.
17905    ///
17906    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17907    /// [`Scope::ManageUser`].
17908    ///
17909    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17910    /// tokens for more than one scope.
17911    ///
17912    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17913    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17914    /// sufficient, a read-write scope will do as well.
17915    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionUpdateCall<'a, C>
17916    where
17917        St: AsRef<str>,
17918    {
17919        self._scopes.insert(String::from(scope.as_ref()));
17920        self
17921    }
17922    /// Identifies the authorization scope(s) for the method you are building.
17923    ///
17924    /// See [`Self::add_scope()`] for details.
17925    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionUpdateCall<'a, C>
17926    where
17927        I: IntoIterator<Item = St>,
17928        St: AsRef<str>,
17929    {
17930        self._scopes
17931            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17932        self
17933    }
17934
17935    /// Removes all scopes, and no default scope will be used either.
17936    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17937    /// for details).
17938    pub fn clear_scopes(mut self) -> AccountPermissionUpdateCall<'a, C> {
17939        self._scopes.clear();
17940        self
17941    }
17942}
17943
17944/// Gets a GTM Account.
17945///
17946/// A builder for the *get* method supported by a *account* resource.
17947/// It is not used directly, but through a [`AccountMethods`] instance.
17948///
17949/// # Example
17950///
17951/// Instantiate a resource method builder
17952///
17953/// ```test_harness,no_run
17954/// # extern crate hyper;
17955/// # extern crate hyper_rustls;
17956/// # extern crate google_tagmanager1 as tagmanager1;
17957/// # async fn dox() {
17958/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17959///
17960/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17961/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17962/// #     .with_native_roots()
17963/// #     .unwrap()
17964/// #     .https_only()
17965/// #     .enable_http2()
17966/// #     .build();
17967///
17968/// # let executor = hyper_util::rt::TokioExecutor::new();
17969/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17970/// #     secret,
17971/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17972/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17973/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17974/// #     ),
17975/// # ).build().await.unwrap();
17976///
17977/// # let client = hyper_util::client::legacy::Client::builder(
17978/// #     hyper_util::rt::TokioExecutor::new()
17979/// # )
17980/// # .build(
17981/// #     hyper_rustls::HttpsConnectorBuilder::new()
17982/// #         .with_native_roots()
17983/// #         .unwrap()
17984/// #         .https_or_http()
17985/// #         .enable_http2()
17986/// #         .build()
17987/// # );
17988/// # let mut hub = TagManager::new(client, auth);
17989/// // You can configure optional parameters by calling the respective setters at will, and
17990/// // execute the final call using `doit()`.
17991/// // Values shown here are possibly random and not representative !
17992/// let result = hub.accounts().get("accountId")
17993///              .doit().await;
17994/// # }
17995/// ```
17996pub struct AccountGetCall<'a, C>
17997where
17998    C: 'a,
17999{
18000    hub: &'a TagManager<C>,
18001    _account_id: String,
18002    _delegate: Option<&'a mut dyn common::Delegate>,
18003    _additional_params: HashMap<String, String>,
18004    _scopes: BTreeSet<String>,
18005}
18006
18007impl<'a, C> common::CallBuilder for AccountGetCall<'a, C> {}
18008
18009impl<'a, C> AccountGetCall<'a, C>
18010where
18011    C: common::Connector,
18012{
18013    /// Perform the operation you have build so far.
18014    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
18015        use std::borrow::Cow;
18016        use std::io::{Read, Seek};
18017
18018        use common::{url::Params, ToParts};
18019        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18020
18021        let mut dd = common::DefaultDelegate;
18022        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18023        dlg.begin(common::MethodInfo {
18024            id: "tagmanager.accounts.get",
18025            http_method: hyper::Method::GET,
18026        });
18027
18028        for &field in ["alt", "accountId"].iter() {
18029            if self._additional_params.contains_key(field) {
18030                dlg.finished(false);
18031                return Err(common::Error::FieldClash(field));
18032            }
18033        }
18034
18035        let mut params = Params::with_capacity(3 + self._additional_params.len());
18036        params.push("accountId", self._account_id);
18037
18038        params.extend(self._additional_params.iter());
18039
18040        params.push("alt", "json");
18041        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}";
18042        if self._scopes.is_empty() {
18043            self._scopes.insert(Scope::Readonly.as_ref().to_string());
18044        }
18045
18046        #[allow(clippy::single_element_loop)]
18047        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
18048            url = params.uri_replacement(url, param_name, find_this, false);
18049        }
18050        {
18051            let to_remove = ["accountId"];
18052            params.remove_params(&to_remove);
18053        }
18054
18055        let url = params.parse_with_url(&url);
18056
18057        loop {
18058            let token = match self
18059                .hub
18060                .auth
18061                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18062                .await
18063            {
18064                Ok(token) => token,
18065                Err(e) => match dlg.token(e) {
18066                    Ok(token) => token,
18067                    Err(e) => {
18068                        dlg.finished(false);
18069                        return Err(common::Error::MissingToken(e));
18070                    }
18071                },
18072            };
18073            let mut req_result = {
18074                let client = &self.hub.client;
18075                dlg.pre_request();
18076                let mut req_builder = hyper::Request::builder()
18077                    .method(hyper::Method::GET)
18078                    .uri(url.as_str())
18079                    .header(USER_AGENT, self.hub._user_agent.clone());
18080
18081                if let Some(token) = token.as_ref() {
18082                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18083                }
18084
18085                let request = req_builder
18086                    .header(CONTENT_LENGTH, 0_u64)
18087                    .body(common::to_body::<String>(None));
18088
18089                client.request(request.unwrap()).await
18090            };
18091
18092            match req_result {
18093                Err(err) => {
18094                    if let common::Retry::After(d) = dlg.http_error(&err) {
18095                        sleep(d).await;
18096                        continue;
18097                    }
18098                    dlg.finished(false);
18099                    return Err(common::Error::HttpError(err));
18100                }
18101                Ok(res) => {
18102                    let (mut parts, body) = res.into_parts();
18103                    let mut body = common::Body::new(body);
18104                    if !parts.status.is_success() {
18105                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18106                        let error = serde_json::from_str(&common::to_string(&bytes));
18107                        let response = common::to_response(parts, bytes.into());
18108
18109                        if let common::Retry::After(d) =
18110                            dlg.http_failure(&response, error.as_ref().ok())
18111                        {
18112                            sleep(d).await;
18113                            continue;
18114                        }
18115
18116                        dlg.finished(false);
18117
18118                        return Err(match error {
18119                            Ok(value) => common::Error::BadRequest(value),
18120                            _ => common::Error::Failure(response),
18121                        });
18122                    }
18123                    let response = {
18124                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18125                        let encoded = common::to_string(&bytes);
18126                        match serde_json::from_str(&encoded) {
18127                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18128                            Err(error) => {
18129                                dlg.response_json_decode_error(&encoded, &error);
18130                                return Err(common::Error::JsonDecodeError(
18131                                    encoded.to_string(),
18132                                    error,
18133                                ));
18134                            }
18135                        }
18136                    };
18137
18138                    dlg.finished(true);
18139                    return Ok(response);
18140                }
18141            }
18142        }
18143    }
18144
18145    /// The GTM Account ID.
18146    ///
18147    /// Sets the *account id* path property to the given value.
18148    ///
18149    /// Even though the property as already been set when instantiating this call,
18150    /// we provide this method for API completeness.
18151    pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C> {
18152        self._account_id = new_value.to_string();
18153        self
18154    }
18155    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18156    /// while executing the actual API request.
18157    ///
18158    /// ````text
18159    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18160    /// ````
18161    ///
18162    /// Sets the *delegate* property to the given value.
18163    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountGetCall<'a, C> {
18164        self._delegate = Some(new_value);
18165        self
18166    }
18167
18168    /// Set any additional parameter of the query string used in the request.
18169    /// It should be used to set parameters which are not yet available through their own
18170    /// setters.
18171    ///
18172    /// Please note that this method must not be used to set any of the known parameters
18173    /// which have their own setter method. If done anyway, the request will fail.
18174    ///
18175    /// # Additional Parameters
18176    ///
18177    /// * *$.xgafv* (query-string) - V1 error format.
18178    /// * *access_token* (query-string) - OAuth access token.
18179    /// * *alt* (query-string) - Data format for response.
18180    /// * *callback* (query-string) - JSONP
18181    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18182    /// * *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.
18183    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18184    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18185    /// * *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.
18186    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18187    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18188    pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, C>
18189    where
18190        T: AsRef<str>,
18191    {
18192        self._additional_params
18193            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18194        self
18195    }
18196
18197    /// Identifies the authorization scope for the method you are building.
18198    ///
18199    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18200    /// [`Scope::Readonly`].
18201    ///
18202    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18203    /// tokens for more than one scope.
18204    ///
18205    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18206    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18207    /// sufficient, a read-write scope will do as well.
18208    pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, C>
18209    where
18210        St: AsRef<str>,
18211    {
18212        self._scopes.insert(String::from(scope.as_ref()));
18213        self
18214    }
18215    /// Identifies the authorization scope(s) for the method you are building.
18216    ///
18217    /// See [`Self::add_scope()`] for details.
18218    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, C>
18219    where
18220        I: IntoIterator<Item = St>,
18221        St: AsRef<str>,
18222    {
18223        self._scopes
18224            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18225        self
18226    }
18227
18228    /// Removes all scopes, and no default scope will be used either.
18229    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18230    /// for details).
18231    pub fn clear_scopes(mut self) -> AccountGetCall<'a, C> {
18232        self._scopes.clear();
18233        self
18234    }
18235}
18236
18237/// Lists all GTM Accounts that a user has access to.
18238///
18239/// A builder for the *list* method supported by a *account* resource.
18240/// It is not used directly, but through a [`AccountMethods`] instance.
18241///
18242/// # Example
18243///
18244/// Instantiate a resource method builder
18245///
18246/// ```test_harness,no_run
18247/// # extern crate hyper;
18248/// # extern crate hyper_rustls;
18249/// # extern crate google_tagmanager1 as tagmanager1;
18250/// # async fn dox() {
18251/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18252///
18253/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18254/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18255/// #     .with_native_roots()
18256/// #     .unwrap()
18257/// #     .https_only()
18258/// #     .enable_http2()
18259/// #     .build();
18260///
18261/// # let executor = hyper_util::rt::TokioExecutor::new();
18262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18263/// #     secret,
18264/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18265/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18266/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18267/// #     ),
18268/// # ).build().await.unwrap();
18269///
18270/// # let client = hyper_util::client::legacy::Client::builder(
18271/// #     hyper_util::rt::TokioExecutor::new()
18272/// # )
18273/// # .build(
18274/// #     hyper_rustls::HttpsConnectorBuilder::new()
18275/// #         .with_native_roots()
18276/// #         .unwrap()
18277/// #         .https_or_http()
18278/// #         .enable_http2()
18279/// #         .build()
18280/// # );
18281/// # let mut hub = TagManager::new(client, auth);
18282/// // You can configure optional parameters by calling the respective setters at will, and
18283/// // execute the final call using `doit()`.
18284/// // Values shown here are possibly random and not representative !
18285/// let result = hub.accounts().list()
18286///              .doit().await;
18287/// # }
18288/// ```
18289pub struct AccountListCall<'a, C>
18290where
18291    C: 'a,
18292{
18293    hub: &'a TagManager<C>,
18294    _delegate: Option<&'a mut dyn common::Delegate>,
18295    _additional_params: HashMap<String, String>,
18296    _scopes: BTreeSet<String>,
18297}
18298
18299impl<'a, C> common::CallBuilder for AccountListCall<'a, C> {}
18300
18301impl<'a, C> AccountListCall<'a, C>
18302where
18303    C: common::Connector,
18304{
18305    /// Perform the operation you have build so far.
18306    pub async fn doit(mut self) -> common::Result<(common::Response, ListAccountsResponse)> {
18307        use std::borrow::Cow;
18308        use std::io::{Read, Seek};
18309
18310        use common::{url::Params, ToParts};
18311        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18312
18313        let mut dd = common::DefaultDelegate;
18314        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18315        dlg.begin(common::MethodInfo {
18316            id: "tagmanager.accounts.list",
18317            http_method: hyper::Method::GET,
18318        });
18319
18320        for &field in ["alt"].iter() {
18321            if self._additional_params.contains_key(field) {
18322                dlg.finished(false);
18323                return Err(common::Error::FieldClash(field));
18324            }
18325        }
18326
18327        let mut params = Params::with_capacity(2 + self._additional_params.len());
18328
18329        params.extend(self._additional_params.iter());
18330
18331        params.push("alt", "json");
18332        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts";
18333        if self._scopes.is_empty() {
18334            self._scopes.insert(Scope::Readonly.as_ref().to_string());
18335        }
18336
18337        let url = params.parse_with_url(&url);
18338
18339        loop {
18340            let token = match self
18341                .hub
18342                .auth
18343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18344                .await
18345            {
18346                Ok(token) => token,
18347                Err(e) => match dlg.token(e) {
18348                    Ok(token) => token,
18349                    Err(e) => {
18350                        dlg.finished(false);
18351                        return Err(common::Error::MissingToken(e));
18352                    }
18353                },
18354            };
18355            let mut req_result = {
18356                let client = &self.hub.client;
18357                dlg.pre_request();
18358                let mut req_builder = hyper::Request::builder()
18359                    .method(hyper::Method::GET)
18360                    .uri(url.as_str())
18361                    .header(USER_AGENT, self.hub._user_agent.clone());
18362
18363                if let Some(token) = token.as_ref() {
18364                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18365                }
18366
18367                let request = req_builder
18368                    .header(CONTENT_LENGTH, 0_u64)
18369                    .body(common::to_body::<String>(None));
18370
18371                client.request(request.unwrap()).await
18372            };
18373
18374            match req_result {
18375                Err(err) => {
18376                    if let common::Retry::After(d) = dlg.http_error(&err) {
18377                        sleep(d).await;
18378                        continue;
18379                    }
18380                    dlg.finished(false);
18381                    return Err(common::Error::HttpError(err));
18382                }
18383                Ok(res) => {
18384                    let (mut parts, body) = res.into_parts();
18385                    let mut body = common::Body::new(body);
18386                    if !parts.status.is_success() {
18387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18388                        let error = serde_json::from_str(&common::to_string(&bytes));
18389                        let response = common::to_response(parts, bytes.into());
18390
18391                        if let common::Retry::After(d) =
18392                            dlg.http_failure(&response, error.as_ref().ok())
18393                        {
18394                            sleep(d).await;
18395                            continue;
18396                        }
18397
18398                        dlg.finished(false);
18399
18400                        return Err(match error {
18401                            Ok(value) => common::Error::BadRequest(value),
18402                            _ => common::Error::Failure(response),
18403                        });
18404                    }
18405                    let response = {
18406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18407                        let encoded = common::to_string(&bytes);
18408                        match serde_json::from_str(&encoded) {
18409                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18410                            Err(error) => {
18411                                dlg.response_json_decode_error(&encoded, &error);
18412                                return Err(common::Error::JsonDecodeError(
18413                                    encoded.to_string(),
18414                                    error,
18415                                ));
18416                            }
18417                        }
18418                    };
18419
18420                    dlg.finished(true);
18421                    return Ok(response);
18422                }
18423            }
18424        }
18425    }
18426
18427    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18428    /// while executing the actual API request.
18429    ///
18430    /// ````text
18431    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18432    /// ````
18433    ///
18434    /// Sets the *delegate* property to the given value.
18435    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountListCall<'a, C> {
18436        self._delegate = Some(new_value);
18437        self
18438    }
18439
18440    /// Set any additional parameter of the query string used in the request.
18441    /// It should be used to set parameters which are not yet available through their own
18442    /// setters.
18443    ///
18444    /// Please note that this method must not be used to set any of the known parameters
18445    /// which have their own setter method. If done anyway, the request will fail.
18446    ///
18447    /// # Additional Parameters
18448    ///
18449    /// * *$.xgafv* (query-string) - V1 error format.
18450    /// * *access_token* (query-string) - OAuth access token.
18451    /// * *alt* (query-string) - Data format for response.
18452    /// * *callback* (query-string) - JSONP
18453    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18454    /// * *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.
18455    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18456    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18457    /// * *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.
18458    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18459    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18460    pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, C>
18461    where
18462        T: AsRef<str>,
18463    {
18464        self._additional_params
18465            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18466        self
18467    }
18468
18469    /// Identifies the authorization scope for the method you are building.
18470    ///
18471    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18472    /// [`Scope::Readonly`].
18473    ///
18474    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18475    /// tokens for more than one scope.
18476    ///
18477    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18478    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18479    /// sufficient, a read-write scope will do as well.
18480    pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, C>
18481    where
18482        St: AsRef<str>,
18483    {
18484        self._scopes.insert(String::from(scope.as_ref()));
18485        self
18486    }
18487    /// Identifies the authorization scope(s) for the method you are building.
18488    ///
18489    /// See [`Self::add_scope()`] for details.
18490    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, C>
18491    where
18492        I: IntoIterator<Item = St>,
18493        St: AsRef<str>,
18494    {
18495        self._scopes
18496            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18497        self
18498    }
18499
18500    /// Removes all scopes, and no default scope will be used either.
18501    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18502    /// for details).
18503    pub fn clear_scopes(mut self) -> AccountListCall<'a, C> {
18504        self._scopes.clear();
18505        self
18506    }
18507}
18508
18509/// Updates a GTM Account.
18510///
18511/// A builder for the *update* method supported by a *account* resource.
18512/// It is not used directly, but through a [`AccountMethods`] instance.
18513///
18514/// # Example
18515///
18516/// Instantiate a resource method builder
18517///
18518/// ```test_harness,no_run
18519/// # extern crate hyper;
18520/// # extern crate hyper_rustls;
18521/// # extern crate google_tagmanager1 as tagmanager1;
18522/// use tagmanager1::api::Account;
18523/// # async fn dox() {
18524/// # use tagmanager1::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18525///
18526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18527/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18528/// #     .with_native_roots()
18529/// #     .unwrap()
18530/// #     .https_only()
18531/// #     .enable_http2()
18532/// #     .build();
18533///
18534/// # let executor = hyper_util::rt::TokioExecutor::new();
18535/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18536/// #     secret,
18537/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18538/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18539/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18540/// #     ),
18541/// # ).build().await.unwrap();
18542///
18543/// # let client = hyper_util::client::legacy::Client::builder(
18544/// #     hyper_util::rt::TokioExecutor::new()
18545/// # )
18546/// # .build(
18547/// #     hyper_rustls::HttpsConnectorBuilder::new()
18548/// #         .with_native_roots()
18549/// #         .unwrap()
18550/// #         .https_or_http()
18551/// #         .enable_http2()
18552/// #         .build()
18553/// # );
18554/// # let mut hub = TagManager::new(client, auth);
18555/// // As the method needs a request, you would usually fill it with the desired information
18556/// // into the respective structure. Some of the parts shown here might not be applicable !
18557/// // Values shown here are possibly random and not representative !
18558/// let mut req = Account::default();
18559///
18560/// // You can configure optional parameters by calling the respective setters at will, and
18561/// // execute the final call using `doit()`.
18562/// // Values shown here are possibly random and not representative !
18563/// let result = hub.accounts().update(req, "accountId")
18564///              .fingerprint("Stet")
18565///              .doit().await;
18566/// # }
18567/// ```
18568pub struct AccountUpdateCall<'a, C>
18569where
18570    C: 'a,
18571{
18572    hub: &'a TagManager<C>,
18573    _request: Account,
18574    _account_id: String,
18575    _fingerprint: Option<String>,
18576    _delegate: Option<&'a mut dyn common::Delegate>,
18577    _additional_params: HashMap<String, String>,
18578    _scopes: BTreeSet<String>,
18579}
18580
18581impl<'a, C> common::CallBuilder for AccountUpdateCall<'a, C> {}
18582
18583impl<'a, C> AccountUpdateCall<'a, C>
18584where
18585    C: common::Connector,
18586{
18587    /// Perform the operation you have build so far.
18588    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
18589        use std::borrow::Cow;
18590        use std::io::{Read, Seek};
18591
18592        use common::{url::Params, ToParts};
18593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18594
18595        let mut dd = common::DefaultDelegate;
18596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18597        dlg.begin(common::MethodInfo {
18598            id: "tagmanager.accounts.update",
18599            http_method: hyper::Method::PUT,
18600        });
18601
18602        for &field in ["alt", "accountId", "fingerprint"].iter() {
18603            if self._additional_params.contains_key(field) {
18604                dlg.finished(false);
18605                return Err(common::Error::FieldClash(field));
18606            }
18607        }
18608
18609        let mut params = Params::with_capacity(5 + self._additional_params.len());
18610        params.push("accountId", self._account_id);
18611        if let Some(value) = self._fingerprint.as_ref() {
18612            params.push("fingerprint", value);
18613        }
18614
18615        params.extend(self._additional_params.iter());
18616
18617        params.push("alt", "json");
18618        let mut url = self.hub._base_url.clone() + "tagmanager/v1/accounts/{accountId}";
18619        if self._scopes.is_empty() {
18620            self._scopes
18621                .insert(Scope::ManageAccount.as_ref().to_string());
18622        }
18623
18624        #[allow(clippy::single_element_loop)]
18625        for &(find_this, param_name) in [("{accountId}", "accountId")].iter() {
18626            url = params.uri_replacement(url, param_name, find_this, false);
18627        }
18628        {
18629            let to_remove = ["accountId"];
18630            params.remove_params(&to_remove);
18631        }
18632
18633        let url = params.parse_with_url(&url);
18634
18635        let mut json_mime_type = mime::APPLICATION_JSON;
18636        let mut request_value_reader = {
18637            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18638            common::remove_json_null_values(&mut value);
18639            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18640            serde_json::to_writer(&mut dst, &value).unwrap();
18641            dst
18642        };
18643        let request_size = request_value_reader
18644            .seek(std::io::SeekFrom::End(0))
18645            .unwrap();
18646        request_value_reader
18647            .seek(std::io::SeekFrom::Start(0))
18648            .unwrap();
18649
18650        loop {
18651            let token = match self
18652                .hub
18653                .auth
18654                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18655                .await
18656            {
18657                Ok(token) => token,
18658                Err(e) => match dlg.token(e) {
18659                    Ok(token) => token,
18660                    Err(e) => {
18661                        dlg.finished(false);
18662                        return Err(common::Error::MissingToken(e));
18663                    }
18664                },
18665            };
18666            request_value_reader
18667                .seek(std::io::SeekFrom::Start(0))
18668                .unwrap();
18669            let mut req_result = {
18670                let client = &self.hub.client;
18671                dlg.pre_request();
18672                let mut req_builder = hyper::Request::builder()
18673                    .method(hyper::Method::PUT)
18674                    .uri(url.as_str())
18675                    .header(USER_AGENT, self.hub._user_agent.clone());
18676
18677                if let Some(token) = token.as_ref() {
18678                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18679                }
18680
18681                let request = req_builder
18682                    .header(CONTENT_TYPE, json_mime_type.to_string())
18683                    .header(CONTENT_LENGTH, request_size as u64)
18684                    .body(common::to_body(
18685                        request_value_reader.get_ref().clone().into(),
18686                    ));
18687
18688                client.request(request.unwrap()).await
18689            };
18690
18691            match req_result {
18692                Err(err) => {
18693                    if let common::Retry::After(d) = dlg.http_error(&err) {
18694                        sleep(d).await;
18695                        continue;
18696                    }
18697                    dlg.finished(false);
18698                    return Err(common::Error::HttpError(err));
18699                }
18700                Ok(res) => {
18701                    let (mut parts, body) = res.into_parts();
18702                    let mut body = common::Body::new(body);
18703                    if !parts.status.is_success() {
18704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18705                        let error = serde_json::from_str(&common::to_string(&bytes));
18706                        let response = common::to_response(parts, bytes.into());
18707
18708                        if let common::Retry::After(d) =
18709                            dlg.http_failure(&response, error.as_ref().ok())
18710                        {
18711                            sleep(d).await;
18712                            continue;
18713                        }
18714
18715                        dlg.finished(false);
18716
18717                        return Err(match error {
18718                            Ok(value) => common::Error::BadRequest(value),
18719                            _ => common::Error::Failure(response),
18720                        });
18721                    }
18722                    let response = {
18723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18724                        let encoded = common::to_string(&bytes);
18725                        match serde_json::from_str(&encoded) {
18726                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18727                            Err(error) => {
18728                                dlg.response_json_decode_error(&encoded, &error);
18729                                return Err(common::Error::JsonDecodeError(
18730                                    encoded.to_string(),
18731                                    error,
18732                                ));
18733                            }
18734                        }
18735                    };
18736
18737                    dlg.finished(true);
18738                    return Ok(response);
18739                }
18740            }
18741        }
18742    }
18743
18744    ///
18745    /// Sets the *request* property to the given value.
18746    ///
18747    /// Even though the property as already been set when instantiating this call,
18748    /// we provide this method for API completeness.
18749    pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C> {
18750        self._request = new_value;
18751        self
18752    }
18753    /// The GTM Account ID.
18754    ///
18755    /// Sets the *account id* path property to the given value.
18756    ///
18757    /// Even though the property as already been set when instantiating this call,
18758    /// we provide this method for API completeness.
18759    pub fn account_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
18760        self._account_id = new_value.to_string();
18761        self
18762    }
18763    /// When provided, this fingerprint must match the fingerprint of the account in storage.
18764    ///
18765    /// Sets the *fingerprint* query property to the given value.
18766    pub fn fingerprint(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
18767        self._fingerprint = Some(new_value.to_string());
18768        self
18769    }
18770    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18771    /// while executing the actual API request.
18772    ///
18773    /// ````text
18774    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18775    /// ````
18776    ///
18777    /// Sets the *delegate* property to the given value.
18778    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountUpdateCall<'a, C> {
18779        self._delegate = Some(new_value);
18780        self
18781    }
18782
18783    /// Set any additional parameter of the query string used in the request.
18784    /// It should be used to set parameters which are not yet available through their own
18785    /// setters.
18786    ///
18787    /// Please note that this method must not be used to set any of the known parameters
18788    /// which have their own setter method. If done anyway, the request will fail.
18789    ///
18790    /// # Additional Parameters
18791    ///
18792    /// * *$.xgafv* (query-string) - V1 error format.
18793    /// * *access_token* (query-string) - OAuth access token.
18794    /// * *alt* (query-string) - Data format for response.
18795    /// * *callback* (query-string) - JSONP
18796    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18797    /// * *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.
18798    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18799    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18800    /// * *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.
18801    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18802    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18803    pub fn param<T>(mut self, name: T, value: T) -> AccountUpdateCall<'a, C>
18804    where
18805        T: AsRef<str>,
18806    {
18807        self._additional_params
18808            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18809        self
18810    }
18811
18812    /// Identifies the authorization scope for the method you are building.
18813    ///
18814    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18815    /// [`Scope::ManageAccount`].
18816    ///
18817    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18818    /// tokens for more than one scope.
18819    ///
18820    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18821    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18822    /// sufficient, a read-write scope will do as well.
18823    pub fn add_scope<St>(mut self, scope: St) -> AccountUpdateCall<'a, C>
18824    where
18825        St: AsRef<str>,
18826    {
18827        self._scopes.insert(String::from(scope.as_ref()));
18828        self
18829    }
18830    /// Identifies the authorization scope(s) for the method you are building.
18831    ///
18832    /// See [`Self::add_scope()`] for details.
18833    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUpdateCall<'a, C>
18834    where
18835        I: IntoIterator<Item = St>,
18836        St: AsRef<str>,
18837    {
18838        self._scopes
18839            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18840        self
18841    }
18842
18843    /// Removes all scopes, and no default scope will be used either.
18844    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18845    /// for details).
18846    pub fn clear_scopes(mut self) -> AccountUpdateCall<'a, C> {
18847        self._scopes.clear();
18848        self
18849    }
18850}