google_tagmanager2/
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_tagmanager2 as tagmanager2;
77/// use tagmanager2::{Result, Error};
78/// # async fn dox() {
79/// use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80///
81/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
82/// // `client_secret`, among other things.
83/// let secret: yup_oauth2::ApplicationSecret = Default::default();
84/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
85/// // unless you replace  `None` with the desired Flow.
86/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
87/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
88/// // retrieve them from storage.
89/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
90///     secret,
91///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
92/// ).build().await.unwrap();
93///
94/// let client = hyper_util::client::legacy::Client::builder(
95///     hyper_util::rt::TokioExecutor::new()
96/// )
97/// .build(
98///     hyper_rustls::HttpsConnectorBuilder::new()
99///         .with_native_roots()
100///         .unwrap()
101///         .https_or_http()
102///         .enable_http1()
103///         .build()
104/// );
105/// let mut hub = TagManager::new(client, auth);
106/// // You can configure optional parameters by calling the respective setters at will, and
107/// // execute the final call using `doit()`.
108/// // Values shown here are possibly random and not representative !
109/// let result = hub.accounts().containers_move_tag_id("path")
110///              .tag_name("duo")
111///              .tag_id("ipsum")
112///              .copy_users(false)
113///              .copy_terms_of_service(true)
114///              .copy_settings(true)
115///              .allow_user_permission_feature_update(true)
116///              .doit().await;
117///
118/// match result {
119///     Err(e) => match e {
120///         // The Error enum provides details about what exactly happened.
121///         // You can also just use its `Debug`, `Display` or `Error` traits
122///          Error::HttpError(_)
123///         |Error::Io(_)
124///         |Error::MissingAPIKey
125///         |Error::MissingToken(_)
126///         |Error::Cancelled
127///         |Error::UploadSizeLimitExceeded(_, _)
128///         |Error::Failure(_)
129///         |Error::BadRequest(_)
130///         |Error::FieldClash(_)
131///         |Error::JsonDecodeError(_, _) => println!("{}", e),
132///     },
133///     Ok(res) => println!("Success: {:?}", res),
134/// }
135/// # }
136/// ```
137#[derive(Clone)]
138pub struct TagManager<C> {
139    pub client: common::Client<C>,
140    pub auth: Box<dyn common::GetToken>,
141    _user_agent: String,
142    _base_url: String,
143    _root_url: String,
144}
145
146impl<C> common::Hub for TagManager<C> {}
147
148impl<'a, C> TagManager<C> {
149    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> TagManager<C> {
150        TagManager {
151            client,
152            auth: Box::new(auth),
153            _user_agent: "google-api-rust-client/6.0.0".to_string(),
154            _base_url: "https://tagmanager.googleapis.com/".to_string(),
155            _root_url: "https://tagmanager.googleapis.com/".to_string(),
156        }
157    }
158
159    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
160        AccountMethods { hub: self }
161    }
162
163    /// Set the user-agent header field to use in all requests to the server.
164    /// It defaults to `google-api-rust-client/6.0.0`.
165    ///
166    /// Returns the previously set user-agent.
167    pub fn user_agent(&mut self, agent_name: String) -> String {
168        std::mem::replace(&mut self._user_agent, agent_name)
169    }
170
171    /// Set the base url to use in all requests to the server.
172    /// It defaults to `https://tagmanager.googleapis.com/`.
173    ///
174    /// Returns the previously set base url.
175    pub fn base_url(&mut self, new_base_url: String) -> String {
176        std::mem::replace(&mut self._base_url, new_base_url)
177    }
178
179    /// Set the root url to use in all requests to the server.
180    /// It defaults to `https://tagmanager.googleapis.com/`.
181    ///
182    /// Returns the previously set root url.
183    pub fn root_url(&mut self, new_root_url: String) -> String {
184        std::mem::replace(&mut self._root_url, new_root_url)
185    }
186}
187
188// ############
189// SCHEMAS ###
190// ##########
191/// Represents a Google Tag Manager Account.
192///
193/// # Activities
194///
195/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
196/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
197///
198/// * [containers destinations get accounts](AccountContainerDestinationGetCall) (none)
199/// * [containers destinations link accounts](AccountContainerDestinationLinkCall) (none)
200/// * [containers destinations list accounts](AccountContainerDestinationListCall) (none)
201/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (none)
202/// * [containers environments delete accounts](AccountContainerEnvironmentDeleteCall) (none)
203/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (none)
204/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (none)
205/// * [containers environments reauthorize accounts](AccountContainerEnvironmentReauthorizeCall) (none)
206/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (none)
207/// * [containers version_headers latest accounts](AccountContainerVersionHeaderLatestCall) (none)
208/// * [containers version_headers list accounts](AccountContainerVersionHeaderListCall) (none)
209/// * [containers versions delete accounts](AccountContainerVersionDeleteCall) (none)
210/// * [containers versions get accounts](AccountContainerVersionGetCall) (none)
211/// * [containers versions live accounts](AccountContainerVersionLiveCall) (none)
212/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (none)
213/// * [containers versions set_latest accounts](AccountContainerVersionSetLatestCall) (none)
214/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (none)
215/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (none)
216/// * [containers workspaces built_in_variables create accounts](AccountContainerWorkspaceBuiltInVariableCreateCall) (none)
217/// * [containers workspaces built_in_variables delete accounts](AccountContainerWorkspaceBuiltInVariableDeleteCall) (none)
218/// * [containers workspaces built_in_variables list accounts](AccountContainerWorkspaceBuiltInVariableListCall) (none)
219/// * [containers workspaces built_in_variables revert accounts](AccountContainerWorkspaceBuiltInVariableRevertCall) (none)
220/// * [containers workspaces clients create accounts](AccountContainerWorkspaceClientCreateCall) (none)
221/// * [containers workspaces clients delete accounts](AccountContainerWorkspaceClientDeleteCall) (none)
222/// * [containers workspaces clients get accounts](AccountContainerWorkspaceClientGetCall) (none)
223/// * [containers workspaces clients list accounts](AccountContainerWorkspaceClientListCall) (none)
224/// * [containers workspaces clients revert accounts](AccountContainerWorkspaceClientRevertCall) (none)
225/// * [containers workspaces clients update accounts](AccountContainerWorkspaceClientUpdateCall) (none)
226/// * [containers workspaces folders create accounts](AccountContainerWorkspaceFolderCreateCall) (none)
227/// * [containers workspaces folders delete accounts](AccountContainerWorkspaceFolderDeleteCall) (none)
228/// * [containers workspaces folders entities accounts](AccountContainerWorkspaceFolderEntityCall) (none)
229/// * [containers workspaces folders get accounts](AccountContainerWorkspaceFolderGetCall) (none)
230/// * [containers workspaces folders list accounts](AccountContainerWorkspaceFolderListCall) (none)
231/// * [containers workspaces folders move_entities_to_folder accounts](AccountContainerWorkspaceFolderMoveEntitiesToFolderCall) (none)
232/// * [containers workspaces folders revert accounts](AccountContainerWorkspaceFolderRevertCall) (none)
233/// * [containers workspaces folders update accounts](AccountContainerWorkspaceFolderUpdateCall) (none)
234/// * [containers workspaces gtag_config create accounts](AccountContainerWorkspaceGtagConfigCreateCall) (none)
235/// * [containers workspaces gtag_config delete accounts](AccountContainerWorkspaceGtagConfigDeleteCall) (none)
236/// * [containers workspaces gtag_config get accounts](AccountContainerWorkspaceGtagConfigGetCall) (none)
237/// * [containers workspaces gtag_config list accounts](AccountContainerWorkspaceGtagConfigListCall) (none)
238/// * [containers workspaces gtag_config update accounts](AccountContainerWorkspaceGtagConfigUpdateCall) (none)
239/// * [containers workspaces tags create accounts](AccountContainerWorkspaceTagCreateCall) (none)
240/// * [containers workspaces tags delete accounts](AccountContainerWorkspaceTagDeleteCall) (none)
241/// * [containers workspaces tags get accounts](AccountContainerWorkspaceTagGetCall) (none)
242/// * [containers workspaces tags list accounts](AccountContainerWorkspaceTagListCall) (none)
243/// * [containers workspaces tags revert accounts](AccountContainerWorkspaceTagRevertCall) (none)
244/// * [containers workspaces tags update accounts](AccountContainerWorkspaceTagUpdateCall) (none)
245/// * [containers workspaces templates create accounts](AccountContainerWorkspaceTemplateCreateCall) (none)
246/// * [containers workspaces templates delete accounts](AccountContainerWorkspaceTemplateDeleteCall) (none)
247/// * [containers workspaces templates get accounts](AccountContainerWorkspaceTemplateGetCall) (none)
248/// * [containers workspaces templates list accounts](AccountContainerWorkspaceTemplateListCall) (none)
249/// * [containers workspaces templates revert accounts](AccountContainerWorkspaceTemplateRevertCall) (none)
250/// * [containers workspaces templates update accounts](AccountContainerWorkspaceTemplateUpdateCall) (none)
251/// * [containers workspaces transformations create accounts](AccountContainerWorkspaceTransformationCreateCall) (none)
252/// * [containers workspaces transformations delete accounts](AccountContainerWorkspaceTransformationDeleteCall) (none)
253/// * [containers workspaces transformations get accounts](AccountContainerWorkspaceTransformationGetCall) (none)
254/// * [containers workspaces transformations list accounts](AccountContainerWorkspaceTransformationListCall) (none)
255/// * [containers workspaces transformations revert accounts](AccountContainerWorkspaceTransformationRevertCall) (none)
256/// * [containers workspaces transformations update accounts](AccountContainerWorkspaceTransformationUpdateCall) (none)
257/// * [containers workspaces triggers create accounts](AccountContainerWorkspaceTriggerCreateCall) (none)
258/// * [containers workspaces triggers delete accounts](AccountContainerWorkspaceTriggerDeleteCall) (none)
259/// * [containers workspaces triggers get accounts](AccountContainerWorkspaceTriggerGetCall) (none)
260/// * [containers workspaces triggers list accounts](AccountContainerWorkspaceTriggerListCall) (none)
261/// * [containers workspaces triggers revert accounts](AccountContainerWorkspaceTriggerRevertCall) (none)
262/// * [containers workspaces triggers update accounts](AccountContainerWorkspaceTriggerUpdateCall) (none)
263/// * [containers workspaces variables create accounts](AccountContainerWorkspaceVariableCreateCall) (none)
264/// * [containers workspaces variables delete accounts](AccountContainerWorkspaceVariableDeleteCall) (none)
265/// * [containers workspaces variables get accounts](AccountContainerWorkspaceVariableGetCall) (none)
266/// * [containers workspaces variables list accounts](AccountContainerWorkspaceVariableListCall) (none)
267/// * [containers workspaces variables revert accounts](AccountContainerWorkspaceVariableRevertCall) (none)
268/// * [containers workspaces variables update accounts](AccountContainerWorkspaceVariableUpdateCall) (none)
269/// * [containers workspaces zones create accounts](AccountContainerWorkspaceZoneCreateCall) (none)
270/// * [containers workspaces zones delete accounts](AccountContainerWorkspaceZoneDeleteCall) (none)
271/// * [containers workspaces zones get accounts](AccountContainerWorkspaceZoneGetCall) (none)
272/// * [containers workspaces zones list accounts](AccountContainerWorkspaceZoneListCall) (none)
273/// * [containers workspaces zones revert accounts](AccountContainerWorkspaceZoneRevertCall) (none)
274/// * [containers workspaces zones update accounts](AccountContainerWorkspaceZoneUpdateCall) (none)
275/// * [containers workspaces create accounts](AccountContainerWorkspaceCreateCall) (none)
276/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (none)
277/// * [containers workspaces delete accounts](AccountContainerWorkspaceDeleteCall) (none)
278/// * [containers workspaces get accounts](AccountContainerWorkspaceGetCall) (none)
279/// * [containers workspaces get status accounts](AccountContainerWorkspaceGetStatuCall) (none)
280/// * [containers workspaces list accounts](AccountContainerWorkspaceListCall) (none)
281/// * [containers workspaces quick_preview accounts](AccountContainerWorkspaceQuickPreviewCall) (none)
282/// * [containers workspaces resolve_conflict accounts](AccountContainerWorkspaceResolveConflictCall) (none)
283/// * [containers workspaces sync accounts](AccountContainerWorkspaceSyncCall) (none)
284/// * [containers workspaces update accounts](AccountContainerWorkspaceUpdateCall) (none)
285/// * [containers combine accounts](AccountContainerCombineCall) (none)
286/// * [containers create accounts](AccountContainerCreateCall) (none)
287/// * [containers delete accounts](AccountContainerDeleteCall) (none)
288/// * [containers get accounts](AccountContainerGetCall) (none)
289/// * [containers list accounts](AccountContainerListCall) (none)
290/// * [containers lookup accounts](AccountContainerLookupCall) (none)
291/// * [containers move_tag_id accounts](AccountContainerMoveTagIdCall) (none)
292/// * [containers snippet accounts](AccountContainerSnippetCall) (none)
293/// * [containers update accounts](AccountContainerUpdateCall) (none)
294/// * [user_permissions create accounts](AccountUserPermissionCreateCall) (none)
295/// * [user_permissions delete accounts](AccountUserPermissionDeleteCall) (none)
296/// * [user_permissions get accounts](AccountUserPermissionGetCall) (none)
297/// * [user_permissions list accounts](AccountUserPermissionListCall) (none)
298/// * [user_permissions update accounts](AccountUserPermissionUpdateCall) (none)
299/// * [get accounts](AccountGetCall) (response)
300/// * [list accounts](AccountListCall) (none)
301/// * [update accounts](AccountUpdateCall) (request|response)
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct Account {
306    /// The Account ID uniquely identifies the GTM Account.
307    #[serde(rename = "accountId")]
308    pub account_id: Option<String>,
309    /// Read-only Account feature set
310    pub features: Option<AccountFeatures>,
311    /// The fingerprint of the GTM Account as computed at storage time. This value is recomputed whenever the account is modified.
312    pub fingerprint: Option<String>,
313    /// Account display name. @mutable tagmanager.accounts.create @mutable tagmanager.accounts.update
314    pub name: Option<String>,
315    /// GTM Account's API relative path.
316    pub path: Option<String>,
317    /// Whether the account shares data anonymously with Google and others. This flag enables benchmarking by sharing your data in an anonymous form. Google will remove all identifiable information about your website, combine the data with hundreds of other anonymous sites and report aggregate trends in the benchmarking service. @mutable tagmanager.accounts.create @mutable tagmanager.accounts.update
318    #[serde(rename = "shareData")]
319    pub share_data: Option<bool>,
320    /// Auto generated link to the tag manager UI
321    #[serde(rename = "tagManagerUrl")]
322    pub tag_manager_url: Option<String>,
323}
324
325impl common::RequestValue for Account {}
326impl common::Resource for Account {}
327impl common::ResponseResult for Account {}
328
329/// Defines the Google Tag Manager Account access permissions.
330///
331/// This type is not used in any activity, and only used as *part* of another schema.
332///
333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
334#[serde_with::serde_as]
335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
336pub struct AccountAccess {
337    /// Whether the user has no access, user access, or admin access to an account. @mutable tagmanager.accounts.permissions.create @mutable tagmanager.accounts.permissions.update
338    pub permission: Option<String>,
339}
340
341impl common::Part for AccountAccess {}
342
343/// There is no detailed description.
344///
345/// This type is not used in any activity, and only used as *part* of another schema.
346///
347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
348#[serde_with::serde_as]
349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
350pub struct AccountFeatures {
351    /// Whether this Account supports multiple Containers.
352    #[serde(rename = "supportMultipleContainers")]
353    pub support_multiple_containers: Option<bool>,
354    /// Whether this Account supports user permissions managed by GTM.
355    #[serde(rename = "supportUserPermissions")]
356    pub support_user_permissions: Option<bool>,
357}
358
359impl common::Part for AccountFeatures {}
360
361/// Built-in variables are a special category of variables that are pre-created and non-customizable. They provide common functionality like accessing properties of the gtm data layer, monitoring clicks, or accessing elements of a page URL.
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 BuiltInVariable {
369    /// GTM Account ID.
370    #[serde(rename = "accountId")]
371    pub account_id: Option<String>,
372    /// GTM Container ID.
373    #[serde(rename = "containerId")]
374    pub container_id: Option<String>,
375    /// Name of the built-in variable to be used to refer to the built-in variable.
376    pub name: Option<String>,
377    /// GTM BuiltInVariable's API relative path.
378    pub path: Option<String>,
379    /// Type of built-in variable. @required.tagmanager.accounts.containers.workspaces.built_in_variable.update @mutable tagmanager.accounts.containers.workspaces.built_in_variable.update
380    #[serde(rename = "type")]
381    pub type_: Option<String>,
382    /// GTM Workspace ID.
383    #[serde(rename = "workspaceId")]
384    pub workspace_id: Option<String>,
385}
386
387impl common::Part for BuiltInVariable {}
388
389/// There is no detailed description.
390///
391/// # Activities
392///
393/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
394/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
395///
396/// * [containers workspaces clients create accounts](AccountContainerWorkspaceClientCreateCall) (request|response)
397/// * [containers workspaces clients get accounts](AccountContainerWorkspaceClientGetCall) (response)
398/// * [containers workspaces clients update accounts](AccountContainerWorkspaceClientUpdateCall) (request|response)
399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
400#[serde_with::serde_as]
401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
402pub struct Client {
403    /// GTM Account ID.
404    #[serde(rename = "accountId")]
405    pub account_id: Option<String>,
406    /// The Client ID uniquely identifies the GTM client.
407    #[serde(rename = "clientId")]
408    pub client_id: Option<String>,
409    /// GTM Container ID.
410    #[serde(rename = "containerId")]
411    pub container_id: Option<String>,
412    /// The fingerprint of the GTM Client as computed at storage time. This value is recomputed whenever the client is modified.
413    pub fingerprint: Option<String>,
414    /// Client display name. @mutable tagmanager.accounts.containers.workspaces.clients.create @mutable tagmanager.accounts.containers.workspaces.clients.update
415    pub name: Option<String>,
416    /// User notes on how to apply this tag in the container. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
417    pub notes: Option<String>,
418    /// The client's parameters. @mutable tagmanager.accounts.containers.workspaces.clients.create @mutable tagmanager.accounts.containers.workspaces.clients.update
419    pub parameter: Option<Vec<Parameter>>,
420    /// Parent folder id.
421    #[serde(rename = "parentFolderId")]
422    pub parent_folder_id: Option<String>,
423    /// GTM client's API relative path.
424    pub path: Option<String>,
425    /// Priority determines relative firing order. @mutable tagmanager.accounts.containers.workspaces.clients.create @mutable tagmanager.accounts.containers.workspaces.clients.update
426    pub priority: Option<i32>,
427    /// Auto generated link to the tag manager UI
428    #[serde(rename = "tagManagerUrl")]
429    pub tag_manager_url: Option<String>,
430    /// Client type. @mutable tagmanager.accounts.containers.workspaces.clients.create @mutable tagmanager.accounts.containers.workspaces.clients.update
431    #[serde(rename = "type")]
432    pub type_: Option<String>,
433    /// GTM Workspace ID.
434    #[serde(rename = "workspaceId")]
435    pub workspace_id: Option<String>,
436}
437
438impl common::RequestValue for Client {}
439impl common::ResponseResult for Client {}
440
441/// Represents a predicate.
442///
443/// This type is not used in any activity, and only used as *part* of another schema.
444///
445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
446#[serde_with::serde_as]
447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
448pub struct Condition {
449    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
450    pub parameter: Option<Vec<Parameter>>,
451    /// The type of operator for this condition. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
452    #[serde(rename = "type")]
453    pub type_: Option<String>,
454}
455
456impl common::Part for Condition {}
457
458/// Represents a Google Tag Manager Container, which specifies the platform tags will run on, manages workspaces, and retains container versions.
459///
460/// # Activities
461///
462/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
463/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
464///
465/// * [containers combine accounts](AccountContainerCombineCall) (response)
466/// * [containers create accounts](AccountContainerCreateCall) (request|response)
467/// * [containers get accounts](AccountContainerGetCall) (response)
468/// * [containers lookup accounts](AccountContainerLookupCall) (response)
469/// * [containers move_tag_id accounts](AccountContainerMoveTagIdCall) (response)
470/// * [containers update accounts](AccountContainerUpdateCall) (request|response)
471#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
472#[serde_with::serde_as]
473#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
474pub struct Container {
475    /// GTM Account ID.
476    #[serde(rename = "accountId")]
477    pub account_id: Option<String>,
478    /// The Container ID uniquely identifies the GTM Container.
479    #[serde(rename = "containerId")]
480    pub container_id: Option<String>,
481    /// List of domain names associated with the Container. @mutable tagmanager.accounts.containers.create @mutable tagmanager.accounts.containers.update
482    #[serde(rename = "domainName")]
483    pub domain_name: Option<Vec<String>>,
484    /// Read-only Container feature set.
485    pub features: Option<ContainerFeatures>,
486    /// The fingerprint of the GTM Container as computed at storage time. This value is recomputed whenever the account is modified.
487    pub fingerprint: Option<String>,
488    /// Container display name. @mutable tagmanager.accounts.containers.create @mutable tagmanager.accounts.containers.update
489    pub name: Option<String>,
490    /// Container Notes. @mutable tagmanager.accounts.containers.create @mutable tagmanager.accounts.containers.update
491    pub notes: Option<String>,
492    /// GTM Container's API relative path.
493    pub path: Option<String>,
494    /// Container Public ID.
495    #[serde(rename = "publicId")]
496    pub public_id: Option<String>,
497    /// All Tag IDs that refer to this Container.
498    #[serde(rename = "tagIds")]
499    pub tag_ids: Option<Vec<String>>,
500    /// Auto generated link to the tag manager UI
501    #[serde(rename = "tagManagerUrl")]
502    pub tag_manager_url: Option<String>,
503    /// List of server-side container URLs for the Container. If multiple URLs are provided, all URL paths must match. @mutable tagmanager.accounts.containers.create @mutable tagmanager.accounts.containers.update
504    #[serde(rename = "taggingServerUrls")]
505    pub tagging_server_urls: Option<Vec<String>>,
506    /// List of Usage Contexts for the Container. Valid values include: web, android, or ios. @mutable tagmanager.accounts.containers.create @mutable tagmanager.accounts.containers.update
507    #[serde(rename = "usageContext")]
508    pub usage_context: Option<Vec<String>>,
509}
510
511impl common::RequestValue for Container {}
512impl common::ResponseResult for Container {}
513
514/// Defines the Google Tag Manager Container access permissions.
515///
516/// This type is not used in any activity, and only used as *part* of another schema.
517///
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct ContainerAccess {
522    /// GTM Container ID. @mutable tagmanager.accounts.permissions.create @mutable tagmanager.accounts.permissions.update
523    #[serde(rename = "containerId")]
524    pub container_id: Option<String>,
525    /// List of Container permissions. @mutable tagmanager.accounts.permissions.create @mutable tagmanager.accounts.permissions.update
526    pub permission: Option<String>,
527}
528
529impl common::Part for ContainerAccess {}
530
531/// There is no detailed description.
532///
533/// This type is not used in any activity, and only used as *part* of another schema.
534///
535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
536#[serde_with::serde_as]
537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
538pub struct ContainerFeatures {
539    /// Whether this Container supports built-in variables
540    #[serde(rename = "supportBuiltInVariables")]
541    pub support_built_in_variables: Option<bool>,
542    /// Whether this Container supports clients.
543    #[serde(rename = "supportClients")]
544    pub support_clients: Option<bool>,
545    /// Whether this Container supports environments.
546    #[serde(rename = "supportEnvironments")]
547    pub support_environments: Option<bool>,
548    /// Whether this Container supports folders.
549    #[serde(rename = "supportFolders")]
550    pub support_folders: Option<bool>,
551    /// Whether this Container supports Google tag config.
552    #[serde(rename = "supportGtagConfigs")]
553    pub support_gtag_configs: Option<bool>,
554    /// Whether this Container supports tags.
555    #[serde(rename = "supportTags")]
556    pub support_tags: Option<bool>,
557    /// Whether this Container supports templates.
558    #[serde(rename = "supportTemplates")]
559    pub support_templates: Option<bool>,
560    /// Whether this Container supports transformations.
561    #[serde(rename = "supportTransformations")]
562    pub support_transformations: Option<bool>,
563    /// Whether this Container supports triggers.
564    #[serde(rename = "supportTriggers")]
565    pub support_triggers: Option<bool>,
566    /// Whether this Container supports user permissions managed by GTM.
567    #[serde(rename = "supportUserPermissions")]
568    pub support_user_permissions: Option<bool>,
569    /// Whether this Container supports variables.
570    #[serde(rename = "supportVariables")]
571    pub support_variables: Option<bool>,
572    /// Whether this Container supports Container versions.
573    #[serde(rename = "supportVersions")]
574    pub support_versions: Option<bool>,
575    /// Whether this Container supports workspaces.
576    #[serde(rename = "supportWorkspaces")]
577    pub support_workspaces: Option<bool>,
578    /// Whether this Container supports zones.
579    #[serde(rename = "supportZones")]
580    pub support_zones: Option<bool>,
581}
582
583impl common::Part for ContainerFeatures {}
584
585/// Represents a Google Tag Manager Container Version.
586///
587/// # Activities
588///
589/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
590/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
591///
592/// * [containers versions get accounts](AccountContainerVersionGetCall) (response)
593/// * [containers versions live accounts](AccountContainerVersionLiveCall) (response)
594/// * [containers versions set_latest accounts](AccountContainerVersionSetLatestCall) (response)
595/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (response)
596/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (request|response)
597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
598#[serde_with::serde_as]
599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
600pub struct ContainerVersion {
601    /// GTM Account ID.
602    #[serde(rename = "accountId")]
603    pub account_id: Option<String>,
604    /// The built-in variables in the container that this version was taken from.
605    #[serde(rename = "builtInVariable")]
606    pub built_in_variable: Option<Vec<BuiltInVariable>>,
607    /// The clients in the container that this version was taken from.
608    pub client: Option<Vec<Client>>,
609    /// The container that this version was taken from.
610    pub container: Option<Container>,
611    /// GTM Container ID.
612    #[serde(rename = "containerId")]
613    pub container_id: Option<String>,
614    /// The Container Version ID uniquely identifies the GTM Container Version.
615    #[serde(rename = "containerVersionId")]
616    pub container_version_id: Option<String>,
617    /// The custom templates in the container that this version was taken from.
618    #[serde(rename = "customTemplate")]
619    pub custom_template: Option<Vec<CustomTemplate>>,
620    /// A value of true indicates this container version has been deleted.
621    pub deleted: Option<bool>,
622    /// Container version description. @mutable tagmanager.accounts.containers.versions.update
623    pub description: Option<String>,
624    /// The fingerprint of the GTM Container Version as computed at storage time. This value is recomputed whenever the container version is modified.
625    pub fingerprint: Option<String>,
626    /// The folders in the container that this version was taken from.
627    pub folder: Option<Vec<Folder>>,
628    /// The Google tag configs in the container that this version was taken from.
629    #[serde(rename = "gtagConfig")]
630    pub gtag_config: Option<Vec<GtagConfig>>,
631    /// Container version display name. @mutable tagmanager.accounts.containers.versions.update
632    pub name: Option<String>,
633    /// GTM Container Version's API relative path.
634    pub path: Option<String>,
635    /// The tags in the container that this version was taken from.
636    pub tag: Option<Vec<Tag>>,
637    /// Auto generated link to the tag manager UI
638    #[serde(rename = "tagManagerUrl")]
639    pub tag_manager_url: Option<String>,
640    /// The transformations in the container that this version was taken from.
641    pub transformation: Option<Vec<Transformation>>,
642    /// The triggers in the container that this version was taken from.
643    pub trigger: Option<Vec<Trigger>>,
644    /// The variables in the container that this version was taken from.
645    pub variable: Option<Vec<Variable>>,
646    /// The zones in the container that this version was taken from.
647    pub zone: Option<Vec<Zone>>,
648}
649
650impl common::RequestValue for ContainerVersion {}
651impl common::ResponseResult for ContainerVersion {}
652
653/// Represents a Google Tag Manager Container Version Header.
654///
655/// # Activities
656///
657/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
658/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
659///
660/// * [containers version_headers latest accounts](AccountContainerVersionHeaderLatestCall) (response)
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct ContainerVersionHeader {
665    /// GTM Account ID.
666    #[serde(rename = "accountId")]
667    pub account_id: Option<String>,
668    /// GTM Container ID.
669    #[serde(rename = "containerId")]
670    pub container_id: Option<String>,
671    /// The Container Version ID uniquely identifies the GTM Container Version.
672    #[serde(rename = "containerVersionId")]
673    pub container_version_id: Option<String>,
674    /// A value of true indicates this container version has been deleted.
675    pub deleted: Option<bool>,
676    /// Container version display name.
677    pub name: Option<String>,
678    /// Number of clients in the container version.
679    #[serde(rename = "numClients")]
680    pub num_clients: Option<String>,
681    /// Number of custom templates in the container version.
682    #[serde(rename = "numCustomTemplates")]
683    pub num_custom_templates: Option<String>,
684    /// Number of Google tag configs in the container version.
685    #[serde(rename = "numGtagConfigs")]
686    pub num_gtag_configs: Option<String>,
687    /// Number of macros in the container version.
688    #[serde(rename = "numMacros")]
689    pub num_macros: Option<String>,
690    /// Number of rules in the container version.
691    #[serde(rename = "numRules")]
692    pub num_rules: Option<String>,
693    /// Number of tags in the container version.
694    #[serde(rename = "numTags")]
695    pub num_tags: Option<String>,
696    /// Number of transformations in the container version.
697    #[serde(rename = "numTransformations")]
698    pub num_transformations: Option<String>,
699    /// Number of triggers in the container version.
700    #[serde(rename = "numTriggers")]
701    pub num_triggers: Option<String>,
702    /// Number of variables in the container version.
703    #[serde(rename = "numVariables")]
704    pub num_variables: Option<String>,
705    /// Number of zones in the container version.
706    #[serde(rename = "numZones")]
707    pub num_zones: Option<String>,
708    /// GTM Container Version's API relative path.
709    pub path: Option<String>,
710}
711
712impl common::ResponseResult for ContainerVersionHeader {}
713
714/// There is no detailed description.
715///
716/// # Activities
717///
718/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
719/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
720///
721/// * [containers workspaces built_in_variables create accounts](AccountContainerWorkspaceBuiltInVariableCreateCall) (response)
722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
723#[serde_with::serde_as]
724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct CreateBuiltInVariableResponse {
726    /// List of created built-in variables.
727    #[serde(rename = "builtInVariable")]
728    pub built_in_variable: Option<Vec<BuiltInVariable>>,
729}
730
731impl common::ResponseResult for CreateBuiltInVariableResponse {}
732
733/// Options for new container versions.
734///
735/// # Activities
736///
737/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
738/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
739///
740/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (request)
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct CreateContainerVersionRequestVersionOptions {
745    /// The name of the container version to be created.
746    pub name: Option<String>,
747    /// The notes of the container version to be created.
748    pub notes: Option<String>,
749}
750
751impl common::RequestValue for CreateContainerVersionRequestVersionOptions {}
752
753/// Create container versions response.
754///
755/// # Activities
756///
757/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
758/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
759///
760/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (response)
761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
762#[serde_with::serde_as]
763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
764pub struct CreateContainerVersionResponse {
765    /// Compiler errors or not.
766    #[serde(rename = "compilerError")]
767    pub compiler_error: Option<bool>,
768    /// The container version created.
769    #[serde(rename = "containerVersion")]
770    pub container_version: Option<ContainerVersion>,
771    /// Auto generated workspace path created as a result of version creation. This field should only be populated if the created version was not a quick preview.
772    #[serde(rename = "newWorkspacePath")]
773    pub new_workspace_path: Option<String>,
774    /// Whether version creation failed when syncing the workspace to the latest container version.
775    #[serde(rename = "syncStatus")]
776    pub sync_status: Option<SyncStatus>,
777}
778
779impl common::ResponseResult for CreateContainerVersionResponse {}
780
781/// Represents a Google Tag Manager Custom Template’s contents.
782///
783/// # Activities
784///
785/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
786/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
787///
788/// * [containers workspaces templates create accounts](AccountContainerWorkspaceTemplateCreateCall) (request|response)
789/// * [containers workspaces templates get accounts](AccountContainerWorkspaceTemplateGetCall) (response)
790/// * [containers workspaces templates update accounts](AccountContainerWorkspaceTemplateUpdateCall) (request|response)
791#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
792#[serde_with::serde_as]
793#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
794pub struct CustomTemplate {
795    /// GTM Account ID.
796    #[serde(rename = "accountId")]
797    pub account_id: Option<String>,
798    /// GTM Container ID.
799    #[serde(rename = "containerId")]
800    pub container_id: Option<String>,
801    /// The fingerprint of the GTM Custom Template as computed at storage time. This value is recomputed whenever the template is modified.
802    pub fingerprint: Option<String>,
803    /// A reference to the Community Template Gallery entry.
804    #[serde(rename = "galleryReference")]
805    pub gallery_reference: Option<GalleryReference>,
806    /// Custom Template display name.
807    pub name: Option<String>,
808    /// GTM Custom Template's API relative path.
809    pub path: Option<String>,
810    /// Auto generated link to the tag manager UI
811    #[serde(rename = "tagManagerUrl")]
812    pub tag_manager_url: Option<String>,
813    /// The custom template in text format.
814    #[serde(rename = "templateData")]
815    pub template_data: Option<String>,
816    /// The Custom Template ID uniquely identifies the GTM custom template.
817    #[serde(rename = "templateId")]
818    pub template_id: Option<String>,
819    /// GTM Workspace ID.
820    #[serde(rename = "workspaceId")]
821    pub workspace_id: Option<String>,
822}
823
824impl common::RequestValue for CustomTemplate {}
825impl common::ResponseResult for CustomTemplate {}
826
827/// Represents a Google Tag Destination.
828///
829/// # Activities
830///
831/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
832/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
833///
834/// * [containers destinations get accounts](AccountContainerDestinationGetCall) (response)
835/// * [containers destinations link accounts](AccountContainerDestinationLinkCall) (response)
836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
837#[serde_with::serde_as]
838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
839pub struct Destination {
840    /// GTM Account ID.
841    #[serde(rename = "accountId")]
842    pub account_id: Option<String>,
843    /// GTM Container ID.
844    #[serde(rename = "containerId")]
845    pub container_id: Option<String>,
846    /// Destination ID.
847    #[serde(rename = "destinationId")]
848    pub destination_id: Option<String>,
849    /// The Destination link ID uniquely identifies the Destination.
850    #[serde(rename = "destinationLinkId")]
851    pub destination_link_id: Option<String>,
852    /// The fingerprint of the Google Tag Destination as computed at storage time. This value is recomputed whenever the destination is modified.
853    pub fingerprint: Option<String>,
854    /// Destination display name.
855    pub name: Option<String>,
856    /// Destination's API relative path.
857    pub path: Option<String>,
858    /// Auto generated link to the tag manager UI.
859    #[serde(rename = "tagManagerUrl")]
860    pub tag_manager_url: Option<String>,
861}
862
863impl common::ResponseResult for Destination {}
864
865/// A workspace entity that may represent a tag, trigger, variable, or folder in addition to its status in the workspace.
866///
867/// # Activities
868///
869/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
870/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
871///
872/// * [containers workspaces resolve_conflict accounts](AccountContainerWorkspaceResolveConflictCall) (request)
873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
874#[serde_with::serde_as]
875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
876pub struct Entity {
877    /// The built in variable being represented by the entity.
878    #[serde(rename = "builtInVariable")]
879    pub built_in_variable: Option<BuiltInVariable>,
880    /// Represents how the entity has been changed in the workspace.
881    #[serde(rename = "changeStatus")]
882    pub change_status: Option<String>,
883    /// The client being represented by the entity.
884    pub client: Option<Client>,
885    /// The custom template being represented by the entity.
886    #[serde(rename = "customTemplate")]
887    pub custom_template: Option<CustomTemplate>,
888    /// The folder being represented by the entity.
889    pub folder: Option<Folder>,
890    /// The gtag config being represented by the entity.
891    #[serde(rename = "gtagConfig")]
892    pub gtag_config: Option<GtagConfig>,
893    /// The tag being represented by the entity.
894    pub tag: Option<Tag>,
895    /// The transformation being represented by the entity.
896    pub transformation: Option<Transformation>,
897    /// The trigger being represented by the entity.
898    pub trigger: Option<Trigger>,
899    /// The variable being represented by the entity.
900    pub variable: Option<Variable>,
901    /// The zone being represented by the entity.
902    pub zone: Option<Zone>,
903}
904
905impl common::RequestValue for Entity {}
906
907/// 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.
908///
909/// # Activities
910///
911/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
912/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
913///
914/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (request|response)
915/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (response)
916/// * [containers environments reauthorize accounts](AccountContainerEnvironmentReauthorizeCall) (request|response)
917/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (request|response)
918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
919#[serde_with::serde_as]
920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
921pub struct Environment {
922    /// GTM Account ID.
923    #[serde(rename = "accountId")]
924    pub account_id: Option<String>,
925    /// The environment authorization code.
926    #[serde(rename = "authorizationCode")]
927    pub authorization_code: Option<String>,
928    /// The last update time-stamp for the authorization code.
929    #[serde(rename = "authorizationTimestamp")]
930    pub authorization_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
931    /// GTM Container ID.
932    #[serde(rename = "containerId")]
933    pub container_id: Option<String>,
934    /// Represents a link to a container version.
935    #[serde(rename = "containerVersionId")]
936    pub container_version_id: Option<String>,
937    /// The environment description. Can be set or changed only on USER type environments. @mutable tagmanager.accounts.containers.environments.create @mutable tagmanager.accounts.containers.environments.update
938    pub description: Option<String>,
939    /// Whether or not to enable debug by default for the environment. @mutable tagmanager.accounts.containers.environments.create @mutable tagmanager.accounts.containers.environments.update
940    #[serde(rename = "enableDebug")]
941    pub enable_debug: Option<bool>,
942    /// GTM Environment ID uniquely identifies the GTM Environment.
943    #[serde(rename = "environmentId")]
944    pub environment_id: Option<String>,
945    /// The fingerprint of the GTM environment as computed at storage time. This value is recomputed whenever the environment is modified.
946    pub fingerprint: Option<String>,
947    /// The environment display name. Can be set or changed only on USER type environments. @mutable tagmanager.accounts.containers.environments.create @mutable tagmanager.accounts.containers.environments.update
948    pub name: Option<String>,
949    /// GTM Environment's API relative path.
950    pub path: Option<String>,
951    /// Auto generated link to the tag manager UI
952    #[serde(rename = "tagManagerUrl")]
953    pub tag_manager_url: Option<String>,
954    /// The type of this environment.
955    #[serde(rename = "type")]
956    pub type_: Option<String>,
957    /// Default preview page url for the environment. @mutable tagmanager.accounts.containers.environments.create @mutable tagmanager.accounts.containers.environments.update
958    pub url: Option<String>,
959    /// Represents a link to a quick preview of a workspace.
960    #[serde(rename = "workspaceId")]
961    pub workspace_id: Option<String>,
962}
963
964impl common::RequestValue for Environment {}
965impl common::ResponseResult for Environment {}
966
967/// Represents a Google Tag Manager Folder.
968///
969/// # Activities
970///
971/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
972/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
973///
974/// * [containers workspaces folders create accounts](AccountContainerWorkspaceFolderCreateCall) (request|response)
975/// * [containers workspaces folders get accounts](AccountContainerWorkspaceFolderGetCall) (response)
976/// * [containers workspaces folders move_entities_to_folder accounts](AccountContainerWorkspaceFolderMoveEntitiesToFolderCall) (request)
977/// * [containers workspaces folders update accounts](AccountContainerWorkspaceFolderUpdateCall) (request|response)
978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
979#[serde_with::serde_as]
980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
981pub struct Folder {
982    /// GTM Account ID.
983    #[serde(rename = "accountId")]
984    pub account_id: Option<String>,
985    /// GTM Container ID.
986    #[serde(rename = "containerId")]
987    pub container_id: Option<String>,
988    /// The fingerprint of the GTM Folder as computed at storage time. This value is recomputed whenever the folder is modified.
989    pub fingerprint: Option<String>,
990    /// The Folder ID uniquely identifies the GTM Folder.
991    #[serde(rename = "folderId")]
992    pub folder_id: Option<String>,
993    /// Folder display name. @mutable tagmanager.accounts.containers.workspaces.folders.create @mutable tagmanager.accounts.containers.workspaces.folders.update
994    pub name: Option<String>,
995    /// User notes on how to apply this folder in the container. @mutable tagmanager.accounts.containers.workspaces.folders.create @mutable tagmanager.accounts.containers.workspaces.folders.update
996    pub notes: Option<String>,
997    /// GTM Folder's API relative path.
998    pub path: Option<String>,
999    /// Auto generated link to the tag manager UI
1000    #[serde(rename = "tagManagerUrl")]
1001    pub tag_manager_url: Option<String>,
1002    /// GTM Workspace ID.
1003    #[serde(rename = "workspaceId")]
1004    pub workspace_id: Option<String>,
1005}
1006
1007impl common::RequestValue for Folder {}
1008impl common::ResponseResult for Folder {}
1009
1010/// Represents a Google Tag Manager Folder’s contents.
1011///
1012/// # Activities
1013///
1014/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1015/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1016///
1017/// * [containers workspaces folders entities accounts](AccountContainerWorkspaceFolderEntityCall) (response)
1018#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1019#[serde_with::serde_as]
1020#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1021pub struct FolderEntities {
1022    /// Continuation token for fetching the next page of results.
1023    #[serde(rename = "nextPageToken")]
1024    pub next_page_token: Option<String>,
1025    /// The list of tags inside the folder.
1026    pub tag: Option<Vec<Tag>>,
1027    /// The list of triggers inside the folder.
1028    pub trigger: Option<Vec<Trigger>>,
1029    /// The list of variables inside the folder.
1030    pub variable: Option<Vec<Variable>>,
1031}
1032
1033impl common::ResponseResult for FolderEntities {}
1034
1035/// Represents the link between a custom template and an entry on the Community Template Gallery site.
1036///
1037/// This type is not used in any activity, and only used as *part* of another schema.
1038///
1039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1040#[serde_with::serde_as]
1041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1042pub struct GalleryReference {
1043    /// The name of the host for the community gallery template.
1044    pub host: Option<String>,
1045    /// If a user has manually edited the community gallery template.
1046    #[serde(rename = "isModified")]
1047    pub is_modified: Option<bool>,
1048    /// The name of the owner for the community gallery template.
1049    pub owner: Option<String>,
1050    /// The name of the repository for the community gallery template.
1051    pub repository: Option<String>,
1052    /// The signature of the community gallery template as computed at import time. This value is recomputed whenever the template is updated from the gallery.
1053    pub signature: Option<String>,
1054    /// The version of the community gallery template.
1055    pub version: Option<String>,
1056}
1057
1058impl common::Part for GalleryReference {}
1059
1060/// There is no detailed description.
1061///
1062/// # Activities
1063///
1064/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1065/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1066///
1067/// * [containers snippet accounts](AccountContainerSnippetCall) (response)
1068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1069#[serde_with::serde_as]
1070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1071pub struct GetContainerSnippetResponse {
1072    /// Tagging snippet for a Container.
1073    pub snippet: Option<String>,
1074}
1075
1076impl common::ResponseResult for GetContainerSnippetResponse {}
1077
1078/// The changes that have occurred in the workspace since the base container version.
1079///
1080/// # Activities
1081///
1082/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1083/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1084///
1085/// * [containers workspaces get status accounts](AccountContainerWorkspaceGetStatuCall) (response)
1086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1087#[serde_with::serde_as]
1088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1089pub struct GetWorkspaceStatusResponse {
1090    /// The merge conflict after sync.
1091    #[serde(rename = "mergeConflict")]
1092    pub merge_conflict: Option<Vec<MergeConflict>>,
1093    /// Entities that have been changed in the workspace.
1094    #[serde(rename = "workspaceChange")]
1095    pub workspace_change: Option<Vec<Entity>>,
1096}
1097
1098impl common::ResponseResult for GetWorkspaceStatusResponse {}
1099
1100/// Represents a Google tag configuration.
1101///
1102/// # Activities
1103///
1104/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1105/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1106///
1107/// * [containers workspaces gtag_config create accounts](AccountContainerWorkspaceGtagConfigCreateCall) (request|response)
1108/// * [containers workspaces gtag_config get accounts](AccountContainerWorkspaceGtagConfigGetCall) (response)
1109/// * [containers workspaces gtag_config update accounts](AccountContainerWorkspaceGtagConfigUpdateCall) (request|response)
1110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1111#[serde_with::serde_as]
1112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1113pub struct GtagConfig {
1114    /// Google tag account ID.
1115    #[serde(rename = "accountId")]
1116    pub account_id: Option<String>,
1117    /// Google tag container ID.
1118    #[serde(rename = "containerId")]
1119    pub container_id: Option<String>,
1120    /// The fingerprint of the Google tag config as computed at storage time. This value is recomputed whenever the config is modified.
1121    pub fingerprint: Option<String>,
1122    /// The ID uniquely identifies the Google tag config.
1123    #[serde(rename = "gtagConfigId")]
1124    pub gtag_config_id: Option<String>,
1125    /// The Google tag config's parameters. @mutable tagmanager.accounts.containers.workspaces.gtag_config.create @mutable tagmanager.accounts.containers.workspaces.gtag_config.update
1126    pub parameter: Option<Vec<Parameter>>,
1127    /// Google tag config's API relative path.
1128    pub path: Option<String>,
1129    /// Auto generated link to the tag manager UI
1130    #[serde(rename = "tagManagerUrl")]
1131    pub tag_manager_url: Option<String>,
1132    /// Google tag config type. @required tagmanager.accounts.containers.workspaces.gtag_config.create @required tagmanager.accounts.containers.workspaces.gtag_config.update @mutable tagmanager.accounts.containers.workspaces.gtag_config.create @mutable tagmanager.accounts.containers.workspaces.gtag_config.update
1133    #[serde(rename = "type")]
1134    pub type_: Option<String>,
1135    /// Google tag workspace ID. Only used by GTM containers. Set to 0 otherwise.
1136    #[serde(rename = "workspaceId")]
1137    pub workspace_id: Option<String>,
1138}
1139
1140impl common::RequestValue for GtagConfig {}
1141impl common::ResponseResult for GtagConfig {}
1142
1143/// List Accounts Response.
1144///
1145/// # Activities
1146///
1147/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1148/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1149///
1150/// * [list accounts](AccountListCall) (response)
1151#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1152#[serde_with::serde_as]
1153#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1154pub struct ListAccountsResponse {
1155    /// List of GTM Accounts that a user has access to.
1156    pub account: Option<Vec<Account>>,
1157    /// Continuation token for fetching the next page of results.
1158    #[serde(rename = "nextPageToken")]
1159    pub next_page_token: Option<String>,
1160}
1161
1162impl common::ResponseResult for ListAccountsResponse {}
1163
1164/// There is no detailed description.
1165///
1166/// # Activities
1167///
1168/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1169/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1170///
1171/// * [containers workspaces clients list accounts](AccountContainerWorkspaceClientListCall) (response)
1172#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1173#[serde_with::serde_as]
1174#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1175pub struct ListClientsResponse {
1176    /// All GTM Clients of a GTM Container.
1177    pub client: Option<Vec<Client>>,
1178    /// Continuation token for fetching the next page of results.
1179    #[serde(rename = "nextPageToken")]
1180    pub next_page_token: Option<String>,
1181}
1182
1183impl common::ResponseResult for ListClientsResponse {}
1184
1185/// List container versions response.
1186///
1187/// # Activities
1188///
1189/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1190/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1191///
1192/// * [containers version_headers list accounts](AccountContainerVersionHeaderListCall) (response)
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct ListContainerVersionsResponse {
1197    /// All container version headers of a GTM Container.
1198    #[serde(rename = "containerVersionHeader")]
1199    pub container_version_header: Option<Vec<ContainerVersionHeader>>,
1200    /// Continuation token for fetching the next page of results.
1201    #[serde(rename = "nextPageToken")]
1202    pub next_page_token: Option<String>,
1203}
1204
1205impl common::ResponseResult for ListContainerVersionsResponse {}
1206
1207/// List Containers Response.
1208///
1209/// # Activities
1210///
1211/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1212/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1213///
1214/// * [containers list accounts](AccountContainerListCall) (response)
1215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1216#[serde_with::serde_as]
1217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1218pub struct ListContainersResponse {
1219    /// All Containers of a GTM Account.
1220    pub container: Option<Vec<Container>>,
1221    /// Continuation token for fetching the next page of results.
1222    #[serde(rename = "nextPageToken")]
1223    pub next_page_token: Option<String>,
1224}
1225
1226impl common::ResponseResult for ListContainersResponse {}
1227
1228/// There is no detailed description.
1229///
1230/// # Activities
1231///
1232/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1233/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1234///
1235/// * [containers destinations list accounts](AccountContainerDestinationListCall) (response)
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct ListDestinationsResponse {
1240    /// All Destinations linked to a GTM Container.
1241    pub destination: Option<Vec<Destination>>,
1242    /// Continuation token for fetching the next page of results.
1243    #[serde(rename = "nextPageToken")]
1244    pub next_page_token: Option<String>,
1245}
1246
1247impl common::ResponseResult for ListDestinationsResponse {}
1248
1249/// A list of enabled built-in variables.
1250///
1251/// # Activities
1252///
1253/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1254/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1255///
1256/// * [containers workspaces built_in_variables list accounts](AccountContainerWorkspaceBuiltInVariableListCall) (response)
1257#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1258#[serde_with::serde_as]
1259#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1260pub struct ListEnabledBuiltInVariablesResponse {
1261    /// All GTM BuiltInVariables of a GTM container.
1262    #[serde(rename = "builtInVariable")]
1263    pub built_in_variable: Option<Vec<BuiltInVariable>>,
1264    /// Continuation token for fetching the next page of results.
1265    #[serde(rename = "nextPageToken")]
1266    pub next_page_token: Option<String>,
1267}
1268
1269impl common::ResponseResult for ListEnabledBuiltInVariablesResponse {}
1270
1271/// List Environments Response.
1272///
1273/// # Activities
1274///
1275/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1276/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1277///
1278/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (response)
1279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1280#[serde_with::serde_as]
1281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1282pub struct ListEnvironmentsResponse {
1283    /// All Environments of a GTM Container.
1284    pub environment: Option<Vec<Environment>>,
1285    /// Continuation token for fetching the next page of results.
1286    #[serde(rename = "nextPageToken")]
1287    pub next_page_token: Option<String>,
1288}
1289
1290impl common::ResponseResult for ListEnvironmentsResponse {}
1291
1292/// List Folders Response.
1293///
1294/// # Activities
1295///
1296/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1297/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1298///
1299/// * [containers workspaces folders list accounts](AccountContainerWorkspaceFolderListCall) (response)
1300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1301#[serde_with::serde_as]
1302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1303pub struct ListFoldersResponse {
1304    /// All GTM Folders of a GTM Container.
1305    pub folder: Option<Vec<Folder>>,
1306    /// Continuation token for fetching the next page of results.
1307    #[serde(rename = "nextPageToken")]
1308    pub next_page_token: Option<String>,
1309}
1310
1311impl common::ResponseResult for ListFoldersResponse {}
1312
1313/// There is no detailed description.
1314///
1315/// # Activities
1316///
1317/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1318/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1319///
1320/// * [containers workspaces gtag_config list accounts](AccountContainerWorkspaceGtagConfigListCall) (response)
1321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1322#[serde_with::serde_as]
1323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1324pub struct ListGtagConfigResponse {
1325    /// All Google tag configs in a Container.
1326    #[serde(rename = "gtagConfig")]
1327    pub gtag_config: Option<Vec<GtagConfig>>,
1328    /// Continuation token for fetching the next page of results.
1329    #[serde(rename = "nextPageToken")]
1330    pub next_page_token: Option<String>,
1331}
1332
1333impl common::ResponseResult for ListGtagConfigResponse {}
1334
1335/// List Tags Response.
1336///
1337/// # Activities
1338///
1339/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1341///
1342/// * [containers workspaces tags list accounts](AccountContainerWorkspaceTagListCall) (response)
1343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1344#[serde_with::serde_as]
1345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1346pub struct ListTagsResponse {
1347    /// Continuation token for fetching the next page of results.
1348    #[serde(rename = "nextPageToken")]
1349    pub next_page_token: Option<String>,
1350    /// All GTM Tags of a GTM Container.
1351    pub tag: Option<Vec<Tag>>,
1352}
1353
1354impl common::ResponseResult for ListTagsResponse {}
1355
1356/// There is no detailed description.
1357///
1358/// # Activities
1359///
1360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1362///
1363/// * [containers workspaces templates list accounts](AccountContainerWorkspaceTemplateListCall) (response)
1364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1365#[serde_with::serde_as]
1366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1367pub struct ListTemplatesResponse {
1368    /// Continuation token for fetching the next page of results.
1369    #[serde(rename = "nextPageToken")]
1370    pub next_page_token: Option<String>,
1371    /// All GTM Custom Templates of a GTM Container.
1372    pub template: Option<Vec<CustomTemplate>>,
1373}
1374
1375impl common::ResponseResult for ListTemplatesResponse {}
1376
1377/// There is no detailed description.
1378///
1379/// # Activities
1380///
1381/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1383///
1384/// * [containers workspaces transformations list accounts](AccountContainerWorkspaceTransformationListCall) (response)
1385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1386#[serde_with::serde_as]
1387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1388pub struct ListTransformationsResponse {
1389    /// Continuation token for fetching the next page of results.
1390    #[serde(rename = "nextPageToken")]
1391    pub next_page_token: Option<String>,
1392    /// All GTM Transformations of a GTM Container.
1393    pub transformation: Option<Vec<Transformation>>,
1394}
1395
1396impl common::ResponseResult for ListTransformationsResponse {}
1397
1398/// List triggers response.
1399///
1400/// # Activities
1401///
1402/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1403/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1404///
1405/// * [containers workspaces triggers list accounts](AccountContainerWorkspaceTriggerListCall) (response)
1406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1407#[serde_with::serde_as]
1408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1409pub struct ListTriggersResponse {
1410    /// Continuation token for fetching the next page of results.
1411    #[serde(rename = "nextPageToken")]
1412    pub next_page_token: Option<String>,
1413    /// All GTM Triggers of a GTM Container.
1414    pub trigger: Option<Vec<Trigger>>,
1415}
1416
1417impl common::ResponseResult for ListTriggersResponse {}
1418
1419/// List user permissions response.
1420///
1421/// # Activities
1422///
1423/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1424/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1425///
1426/// * [user_permissions list accounts](AccountUserPermissionListCall) (response)
1427#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1428#[serde_with::serde_as]
1429#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1430pub struct ListUserPermissionsResponse {
1431    /// Continuation token for fetching the next page of results.
1432    #[serde(rename = "nextPageToken")]
1433    pub next_page_token: Option<String>,
1434    /// All GTM UserPermissions of a GTM Account.
1435    #[serde(rename = "userPermission")]
1436    pub user_permission: Option<Vec<UserPermission>>,
1437}
1438
1439impl common::ResponseResult for ListUserPermissionsResponse {}
1440
1441/// List Variables Response.
1442///
1443/// # Activities
1444///
1445/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1446/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1447///
1448/// * [containers workspaces variables list accounts](AccountContainerWorkspaceVariableListCall) (response)
1449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1450#[serde_with::serde_as]
1451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1452pub struct ListVariablesResponse {
1453    /// Continuation token for fetching the next page of results.
1454    #[serde(rename = "nextPageToken")]
1455    pub next_page_token: Option<String>,
1456    /// All GTM Variables of a GTM Container.
1457    pub variable: Option<Vec<Variable>>,
1458}
1459
1460impl common::ResponseResult for ListVariablesResponse {}
1461
1462/// A list of workspaces in a container.
1463///
1464/// # Activities
1465///
1466/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1467/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1468///
1469/// * [containers workspaces list accounts](AccountContainerWorkspaceListCall) (response)
1470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1471#[serde_with::serde_as]
1472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1473pub struct ListWorkspacesResponse {
1474    /// Continuation token for fetching the next page of results.
1475    #[serde(rename = "nextPageToken")]
1476    pub next_page_token: Option<String>,
1477    /// All Workspaces of a GTM Container.
1478    pub workspace: Option<Vec<Workspace>>,
1479}
1480
1481impl common::ResponseResult for ListWorkspacesResponse {}
1482
1483/// There is no detailed description.
1484///
1485/// # Activities
1486///
1487/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1488/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1489///
1490/// * [containers workspaces zones list accounts](AccountContainerWorkspaceZoneListCall) (response)
1491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1492#[serde_with::serde_as]
1493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1494pub struct ListZonesResponse {
1495    /// Continuation token for fetching the next page of results.
1496    #[serde(rename = "nextPageToken")]
1497    pub next_page_token: Option<String>,
1498    /// All GTM Zones of a GTM Container.
1499    pub zone: Option<Vec<Zone>>,
1500}
1501
1502impl common::ResponseResult for ListZonesResponse {}
1503
1504/// Represents a merge conflict.
1505///
1506/// This type is not used in any activity, and only used as *part* of another schema.
1507///
1508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1509#[serde_with::serde_as]
1510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1511pub struct MergeConflict {
1512    /// The base version entity (since the latest sync operation) that has conflicting changes compared to the workspace. If this field is missing, it means the workspace entity is deleted from the base version.
1513    #[serde(rename = "entityInBaseVersion")]
1514    pub entity_in_base_version: Option<Entity>,
1515    /// The workspace entity that has conflicting changes compared to the base version. If an entity is deleted in a workspace, it will still appear with a deleted change status.
1516    #[serde(rename = "entityInWorkspace")]
1517    pub entity_in_workspace: Option<Entity>,
1518}
1519
1520impl common::Part for MergeConflict {}
1521
1522/// Represents a Google Tag Manager Parameter.
1523///
1524/// This type is not used in any activity, and only used as *part* of another schema.
1525///
1526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1527#[serde_with::serde_as]
1528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1529pub struct Parameter {
1530    /// Whether or not a reference type parameter is strongly or weakly referenced. Only used by Transformations. @mutable tagmanager.accounts.containers.workspaces.transformations.create @mutable tagmanager.accounts.containers.workspaces.transformations.update
1531    #[serde(rename = "isWeakReference")]
1532    pub is_weak_reference: Option<bool>,
1533    /// The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1534    pub key: Option<String>,
1535    /// This list parameter's parameters (keys will be ignored). @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1536    pub list: Option<Vec<Parameter>>,
1537    /// This map parameter's parameters (must have keys; keys must be unique). @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1538    pub map: Option<Vec<Parameter>>,
1539    /// 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 @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1540    #[serde(rename = "type")]
1541    pub type_: Option<String>,
1542    /// A parameter's value (may contain variable references such as "{{myVariable}}") as appropriate to the specified type. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1543    pub value: Option<String>,
1544}
1545
1546impl common::Part for Parameter {}
1547
1548/// Publish container version response.
1549///
1550/// # Activities
1551///
1552/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1553/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1554///
1555/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (response)
1556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1557#[serde_with::serde_as]
1558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1559pub struct PublishContainerVersionResponse {
1560    /// Compiler errors or not.
1561    #[serde(rename = "compilerError")]
1562    pub compiler_error: Option<bool>,
1563    /// The container version created.
1564    #[serde(rename = "containerVersion")]
1565    pub container_version: Option<ContainerVersion>,
1566}
1567
1568impl common::ResponseResult for PublishContainerVersionResponse {}
1569
1570/// Response to quick previewing a workspace.
1571///
1572/// # Activities
1573///
1574/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1575/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1576///
1577/// * [containers workspaces quick_preview accounts](AccountContainerWorkspaceQuickPreviewCall) (response)
1578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1579#[serde_with::serde_as]
1580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1581pub struct QuickPreviewResponse {
1582    /// Were there compiler errors or not.
1583    #[serde(rename = "compilerError")]
1584    pub compiler_error: Option<bool>,
1585    /// The quick previewed container version.
1586    #[serde(rename = "containerVersion")]
1587    pub container_version: Option<ContainerVersion>,
1588    /// Whether quick previewing failed when syncing the workspace to the latest container version.
1589    #[serde(rename = "syncStatus")]
1590    pub sync_status: Option<SyncStatus>,
1591}
1592
1593impl common::ResponseResult for QuickPreviewResponse {}
1594
1595/// The result of reverting a built-in variable in a workspace.
1596///
1597/// # Activities
1598///
1599/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1600/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1601///
1602/// * [containers workspaces built_in_variables revert accounts](AccountContainerWorkspaceBuiltInVariableRevertCall) (response)
1603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1604#[serde_with::serde_as]
1605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1606pub struct RevertBuiltInVariableResponse {
1607    /// Whether the built-in variable is enabled after reversion.
1608    pub enabled: Option<bool>,
1609}
1610
1611impl common::ResponseResult for RevertBuiltInVariableResponse {}
1612
1613/// The result of reverting a client in a workspace.
1614///
1615/// # Activities
1616///
1617/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1618/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1619///
1620/// * [containers workspaces clients revert accounts](AccountContainerWorkspaceClientRevertCall) (response)
1621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1622#[serde_with::serde_as]
1623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1624pub struct RevertClientResponse {
1625    /// Client as it appears in the latest container version since the last workspace synchronization operation. If no client is present, that means the client was deleted in the latest container version.
1626    pub client: Option<Client>,
1627}
1628
1629impl common::ResponseResult for RevertClientResponse {}
1630
1631/// The result of reverting folder changes in a workspace.
1632///
1633/// # Activities
1634///
1635/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1636/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1637///
1638/// * [containers workspaces folders revert accounts](AccountContainerWorkspaceFolderRevertCall) (response)
1639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1640#[serde_with::serde_as]
1641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1642pub struct RevertFolderResponse {
1643    /// Folder as it appears in the latest container version since the last workspace synchronization operation. If no folder is present, that means the folder was deleted in the latest container version.
1644    pub folder: Option<Folder>,
1645}
1646
1647impl common::ResponseResult for RevertFolderResponse {}
1648
1649/// The result of reverting a tag in a workspace.
1650///
1651/// # Activities
1652///
1653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1655///
1656/// * [containers workspaces tags revert accounts](AccountContainerWorkspaceTagRevertCall) (response)
1657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1658#[serde_with::serde_as]
1659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1660pub struct RevertTagResponse {
1661    /// Tag as it appears in the latest container version since the last workspace synchronization operation. If no tag is present, that means the tag was deleted in the latest container version.
1662    pub tag: Option<Tag>,
1663}
1664
1665impl common::ResponseResult for RevertTagResponse {}
1666
1667/// The result of reverting a template in a workspace.
1668///
1669/// # Activities
1670///
1671/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1672/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1673///
1674/// * [containers workspaces templates revert accounts](AccountContainerWorkspaceTemplateRevertCall) (response)
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct RevertTemplateResponse {
1679    /// Template as it appears in the latest container version since the last workspace synchronization operation. If no template is present, that means the template was deleted in the latest container version.
1680    pub template: Option<CustomTemplate>,
1681}
1682
1683impl common::ResponseResult for RevertTemplateResponse {}
1684
1685/// The result of reverting a transformation in a workspace.
1686///
1687/// # Activities
1688///
1689/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1690/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1691///
1692/// * [containers workspaces transformations revert accounts](AccountContainerWorkspaceTransformationRevertCall) (response)
1693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1694#[serde_with::serde_as]
1695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1696pub struct RevertTransformationResponse {
1697    /// Transformation as it appears in the latest container version since the last workspace synchronization operation. If no transformation is present, that means the transformation was deleted in the latest container version.
1698    pub transformation: Option<Transformation>,
1699}
1700
1701impl common::ResponseResult for RevertTransformationResponse {}
1702
1703/// The result of reverting a trigger in a workspace.
1704///
1705/// # Activities
1706///
1707/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1708/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1709///
1710/// * [containers workspaces triggers revert accounts](AccountContainerWorkspaceTriggerRevertCall) (response)
1711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1712#[serde_with::serde_as]
1713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1714pub struct RevertTriggerResponse {
1715    /// Trigger as it appears in the latest container version since the last workspace synchronization operation. If no trigger is present, that means the trigger was deleted in the latest container version.
1716    pub trigger: Option<Trigger>,
1717}
1718
1719impl common::ResponseResult for RevertTriggerResponse {}
1720
1721/// The result of reverting a variable in a workspace.
1722///
1723/// # Activities
1724///
1725/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1726/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1727///
1728/// * [containers workspaces variables revert accounts](AccountContainerWorkspaceVariableRevertCall) (response)
1729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1730#[serde_with::serde_as]
1731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1732pub struct RevertVariableResponse {
1733    /// Variable as it appears in the latest container version since the last workspace synchronization operation. If no variable is present, that means the variable was deleted in the latest container version.
1734    pub variable: Option<Variable>,
1735}
1736
1737impl common::ResponseResult for RevertVariableResponse {}
1738
1739/// The result of reverting a zone in a workspace.
1740///
1741/// # Activities
1742///
1743/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1744/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1745///
1746/// * [containers workspaces zones revert accounts](AccountContainerWorkspaceZoneRevertCall) (response)
1747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1748#[serde_with::serde_as]
1749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1750pub struct RevertZoneResponse {
1751    /// Zone as it appears in the latest container version since the last workspace synchronization operation. If no zone is present, that means the zone was deleted in the latest container version.
1752    pub zone: Option<Zone>,
1753}
1754
1755impl common::ResponseResult for RevertZoneResponse {}
1756
1757/// Represents a reference to atag that fires before another tag in order to set up dependencies.
1758///
1759/// This type is not used in any activity, and only used as *part* of another schema.
1760///
1761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1762#[serde_with::serde_as]
1763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1764pub struct SetupTag {
1765    /// 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.
1766    #[serde(rename = "stopOnSetupFailure")]
1767    pub stop_on_setup_failure: Option<bool>,
1768    /// The name of the setup tag.
1769    #[serde(rename = "tagName")]
1770    pub tag_name: Option<String>,
1771}
1772
1773impl common::Part for SetupTag {}
1774
1775/// The status of a workspace after synchronization.
1776///
1777/// This type is not used in any activity, and only used as *part* of another schema.
1778///
1779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1780#[serde_with::serde_as]
1781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1782pub struct SyncStatus {
1783    /// Synchornization operation detected a merge conflict.
1784    #[serde(rename = "mergeConflict")]
1785    pub merge_conflict: Option<bool>,
1786    /// An error occurred during the synchronization operation.
1787    #[serde(rename = "syncError")]
1788    pub sync_error: Option<bool>,
1789}
1790
1791impl common::Part for SyncStatus {}
1792
1793/// A response after synchronizing the workspace to the latest container version.
1794///
1795/// # Activities
1796///
1797/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1798/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1799///
1800/// * [containers workspaces sync accounts](AccountContainerWorkspaceSyncCall) (response)
1801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1802#[serde_with::serde_as]
1803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1804pub struct SyncWorkspaceResponse {
1805    /// The merge conflict after sync. If this field is not empty, the sync is still treated as successful. But a version cannot be created until all conflicts are resolved.
1806    #[serde(rename = "mergeConflict")]
1807    pub merge_conflict: Option<Vec<MergeConflict>>,
1808    /// Indicates whether synchronization caused a merge conflict or sync error.
1809    #[serde(rename = "syncStatus")]
1810    pub sync_status: Option<SyncStatus>,
1811}
1812
1813impl common::ResponseResult for SyncWorkspaceResponse {}
1814
1815/// Represents a Google Tag Manager Tag.
1816///
1817/// # Activities
1818///
1819/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1820/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1821///
1822/// * [containers workspaces tags create accounts](AccountContainerWorkspaceTagCreateCall) (request|response)
1823/// * [containers workspaces tags get accounts](AccountContainerWorkspaceTagGetCall) (response)
1824/// * [containers workspaces tags update accounts](AccountContainerWorkspaceTagUpdateCall) (request|response)
1825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1826#[serde_with::serde_as]
1827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1828pub struct Tag {
1829    /// GTM Account ID.
1830    #[serde(rename = "accountId")]
1831    pub account_id: Option<String>,
1832    /// Blocking rule IDs. If any of the listed rules evaluate to true, the tag will not fire. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1833    #[serde(rename = "blockingRuleId")]
1834    pub blocking_rule_id: Option<Vec<String>>,
1835    /// Blocking trigger IDs. If any of the listed triggers evaluate to true, the tag will not fire. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1836    #[serde(rename = "blockingTriggerId")]
1837    pub blocking_trigger_id: Option<Vec<String>>,
1838    /// Consent settings of a tag. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1839    #[serde(rename = "consentSettings")]
1840    pub consent_settings: Option<TagConsentSetting>,
1841    /// GTM Container ID.
1842    #[serde(rename = "containerId")]
1843    pub container_id: Option<String>,
1844    /// The fingerprint of the GTM Tag as computed at storage time. This value is recomputed whenever the tag is modified.
1845    pub fingerprint: Option<String>,
1846    /// Firing rule IDs. A tag will fire when any of the listed rules are true and all of its blockingRuleIds (if any specified) are false. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1847    #[serde(rename = "firingRuleId")]
1848    pub firing_rule_id: Option<Vec<String>>,
1849    /// 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. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1850    #[serde(rename = "firingTriggerId")]
1851    pub firing_trigger_id: Option<Vec<String>>,
1852    /// If set to true, this tag will only fire in the live environment (e.g. not in preview or debug mode). @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1853    #[serde(rename = "liveOnly")]
1854    pub live_only: Option<bool>,
1855    /// A map of key-value pairs of tag metadata to be included in the event data for tag monitoring. Notes: - This parameter must be type MAP. - Each parameter in the map are type TEMPLATE, however cannot contain variable references. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1856    #[serde(rename = "monitoringMetadata")]
1857    pub monitoring_metadata: Option<Parameter>,
1858    /// If non-empty, then the tag display name will be included in the monitoring metadata map using the key specified. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1859    #[serde(rename = "monitoringMetadataTagNameKey")]
1860    pub monitoring_metadata_tag_name_key: Option<String>,
1861    /// Tag display name. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1862    pub name: Option<String>,
1863    /// User notes on how to apply this tag in the container. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1864    pub notes: Option<String>,
1865    /// The tag's parameters. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1866    pub parameter: Option<Vec<Parameter>>,
1867    /// Parent folder id.
1868    #[serde(rename = "parentFolderId")]
1869    pub parent_folder_id: Option<String>,
1870    /// GTM Tag's API relative path.
1871    pub path: Option<String>,
1872    /// Indicates whether the tag is paused, which prevents the tag from firing. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1873    pub paused: Option<bool>,
1874    /// 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. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1875    pub priority: Option<Parameter>,
1876    /// The end timestamp in milliseconds to schedule a tag. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1877    #[serde(rename = "scheduleEndMs")]
1878    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1879    pub schedule_end_ms: Option<i64>,
1880    /// The start timestamp in milliseconds to schedule a tag. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1881    #[serde(rename = "scheduleStartMs")]
1882    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1883    pub schedule_start_ms: Option<i64>,
1884    /// The list of setup tags. Currently we only allow one.
1885    #[serde(rename = "setupTag")]
1886    pub setup_tag: Option<Vec<SetupTag>>,
1887    /// Option to fire this tag.
1888    #[serde(rename = "tagFiringOption")]
1889    pub tag_firing_option: Option<String>,
1890    /// The Tag ID uniquely identifies the GTM Tag.
1891    #[serde(rename = "tagId")]
1892    pub tag_id: Option<String>,
1893    /// Auto generated link to the tag manager UI
1894    #[serde(rename = "tagManagerUrl")]
1895    pub tag_manager_url: Option<String>,
1896    /// The list of teardown tags. Currently we only allow one.
1897    #[serde(rename = "teardownTag")]
1898    pub teardown_tag: Option<Vec<TeardownTag>>,
1899    /// GTM Tag Type. @mutable tagmanager.accounts.containers.workspaces.tags.create @mutable tagmanager.accounts.containers.workspaces.tags.update
1900    #[serde(rename = "type")]
1901    pub type_: Option<String>,
1902    /// GTM Workspace ID.
1903    #[serde(rename = "workspaceId")]
1904    pub workspace_id: Option<String>,
1905}
1906
1907impl common::RequestValue for Tag {}
1908impl common::ResponseResult for Tag {}
1909
1910/// There is no detailed description.
1911///
1912/// This type is not used in any activity, and only used as *part* of another schema.
1913///
1914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1915#[serde_with::serde_as]
1916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1917pub struct TagConsentSetting {
1918    /// The tag's consent status. If set to NEEDED, the runtime will check that the consent types specified by the consent_type field have been granted.
1919    #[serde(rename = "consentStatus")]
1920    pub consent_status: Option<String>,
1921    /// The type of consents to check for during tag firing if in the consent NEEDED state. This parameter must be of type LIST where each list item is of type STRING.
1922    #[serde(rename = "consentType")]
1923    pub consent_type: Option<Parameter>,
1924}
1925
1926impl common::Part for TagConsentSetting {}
1927
1928/// Represents a tag that fires after another tag in order to tear down dependencies.
1929///
1930/// This type is not used in any activity, and only used as *part* of another schema.
1931///
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct TeardownTag {
1936    /// 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.
1937    #[serde(rename = "stopTeardownOnFailure")]
1938    pub stop_teardown_on_failure: Option<bool>,
1939    /// The name of the teardown tag.
1940    #[serde(rename = "tagName")]
1941    pub tag_name: Option<String>,
1942}
1943
1944impl common::Part for TeardownTag {}
1945
1946/// Represents a Google Tag Manager Transformation.
1947///
1948/// # Activities
1949///
1950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1952///
1953/// * [containers workspaces transformations create accounts](AccountContainerWorkspaceTransformationCreateCall) (request|response)
1954/// * [containers workspaces transformations get accounts](AccountContainerWorkspaceTransformationGetCall) (response)
1955/// * [containers workspaces transformations update accounts](AccountContainerWorkspaceTransformationUpdateCall) (request|response)
1956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1957#[serde_with::serde_as]
1958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1959pub struct Transformation {
1960    /// GTM Account ID.
1961    #[serde(rename = "accountId")]
1962    pub account_id: Option<String>,
1963    /// GTM Container ID.
1964    #[serde(rename = "containerId")]
1965    pub container_id: Option<String>,
1966    /// The fingerprint of the GTM Transformation as computed at storage time. This value is recomputed whenever the transformation is modified.
1967    pub fingerprint: Option<String>,
1968    /// Transformation display name. @mutable tagmanager.accounts.containers.workspaces.transformations.create @mutable tagmanager.accounts.containers.workspaces.transformations.update
1969    pub name: Option<String>,
1970    /// User notes on how to apply this transformation in the container. @mutable tagmanager.accounts.containers.workspaces.transformations.create @mutable tagmanager.accounts.containers.workspaces.transformations.update
1971    pub notes: Option<String>,
1972    /// The transformation's parameters. @mutable tagmanager.accounts.containers.workspaces.transformations.create @mutable tagmanager.accounts.containers.workspaces.transformations.update
1973    pub parameter: Option<Vec<Parameter>>,
1974    /// Parent folder id.
1975    #[serde(rename = "parentFolderId")]
1976    pub parent_folder_id: Option<String>,
1977    /// GTM transformation's API relative path.
1978    pub path: Option<String>,
1979    /// Auto generated link to the tag manager UI
1980    #[serde(rename = "tagManagerUrl")]
1981    pub tag_manager_url: Option<String>,
1982    /// The Transformation ID uniquely identifies the GTM transformation.
1983    #[serde(rename = "transformationId")]
1984    pub transformation_id: Option<String>,
1985    /// Transformation type. @mutable tagmanager.accounts.containers.workspaces.transformations.create @mutable tagmanager.accounts.containers.workspaces.transformations.update
1986    #[serde(rename = "type")]
1987    pub type_: Option<String>,
1988    /// GTM Workspace ID.
1989    #[serde(rename = "workspaceId")]
1990    pub workspace_id: Option<String>,
1991}
1992
1993impl common::RequestValue for Transformation {}
1994impl common::ResponseResult for Transformation {}
1995
1996/// Represents a Google Tag Manager Trigger
1997///
1998/// # Activities
1999///
2000/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2001/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2002///
2003/// * [containers workspaces triggers create accounts](AccountContainerWorkspaceTriggerCreateCall) (request|response)
2004/// * [containers workspaces triggers get accounts](AccountContainerWorkspaceTriggerGetCall) (response)
2005/// * [containers workspaces triggers update accounts](AccountContainerWorkspaceTriggerUpdateCall) (request|response)
2006#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2007#[serde_with::serde_as]
2008#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2009pub struct Trigger {
2010    /// GTM Account ID.
2011    #[serde(rename = "accountId")]
2012    pub account_id: Option<String>,
2013    /// Used in the case of auto event tracking. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2014    #[serde(rename = "autoEventFilter")]
2015    pub auto_event_filter: Option<Vec<Condition>>,
2016    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2017    #[serde(rename = "checkValidation")]
2018    pub check_validation: Option<Parameter>,
2019    /// GTM Container ID.
2020    #[serde(rename = "containerId")]
2021    pub container_id: Option<String>,
2022    /// A visibility trigger minimum continuous visible time (in milliseconds). Only valid for AMP Visibility trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2023    #[serde(rename = "continuousTimeMinMilliseconds")]
2024    pub continuous_time_min_milliseconds: Option<Parameter>,
2025    /// Used in the case of custom event, which is fired iff all Conditions are true. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2026    #[serde(rename = "customEventFilter")]
2027    pub custom_event_filter: Option<Vec<Condition>>,
2028    /// Name of the GTM event that is fired. Only valid for Timer triggers. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2029    #[serde(rename = "eventName")]
2030    pub event_name: Option<Parameter>,
2031    /// The trigger will only fire iff all Conditions are true. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2032    pub filter: Option<Vec<Condition>>,
2033    /// The fingerprint of the GTM Trigger as computed at storage time. This value is recomputed whenever the trigger is modified.
2034    pub fingerprint: Option<String>,
2035    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2036    #[serde(rename = "horizontalScrollPercentageList")]
2037    pub horizontal_scroll_percentage_list: Option<Parameter>,
2038    /// Time between triggering recurring Timer Events (in milliseconds). Only valid for Timer triggers. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2039    pub interval: Option<Parameter>,
2040    /// Time between Timer Events to fire (in seconds). Only valid for AMP Timer trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2041    #[serde(rename = "intervalSeconds")]
2042    pub interval_seconds: Option<Parameter>,
2043    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2044    pub limit: Option<Parameter>,
2045    /// Max time to fire Timer Events (in seconds). Only valid for AMP Timer trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2046    #[serde(rename = "maxTimerLengthSeconds")]
2047    pub max_timer_length_seconds: Option<Parameter>,
2048    /// Trigger display name. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2049    pub name: Option<String>,
2050    /// User notes on how to apply this trigger in the container. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2051    pub notes: Option<String>,
2052    /// Additional parameters. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2053    pub parameter: Option<Vec<Parameter>>,
2054    /// Parent folder id.
2055    #[serde(rename = "parentFolderId")]
2056    pub parent_folder_id: Option<String>,
2057    /// GTM Trigger's API relative path.
2058    pub path: Option<String>,
2059    /// A click trigger CSS selector (i.e. "a", "button" etc.). Only valid for AMP Click trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2060    pub selector: Option<Parameter>,
2061    /// Auto generated link to the tag manager UI
2062    #[serde(rename = "tagManagerUrl")]
2063    pub tag_manager_url: Option<String>,
2064    /// A visibility trigger minimum total visible time (in milliseconds). Only valid for AMP Visibility trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2065    #[serde(rename = "totalTimeMinMilliseconds")]
2066    pub total_time_min_milliseconds: Option<Parameter>,
2067    /// The Trigger ID uniquely identifies the GTM Trigger.
2068    #[serde(rename = "triggerId")]
2069    pub trigger_id: Option<String>,
2070    /// Defines the data layer event that causes this trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2071    #[serde(rename = "type")]
2072    pub type_: Option<String>,
2073    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2074    #[serde(rename = "uniqueTriggerId")]
2075    pub unique_trigger_id: Option<Parameter>,
2076    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2077    #[serde(rename = "verticalScrollPercentageList")]
2078    pub vertical_scroll_percentage_list: Option<Parameter>,
2079    /// A visibility trigger CSS selector (i.e. "#id"). Only valid for AMP Visibility trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2080    #[serde(rename = "visibilitySelector")]
2081    pub visibility_selector: Option<Parameter>,
2082    /// A visibility trigger maximum percent visibility. Only valid for AMP Visibility trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2083    #[serde(rename = "visiblePercentageMax")]
2084    pub visible_percentage_max: Option<Parameter>,
2085    /// A visibility trigger minimum percent visibility. Only valid for AMP Visibility trigger. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2086    #[serde(rename = "visiblePercentageMin")]
2087    pub visible_percentage_min: Option<Parameter>,
2088    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2089    #[serde(rename = "waitForTags")]
2090    pub wait_for_tags: Option<Parameter>,
2091    /// 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. @mutable tagmanager.accounts.containers.workspaces.triggers.create @mutable tagmanager.accounts.containers.workspaces.triggers.update
2092    #[serde(rename = "waitForTagsTimeout")]
2093    pub wait_for_tags_timeout: Option<Parameter>,
2094    /// GTM Workspace ID.
2095    #[serde(rename = "workspaceId")]
2096    pub workspace_id: Option<String>,
2097}
2098
2099impl common::RequestValue for Trigger {}
2100impl common::ResponseResult for Trigger {}
2101
2102/// Represents a user’s permissions to an account and its container.
2103///
2104/// # Activities
2105///
2106/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2107/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2108///
2109/// * [user_permissions create accounts](AccountUserPermissionCreateCall) (request|response)
2110/// * [user_permissions get accounts](AccountUserPermissionGetCall) (response)
2111/// * [user_permissions update accounts](AccountUserPermissionUpdateCall) (request|response)
2112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2113#[serde_with::serde_as]
2114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2115pub struct UserPermission {
2116    /// GTM Account access permissions. @mutable tagmanager.accounts.permissions.create @mutable tagmanager.accounts.permissions.update
2117    #[serde(rename = "accountAccess")]
2118    pub account_access: Option<AccountAccess>,
2119    /// The Account ID uniquely identifies the GTM Account.
2120    #[serde(rename = "accountId")]
2121    pub account_id: Option<String>,
2122    /// GTM Container access permissions. @mutable tagmanager.accounts.permissions.create @mutable tagmanager.accounts.permissions.update
2123    #[serde(rename = "containerAccess")]
2124    pub container_access: Option<Vec<ContainerAccess>>,
2125    /// User's email address. @mutable tagmanager.accounts.permissions.create
2126    #[serde(rename = "emailAddress")]
2127    pub email_address: Option<String>,
2128    /// GTM UserPermission's API relative path.
2129    pub path: Option<String>,
2130}
2131
2132impl common::RequestValue for UserPermission {}
2133impl common::ResponseResult for UserPermission {}
2134
2135/// Represents a Google Tag Manager Variable.
2136///
2137/// # Activities
2138///
2139/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2140/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2141///
2142/// * [containers workspaces variables create accounts](AccountContainerWorkspaceVariableCreateCall) (request|response)
2143/// * [containers workspaces variables get accounts](AccountContainerWorkspaceVariableGetCall) (response)
2144/// * [containers workspaces variables update accounts](AccountContainerWorkspaceVariableUpdateCall) (request|response)
2145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2146#[serde_with::serde_as]
2147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2148pub struct Variable {
2149    /// GTM Account ID.
2150    #[serde(rename = "accountId")]
2151    pub account_id: Option<String>,
2152    /// GTM Container ID.
2153    #[serde(rename = "containerId")]
2154    pub container_id: Option<String>,
2155    /// 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. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2156    #[serde(rename = "disablingTriggerId")]
2157    pub disabling_trigger_id: Option<Vec<String>>,
2158    /// 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. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2159    #[serde(rename = "enablingTriggerId")]
2160    pub enabling_trigger_id: Option<Vec<String>>,
2161    /// The fingerprint of the GTM Variable as computed at storage time. This value is recomputed whenever the variable is modified.
2162    pub fingerprint: Option<String>,
2163    /// Option to convert a variable value to other value.
2164    #[serde(rename = "formatValue")]
2165    pub format_value: Option<VariableFormatValue>,
2166    /// Variable display name. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2167    pub name: Option<String>,
2168    /// User notes on how to apply this variable in the container. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2169    pub notes: Option<String>,
2170    /// The variable's parameters. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2171    pub parameter: Option<Vec<Parameter>>,
2172    /// Parent folder id.
2173    #[serde(rename = "parentFolderId")]
2174    pub parent_folder_id: Option<String>,
2175    /// GTM Variable's API relative path.
2176    pub path: Option<String>,
2177    /// The end timestamp in milliseconds to schedule a variable. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2178    #[serde(rename = "scheduleEndMs")]
2179    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2180    pub schedule_end_ms: Option<i64>,
2181    /// The start timestamp in milliseconds to schedule a variable. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2182    #[serde(rename = "scheduleStartMs")]
2183    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2184    pub schedule_start_ms: Option<i64>,
2185    /// Auto generated link to the tag manager UI
2186    #[serde(rename = "tagManagerUrl")]
2187    pub tag_manager_url: Option<String>,
2188    /// GTM Variable Type. @mutable tagmanager.accounts.containers.workspaces.variables.create @mutable tagmanager.accounts.containers.workspaces.variables.update
2189    #[serde(rename = "type")]
2190    pub type_: Option<String>,
2191    /// The Variable ID uniquely identifies the GTM Variable.
2192    #[serde(rename = "variableId")]
2193    pub variable_id: Option<String>,
2194    /// GTM Workspace ID.
2195    #[serde(rename = "workspaceId")]
2196    pub workspace_id: Option<String>,
2197}
2198
2199impl common::RequestValue for Variable {}
2200impl common::ResponseResult for Variable {}
2201
2202/// There is no detailed description.
2203///
2204/// This type is not used in any activity, and only used as *part* of another schema.
2205///
2206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2207#[serde_with::serde_as]
2208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2209pub struct VariableFormatValue {
2210    /// The option to convert a string-type variable value to either lowercase or uppercase.
2211    #[serde(rename = "caseConversionType")]
2212    pub case_conversion_type: Option<String>,
2213    /// The value to convert if a variable value is false.
2214    #[serde(rename = "convertFalseToValue")]
2215    pub convert_false_to_value: Option<Parameter>,
2216    /// The value to convert if a variable value is null.
2217    #[serde(rename = "convertNullToValue")]
2218    pub convert_null_to_value: Option<Parameter>,
2219    /// The value to convert if a variable value is true.
2220    #[serde(rename = "convertTrueToValue")]
2221    pub convert_true_to_value: Option<Parameter>,
2222    /// The value to convert if a variable value is undefined.
2223    #[serde(rename = "convertUndefinedToValue")]
2224    pub convert_undefined_to_value: Option<Parameter>,
2225}
2226
2227impl common::Part for VariableFormatValue {}
2228
2229/// Represents a Google Tag Manager Container Workspace.
2230///
2231/// # Activities
2232///
2233/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2234/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2235///
2236/// * [containers workspaces create accounts](AccountContainerWorkspaceCreateCall) (request|response)
2237/// * [containers workspaces get accounts](AccountContainerWorkspaceGetCall) (response)
2238/// * [containers workspaces update accounts](AccountContainerWorkspaceUpdateCall) (request|response)
2239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2240#[serde_with::serde_as]
2241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2242pub struct Workspace {
2243    /// GTM Account ID.
2244    #[serde(rename = "accountId")]
2245    pub account_id: Option<String>,
2246    /// GTM Container ID.
2247    #[serde(rename = "containerId")]
2248    pub container_id: Option<String>,
2249    /// Workspace description. @mutable tagmanager.accounts.containers.workspaces.create @mutable tagmanager.accounts.containers.workspaces.update
2250    pub description: Option<String>,
2251    /// The fingerprint of the GTM Workspace as computed at storage time. This value is recomputed whenever the workspace is modified.
2252    pub fingerprint: Option<String>,
2253    /// Workspace display name. @mutable tagmanager.accounts.containers.workspaces.create @mutable tagmanager.accounts.containers.workspaces.update
2254    pub name: Option<String>,
2255    /// GTM Workspace's API relative path.
2256    pub path: Option<String>,
2257    /// Auto generated link to the tag manager UI
2258    #[serde(rename = "tagManagerUrl")]
2259    pub tag_manager_url: Option<String>,
2260    /// The Workspace ID uniquely identifies the GTM Workspace.
2261    #[serde(rename = "workspaceId")]
2262    pub workspace_id: Option<String>,
2263}
2264
2265impl common::RequestValue for Workspace {}
2266impl common::ResponseResult for Workspace {}
2267
2268/// Represents a Google Tag Manager Zone’s contents.
2269///
2270/// # Activities
2271///
2272/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2273/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2274///
2275/// * [containers workspaces zones create accounts](AccountContainerWorkspaceZoneCreateCall) (request|response)
2276/// * [containers workspaces zones get accounts](AccountContainerWorkspaceZoneGetCall) (response)
2277/// * [containers workspaces zones update accounts](AccountContainerWorkspaceZoneUpdateCall) (request|response)
2278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2279#[serde_with::serde_as]
2280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2281pub struct Zone {
2282    /// GTM Account ID.
2283    #[serde(rename = "accountId")]
2284    pub account_id: Option<String>,
2285    /// This Zone's boundary.
2286    pub boundary: Option<ZoneBoundary>,
2287    /// Containers that are children of this Zone.
2288    #[serde(rename = "childContainer")]
2289    pub child_container: Option<Vec<ZoneChildContainer>>,
2290    /// GTM Container ID.
2291    #[serde(rename = "containerId")]
2292    pub container_id: Option<String>,
2293    /// The fingerprint of the GTM Zone as computed at storage time. This value is recomputed whenever the zone is modified.
2294    pub fingerprint: Option<String>,
2295    /// Zone display name.
2296    pub name: Option<String>,
2297    /// User notes on how to apply this zone in the container.
2298    pub notes: Option<String>,
2299    /// GTM Zone's API relative path.
2300    pub path: Option<String>,
2301    /// Auto generated link to the tag manager UI
2302    #[serde(rename = "tagManagerUrl")]
2303    pub tag_manager_url: Option<String>,
2304    /// This Zone's type restrictions.
2305    #[serde(rename = "typeRestriction")]
2306    pub type_restriction: Option<ZoneTypeRestriction>,
2307    /// GTM Workspace ID.
2308    #[serde(rename = "workspaceId")]
2309    pub workspace_id: Option<String>,
2310    /// The Zone ID uniquely identifies the GTM Zone.
2311    #[serde(rename = "zoneId")]
2312    pub zone_id: Option<String>,
2313}
2314
2315impl common::RequestValue for Zone {}
2316impl common::ResponseResult for Zone {}
2317
2318/// Represents a Zone's boundaries.
2319///
2320/// This type is not used in any activity, and only used as *part* of another schema.
2321///
2322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2323#[serde_with::serde_as]
2324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2325pub struct ZoneBoundary {
2326    /// The conditions that, when conjoined, make up the boundary.
2327    pub condition: Option<Vec<Condition>>,
2328    /// Custom evaluation trigger IDs. A zone will evaluate its boundary conditions when any of the listed triggers are true.
2329    #[serde(rename = "customEvaluationTriggerId")]
2330    pub custom_evaluation_trigger_id: Option<Vec<String>>,
2331}
2332
2333impl common::Part for ZoneBoundary {}
2334
2335/// Represents a child container of a Zone.
2336///
2337/// This type is not used in any activity, and only used as *part* of another schema.
2338///
2339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2340#[serde_with::serde_as]
2341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2342pub struct ZoneChildContainer {
2343    /// The zone's nickname for the child container.
2344    pub nickname: Option<String>,
2345    /// The child container's public id.
2346    #[serde(rename = "publicId")]
2347    pub public_id: Option<String>,
2348}
2349
2350impl common::Part for ZoneChildContainer {}
2351
2352/// Represents a Zone's type restrictions.
2353///
2354/// This type is not used in any activity, and only used as *part* of another schema.
2355///
2356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2357#[serde_with::serde_as]
2358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2359pub struct ZoneTypeRestriction {
2360    /// True if type restrictions have been enabled for this Zone.
2361    pub enable: Option<bool>,
2362    /// List of type public ids that have been whitelisted for use in this Zone.
2363    #[serde(rename = "whitelistedTypeId")]
2364    pub whitelisted_type_id: Option<Vec<String>>,
2365}
2366
2367impl common::Part for ZoneTypeRestriction {}
2368
2369// ###################
2370// MethodBuilders ###
2371// #################
2372
2373/// A builder providing access to all methods supported on *account* resources.
2374/// It is not used directly, but through the [`TagManager`] hub.
2375///
2376/// # Example
2377///
2378/// Instantiate a resource builder
2379///
2380/// ```test_harness,no_run
2381/// extern crate hyper;
2382/// extern crate hyper_rustls;
2383/// extern crate google_tagmanager2 as tagmanager2;
2384///
2385/// # async fn dox() {
2386/// use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2387///
2388/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2389/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2390///     secret,
2391///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2392/// ).build().await.unwrap();
2393///
2394/// let client = hyper_util::client::legacy::Client::builder(
2395///     hyper_util::rt::TokioExecutor::new()
2396/// )
2397/// .build(
2398///     hyper_rustls::HttpsConnectorBuilder::new()
2399///         .with_native_roots()
2400///         .unwrap()
2401///         .https_or_http()
2402///         .enable_http1()
2403///         .build()
2404/// );
2405/// let mut hub = TagManager::new(client, auth);
2406/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2407/// // like `containers_combine(...)`, `containers_create(...)`, `containers_delete(...)`, `containers_destinations_get(...)`, `containers_destinations_link(...)`, `containers_destinations_list(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_reauthorize(...)`, `containers_environments_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_lookup(...)`, `containers_move_tag_id(...)`, `containers_snippet(...)`, `containers_update(...)`, `containers_version_headers_latest(...)`, `containers_version_headers_list(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_live(...)`, `containers_versions_publish(...)`, `containers_versions_set_latest(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `containers_workspaces_built_in_variables_create(...)`, `containers_workspaces_built_in_variables_delete(...)`, `containers_workspaces_built_in_variables_list(...)`, `containers_workspaces_built_in_variables_revert(...)`, `containers_workspaces_clients_create(...)`, `containers_workspaces_clients_delete(...)`, `containers_workspaces_clients_get(...)`, `containers_workspaces_clients_list(...)`, `containers_workspaces_clients_revert(...)`, `containers_workspaces_clients_update(...)`, `containers_workspaces_create(...)`, `containers_workspaces_create_version(...)`, `containers_workspaces_delete(...)`, `containers_workspaces_folders_create(...)`, `containers_workspaces_folders_delete(...)`, `containers_workspaces_folders_entities(...)`, `containers_workspaces_folders_get(...)`, `containers_workspaces_folders_list(...)`, `containers_workspaces_folders_move_entities_to_folder(...)`, `containers_workspaces_folders_revert(...)`, `containers_workspaces_folders_update(...)`, `containers_workspaces_get(...)`, `containers_workspaces_get_status(...)`, `containers_workspaces_gtag_config_create(...)`, `containers_workspaces_gtag_config_delete(...)`, `containers_workspaces_gtag_config_get(...)`, `containers_workspaces_gtag_config_list(...)`, `containers_workspaces_gtag_config_update(...)`, `containers_workspaces_list(...)`, `containers_workspaces_quick_preview(...)`, `containers_workspaces_resolve_conflict(...)`, `containers_workspaces_sync(...)`, `containers_workspaces_tags_create(...)`, `containers_workspaces_tags_delete(...)`, `containers_workspaces_tags_get(...)`, `containers_workspaces_tags_list(...)`, `containers_workspaces_tags_revert(...)`, `containers_workspaces_tags_update(...)`, `containers_workspaces_templates_create(...)`, `containers_workspaces_templates_delete(...)`, `containers_workspaces_templates_get(...)`, `containers_workspaces_templates_list(...)`, `containers_workspaces_templates_revert(...)`, `containers_workspaces_templates_update(...)`, `containers_workspaces_transformations_create(...)`, `containers_workspaces_transformations_delete(...)`, `containers_workspaces_transformations_get(...)`, `containers_workspaces_transformations_list(...)`, `containers_workspaces_transformations_revert(...)`, `containers_workspaces_transformations_update(...)`, `containers_workspaces_triggers_create(...)`, `containers_workspaces_triggers_delete(...)`, `containers_workspaces_triggers_get(...)`, `containers_workspaces_triggers_list(...)`, `containers_workspaces_triggers_revert(...)`, `containers_workspaces_triggers_update(...)`, `containers_workspaces_update(...)`, `containers_workspaces_variables_create(...)`, `containers_workspaces_variables_delete(...)`, `containers_workspaces_variables_get(...)`, `containers_workspaces_variables_list(...)`, `containers_workspaces_variables_revert(...)`, `containers_workspaces_variables_update(...)`, `containers_workspaces_zones_create(...)`, `containers_workspaces_zones_delete(...)`, `containers_workspaces_zones_get(...)`, `containers_workspaces_zones_list(...)`, `containers_workspaces_zones_revert(...)`, `containers_workspaces_zones_update(...)`, `get(...)`, `list(...)`, `update(...)`, `user_permissions_create(...)`, `user_permissions_delete(...)`, `user_permissions_get(...)`, `user_permissions_list(...)` and `user_permissions_update(...)`
2408/// // to build up your call.
2409/// let rb = hub.accounts();
2410/// # }
2411/// ```
2412pub struct AccountMethods<'a, C>
2413where
2414    C: 'a,
2415{
2416    hub: &'a TagManager<C>,
2417}
2418
2419impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
2420
2421impl<'a, C> AccountMethods<'a, C> {
2422    /// Create a builder to help you perform the following task:
2423    ///
2424    /// Gets a Destination.
2425    ///
2426    /// # Arguments
2427    ///
2428    /// * `path` - Google Tag Destination's API relative path. Example: accounts/{account_id}/containers/{container_id}/destinations/{destination_link_id}
2429    pub fn containers_destinations_get(
2430        &self,
2431        path: &str,
2432    ) -> AccountContainerDestinationGetCall<'a, C> {
2433        AccountContainerDestinationGetCall {
2434            hub: self.hub,
2435            _path: path.to_string(),
2436            _delegate: Default::default(),
2437            _additional_params: Default::default(),
2438            _scopes: Default::default(),
2439        }
2440    }
2441
2442    /// Create a builder to help you perform the following task:
2443    ///
2444    /// Adds a Destination to this Container and removes it from the Container to which it is currently linked.
2445    ///
2446    /// # Arguments
2447    ///
2448    /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2449    pub fn containers_destinations_link(
2450        &self,
2451        parent: &str,
2452    ) -> AccountContainerDestinationLinkCall<'a, C> {
2453        AccountContainerDestinationLinkCall {
2454            hub: self.hub,
2455            _parent: parent.to_string(),
2456            _destination_id: Default::default(),
2457            _allow_user_permission_feature_update: Default::default(),
2458            _delegate: Default::default(),
2459            _additional_params: Default::default(),
2460            _scopes: Default::default(),
2461        }
2462    }
2463
2464    /// Create a builder to help you perform the following task:
2465    ///
2466    /// Lists all Destinations linked to a GTM Container.
2467    ///
2468    /// # Arguments
2469    ///
2470    /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2471    pub fn containers_destinations_list(
2472        &self,
2473        parent: &str,
2474    ) -> AccountContainerDestinationListCall<'a, C> {
2475        AccountContainerDestinationListCall {
2476            hub: self.hub,
2477            _parent: parent.to_string(),
2478            _delegate: Default::default(),
2479            _additional_params: Default::default(),
2480            _scopes: Default::default(),
2481        }
2482    }
2483
2484    /// Create a builder to help you perform the following task:
2485    ///
2486    /// Creates a GTM Environment.
2487    ///
2488    /// # Arguments
2489    ///
2490    /// * `request` - No description provided.
2491    /// * `parent` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2492    pub fn containers_environments_create(
2493        &self,
2494        request: Environment,
2495        parent: &str,
2496    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
2497        AccountContainerEnvironmentCreateCall {
2498            hub: self.hub,
2499            _request: request,
2500            _parent: parent.to_string(),
2501            _delegate: Default::default(),
2502            _additional_params: Default::default(),
2503            _scopes: Default::default(),
2504        }
2505    }
2506
2507    /// Create a builder to help you perform the following task:
2508    ///
2509    /// Deletes a GTM Environment.
2510    ///
2511    /// # Arguments
2512    ///
2513    /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
2514    pub fn containers_environments_delete(
2515        &self,
2516        path: &str,
2517    ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
2518        AccountContainerEnvironmentDeleteCall {
2519            hub: self.hub,
2520            _path: path.to_string(),
2521            _delegate: Default::default(),
2522            _additional_params: Default::default(),
2523            _scopes: Default::default(),
2524        }
2525    }
2526
2527    /// Create a builder to help you perform the following task:
2528    ///
2529    /// Gets a GTM Environment.
2530    ///
2531    /// # Arguments
2532    ///
2533    /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
2534    pub fn containers_environments_get(
2535        &self,
2536        path: &str,
2537    ) -> AccountContainerEnvironmentGetCall<'a, C> {
2538        AccountContainerEnvironmentGetCall {
2539            hub: self.hub,
2540            _path: path.to_string(),
2541            _delegate: Default::default(),
2542            _additional_params: Default::default(),
2543            _scopes: Default::default(),
2544        }
2545    }
2546
2547    /// Create a builder to help you perform the following task:
2548    ///
2549    /// Lists all GTM Environments of a GTM Container.
2550    ///
2551    /// # Arguments
2552    ///
2553    /// * `parent` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2554    pub fn containers_environments_list(
2555        &self,
2556        parent: &str,
2557    ) -> AccountContainerEnvironmentListCall<'a, C> {
2558        AccountContainerEnvironmentListCall {
2559            hub: self.hub,
2560            _parent: parent.to_string(),
2561            _page_token: Default::default(),
2562            _delegate: Default::default(),
2563            _additional_params: Default::default(),
2564            _scopes: Default::default(),
2565        }
2566    }
2567
2568    /// Create a builder to help you perform the following task:
2569    ///
2570    /// Re-generates the authorization code for a GTM Environment.
2571    ///
2572    /// # Arguments
2573    ///
2574    /// * `request` - No description provided.
2575    /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
2576    pub fn containers_environments_reauthorize(
2577        &self,
2578        request: Environment,
2579        path: &str,
2580    ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
2581        AccountContainerEnvironmentReauthorizeCall {
2582            hub: self.hub,
2583            _request: request,
2584            _path: path.to_string(),
2585            _delegate: Default::default(),
2586            _additional_params: Default::default(),
2587            _scopes: Default::default(),
2588        }
2589    }
2590
2591    /// Create a builder to help you perform the following task:
2592    ///
2593    /// Updates a GTM Environment.
2594    ///
2595    /// # Arguments
2596    ///
2597    /// * `request` - No description provided.
2598    /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
2599    pub fn containers_environments_update(
2600        &self,
2601        request: Environment,
2602        path: &str,
2603    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
2604        AccountContainerEnvironmentUpdateCall {
2605            hub: self.hub,
2606            _request: request,
2607            _path: path.to_string(),
2608            _fingerprint: Default::default(),
2609            _delegate: Default::default(),
2610            _additional_params: Default::default(),
2611            _scopes: Default::default(),
2612        }
2613    }
2614
2615    /// Create a builder to help you perform the following task:
2616    ///
2617    /// Gets the latest container version header
2618    ///
2619    /// # Arguments
2620    ///
2621    /// * `parent` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2622    pub fn containers_version_headers_latest(
2623        &self,
2624        parent: &str,
2625    ) -> AccountContainerVersionHeaderLatestCall<'a, C> {
2626        AccountContainerVersionHeaderLatestCall {
2627            hub: self.hub,
2628            _parent: parent.to_string(),
2629            _delegate: Default::default(),
2630            _additional_params: Default::default(),
2631            _scopes: Default::default(),
2632        }
2633    }
2634
2635    /// Create a builder to help you perform the following task:
2636    ///
2637    /// Lists all Container Versions of a GTM Container.
2638    ///
2639    /// # Arguments
2640    ///
2641    /// * `parent` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2642    pub fn containers_version_headers_list(
2643        &self,
2644        parent: &str,
2645    ) -> AccountContainerVersionHeaderListCall<'a, C> {
2646        AccountContainerVersionHeaderListCall {
2647            hub: self.hub,
2648            _parent: parent.to_string(),
2649            _page_token: Default::default(),
2650            _include_deleted: Default::default(),
2651            _delegate: Default::default(),
2652            _additional_params: Default::default(),
2653            _scopes: Default::default(),
2654        }
2655    }
2656
2657    /// Create a builder to help you perform the following task:
2658    ///
2659    /// Deletes a Container Version.
2660    ///
2661    /// # Arguments
2662    ///
2663    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2664    pub fn containers_versions_delete(
2665        &self,
2666        path: &str,
2667    ) -> AccountContainerVersionDeleteCall<'a, C> {
2668        AccountContainerVersionDeleteCall {
2669            hub: self.hub,
2670            _path: path.to_string(),
2671            _delegate: Default::default(),
2672            _additional_params: Default::default(),
2673            _scopes: Default::default(),
2674        }
2675    }
2676
2677    /// Create a builder to help you perform the following task:
2678    ///
2679    /// Gets a Container Version.
2680    ///
2681    /// # Arguments
2682    ///
2683    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2684    pub fn containers_versions_get(&self, path: &str) -> AccountContainerVersionGetCall<'a, C> {
2685        AccountContainerVersionGetCall {
2686            hub: self.hub,
2687            _path: path.to_string(),
2688            _container_version_id: Default::default(),
2689            _delegate: Default::default(),
2690            _additional_params: Default::default(),
2691            _scopes: Default::default(),
2692        }
2693    }
2694
2695    /// Create a builder to help you perform the following task:
2696    ///
2697    /// Gets the live (i.e. published) container version
2698    ///
2699    /// # Arguments
2700    ///
2701    /// * `parent` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
2702    pub fn containers_versions_live(&self, parent: &str) -> AccountContainerVersionLiveCall<'a, C> {
2703        AccountContainerVersionLiveCall {
2704            hub: self.hub,
2705            _parent: parent.to_string(),
2706            _delegate: Default::default(),
2707            _additional_params: Default::default(),
2708            _scopes: Default::default(),
2709        }
2710    }
2711
2712    /// Create a builder to help you perform the following task:
2713    ///
2714    /// Publishes a Container Version.
2715    ///
2716    /// # Arguments
2717    ///
2718    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2719    pub fn containers_versions_publish(
2720        &self,
2721        path: &str,
2722    ) -> AccountContainerVersionPublishCall<'a, C> {
2723        AccountContainerVersionPublishCall {
2724            hub: self.hub,
2725            _path: path.to_string(),
2726            _fingerprint: Default::default(),
2727            _delegate: Default::default(),
2728            _additional_params: Default::default(),
2729            _scopes: Default::default(),
2730        }
2731    }
2732
2733    /// Create a builder to help you perform the following task:
2734    ///
2735    /// Sets the latest version used for synchronization of workspaces when detecting conflicts and errors.
2736    ///
2737    /// # Arguments
2738    ///
2739    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2740    pub fn containers_versions_set_latest(
2741        &self,
2742        path: &str,
2743    ) -> AccountContainerVersionSetLatestCall<'a, C> {
2744        AccountContainerVersionSetLatestCall {
2745            hub: self.hub,
2746            _path: path.to_string(),
2747            _delegate: Default::default(),
2748            _additional_params: Default::default(),
2749            _scopes: Default::default(),
2750        }
2751    }
2752
2753    /// Create a builder to help you perform the following task:
2754    ///
2755    /// Undeletes a Container Version.
2756    ///
2757    /// # Arguments
2758    ///
2759    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2760    pub fn containers_versions_undelete(
2761        &self,
2762        path: &str,
2763    ) -> AccountContainerVersionUndeleteCall<'a, C> {
2764        AccountContainerVersionUndeleteCall {
2765            hub: self.hub,
2766            _path: path.to_string(),
2767            _delegate: Default::default(),
2768            _additional_params: Default::default(),
2769            _scopes: Default::default(),
2770        }
2771    }
2772
2773    /// Create a builder to help you perform the following task:
2774    ///
2775    /// Updates a Container Version.
2776    ///
2777    /// # Arguments
2778    ///
2779    /// * `request` - No description provided.
2780    /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
2781    pub fn containers_versions_update(
2782        &self,
2783        request: ContainerVersion,
2784        path: &str,
2785    ) -> AccountContainerVersionUpdateCall<'a, C> {
2786        AccountContainerVersionUpdateCall {
2787            hub: self.hub,
2788            _request: request,
2789            _path: path.to_string(),
2790            _fingerprint: Default::default(),
2791            _delegate: Default::default(),
2792            _additional_params: Default::default(),
2793            _scopes: Default::default(),
2794        }
2795    }
2796
2797    /// Create a builder to help you perform the following task:
2798    ///
2799    /// Creates one or more GTM Built-In Variables.
2800    ///
2801    /// # Arguments
2802    ///
2803    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
2804    pub fn containers_workspaces_built_in_variables_create(
2805        &self,
2806        parent: &str,
2807    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
2808        AccountContainerWorkspaceBuiltInVariableCreateCall {
2809            hub: self.hub,
2810            _parent: parent.to_string(),
2811            _type_: Default::default(),
2812            _delegate: Default::default(),
2813            _additional_params: Default::default(),
2814            _scopes: Default::default(),
2815        }
2816    }
2817
2818    /// Create a builder to help you perform the following task:
2819    ///
2820    /// Deletes one or more GTM Built-In Variables.
2821    ///
2822    /// # Arguments
2823    ///
2824    /// * `path` - GTM BuiltInVariable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/built_in_variables
2825    pub fn containers_workspaces_built_in_variables_delete(
2826        &self,
2827        path: &str,
2828    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
2829        AccountContainerWorkspaceBuiltInVariableDeleteCall {
2830            hub: self.hub,
2831            _path: path.to_string(),
2832            _type_: Default::default(),
2833            _delegate: Default::default(),
2834            _additional_params: Default::default(),
2835            _scopes: Default::default(),
2836        }
2837    }
2838
2839    /// Create a builder to help you perform the following task:
2840    ///
2841    /// Lists all the enabled Built-In Variables of a GTM Container.
2842    ///
2843    /// # Arguments
2844    ///
2845    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
2846    pub fn containers_workspaces_built_in_variables_list(
2847        &self,
2848        parent: &str,
2849    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
2850        AccountContainerWorkspaceBuiltInVariableListCall {
2851            hub: self.hub,
2852            _parent: parent.to_string(),
2853            _page_token: Default::default(),
2854            _delegate: Default::default(),
2855            _additional_params: Default::default(),
2856            _scopes: Default::default(),
2857        }
2858    }
2859
2860    /// Create a builder to help you perform the following task:
2861    ///
2862    /// Reverts changes to a GTM Built-In Variables in a GTM Workspace.
2863    ///
2864    /// # Arguments
2865    ///
2866    /// * `path` - GTM BuiltInVariable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/built_in_variables
2867    pub fn containers_workspaces_built_in_variables_revert(
2868        &self,
2869        path: &str,
2870    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
2871        AccountContainerWorkspaceBuiltInVariableRevertCall {
2872            hub: self.hub,
2873            _path: path.to_string(),
2874            _type_: Default::default(),
2875            _delegate: Default::default(),
2876            _additional_params: Default::default(),
2877            _scopes: Default::default(),
2878        }
2879    }
2880
2881    /// Create a builder to help you perform the following task:
2882    ///
2883    /// Creates a GTM Client.
2884    ///
2885    /// # Arguments
2886    ///
2887    /// * `request` - No description provided.
2888    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
2889    pub fn containers_workspaces_clients_create(
2890        &self,
2891        request: Client,
2892        parent: &str,
2893    ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
2894        AccountContainerWorkspaceClientCreateCall {
2895            hub: self.hub,
2896            _request: request,
2897            _parent: parent.to_string(),
2898            _delegate: Default::default(),
2899            _additional_params: Default::default(),
2900            _scopes: Default::default(),
2901        }
2902    }
2903
2904    /// Create a builder to help you perform the following task:
2905    ///
2906    /// Deletes a GTM Client.
2907    ///
2908    /// # Arguments
2909    ///
2910    /// * `path` - GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
2911    pub fn containers_workspaces_clients_delete(
2912        &self,
2913        path: &str,
2914    ) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
2915        AccountContainerWorkspaceClientDeleteCall {
2916            hub: self.hub,
2917            _path: path.to_string(),
2918            _delegate: Default::default(),
2919            _additional_params: Default::default(),
2920            _scopes: Default::default(),
2921        }
2922    }
2923
2924    /// Create a builder to help you perform the following task:
2925    ///
2926    /// Gets a GTM Client.
2927    ///
2928    /// # Arguments
2929    ///
2930    /// * `path` - GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
2931    pub fn containers_workspaces_clients_get(
2932        &self,
2933        path: &str,
2934    ) -> AccountContainerWorkspaceClientGetCall<'a, C> {
2935        AccountContainerWorkspaceClientGetCall {
2936            hub: self.hub,
2937            _path: path.to_string(),
2938            _delegate: Default::default(),
2939            _additional_params: Default::default(),
2940            _scopes: Default::default(),
2941        }
2942    }
2943
2944    /// Create a builder to help you perform the following task:
2945    ///
2946    /// Lists all GTM Clients of a GTM container workspace.
2947    ///
2948    /// # Arguments
2949    ///
2950    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
2951    pub fn containers_workspaces_clients_list(
2952        &self,
2953        parent: &str,
2954    ) -> AccountContainerWorkspaceClientListCall<'a, C> {
2955        AccountContainerWorkspaceClientListCall {
2956            hub: self.hub,
2957            _parent: parent.to_string(),
2958            _page_token: Default::default(),
2959            _delegate: Default::default(),
2960            _additional_params: Default::default(),
2961            _scopes: Default::default(),
2962        }
2963    }
2964
2965    /// Create a builder to help you perform the following task:
2966    ///
2967    /// Reverts changes to a GTM Client in a GTM Workspace.
2968    ///
2969    /// # Arguments
2970    ///
2971    /// * `path` - GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
2972    pub fn containers_workspaces_clients_revert(
2973        &self,
2974        path: &str,
2975    ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
2976        AccountContainerWorkspaceClientRevertCall {
2977            hub: self.hub,
2978            _path: path.to_string(),
2979            _fingerprint: Default::default(),
2980            _delegate: Default::default(),
2981            _additional_params: Default::default(),
2982            _scopes: Default::default(),
2983        }
2984    }
2985
2986    /// Create a builder to help you perform the following task:
2987    ///
2988    /// Updates a GTM Client.
2989    ///
2990    /// # Arguments
2991    ///
2992    /// * `request` - No description provided.
2993    /// * `path` - GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
2994    pub fn containers_workspaces_clients_update(
2995        &self,
2996        request: Client,
2997        path: &str,
2998    ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
2999        AccountContainerWorkspaceClientUpdateCall {
3000            hub: self.hub,
3001            _request: request,
3002            _path: path.to_string(),
3003            _fingerprint: Default::default(),
3004            _delegate: Default::default(),
3005            _additional_params: Default::default(),
3006            _scopes: Default::default(),
3007        }
3008    }
3009
3010    /// Create a builder to help you perform the following task:
3011    ///
3012    /// Creates a GTM Folder.
3013    ///
3014    /// # Arguments
3015    ///
3016    /// * `request` - No description provided.
3017    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3018    pub fn containers_workspaces_folders_create(
3019        &self,
3020        request: Folder,
3021        parent: &str,
3022    ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
3023        AccountContainerWorkspaceFolderCreateCall {
3024            hub: self.hub,
3025            _request: request,
3026            _parent: parent.to_string(),
3027            _delegate: Default::default(),
3028            _additional_params: Default::default(),
3029            _scopes: Default::default(),
3030        }
3031    }
3032
3033    /// Create a builder to help you perform the following task:
3034    ///
3035    /// Deletes a GTM Folder.
3036    ///
3037    /// # Arguments
3038    ///
3039    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3040    pub fn containers_workspaces_folders_delete(
3041        &self,
3042        path: &str,
3043    ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
3044        AccountContainerWorkspaceFolderDeleteCall {
3045            hub: self.hub,
3046            _path: path.to_string(),
3047            _delegate: Default::default(),
3048            _additional_params: Default::default(),
3049            _scopes: Default::default(),
3050        }
3051    }
3052
3053    /// Create a builder to help you perform the following task:
3054    ///
3055    /// List all entities in a GTM Folder.
3056    ///
3057    /// # Arguments
3058    ///
3059    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3060    pub fn containers_workspaces_folders_entities(
3061        &self,
3062        path: &str,
3063    ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
3064        AccountContainerWorkspaceFolderEntityCall {
3065            hub: self.hub,
3066            _path: path.to_string(),
3067            _page_token: Default::default(),
3068            _delegate: Default::default(),
3069            _additional_params: Default::default(),
3070            _scopes: Default::default(),
3071        }
3072    }
3073
3074    /// Create a builder to help you perform the following task:
3075    ///
3076    /// Gets a GTM Folder.
3077    ///
3078    /// # Arguments
3079    ///
3080    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3081    pub fn containers_workspaces_folders_get(
3082        &self,
3083        path: &str,
3084    ) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
3085        AccountContainerWorkspaceFolderGetCall {
3086            hub: self.hub,
3087            _path: path.to_string(),
3088            _delegate: Default::default(),
3089            _additional_params: Default::default(),
3090            _scopes: Default::default(),
3091        }
3092    }
3093
3094    /// Create a builder to help you perform the following task:
3095    ///
3096    /// Lists all GTM Folders of a Container.
3097    ///
3098    /// # Arguments
3099    ///
3100    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3101    pub fn containers_workspaces_folders_list(
3102        &self,
3103        parent: &str,
3104    ) -> AccountContainerWorkspaceFolderListCall<'a, C> {
3105        AccountContainerWorkspaceFolderListCall {
3106            hub: self.hub,
3107            _parent: parent.to_string(),
3108            _page_token: Default::default(),
3109            _delegate: Default::default(),
3110            _additional_params: Default::default(),
3111            _scopes: Default::default(),
3112        }
3113    }
3114
3115    /// Create a builder to help you perform the following task:
3116    ///
3117    /// Moves entities to a GTM Folder. If {folder_id} in the request path equals 0, this will instead move entities out of the folder they currently belong to.
3118    ///
3119    /// # Arguments
3120    ///
3121    /// * `request` - No description provided.
3122    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3123    pub fn containers_workspaces_folders_move_entities_to_folder(
3124        &self,
3125        request: Folder,
3126        path: &str,
3127    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
3128        AccountContainerWorkspaceFolderMoveEntitiesToFolderCall {
3129            hub: self.hub,
3130            _request: request,
3131            _path: path.to_string(),
3132            _variable_id: Default::default(),
3133            _trigger_id: Default::default(),
3134            _tag_id: Default::default(),
3135            _delegate: Default::default(),
3136            _additional_params: Default::default(),
3137            _scopes: Default::default(),
3138        }
3139    }
3140
3141    /// Create a builder to help you perform the following task:
3142    ///
3143    /// Reverts changes to a GTM Folder in a GTM Workspace.
3144    ///
3145    /// # Arguments
3146    ///
3147    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3148    pub fn containers_workspaces_folders_revert(
3149        &self,
3150        path: &str,
3151    ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
3152        AccountContainerWorkspaceFolderRevertCall {
3153            hub: self.hub,
3154            _path: path.to_string(),
3155            _fingerprint: Default::default(),
3156            _delegate: Default::default(),
3157            _additional_params: Default::default(),
3158            _scopes: Default::default(),
3159        }
3160    }
3161
3162    /// Create a builder to help you perform the following task:
3163    ///
3164    /// Updates a GTM Folder.
3165    ///
3166    /// # Arguments
3167    ///
3168    /// * `request` - No description provided.
3169    /// * `path` - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
3170    pub fn containers_workspaces_folders_update(
3171        &self,
3172        request: Folder,
3173        path: &str,
3174    ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
3175        AccountContainerWorkspaceFolderUpdateCall {
3176            hub: self.hub,
3177            _request: request,
3178            _path: path.to_string(),
3179            _fingerprint: Default::default(),
3180            _delegate: Default::default(),
3181            _additional_params: Default::default(),
3182            _scopes: Default::default(),
3183        }
3184    }
3185
3186    /// Create a builder to help you perform the following task:
3187    ///
3188    /// Creates a Google tag config.
3189    ///
3190    /// # Arguments
3191    ///
3192    /// * `request` - No description provided.
3193    /// * `parent` - Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3194    pub fn containers_workspaces_gtag_config_create(
3195        &self,
3196        request: GtagConfig,
3197        parent: &str,
3198    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
3199        AccountContainerWorkspaceGtagConfigCreateCall {
3200            hub: self.hub,
3201            _request: request,
3202            _parent: parent.to_string(),
3203            _delegate: Default::default(),
3204            _additional_params: Default::default(),
3205            _scopes: Default::default(),
3206        }
3207    }
3208
3209    /// Create a builder to help you perform the following task:
3210    ///
3211    /// Deletes a Google tag config.
3212    ///
3213    /// # Arguments
3214    ///
3215    /// * `path` - Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
3216    pub fn containers_workspaces_gtag_config_delete(
3217        &self,
3218        path: &str,
3219    ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
3220        AccountContainerWorkspaceGtagConfigDeleteCall {
3221            hub: self.hub,
3222            _path: path.to_string(),
3223            _delegate: Default::default(),
3224            _additional_params: Default::default(),
3225            _scopes: Default::default(),
3226        }
3227    }
3228
3229    /// Create a builder to help you perform the following task:
3230    ///
3231    /// Gets a Google tag config.
3232    ///
3233    /// # Arguments
3234    ///
3235    /// * `path` - Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
3236    pub fn containers_workspaces_gtag_config_get(
3237        &self,
3238        path: &str,
3239    ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
3240        AccountContainerWorkspaceGtagConfigGetCall {
3241            hub: self.hub,
3242            _path: path.to_string(),
3243            _delegate: Default::default(),
3244            _additional_params: Default::default(),
3245            _scopes: Default::default(),
3246        }
3247    }
3248
3249    /// Create a builder to help you perform the following task:
3250    ///
3251    /// Lists all Google tag configs in a Container.
3252    ///
3253    /// # Arguments
3254    ///
3255    /// * `parent` - Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3256    pub fn containers_workspaces_gtag_config_list(
3257        &self,
3258        parent: &str,
3259    ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
3260        AccountContainerWorkspaceGtagConfigListCall {
3261            hub: self.hub,
3262            _parent: parent.to_string(),
3263            _page_token: Default::default(),
3264            _delegate: Default::default(),
3265            _additional_params: Default::default(),
3266            _scopes: Default::default(),
3267        }
3268    }
3269
3270    /// Create a builder to help you perform the following task:
3271    ///
3272    /// Updates a Google tag config.
3273    ///
3274    /// # Arguments
3275    ///
3276    /// * `request` - No description provided.
3277    /// * `path` - Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
3278    pub fn containers_workspaces_gtag_config_update(
3279        &self,
3280        request: GtagConfig,
3281        path: &str,
3282    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
3283        AccountContainerWorkspaceGtagConfigUpdateCall {
3284            hub: self.hub,
3285            _request: request,
3286            _path: path.to_string(),
3287            _fingerprint: Default::default(),
3288            _delegate: Default::default(),
3289            _additional_params: Default::default(),
3290            _scopes: Default::default(),
3291        }
3292    }
3293
3294    /// Create a builder to help you perform the following task:
3295    ///
3296    /// Creates a GTM Tag.
3297    ///
3298    /// # Arguments
3299    ///
3300    /// * `request` - No description provided.
3301    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3302    pub fn containers_workspaces_tags_create(
3303        &self,
3304        request: Tag,
3305        parent: &str,
3306    ) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
3307        AccountContainerWorkspaceTagCreateCall {
3308            hub: self.hub,
3309            _request: request,
3310            _parent: parent.to_string(),
3311            _delegate: Default::default(),
3312            _additional_params: Default::default(),
3313            _scopes: Default::default(),
3314        }
3315    }
3316
3317    /// Create a builder to help you perform the following task:
3318    ///
3319    /// Deletes a GTM Tag.
3320    ///
3321    /// # Arguments
3322    ///
3323    /// * `path` - GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
3324    pub fn containers_workspaces_tags_delete(
3325        &self,
3326        path: &str,
3327    ) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
3328        AccountContainerWorkspaceTagDeleteCall {
3329            hub: self.hub,
3330            _path: path.to_string(),
3331            _delegate: Default::default(),
3332            _additional_params: Default::default(),
3333            _scopes: Default::default(),
3334        }
3335    }
3336
3337    /// Create a builder to help you perform the following task:
3338    ///
3339    /// Gets a GTM Tag.
3340    ///
3341    /// # Arguments
3342    ///
3343    /// * `path` - GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
3344    pub fn containers_workspaces_tags_get(
3345        &self,
3346        path: &str,
3347    ) -> AccountContainerWorkspaceTagGetCall<'a, C> {
3348        AccountContainerWorkspaceTagGetCall {
3349            hub: self.hub,
3350            _path: path.to_string(),
3351            _delegate: Default::default(),
3352            _additional_params: Default::default(),
3353            _scopes: Default::default(),
3354        }
3355    }
3356
3357    /// Create a builder to help you perform the following task:
3358    ///
3359    /// Lists all GTM Tags of a Container.
3360    ///
3361    /// # Arguments
3362    ///
3363    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3364    pub fn containers_workspaces_tags_list(
3365        &self,
3366        parent: &str,
3367    ) -> AccountContainerWorkspaceTagListCall<'a, C> {
3368        AccountContainerWorkspaceTagListCall {
3369            hub: self.hub,
3370            _parent: parent.to_string(),
3371            _page_token: Default::default(),
3372            _delegate: Default::default(),
3373            _additional_params: Default::default(),
3374            _scopes: Default::default(),
3375        }
3376    }
3377
3378    /// Create a builder to help you perform the following task:
3379    ///
3380    /// Reverts changes to a GTM Tag in a GTM Workspace.
3381    ///
3382    /// # Arguments
3383    ///
3384    /// * `path` - GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
3385    pub fn containers_workspaces_tags_revert(
3386        &self,
3387        path: &str,
3388    ) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
3389        AccountContainerWorkspaceTagRevertCall {
3390            hub: self.hub,
3391            _path: path.to_string(),
3392            _fingerprint: Default::default(),
3393            _delegate: Default::default(),
3394            _additional_params: Default::default(),
3395            _scopes: Default::default(),
3396        }
3397    }
3398
3399    /// Create a builder to help you perform the following task:
3400    ///
3401    /// Updates a GTM Tag.
3402    ///
3403    /// # Arguments
3404    ///
3405    /// * `request` - No description provided.
3406    /// * `path` - GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
3407    pub fn containers_workspaces_tags_update(
3408        &self,
3409        request: Tag,
3410        path: &str,
3411    ) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
3412        AccountContainerWorkspaceTagUpdateCall {
3413            hub: self.hub,
3414            _request: request,
3415            _path: path.to_string(),
3416            _fingerprint: Default::default(),
3417            _delegate: Default::default(),
3418            _additional_params: Default::default(),
3419            _scopes: Default::default(),
3420        }
3421    }
3422
3423    /// Create a builder to help you perform the following task:
3424    ///
3425    /// Creates a GTM Custom Template.
3426    ///
3427    /// # Arguments
3428    ///
3429    /// * `request` - No description provided.
3430    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3431    pub fn containers_workspaces_templates_create(
3432        &self,
3433        request: CustomTemplate,
3434        parent: &str,
3435    ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
3436        AccountContainerWorkspaceTemplateCreateCall {
3437            hub: self.hub,
3438            _request: request,
3439            _parent: parent.to_string(),
3440            _delegate: Default::default(),
3441            _additional_params: Default::default(),
3442            _scopes: Default::default(),
3443        }
3444    }
3445
3446    /// Create a builder to help you perform the following task:
3447    ///
3448    /// Deletes a GTM Template.
3449    ///
3450    /// # Arguments
3451    ///
3452    /// * `path` - GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
3453    pub fn containers_workspaces_templates_delete(
3454        &self,
3455        path: &str,
3456    ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
3457        AccountContainerWorkspaceTemplateDeleteCall {
3458            hub: self.hub,
3459            _path: path.to_string(),
3460            _delegate: Default::default(),
3461            _additional_params: Default::default(),
3462            _scopes: Default::default(),
3463        }
3464    }
3465
3466    /// Create a builder to help you perform the following task:
3467    ///
3468    /// Gets a GTM Template.
3469    ///
3470    /// # Arguments
3471    ///
3472    /// * `path` - GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
3473    pub fn containers_workspaces_templates_get(
3474        &self,
3475        path: &str,
3476    ) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
3477        AccountContainerWorkspaceTemplateGetCall {
3478            hub: self.hub,
3479            _path: path.to_string(),
3480            _delegate: Default::default(),
3481            _additional_params: Default::default(),
3482            _scopes: Default::default(),
3483        }
3484    }
3485
3486    /// Create a builder to help you perform the following task:
3487    ///
3488    /// Lists all GTM Templates of a GTM container workspace.
3489    ///
3490    /// # Arguments
3491    ///
3492    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3493    pub fn containers_workspaces_templates_list(
3494        &self,
3495        parent: &str,
3496    ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
3497        AccountContainerWorkspaceTemplateListCall {
3498            hub: self.hub,
3499            _parent: parent.to_string(),
3500            _page_token: Default::default(),
3501            _delegate: Default::default(),
3502            _additional_params: Default::default(),
3503            _scopes: Default::default(),
3504        }
3505    }
3506
3507    /// Create a builder to help you perform the following task:
3508    ///
3509    /// Reverts changes to a GTM Template in a GTM Workspace.
3510    ///
3511    /// # Arguments
3512    ///
3513    /// * `path` - GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
3514    pub fn containers_workspaces_templates_revert(
3515        &self,
3516        path: &str,
3517    ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
3518        AccountContainerWorkspaceTemplateRevertCall {
3519            hub: self.hub,
3520            _path: path.to_string(),
3521            _fingerprint: Default::default(),
3522            _delegate: Default::default(),
3523            _additional_params: Default::default(),
3524            _scopes: Default::default(),
3525        }
3526    }
3527
3528    /// Create a builder to help you perform the following task:
3529    ///
3530    /// Updates a GTM Template.
3531    ///
3532    /// # Arguments
3533    ///
3534    /// * `request` - No description provided.
3535    /// * `path` - GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
3536    pub fn containers_workspaces_templates_update(
3537        &self,
3538        request: CustomTemplate,
3539        path: &str,
3540    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
3541        AccountContainerWorkspaceTemplateUpdateCall {
3542            hub: self.hub,
3543            _request: request,
3544            _path: path.to_string(),
3545            _fingerprint: Default::default(),
3546            _delegate: Default::default(),
3547            _additional_params: Default::default(),
3548            _scopes: Default::default(),
3549        }
3550    }
3551
3552    /// Create a builder to help you perform the following task:
3553    ///
3554    /// Creates a GTM Transformation.
3555    ///
3556    /// # Arguments
3557    ///
3558    /// * `request` - No description provided.
3559    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3560    pub fn containers_workspaces_transformations_create(
3561        &self,
3562        request: Transformation,
3563        parent: &str,
3564    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
3565        AccountContainerWorkspaceTransformationCreateCall {
3566            hub: self.hub,
3567            _request: request,
3568            _parent: parent.to_string(),
3569            _delegate: Default::default(),
3570            _additional_params: Default::default(),
3571            _scopes: Default::default(),
3572        }
3573    }
3574
3575    /// Create a builder to help you perform the following task:
3576    ///
3577    /// Deletes a GTM Transformation.
3578    ///
3579    /// # Arguments
3580    ///
3581    /// * `path` - GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
3582    pub fn containers_workspaces_transformations_delete(
3583        &self,
3584        path: &str,
3585    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
3586        AccountContainerWorkspaceTransformationDeleteCall {
3587            hub: self.hub,
3588            _path: path.to_string(),
3589            _delegate: Default::default(),
3590            _additional_params: Default::default(),
3591            _scopes: Default::default(),
3592        }
3593    }
3594
3595    /// Create a builder to help you perform the following task:
3596    ///
3597    /// Gets a GTM Transformation.
3598    ///
3599    /// # Arguments
3600    ///
3601    /// * `path` - GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
3602    pub fn containers_workspaces_transformations_get(
3603        &self,
3604        path: &str,
3605    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
3606        AccountContainerWorkspaceTransformationGetCall {
3607            hub: self.hub,
3608            _path: path.to_string(),
3609            _delegate: Default::default(),
3610            _additional_params: Default::default(),
3611            _scopes: Default::default(),
3612        }
3613    }
3614
3615    /// Create a builder to help you perform the following task:
3616    ///
3617    /// Lists all GTM Transformations of a GTM container workspace.
3618    ///
3619    /// # Arguments
3620    ///
3621    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3622    pub fn containers_workspaces_transformations_list(
3623        &self,
3624        parent: &str,
3625    ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
3626        AccountContainerWorkspaceTransformationListCall {
3627            hub: self.hub,
3628            _parent: parent.to_string(),
3629            _page_token: Default::default(),
3630            _delegate: Default::default(),
3631            _additional_params: Default::default(),
3632            _scopes: Default::default(),
3633        }
3634    }
3635
3636    /// Create a builder to help you perform the following task:
3637    ///
3638    /// Reverts changes to a GTM Transformation in a GTM Workspace.
3639    ///
3640    /// # Arguments
3641    ///
3642    /// * `path` - GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
3643    pub fn containers_workspaces_transformations_revert(
3644        &self,
3645        path: &str,
3646    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
3647        AccountContainerWorkspaceTransformationRevertCall {
3648            hub: self.hub,
3649            _path: path.to_string(),
3650            _fingerprint: Default::default(),
3651            _delegate: Default::default(),
3652            _additional_params: Default::default(),
3653            _scopes: Default::default(),
3654        }
3655    }
3656
3657    /// Create a builder to help you perform the following task:
3658    ///
3659    /// Updates a GTM Transformation.
3660    ///
3661    /// # Arguments
3662    ///
3663    /// * `request` - No description provided.
3664    /// * `path` - GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
3665    pub fn containers_workspaces_transformations_update(
3666        &self,
3667        request: Transformation,
3668        path: &str,
3669    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
3670        AccountContainerWorkspaceTransformationUpdateCall {
3671            hub: self.hub,
3672            _request: request,
3673            _path: path.to_string(),
3674            _fingerprint: Default::default(),
3675            _delegate: Default::default(),
3676            _additional_params: Default::default(),
3677            _scopes: Default::default(),
3678        }
3679    }
3680
3681    /// Create a builder to help you perform the following task:
3682    ///
3683    /// Creates a GTM Trigger.
3684    ///
3685    /// # Arguments
3686    ///
3687    /// * `request` - No description provided.
3688    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3689    pub fn containers_workspaces_triggers_create(
3690        &self,
3691        request: Trigger,
3692        parent: &str,
3693    ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
3694        AccountContainerWorkspaceTriggerCreateCall {
3695            hub: self.hub,
3696            _request: request,
3697            _parent: parent.to_string(),
3698            _delegate: Default::default(),
3699            _additional_params: Default::default(),
3700            _scopes: Default::default(),
3701        }
3702    }
3703
3704    /// Create a builder to help you perform the following task:
3705    ///
3706    /// Deletes a GTM Trigger.
3707    ///
3708    /// # Arguments
3709    ///
3710    /// * `path` - GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
3711    pub fn containers_workspaces_triggers_delete(
3712        &self,
3713        path: &str,
3714    ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
3715        AccountContainerWorkspaceTriggerDeleteCall {
3716            hub: self.hub,
3717            _path: path.to_string(),
3718            _delegate: Default::default(),
3719            _additional_params: Default::default(),
3720            _scopes: Default::default(),
3721        }
3722    }
3723
3724    /// Create a builder to help you perform the following task:
3725    ///
3726    /// Gets a GTM Trigger.
3727    ///
3728    /// # Arguments
3729    ///
3730    /// * `path` - GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
3731    pub fn containers_workspaces_triggers_get(
3732        &self,
3733        path: &str,
3734    ) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
3735        AccountContainerWorkspaceTriggerGetCall {
3736            hub: self.hub,
3737            _path: path.to_string(),
3738            _delegate: Default::default(),
3739            _additional_params: Default::default(),
3740            _scopes: Default::default(),
3741        }
3742    }
3743
3744    /// Create a builder to help you perform the following task:
3745    ///
3746    /// Lists all GTM Triggers of a Container.
3747    ///
3748    /// # Arguments
3749    ///
3750    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3751    pub fn containers_workspaces_triggers_list(
3752        &self,
3753        parent: &str,
3754    ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
3755        AccountContainerWorkspaceTriggerListCall {
3756            hub: self.hub,
3757            _parent: parent.to_string(),
3758            _page_token: Default::default(),
3759            _delegate: Default::default(),
3760            _additional_params: Default::default(),
3761            _scopes: Default::default(),
3762        }
3763    }
3764
3765    /// Create a builder to help you perform the following task:
3766    ///
3767    /// Reverts changes to a GTM Trigger in a GTM Workspace.
3768    ///
3769    /// # Arguments
3770    ///
3771    /// * `path` - GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
3772    pub fn containers_workspaces_triggers_revert(
3773        &self,
3774        path: &str,
3775    ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
3776        AccountContainerWorkspaceTriggerRevertCall {
3777            hub: self.hub,
3778            _path: path.to_string(),
3779            _fingerprint: Default::default(),
3780            _delegate: Default::default(),
3781            _additional_params: Default::default(),
3782            _scopes: Default::default(),
3783        }
3784    }
3785
3786    /// Create a builder to help you perform the following task:
3787    ///
3788    /// Updates a GTM Trigger.
3789    ///
3790    /// # Arguments
3791    ///
3792    /// * `request` - No description provided.
3793    /// * `path` - GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
3794    pub fn containers_workspaces_triggers_update(
3795        &self,
3796        request: Trigger,
3797        path: &str,
3798    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
3799        AccountContainerWorkspaceTriggerUpdateCall {
3800            hub: self.hub,
3801            _request: request,
3802            _path: path.to_string(),
3803            _fingerprint: Default::default(),
3804            _delegate: Default::default(),
3805            _additional_params: Default::default(),
3806            _scopes: Default::default(),
3807        }
3808    }
3809
3810    /// Create a builder to help you perform the following task:
3811    ///
3812    /// Creates a GTM Variable.
3813    ///
3814    /// # Arguments
3815    ///
3816    /// * `request` - No description provided.
3817    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3818    pub fn containers_workspaces_variables_create(
3819        &self,
3820        request: Variable,
3821        parent: &str,
3822    ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
3823        AccountContainerWorkspaceVariableCreateCall {
3824            hub: self.hub,
3825            _request: request,
3826            _parent: parent.to_string(),
3827            _delegate: Default::default(),
3828            _additional_params: Default::default(),
3829            _scopes: Default::default(),
3830        }
3831    }
3832
3833    /// Create a builder to help you perform the following task:
3834    ///
3835    /// Deletes a GTM Variable.
3836    ///
3837    /// # Arguments
3838    ///
3839    /// * `path` - GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
3840    pub fn containers_workspaces_variables_delete(
3841        &self,
3842        path: &str,
3843    ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
3844        AccountContainerWorkspaceVariableDeleteCall {
3845            hub: self.hub,
3846            _path: path.to_string(),
3847            _delegate: Default::default(),
3848            _additional_params: Default::default(),
3849            _scopes: Default::default(),
3850        }
3851    }
3852
3853    /// Create a builder to help you perform the following task:
3854    ///
3855    /// Gets a GTM Variable.
3856    ///
3857    /// # Arguments
3858    ///
3859    /// * `path` - GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
3860    pub fn containers_workspaces_variables_get(
3861        &self,
3862        path: &str,
3863    ) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
3864        AccountContainerWorkspaceVariableGetCall {
3865            hub: self.hub,
3866            _path: path.to_string(),
3867            _delegate: Default::default(),
3868            _additional_params: Default::default(),
3869            _scopes: Default::default(),
3870        }
3871    }
3872
3873    /// Create a builder to help you perform the following task:
3874    ///
3875    /// Lists all GTM Variables of a Container.
3876    ///
3877    /// # Arguments
3878    ///
3879    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3880    pub fn containers_workspaces_variables_list(
3881        &self,
3882        parent: &str,
3883    ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
3884        AccountContainerWorkspaceVariableListCall {
3885            hub: self.hub,
3886            _parent: parent.to_string(),
3887            _page_token: Default::default(),
3888            _delegate: Default::default(),
3889            _additional_params: Default::default(),
3890            _scopes: Default::default(),
3891        }
3892    }
3893
3894    /// Create a builder to help you perform the following task:
3895    ///
3896    /// Reverts changes to a GTM Variable in a GTM Workspace.
3897    ///
3898    /// # Arguments
3899    ///
3900    /// * `path` - GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
3901    pub fn containers_workspaces_variables_revert(
3902        &self,
3903        path: &str,
3904    ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
3905        AccountContainerWorkspaceVariableRevertCall {
3906            hub: self.hub,
3907            _path: path.to_string(),
3908            _fingerprint: Default::default(),
3909            _delegate: Default::default(),
3910            _additional_params: Default::default(),
3911            _scopes: Default::default(),
3912        }
3913    }
3914
3915    /// Create a builder to help you perform the following task:
3916    ///
3917    /// Updates a GTM Variable.
3918    ///
3919    /// # Arguments
3920    ///
3921    /// * `request` - No description provided.
3922    /// * `path` - GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
3923    pub fn containers_workspaces_variables_update(
3924        &self,
3925        request: Variable,
3926        path: &str,
3927    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
3928        AccountContainerWorkspaceVariableUpdateCall {
3929            hub: self.hub,
3930            _request: request,
3931            _path: path.to_string(),
3932            _fingerprint: Default::default(),
3933            _delegate: Default::default(),
3934            _additional_params: Default::default(),
3935            _scopes: Default::default(),
3936        }
3937    }
3938
3939    /// Create a builder to help you perform the following task:
3940    ///
3941    /// Creates a GTM Zone.
3942    ///
3943    /// # Arguments
3944    ///
3945    /// * `request` - No description provided.
3946    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
3947    pub fn containers_workspaces_zones_create(
3948        &self,
3949        request: Zone,
3950        parent: &str,
3951    ) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
3952        AccountContainerWorkspaceZoneCreateCall {
3953            hub: self.hub,
3954            _request: request,
3955            _parent: parent.to_string(),
3956            _delegate: Default::default(),
3957            _additional_params: Default::default(),
3958            _scopes: Default::default(),
3959        }
3960    }
3961
3962    /// Create a builder to help you perform the following task:
3963    ///
3964    /// Deletes a GTM Zone.
3965    ///
3966    /// # Arguments
3967    ///
3968    /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
3969    pub fn containers_workspaces_zones_delete(
3970        &self,
3971        path: &str,
3972    ) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
3973        AccountContainerWorkspaceZoneDeleteCall {
3974            hub: self.hub,
3975            _path: path.to_string(),
3976            _delegate: Default::default(),
3977            _additional_params: Default::default(),
3978            _scopes: Default::default(),
3979        }
3980    }
3981
3982    /// Create a builder to help you perform the following task:
3983    ///
3984    /// Gets a GTM Zone.
3985    ///
3986    /// # Arguments
3987    ///
3988    /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
3989    pub fn containers_workspaces_zones_get(
3990        &self,
3991        path: &str,
3992    ) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
3993        AccountContainerWorkspaceZoneGetCall {
3994            hub: self.hub,
3995            _path: path.to_string(),
3996            _delegate: Default::default(),
3997            _additional_params: Default::default(),
3998            _scopes: Default::default(),
3999        }
4000    }
4001
4002    /// Create a builder to help you perform the following task:
4003    ///
4004    /// Lists all GTM Zones of a GTM container workspace.
4005    ///
4006    /// # Arguments
4007    ///
4008    /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4009    pub fn containers_workspaces_zones_list(
4010        &self,
4011        parent: &str,
4012    ) -> AccountContainerWorkspaceZoneListCall<'a, C> {
4013        AccountContainerWorkspaceZoneListCall {
4014            hub: self.hub,
4015            _parent: parent.to_string(),
4016            _page_token: Default::default(),
4017            _delegate: Default::default(),
4018            _additional_params: Default::default(),
4019            _scopes: Default::default(),
4020        }
4021    }
4022
4023    /// Create a builder to help you perform the following task:
4024    ///
4025    /// Reverts changes to a GTM Zone in a GTM Workspace.
4026    ///
4027    /// # Arguments
4028    ///
4029    /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
4030    pub fn containers_workspaces_zones_revert(
4031        &self,
4032        path: &str,
4033    ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
4034        AccountContainerWorkspaceZoneRevertCall {
4035            hub: self.hub,
4036            _path: path.to_string(),
4037            _fingerprint: Default::default(),
4038            _delegate: Default::default(),
4039            _additional_params: Default::default(),
4040            _scopes: Default::default(),
4041        }
4042    }
4043
4044    /// Create a builder to help you perform the following task:
4045    ///
4046    /// Updates a GTM Zone.
4047    ///
4048    /// # Arguments
4049    ///
4050    /// * `request` - No description provided.
4051    /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
4052    pub fn containers_workspaces_zones_update(
4053        &self,
4054        request: Zone,
4055        path: &str,
4056    ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
4057        AccountContainerWorkspaceZoneUpdateCall {
4058            hub: self.hub,
4059            _request: request,
4060            _path: path.to_string(),
4061            _fingerprint: Default::default(),
4062            _delegate: Default::default(),
4063            _additional_params: Default::default(),
4064            _scopes: Default::default(),
4065        }
4066    }
4067
4068    /// Create a builder to help you perform the following task:
4069    ///
4070    /// Creates a Workspace.
4071    ///
4072    /// # Arguments
4073    ///
4074    /// * `request` - No description provided.
4075    /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4076    pub fn containers_workspaces_create(
4077        &self,
4078        request: Workspace,
4079        parent: &str,
4080    ) -> AccountContainerWorkspaceCreateCall<'a, C> {
4081        AccountContainerWorkspaceCreateCall {
4082            hub: self.hub,
4083            _request: request,
4084            _parent: parent.to_string(),
4085            _delegate: Default::default(),
4086            _additional_params: Default::default(),
4087            _scopes: Default::default(),
4088        }
4089    }
4090
4091    /// Create a builder to help you perform the following task:
4092    ///
4093    /// Creates a Container Version from the entities present in the workspace, deletes the workspace, and sets the base container version to the newly created version.
4094    ///
4095    /// # Arguments
4096    ///
4097    /// * `request` - No description provided.
4098    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4099    pub fn containers_workspaces_create_version(
4100        &self,
4101        request: CreateContainerVersionRequestVersionOptions,
4102        path: &str,
4103    ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
4104        AccountContainerWorkspaceCreateVersionCall {
4105            hub: self.hub,
4106            _request: request,
4107            _path: path.to_string(),
4108            _delegate: Default::default(),
4109            _additional_params: Default::default(),
4110            _scopes: Default::default(),
4111        }
4112    }
4113
4114    /// Create a builder to help you perform the following task:
4115    ///
4116    /// Deletes a Workspace.
4117    ///
4118    /// # Arguments
4119    ///
4120    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4121    pub fn containers_workspaces_delete(
4122        &self,
4123        path: &str,
4124    ) -> AccountContainerWorkspaceDeleteCall<'a, C> {
4125        AccountContainerWorkspaceDeleteCall {
4126            hub: self.hub,
4127            _path: path.to_string(),
4128            _delegate: Default::default(),
4129            _additional_params: Default::default(),
4130            _scopes: Default::default(),
4131        }
4132    }
4133
4134    /// Create a builder to help you perform the following task:
4135    ///
4136    /// Gets a Workspace.
4137    ///
4138    /// # Arguments
4139    ///
4140    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4141    pub fn containers_workspaces_get(&self, path: &str) -> AccountContainerWorkspaceGetCall<'a, C> {
4142        AccountContainerWorkspaceGetCall {
4143            hub: self.hub,
4144            _path: path.to_string(),
4145            _delegate: Default::default(),
4146            _additional_params: Default::default(),
4147            _scopes: Default::default(),
4148        }
4149    }
4150
4151    /// Create a builder to help you perform the following task:
4152    ///
4153    /// Finds conflicting and modified entities in the workspace.
4154    ///
4155    /// # Arguments
4156    ///
4157    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4158    pub fn containers_workspaces_get_status(
4159        &self,
4160        path: &str,
4161    ) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
4162        AccountContainerWorkspaceGetStatuCall {
4163            hub: self.hub,
4164            _path: path.to_string(),
4165            _delegate: Default::default(),
4166            _additional_params: Default::default(),
4167            _scopes: Default::default(),
4168        }
4169    }
4170
4171    /// Create a builder to help you perform the following task:
4172    ///
4173    /// Lists all Workspaces that belong to a GTM Container.
4174    ///
4175    /// # Arguments
4176    ///
4177    /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4178    pub fn containers_workspaces_list(
4179        &self,
4180        parent: &str,
4181    ) -> AccountContainerWorkspaceListCall<'a, C> {
4182        AccountContainerWorkspaceListCall {
4183            hub: self.hub,
4184            _parent: parent.to_string(),
4185            _page_token: Default::default(),
4186            _delegate: Default::default(),
4187            _additional_params: Default::default(),
4188            _scopes: Default::default(),
4189        }
4190    }
4191
4192    /// Create a builder to help you perform the following task:
4193    ///
4194    /// Quick previews a workspace by creating a fake container version from all entities in the provided workspace.
4195    ///
4196    /// # Arguments
4197    ///
4198    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4199    pub fn containers_workspaces_quick_preview(
4200        &self,
4201        path: &str,
4202    ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
4203        AccountContainerWorkspaceQuickPreviewCall {
4204            hub: self.hub,
4205            _path: path.to_string(),
4206            _delegate: Default::default(),
4207            _additional_params: Default::default(),
4208            _scopes: Default::default(),
4209        }
4210    }
4211
4212    /// Create a builder to help you perform the following task:
4213    ///
4214    /// Resolves a merge conflict for a workspace entity by updating it to the resolved entity passed in the request.
4215    ///
4216    /// # Arguments
4217    ///
4218    /// * `request` - No description provided.
4219    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4220    pub fn containers_workspaces_resolve_conflict(
4221        &self,
4222        request: Entity,
4223        path: &str,
4224    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
4225        AccountContainerWorkspaceResolveConflictCall {
4226            hub: self.hub,
4227            _request: request,
4228            _path: path.to_string(),
4229            _fingerprint: Default::default(),
4230            _delegate: Default::default(),
4231            _additional_params: Default::default(),
4232            _scopes: Default::default(),
4233        }
4234    }
4235
4236    /// Create a builder to help you perform the following task:
4237    ///
4238    /// Syncs a workspace to the latest container version by updating all unmodified workspace entities and displaying conflicts for modified entities.
4239    ///
4240    /// # Arguments
4241    ///
4242    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4243    pub fn containers_workspaces_sync(
4244        &self,
4245        path: &str,
4246    ) -> AccountContainerWorkspaceSyncCall<'a, C> {
4247        AccountContainerWorkspaceSyncCall {
4248            hub: self.hub,
4249            _path: path.to_string(),
4250            _delegate: Default::default(),
4251            _additional_params: Default::default(),
4252            _scopes: Default::default(),
4253        }
4254    }
4255
4256    /// Create a builder to help you perform the following task:
4257    ///
4258    /// Updates a Workspace.
4259    ///
4260    /// # Arguments
4261    ///
4262    /// * `request` - No description provided.
4263    /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
4264    pub fn containers_workspaces_update(
4265        &self,
4266        request: Workspace,
4267        path: &str,
4268    ) -> AccountContainerWorkspaceUpdateCall<'a, C> {
4269        AccountContainerWorkspaceUpdateCall {
4270            hub: self.hub,
4271            _request: request,
4272            _path: path.to_string(),
4273            _fingerprint: Default::default(),
4274            _delegate: Default::default(),
4275            _additional_params: Default::default(),
4276            _scopes: Default::default(),
4277        }
4278    }
4279
4280    /// Create a builder to help you perform the following task:
4281    ///
4282    /// Combines Containers.
4283    ///
4284    /// # Arguments
4285    ///
4286    /// * `path` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4287    pub fn containers_combine(&self, path: &str) -> AccountContainerCombineCall<'a, C> {
4288        AccountContainerCombineCall {
4289            hub: self.hub,
4290            _path: path.to_string(),
4291            _setting_source: Default::default(),
4292            _container_id: Default::default(),
4293            _allow_user_permission_feature_update: Default::default(),
4294            _delegate: Default::default(),
4295            _additional_params: Default::default(),
4296            _scopes: Default::default(),
4297        }
4298    }
4299
4300    /// Create a builder to help you perform the following task:
4301    ///
4302    /// Creates a Container.
4303    ///
4304    /// # Arguments
4305    ///
4306    /// * `request` - No description provided.
4307    /// * `parent` - GTM Account's API relative path. Example: accounts/{account_id}.
4308    pub fn containers_create(
4309        &self,
4310        request: Container,
4311        parent: &str,
4312    ) -> AccountContainerCreateCall<'a, C> {
4313        AccountContainerCreateCall {
4314            hub: self.hub,
4315            _request: request,
4316            _parent: parent.to_string(),
4317            _delegate: Default::default(),
4318            _additional_params: Default::default(),
4319            _scopes: Default::default(),
4320        }
4321    }
4322
4323    /// Create a builder to help you perform the following task:
4324    ///
4325    /// Deletes a Container.
4326    ///
4327    /// # Arguments
4328    ///
4329    /// * `path` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4330    pub fn containers_delete(&self, path: &str) -> AccountContainerDeleteCall<'a, C> {
4331        AccountContainerDeleteCall {
4332            hub: self.hub,
4333            _path: path.to_string(),
4334            _delegate: Default::default(),
4335            _additional_params: Default::default(),
4336            _scopes: Default::default(),
4337        }
4338    }
4339
4340    /// Create a builder to help you perform the following task:
4341    ///
4342    /// Gets a Container.
4343    ///
4344    /// # Arguments
4345    ///
4346    /// * `path` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4347    pub fn containers_get(&self, path: &str) -> AccountContainerGetCall<'a, C> {
4348        AccountContainerGetCall {
4349            hub: self.hub,
4350            _path: path.to_string(),
4351            _delegate: Default::default(),
4352            _additional_params: Default::default(),
4353            _scopes: Default::default(),
4354        }
4355    }
4356
4357    /// Create a builder to help you perform the following task:
4358    ///
4359    /// Lists all Containers that belongs to a GTM Account.
4360    ///
4361    /// # Arguments
4362    ///
4363    /// * `parent` - GTM Account's API relative path. Example: accounts/{account_id}.
4364    pub fn containers_list(&self, parent: &str) -> AccountContainerListCall<'a, C> {
4365        AccountContainerListCall {
4366            hub: self.hub,
4367            _parent: parent.to_string(),
4368            _page_token: Default::default(),
4369            _delegate: Default::default(),
4370            _additional_params: Default::default(),
4371            _scopes: Default::default(),
4372        }
4373    }
4374
4375    /// Create a builder to help you perform the following task:
4376    ///
4377    /// Looks up a Container by destination ID.
4378    pub fn containers_lookup(&self) -> AccountContainerLookupCall<'a, C> {
4379        AccountContainerLookupCall {
4380            hub: self.hub,
4381            _destination_id: Default::default(),
4382            _delegate: Default::default(),
4383            _additional_params: Default::default(),
4384            _scopes: Default::default(),
4385        }
4386    }
4387
4388    /// Create a builder to help you perform the following task:
4389    ///
4390    /// Move Tag ID out of a Container.
4391    ///
4392    /// # Arguments
4393    ///
4394    /// * `path` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4395    pub fn containers_move_tag_id(&self, path: &str) -> AccountContainerMoveTagIdCall<'a, C> {
4396        AccountContainerMoveTagIdCall {
4397            hub: self.hub,
4398            _path: path.to_string(),
4399            _tag_name: Default::default(),
4400            _tag_id: Default::default(),
4401            _copy_users: Default::default(),
4402            _copy_terms_of_service: Default::default(),
4403            _copy_settings: Default::default(),
4404            _allow_user_permission_feature_update: Default::default(),
4405            _delegate: Default::default(),
4406            _additional_params: Default::default(),
4407            _scopes: Default::default(),
4408        }
4409    }
4410
4411    /// Create a builder to help you perform the following task:
4412    ///
4413    /// Gets the tagging snippet for a Container.
4414    ///
4415    /// # Arguments
4416    ///
4417    /// * `path` - Container snippet's API relative path. Example: accounts/{account_id}/containers/{container_id}:snippet
4418    pub fn containers_snippet(&self, path: &str) -> AccountContainerSnippetCall<'a, C> {
4419        AccountContainerSnippetCall {
4420            hub: self.hub,
4421            _path: path.to_string(),
4422            _delegate: Default::default(),
4423            _additional_params: Default::default(),
4424            _scopes: Default::default(),
4425        }
4426    }
4427
4428    /// Create a builder to help you perform the following task:
4429    ///
4430    /// Updates a Container.
4431    ///
4432    /// # Arguments
4433    ///
4434    /// * `request` - No description provided.
4435    /// * `path` - GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
4436    pub fn containers_update(
4437        &self,
4438        request: Container,
4439        path: &str,
4440    ) -> AccountContainerUpdateCall<'a, C> {
4441        AccountContainerUpdateCall {
4442            hub: self.hub,
4443            _request: request,
4444            _path: path.to_string(),
4445            _fingerprint: Default::default(),
4446            _delegate: Default::default(),
4447            _additional_params: Default::default(),
4448            _scopes: Default::default(),
4449        }
4450    }
4451
4452    /// Create a builder to help you perform the following task:
4453    ///
4454    /// Creates a user's Account & Container access.
4455    ///
4456    /// # Arguments
4457    ///
4458    /// * `request` - No description provided.
4459    /// * `parent` - GTM Account's API relative path. Example: accounts/{account_id}
4460    pub fn user_permissions_create(
4461        &self,
4462        request: UserPermission,
4463        parent: &str,
4464    ) -> AccountUserPermissionCreateCall<'a, C> {
4465        AccountUserPermissionCreateCall {
4466            hub: self.hub,
4467            _request: request,
4468            _parent: parent.to_string(),
4469            _delegate: Default::default(),
4470            _additional_params: Default::default(),
4471            _scopes: Default::default(),
4472        }
4473    }
4474
4475    /// Create a builder to help you perform the following task:
4476    ///
4477    /// Removes a user from the account, revoking access to it and all of its containers.
4478    ///
4479    /// # Arguments
4480    ///
4481    /// * `path` - GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
4482    pub fn user_permissions_delete(&self, path: &str) -> AccountUserPermissionDeleteCall<'a, C> {
4483        AccountUserPermissionDeleteCall {
4484            hub: self.hub,
4485            _path: path.to_string(),
4486            _delegate: Default::default(),
4487            _additional_params: Default::default(),
4488            _scopes: Default::default(),
4489        }
4490    }
4491
4492    /// Create a builder to help you perform the following task:
4493    ///
4494    /// Gets a user's Account & Container access.
4495    ///
4496    /// # Arguments
4497    ///
4498    /// * `path` - GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
4499    pub fn user_permissions_get(&self, path: &str) -> AccountUserPermissionGetCall<'a, C> {
4500        AccountUserPermissionGetCall {
4501            hub: self.hub,
4502            _path: path.to_string(),
4503            _delegate: Default::default(),
4504            _additional_params: Default::default(),
4505            _scopes: Default::default(),
4506        }
4507    }
4508
4509    /// Create a builder to help you perform the following task:
4510    ///
4511    /// List all users that have access to the account along with Account and Container user access granted to each of them.
4512    ///
4513    /// # Arguments
4514    ///
4515    /// * `parent` - GTM Account's API relative path. Example: accounts/{account_id}
4516    pub fn user_permissions_list(&self, parent: &str) -> AccountUserPermissionListCall<'a, C> {
4517        AccountUserPermissionListCall {
4518            hub: self.hub,
4519            _parent: parent.to_string(),
4520            _page_token: Default::default(),
4521            _delegate: Default::default(),
4522            _additional_params: Default::default(),
4523            _scopes: Default::default(),
4524        }
4525    }
4526
4527    /// Create a builder to help you perform the following task:
4528    ///
4529    /// Updates a user's Account & Container access.
4530    ///
4531    /// # Arguments
4532    ///
4533    /// * `request` - No description provided.
4534    /// * `path` - GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
4535    pub fn user_permissions_update(
4536        &self,
4537        request: UserPermission,
4538        path: &str,
4539    ) -> AccountUserPermissionUpdateCall<'a, C> {
4540        AccountUserPermissionUpdateCall {
4541            hub: self.hub,
4542            _request: request,
4543            _path: path.to_string(),
4544            _delegate: Default::default(),
4545            _additional_params: Default::default(),
4546            _scopes: Default::default(),
4547        }
4548    }
4549
4550    /// Create a builder to help you perform the following task:
4551    ///
4552    /// Gets a GTM Account.
4553    ///
4554    /// # Arguments
4555    ///
4556    /// * `path` - GTM Account's API relative path. Example: accounts/{account_id}
4557    pub fn get(&self, path: &str) -> AccountGetCall<'a, C> {
4558        AccountGetCall {
4559            hub: self.hub,
4560            _path: path.to_string(),
4561            _delegate: Default::default(),
4562            _additional_params: Default::default(),
4563            _scopes: Default::default(),
4564        }
4565    }
4566
4567    /// Create a builder to help you perform the following task:
4568    ///
4569    /// Lists all GTM Accounts that a user has access to.
4570    pub fn list(&self) -> AccountListCall<'a, C> {
4571        AccountListCall {
4572            hub: self.hub,
4573            _page_token: Default::default(),
4574            _include_google_tags: Default::default(),
4575            _delegate: Default::default(),
4576            _additional_params: Default::default(),
4577            _scopes: Default::default(),
4578        }
4579    }
4580
4581    /// Create a builder to help you perform the following task:
4582    ///
4583    /// Updates a GTM Account.
4584    ///
4585    /// # Arguments
4586    ///
4587    /// * `request` - No description provided.
4588    /// * `path` - GTM Account's API relative path. Example: accounts/{account_id}
4589    pub fn update(&self, request: Account, path: &str) -> AccountUpdateCall<'a, C> {
4590        AccountUpdateCall {
4591            hub: self.hub,
4592            _request: request,
4593            _path: path.to_string(),
4594            _fingerprint: Default::default(),
4595            _delegate: Default::default(),
4596            _additional_params: Default::default(),
4597            _scopes: Default::default(),
4598        }
4599    }
4600}
4601
4602// ###################
4603// CallBuilders   ###
4604// #################
4605
4606/// Gets a Destination.
4607///
4608/// A builder for the *containers.destinations.get* method supported by a *account* resource.
4609/// It is not used directly, but through a [`AccountMethods`] instance.
4610///
4611/// # Example
4612///
4613/// Instantiate a resource method builder
4614///
4615/// ```test_harness,no_run
4616/// # extern crate hyper;
4617/// # extern crate hyper_rustls;
4618/// # extern crate google_tagmanager2 as tagmanager2;
4619/// # async fn dox() {
4620/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4621///
4622/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4623/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4624/// #     secret,
4625/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4626/// # ).build().await.unwrap();
4627///
4628/// # let client = hyper_util::client::legacy::Client::builder(
4629/// #     hyper_util::rt::TokioExecutor::new()
4630/// # )
4631/// # .build(
4632/// #     hyper_rustls::HttpsConnectorBuilder::new()
4633/// #         .with_native_roots()
4634/// #         .unwrap()
4635/// #         .https_or_http()
4636/// #         .enable_http1()
4637/// #         .build()
4638/// # );
4639/// # let mut hub = TagManager::new(client, auth);
4640/// // You can configure optional parameters by calling the respective setters at will, and
4641/// // execute the final call using `doit()`.
4642/// // Values shown here are possibly random and not representative !
4643/// let result = hub.accounts().containers_destinations_get("path")
4644///              .doit().await;
4645/// # }
4646/// ```
4647pub struct AccountContainerDestinationGetCall<'a, C>
4648where
4649    C: 'a,
4650{
4651    hub: &'a TagManager<C>,
4652    _path: String,
4653    _delegate: Option<&'a mut dyn common::Delegate>,
4654    _additional_params: HashMap<String, String>,
4655    _scopes: BTreeSet<String>,
4656}
4657
4658impl<'a, C> common::CallBuilder for AccountContainerDestinationGetCall<'a, C> {}
4659
4660impl<'a, C> AccountContainerDestinationGetCall<'a, C>
4661where
4662    C: common::Connector,
4663{
4664    /// Perform the operation you have build so far.
4665    pub async fn doit(mut self) -> common::Result<(common::Response, Destination)> {
4666        use std::borrow::Cow;
4667        use std::io::{Read, Seek};
4668
4669        use common::{url::Params, ToParts};
4670        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4671
4672        let mut dd = common::DefaultDelegate;
4673        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4674        dlg.begin(common::MethodInfo {
4675            id: "tagmanager.accounts.containers.destinations.get",
4676            http_method: hyper::Method::GET,
4677        });
4678
4679        for &field in ["alt", "path"].iter() {
4680            if self._additional_params.contains_key(field) {
4681                dlg.finished(false);
4682                return Err(common::Error::FieldClash(field));
4683            }
4684        }
4685
4686        let mut params = Params::with_capacity(3 + self._additional_params.len());
4687        params.push("path", self._path);
4688
4689        params.extend(self._additional_params.iter());
4690
4691        params.push("alt", "json");
4692        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
4693        if self._scopes.is_empty() {
4694            self._scopes.insert(Scope::Readonly.as_ref().to_string());
4695        }
4696
4697        #[allow(clippy::single_element_loop)]
4698        for &(find_this, param_name) in [("{+path}", "path")].iter() {
4699            url = params.uri_replacement(url, param_name, find_this, true);
4700        }
4701        {
4702            let to_remove = ["path"];
4703            params.remove_params(&to_remove);
4704        }
4705
4706        let url = params.parse_with_url(&url);
4707
4708        loop {
4709            let token = match self
4710                .hub
4711                .auth
4712                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4713                .await
4714            {
4715                Ok(token) => token,
4716                Err(e) => match dlg.token(e) {
4717                    Ok(token) => token,
4718                    Err(e) => {
4719                        dlg.finished(false);
4720                        return Err(common::Error::MissingToken(e));
4721                    }
4722                },
4723            };
4724            let mut req_result = {
4725                let client = &self.hub.client;
4726                dlg.pre_request();
4727                let mut req_builder = hyper::Request::builder()
4728                    .method(hyper::Method::GET)
4729                    .uri(url.as_str())
4730                    .header(USER_AGENT, self.hub._user_agent.clone());
4731
4732                if let Some(token) = token.as_ref() {
4733                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4734                }
4735
4736                let request = req_builder
4737                    .header(CONTENT_LENGTH, 0_u64)
4738                    .body(common::to_body::<String>(None));
4739
4740                client.request(request.unwrap()).await
4741            };
4742
4743            match req_result {
4744                Err(err) => {
4745                    if let common::Retry::After(d) = dlg.http_error(&err) {
4746                        sleep(d).await;
4747                        continue;
4748                    }
4749                    dlg.finished(false);
4750                    return Err(common::Error::HttpError(err));
4751                }
4752                Ok(res) => {
4753                    let (mut parts, body) = res.into_parts();
4754                    let mut body = common::Body::new(body);
4755                    if !parts.status.is_success() {
4756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4757                        let error = serde_json::from_str(&common::to_string(&bytes));
4758                        let response = common::to_response(parts, bytes.into());
4759
4760                        if let common::Retry::After(d) =
4761                            dlg.http_failure(&response, error.as_ref().ok())
4762                        {
4763                            sleep(d).await;
4764                            continue;
4765                        }
4766
4767                        dlg.finished(false);
4768
4769                        return Err(match error {
4770                            Ok(value) => common::Error::BadRequest(value),
4771                            _ => common::Error::Failure(response),
4772                        });
4773                    }
4774                    let response = {
4775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4776                        let encoded = common::to_string(&bytes);
4777                        match serde_json::from_str(&encoded) {
4778                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4779                            Err(error) => {
4780                                dlg.response_json_decode_error(&encoded, &error);
4781                                return Err(common::Error::JsonDecodeError(
4782                                    encoded.to_string(),
4783                                    error,
4784                                ));
4785                            }
4786                        }
4787                    };
4788
4789                    dlg.finished(true);
4790                    return Ok(response);
4791                }
4792            }
4793        }
4794    }
4795
4796    /// Google Tag Destination's API relative path. Example: accounts/{account_id}/containers/{container_id}/destinations/{destination_link_id}
4797    ///
4798    /// Sets the *path* path property to the given value.
4799    ///
4800    /// Even though the property as already been set when instantiating this call,
4801    /// we provide this method for API completeness.
4802    pub fn path(mut self, new_value: &str) -> AccountContainerDestinationGetCall<'a, C> {
4803        self._path = new_value.to_string();
4804        self
4805    }
4806    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4807    /// while executing the actual API request.
4808    ///
4809    /// ````text
4810    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4811    /// ````
4812    ///
4813    /// Sets the *delegate* property to the given value.
4814    pub fn delegate(
4815        mut self,
4816        new_value: &'a mut dyn common::Delegate,
4817    ) -> AccountContainerDestinationGetCall<'a, C> {
4818        self._delegate = Some(new_value);
4819        self
4820    }
4821
4822    /// Set any additional parameter of the query string used in the request.
4823    /// It should be used to set parameters which are not yet available through their own
4824    /// setters.
4825    ///
4826    /// Please note that this method must not be used to set any of the known parameters
4827    /// which have their own setter method. If done anyway, the request will fail.
4828    ///
4829    /// # Additional Parameters
4830    ///
4831    /// * *$.xgafv* (query-string) - V1 error format.
4832    /// * *access_token* (query-string) - OAuth access token.
4833    /// * *alt* (query-string) - Data format for response.
4834    /// * *callback* (query-string) - JSONP
4835    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4836    /// * *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.
4837    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4838    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4839    /// * *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.
4840    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4841    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4842    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationGetCall<'a, C>
4843    where
4844        T: AsRef<str>,
4845    {
4846        self._additional_params
4847            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4848        self
4849    }
4850
4851    /// Identifies the authorization scope for the method you are building.
4852    ///
4853    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4854    /// [`Scope::Readonly`].
4855    ///
4856    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4857    /// tokens for more than one scope.
4858    ///
4859    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4860    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4861    /// sufficient, a read-write scope will do as well.
4862    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationGetCall<'a, C>
4863    where
4864        St: AsRef<str>,
4865    {
4866        self._scopes.insert(String::from(scope.as_ref()));
4867        self
4868    }
4869    /// Identifies the authorization scope(s) for the method you are building.
4870    ///
4871    /// See [`Self::add_scope()`] for details.
4872    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationGetCall<'a, C>
4873    where
4874        I: IntoIterator<Item = St>,
4875        St: AsRef<str>,
4876    {
4877        self._scopes
4878            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4879        self
4880    }
4881
4882    /// Removes all scopes, and no default scope will be used either.
4883    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4884    /// for details).
4885    pub fn clear_scopes(mut self) -> AccountContainerDestinationGetCall<'a, C> {
4886        self._scopes.clear();
4887        self
4888    }
4889}
4890
4891/// Adds a Destination to this Container and removes it from the Container to which it is currently linked.
4892///
4893/// A builder for the *containers.destinations.link* method supported by a *account* resource.
4894/// It is not used directly, but through a [`AccountMethods`] instance.
4895///
4896/// # Example
4897///
4898/// Instantiate a resource method builder
4899///
4900/// ```test_harness,no_run
4901/// # extern crate hyper;
4902/// # extern crate hyper_rustls;
4903/// # extern crate google_tagmanager2 as tagmanager2;
4904/// # async fn dox() {
4905/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4906///
4907/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4908/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4909/// #     secret,
4910/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4911/// # ).build().await.unwrap();
4912///
4913/// # let client = hyper_util::client::legacy::Client::builder(
4914/// #     hyper_util::rt::TokioExecutor::new()
4915/// # )
4916/// # .build(
4917/// #     hyper_rustls::HttpsConnectorBuilder::new()
4918/// #         .with_native_roots()
4919/// #         .unwrap()
4920/// #         .https_or_http()
4921/// #         .enable_http1()
4922/// #         .build()
4923/// # );
4924/// # let mut hub = TagManager::new(client, auth);
4925/// // You can configure optional parameters by calling the respective setters at will, and
4926/// // execute the final call using `doit()`.
4927/// // Values shown here are possibly random and not representative !
4928/// let result = hub.accounts().containers_destinations_link("parent")
4929///              .destination_id("ea")
4930///              .allow_user_permission_feature_update(false)
4931///              .doit().await;
4932/// # }
4933/// ```
4934pub struct AccountContainerDestinationLinkCall<'a, C>
4935where
4936    C: 'a,
4937{
4938    hub: &'a TagManager<C>,
4939    _parent: String,
4940    _destination_id: Option<String>,
4941    _allow_user_permission_feature_update: Option<bool>,
4942    _delegate: Option<&'a mut dyn common::Delegate>,
4943    _additional_params: HashMap<String, String>,
4944    _scopes: BTreeSet<String>,
4945}
4946
4947impl<'a, C> common::CallBuilder for AccountContainerDestinationLinkCall<'a, C> {}
4948
4949impl<'a, C> AccountContainerDestinationLinkCall<'a, C>
4950where
4951    C: common::Connector,
4952{
4953    /// Perform the operation you have build so far.
4954    pub async fn doit(mut self) -> common::Result<(common::Response, Destination)> {
4955        use std::borrow::Cow;
4956        use std::io::{Read, Seek};
4957
4958        use common::{url::Params, ToParts};
4959        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4960
4961        let mut dd = common::DefaultDelegate;
4962        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4963        dlg.begin(common::MethodInfo {
4964            id: "tagmanager.accounts.containers.destinations.link",
4965            http_method: hyper::Method::POST,
4966        });
4967
4968        for &field in [
4969            "alt",
4970            "parent",
4971            "destinationId",
4972            "allowUserPermissionFeatureUpdate",
4973        ]
4974        .iter()
4975        {
4976            if self._additional_params.contains_key(field) {
4977                dlg.finished(false);
4978                return Err(common::Error::FieldClash(field));
4979            }
4980        }
4981
4982        let mut params = Params::with_capacity(5 + self._additional_params.len());
4983        params.push("parent", self._parent);
4984        if let Some(value) = self._destination_id.as_ref() {
4985            params.push("destinationId", value);
4986        }
4987        if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
4988            params.push("allowUserPermissionFeatureUpdate", value.to_string());
4989        }
4990
4991        params.extend(self._additional_params.iter());
4992
4993        params.push("alt", "json");
4994        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/destinations:link";
4995        if self._scopes.is_empty() {
4996            self._scopes
4997                .insert(Scope::EditContainer.as_ref().to_string());
4998        }
4999
5000        #[allow(clippy::single_element_loop)]
5001        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5002            url = params.uri_replacement(url, param_name, find_this, true);
5003        }
5004        {
5005            let to_remove = ["parent"];
5006            params.remove_params(&to_remove);
5007        }
5008
5009        let url = params.parse_with_url(&url);
5010
5011        loop {
5012            let token = match self
5013                .hub
5014                .auth
5015                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5016                .await
5017            {
5018                Ok(token) => token,
5019                Err(e) => match dlg.token(e) {
5020                    Ok(token) => token,
5021                    Err(e) => {
5022                        dlg.finished(false);
5023                        return Err(common::Error::MissingToken(e));
5024                    }
5025                },
5026            };
5027            let mut req_result = {
5028                let client = &self.hub.client;
5029                dlg.pre_request();
5030                let mut req_builder = hyper::Request::builder()
5031                    .method(hyper::Method::POST)
5032                    .uri(url.as_str())
5033                    .header(USER_AGENT, self.hub._user_agent.clone());
5034
5035                if let Some(token) = token.as_ref() {
5036                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5037                }
5038
5039                let request = req_builder
5040                    .header(CONTENT_LENGTH, 0_u64)
5041                    .body(common::to_body::<String>(None));
5042
5043                client.request(request.unwrap()).await
5044            };
5045
5046            match req_result {
5047                Err(err) => {
5048                    if let common::Retry::After(d) = dlg.http_error(&err) {
5049                        sleep(d).await;
5050                        continue;
5051                    }
5052                    dlg.finished(false);
5053                    return Err(common::Error::HttpError(err));
5054                }
5055                Ok(res) => {
5056                    let (mut parts, body) = res.into_parts();
5057                    let mut body = common::Body::new(body);
5058                    if !parts.status.is_success() {
5059                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5060                        let error = serde_json::from_str(&common::to_string(&bytes));
5061                        let response = common::to_response(parts, bytes.into());
5062
5063                        if let common::Retry::After(d) =
5064                            dlg.http_failure(&response, error.as_ref().ok())
5065                        {
5066                            sleep(d).await;
5067                            continue;
5068                        }
5069
5070                        dlg.finished(false);
5071
5072                        return Err(match error {
5073                            Ok(value) => common::Error::BadRequest(value),
5074                            _ => common::Error::Failure(response),
5075                        });
5076                    }
5077                    let response = {
5078                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5079                        let encoded = common::to_string(&bytes);
5080                        match serde_json::from_str(&encoded) {
5081                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5082                            Err(error) => {
5083                                dlg.response_json_decode_error(&encoded, &error);
5084                                return Err(common::Error::JsonDecodeError(
5085                                    encoded.to_string(),
5086                                    error,
5087                                ));
5088                            }
5089                        }
5090                    };
5091
5092                    dlg.finished(true);
5093                    return Ok(response);
5094                }
5095            }
5096        }
5097    }
5098
5099    /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
5100    ///
5101    /// Sets the *parent* path property to the given value.
5102    ///
5103    /// Even though the property as already been set when instantiating this call,
5104    /// we provide this method for API completeness.
5105    pub fn parent(mut self, new_value: &str) -> AccountContainerDestinationLinkCall<'a, C> {
5106        self._parent = new_value.to_string();
5107        self
5108    }
5109    /// Destination ID to be linked to the current container.
5110    ///
5111    /// Sets the *destination id* query property to the given value.
5112    pub fn destination_id(mut self, new_value: &str) -> AccountContainerDestinationLinkCall<'a, C> {
5113        self._destination_id = Some(new_value.to_string());
5114        self
5115    }
5116    /// Must be set to true to allow features.user_permissions to change from false to true. If this operation causes an update but this bit is false, the operation will fail.
5117    ///
5118    /// Sets the *allow user permission feature update* query property to the given value.
5119    pub fn allow_user_permission_feature_update(
5120        mut self,
5121        new_value: bool,
5122    ) -> AccountContainerDestinationLinkCall<'a, C> {
5123        self._allow_user_permission_feature_update = Some(new_value);
5124        self
5125    }
5126    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5127    /// while executing the actual API request.
5128    ///
5129    /// ````text
5130    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5131    /// ````
5132    ///
5133    /// Sets the *delegate* property to the given value.
5134    pub fn delegate(
5135        mut self,
5136        new_value: &'a mut dyn common::Delegate,
5137    ) -> AccountContainerDestinationLinkCall<'a, C> {
5138        self._delegate = Some(new_value);
5139        self
5140    }
5141
5142    /// Set any additional parameter of the query string used in the request.
5143    /// It should be used to set parameters which are not yet available through their own
5144    /// setters.
5145    ///
5146    /// Please note that this method must not be used to set any of the known parameters
5147    /// which have their own setter method. If done anyway, the request will fail.
5148    ///
5149    /// # Additional Parameters
5150    ///
5151    /// * *$.xgafv* (query-string) - V1 error format.
5152    /// * *access_token* (query-string) - OAuth access token.
5153    /// * *alt* (query-string) - Data format for response.
5154    /// * *callback* (query-string) - JSONP
5155    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5156    /// * *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.
5157    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5158    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5159    /// * *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.
5160    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5161    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5162    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationLinkCall<'a, C>
5163    where
5164        T: AsRef<str>,
5165    {
5166        self._additional_params
5167            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5168        self
5169    }
5170
5171    /// Identifies the authorization scope for the method you are building.
5172    ///
5173    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5174    /// [`Scope::EditContainer`].
5175    ///
5176    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5177    /// tokens for more than one scope.
5178    ///
5179    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5180    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5181    /// sufficient, a read-write scope will do as well.
5182    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationLinkCall<'a, C>
5183    where
5184        St: AsRef<str>,
5185    {
5186        self._scopes.insert(String::from(scope.as_ref()));
5187        self
5188    }
5189    /// Identifies the authorization scope(s) for the method you are building.
5190    ///
5191    /// See [`Self::add_scope()`] for details.
5192    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationLinkCall<'a, C>
5193    where
5194        I: IntoIterator<Item = St>,
5195        St: AsRef<str>,
5196    {
5197        self._scopes
5198            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5199        self
5200    }
5201
5202    /// Removes all scopes, and no default scope will be used either.
5203    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5204    /// for details).
5205    pub fn clear_scopes(mut self) -> AccountContainerDestinationLinkCall<'a, C> {
5206        self._scopes.clear();
5207        self
5208    }
5209}
5210
5211/// Lists all Destinations linked to a GTM Container.
5212///
5213/// A builder for the *containers.destinations.list* method supported by a *account* resource.
5214/// It is not used directly, but through a [`AccountMethods`] instance.
5215///
5216/// # Example
5217///
5218/// Instantiate a resource method builder
5219///
5220/// ```test_harness,no_run
5221/// # extern crate hyper;
5222/// # extern crate hyper_rustls;
5223/// # extern crate google_tagmanager2 as tagmanager2;
5224/// # async fn dox() {
5225/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5226///
5227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5229/// #     secret,
5230/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5231/// # ).build().await.unwrap();
5232///
5233/// # let client = hyper_util::client::legacy::Client::builder(
5234/// #     hyper_util::rt::TokioExecutor::new()
5235/// # )
5236/// # .build(
5237/// #     hyper_rustls::HttpsConnectorBuilder::new()
5238/// #         .with_native_roots()
5239/// #         .unwrap()
5240/// #         .https_or_http()
5241/// #         .enable_http1()
5242/// #         .build()
5243/// # );
5244/// # let mut hub = TagManager::new(client, auth);
5245/// // You can configure optional parameters by calling the respective setters at will, and
5246/// // execute the final call using `doit()`.
5247/// // Values shown here are possibly random and not representative !
5248/// let result = hub.accounts().containers_destinations_list("parent")
5249///              .doit().await;
5250/// # }
5251/// ```
5252pub struct AccountContainerDestinationListCall<'a, C>
5253where
5254    C: 'a,
5255{
5256    hub: &'a TagManager<C>,
5257    _parent: String,
5258    _delegate: Option<&'a mut dyn common::Delegate>,
5259    _additional_params: HashMap<String, String>,
5260    _scopes: BTreeSet<String>,
5261}
5262
5263impl<'a, C> common::CallBuilder for AccountContainerDestinationListCall<'a, C> {}
5264
5265impl<'a, C> AccountContainerDestinationListCall<'a, C>
5266where
5267    C: common::Connector,
5268{
5269    /// Perform the operation you have build so far.
5270    pub async fn doit(mut self) -> common::Result<(common::Response, ListDestinationsResponse)> {
5271        use std::borrow::Cow;
5272        use std::io::{Read, Seek};
5273
5274        use common::{url::Params, ToParts};
5275        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5276
5277        let mut dd = common::DefaultDelegate;
5278        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5279        dlg.begin(common::MethodInfo {
5280            id: "tagmanager.accounts.containers.destinations.list",
5281            http_method: hyper::Method::GET,
5282        });
5283
5284        for &field in ["alt", "parent"].iter() {
5285            if self._additional_params.contains_key(field) {
5286                dlg.finished(false);
5287                return Err(common::Error::FieldClash(field));
5288            }
5289        }
5290
5291        let mut params = Params::with_capacity(3 + self._additional_params.len());
5292        params.push("parent", self._parent);
5293
5294        params.extend(self._additional_params.iter());
5295
5296        params.push("alt", "json");
5297        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/destinations";
5298        if self._scopes.is_empty() {
5299            self._scopes.insert(Scope::Readonly.as_ref().to_string());
5300        }
5301
5302        #[allow(clippy::single_element_loop)]
5303        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5304            url = params.uri_replacement(url, param_name, find_this, true);
5305        }
5306        {
5307            let to_remove = ["parent"];
5308            params.remove_params(&to_remove);
5309        }
5310
5311        let url = params.parse_with_url(&url);
5312
5313        loop {
5314            let token = match self
5315                .hub
5316                .auth
5317                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5318                .await
5319            {
5320                Ok(token) => token,
5321                Err(e) => match dlg.token(e) {
5322                    Ok(token) => token,
5323                    Err(e) => {
5324                        dlg.finished(false);
5325                        return Err(common::Error::MissingToken(e));
5326                    }
5327                },
5328            };
5329            let mut req_result = {
5330                let client = &self.hub.client;
5331                dlg.pre_request();
5332                let mut req_builder = hyper::Request::builder()
5333                    .method(hyper::Method::GET)
5334                    .uri(url.as_str())
5335                    .header(USER_AGENT, self.hub._user_agent.clone());
5336
5337                if let Some(token) = token.as_ref() {
5338                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5339                }
5340
5341                let request = req_builder
5342                    .header(CONTENT_LENGTH, 0_u64)
5343                    .body(common::to_body::<String>(None));
5344
5345                client.request(request.unwrap()).await
5346            };
5347
5348            match req_result {
5349                Err(err) => {
5350                    if let common::Retry::After(d) = dlg.http_error(&err) {
5351                        sleep(d).await;
5352                        continue;
5353                    }
5354                    dlg.finished(false);
5355                    return Err(common::Error::HttpError(err));
5356                }
5357                Ok(res) => {
5358                    let (mut parts, body) = res.into_parts();
5359                    let mut body = common::Body::new(body);
5360                    if !parts.status.is_success() {
5361                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5362                        let error = serde_json::from_str(&common::to_string(&bytes));
5363                        let response = common::to_response(parts, bytes.into());
5364
5365                        if let common::Retry::After(d) =
5366                            dlg.http_failure(&response, error.as_ref().ok())
5367                        {
5368                            sleep(d).await;
5369                            continue;
5370                        }
5371
5372                        dlg.finished(false);
5373
5374                        return Err(match error {
5375                            Ok(value) => common::Error::BadRequest(value),
5376                            _ => common::Error::Failure(response),
5377                        });
5378                    }
5379                    let response = {
5380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5381                        let encoded = common::to_string(&bytes);
5382                        match serde_json::from_str(&encoded) {
5383                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5384                            Err(error) => {
5385                                dlg.response_json_decode_error(&encoded, &error);
5386                                return Err(common::Error::JsonDecodeError(
5387                                    encoded.to_string(),
5388                                    error,
5389                                ));
5390                            }
5391                        }
5392                    };
5393
5394                    dlg.finished(true);
5395                    return Ok(response);
5396                }
5397            }
5398        }
5399    }
5400
5401    /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
5402    ///
5403    /// Sets the *parent* path property to the given value.
5404    ///
5405    /// Even though the property as already been set when instantiating this call,
5406    /// we provide this method for API completeness.
5407    pub fn parent(mut self, new_value: &str) -> AccountContainerDestinationListCall<'a, C> {
5408        self._parent = new_value.to_string();
5409        self
5410    }
5411    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5412    /// while executing the actual API request.
5413    ///
5414    /// ````text
5415    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5416    /// ````
5417    ///
5418    /// Sets the *delegate* property to the given value.
5419    pub fn delegate(
5420        mut self,
5421        new_value: &'a mut dyn common::Delegate,
5422    ) -> AccountContainerDestinationListCall<'a, C> {
5423        self._delegate = Some(new_value);
5424        self
5425    }
5426
5427    /// Set any additional parameter of the query string used in the request.
5428    /// It should be used to set parameters which are not yet available through their own
5429    /// setters.
5430    ///
5431    /// Please note that this method must not be used to set any of the known parameters
5432    /// which have their own setter method. If done anyway, the request will fail.
5433    ///
5434    /// # Additional Parameters
5435    ///
5436    /// * *$.xgafv* (query-string) - V1 error format.
5437    /// * *access_token* (query-string) - OAuth access token.
5438    /// * *alt* (query-string) - Data format for response.
5439    /// * *callback* (query-string) - JSONP
5440    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5441    /// * *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.
5442    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5443    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5444    /// * *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.
5445    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5446    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5447    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationListCall<'a, C>
5448    where
5449        T: AsRef<str>,
5450    {
5451        self._additional_params
5452            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5453        self
5454    }
5455
5456    /// Identifies the authorization scope for the method you are building.
5457    ///
5458    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5459    /// [`Scope::Readonly`].
5460    ///
5461    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5462    /// tokens for more than one scope.
5463    ///
5464    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5465    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5466    /// sufficient, a read-write scope will do as well.
5467    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationListCall<'a, C>
5468    where
5469        St: AsRef<str>,
5470    {
5471        self._scopes.insert(String::from(scope.as_ref()));
5472        self
5473    }
5474    /// Identifies the authorization scope(s) for the method you are building.
5475    ///
5476    /// See [`Self::add_scope()`] for details.
5477    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationListCall<'a, C>
5478    where
5479        I: IntoIterator<Item = St>,
5480        St: AsRef<str>,
5481    {
5482        self._scopes
5483            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5484        self
5485    }
5486
5487    /// Removes all scopes, and no default scope will be used either.
5488    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5489    /// for details).
5490    pub fn clear_scopes(mut self) -> AccountContainerDestinationListCall<'a, C> {
5491        self._scopes.clear();
5492        self
5493    }
5494}
5495
5496/// Creates a GTM Environment.
5497///
5498/// A builder for the *containers.environments.create* method supported by a *account* resource.
5499/// It is not used directly, but through a [`AccountMethods`] instance.
5500///
5501/// # Example
5502///
5503/// Instantiate a resource method builder
5504///
5505/// ```test_harness,no_run
5506/// # extern crate hyper;
5507/// # extern crate hyper_rustls;
5508/// # extern crate google_tagmanager2 as tagmanager2;
5509/// use tagmanager2::api::Environment;
5510/// # async fn dox() {
5511/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5512///
5513/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5514/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5515/// #     secret,
5516/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5517/// # ).build().await.unwrap();
5518///
5519/// # let client = hyper_util::client::legacy::Client::builder(
5520/// #     hyper_util::rt::TokioExecutor::new()
5521/// # )
5522/// # .build(
5523/// #     hyper_rustls::HttpsConnectorBuilder::new()
5524/// #         .with_native_roots()
5525/// #         .unwrap()
5526/// #         .https_or_http()
5527/// #         .enable_http1()
5528/// #         .build()
5529/// # );
5530/// # let mut hub = TagManager::new(client, auth);
5531/// // As the method needs a request, you would usually fill it with the desired information
5532/// // into the respective structure. Some of the parts shown here might not be applicable !
5533/// // Values shown here are possibly random and not representative !
5534/// let mut req = Environment::default();
5535///
5536/// // You can configure optional parameters by calling the respective setters at will, and
5537/// // execute the final call using `doit()`.
5538/// // Values shown here are possibly random and not representative !
5539/// let result = hub.accounts().containers_environments_create(req, "parent")
5540///              .doit().await;
5541/// # }
5542/// ```
5543pub struct AccountContainerEnvironmentCreateCall<'a, C>
5544where
5545    C: 'a,
5546{
5547    hub: &'a TagManager<C>,
5548    _request: Environment,
5549    _parent: String,
5550    _delegate: Option<&'a mut dyn common::Delegate>,
5551    _additional_params: HashMap<String, String>,
5552    _scopes: BTreeSet<String>,
5553}
5554
5555impl<'a, C> common::CallBuilder for AccountContainerEnvironmentCreateCall<'a, C> {}
5556
5557impl<'a, C> AccountContainerEnvironmentCreateCall<'a, C>
5558where
5559    C: common::Connector,
5560{
5561    /// Perform the operation you have build so far.
5562    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
5563        use std::borrow::Cow;
5564        use std::io::{Read, Seek};
5565
5566        use common::{url::Params, ToParts};
5567        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5568
5569        let mut dd = common::DefaultDelegate;
5570        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5571        dlg.begin(common::MethodInfo {
5572            id: "tagmanager.accounts.containers.environments.create",
5573            http_method: hyper::Method::POST,
5574        });
5575
5576        for &field in ["alt", "parent"].iter() {
5577            if self._additional_params.contains_key(field) {
5578                dlg.finished(false);
5579                return Err(common::Error::FieldClash(field));
5580            }
5581        }
5582
5583        let mut params = Params::with_capacity(4 + self._additional_params.len());
5584        params.push("parent", self._parent);
5585
5586        params.extend(self._additional_params.iter());
5587
5588        params.push("alt", "json");
5589        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/environments";
5590        if self._scopes.is_empty() {
5591            self._scopes
5592                .insert(Scope::EditContainer.as_ref().to_string());
5593        }
5594
5595        #[allow(clippy::single_element_loop)]
5596        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5597            url = params.uri_replacement(url, param_name, find_this, true);
5598        }
5599        {
5600            let to_remove = ["parent"];
5601            params.remove_params(&to_remove);
5602        }
5603
5604        let url = params.parse_with_url(&url);
5605
5606        let mut json_mime_type = mime::APPLICATION_JSON;
5607        let mut request_value_reader = {
5608            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5609            common::remove_json_null_values(&mut value);
5610            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5611            serde_json::to_writer(&mut dst, &value).unwrap();
5612            dst
5613        };
5614        let request_size = request_value_reader
5615            .seek(std::io::SeekFrom::End(0))
5616            .unwrap();
5617        request_value_reader
5618            .seek(std::io::SeekFrom::Start(0))
5619            .unwrap();
5620
5621        loop {
5622            let token = match self
5623                .hub
5624                .auth
5625                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5626                .await
5627            {
5628                Ok(token) => token,
5629                Err(e) => match dlg.token(e) {
5630                    Ok(token) => token,
5631                    Err(e) => {
5632                        dlg.finished(false);
5633                        return Err(common::Error::MissingToken(e));
5634                    }
5635                },
5636            };
5637            request_value_reader
5638                .seek(std::io::SeekFrom::Start(0))
5639                .unwrap();
5640            let mut req_result = {
5641                let client = &self.hub.client;
5642                dlg.pre_request();
5643                let mut req_builder = hyper::Request::builder()
5644                    .method(hyper::Method::POST)
5645                    .uri(url.as_str())
5646                    .header(USER_AGENT, self.hub._user_agent.clone());
5647
5648                if let Some(token) = token.as_ref() {
5649                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5650                }
5651
5652                let request = req_builder
5653                    .header(CONTENT_TYPE, json_mime_type.to_string())
5654                    .header(CONTENT_LENGTH, request_size as u64)
5655                    .body(common::to_body(
5656                        request_value_reader.get_ref().clone().into(),
5657                    ));
5658
5659                client.request(request.unwrap()).await
5660            };
5661
5662            match req_result {
5663                Err(err) => {
5664                    if let common::Retry::After(d) = dlg.http_error(&err) {
5665                        sleep(d).await;
5666                        continue;
5667                    }
5668                    dlg.finished(false);
5669                    return Err(common::Error::HttpError(err));
5670                }
5671                Ok(res) => {
5672                    let (mut parts, body) = res.into_parts();
5673                    let mut body = common::Body::new(body);
5674                    if !parts.status.is_success() {
5675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5676                        let error = serde_json::from_str(&common::to_string(&bytes));
5677                        let response = common::to_response(parts, bytes.into());
5678
5679                        if let common::Retry::After(d) =
5680                            dlg.http_failure(&response, error.as_ref().ok())
5681                        {
5682                            sleep(d).await;
5683                            continue;
5684                        }
5685
5686                        dlg.finished(false);
5687
5688                        return Err(match error {
5689                            Ok(value) => common::Error::BadRequest(value),
5690                            _ => common::Error::Failure(response),
5691                        });
5692                    }
5693                    let response = {
5694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5695                        let encoded = common::to_string(&bytes);
5696                        match serde_json::from_str(&encoded) {
5697                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5698                            Err(error) => {
5699                                dlg.response_json_decode_error(&encoded, &error);
5700                                return Err(common::Error::JsonDecodeError(
5701                                    encoded.to_string(),
5702                                    error,
5703                                ));
5704                            }
5705                        }
5706                    };
5707
5708                    dlg.finished(true);
5709                    return Ok(response);
5710                }
5711            }
5712        }
5713    }
5714
5715    ///
5716    /// Sets the *request* property to the given value.
5717    ///
5718    /// Even though the property as already been set when instantiating this call,
5719    /// we provide this method for API completeness.
5720    pub fn request(
5721        mut self,
5722        new_value: Environment,
5723    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
5724        self._request = new_value;
5725        self
5726    }
5727    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
5728    ///
5729    /// Sets the *parent* path property to the given value.
5730    ///
5731    /// Even though the property as already been set when instantiating this call,
5732    /// we provide this method for API completeness.
5733    pub fn parent(mut self, new_value: &str) -> AccountContainerEnvironmentCreateCall<'a, C> {
5734        self._parent = new_value.to_string();
5735        self
5736    }
5737    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5738    /// while executing the actual API request.
5739    ///
5740    /// ````text
5741    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5742    /// ````
5743    ///
5744    /// Sets the *delegate* property to the given value.
5745    pub fn delegate(
5746        mut self,
5747        new_value: &'a mut dyn common::Delegate,
5748    ) -> AccountContainerEnvironmentCreateCall<'a, C> {
5749        self._delegate = Some(new_value);
5750        self
5751    }
5752
5753    /// Set any additional parameter of the query string used in the request.
5754    /// It should be used to set parameters which are not yet available through their own
5755    /// setters.
5756    ///
5757    /// Please note that this method must not be used to set any of the known parameters
5758    /// which have their own setter method. If done anyway, the request will fail.
5759    ///
5760    /// # Additional Parameters
5761    ///
5762    /// * *$.xgafv* (query-string) - V1 error format.
5763    /// * *access_token* (query-string) - OAuth access token.
5764    /// * *alt* (query-string) - Data format for response.
5765    /// * *callback* (query-string) - JSONP
5766    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5767    /// * *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.
5768    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5769    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5770    /// * *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.
5771    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5772    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5773    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentCreateCall<'a, C>
5774    where
5775        T: AsRef<str>,
5776    {
5777        self._additional_params
5778            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5779        self
5780    }
5781
5782    /// Identifies the authorization scope for the method you are building.
5783    ///
5784    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5785    /// [`Scope::EditContainer`].
5786    ///
5787    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5788    /// tokens for more than one scope.
5789    ///
5790    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5791    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5792    /// sufficient, a read-write scope will do as well.
5793    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentCreateCall<'a, C>
5794    where
5795        St: AsRef<str>,
5796    {
5797        self._scopes.insert(String::from(scope.as_ref()));
5798        self
5799    }
5800    /// Identifies the authorization scope(s) for the method you are building.
5801    ///
5802    /// See [`Self::add_scope()`] for details.
5803    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentCreateCall<'a, C>
5804    where
5805        I: IntoIterator<Item = St>,
5806        St: AsRef<str>,
5807    {
5808        self._scopes
5809            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5810        self
5811    }
5812
5813    /// Removes all scopes, and no default scope will be used either.
5814    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5815    /// for details).
5816    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentCreateCall<'a, C> {
5817        self._scopes.clear();
5818        self
5819    }
5820}
5821
5822/// Deletes a GTM Environment.
5823///
5824/// A builder for the *containers.environments.delete* method supported by a *account* resource.
5825/// It is not used directly, but through a [`AccountMethods`] instance.
5826///
5827/// # Example
5828///
5829/// Instantiate a resource method builder
5830///
5831/// ```test_harness,no_run
5832/// # extern crate hyper;
5833/// # extern crate hyper_rustls;
5834/// # extern crate google_tagmanager2 as tagmanager2;
5835/// # async fn dox() {
5836/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5837///
5838/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5840/// #     secret,
5841/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5842/// # ).build().await.unwrap();
5843///
5844/// # let client = hyper_util::client::legacy::Client::builder(
5845/// #     hyper_util::rt::TokioExecutor::new()
5846/// # )
5847/// # .build(
5848/// #     hyper_rustls::HttpsConnectorBuilder::new()
5849/// #         .with_native_roots()
5850/// #         .unwrap()
5851/// #         .https_or_http()
5852/// #         .enable_http1()
5853/// #         .build()
5854/// # );
5855/// # let mut hub = TagManager::new(client, auth);
5856/// // You can configure optional parameters by calling the respective setters at will, and
5857/// // execute the final call using `doit()`.
5858/// // Values shown here are possibly random and not representative !
5859/// let result = hub.accounts().containers_environments_delete("path")
5860///              .doit().await;
5861/// # }
5862/// ```
5863pub struct AccountContainerEnvironmentDeleteCall<'a, C>
5864where
5865    C: 'a,
5866{
5867    hub: &'a TagManager<C>,
5868    _path: String,
5869    _delegate: Option<&'a mut dyn common::Delegate>,
5870    _additional_params: HashMap<String, String>,
5871    _scopes: BTreeSet<String>,
5872}
5873
5874impl<'a, C> common::CallBuilder for AccountContainerEnvironmentDeleteCall<'a, C> {}
5875
5876impl<'a, C> AccountContainerEnvironmentDeleteCall<'a, C>
5877where
5878    C: common::Connector,
5879{
5880    /// Perform the operation you have build so far.
5881    pub async fn doit(mut self) -> common::Result<common::Response> {
5882        use std::borrow::Cow;
5883        use std::io::{Read, Seek};
5884
5885        use common::{url::Params, ToParts};
5886        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5887
5888        let mut dd = common::DefaultDelegate;
5889        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5890        dlg.begin(common::MethodInfo {
5891            id: "tagmanager.accounts.containers.environments.delete",
5892            http_method: hyper::Method::DELETE,
5893        });
5894
5895        for &field in ["path"].iter() {
5896            if self._additional_params.contains_key(field) {
5897                dlg.finished(false);
5898                return Err(common::Error::FieldClash(field));
5899            }
5900        }
5901
5902        let mut params = Params::with_capacity(2 + self._additional_params.len());
5903        params.push("path", self._path);
5904
5905        params.extend(self._additional_params.iter());
5906
5907        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
5908        if self._scopes.is_empty() {
5909            self._scopes
5910                .insert(Scope::EditContainer.as_ref().to_string());
5911        }
5912
5913        #[allow(clippy::single_element_loop)]
5914        for &(find_this, param_name) in [("{+path}", "path")].iter() {
5915            url = params.uri_replacement(url, param_name, find_this, true);
5916        }
5917        {
5918            let to_remove = ["path"];
5919            params.remove_params(&to_remove);
5920        }
5921
5922        let url = params.parse_with_url(&url);
5923
5924        loop {
5925            let token = match self
5926                .hub
5927                .auth
5928                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5929                .await
5930            {
5931                Ok(token) => token,
5932                Err(e) => match dlg.token(e) {
5933                    Ok(token) => token,
5934                    Err(e) => {
5935                        dlg.finished(false);
5936                        return Err(common::Error::MissingToken(e));
5937                    }
5938                },
5939            };
5940            let mut req_result = {
5941                let client = &self.hub.client;
5942                dlg.pre_request();
5943                let mut req_builder = hyper::Request::builder()
5944                    .method(hyper::Method::DELETE)
5945                    .uri(url.as_str())
5946                    .header(USER_AGENT, self.hub._user_agent.clone());
5947
5948                if let Some(token) = token.as_ref() {
5949                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5950                }
5951
5952                let request = req_builder
5953                    .header(CONTENT_LENGTH, 0_u64)
5954                    .body(common::to_body::<String>(None));
5955
5956                client.request(request.unwrap()).await
5957            };
5958
5959            match req_result {
5960                Err(err) => {
5961                    if let common::Retry::After(d) = dlg.http_error(&err) {
5962                        sleep(d).await;
5963                        continue;
5964                    }
5965                    dlg.finished(false);
5966                    return Err(common::Error::HttpError(err));
5967                }
5968                Ok(res) => {
5969                    let (mut parts, body) = res.into_parts();
5970                    let mut body = common::Body::new(body);
5971                    if !parts.status.is_success() {
5972                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5973                        let error = serde_json::from_str(&common::to_string(&bytes));
5974                        let response = common::to_response(parts, bytes.into());
5975
5976                        if let common::Retry::After(d) =
5977                            dlg.http_failure(&response, error.as_ref().ok())
5978                        {
5979                            sleep(d).await;
5980                            continue;
5981                        }
5982
5983                        dlg.finished(false);
5984
5985                        return Err(match error {
5986                            Ok(value) => common::Error::BadRequest(value),
5987                            _ => common::Error::Failure(response),
5988                        });
5989                    }
5990                    let response = common::Response::from_parts(parts, body);
5991
5992                    dlg.finished(true);
5993                    return Ok(response);
5994                }
5995            }
5996        }
5997    }
5998
5999    /// GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
6000    ///
6001    /// Sets the *path* path property to the given value.
6002    ///
6003    /// Even though the property as already been set when instantiating this call,
6004    /// we provide this method for API completeness.
6005    pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6006        self._path = new_value.to_string();
6007        self
6008    }
6009    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6010    /// while executing the actual API request.
6011    ///
6012    /// ````text
6013    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6014    /// ````
6015    ///
6016    /// Sets the *delegate* property to the given value.
6017    pub fn delegate(
6018        mut self,
6019        new_value: &'a mut dyn common::Delegate,
6020    ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6021        self._delegate = Some(new_value);
6022        self
6023    }
6024
6025    /// Set any additional parameter of the query string used in the request.
6026    /// It should be used to set parameters which are not yet available through their own
6027    /// setters.
6028    ///
6029    /// Please note that this method must not be used to set any of the known parameters
6030    /// which have their own setter method. If done anyway, the request will fail.
6031    ///
6032    /// # Additional Parameters
6033    ///
6034    /// * *$.xgafv* (query-string) - V1 error format.
6035    /// * *access_token* (query-string) - OAuth access token.
6036    /// * *alt* (query-string) - Data format for response.
6037    /// * *callback* (query-string) - JSONP
6038    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6039    /// * *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.
6040    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6041    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6042    /// * *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.
6043    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6044    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6045    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentDeleteCall<'a, C>
6046    where
6047        T: AsRef<str>,
6048    {
6049        self._additional_params
6050            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6051        self
6052    }
6053
6054    /// Identifies the authorization scope for the method you are building.
6055    ///
6056    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6057    /// [`Scope::EditContainer`].
6058    ///
6059    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6060    /// tokens for more than one scope.
6061    ///
6062    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6063    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6064    /// sufficient, a read-write scope will do as well.
6065    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentDeleteCall<'a, C>
6066    where
6067        St: AsRef<str>,
6068    {
6069        self._scopes.insert(String::from(scope.as_ref()));
6070        self
6071    }
6072    /// Identifies the authorization scope(s) for the method you are building.
6073    ///
6074    /// See [`Self::add_scope()`] for details.
6075    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentDeleteCall<'a, C>
6076    where
6077        I: IntoIterator<Item = St>,
6078        St: AsRef<str>,
6079    {
6080        self._scopes
6081            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6082        self
6083    }
6084
6085    /// Removes all scopes, and no default scope will be used either.
6086    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6087    /// for details).
6088    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6089        self._scopes.clear();
6090        self
6091    }
6092}
6093
6094/// Gets a GTM Environment.
6095///
6096/// A builder for the *containers.environments.get* method supported by a *account* resource.
6097/// It is not used directly, but through a [`AccountMethods`] instance.
6098///
6099/// # Example
6100///
6101/// Instantiate a resource method builder
6102///
6103/// ```test_harness,no_run
6104/// # extern crate hyper;
6105/// # extern crate hyper_rustls;
6106/// # extern crate google_tagmanager2 as tagmanager2;
6107/// # async fn dox() {
6108/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6109///
6110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6112/// #     secret,
6113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6114/// # ).build().await.unwrap();
6115///
6116/// # let client = hyper_util::client::legacy::Client::builder(
6117/// #     hyper_util::rt::TokioExecutor::new()
6118/// # )
6119/// # .build(
6120/// #     hyper_rustls::HttpsConnectorBuilder::new()
6121/// #         .with_native_roots()
6122/// #         .unwrap()
6123/// #         .https_or_http()
6124/// #         .enable_http1()
6125/// #         .build()
6126/// # );
6127/// # let mut hub = TagManager::new(client, auth);
6128/// // You can configure optional parameters by calling the respective setters at will, and
6129/// // execute the final call using `doit()`.
6130/// // Values shown here are possibly random and not representative !
6131/// let result = hub.accounts().containers_environments_get("path")
6132///              .doit().await;
6133/// # }
6134/// ```
6135pub struct AccountContainerEnvironmentGetCall<'a, C>
6136where
6137    C: 'a,
6138{
6139    hub: &'a TagManager<C>,
6140    _path: String,
6141    _delegate: Option<&'a mut dyn common::Delegate>,
6142    _additional_params: HashMap<String, String>,
6143    _scopes: BTreeSet<String>,
6144}
6145
6146impl<'a, C> common::CallBuilder for AccountContainerEnvironmentGetCall<'a, C> {}
6147
6148impl<'a, C> AccountContainerEnvironmentGetCall<'a, C>
6149where
6150    C: common::Connector,
6151{
6152    /// Perform the operation you have build so far.
6153    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
6154        use std::borrow::Cow;
6155        use std::io::{Read, Seek};
6156
6157        use common::{url::Params, ToParts};
6158        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6159
6160        let mut dd = common::DefaultDelegate;
6161        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6162        dlg.begin(common::MethodInfo {
6163            id: "tagmanager.accounts.containers.environments.get",
6164            http_method: hyper::Method::GET,
6165        });
6166
6167        for &field in ["alt", "path"].iter() {
6168            if self._additional_params.contains_key(field) {
6169                dlg.finished(false);
6170                return Err(common::Error::FieldClash(field));
6171            }
6172        }
6173
6174        let mut params = Params::with_capacity(3 + self._additional_params.len());
6175        params.push("path", self._path);
6176
6177        params.extend(self._additional_params.iter());
6178
6179        params.push("alt", "json");
6180        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
6181        if self._scopes.is_empty() {
6182            self._scopes.insert(Scope::Readonly.as_ref().to_string());
6183        }
6184
6185        #[allow(clippy::single_element_loop)]
6186        for &(find_this, param_name) in [("{+path}", "path")].iter() {
6187            url = params.uri_replacement(url, param_name, find_this, true);
6188        }
6189        {
6190            let to_remove = ["path"];
6191            params.remove_params(&to_remove);
6192        }
6193
6194        let url = params.parse_with_url(&url);
6195
6196        loop {
6197            let token = match self
6198                .hub
6199                .auth
6200                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6201                .await
6202            {
6203                Ok(token) => token,
6204                Err(e) => match dlg.token(e) {
6205                    Ok(token) => token,
6206                    Err(e) => {
6207                        dlg.finished(false);
6208                        return Err(common::Error::MissingToken(e));
6209                    }
6210                },
6211            };
6212            let mut req_result = {
6213                let client = &self.hub.client;
6214                dlg.pre_request();
6215                let mut req_builder = hyper::Request::builder()
6216                    .method(hyper::Method::GET)
6217                    .uri(url.as_str())
6218                    .header(USER_AGENT, self.hub._user_agent.clone());
6219
6220                if let Some(token) = token.as_ref() {
6221                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6222                }
6223
6224                let request = req_builder
6225                    .header(CONTENT_LENGTH, 0_u64)
6226                    .body(common::to_body::<String>(None));
6227
6228                client.request(request.unwrap()).await
6229            };
6230
6231            match req_result {
6232                Err(err) => {
6233                    if let common::Retry::After(d) = dlg.http_error(&err) {
6234                        sleep(d).await;
6235                        continue;
6236                    }
6237                    dlg.finished(false);
6238                    return Err(common::Error::HttpError(err));
6239                }
6240                Ok(res) => {
6241                    let (mut parts, body) = res.into_parts();
6242                    let mut body = common::Body::new(body);
6243                    if !parts.status.is_success() {
6244                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6245                        let error = serde_json::from_str(&common::to_string(&bytes));
6246                        let response = common::to_response(parts, bytes.into());
6247
6248                        if let common::Retry::After(d) =
6249                            dlg.http_failure(&response, error.as_ref().ok())
6250                        {
6251                            sleep(d).await;
6252                            continue;
6253                        }
6254
6255                        dlg.finished(false);
6256
6257                        return Err(match error {
6258                            Ok(value) => common::Error::BadRequest(value),
6259                            _ => common::Error::Failure(response),
6260                        });
6261                    }
6262                    let response = {
6263                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6264                        let encoded = common::to_string(&bytes);
6265                        match serde_json::from_str(&encoded) {
6266                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6267                            Err(error) => {
6268                                dlg.response_json_decode_error(&encoded, &error);
6269                                return Err(common::Error::JsonDecodeError(
6270                                    encoded.to_string(),
6271                                    error,
6272                                ));
6273                            }
6274                        }
6275                    };
6276
6277                    dlg.finished(true);
6278                    return Ok(response);
6279                }
6280            }
6281        }
6282    }
6283
6284    /// GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
6285    ///
6286    /// Sets the *path* path property to the given value.
6287    ///
6288    /// Even though the property as already been set when instantiating this call,
6289    /// we provide this method for API completeness.
6290    pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C> {
6291        self._path = new_value.to_string();
6292        self
6293    }
6294    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6295    /// while executing the actual API request.
6296    ///
6297    /// ````text
6298    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6299    /// ````
6300    ///
6301    /// Sets the *delegate* property to the given value.
6302    pub fn delegate(
6303        mut self,
6304        new_value: &'a mut dyn common::Delegate,
6305    ) -> AccountContainerEnvironmentGetCall<'a, C> {
6306        self._delegate = Some(new_value);
6307        self
6308    }
6309
6310    /// Set any additional parameter of the query string used in the request.
6311    /// It should be used to set parameters which are not yet available through their own
6312    /// setters.
6313    ///
6314    /// Please note that this method must not be used to set any of the known parameters
6315    /// which have their own setter method. If done anyway, the request will fail.
6316    ///
6317    /// # Additional Parameters
6318    ///
6319    /// * *$.xgafv* (query-string) - V1 error format.
6320    /// * *access_token* (query-string) - OAuth access token.
6321    /// * *alt* (query-string) - Data format for response.
6322    /// * *callback* (query-string) - JSONP
6323    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6324    /// * *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.
6325    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6326    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6327    /// * *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.
6328    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6329    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6330    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentGetCall<'a, C>
6331    where
6332        T: AsRef<str>,
6333    {
6334        self._additional_params
6335            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6336        self
6337    }
6338
6339    /// Identifies the authorization scope for the method you are building.
6340    ///
6341    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6342    /// [`Scope::Readonly`].
6343    ///
6344    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6345    /// tokens for more than one scope.
6346    ///
6347    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6348    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6349    /// sufficient, a read-write scope will do as well.
6350    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentGetCall<'a, C>
6351    where
6352        St: AsRef<str>,
6353    {
6354        self._scopes.insert(String::from(scope.as_ref()));
6355        self
6356    }
6357    /// Identifies the authorization scope(s) for the method you are building.
6358    ///
6359    /// See [`Self::add_scope()`] for details.
6360    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentGetCall<'a, C>
6361    where
6362        I: IntoIterator<Item = St>,
6363        St: AsRef<str>,
6364    {
6365        self._scopes
6366            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6367        self
6368    }
6369
6370    /// Removes all scopes, and no default scope will be used either.
6371    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6372    /// for details).
6373    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentGetCall<'a, C> {
6374        self._scopes.clear();
6375        self
6376    }
6377}
6378
6379/// Lists all GTM Environments of a GTM Container.
6380///
6381/// A builder for the *containers.environments.list* method supported by a *account* resource.
6382/// It is not used directly, but through a [`AccountMethods`] instance.
6383///
6384/// # Example
6385///
6386/// Instantiate a resource method builder
6387///
6388/// ```test_harness,no_run
6389/// # extern crate hyper;
6390/// # extern crate hyper_rustls;
6391/// # extern crate google_tagmanager2 as tagmanager2;
6392/// # async fn dox() {
6393/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6394///
6395/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6396/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6397/// #     secret,
6398/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6399/// # ).build().await.unwrap();
6400///
6401/// # let client = hyper_util::client::legacy::Client::builder(
6402/// #     hyper_util::rt::TokioExecutor::new()
6403/// # )
6404/// # .build(
6405/// #     hyper_rustls::HttpsConnectorBuilder::new()
6406/// #         .with_native_roots()
6407/// #         .unwrap()
6408/// #         .https_or_http()
6409/// #         .enable_http1()
6410/// #         .build()
6411/// # );
6412/// # let mut hub = TagManager::new(client, auth);
6413/// // You can configure optional parameters by calling the respective setters at will, and
6414/// // execute the final call using `doit()`.
6415/// // Values shown here are possibly random and not representative !
6416/// let result = hub.accounts().containers_environments_list("parent")
6417///              .page_token("sed")
6418///              .doit().await;
6419/// # }
6420/// ```
6421pub struct AccountContainerEnvironmentListCall<'a, C>
6422where
6423    C: 'a,
6424{
6425    hub: &'a TagManager<C>,
6426    _parent: String,
6427    _page_token: Option<String>,
6428    _delegate: Option<&'a mut dyn common::Delegate>,
6429    _additional_params: HashMap<String, String>,
6430    _scopes: BTreeSet<String>,
6431}
6432
6433impl<'a, C> common::CallBuilder for AccountContainerEnvironmentListCall<'a, C> {}
6434
6435impl<'a, C> AccountContainerEnvironmentListCall<'a, C>
6436where
6437    C: common::Connector,
6438{
6439    /// Perform the operation you have build so far.
6440    pub async fn doit(mut self) -> common::Result<(common::Response, ListEnvironmentsResponse)> {
6441        use std::borrow::Cow;
6442        use std::io::{Read, Seek};
6443
6444        use common::{url::Params, ToParts};
6445        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6446
6447        let mut dd = common::DefaultDelegate;
6448        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6449        dlg.begin(common::MethodInfo {
6450            id: "tagmanager.accounts.containers.environments.list",
6451            http_method: hyper::Method::GET,
6452        });
6453
6454        for &field in ["alt", "parent", "pageToken"].iter() {
6455            if self._additional_params.contains_key(field) {
6456                dlg.finished(false);
6457                return Err(common::Error::FieldClash(field));
6458            }
6459        }
6460
6461        let mut params = Params::with_capacity(4 + self._additional_params.len());
6462        params.push("parent", self._parent);
6463        if let Some(value) = self._page_token.as_ref() {
6464            params.push("pageToken", value);
6465        }
6466
6467        params.extend(self._additional_params.iter());
6468
6469        params.push("alt", "json");
6470        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/environments";
6471        if self._scopes.is_empty() {
6472            self._scopes.insert(Scope::Readonly.as_ref().to_string());
6473        }
6474
6475        #[allow(clippy::single_element_loop)]
6476        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6477            url = params.uri_replacement(url, param_name, find_this, true);
6478        }
6479        {
6480            let to_remove = ["parent"];
6481            params.remove_params(&to_remove);
6482        }
6483
6484        let url = params.parse_with_url(&url);
6485
6486        loop {
6487            let token = match self
6488                .hub
6489                .auth
6490                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6491                .await
6492            {
6493                Ok(token) => token,
6494                Err(e) => match dlg.token(e) {
6495                    Ok(token) => token,
6496                    Err(e) => {
6497                        dlg.finished(false);
6498                        return Err(common::Error::MissingToken(e));
6499                    }
6500                },
6501            };
6502            let mut req_result = {
6503                let client = &self.hub.client;
6504                dlg.pre_request();
6505                let mut req_builder = hyper::Request::builder()
6506                    .method(hyper::Method::GET)
6507                    .uri(url.as_str())
6508                    .header(USER_AGENT, self.hub._user_agent.clone());
6509
6510                if let Some(token) = token.as_ref() {
6511                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6512                }
6513
6514                let request = req_builder
6515                    .header(CONTENT_LENGTH, 0_u64)
6516                    .body(common::to_body::<String>(None));
6517
6518                client.request(request.unwrap()).await
6519            };
6520
6521            match req_result {
6522                Err(err) => {
6523                    if let common::Retry::After(d) = dlg.http_error(&err) {
6524                        sleep(d).await;
6525                        continue;
6526                    }
6527                    dlg.finished(false);
6528                    return Err(common::Error::HttpError(err));
6529                }
6530                Ok(res) => {
6531                    let (mut parts, body) = res.into_parts();
6532                    let mut body = common::Body::new(body);
6533                    if !parts.status.is_success() {
6534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6535                        let error = serde_json::from_str(&common::to_string(&bytes));
6536                        let response = common::to_response(parts, bytes.into());
6537
6538                        if let common::Retry::After(d) =
6539                            dlg.http_failure(&response, error.as_ref().ok())
6540                        {
6541                            sleep(d).await;
6542                            continue;
6543                        }
6544
6545                        dlg.finished(false);
6546
6547                        return Err(match error {
6548                            Ok(value) => common::Error::BadRequest(value),
6549                            _ => common::Error::Failure(response),
6550                        });
6551                    }
6552                    let response = {
6553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6554                        let encoded = common::to_string(&bytes);
6555                        match serde_json::from_str(&encoded) {
6556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6557                            Err(error) => {
6558                                dlg.response_json_decode_error(&encoded, &error);
6559                                return Err(common::Error::JsonDecodeError(
6560                                    encoded.to_string(),
6561                                    error,
6562                                ));
6563                            }
6564                        }
6565                    };
6566
6567                    dlg.finished(true);
6568                    return Ok(response);
6569                }
6570            }
6571        }
6572    }
6573
6574    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
6575    ///
6576    /// Sets the *parent* path property to the given value.
6577    ///
6578    /// Even though the property as already been set when instantiating this call,
6579    /// we provide this method for API completeness.
6580    pub fn parent(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
6581        self._parent = new_value.to_string();
6582        self
6583    }
6584    /// Continuation token for fetching the next page of results.
6585    ///
6586    /// Sets the *page token* query property to the given value.
6587    pub fn page_token(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
6588        self._page_token = Some(new_value.to_string());
6589        self
6590    }
6591    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6592    /// while executing the actual API request.
6593    ///
6594    /// ````text
6595    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6596    /// ````
6597    ///
6598    /// Sets the *delegate* property to the given value.
6599    pub fn delegate(
6600        mut self,
6601        new_value: &'a mut dyn common::Delegate,
6602    ) -> AccountContainerEnvironmentListCall<'a, C> {
6603        self._delegate = Some(new_value);
6604        self
6605    }
6606
6607    /// Set any additional parameter of the query string used in the request.
6608    /// It should be used to set parameters which are not yet available through their own
6609    /// setters.
6610    ///
6611    /// Please note that this method must not be used to set any of the known parameters
6612    /// which have their own setter method. If done anyway, the request will fail.
6613    ///
6614    /// # Additional Parameters
6615    ///
6616    /// * *$.xgafv* (query-string) - V1 error format.
6617    /// * *access_token* (query-string) - OAuth access token.
6618    /// * *alt* (query-string) - Data format for response.
6619    /// * *callback* (query-string) - JSONP
6620    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6621    /// * *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.
6622    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6623    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6624    /// * *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.
6625    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6626    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6627    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentListCall<'a, C>
6628    where
6629        T: AsRef<str>,
6630    {
6631        self._additional_params
6632            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6633        self
6634    }
6635
6636    /// Identifies the authorization scope for the method you are building.
6637    ///
6638    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6639    /// [`Scope::Readonly`].
6640    ///
6641    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6642    /// tokens for more than one scope.
6643    ///
6644    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6645    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6646    /// sufficient, a read-write scope will do as well.
6647    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentListCall<'a, C>
6648    where
6649        St: AsRef<str>,
6650    {
6651        self._scopes.insert(String::from(scope.as_ref()));
6652        self
6653    }
6654    /// Identifies the authorization scope(s) for the method you are building.
6655    ///
6656    /// See [`Self::add_scope()`] for details.
6657    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentListCall<'a, C>
6658    where
6659        I: IntoIterator<Item = St>,
6660        St: AsRef<str>,
6661    {
6662        self._scopes
6663            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6664        self
6665    }
6666
6667    /// Removes all scopes, and no default scope will be used either.
6668    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6669    /// for details).
6670    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentListCall<'a, C> {
6671        self._scopes.clear();
6672        self
6673    }
6674}
6675
6676/// Re-generates the authorization code for a GTM Environment.
6677///
6678/// A builder for the *containers.environments.reauthorize* method supported by a *account* resource.
6679/// It is not used directly, but through a [`AccountMethods`] instance.
6680///
6681/// # Example
6682///
6683/// Instantiate a resource method builder
6684///
6685/// ```test_harness,no_run
6686/// # extern crate hyper;
6687/// # extern crate hyper_rustls;
6688/// # extern crate google_tagmanager2 as tagmanager2;
6689/// use tagmanager2::api::Environment;
6690/// # async fn dox() {
6691/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6692///
6693/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6694/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6695/// #     secret,
6696/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6697/// # ).build().await.unwrap();
6698///
6699/// # let client = hyper_util::client::legacy::Client::builder(
6700/// #     hyper_util::rt::TokioExecutor::new()
6701/// # )
6702/// # .build(
6703/// #     hyper_rustls::HttpsConnectorBuilder::new()
6704/// #         .with_native_roots()
6705/// #         .unwrap()
6706/// #         .https_or_http()
6707/// #         .enable_http1()
6708/// #         .build()
6709/// # );
6710/// # let mut hub = TagManager::new(client, auth);
6711/// // As the method needs a request, you would usually fill it with the desired information
6712/// // into the respective structure. Some of the parts shown here might not be applicable !
6713/// // Values shown here are possibly random and not representative !
6714/// let mut req = Environment::default();
6715///
6716/// // You can configure optional parameters by calling the respective setters at will, and
6717/// // execute the final call using `doit()`.
6718/// // Values shown here are possibly random and not representative !
6719/// let result = hub.accounts().containers_environments_reauthorize(req, "path")
6720///              .doit().await;
6721/// # }
6722/// ```
6723pub struct AccountContainerEnvironmentReauthorizeCall<'a, C>
6724where
6725    C: 'a,
6726{
6727    hub: &'a TagManager<C>,
6728    _request: Environment,
6729    _path: String,
6730    _delegate: Option<&'a mut dyn common::Delegate>,
6731    _additional_params: HashMap<String, String>,
6732    _scopes: BTreeSet<String>,
6733}
6734
6735impl<'a, C> common::CallBuilder for AccountContainerEnvironmentReauthorizeCall<'a, C> {}
6736
6737impl<'a, C> AccountContainerEnvironmentReauthorizeCall<'a, C>
6738where
6739    C: common::Connector,
6740{
6741    /// Perform the operation you have build so far.
6742    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
6743        use std::borrow::Cow;
6744        use std::io::{Read, Seek};
6745
6746        use common::{url::Params, ToParts};
6747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6748
6749        let mut dd = common::DefaultDelegate;
6750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6751        dlg.begin(common::MethodInfo {
6752            id: "tagmanager.accounts.containers.environments.reauthorize",
6753            http_method: hyper::Method::POST,
6754        });
6755
6756        for &field in ["alt", "path"].iter() {
6757            if self._additional_params.contains_key(field) {
6758                dlg.finished(false);
6759                return Err(common::Error::FieldClash(field));
6760            }
6761        }
6762
6763        let mut params = Params::with_capacity(4 + self._additional_params.len());
6764        params.push("path", self._path);
6765
6766        params.extend(self._additional_params.iter());
6767
6768        params.push("alt", "json");
6769        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:reauthorize";
6770        if self._scopes.is_empty() {
6771            self._scopes.insert(Scope::Publish.as_ref().to_string());
6772        }
6773
6774        #[allow(clippy::single_element_loop)]
6775        for &(find_this, param_name) in [("{+path}", "path")].iter() {
6776            url = params.uri_replacement(url, param_name, find_this, true);
6777        }
6778        {
6779            let to_remove = ["path"];
6780            params.remove_params(&to_remove);
6781        }
6782
6783        let url = params.parse_with_url(&url);
6784
6785        let mut json_mime_type = mime::APPLICATION_JSON;
6786        let mut request_value_reader = {
6787            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6788            common::remove_json_null_values(&mut value);
6789            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6790            serde_json::to_writer(&mut dst, &value).unwrap();
6791            dst
6792        };
6793        let request_size = request_value_reader
6794            .seek(std::io::SeekFrom::End(0))
6795            .unwrap();
6796        request_value_reader
6797            .seek(std::io::SeekFrom::Start(0))
6798            .unwrap();
6799
6800        loop {
6801            let token = match self
6802                .hub
6803                .auth
6804                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6805                .await
6806            {
6807                Ok(token) => token,
6808                Err(e) => match dlg.token(e) {
6809                    Ok(token) => token,
6810                    Err(e) => {
6811                        dlg.finished(false);
6812                        return Err(common::Error::MissingToken(e));
6813                    }
6814                },
6815            };
6816            request_value_reader
6817                .seek(std::io::SeekFrom::Start(0))
6818                .unwrap();
6819            let mut req_result = {
6820                let client = &self.hub.client;
6821                dlg.pre_request();
6822                let mut req_builder = hyper::Request::builder()
6823                    .method(hyper::Method::POST)
6824                    .uri(url.as_str())
6825                    .header(USER_AGENT, self.hub._user_agent.clone());
6826
6827                if let Some(token) = token.as_ref() {
6828                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6829                }
6830
6831                let request = req_builder
6832                    .header(CONTENT_TYPE, json_mime_type.to_string())
6833                    .header(CONTENT_LENGTH, request_size as u64)
6834                    .body(common::to_body(
6835                        request_value_reader.get_ref().clone().into(),
6836                    ));
6837
6838                client.request(request.unwrap()).await
6839            };
6840
6841            match req_result {
6842                Err(err) => {
6843                    if let common::Retry::After(d) = dlg.http_error(&err) {
6844                        sleep(d).await;
6845                        continue;
6846                    }
6847                    dlg.finished(false);
6848                    return Err(common::Error::HttpError(err));
6849                }
6850                Ok(res) => {
6851                    let (mut parts, body) = res.into_parts();
6852                    let mut body = common::Body::new(body);
6853                    if !parts.status.is_success() {
6854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6855                        let error = serde_json::from_str(&common::to_string(&bytes));
6856                        let response = common::to_response(parts, bytes.into());
6857
6858                        if let common::Retry::After(d) =
6859                            dlg.http_failure(&response, error.as_ref().ok())
6860                        {
6861                            sleep(d).await;
6862                            continue;
6863                        }
6864
6865                        dlg.finished(false);
6866
6867                        return Err(match error {
6868                            Ok(value) => common::Error::BadRequest(value),
6869                            _ => common::Error::Failure(response),
6870                        });
6871                    }
6872                    let response = {
6873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6874                        let encoded = common::to_string(&bytes);
6875                        match serde_json::from_str(&encoded) {
6876                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6877                            Err(error) => {
6878                                dlg.response_json_decode_error(&encoded, &error);
6879                                return Err(common::Error::JsonDecodeError(
6880                                    encoded.to_string(),
6881                                    error,
6882                                ));
6883                            }
6884                        }
6885                    };
6886
6887                    dlg.finished(true);
6888                    return Ok(response);
6889                }
6890            }
6891        }
6892    }
6893
6894    ///
6895    /// Sets the *request* property to the given value.
6896    ///
6897    /// Even though the property as already been set when instantiating this call,
6898    /// we provide this method for API completeness.
6899    pub fn request(
6900        mut self,
6901        new_value: Environment,
6902    ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
6903        self._request = new_value;
6904        self
6905    }
6906    /// GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
6907    ///
6908    /// Sets the *path* path property to the given value.
6909    ///
6910    /// Even though the property as already been set when instantiating this call,
6911    /// we provide this method for API completeness.
6912    pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
6913        self._path = new_value.to_string();
6914        self
6915    }
6916    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6917    /// while executing the actual API request.
6918    ///
6919    /// ````text
6920    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6921    /// ````
6922    ///
6923    /// Sets the *delegate* property to the given value.
6924    pub fn delegate(
6925        mut self,
6926        new_value: &'a mut dyn common::Delegate,
6927    ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
6928        self._delegate = Some(new_value);
6929        self
6930    }
6931
6932    /// Set any additional parameter of the query string used in the request.
6933    /// It should be used to set parameters which are not yet available through their own
6934    /// setters.
6935    ///
6936    /// Please note that this method must not be used to set any of the known parameters
6937    /// which have their own setter method. If done anyway, the request will fail.
6938    ///
6939    /// # Additional Parameters
6940    ///
6941    /// * *$.xgafv* (query-string) - V1 error format.
6942    /// * *access_token* (query-string) - OAuth access token.
6943    /// * *alt* (query-string) - Data format for response.
6944    /// * *callback* (query-string) - JSONP
6945    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6946    /// * *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.
6947    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6948    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6949    /// * *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.
6950    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6951    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6952    pub fn param<T>(
6953        mut self,
6954        name: T,
6955        value: T,
6956    ) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
6957    where
6958        T: AsRef<str>,
6959    {
6960        self._additional_params
6961            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6962        self
6963    }
6964
6965    /// Identifies the authorization scope for the method you are building.
6966    ///
6967    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6968    /// [`Scope::Publish`].
6969    ///
6970    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6971    /// tokens for more than one scope.
6972    ///
6973    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6974    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6975    /// sufficient, a read-write scope will do as well.
6976    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
6977    where
6978        St: AsRef<str>,
6979    {
6980        self._scopes.insert(String::from(scope.as_ref()));
6981        self
6982    }
6983    /// Identifies the authorization scope(s) for the method you are building.
6984    ///
6985    /// See [`Self::add_scope()`] for details.
6986    pub fn add_scopes<I, St>(
6987        mut self,
6988        scopes: I,
6989    ) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
6990    where
6991        I: IntoIterator<Item = St>,
6992        St: AsRef<str>,
6993    {
6994        self._scopes
6995            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6996        self
6997    }
6998
6999    /// Removes all scopes, and no default scope will be used either.
7000    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7001    /// for details).
7002    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
7003        self._scopes.clear();
7004        self
7005    }
7006}
7007
7008/// Updates a GTM Environment.
7009///
7010/// A builder for the *containers.environments.update* method supported by a *account* resource.
7011/// It is not used directly, but through a [`AccountMethods`] instance.
7012///
7013/// # Example
7014///
7015/// Instantiate a resource method builder
7016///
7017/// ```test_harness,no_run
7018/// # extern crate hyper;
7019/// # extern crate hyper_rustls;
7020/// # extern crate google_tagmanager2 as tagmanager2;
7021/// use tagmanager2::api::Environment;
7022/// # async fn dox() {
7023/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7024///
7025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7027/// #     secret,
7028/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7029/// # ).build().await.unwrap();
7030///
7031/// # let client = hyper_util::client::legacy::Client::builder(
7032/// #     hyper_util::rt::TokioExecutor::new()
7033/// # )
7034/// # .build(
7035/// #     hyper_rustls::HttpsConnectorBuilder::new()
7036/// #         .with_native_roots()
7037/// #         .unwrap()
7038/// #         .https_or_http()
7039/// #         .enable_http1()
7040/// #         .build()
7041/// # );
7042/// # let mut hub = TagManager::new(client, auth);
7043/// // As the method needs a request, you would usually fill it with the desired information
7044/// // into the respective structure. Some of the parts shown here might not be applicable !
7045/// // Values shown here are possibly random and not representative !
7046/// let mut req = Environment::default();
7047///
7048/// // You can configure optional parameters by calling the respective setters at will, and
7049/// // execute the final call using `doit()`.
7050/// // Values shown here are possibly random and not representative !
7051/// let result = hub.accounts().containers_environments_update(req, "path")
7052///              .fingerprint("kasd")
7053///              .doit().await;
7054/// # }
7055/// ```
7056pub struct AccountContainerEnvironmentUpdateCall<'a, C>
7057where
7058    C: 'a,
7059{
7060    hub: &'a TagManager<C>,
7061    _request: Environment,
7062    _path: String,
7063    _fingerprint: Option<String>,
7064    _delegate: Option<&'a mut dyn common::Delegate>,
7065    _additional_params: HashMap<String, String>,
7066    _scopes: BTreeSet<String>,
7067}
7068
7069impl<'a, C> common::CallBuilder for AccountContainerEnvironmentUpdateCall<'a, C> {}
7070
7071impl<'a, C> AccountContainerEnvironmentUpdateCall<'a, C>
7072where
7073    C: common::Connector,
7074{
7075    /// Perform the operation you have build so far.
7076    pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
7077        use std::borrow::Cow;
7078        use std::io::{Read, Seek};
7079
7080        use common::{url::Params, ToParts};
7081        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7082
7083        let mut dd = common::DefaultDelegate;
7084        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7085        dlg.begin(common::MethodInfo {
7086            id: "tagmanager.accounts.containers.environments.update",
7087            http_method: hyper::Method::PUT,
7088        });
7089
7090        for &field in ["alt", "path", "fingerprint"].iter() {
7091            if self._additional_params.contains_key(field) {
7092                dlg.finished(false);
7093                return Err(common::Error::FieldClash(field));
7094            }
7095        }
7096
7097        let mut params = Params::with_capacity(5 + self._additional_params.len());
7098        params.push("path", self._path);
7099        if let Some(value) = self._fingerprint.as_ref() {
7100            params.push("fingerprint", value);
7101        }
7102
7103        params.extend(self._additional_params.iter());
7104
7105        params.push("alt", "json");
7106        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
7107        if self._scopes.is_empty() {
7108            self._scopes
7109                .insert(Scope::EditContainer.as_ref().to_string());
7110        }
7111
7112        #[allow(clippy::single_element_loop)]
7113        for &(find_this, param_name) in [("{+path}", "path")].iter() {
7114            url = params.uri_replacement(url, param_name, find_this, true);
7115        }
7116        {
7117            let to_remove = ["path"];
7118            params.remove_params(&to_remove);
7119        }
7120
7121        let url = params.parse_with_url(&url);
7122
7123        let mut json_mime_type = mime::APPLICATION_JSON;
7124        let mut request_value_reader = {
7125            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7126            common::remove_json_null_values(&mut value);
7127            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7128            serde_json::to_writer(&mut dst, &value).unwrap();
7129            dst
7130        };
7131        let request_size = request_value_reader
7132            .seek(std::io::SeekFrom::End(0))
7133            .unwrap();
7134        request_value_reader
7135            .seek(std::io::SeekFrom::Start(0))
7136            .unwrap();
7137
7138        loop {
7139            let token = match self
7140                .hub
7141                .auth
7142                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7143                .await
7144            {
7145                Ok(token) => token,
7146                Err(e) => match dlg.token(e) {
7147                    Ok(token) => token,
7148                    Err(e) => {
7149                        dlg.finished(false);
7150                        return Err(common::Error::MissingToken(e));
7151                    }
7152                },
7153            };
7154            request_value_reader
7155                .seek(std::io::SeekFrom::Start(0))
7156                .unwrap();
7157            let mut req_result = {
7158                let client = &self.hub.client;
7159                dlg.pre_request();
7160                let mut req_builder = hyper::Request::builder()
7161                    .method(hyper::Method::PUT)
7162                    .uri(url.as_str())
7163                    .header(USER_AGENT, self.hub._user_agent.clone());
7164
7165                if let Some(token) = token.as_ref() {
7166                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7167                }
7168
7169                let request = req_builder
7170                    .header(CONTENT_TYPE, json_mime_type.to_string())
7171                    .header(CONTENT_LENGTH, request_size as u64)
7172                    .body(common::to_body(
7173                        request_value_reader.get_ref().clone().into(),
7174                    ));
7175
7176                client.request(request.unwrap()).await
7177            };
7178
7179            match req_result {
7180                Err(err) => {
7181                    if let common::Retry::After(d) = dlg.http_error(&err) {
7182                        sleep(d).await;
7183                        continue;
7184                    }
7185                    dlg.finished(false);
7186                    return Err(common::Error::HttpError(err));
7187                }
7188                Ok(res) => {
7189                    let (mut parts, body) = res.into_parts();
7190                    let mut body = common::Body::new(body);
7191                    if !parts.status.is_success() {
7192                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7193                        let error = serde_json::from_str(&common::to_string(&bytes));
7194                        let response = common::to_response(parts, bytes.into());
7195
7196                        if let common::Retry::After(d) =
7197                            dlg.http_failure(&response, error.as_ref().ok())
7198                        {
7199                            sleep(d).await;
7200                            continue;
7201                        }
7202
7203                        dlg.finished(false);
7204
7205                        return Err(match error {
7206                            Ok(value) => common::Error::BadRequest(value),
7207                            _ => common::Error::Failure(response),
7208                        });
7209                    }
7210                    let response = {
7211                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7212                        let encoded = common::to_string(&bytes);
7213                        match serde_json::from_str(&encoded) {
7214                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7215                            Err(error) => {
7216                                dlg.response_json_decode_error(&encoded, &error);
7217                                return Err(common::Error::JsonDecodeError(
7218                                    encoded.to_string(),
7219                                    error,
7220                                ));
7221                            }
7222                        }
7223                    };
7224
7225                    dlg.finished(true);
7226                    return Ok(response);
7227                }
7228            }
7229        }
7230    }
7231
7232    ///
7233    /// Sets the *request* property to the given value.
7234    ///
7235    /// Even though the property as already been set when instantiating this call,
7236    /// we provide this method for API completeness.
7237    pub fn request(
7238        mut self,
7239        new_value: Environment,
7240    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7241        self._request = new_value;
7242        self
7243    }
7244    /// GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}
7245    ///
7246    /// Sets the *path* path property to the given value.
7247    ///
7248    /// Even though the property as already been set when instantiating this call,
7249    /// we provide this method for API completeness.
7250    pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7251        self._path = new_value.to_string();
7252        self
7253    }
7254    /// When provided, this fingerprint must match the fingerprint of the environment in storage.
7255    ///
7256    /// Sets the *fingerprint* query property to the given value.
7257    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7258        self._fingerprint = Some(new_value.to_string());
7259        self
7260    }
7261    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7262    /// while executing the actual API request.
7263    ///
7264    /// ````text
7265    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7266    /// ````
7267    ///
7268    /// Sets the *delegate* property to the given value.
7269    pub fn delegate(
7270        mut self,
7271        new_value: &'a mut dyn common::Delegate,
7272    ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7273        self._delegate = Some(new_value);
7274        self
7275    }
7276
7277    /// Set any additional parameter of the query string used in the request.
7278    /// It should be used to set parameters which are not yet available through their own
7279    /// setters.
7280    ///
7281    /// Please note that this method must not be used to set any of the known parameters
7282    /// which have their own setter method. If done anyway, the request will fail.
7283    ///
7284    /// # Additional Parameters
7285    ///
7286    /// * *$.xgafv* (query-string) - V1 error format.
7287    /// * *access_token* (query-string) - OAuth access token.
7288    /// * *alt* (query-string) - Data format for response.
7289    /// * *callback* (query-string) - JSONP
7290    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7291    /// * *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.
7292    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7293    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7294    /// * *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.
7295    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7296    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7297    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentUpdateCall<'a, C>
7298    where
7299        T: AsRef<str>,
7300    {
7301        self._additional_params
7302            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7303        self
7304    }
7305
7306    /// Identifies the authorization scope for the method you are building.
7307    ///
7308    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7309    /// [`Scope::EditContainer`].
7310    ///
7311    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7312    /// tokens for more than one scope.
7313    ///
7314    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7315    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7316    /// sufficient, a read-write scope will do as well.
7317    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentUpdateCall<'a, C>
7318    where
7319        St: AsRef<str>,
7320    {
7321        self._scopes.insert(String::from(scope.as_ref()));
7322        self
7323    }
7324    /// Identifies the authorization scope(s) for the method you are building.
7325    ///
7326    /// See [`Self::add_scope()`] for details.
7327    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentUpdateCall<'a, C>
7328    where
7329        I: IntoIterator<Item = St>,
7330        St: AsRef<str>,
7331    {
7332        self._scopes
7333            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7334        self
7335    }
7336
7337    /// Removes all scopes, and no default scope will be used either.
7338    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7339    /// for details).
7340    pub fn clear_scopes(mut self) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7341        self._scopes.clear();
7342        self
7343    }
7344}
7345
7346/// Gets the latest container version header
7347///
7348/// A builder for the *containers.version_headers.latest* method supported by a *account* resource.
7349/// It is not used directly, but through a [`AccountMethods`] instance.
7350///
7351/// # Example
7352///
7353/// Instantiate a resource method builder
7354///
7355/// ```test_harness,no_run
7356/// # extern crate hyper;
7357/// # extern crate hyper_rustls;
7358/// # extern crate google_tagmanager2 as tagmanager2;
7359/// # async fn dox() {
7360/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7361///
7362/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7363/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7364/// #     secret,
7365/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7366/// # ).build().await.unwrap();
7367///
7368/// # let client = hyper_util::client::legacy::Client::builder(
7369/// #     hyper_util::rt::TokioExecutor::new()
7370/// # )
7371/// # .build(
7372/// #     hyper_rustls::HttpsConnectorBuilder::new()
7373/// #         .with_native_roots()
7374/// #         .unwrap()
7375/// #         .https_or_http()
7376/// #         .enable_http1()
7377/// #         .build()
7378/// # );
7379/// # let mut hub = TagManager::new(client, auth);
7380/// // You can configure optional parameters by calling the respective setters at will, and
7381/// // execute the final call using `doit()`.
7382/// // Values shown here are possibly random and not representative !
7383/// let result = hub.accounts().containers_version_headers_latest("parent")
7384///              .doit().await;
7385/// # }
7386/// ```
7387pub struct AccountContainerVersionHeaderLatestCall<'a, C>
7388where
7389    C: 'a,
7390{
7391    hub: &'a TagManager<C>,
7392    _parent: String,
7393    _delegate: Option<&'a mut dyn common::Delegate>,
7394    _additional_params: HashMap<String, String>,
7395    _scopes: BTreeSet<String>,
7396}
7397
7398impl<'a, C> common::CallBuilder for AccountContainerVersionHeaderLatestCall<'a, C> {}
7399
7400impl<'a, C> AccountContainerVersionHeaderLatestCall<'a, C>
7401where
7402    C: common::Connector,
7403{
7404    /// Perform the operation you have build so far.
7405    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersionHeader)> {
7406        use std::borrow::Cow;
7407        use std::io::{Read, Seek};
7408
7409        use common::{url::Params, ToParts};
7410        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7411
7412        let mut dd = common::DefaultDelegate;
7413        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7414        dlg.begin(common::MethodInfo {
7415            id: "tagmanager.accounts.containers.version_headers.latest",
7416            http_method: hyper::Method::GET,
7417        });
7418
7419        for &field in ["alt", "parent"].iter() {
7420            if self._additional_params.contains_key(field) {
7421                dlg.finished(false);
7422                return Err(common::Error::FieldClash(field));
7423            }
7424        }
7425
7426        let mut params = Params::with_capacity(3 + self._additional_params.len());
7427        params.push("parent", self._parent);
7428
7429        params.extend(self._additional_params.iter());
7430
7431        params.push("alt", "json");
7432        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/version_headers:latest";
7433        if self._scopes.is_empty() {
7434            self._scopes.insert(Scope::Readonly.as_ref().to_string());
7435        }
7436
7437        #[allow(clippy::single_element_loop)]
7438        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7439            url = params.uri_replacement(url, param_name, find_this, true);
7440        }
7441        {
7442            let to_remove = ["parent"];
7443            params.remove_params(&to_remove);
7444        }
7445
7446        let url = params.parse_with_url(&url);
7447
7448        loop {
7449            let token = match self
7450                .hub
7451                .auth
7452                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7453                .await
7454            {
7455                Ok(token) => token,
7456                Err(e) => match dlg.token(e) {
7457                    Ok(token) => token,
7458                    Err(e) => {
7459                        dlg.finished(false);
7460                        return Err(common::Error::MissingToken(e));
7461                    }
7462                },
7463            };
7464            let mut req_result = {
7465                let client = &self.hub.client;
7466                dlg.pre_request();
7467                let mut req_builder = hyper::Request::builder()
7468                    .method(hyper::Method::GET)
7469                    .uri(url.as_str())
7470                    .header(USER_AGENT, self.hub._user_agent.clone());
7471
7472                if let Some(token) = token.as_ref() {
7473                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7474                }
7475
7476                let request = req_builder
7477                    .header(CONTENT_LENGTH, 0_u64)
7478                    .body(common::to_body::<String>(None));
7479
7480                client.request(request.unwrap()).await
7481            };
7482
7483            match req_result {
7484                Err(err) => {
7485                    if let common::Retry::After(d) = dlg.http_error(&err) {
7486                        sleep(d).await;
7487                        continue;
7488                    }
7489                    dlg.finished(false);
7490                    return Err(common::Error::HttpError(err));
7491                }
7492                Ok(res) => {
7493                    let (mut parts, body) = res.into_parts();
7494                    let mut body = common::Body::new(body);
7495                    if !parts.status.is_success() {
7496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7497                        let error = serde_json::from_str(&common::to_string(&bytes));
7498                        let response = common::to_response(parts, bytes.into());
7499
7500                        if let common::Retry::After(d) =
7501                            dlg.http_failure(&response, error.as_ref().ok())
7502                        {
7503                            sleep(d).await;
7504                            continue;
7505                        }
7506
7507                        dlg.finished(false);
7508
7509                        return Err(match error {
7510                            Ok(value) => common::Error::BadRequest(value),
7511                            _ => common::Error::Failure(response),
7512                        });
7513                    }
7514                    let response = {
7515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7516                        let encoded = common::to_string(&bytes);
7517                        match serde_json::from_str(&encoded) {
7518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7519                            Err(error) => {
7520                                dlg.response_json_decode_error(&encoded, &error);
7521                                return Err(common::Error::JsonDecodeError(
7522                                    encoded.to_string(),
7523                                    error,
7524                                ));
7525                            }
7526                        }
7527                    };
7528
7529                    dlg.finished(true);
7530                    return Ok(response);
7531                }
7532            }
7533        }
7534    }
7535
7536    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
7537    ///
7538    /// Sets the *parent* path property to the given value.
7539    ///
7540    /// Even though the property as already been set when instantiating this call,
7541    /// we provide this method for API completeness.
7542    pub fn parent(mut self, new_value: &str) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7543        self._parent = new_value.to_string();
7544        self
7545    }
7546    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7547    /// while executing the actual API request.
7548    ///
7549    /// ````text
7550    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7551    /// ````
7552    ///
7553    /// Sets the *delegate* property to the given value.
7554    pub fn delegate(
7555        mut self,
7556        new_value: &'a mut dyn common::Delegate,
7557    ) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7558        self._delegate = Some(new_value);
7559        self
7560    }
7561
7562    /// Set any additional parameter of the query string used in the request.
7563    /// It should be used to set parameters which are not yet available through their own
7564    /// setters.
7565    ///
7566    /// Please note that this method must not be used to set any of the known parameters
7567    /// which have their own setter method. If done anyway, the request will fail.
7568    ///
7569    /// # Additional Parameters
7570    ///
7571    /// * *$.xgafv* (query-string) - V1 error format.
7572    /// * *access_token* (query-string) - OAuth access token.
7573    /// * *alt* (query-string) - Data format for response.
7574    /// * *callback* (query-string) - JSONP
7575    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7576    /// * *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.
7577    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7578    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7579    /// * *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.
7580    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7581    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7582    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionHeaderLatestCall<'a, C>
7583    where
7584        T: AsRef<str>,
7585    {
7586        self._additional_params
7587            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7588        self
7589    }
7590
7591    /// Identifies the authorization scope for the method you are building.
7592    ///
7593    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7594    /// [`Scope::Readonly`].
7595    ///
7596    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7597    /// tokens for more than one scope.
7598    ///
7599    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7600    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7601    /// sufficient, a read-write scope will do as well.
7602    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionHeaderLatestCall<'a, C>
7603    where
7604        St: AsRef<str>,
7605    {
7606        self._scopes.insert(String::from(scope.as_ref()));
7607        self
7608    }
7609    /// Identifies the authorization scope(s) for the method you are building.
7610    ///
7611    /// See [`Self::add_scope()`] for details.
7612    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionHeaderLatestCall<'a, C>
7613    where
7614        I: IntoIterator<Item = St>,
7615        St: AsRef<str>,
7616    {
7617        self._scopes
7618            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7619        self
7620    }
7621
7622    /// Removes all scopes, and no default scope will be used either.
7623    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7624    /// for details).
7625    pub fn clear_scopes(mut self) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7626        self._scopes.clear();
7627        self
7628    }
7629}
7630
7631/// Lists all Container Versions of a GTM Container.
7632///
7633/// A builder for the *containers.version_headers.list* method supported by a *account* resource.
7634/// It is not used directly, but through a [`AccountMethods`] instance.
7635///
7636/// # Example
7637///
7638/// Instantiate a resource method builder
7639///
7640/// ```test_harness,no_run
7641/// # extern crate hyper;
7642/// # extern crate hyper_rustls;
7643/// # extern crate google_tagmanager2 as tagmanager2;
7644/// # async fn dox() {
7645/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7646///
7647/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7649/// #     secret,
7650/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7651/// # ).build().await.unwrap();
7652///
7653/// # let client = hyper_util::client::legacy::Client::builder(
7654/// #     hyper_util::rt::TokioExecutor::new()
7655/// # )
7656/// # .build(
7657/// #     hyper_rustls::HttpsConnectorBuilder::new()
7658/// #         .with_native_roots()
7659/// #         .unwrap()
7660/// #         .https_or_http()
7661/// #         .enable_http1()
7662/// #         .build()
7663/// # );
7664/// # let mut hub = TagManager::new(client, auth);
7665/// // You can configure optional parameters by calling the respective setters at will, and
7666/// // execute the final call using `doit()`.
7667/// // Values shown here are possibly random and not representative !
7668/// let result = hub.accounts().containers_version_headers_list("parent")
7669///              .page_token("et")
7670///              .include_deleted(true)
7671///              .doit().await;
7672/// # }
7673/// ```
7674pub struct AccountContainerVersionHeaderListCall<'a, C>
7675where
7676    C: 'a,
7677{
7678    hub: &'a TagManager<C>,
7679    _parent: String,
7680    _page_token: Option<String>,
7681    _include_deleted: Option<bool>,
7682    _delegate: Option<&'a mut dyn common::Delegate>,
7683    _additional_params: HashMap<String, String>,
7684    _scopes: BTreeSet<String>,
7685}
7686
7687impl<'a, C> common::CallBuilder for AccountContainerVersionHeaderListCall<'a, C> {}
7688
7689impl<'a, C> AccountContainerVersionHeaderListCall<'a, C>
7690where
7691    C: common::Connector,
7692{
7693    /// Perform the operation you have build so far.
7694    pub async fn doit(
7695        mut self,
7696    ) -> common::Result<(common::Response, ListContainerVersionsResponse)> {
7697        use std::borrow::Cow;
7698        use std::io::{Read, Seek};
7699
7700        use common::{url::Params, ToParts};
7701        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7702
7703        let mut dd = common::DefaultDelegate;
7704        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7705        dlg.begin(common::MethodInfo {
7706            id: "tagmanager.accounts.containers.version_headers.list",
7707            http_method: hyper::Method::GET,
7708        });
7709
7710        for &field in ["alt", "parent", "pageToken", "includeDeleted"].iter() {
7711            if self._additional_params.contains_key(field) {
7712                dlg.finished(false);
7713                return Err(common::Error::FieldClash(field));
7714            }
7715        }
7716
7717        let mut params = Params::with_capacity(5 + self._additional_params.len());
7718        params.push("parent", self._parent);
7719        if let Some(value) = self._page_token.as_ref() {
7720            params.push("pageToken", value);
7721        }
7722        if let Some(value) = self._include_deleted.as_ref() {
7723            params.push("includeDeleted", value.to_string());
7724        }
7725
7726        params.extend(self._additional_params.iter());
7727
7728        params.push("alt", "json");
7729        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/version_headers";
7730        if self._scopes.is_empty() {
7731            self._scopes.insert(Scope::Readonly.as_ref().to_string());
7732        }
7733
7734        #[allow(clippy::single_element_loop)]
7735        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7736            url = params.uri_replacement(url, param_name, find_this, true);
7737        }
7738        {
7739            let to_remove = ["parent"];
7740            params.remove_params(&to_remove);
7741        }
7742
7743        let url = params.parse_with_url(&url);
7744
7745        loop {
7746            let token = match self
7747                .hub
7748                .auth
7749                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7750                .await
7751            {
7752                Ok(token) => token,
7753                Err(e) => match dlg.token(e) {
7754                    Ok(token) => token,
7755                    Err(e) => {
7756                        dlg.finished(false);
7757                        return Err(common::Error::MissingToken(e));
7758                    }
7759                },
7760            };
7761            let mut req_result = {
7762                let client = &self.hub.client;
7763                dlg.pre_request();
7764                let mut req_builder = hyper::Request::builder()
7765                    .method(hyper::Method::GET)
7766                    .uri(url.as_str())
7767                    .header(USER_AGENT, self.hub._user_agent.clone());
7768
7769                if let Some(token) = token.as_ref() {
7770                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7771                }
7772
7773                let request = req_builder
7774                    .header(CONTENT_LENGTH, 0_u64)
7775                    .body(common::to_body::<String>(None));
7776
7777                client.request(request.unwrap()).await
7778            };
7779
7780            match req_result {
7781                Err(err) => {
7782                    if let common::Retry::After(d) = dlg.http_error(&err) {
7783                        sleep(d).await;
7784                        continue;
7785                    }
7786                    dlg.finished(false);
7787                    return Err(common::Error::HttpError(err));
7788                }
7789                Ok(res) => {
7790                    let (mut parts, body) = res.into_parts();
7791                    let mut body = common::Body::new(body);
7792                    if !parts.status.is_success() {
7793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7794                        let error = serde_json::from_str(&common::to_string(&bytes));
7795                        let response = common::to_response(parts, bytes.into());
7796
7797                        if let common::Retry::After(d) =
7798                            dlg.http_failure(&response, error.as_ref().ok())
7799                        {
7800                            sleep(d).await;
7801                            continue;
7802                        }
7803
7804                        dlg.finished(false);
7805
7806                        return Err(match error {
7807                            Ok(value) => common::Error::BadRequest(value),
7808                            _ => common::Error::Failure(response),
7809                        });
7810                    }
7811                    let response = {
7812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7813                        let encoded = common::to_string(&bytes);
7814                        match serde_json::from_str(&encoded) {
7815                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7816                            Err(error) => {
7817                                dlg.response_json_decode_error(&encoded, &error);
7818                                return Err(common::Error::JsonDecodeError(
7819                                    encoded.to_string(),
7820                                    error,
7821                                ));
7822                            }
7823                        }
7824                    };
7825
7826                    dlg.finished(true);
7827                    return Ok(response);
7828                }
7829            }
7830        }
7831    }
7832
7833    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
7834    ///
7835    /// Sets the *parent* path property to the given value.
7836    ///
7837    /// Even though the property as already been set when instantiating this call,
7838    /// we provide this method for API completeness.
7839    pub fn parent(mut self, new_value: &str) -> AccountContainerVersionHeaderListCall<'a, C> {
7840        self._parent = new_value.to_string();
7841        self
7842    }
7843    /// Continuation token for fetching the next page of results.
7844    ///
7845    /// Sets the *page token* query property to the given value.
7846    pub fn page_token(mut self, new_value: &str) -> AccountContainerVersionHeaderListCall<'a, C> {
7847        self._page_token = Some(new_value.to_string());
7848        self
7849    }
7850    /// Also retrieve deleted (archived) versions when true.
7851    ///
7852    /// Sets the *include deleted* query property to the given value.
7853    pub fn include_deleted(
7854        mut self,
7855        new_value: bool,
7856    ) -> AccountContainerVersionHeaderListCall<'a, C> {
7857        self._include_deleted = Some(new_value);
7858        self
7859    }
7860    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7861    /// while executing the actual API request.
7862    ///
7863    /// ````text
7864    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7865    /// ````
7866    ///
7867    /// Sets the *delegate* property to the given value.
7868    pub fn delegate(
7869        mut self,
7870        new_value: &'a mut dyn common::Delegate,
7871    ) -> AccountContainerVersionHeaderListCall<'a, C> {
7872        self._delegate = Some(new_value);
7873        self
7874    }
7875
7876    /// Set any additional parameter of the query string used in the request.
7877    /// It should be used to set parameters which are not yet available through their own
7878    /// setters.
7879    ///
7880    /// Please note that this method must not be used to set any of the known parameters
7881    /// which have their own setter method. If done anyway, the request will fail.
7882    ///
7883    /// # Additional Parameters
7884    ///
7885    /// * *$.xgafv* (query-string) - V1 error format.
7886    /// * *access_token* (query-string) - OAuth access token.
7887    /// * *alt* (query-string) - Data format for response.
7888    /// * *callback* (query-string) - JSONP
7889    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7890    /// * *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.
7891    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7892    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7893    /// * *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.
7894    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7895    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7896    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionHeaderListCall<'a, C>
7897    where
7898        T: AsRef<str>,
7899    {
7900        self._additional_params
7901            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7902        self
7903    }
7904
7905    /// Identifies the authorization scope for the method you are building.
7906    ///
7907    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7908    /// [`Scope::Readonly`].
7909    ///
7910    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7911    /// tokens for more than one scope.
7912    ///
7913    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7914    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7915    /// sufficient, a read-write scope will do as well.
7916    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionHeaderListCall<'a, C>
7917    where
7918        St: AsRef<str>,
7919    {
7920        self._scopes.insert(String::from(scope.as_ref()));
7921        self
7922    }
7923    /// Identifies the authorization scope(s) for the method you are building.
7924    ///
7925    /// See [`Self::add_scope()`] for details.
7926    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionHeaderListCall<'a, C>
7927    where
7928        I: IntoIterator<Item = St>,
7929        St: AsRef<str>,
7930    {
7931        self._scopes
7932            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7933        self
7934    }
7935
7936    /// Removes all scopes, and no default scope will be used either.
7937    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7938    /// for details).
7939    pub fn clear_scopes(mut self) -> AccountContainerVersionHeaderListCall<'a, C> {
7940        self._scopes.clear();
7941        self
7942    }
7943}
7944
7945/// Deletes a Container Version.
7946///
7947/// A builder for the *containers.versions.delete* method supported by a *account* resource.
7948/// It is not used directly, but through a [`AccountMethods`] instance.
7949///
7950/// # Example
7951///
7952/// Instantiate a resource method builder
7953///
7954/// ```test_harness,no_run
7955/// # extern crate hyper;
7956/// # extern crate hyper_rustls;
7957/// # extern crate google_tagmanager2 as tagmanager2;
7958/// # async fn dox() {
7959/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7960///
7961/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7962/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7963/// #     secret,
7964/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7965/// # ).build().await.unwrap();
7966///
7967/// # let client = hyper_util::client::legacy::Client::builder(
7968/// #     hyper_util::rt::TokioExecutor::new()
7969/// # )
7970/// # .build(
7971/// #     hyper_rustls::HttpsConnectorBuilder::new()
7972/// #         .with_native_roots()
7973/// #         .unwrap()
7974/// #         .https_or_http()
7975/// #         .enable_http1()
7976/// #         .build()
7977/// # );
7978/// # let mut hub = TagManager::new(client, auth);
7979/// // You can configure optional parameters by calling the respective setters at will, and
7980/// // execute the final call using `doit()`.
7981/// // Values shown here are possibly random and not representative !
7982/// let result = hub.accounts().containers_versions_delete("path")
7983///              .doit().await;
7984/// # }
7985/// ```
7986pub struct AccountContainerVersionDeleteCall<'a, C>
7987where
7988    C: 'a,
7989{
7990    hub: &'a TagManager<C>,
7991    _path: String,
7992    _delegate: Option<&'a mut dyn common::Delegate>,
7993    _additional_params: HashMap<String, String>,
7994    _scopes: BTreeSet<String>,
7995}
7996
7997impl<'a, C> common::CallBuilder for AccountContainerVersionDeleteCall<'a, C> {}
7998
7999impl<'a, C> AccountContainerVersionDeleteCall<'a, C>
8000where
8001    C: common::Connector,
8002{
8003    /// Perform the operation you have build so far.
8004    pub async fn doit(mut self) -> common::Result<common::Response> {
8005        use std::borrow::Cow;
8006        use std::io::{Read, Seek};
8007
8008        use common::{url::Params, ToParts};
8009        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8010
8011        let mut dd = common::DefaultDelegate;
8012        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8013        dlg.begin(common::MethodInfo {
8014            id: "tagmanager.accounts.containers.versions.delete",
8015            http_method: hyper::Method::DELETE,
8016        });
8017
8018        for &field in ["path"].iter() {
8019            if self._additional_params.contains_key(field) {
8020                dlg.finished(false);
8021                return Err(common::Error::FieldClash(field));
8022            }
8023        }
8024
8025        let mut params = Params::with_capacity(2 + self._additional_params.len());
8026        params.push("path", self._path);
8027
8028        params.extend(self._additional_params.iter());
8029
8030        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
8031        if self._scopes.is_empty() {
8032            self._scopes
8033                .insert(Scope::EditContainerversion.as_ref().to_string());
8034        }
8035
8036        #[allow(clippy::single_element_loop)]
8037        for &(find_this, param_name) in [("{+path}", "path")].iter() {
8038            url = params.uri_replacement(url, param_name, find_this, true);
8039        }
8040        {
8041            let to_remove = ["path"];
8042            params.remove_params(&to_remove);
8043        }
8044
8045        let url = params.parse_with_url(&url);
8046
8047        loop {
8048            let token = match self
8049                .hub
8050                .auth
8051                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8052                .await
8053            {
8054                Ok(token) => token,
8055                Err(e) => match dlg.token(e) {
8056                    Ok(token) => token,
8057                    Err(e) => {
8058                        dlg.finished(false);
8059                        return Err(common::Error::MissingToken(e));
8060                    }
8061                },
8062            };
8063            let mut req_result = {
8064                let client = &self.hub.client;
8065                dlg.pre_request();
8066                let mut req_builder = hyper::Request::builder()
8067                    .method(hyper::Method::DELETE)
8068                    .uri(url.as_str())
8069                    .header(USER_AGENT, self.hub._user_agent.clone());
8070
8071                if let Some(token) = token.as_ref() {
8072                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8073                }
8074
8075                let request = req_builder
8076                    .header(CONTENT_LENGTH, 0_u64)
8077                    .body(common::to_body::<String>(None));
8078
8079                client.request(request.unwrap()).await
8080            };
8081
8082            match req_result {
8083                Err(err) => {
8084                    if let common::Retry::After(d) = dlg.http_error(&err) {
8085                        sleep(d).await;
8086                        continue;
8087                    }
8088                    dlg.finished(false);
8089                    return Err(common::Error::HttpError(err));
8090                }
8091                Ok(res) => {
8092                    let (mut parts, body) = res.into_parts();
8093                    let mut body = common::Body::new(body);
8094                    if !parts.status.is_success() {
8095                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8096                        let error = serde_json::from_str(&common::to_string(&bytes));
8097                        let response = common::to_response(parts, bytes.into());
8098
8099                        if let common::Retry::After(d) =
8100                            dlg.http_failure(&response, error.as_ref().ok())
8101                        {
8102                            sleep(d).await;
8103                            continue;
8104                        }
8105
8106                        dlg.finished(false);
8107
8108                        return Err(match error {
8109                            Ok(value) => common::Error::BadRequest(value),
8110                            _ => common::Error::Failure(response),
8111                        });
8112                    }
8113                    let response = common::Response::from_parts(parts, body);
8114
8115                    dlg.finished(true);
8116                    return Ok(response);
8117                }
8118            }
8119        }
8120    }
8121
8122    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
8123    ///
8124    /// Sets the *path* path property to the given value.
8125    ///
8126    /// Even though the property as already been set when instantiating this call,
8127    /// we provide this method for API completeness.
8128    pub fn path(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C> {
8129        self._path = new_value.to_string();
8130        self
8131    }
8132    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8133    /// while executing the actual API request.
8134    ///
8135    /// ````text
8136    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8137    /// ````
8138    ///
8139    /// Sets the *delegate* property to the given value.
8140    pub fn delegate(
8141        mut self,
8142        new_value: &'a mut dyn common::Delegate,
8143    ) -> AccountContainerVersionDeleteCall<'a, C> {
8144        self._delegate = Some(new_value);
8145        self
8146    }
8147
8148    /// Set any additional parameter of the query string used in the request.
8149    /// It should be used to set parameters which are not yet available through their own
8150    /// setters.
8151    ///
8152    /// Please note that this method must not be used to set any of the known parameters
8153    /// which have their own setter method. If done anyway, the request will fail.
8154    ///
8155    /// # Additional Parameters
8156    ///
8157    /// * *$.xgafv* (query-string) - V1 error format.
8158    /// * *access_token* (query-string) - OAuth access token.
8159    /// * *alt* (query-string) - Data format for response.
8160    /// * *callback* (query-string) - JSONP
8161    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8162    /// * *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.
8163    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8164    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8165    /// * *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.
8166    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8167    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8168    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionDeleteCall<'a, C>
8169    where
8170        T: AsRef<str>,
8171    {
8172        self._additional_params
8173            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8174        self
8175    }
8176
8177    /// Identifies the authorization scope for the method you are building.
8178    ///
8179    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8180    /// [`Scope::EditContainerversion`].
8181    ///
8182    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8183    /// tokens for more than one scope.
8184    ///
8185    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8186    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8187    /// sufficient, a read-write scope will do as well.
8188    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionDeleteCall<'a, C>
8189    where
8190        St: AsRef<str>,
8191    {
8192        self._scopes.insert(String::from(scope.as_ref()));
8193        self
8194    }
8195    /// Identifies the authorization scope(s) for the method you are building.
8196    ///
8197    /// See [`Self::add_scope()`] for details.
8198    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionDeleteCall<'a, C>
8199    where
8200        I: IntoIterator<Item = St>,
8201        St: AsRef<str>,
8202    {
8203        self._scopes
8204            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8205        self
8206    }
8207
8208    /// Removes all scopes, and no default scope will be used either.
8209    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8210    /// for details).
8211    pub fn clear_scopes(mut self) -> AccountContainerVersionDeleteCall<'a, C> {
8212        self._scopes.clear();
8213        self
8214    }
8215}
8216
8217/// Gets a Container Version.
8218///
8219/// A builder for the *containers.versions.get* method supported by a *account* resource.
8220/// It is not used directly, but through a [`AccountMethods`] instance.
8221///
8222/// # Example
8223///
8224/// Instantiate a resource method builder
8225///
8226/// ```test_harness,no_run
8227/// # extern crate hyper;
8228/// # extern crate hyper_rustls;
8229/// # extern crate google_tagmanager2 as tagmanager2;
8230/// # async fn dox() {
8231/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8232///
8233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8234/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8235/// #     secret,
8236/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8237/// # ).build().await.unwrap();
8238///
8239/// # let client = hyper_util::client::legacy::Client::builder(
8240/// #     hyper_util::rt::TokioExecutor::new()
8241/// # )
8242/// # .build(
8243/// #     hyper_rustls::HttpsConnectorBuilder::new()
8244/// #         .with_native_roots()
8245/// #         .unwrap()
8246/// #         .https_or_http()
8247/// #         .enable_http1()
8248/// #         .build()
8249/// # );
8250/// # let mut hub = TagManager::new(client, auth);
8251/// // You can configure optional parameters by calling the respective setters at will, and
8252/// // execute the final call using `doit()`.
8253/// // Values shown here are possibly random and not representative !
8254/// let result = hub.accounts().containers_versions_get("path")
8255///              .container_version_id("sed")
8256///              .doit().await;
8257/// # }
8258/// ```
8259pub struct AccountContainerVersionGetCall<'a, C>
8260where
8261    C: 'a,
8262{
8263    hub: &'a TagManager<C>,
8264    _path: String,
8265    _container_version_id: Option<String>,
8266    _delegate: Option<&'a mut dyn common::Delegate>,
8267    _additional_params: HashMap<String, String>,
8268    _scopes: BTreeSet<String>,
8269}
8270
8271impl<'a, C> common::CallBuilder for AccountContainerVersionGetCall<'a, C> {}
8272
8273impl<'a, C> AccountContainerVersionGetCall<'a, C>
8274where
8275    C: common::Connector,
8276{
8277    /// Perform the operation you have build so far.
8278    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
8279        use std::borrow::Cow;
8280        use std::io::{Read, Seek};
8281
8282        use common::{url::Params, ToParts};
8283        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8284
8285        let mut dd = common::DefaultDelegate;
8286        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8287        dlg.begin(common::MethodInfo {
8288            id: "tagmanager.accounts.containers.versions.get",
8289            http_method: hyper::Method::GET,
8290        });
8291
8292        for &field in ["alt", "path", "containerVersionId"].iter() {
8293            if self._additional_params.contains_key(field) {
8294                dlg.finished(false);
8295                return Err(common::Error::FieldClash(field));
8296            }
8297        }
8298
8299        let mut params = Params::with_capacity(4 + self._additional_params.len());
8300        params.push("path", self._path);
8301        if let Some(value) = self._container_version_id.as_ref() {
8302            params.push("containerVersionId", value);
8303        }
8304
8305        params.extend(self._additional_params.iter());
8306
8307        params.push("alt", "json");
8308        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
8309        if self._scopes.is_empty() {
8310            self._scopes.insert(Scope::Readonly.as_ref().to_string());
8311        }
8312
8313        #[allow(clippy::single_element_loop)]
8314        for &(find_this, param_name) in [("{+path}", "path")].iter() {
8315            url = params.uri_replacement(url, param_name, find_this, true);
8316        }
8317        {
8318            let to_remove = ["path"];
8319            params.remove_params(&to_remove);
8320        }
8321
8322        let url = params.parse_with_url(&url);
8323
8324        loop {
8325            let token = match self
8326                .hub
8327                .auth
8328                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8329                .await
8330            {
8331                Ok(token) => token,
8332                Err(e) => match dlg.token(e) {
8333                    Ok(token) => token,
8334                    Err(e) => {
8335                        dlg.finished(false);
8336                        return Err(common::Error::MissingToken(e));
8337                    }
8338                },
8339            };
8340            let mut req_result = {
8341                let client = &self.hub.client;
8342                dlg.pre_request();
8343                let mut req_builder = hyper::Request::builder()
8344                    .method(hyper::Method::GET)
8345                    .uri(url.as_str())
8346                    .header(USER_AGENT, self.hub._user_agent.clone());
8347
8348                if let Some(token) = token.as_ref() {
8349                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8350                }
8351
8352                let request = req_builder
8353                    .header(CONTENT_LENGTH, 0_u64)
8354                    .body(common::to_body::<String>(None));
8355
8356                client.request(request.unwrap()).await
8357            };
8358
8359            match req_result {
8360                Err(err) => {
8361                    if let common::Retry::After(d) = dlg.http_error(&err) {
8362                        sleep(d).await;
8363                        continue;
8364                    }
8365                    dlg.finished(false);
8366                    return Err(common::Error::HttpError(err));
8367                }
8368                Ok(res) => {
8369                    let (mut parts, body) = res.into_parts();
8370                    let mut body = common::Body::new(body);
8371                    if !parts.status.is_success() {
8372                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8373                        let error = serde_json::from_str(&common::to_string(&bytes));
8374                        let response = common::to_response(parts, bytes.into());
8375
8376                        if let common::Retry::After(d) =
8377                            dlg.http_failure(&response, error.as_ref().ok())
8378                        {
8379                            sleep(d).await;
8380                            continue;
8381                        }
8382
8383                        dlg.finished(false);
8384
8385                        return Err(match error {
8386                            Ok(value) => common::Error::BadRequest(value),
8387                            _ => common::Error::Failure(response),
8388                        });
8389                    }
8390                    let response = {
8391                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8392                        let encoded = common::to_string(&bytes);
8393                        match serde_json::from_str(&encoded) {
8394                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8395                            Err(error) => {
8396                                dlg.response_json_decode_error(&encoded, &error);
8397                                return Err(common::Error::JsonDecodeError(
8398                                    encoded.to_string(),
8399                                    error,
8400                                ));
8401                            }
8402                        }
8403                    };
8404
8405                    dlg.finished(true);
8406                    return Ok(response);
8407                }
8408            }
8409        }
8410    }
8411
8412    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
8413    ///
8414    /// Sets the *path* path property to the given value.
8415    ///
8416    /// Even though the property as already been set when instantiating this call,
8417    /// we provide this method for API completeness.
8418    pub fn path(mut self, new_value: &str) -> AccountContainerVersionGetCall<'a, C> {
8419        self._path = new_value.to_string();
8420        self
8421    }
8422    /// The GTM ContainerVersion ID. Specify published to retrieve the currently published version.
8423    ///
8424    /// Sets the *container version id* query property to the given value.
8425    pub fn container_version_id(
8426        mut self,
8427        new_value: &str,
8428    ) -> AccountContainerVersionGetCall<'a, C> {
8429        self._container_version_id = Some(new_value.to_string());
8430        self
8431    }
8432    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8433    /// while executing the actual API request.
8434    ///
8435    /// ````text
8436    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8437    /// ````
8438    ///
8439    /// Sets the *delegate* property to the given value.
8440    pub fn delegate(
8441        mut self,
8442        new_value: &'a mut dyn common::Delegate,
8443    ) -> AccountContainerVersionGetCall<'a, C> {
8444        self._delegate = Some(new_value);
8445        self
8446    }
8447
8448    /// Set any additional parameter of the query string used in the request.
8449    /// It should be used to set parameters which are not yet available through their own
8450    /// setters.
8451    ///
8452    /// Please note that this method must not be used to set any of the known parameters
8453    /// which have their own setter method. If done anyway, the request will fail.
8454    ///
8455    /// # Additional Parameters
8456    ///
8457    /// * *$.xgafv* (query-string) - V1 error format.
8458    /// * *access_token* (query-string) - OAuth access token.
8459    /// * *alt* (query-string) - Data format for response.
8460    /// * *callback* (query-string) - JSONP
8461    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8462    /// * *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.
8463    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8464    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8465    /// * *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.
8466    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8467    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8468    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionGetCall<'a, C>
8469    where
8470        T: AsRef<str>,
8471    {
8472        self._additional_params
8473            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8474        self
8475    }
8476
8477    /// Identifies the authorization scope for the method you are building.
8478    ///
8479    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8480    /// [`Scope::Readonly`].
8481    ///
8482    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8483    /// tokens for more than one scope.
8484    ///
8485    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8486    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8487    /// sufficient, a read-write scope will do as well.
8488    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionGetCall<'a, C>
8489    where
8490        St: AsRef<str>,
8491    {
8492        self._scopes.insert(String::from(scope.as_ref()));
8493        self
8494    }
8495    /// Identifies the authorization scope(s) for the method you are building.
8496    ///
8497    /// See [`Self::add_scope()`] for details.
8498    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionGetCall<'a, C>
8499    where
8500        I: IntoIterator<Item = St>,
8501        St: AsRef<str>,
8502    {
8503        self._scopes
8504            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8505        self
8506    }
8507
8508    /// Removes all scopes, and no default scope will be used either.
8509    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8510    /// for details).
8511    pub fn clear_scopes(mut self) -> AccountContainerVersionGetCall<'a, C> {
8512        self._scopes.clear();
8513        self
8514    }
8515}
8516
8517/// Gets the live (i.e. published) container version
8518///
8519/// A builder for the *containers.versions.live* method supported by a *account* resource.
8520/// It is not used directly, but through a [`AccountMethods`] instance.
8521///
8522/// # Example
8523///
8524/// Instantiate a resource method builder
8525///
8526/// ```test_harness,no_run
8527/// # extern crate hyper;
8528/// # extern crate hyper_rustls;
8529/// # extern crate google_tagmanager2 as tagmanager2;
8530/// # async fn dox() {
8531/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8532///
8533/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8534/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8535/// #     secret,
8536/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8537/// # ).build().await.unwrap();
8538///
8539/// # let client = hyper_util::client::legacy::Client::builder(
8540/// #     hyper_util::rt::TokioExecutor::new()
8541/// # )
8542/// # .build(
8543/// #     hyper_rustls::HttpsConnectorBuilder::new()
8544/// #         .with_native_roots()
8545/// #         .unwrap()
8546/// #         .https_or_http()
8547/// #         .enable_http1()
8548/// #         .build()
8549/// # );
8550/// # let mut hub = TagManager::new(client, auth);
8551/// // You can configure optional parameters by calling the respective setters at will, and
8552/// // execute the final call using `doit()`.
8553/// // Values shown here are possibly random and not representative !
8554/// let result = hub.accounts().containers_versions_live("parent")
8555///              .doit().await;
8556/// # }
8557/// ```
8558pub struct AccountContainerVersionLiveCall<'a, C>
8559where
8560    C: 'a,
8561{
8562    hub: &'a TagManager<C>,
8563    _parent: String,
8564    _delegate: Option<&'a mut dyn common::Delegate>,
8565    _additional_params: HashMap<String, String>,
8566    _scopes: BTreeSet<String>,
8567}
8568
8569impl<'a, C> common::CallBuilder for AccountContainerVersionLiveCall<'a, C> {}
8570
8571impl<'a, C> AccountContainerVersionLiveCall<'a, C>
8572where
8573    C: common::Connector,
8574{
8575    /// Perform the operation you have build so far.
8576    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
8577        use std::borrow::Cow;
8578        use std::io::{Read, Seek};
8579
8580        use common::{url::Params, ToParts};
8581        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8582
8583        let mut dd = common::DefaultDelegate;
8584        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8585        dlg.begin(common::MethodInfo {
8586            id: "tagmanager.accounts.containers.versions.live",
8587            http_method: hyper::Method::GET,
8588        });
8589
8590        for &field in ["alt", "parent"].iter() {
8591            if self._additional_params.contains_key(field) {
8592                dlg.finished(false);
8593                return Err(common::Error::FieldClash(field));
8594            }
8595        }
8596
8597        let mut params = Params::with_capacity(3 + self._additional_params.len());
8598        params.push("parent", self._parent);
8599
8600        params.extend(self._additional_params.iter());
8601
8602        params.push("alt", "json");
8603        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/versions:live";
8604        if self._scopes.is_empty() {
8605            self._scopes.insert(Scope::Readonly.as_ref().to_string());
8606        }
8607
8608        #[allow(clippy::single_element_loop)]
8609        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8610            url = params.uri_replacement(url, param_name, find_this, true);
8611        }
8612        {
8613            let to_remove = ["parent"];
8614            params.remove_params(&to_remove);
8615        }
8616
8617        let url = params.parse_with_url(&url);
8618
8619        loop {
8620            let token = match self
8621                .hub
8622                .auth
8623                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8624                .await
8625            {
8626                Ok(token) => token,
8627                Err(e) => match dlg.token(e) {
8628                    Ok(token) => token,
8629                    Err(e) => {
8630                        dlg.finished(false);
8631                        return Err(common::Error::MissingToken(e));
8632                    }
8633                },
8634            };
8635            let mut req_result = {
8636                let client = &self.hub.client;
8637                dlg.pre_request();
8638                let mut req_builder = hyper::Request::builder()
8639                    .method(hyper::Method::GET)
8640                    .uri(url.as_str())
8641                    .header(USER_AGENT, self.hub._user_agent.clone());
8642
8643                if let Some(token) = token.as_ref() {
8644                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8645                }
8646
8647                let request = req_builder
8648                    .header(CONTENT_LENGTH, 0_u64)
8649                    .body(common::to_body::<String>(None));
8650
8651                client.request(request.unwrap()).await
8652            };
8653
8654            match req_result {
8655                Err(err) => {
8656                    if let common::Retry::After(d) = dlg.http_error(&err) {
8657                        sleep(d).await;
8658                        continue;
8659                    }
8660                    dlg.finished(false);
8661                    return Err(common::Error::HttpError(err));
8662                }
8663                Ok(res) => {
8664                    let (mut parts, body) = res.into_parts();
8665                    let mut body = common::Body::new(body);
8666                    if !parts.status.is_success() {
8667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8668                        let error = serde_json::from_str(&common::to_string(&bytes));
8669                        let response = common::to_response(parts, bytes.into());
8670
8671                        if let common::Retry::After(d) =
8672                            dlg.http_failure(&response, error.as_ref().ok())
8673                        {
8674                            sleep(d).await;
8675                            continue;
8676                        }
8677
8678                        dlg.finished(false);
8679
8680                        return Err(match error {
8681                            Ok(value) => common::Error::BadRequest(value),
8682                            _ => common::Error::Failure(response),
8683                        });
8684                    }
8685                    let response = {
8686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8687                        let encoded = common::to_string(&bytes);
8688                        match serde_json::from_str(&encoded) {
8689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8690                            Err(error) => {
8691                                dlg.response_json_decode_error(&encoded, &error);
8692                                return Err(common::Error::JsonDecodeError(
8693                                    encoded.to_string(),
8694                                    error,
8695                                ));
8696                            }
8697                        }
8698                    };
8699
8700                    dlg.finished(true);
8701                    return Ok(response);
8702                }
8703            }
8704        }
8705    }
8706
8707    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
8708    ///
8709    /// Sets the *parent* path property to the given value.
8710    ///
8711    /// Even though the property as already been set when instantiating this call,
8712    /// we provide this method for API completeness.
8713    pub fn parent(mut self, new_value: &str) -> AccountContainerVersionLiveCall<'a, C> {
8714        self._parent = new_value.to_string();
8715        self
8716    }
8717    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8718    /// while executing the actual API request.
8719    ///
8720    /// ````text
8721    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8722    /// ````
8723    ///
8724    /// Sets the *delegate* property to the given value.
8725    pub fn delegate(
8726        mut self,
8727        new_value: &'a mut dyn common::Delegate,
8728    ) -> AccountContainerVersionLiveCall<'a, C> {
8729        self._delegate = Some(new_value);
8730        self
8731    }
8732
8733    /// Set any additional parameter of the query string used in the request.
8734    /// It should be used to set parameters which are not yet available through their own
8735    /// setters.
8736    ///
8737    /// Please note that this method must not be used to set any of the known parameters
8738    /// which have their own setter method. If done anyway, the request will fail.
8739    ///
8740    /// # Additional Parameters
8741    ///
8742    /// * *$.xgafv* (query-string) - V1 error format.
8743    /// * *access_token* (query-string) - OAuth access token.
8744    /// * *alt* (query-string) - Data format for response.
8745    /// * *callback* (query-string) - JSONP
8746    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8747    /// * *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.
8748    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8749    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8750    /// * *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.
8751    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8752    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8753    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionLiveCall<'a, C>
8754    where
8755        T: AsRef<str>,
8756    {
8757        self._additional_params
8758            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8759        self
8760    }
8761
8762    /// Identifies the authorization scope for the method you are building.
8763    ///
8764    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8765    /// [`Scope::Readonly`].
8766    ///
8767    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8768    /// tokens for more than one scope.
8769    ///
8770    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8771    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8772    /// sufficient, a read-write scope will do as well.
8773    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionLiveCall<'a, C>
8774    where
8775        St: AsRef<str>,
8776    {
8777        self._scopes.insert(String::from(scope.as_ref()));
8778        self
8779    }
8780    /// Identifies the authorization scope(s) for the method you are building.
8781    ///
8782    /// See [`Self::add_scope()`] for details.
8783    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionLiveCall<'a, C>
8784    where
8785        I: IntoIterator<Item = St>,
8786        St: AsRef<str>,
8787    {
8788        self._scopes
8789            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8790        self
8791    }
8792
8793    /// Removes all scopes, and no default scope will be used either.
8794    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8795    /// for details).
8796    pub fn clear_scopes(mut self) -> AccountContainerVersionLiveCall<'a, C> {
8797        self._scopes.clear();
8798        self
8799    }
8800}
8801
8802/// Publishes a Container Version.
8803///
8804/// A builder for the *containers.versions.publish* method supported by a *account* resource.
8805/// It is not used directly, but through a [`AccountMethods`] instance.
8806///
8807/// # Example
8808///
8809/// Instantiate a resource method builder
8810///
8811/// ```test_harness,no_run
8812/// # extern crate hyper;
8813/// # extern crate hyper_rustls;
8814/// # extern crate google_tagmanager2 as tagmanager2;
8815/// # async fn dox() {
8816/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8817///
8818/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8820/// #     secret,
8821/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8822/// # ).build().await.unwrap();
8823///
8824/// # let client = hyper_util::client::legacy::Client::builder(
8825/// #     hyper_util::rt::TokioExecutor::new()
8826/// # )
8827/// # .build(
8828/// #     hyper_rustls::HttpsConnectorBuilder::new()
8829/// #         .with_native_roots()
8830/// #         .unwrap()
8831/// #         .https_or_http()
8832/// #         .enable_http1()
8833/// #         .build()
8834/// # );
8835/// # let mut hub = TagManager::new(client, auth);
8836/// // You can configure optional parameters by calling the respective setters at will, and
8837/// // execute the final call using `doit()`.
8838/// // Values shown here are possibly random and not representative !
8839/// let result = hub.accounts().containers_versions_publish("path")
8840///              .fingerprint("et")
8841///              .doit().await;
8842/// # }
8843/// ```
8844pub struct AccountContainerVersionPublishCall<'a, C>
8845where
8846    C: 'a,
8847{
8848    hub: &'a TagManager<C>,
8849    _path: String,
8850    _fingerprint: Option<String>,
8851    _delegate: Option<&'a mut dyn common::Delegate>,
8852    _additional_params: HashMap<String, String>,
8853    _scopes: BTreeSet<String>,
8854}
8855
8856impl<'a, C> common::CallBuilder for AccountContainerVersionPublishCall<'a, C> {}
8857
8858impl<'a, C> AccountContainerVersionPublishCall<'a, C>
8859where
8860    C: common::Connector,
8861{
8862    /// Perform the operation you have build so far.
8863    pub async fn doit(
8864        mut self,
8865    ) -> common::Result<(common::Response, PublishContainerVersionResponse)> {
8866        use std::borrow::Cow;
8867        use std::io::{Read, Seek};
8868
8869        use common::{url::Params, ToParts};
8870        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8871
8872        let mut dd = common::DefaultDelegate;
8873        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8874        dlg.begin(common::MethodInfo {
8875            id: "tagmanager.accounts.containers.versions.publish",
8876            http_method: hyper::Method::POST,
8877        });
8878
8879        for &field in ["alt", "path", "fingerprint"].iter() {
8880            if self._additional_params.contains_key(field) {
8881                dlg.finished(false);
8882                return Err(common::Error::FieldClash(field));
8883            }
8884        }
8885
8886        let mut params = Params::with_capacity(4 + self._additional_params.len());
8887        params.push("path", self._path);
8888        if let Some(value) = self._fingerprint.as_ref() {
8889            params.push("fingerprint", value);
8890        }
8891
8892        params.extend(self._additional_params.iter());
8893
8894        params.push("alt", "json");
8895        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:publish";
8896        if self._scopes.is_empty() {
8897            self._scopes.insert(Scope::Publish.as_ref().to_string());
8898        }
8899
8900        #[allow(clippy::single_element_loop)]
8901        for &(find_this, param_name) in [("{+path}", "path")].iter() {
8902            url = params.uri_replacement(url, param_name, find_this, true);
8903        }
8904        {
8905            let to_remove = ["path"];
8906            params.remove_params(&to_remove);
8907        }
8908
8909        let url = params.parse_with_url(&url);
8910
8911        loop {
8912            let token = match self
8913                .hub
8914                .auth
8915                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8916                .await
8917            {
8918                Ok(token) => token,
8919                Err(e) => match dlg.token(e) {
8920                    Ok(token) => token,
8921                    Err(e) => {
8922                        dlg.finished(false);
8923                        return Err(common::Error::MissingToken(e));
8924                    }
8925                },
8926            };
8927            let mut req_result = {
8928                let client = &self.hub.client;
8929                dlg.pre_request();
8930                let mut req_builder = hyper::Request::builder()
8931                    .method(hyper::Method::POST)
8932                    .uri(url.as_str())
8933                    .header(USER_AGENT, self.hub._user_agent.clone());
8934
8935                if let Some(token) = token.as_ref() {
8936                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8937                }
8938
8939                let request = req_builder
8940                    .header(CONTENT_LENGTH, 0_u64)
8941                    .body(common::to_body::<String>(None));
8942
8943                client.request(request.unwrap()).await
8944            };
8945
8946            match req_result {
8947                Err(err) => {
8948                    if let common::Retry::After(d) = dlg.http_error(&err) {
8949                        sleep(d).await;
8950                        continue;
8951                    }
8952                    dlg.finished(false);
8953                    return Err(common::Error::HttpError(err));
8954                }
8955                Ok(res) => {
8956                    let (mut parts, body) = res.into_parts();
8957                    let mut body = common::Body::new(body);
8958                    if !parts.status.is_success() {
8959                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8960                        let error = serde_json::from_str(&common::to_string(&bytes));
8961                        let response = common::to_response(parts, bytes.into());
8962
8963                        if let common::Retry::After(d) =
8964                            dlg.http_failure(&response, error.as_ref().ok())
8965                        {
8966                            sleep(d).await;
8967                            continue;
8968                        }
8969
8970                        dlg.finished(false);
8971
8972                        return Err(match error {
8973                            Ok(value) => common::Error::BadRequest(value),
8974                            _ => common::Error::Failure(response),
8975                        });
8976                    }
8977                    let response = {
8978                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8979                        let encoded = common::to_string(&bytes);
8980                        match serde_json::from_str(&encoded) {
8981                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8982                            Err(error) => {
8983                                dlg.response_json_decode_error(&encoded, &error);
8984                                return Err(common::Error::JsonDecodeError(
8985                                    encoded.to_string(),
8986                                    error,
8987                                ));
8988                            }
8989                        }
8990                    };
8991
8992                    dlg.finished(true);
8993                    return Ok(response);
8994                }
8995            }
8996        }
8997    }
8998
8999    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
9000    ///
9001    /// Sets the *path* path property to the given value.
9002    ///
9003    /// Even though the property as already been set when instantiating this call,
9004    /// we provide this method for API completeness.
9005    pub fn path(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
9006        self._path = new_value.to_string();
9007        self
9008    }
9009    /// When provided, this fingerprint must match the fingerprint of the container version in storage.
9010    ///
9011    /// Sets the *fingerprint* query property to the given value.
9012    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
9013        self._fingerprint = Some(new_value.to_string());
9014        self
9015    }
9016    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9017    /// while executing the actual API request.
9018    ///
9019    /// ````text
9020    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9021    /// ````
9022    ///
9023    /// Sets the *delegate* property to the given value.
9024    pub fn delegate(
9025        mut self,
9026        new_value: &'a mut dyn common::Delegate,
9027    ) -> AccountContainerVersionPublishCall<'a, C> {
9028        self._delegate = Some(new_value);
9029        self
9030    }
9031
9032    /// Set any additional parameter of the query string used in the request.
9033    /// It should be used to set parameters which are not yet available through their own
9034    /// setters.
9035    ///
9036    /// Please note that this method must not be used to set any of the known parameters
9037    /// which have their own setter method. If done anyway, the request will fail.
9038    ///
9039    /// # Additional Parameters
9040    ///
9041    /// * *$.xgafv* (query-string) - V1 error format.
9042    /// * *access_token* (query-string) - OAuth access token.
9043    /// * *alt* (query-string) - Data format for response.
9044    /// * *callback* (query-string) - JSONP
9045    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9046    /// * *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.
9047    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9048    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9049    /// * *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.
9050    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9051    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9052    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionPublishCall<'a, C>
9053    where
9054        T: AsRef<str>,
9055    {
9056        self._additional_params
9057            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9058        self
9059    }
9060
9061    /// Identifies the authorization scope for the method you are building.
9062    ///
9063    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9064    /// [`Scope::Publish`].
9065    ///
9066    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9067    /// tokens for more than one scope.
9068    ///
9069    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9070    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9071    /// sufficient, a read-write scope will do as well.
9072    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionPublishCall<'a, C>
9073    where
9074        St: AsRef<str>,
9075    {
9076        self._scopes.insert(String::from(scope.as_ref()));
9077        self
9078    }
9079    /// Identifies the authorization scope(s) for the method you are building.
9080    ///
9081    /// See [`Self::add_scope()`] for details.
9082    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionPublishCall<'a, C>
9083    where
9084        I: IntoIterator<Item = St>,
9085        St: AsRef<str>,
9086    {
9087        self._scopes
9088            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9089        self
9090    }
9091
9092    /// Removes all scopes, and no default scope will be used either.
9093    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9094    /// for details).
9095    pub fn clear_scopes(mut self) -> AccountContainerVersionPublishCall<'a, C> {
9096        self._scopes.clear();
9097        self
9098    }
9099}
9100
9101/// Sets the latest version used for synchronization of workspaces when detecting conflicts and errors.
9102///
9103/// A builder for the *containers.versions.set_latest* method supported by a *account* resource.
9104/// It is not used directly, but through a [`AccountMethods`] instance.
9105///
9106/// # Example
9107///
9108/// Instantiate a resource method builder
9109///
9110/// ```test_harness,no_run
9111/// # extern crate hyper;
9112/// # extern crate hyper_rustls;
9113/// # extern crate google_tagmanager2 as tagmanager2;
9114/// # async fn dox() {
9115/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9116///
9117/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9118/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9119/// #     secret,
9120/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9121/// # ).build().await.unwrap();
9122///
9123/// # let client = hyper_util::client::legacy::Client::builder(
9124/// #     hyper_util::rt::TokioExecutor::new()
9125/// # )
9126/// # .build(
9127/// #     hyper_rustls::HttpsConnectorBuilder::new()
9128/// #         .with_native_roots()
9129/// #         .unwrap()
9130/// #         .https_or_http()
9131/// #         .enable_http1()
9132/// #         .build()
9133/// # );
9134/// # let mut hub = TagManager::new(client, auth);
9135/// // You can configure optional parameters by calling the respective setters at will, and
9136/// // execute the final call using `doit()`.
9137/// // Values shown here are possibly random and not representative !
9138/// let result = hub.accounts().containers_versions_set_latest("path")
9139///              .doit().await;
9140/// # }
9141/// ```
9142pub struct AccountContainerVersionSetLatestCall<'a, C>
9143where
9144    C: 'a,
9145{
9146    hub: &'a TagManager<C>,
9147    _path: String,
9148    _delegate: Option<&'a mut dyn common::Delegate>,
9149    _additional_params: HashMap<String, String>,
9150    _scopes: BTreeSet<String>,
9151}
9152
9153impl<'a, C> common::CallBuilder for AccountContainerVersionSetLatestCall<'a, C> {}
9154
9155impl<'a, C> AccountContainerVersionSetLatestCall<'a, C>
9156where
9157    C: common::Connector,
9158{
9159    /// Perform the operation you have build so far.
9160    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
9161        use std::borrow::Cow;
9162        use std::io::{Read, Seek};
9163
9164        use common::{url::Params, ToParts};
9165        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9166
9167        let mut dd = common::DefaultDelegate;
9168        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9169        dlg.begin(common::MethodInfo {
9170            id: "tagmanager.accounts.containers.versions.set_latest",
9171            http_method: hyper::Method::POST,
9172        });
9173
9174        for &field in ["alt", "path"].iter() {
9175            if self._additional_params.contains_key(field) {
9176                dlg.finished(false);
9177                return Err(common::Error::FieldClash(field));
9178            }
9179        }
9180
9181        let mut params = Params::with_capacity(3 + self._additional_params.len());
9182        params.push("path", self._path);
9183
9184        params.extend(self._additional_params.iter());
9185
9186        params.push("alt", "json");
9187        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:set_latest";
9188        if self._scopes.is_empty() {
9189            self._scopes
9190                .insert(Scope::EditContainer.as_ref().to_string());
9191        }
9192
9193        #[allow(clippy::single_element_loop)]
9194        for &(find_this, param_name) in [("{+path}", "path")].iter() {
9195            url = params.uri_replacement(url, param_name, find_this, true);
9196        }
9197        {
9198            let to_remove = ["path"];
9199            params.remove_params(&to_remove);
9200        }
9201
9202        let url = params.parse_with_url(&url);
9203
9204        loop {
9205            let token = match self
9206                .hub
9207                .auth
9208                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9209                .await
9210            {
9211                Ok(token) => token,
9212                Err(e) => match dlg.token(e) {
9213                    Ok(token) => token,
9214                    Err(e) => {
9215                        dlg.finished(false);
9216                        return Err(common::Error::MissingToken(e));
9217                    }
9218                },
9219            };
9220            let mut req_result = {
9221                let client = &self.hub.client;
9222                dlg.pre_request();
9223                let mut req_builder = hyper::Request::builder()
9224                    .method(hyper::Method::POST)
9225                    .uri(url.as_str())
9226                    .header(USER_AGENT, self.hub._user_agent.clone());
9227
9228                if let Some(token) = token.as_ref() {
9229                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9230                }
9231
9232                let request = req_builder
9233                    .header(CONTENT_LENGTH, 0_u64)
9234                    .body(common::to_body::<String>(None));
9235
9236                client.request(request.unwrap()).await
9237            };
9238
9239            match req_result {
9240                Err(err) => {
9241                    if let common::Retry::After(d) = dlg.http_error(&err) {
9242                        sleep(d).await;
9243                        continue;
9244                    }
9245                    dlg.finished(false);
9246                    return Err(common::Error::HttpError(err));
9247                }
9248                Ok(res) => {
9249                    let (mut parts, body) = res.into_parts();
9250                    let mut body = common::Body::new(body);
9251                    if !parts.status.is_success() {
9252                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9253                        let error = serde_json::from_str(&common::to_string(&bytes));
9254                        let response = common::to_response(parts, bytes.into());
9255
9256                        if let common::Retry::After(d) =
9257                            dlg.http_failure(&response, error.as_ref().ok())
9258                        {
9259                            sleep(d).await;
9260                            continue;
9261                        }
9262
9263                        dlg.finished(false);
9264
9265                        return Err(match error {
9266                            Ok(value) => common::Error::BadRequest(value),
9267                            _ => common::Error::Failure(response),
9268                        });
9269                    }
9270                    let response = {
9271                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9272                        let encoded = common::to_string(&bytes);
9273                        match serde_json::from_str(&encoded) {
9274                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9275                            Err(error) => {
9276                                dlg.response_json_decode_error(&encoded, &error);
9277                                return Err(common::Error::JsonDecodeError(
9278                                    encoded.to_string(),
9279                                    error,
9280                                ));
9281                            }
9282                        }
9283                    };
9284
9285                    dlg.finished(true);
9286                    return Ok(response);
9287                }
9288            }
9289        }
9290    }
9291
9292    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
9293    ///
9294    /// Sets the *path* path property to the given value.
9295    ///
9296    /// Even though the property as already been set when instantiating this call,
9297    /// we provide this method for API completeness.
9298    pub fn path(mut self, new_value: &str) -> AccountContainerVersionSetLatestCall<'a, C> {
9299        self._path = new_value.to_string();
9300        self
9301    }
9302    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9303    /// while executing the actual API request.
9304    ///
9305    /// ````text
9306    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9307    /// ````
9308    ///
9309    /// Sets the *delegate* property to the given value.
9310    pub fn delegate(
9311        mut self,
9312        new_value: &'a mut dyn common::Delegate,
9313    ) -> AccountContainerVersionSetLatestCall<'a, C> {
9314        self._delegate = Some(new_value);
9315        self
9316    }
9317
9318    /// Set any additional parameter of the query string used in the request.
9319    /// It should be used to set parameters which are not yet available through their own
9320    /// setters.
9321    ///
9322    /// Please note that this method must not be used to set any of the known parameters
9323    /// which have their own setter method. If done anyway, the request will fail.
9324    ///
9325    /// # Additional Parameters
9326    ///
9327    /// * *$.xgafv* (query-string) - V1 error format.
9328    /// * *access_token* (query-string) - OAuth access token.
9329    /// * *alt* (query-string) - Data format for response.
9330    /// * *callback* (query-string) - JSONP
9331    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9332    /// * *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.
9333    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9334    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9335    /// * *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.
9336    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9337    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9338    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionSetLatestCall<'a, C>
9339    where
9340        T: AsRef<str>,
9341    {
9342        self._additional_params
9343            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9344        self
9345    }
9346
9347    /// Identifies the authorization scope for the method you are building.
9348    ///
9349    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9350    /// [`Scope::EditContainer`].
9351    ///
9352    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9353    /// tokens for more than one scope.
9354    ///
9355    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9356    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9357    /// sufficient, a read-write scope will do as well.
9358    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionSetLatestCall<'a, C>
9359    where
9360        St: AsRef<str>,
9361    {
9362        self._scopes.insert(String::from(scope.as_ref()));
9363        self
9364    }
9365    /// Identifies the authorization scope(s) for the method you are building.
9366    ///
9367    /// See [`Self::add_scope()`] for details.
9368    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionSetLatestCall<'a, C>
9369    where
9370        I: IntoIterator<Item = St>,
9371        St: AsRef<str>,
9372    {
9373        self._scopes
9374            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9375        self
9376    }
9377
9378    /// Removes all scopes, and no default scope will be used either.
9379    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9380    /// for details).
9381    pub fn clear_scopes(mut self) -> AccountContainerVersionSetLatestCall<'a, C> {
9382        self._scopes.clear();
9383        self
9384    }
9385}
9386
9387/// Undeletes a Container Version.
9388///
9389/// A builder for the *containers.versions.undelete* method supported by a *account* resource.
9390/// It is not used directly, but through a [`AccountMethods`] instance.
9391///
9392/// # Example
9393///
9394/// Instantiate a resource method builder
9395///
9396/// ```test_harness,no_run
9397/// # extern crate hyper;
9398/// # extern crate hyper_rustls;
9399/// # extern crate google_tagmanager2 as tagmanager2;
9400/// # async fn dox() {
9401/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9402///
9403/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9404/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9405/// #     secret,
9406/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9407/// # ).build().await.unwrap();
9408///
9409/// # let client = hyper_util::client::legacy::Client::builder(
9410/// #     hyper_util::rt::TokioExecutor::new()
9411/// # )
9412/// # .build(
9413/// #     hyper_rustls::HttpsConnectorBuilder::new()
9414/// #         .with_native_roots()
9415/// #         .unwrap()
9416/// #         .https_or_http()
9417/// #         .enable_http1()
9418/// #         .build()
9419/// # );
9420/// # let mut hub = TagManager::new(client, auth);
9421/// // You can configure optional parameters by calling the respective setters at will, and
9422/// // execute the final call using `doit()`.
9423/// // Values shown here are possibly random and not representative !
9424/// let result = hub.accounts().containers_versions_undelete("path")
9425///              .doit().await;
9426/// # }
9427/// ```
9428pub struct AccountContainerVersionUndeleteCall<'a, C>
9429where
9430    C: 'a,
9431{
9432    hub: &'a TagManager<C>,
9433    _path: String,
9434    _delegate: Option<&'a mut dyn common::Delegate>,
9435    _additional_params: HashMap<String, String>,
9436    _scopes: BTreeSet<String>,
9437}
9438
9439impl<'a, C> common::CallBuilder for AccountContainerVersionUndeleteCall<'a, C> {}
9440
9441impl<'a, C> AccountContainerVersionUndeleteCall<'a, C>
9442where
9443    C: common::Connector,
9444{
9445    /// Perform the operation you have build so far.
9446    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
9447        use std::borrow::Cow;
9448        use std::io::{Read, Seek};
9449
9450        use common::{url::Params, ToParts};
9451        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9452
9453        let mut dd = common::DefaultDelegate;
9454        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9455        dlg.begin(common::MethodInfo {
9456            id: "tagmanager.accounts.containers.versions.undelete",
9457            http_method: hyper::Method::POST,
9458        });
9459
9460        for &field in ["alt", "path"].iter() {
9461            if self._additional_params.contains_key(field) {
9462                dlg.finished(false);
9463                return Err(common::Error::FieldClash(field));
9464            }
9465        }
9466
9467        let mut params = Params::with_capacity(3 + self._additional_params.len());
9468        params.push("path", self._path);
9469
9470        params.extend(self._additional_params.iter());
9471
9472        params.push("alt", "json");
9473        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:undelete";
9474        if self._scopes.is_empty() {
9475            self._scopes
9476                .insert(Scope::EditContainerversion.as_ref().to_string());
9477        }
9478
9479        #[allow(clippy::single_element_loop)]
9480        for &(find_this, param_name) in [("{+path}", "path")].iter() {
9481            url = params.uri_replacement(url, param_name, find_this, true);
9482        }
9483        {
9484            let to_remove = ["path"];
9485            params.remove_params(&to_remove);
9486        }
9487
9488        let url = params.parse_with_url(&url);
9489
9490        loop {
9491            let token = match self
9492                .hub
9493                .auth
9494                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9495                .await
9496            {
9497                Ok(token) => token,
9498                Err(e) => match dlg.token(e) {
9499                    Ok(token) => token,
9500                    Err(e) => {
9501                        dlg.finished(false);
9502                        return Err(common::Error::MissingToken(e));
9503                    }
9504                },
9505            };
9506            let mut req_result = {
9507                let client = &self.hub.client;
9508                dlg.pre_request();
9509                let mut req_builder = hyper::Request::builder()
9510                    .method(hyper::Method::POST)
9511                    .uri(url.as_str())
9512                    .header(USER_AGENT, self.hub._user_agent.clone());
9513
9514                if let Some(token) = token.as_ref() {
9515                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9516                }
9517
9518                let request = req_builder
9519                    .header(CONTENT_LENGTH, 0_u64)
9520                    .body(common::to_body::<String>(None));
9521
9522                client.request(request.unwrap()).await
9523            };
9524
9525            match req_result {
9526                Err(err) => {
9527                    if let common::Retry::After(d) = dlg.http_error(&err) {
9528                        sleep(d).await;
9529                        continue;
9530                    }
9531                    dlg.finished(false);
9532                    return Err(common::Error::HttpError(err));
9533                }
9534                Ok(res) => {
9535                    let (mut parts, body) = res.into_parts();
9536                    let mut body = common::Body::new(body);
9537                    if !parts.status.is_success() {
9538                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9539                        let error = serde_json::from_str(&common::to_string(&bytes));
9540                        let response = common::to_response(parts, bytes.into());
9541
9542                        if let common::Retry::After(d) =
9543                            dlg.http_failure(&response, error.as_ref().ok())
9544                        {
9545                            sleep(d).await;
9546                            continue;
9547                        }
9548
9549                        dlg.finished(false);
9550
9551                        return Err(match error {
9552                            Ok(value) => common::Error::BadRequest(value),
9553                            _ => common::Error::Failure(response),
9554                        });
9555                    }
9556                    let response = {
9557                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9558                        let encoded = common::to_string(&bytes);
9559                        match serde_json::from_str(&encoded) {
9560                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9561                            Err(error) => {
9562                                dlg.response_json_decode_error(&encoded, &error);
9563                                return Err(common::Error::JsonDecodeError(
9564                                    encoded.to_string(),
9565                                    error,
9566                                ));
9567                            }
9568                        }
9569                    };
9570
9571                    dlg.finished(true);
9572                    return Ok(response);
9573                }
9574            }
9575        }
9576    }
9577
9578    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
9579    ///
9580    /// Sets the *path* path property to the given value.
9581    ///
9582    /// Even though the property as already been set when instantiating this call,
9583    /// we provide this method for API completeness.
9584    pub fn path(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C> {
9585        self._path = new_value.to_string();
9586        self
9587    }
9588    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9589    /// while executing the actual API request.
9590    ///
9591    /// ````text
9592    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9593    /// ````
9594    ///
9595    /// Sets the *delegate* property to the given value.
9596    pub fn delegate(
9597        mut self,
9598        new_value: &'a mut dyn common::Delegate,
9599    ) -> AccountContainerVersionUndeleteCall<'a, C> {
9600        self._delegate = Some(new_value);
9601        self
9602    }
9603
9604    /// Set any additional parameter of the query string used in the request.
9605    /// It should be used to set parameters which are not yet available through their own
9606    /// setters.
9607    ///
9608    /// Please note that this method must not be used to set any of the known parameters
9609    /// which have their own setter method. If done anyway, the request will fail.
9610    ///
9611    /// # Additional Parameters
9612    ///
9613    /// * *$.xgafv* (query-string) - V1 error format.
9614    /// * *access_token* (query-string) - OAuth access token.
9615    /// * *alt* (query-string) - Data format for response.
9616    /// * *callback* (query-string) - JSONP
9617    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9618    /// * *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.
9619    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9620    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9621    /// * *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.
9622    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9623    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9624    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUndeleteCall<'a, C>
9625    where
9626        T: AsRef<str>,
9627    {
9628        self._additional_params
9629            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9630        self
9631    }
9632
9633    /// Identifies the authorization scope for the method you are building.
9634    ///
9635    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9636    /// [`Scope::EditContainerversion`].
9637    ///
9638    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9639    /// tokens for more than one scope.
9640    ///
9641    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9642    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9643    /// sufficient, a read-write scope will do as well.
9644    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUndeleteCall<'a, C>
9645    where
9646        St: AsRef<str>,
9647    {
9648        self._scopes.insert(String::from(scope.as_ref()));
9649        self
9650    }
9651    /// Identifies the authorization scope(s) for the method you are building.
9652    ///
9653    /// See [`Self::add_scope()`] for details.
9654    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUndeleteCall<'a, C>
9655    where
9656        I: IntoIterator<Item = St>,
9657        St: AsRef<str>,
9658    {
9659        self._scopes
9660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9661        self
9662    }
9663
9664    /// Removes all scopes, and no default scope will be used either.
9665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9666    /// for details).
9667    pub fn clear_scopes(mut self) -> AccountContainerVersionUndeleteCall<'a, C> {
9668        self._scopes.clear();
9669        self
9670    }
9671}
9672
9673/// Updates a Container Version.
9674///
9675/// A builder for the *containers.versions.update* method supported by a *account* resource.
9676/// It is not used directly, but through a [`AccountMethods`] instance.
9677///
9678/// # Example
9679///
9680/// Instantiate a resource method builder
9681///
9682/// ```test_harness,no_run
9683/// # extern crate hyper;
9684/// # extern crate hyper_rustls;
9685/// # extern crate google_tagmanager2 as tagmanager2;
9686/// use tagmanager2::api::ContainerVersion;
9687/// # async fn dox() {
9688/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9689///
9690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9692/// #     secret,
9693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9694/// # ).build().await.unwrap();
9695///
9696/// # let client = hyper_util::client::legacy::Client::builder(
9697/// #     hyper_util::rt::TokioExecutor::new()
9698/// # )
9699/// # .build(
9700/// #     hyper_rustls::HttpsConnectorBuilder::new()
9701/// #         .with_native_roots()
9702/// #         .unwrap()
9703/// #         .https_or_http()
9704/// #         .enable_http1()
9705/// #         .build()
9706/// # );
9707/// # let mut hub = TagManager::new(client, auth);
9708/// // As the method needs a request, you would usually fill it with the desired information
9709/// // into the respective structure. Some of the parts shown here might not be applicable !
9710/// // Values shown here are possibly random and not representative !
9711/// let mut req = ContainerVersion::default();
9712///
9713/// // You can configure optional parameters by calling the respective setters at will, and
9714/// // execute the final call using `doit()`.
9715/// // Values shown here are possibly random and not representative !
9716/// let result = hub.accounts().containers_versions_update(req, "path")
9717///              .fingerprint("diam")
9718///              .doit().await;
9719/// # }
9720/// ```
9721pub struct AccountContainerVersionUpdateCall<'a, C>
9722where
9723    C: 'a,
9724{
9725    hub: &'a TagManager<C>,
9726    _request: ContainerVersion,
9727    _path: String,
9728    _fingerprint: Option<String>,
9729    _delegate: Option<&'a mut dyn common::Delegate>,
9730    _additional_params: HashMap<String, String>,
9731    _scopes: BTreeSet<String>,
9732}
9733
9734impl<'a, C> common::CallBuilder for AccountContainerVersionUpdateCall<'a, C> {}
9735
9736impl<'a, C> AccountContainerVersionUpdateCall<'a, C>
9737where
9738    C: common::Connector,
9739{
9740    /// Perform the operation you have build so far.
9741    pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
9742        use std::borrow::Cow;
9743        use std::io::{Read, Seek};
9744
9745        use common::{url::Params, ToParts};
9746        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9747
9748        let mut dd = common::DefaultDelegate;
9749        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9750        dlg.begin(common::MethodInfo {
9751            id: "tagmanager.accounts.containers.versions.update",
9752            http_method: hyper::Method::PUT,
9753        });
9754
9755        for &field in ["alt", "path", "fingerprint"].iter() {
9756            if self._additional_params.contains_key(field) {
9757                dlg.finished(false);
9758                return Err(common::Error::FieldClash(field));
9759            }
9760        }
9761
9762        let mut params = Params::with_capacity(5 + self._additional_params.len());
9763        params.push("path", self._path);
9764        if let Some(value) = self._fingerprint.as_ref() {
9765            params.push("fingerprint", value);
9766        }
9767
9768        params.extend(self._additional_params.iter());
9769
9770        params.push("alt", "json");
9771        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
9772        if self._scopes.is_empty() {
9773            self._scopes
9774                .insert(Scope::EditContainerversion.as_ref().to_string());
9775        }
9776
9777        #[allow(clippy::single_element_loop)]
9778        for &(find_this, param_name) in [("{+path}", "path")].iter() {
9779            url = params.uri_replacement(url, param_name, find_this, true);
9780        }
9781        {
9782            let to_remove = ["path"];
9783            params.remove_params(&to_remove);
9784        }
9785
9786        let url = params.parse_with_url(&url);
9787
9788        let mut json_mime_type = mime::APPLICATION_JSON;
9789        let mut request_value_reader = {
9790            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9791            common::remove_json_null_values(&mut value);
9792            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9793            serde_json::to_writer(&mut dst, &value).unwrap();
9794            dst
9795        };
9796        let request_size = request_value_reader
9797            .seek(std::io::SeekFrom::End(0))
9798            .unwrap();
9799        request_value_reader
9800            .seek(std::io::SeekFrom::Start(0))
9801            .unwrap();
9802
9803        loop {
9804            let token = match self
9805                .hub
9806                .auth
9807                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9808                .await
9809            {
9810                Ok(token) => token,
9811                Err(e) => match dlg.token(e) {
9812                    Ok(token) => token,
9813                    Err(e) => {
9814                        dlg.finished(false);
9815                        return Err(common::Error::MissingToken(e));
9816                    }
9817                },
9818            };
9819            request_value_reader
9820                .seek(std::io::SeekFrom::Start(0))
9821                .unwrap();
9822            let mut req_result = {
9823                let client = &self.hub.client;
9824                dlg.pre_request();
9825                let mut req_builder = hyper::Request::builder()
9826                    .method(hyper::Method::PUT)
9827                    .uri(url.as_str())
9828                    .header(USER_AGENT, self.hub._user_agent.clone());
9829
9830                if let Some(token) = token.as_ref() {
9831                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9832                }
9833
9834                let request = req_builder
9835                    .header(CONTENT_TYPE, json_mime_type.to_string())
9836                    .header(CONTENT_LENGTH, request_size as u64)
9837                    .body(common::to_body(
9838                        request_value_reader.get_ref().clone().into(),
9839                    ));
9840
9841                client.request(request.unwrap()).await
9842            };
9843
9844            match req_result {
9845                Err(err) => {
9846                    if let common::Retry::After(d) = dlg.http_error(&err) {
9847                        sleep(d).await;
9848                        continue;
9849                    }
9850                    dlg.finished(false);
9851                    return Err(common::Error::HttpError(err));
9852                }
9853                Ok(res) => {
9854                    let (mut parts, body) = res.into_parts();
9855                    let mut body = common::Body::new(body);
9856                    if !parts.status.is_success() {
9857                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9858                        let error = serde_json::from_str(&common::to_string(&bytes));
9859                        let response = common::to_response(parts, bytes.into());
9860
9861                        if let common::Retry::After(d) =
9862                            dlg.http_failure(&response, error.as_ref().ok())
9863                        {
9864                            sleep(d).await;
9865                            continue;
9866                        }
9867
9868                        dlg.finished(false);
9869
9870                        return Err(match error {
9871                            Ok(value) => common::Error::BadRequest(value),
9872                            _ => common::Error::Failure(response),
9873                        });
9874                    }
9875                    let response = {
9876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9877                        let encoded = common::to_string(&bytes);
9878                        match serde_json::from_str(&encoded) {
9879                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9880                            Err(error) => {
9881                                dlg.response_json_decode_error(&encoded, &error);
9882                                return Err(common::Error::JsonDecodeError(
9883                                    encoded.to_string(),
9884                                    error,
9885                                ));
9886                            }
9887                        }
9888                    };
9889
9890                    dlg.finished(true);
9891                    return Ok(response);
9892                }
9893            }
9894        }
9895    }
9896
9897    ///
9898    /// Sets the *request* property to the given value.
9899    ///
9900    /// Even though the property as already been set when instantiating this call,
9901    /// we provide this method for API completeness.
9902    pub fn request(
9903        mut self,
9904        new_value: ContainerVersion,
9905    ) -> AccountContainerVersionUpdateCall<'a, C> {
9906        self._request = new_value;
9907        self
9908    }
9909    /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id}
9910    ///
9911    /// Sets the *path* path property to the given value.
9912    ///
9913    /// Even though the property as already been set when instantiating this call,
9914    /// we provide this method for API completeness.
9915    pub fn path(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
9916        self._path = new_value.to_string();
9917        self
9918    }
9919    /// When provided, this fingerprint must match the fingerprint of the container version in storage.
9920    ///
9921    /// Sets the *fingerprint* query property to the given value.
9922    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
9923        self._fingerprint = Some(new_value.to_string());
9924        self
9925    }
9926    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9927    /// while executing the actual API request.
9928    ///
9929    /// ````text
9930    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9931    /// ````
9932    ///
9933    /// Sets the *delegate* property to the given value.
9934    pub fn delegate(
9935        mut self,
9936        new_value: &'a mut dyn common::Delegate,
9937    ) -> AccountContainerVersionUpdateCall<'a, C> {
9938        self._delegate = Some(new_value);
9939        self
9940    }
9941
9942    /// Set any additional parameter of the query string used in the request.
9943    /// It should be used to set parameters which are not yet available through their own
9944    /// setters.
9945    ///
9946    /// Please note that this method must not be used to set any of the known parameters
9947    /// which have their own setter method. If done anyway, the request will fail.
9948    ///
9949    /// # Additional Parameters
9950    ///
9951    /// * *$.xgafv* (query-string) - V1 error format.
9952    /// * *access_token* (query-string) - OAuth access token.
9953    /// * *alt* (query-string) - Data format for response.
9954    /// * *callback* (query-string) - JSONP
9955    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9956    /// * *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.
9957    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9958    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9959    /// * *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.
9960    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9961    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9962    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUpdateCall<'a, C>
9963    where
9964        T: AsRef<str>,
9965    {
9966        self._additional_params
9967            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9968        self
9969    }
9970
9971    /// Identifies the authorization scope for the method you are building.
9972    ///
9973    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9974    /// [`Scope::EditContainerversion`].
9975    ///
9976    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9977    /// tokens for more than one scope.
9978    ///
9979    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9980    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9981    /// sufficient, a read-write scope will do as well.
9982    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUpdateCall<'a, C>
9983    where
9984        St: AsRef<str>,
9985    {
9986        self._scopes.insert(String::from(scope.as_ref()));
9987        self
9988    }
9989    /// Identifies the authorization scope(s) for the method you are building.
9990    ///
9991    /// See [`Self::add_scope()`] for details.
9992    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUpdateCall<'a, C>
9993    where
9994        I: IntoIterator<Item = St>,
9995        St: AsRef<str>,
9996    {
9997        self._scopes
9998            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9999        self
10000    }
10001
10002    /// Removes all scopes, and no default scope will be used either.
10003    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10004    /// for details).
10005    pub fn clear_scopes(mut self) -> AccountContainerVersionUpdateCall<'a, C> {
10006        self._scopes.clear();
10007        self
10008    }
10009}
10010
10011/// Creates one or more GTM Built-In Variables.
10012///
10013/// A builder for the *containers.workspaces.built_in_variables.create* method supported by a *account* resource.
10014/// It is not used directly, but through a [`AccountMethods`] instance.
10015///
10016/// # Example
10017///
10018/// Instantiate a resource method builder
10019///
10020/// ```test_harness,no_run
10021/// # extern crate hyper;
10022/// # extern crate hyper_rustls;
10023/// # extern crate google_tagmanager2 as tagmanager2;
10024/// # async fn dox() {
10025/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10026///
10027/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10029/// #     secret,
10030/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10031/// # ).build().await.unwrap();
10032///
10033/// # let client = hyper_util::client::legacy::Client::builder(
10034/// #     hyper_util::rt::TokioExecutor::new()
10035/// # )
10036/// # .build(
10037/// #     hyper_rustls::HttpsConnectorBuilder::new()
10038/// #         .with_native_roots()
10039/// #         .unwrap()
10040/// #         .https_or_http()
10041/// #         .enable_http1()
10042/// #         .build()
10043/// # );
10044/// # let mut hub = TagManager::new(client, auth);
10045/// // You can configure optional parameters by calling the respective setters at will, and
10046/// // execute the final call using `doit()`.
10047/// // Values shown here are possibly random and not representative !
10048/// let result = hub.accounts().containers_workspaces_built_in_variables_create("parent")
10049///              .add_type("et")
10050///              .doit().await;
10051/// # }
10052/// ```
10053pub struct AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10054where
10055    C: 'a,
10056{
10057    hub: &'a TagManager<C>,
10058    _parent: String,
10059    _type_: Vec<String>,
10060    _delegate: Option<&'a mut dyn common::Delegate>,
10061    _additional_params: HashMap<String, String>,
10062    _scopes: BTreeSet<String>,
10063}
10064
10065impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {}
10066
10067impl<'a, C> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10068where
10069    C: common::Connector,
10070{
10071    /// Perform the operation you have build so far.
10072    pub async fn doit(
10073        mut self,
10074    ) -> common::Result<(common::Response, CreateBuiltInVariableResponse)> {
10075        use std::borrow::Cow;
10076        use std::io::{Read, Seek};
10077
10078        use common::{url::Params, ToParts};
10079        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10080
10081        let mut dd = common::DefaultDelegate;
10082        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10083        dlg.begin(common::MethodInfo {
10084            id: "tagmanager.accounts.containers.workspaces.built_in_variables.create",
10085            http_method: hyper::Method::POST,
10086        });
10087
10088        for &field in ["alt", "parent", "type"].iter() {
10089            if self._additional_params.contains_key(field) {
10090                dlg.finished(false);
10091                return Err(common::Error::FieldClash(field));
10092            }
10093        }
10094
10095        let mut params = Params::with_capacity(4 + self._additional_params.len());
10096        params.push("parent", self._parent);
10097        if !self._type_.is_empty() {
10098            for f in self._type_.iter() {
10099                params.push("type", f);
10100            }
10101        }
10102
10103        params.extend(self._additional_params.iter());
10104
10105        params.push("alt", "json");
10106        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/built_in_variables";
10107        if self._scopes.is_empty() {
10108            self._scopes
10109                .insert(Scope::EditContainer.as_ref().to_string());
10110        }
10111
10112        #[allow(clippy::single_element_loop)]
10113        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10114            url = params.uri_replacement(url, param_name, find_this, true);
10115        }
10116        {
10117            let to_remove = ["parent"];
10118            params.remove_params(&to_remove);
10119        }
10120
10121        let url = params.parse_with_url(&url);
10122
10123        loop {
10124            let token = match self
10125                .hub
10126                .auth
10127                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10128                .await
10129            {
10130                Ok(token) => token,
10131                Err(e) => match dlg.token(e) {
10132                    Ok(token) => token,
10133                    Err(e) => {
10134                        dlg.finished(false);
10135                        return Err(common::Error::MissingToken(e));
10136                    }
10137                },
10138            };
10139            let mut req_result = {
10140                let client = &self.hub.client;
10141                dlg.pre_request();
10142                let mut req_builder = hyper::Request::builder()
10143                    .method(hyper::Method::POST)
10144                    .uri(url.as_str())
10145                    .header(USER_AGENT, self.hub._user_agent.clone());
10146
10147                if let Some(token) = token.as_ref() {
10148                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10149                }
10150
10151                let request = req_builder
10152                    .header(CONTENT_LENGTH, 0_u64)
10153                    .body(common::to_body::<String>(None));
10154
10155                client.request(request.unwrap()).await
10156            };
10157
10158            match req_result {
10159                Err(err) => {
10160                    if let common::Retry::After(d) = dlg.http_error(&err) {
10161                        sleep(d).await;
10162                        continue;
10163                    }
10164                    dlg.finished(false);
10165                    return Err(common::Error::HttpError(err));
10166                }
10167                Ok(res) => {
10168                    let (mut parts, body) = res.into_parts();
10169                    let mut body = common::Body::new(body);
10170                    if !parts.status.is_success() {
10171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10172                        let error = serde_json::from_str(&common::to_string(&bytes));
10173                        let response = common::to_response(parts, bytes.into());
10174
10175                        if let common::Retry::After(d) =
10176                            dlg.http_failure(&response, error.as_ref().ok())
10177                        {
10178                            sleep(d).await;
10179                            continue;
10180                        }
10181
10182                        dlg.finished(false);
10183
10184                        return Err(match error {
10185                            Ok(value) => common::Error::BadRequest(value),
10186                            _ => common::Error::Failure(response),
10187                        });
10188                    }
10189                    let response = {
10190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10191                        let encoded = common::to_string(&bytes);
10192                        match serde_json::from_str(&encoded) {
10193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10194                            Err(error) => {
10195                                dlg.response_json_decode_error(&encoded, &error);
10196                                return Err(common::Error::JsonDecodeError(
10197                                    encoded.to_string(),
10198                                    error,
10199                                ));
10200                            }
10201                        }
10202                    };
10203
10204                    dlg.finished(true);
10205                    return Ok(response);
10206                }
10207            }
10208        }
10209    }
10210
10211    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
10212    ///
10213    /// Sets the *parent* path property to the given value.
10214    ///
10215    /// Even though the property as already been set when instantiating this call,
10216    /// we provide this method for API completeness.
10217    pub fn parent(
10218        mut self,
10219        new_value: &str,
10220    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10221        self._parent = new_value.to_string();
10222        self
10223    }
10224    /// The types of built-in variables to enable.
10225    ///
10226    /// Append the given value to the *type* query property.
10227    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10228    pub fn add_type(
10229        mut self,
10230        new_value: &str,
10231    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10232        self._type_.push(new_value.to_string());
10233        self
10234    }
10235    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10236    /// while executing the actual API request.
10237    ///
10238    /// ````text
10239    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10240    /// ````
10241    ///
10242    /// Sets the *delegate* property to the given value.
10243    pub fn delegate(
10244        mut self,
10245        new_value: &'a mut dyn common::Delegate,
10246    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10247        self._delegate = Some(new_value);
10248        self
10249    }
10250
10251    /// Set any additional parameter of the query string used in the request.
10252    /// It should be used to set parameters which are not yet available through their own
10253    /// setters.
10254    ///
10255    /// Please note that this method must not be used to set any of the known parameters
10256    /// which have their own setter method. If done anyway, the request will fail.
10257    ///
10258    /// # Additional Parameters
10259    ///
10260    /// * *$.xgafv* (query-string) - V1 error format.
10261    /// * *access_token* (query-string) - OAuth access token.
10262    /// * *alt* (query-string) - Data format for response.
10263    /// * *callback* (query-string) - JSONP
10264    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10265    /// * *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.
10266    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10267    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10268    /// * *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.
10269    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10270    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10271    pub fn param<T>(
10272        mut self,
10273        name: T,
10274        value: T,
10275    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10276    where
10277        T: AsRef<str>,
10278    {
10279        self._additional_params
10280            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10281        self
10282    }
10283
10284    /// Identifies the authorization scope for the method you are building.
10285    ///
10286    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10287    /// [`Scope::EditContainer`].
10288    ///
10289    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10290    /// tokens for more than one scope.
10291    ///
10292    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10293    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10294    /// sufficient, a read-write scope will do as well.
10295    pub fn add_scope<St>(
10296        mut self,
10297        scope: St,
10298    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10299    where
10300        St: AsRef<str>,
10301    {
10302        self._scopes.insert(String::from(scope.as_ref()));
10303        self
10304    }
10305    /// Identifies the authorization scope(s) for the method you are building.
10306    ///
10307    /// See [`Self::add_scope()`] for details.
10308    pub fn add_scopes<I, St>(
10309        mut self,
10310        scopes: I,
10311    ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10312    where
10313        I: IntoIterator<Item = St>,
10314        St: AsRef<str>,
10315    {
10316        self._scopes
10317            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10318        self
10319    }
10320
10321    /// Removes all scopes, and no default scope will be used either.
10322    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10323    /// for details).
10324    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10325        self._scopes.clear();
10326        self
10327    }
10328}
10329
10330/// Deletes one or more GTM Built-In Variables.
10331///
10332/// A builder for the *containers.workspaces.built_in_variables.delete* method supported by a *account* resource.
10333/// It is not used directly, but through a [`AccountMethods`] instance.
10334///
10335/// # Example
10336///
10337/// Instantiate a resource method builder
10338///
10339/// ```test_harness,no_run
10340/// # extern crate hyper;
10341/// # extern crate hyper_rustls;
10342/// # extern crate google_tagmanager2 as tagmanager2;
10343/// # async fn dox() {
10344/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10345///
10346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10347/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10348/// #     secret,
10349/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10350/// # ).build().await.unwrap();
10351///
10352/// # let client = hyper_util::client::legacy::Client::builder(
10353/// #     hyper_util::rt::TokioExecutor::new()
10354/// # )
10355/// # .build(
10356/// #     hyper_rustls::HttpsConnectorBuilder::new()
10357/// #         .with_native_roots()
10358/// #         .unwrap()
10359/// #         .https_or_http()
10360/// #         .enable_http1()
10361/// #         .build()
10362/// # );
10363/// # let mut hub = TagManager::new(client, auth);
10364/// // You can configure optional parameters by calling the respective setters at will, and
10365/// // execute the final call using `doit()`.
10366/// // Values shown here are possibly random and not representative !
10367/// let result = hub.accounts().containers_workspaces_built_in_variables_delete("path")
10368///              .add_type("sadipscing")
10369///              .doit().await;
10370/// # }
10371/// ```
10372pub struct AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10373where
10374    C: 'a,
10375{
10376    hub: &'a TagManager<C>,
10377    _path: String,
10378    _type_: Vec<String>,
10379    _delegate: Option<&'a mut dyn common::Delegate>,
10380    _additional_params: HashMap<String, String>,
10381    _scopes: BTreeSet<String>,
10382}
10383
10384impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {}
10385
10386impl<'a, C> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10387where
10388    C: common::Connector,
10389{
10390    /// Perform the operation you have build so far.
10391    pub async fn doit(mut self) -> common::Result<common::Response> {
10392        use std::borrow::Cow;
10393        use std::io::{Read, Seek};
10394
10395        use common::{url::Params, ToParts};
10396        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10397
10398        let mut dd = common::DefaultDelegate;
10399        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10400        dlg.begin(common::MethodInfo {
10401            id: "tagmanager.accounts.containers.workspaces.built_in_variables.delete",
10402            http_method: hyper::Method::DELETE,
10403        });
10404
10405        for &field in ["path", "type"].iter() {
10406            if self._additional_params.contains_key(field) {
10407                dlg.finished(false);
10408                return Err(common::Error::FieldClash(field));
10409            }
10410        }
10411
10412        let mut params = Params::with_capacity(3 + self._additional_params.len());
10413        params.push("path", self._path);
10414        if !self._type_.is_empty() {
10415            for f in self._type_.iter() {
10416                params.push("type", f);
10417            }
10418        }
10419
10420        params.extend(self._additional_params.iter());
10421
10422        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
10423        if self._scopes.is_empty() {
10424            self._scopes
10425                .insert(Scope::EditContainer.as_ref().to_string());
10426        }
10427
10428        #[allow(clippy::single_element_loop)]
10429        for &(find_this, param_name) in [("{+path}", "path")].iter() {
10430            url = params.uri_replacement(url, param_name, find_this, true);
10431        }
10432        {
10433            let to_remove = ["path"];
10434            params.remove_params(&to_remove);
10435        }
10436
10437        let url = params.parse_with_url(&url);
10438
10439        loop {
10440            let token = match self
10441                .hub
10442                .auth
10443                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10444                .await
10445            {
10446                Ok(token) => token,
10447                Err(e) => match dlg.token(e) {
10448                    Ok(token) => token,
10449                    Err(e) => {
10450                        dlg.finished(false);
10451                        return Err(common::Error::MissingToken(e));
10452                    }
10453                },
10454            };
10455            let mut req_result = {
10456                let client = &self.hub.client;
10457                dlg.pre_request();
10458                let mut req_builder = hyper::Request::builder()
10459                    .method(hyper::Method::DELETE)
10460                    .uri(url.as_str())
10461                    .header(USER_AGENT, self.hub._user_agent.clone());
10462
10463                if let Some(token) = token.as_ref() {
10464                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10465                }
10466
10467                let request = req_builder
10468                    .header(CONTENT_LENGTH, 0_u64)
10469                    .body(common::to_body::<String>(None));
10470
10471                client.request(request.unwrap()).await
10472            };
10473
10474            match req_result {
10475                Err(err) => {
10476                    if let common::Retry::After(d) = dlg.http_error(&err) {
10477                        sleep(d).await;
10478                        continue;
10479                    }
10480                    dlg.finished(false);
10481                    return Err(common::Error::HttpError(err));
10482                }
10483                Ok(res) => {
10484                    let (mut parts, body) = res.into_parts();
10485                    let mut body = common::Body::new(body);
10486                    if !parts.status.is_success() {
10487                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10488                        let error = serde_json::from_str(&common::to_string(&bytes));
10489                        let response = common::to_response(parts, bytes.into());
10490
10491                        if let common::Retry::After(d) =
10492                            dlg.http_failure(&response, error.as_ref().ok())
10493                        {
10494                            sleep(d).await;
10495                            continue;
10496                        }
10497
10498                        dlg.finished(false);
10499
10500                        return Err(match error {
10501                            Ok(value) => common::Error::BadRequest(value),
10502                            _ => common::Error::Failure(response),
10503                        });
10504                    }
10505                    let response = common::Response::from_parts(parts, body);
10506
10507                    dlg.finished(true);
10508                    return Ok(response);
10509                }
10510            }
10511        }
10512    }
10513
10514    /// GTM BuiltInVariable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/built_in_variables
10515    ///
10516    /// Sets the *path* path property to the given value.
10517    ///
10518    /// Even though the property as already been set when instantiating this call,
10519    /// we provide this method for API completeness.
10520    pub fn path(
10521        mut self,
10522        new_value: &str,
10523    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10524        self._path = new_value.to_string();
10525        self
10526    }
10527    /// The types of built-in variables to delete.
10528    ///
10529    /// Append the given value to the *type* query property.
10530    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10531    pub fn add_type(
10532        mut self,
10533        new_value: &str,
10534    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10535        self._type_.push(new_value.to_string());
10536        self
10537    }
10538    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10539    /// while executing the actual API request.
10540    ///
10541    /// ````text
10542    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10543    /// ````
10544    ///
10545    /// Sets the *delegate* property to the given value.
10546    pub fn delegate(
10547        mut self,
10548        new_value: &'a mut dyn common::Delegate,
10549    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10550        self._delegate = Some(new_value);
10551        self
10552    }
10553
10554    /// Set any additional parameter of the query string used in the request.
10555    /// It should be used to set parameters which are not yet available through their own
10556    /// setters.
10557    ///
10558    /// Please note that this method must not be used to set any of the known parameters
10559    /// which have their own setter method. If done anyway, the request will fail.
10560    ///
10561    /// # Additional Parameters
10562    ///
10563    /// * *$.xgafv* (query-string) - V1 error format.
10564    /// * *access_token* (query-string) - OAuth access token.
10565    /// * *alt* (query-string) - Data format for response.
10566    /// * *callback* (query-string) - JSONP
10567    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10568    /// * *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.
10569    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10570    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10571    /// * *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.
10572    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10573    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10574    pub fn param<T>(
10575        mut self,
10576        name: T,
10577        value: T,
10578    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10579    where
10580        T: AsRef<str>,
10581    {
10582        self._additional_params
10583            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10584        self
10585    }
10586
10587    /// Identifies the authorization scope for the method you are building.
10588    ///
10589    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10590    /// [`Scope::EditContainer`].
10591    ///
10592    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10593    /// tokens for more than one scope.
10594    ///
10595    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10596    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10597    /// sufficient, a read-write scope will do as well.
10598    pub fn add_scope<St>(
10599        mut self,
10600        scope: St,
10601    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10602    where
10603        St: AsRef<str>,
10604    {
10605        self._scopes.insert(String::from(scope.as_ref()));
10606        self
10607    }
10608    /// Identifies the authorization scope(s) for the method you are building.
10609    ///
10610    /// See [`Self::add_scope()`] for details.
10611    pub fn add_scopes<I, St>(
10612        mut self,
10613        scopes: I,
10614    ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10615    where
10616        I: IntoIterator<Item = St>,
10617        St: AsRef<str>,
10618    {
10619        self._scopes
10620            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10621        self
10622    }
10623
10624    /// Removes all scopes, and no default scope will be used either.
10625    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10626    /// for details).
10627    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10628        self._scopes.clear();
10629        self
10630    }
10631}
10632
10633/// Lists all the enabled Built-In Variables of a GTM Container.
10634///
10635/// A builder for the *containers.workspaces.built_in_variables.list* method supported by a *account* resource.
10636/// It is not used directly, but through a [`AccountMethods`] instance.
10637///
10638/// # Example
10639///
10640/// Instantiate a resource method builder
10641///
10642/// ```test_harness,no_run
10643/// # extern crate hyper;
10644/// # extern crate hyper_rustls;
10645/// # extern crate google_tagmanager2 as tagmanager2;
10646/// # async fn dox() {
10647/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10648///
10649/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10650/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10651/// #     secret,
10652/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10653/// # ).build().await.unwrap();
10654///
10655/// # let client = hyper_util::client::legacy::Client::builder(
10656/// #     hyper_util::rt::TokioExecutor::new()
10657/// # )
10658/// # .build(
10659/// #     hyper_rustls::HttpsConnectorBuilder::new()
10660/// #         .with_native_roots()
10661/// #         .unwrap()
10662/// #         .https_or_http()
10663/// #         .enable_http1()
10664/// #         .build()
10665/// # );
10666/// # let mut hub = TagManager::new(client, auth);
10667/// // You can configure optional parameters by calling the respective setters at will, and
10668/// // execute the final call using `doit()`.
10669/// // Values shown here are possibly random and not representative !
10670/// let result = hub.accounts().containers_workspaces_built_in_variables_list("parent")
10671///              .page_token("dolor")
10672///              .doit().await;
10673/// # }
10674/// ```
10675pub struct AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
10676where
10677    C: 'a,
10678{
10679    hub: &'a TagManager<C>,
10680    _parent: String,
10681    _page_token: Option<String>,
10682    _delegate: Option<&'a mut dyn common::Delegate>,
10683    _additional_params: HashMap<String, String>,
10684    _scopes: BTreeSet<String>,
10685}
10686
10687impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {}
10688
10689impl<'a, C> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
10690where
10691    C: common::Connector,
10692{
10693    /// Perform the operation you have build so far.
10694    pub async fn doit(
10695        mut self,
10696    ) -> common::Result<(common::Response, ListEnabledBuiltInVariablesResponse)> {
10697        use std::borrow::Cow;
10698        use std::io::{Read, Seek};
10699
10700        use common::{url::Params, ToParts};
10701        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10702
10703        let mut dd = common::DefaultDelegate;
10704        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10705        dlg.begin(common::MethodInfo {
10706            id: "tagmanager.accounts.containers.workspaces.built_in_variables.list",
10707            http_method: hyper::Method::GET,
10708        });
10709
10710        for &field in ["alt", "parent", "pageToken"].iter() {
10711            if self._additional_params.contains_key(field) {
10712                dlg.finished(false);
10713                return Err(common::Error::FieldClash(field));
10714            }
10715        }
10716
10717        let mut params = Params::with_capacity(4 + self._additional_params.len());
10718        params.push("parent", self._parent);
10719        if let Some(value) = self._page_token.as_ref() {
10720            params.push("pageToken", value);
10721        }
10722
10723        params.extend(self._additional_params.iter());
10724
10725        params.push("alt", "json");
10726        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/built_in_variables";
10727        if self._scopes.is_empty() {
10728            self._scopes.insert(Scope::Readonly.as_ref().to_string());
10729        }
10730
10731        #[allow(clippy::single_element_loop)]
10732        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10733            url = params.uri_replacement(url, param_name, find_this, true);
10734        }
10735        {
10736            let to_remove = ["parent"];
10737            params.remove_params(&to_remove);
10738        }
10739
10740        let url = params.parse_with_url(&url);
10741
10742        loop {
10743            let token = match self
10744                .hub
10745                .auth
10746                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10747                .await
10748            {
10749                Ok(token) => token,
10750                Err(e) => match dlg.token(e) {
10751                    Ok(token) => token,
10752                    Err(e) => {
10753                        dlg.finished(false);
10754                        return Err(common::Error::MissingToken(e));
10755                    }
10756                },
10757            };
10758            let mut req_result = {
10759                let client = &self.hub.client;
10760                dlg.pre_request();
10761                let mut req_builder = hyper::Request::builder()
10762                    .method(hyper::Method::GET)
10763                    .uri(url.as_str())
10764                    .header(USER_AGENT, self.hub._user_agent.clone());
10765
10766                if let Some(token) = token.as_ref() {
10767                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10768                }
10769
10770                let request = req_builder
10771                    .header(CONTENT_LENGTH, 0_u64)
10772                    .body(common::to_body::<String>(None));
10773
10774                client.request(request.unwrap()).await
10775            };
10776
10777            match req_result {
10778                Err(err) => {
10779                    if let common::Retry::After(d) = dlg.http_error(&err) {
10780                        sleep(d).await;
10781                        continue;
10782                    }
10783                    dlg.finished(false);
10784                    return Err(common::Error::HttpError(err));
10785                }
10786                Ok(res) => {
10787                    let (mut parts, body) = res.into_parts();
10788                    let mut body = common::Body::new(body);
10789                    if !parts.status.is_success() {
10790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10791                        let error = serde_json::from_str(&common::to_string(&bytes));
10792                        let response = common::to_response(parts, bytes.into());
10793
10794                        if let common::Retry::After(d) =
10795                            dlg.http_failure(&response, error.as_ref().ok())
10796                        {
10797                            sleep(d).await;
10798                            continue;
10799                        }
10800
10801                        dlg.finished(false);
10802
10803                        return Err(match error {
10804                            Ok(value) => common::Error::BadRequest(value),
10805                            _ => common::Error::Failure(response),
10806                        });
10807                    }
10808                    let response = {
10809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10810                        let encoded = common::to_string(&bytes);
10811                        match serde_json::from_str(&encoded) {
10812                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10813                            Err(error) => {
10814                                dlg.response_json_decode_error(&encoded, &error);
10815                                return Err(common::Error::JsonDecodeError(
10816                                    encoded.to_string(),
10817                                    error,
10818                                ));
10819                            }
10820                        }
10821                    };
10822
10823                    dlg.finished(true);
10824                    return Ok(response);
10825                }
10826            }
10827        }
10828    }
10829
10830    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
10831    ///
10832    /// Sets the *parent* path property to the given value.
10833    ///
10834    /// Even though the property as already been set when instantiating this call,
10835    /// we provide this method for API completeness.
10836    pub fn parent(
10837        mut self,
10838        new_value: &str,
10839    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
10840        self._parent = new_value.to_string();
10841        self
10842    }
10843    /// Continuation token for fetching the next page of results.
10844    ///
10845    /// Sets the *page token* query property to the given value.
10846    pub fn page_token(
10847        mut self,
10848        new_value: &str,
10849    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
10850        self._page_token = Some(new_value.to_string());
10851        self
10852    }
10853    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10854    /// while executing the actual API request.
10855    ///
10856    /// ````text
10857    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10858    /// ````
10859    ///
10860    /// Sets the *delegate* property to the given value.
10861    pub fn delegate(
10862        mut self,
10863        new_value: &'a mut dyn common::Delegate,
10864    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
10865        self._delegate = Some(new_value);
10866        self
10867    }
10868
10869    /// Set any additional parameter of the query string used in the request.
10870    /// It should be used to set parameters which are not yet available through their own
10871    /// setters.
10872    ///
10873    /// Please note that this method must not be used to set any of the known parameters
10874    /// which have their own setter method. If done anyway, the request will fail.
10875    ///
10876    /// # Additional Parameters
10877    ///
10878    /// * *$.xgafv* (query-string) - V1 error format.
10879    /// * *access_token* (query-string) - OAuth access token.
10880    /// * *alt* (query-string) - Data format for response.
10881    /// * *callback* (query-string) - JSONP
10882    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10883    /// * *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.
10884    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10885    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10886    /// * *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.
10887    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10888    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10889    pub fn param<T>(
10890        mut self,
10891        name: T,
10892        value: T,
10893    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
10894    where
10895        T: AsRef<str>,
10896    {
10897        self._additional_params
10898            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10899        self
10900    }
10901
10902    /// Identifies the authorization scope for the method you are building.
10903    ///
10904    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10905    /// [`Scope::Readonly`].
10906    ///
10907    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10908    /// tokens for more than one scope.
10909    ///
10910    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10911    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10912    /// sufficient, a read-write scope will do as well.
10913    pub fn add_scope<St>(
10914        mut self,
10915        scope: St,
10916    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
10917    where
10918        St: AsRef<str>,
10919    {
10920        self._scopes.insert(String::from(scope.as_ref()));
10921        self
10922    }
10923    /// Identifies the authorization scope(s) for the method you are building.
10924    ///
10925    /// See [`Self::add_scope()`] for details.
10926    pub fn add_scopes<I, St>(
10927        mut self,
10928        scopes: I,
10929    ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
10930    where
10931        I: IntoIterator<Item = St>,
10932        St: AsRef<str>,
10933    {
10934        self._scopes
10935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10936        self
10937    }
10938
10939    /// Removes all scopes, and no default scope will be used either.
10940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10941    /// for details).
10942    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
10943        self._scopes.clear();
10944        self
10945    }
10946}
10947
10948/// Reverts changes to a GTM Built-In Variables in a GTM Workspace.
10949///
10950/// A builder for the *containers.workspaces.built_in_variables.revert* method supported by a *account* resource.
10951/// It is not used directly, but through a [`AccountMethods`] instance.
10952///
10953/// # Example
10954///
10955/// Instantiate a resource method builder
10956///
10957/// ```test_harness,no_run
10958/// # extern crate hyper;
10959/// # extern crate hyper_rustls;
10960/// # extern crate google_tagmanager2 as tagmanager2;
10961/// # async fn dox() {
10962/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10963///
10964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10965/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10966/// #     secret,
10967/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10968/// # ).build().await.unwrap();
10969///
10970/// # let client = hyper_util::client::legacy::Client::builder(
10971/// #     hyper_util::rt::TokioExecutor::new()
10972/// # )
10973/// # .build(
10974/// #     hyper_rustls::HttpsConnectorBuilder::new()
10975/// #         .with_native_roots()
10976/// #         .unwrap()
10977/// #         .https_or_http()
10978/// #         .enable_http1()
10979/// #         .build()
10980/// # );
10981/// # let mut hub = TagManager::new(client, auth);
10982/// // You can configure optional parameters by calling the respective setters at will, and
10983/// // execute the final call using `doit()`.
10984/// // Values shown here are possibly random and not representative !
10985/// let result = hub.accounts().containers_workspaces_built_in_variables_revert("path")
10986///              .type_("vero")
10987///              .doit().await;
10988/// # }
10989/// ```
10990pub struct AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
10991where
10992    C: 'a,
10993{
10994    hub: &'a TagManager<C>,
10995    _path: String,
10996    _type_: Option<String>,
10997    _delegate: Option<&'a mut dyn common::Delegate>,
10998    _additional_params: HashMap<String, String>,
10999    _scopes: BTreeSet<String>,
11000}
11001
11002impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {}
11003
11004impl<'a, C> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11005where
11006    C: common::Connector,
11007{
11008    /// Perform the operation you have build so far.
11009    pub async fn doit(
11010        mut self,
11011    ) -> common::Result<(common::Response, RevertBuiltInVariableResponse)> {
11012        use std::borrow::Cow;
11013        use std::io::{Read, Seek};
11014
11015        use common::{url::Params, ToParts};
11016        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11017
11018        let mut dd = common::DefaultDelegate;
11019        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11020        dlg.begin(common::MethodInfo {
11021            id: "tagmanager.accounts.containers.workspaces.built_in_variables.revert",
11022            http_method: hyper::Method::POST,
11023        });
11024
11025        for &field in ["alt", "path", "type"].iter() {
11026            if self._additional_params.contains_key(field) {
11027                dlg.finished(false);
11028                return Err(common::Error::FieldClash(field));
11029            }
11030        }
11031
11032        let mut params = Params::with_capacity(4 + self._additional_params.len());
11033        params.push("path", self._path);
11034        if let Some(value) = self._type_.as_ref() {
11035            params.push("type", value);
11036        }
11037
11038        params.extend(self._additional_params.iter());
11039
11040        params.push("alt", "json");
11041        let mut url =
11042            self.hub._base_url.clone() + "tagmanager/v2/{+path}/built_in_variables:revert";
11043        if self._scopes.is_empty() {
11044            self._scopes
11045                .insert(Scope::EditContainer.as_ref().to_string());
11046        }
11047
11048        #[allow(clippy::single_element_loop)]
11049        for &(find_this, param_name) in [("{+path}", "path")].iter() {
11050            url = params.uri_replacement(url, param_name, find_this, true);
11051        }
11052        {
11053            let to_remove = ["path"];
11054            params.remove_params(&to_remove);
11055        }
11056
11057        let url = params.parse_with_url(&url);
11058
11059        loop {
11060            let token = match self
11061                .hub
11062                .auth
11063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11064                .await
11065            {
11066                Ok(token) => token,
11067                Err(e) => match dlg.token(e) {
11068                    Ok(token) => token,
11069                    Err(e) => {
11070                        dlg.finished(false);
11071                        return Err(common::Error::MissingToken(e));
11072                    }
11073                },
11074            };
11075            let mut req_result = {
11076                let client = &self.hub.client;
11077                dlg.pre_request();
11078                let mut req_builder = hyper::Request::builder()
11079                    .method(hyper::Method::POST)
11080                    .uri(url.as_str())
11081                    .header(USER_AGENT, self.hub._user_agent.clone());
11082
11083                if let Some(token) = token.as_ref() {
11084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11085                }
11086
11087                let request = req_builder
11088                    .header(CONTENT_LENGTH, 0_u64)
11089                    .body(common::to_body::<String>(None));
11090
11091                client.request(request.unwrap()).await
11092            };
11093
11094            match req_result {
11095                Err(err) => {
11096                    if let common::Retry::After(d) = dlg.http_error(&err) {
11097                        sleep(d).await;
11098                        continue;
11099                    }
11100                    dlg.finished(false);
11101                    return Err(common::Error::HttpError(err));
11102                }
11103                Ok(res) => {
11104                    let (mut parts, body) = res.into_parts();
11105                    let mut body = common::Body::new(body);
11106                    if !parts.status.is_success() {
11107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11108                        let error = serde_json::from_str(&common::to_string(&bytes));
11109                        let response = common::to_response(parts, bytes.into());
11110
11111                        if let common::Retry::After(d) =
11112                            dlg.http_failure(&response, error.as_ref().ok())
11113                        {
11114                            sleep(d).await;
11115                            continue;
11116                        }
11117
11118                        dlg.finished(false);
11119
11120                        return Err(match error {
11121                            Ok(value) => common::Error::BadRequest(value),
11122                            _ => common::Error::Failure(response),
11123                        });
11124                    }
11125                    let response = {
11126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11127                        let encoded = common::to_string(&bytes);
11128                        match serde_json::from_str(&encoded) {
11129                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11130                            Err(error) => {
11131                                dlg.response_json_decode_error(&encoded, &error);
11132                                return Err(common::Error::JsonDecodeError(
11133                                    encoded.to_string(),
11134                                    error,
11135                                ));
11136                            }
11137                        }
11138                    };
11139
11140                    dlg.finished(true);
11141                    return Ok(response);
11142                }
11143            }
11144        }
11145    }
11146
11147    /// GTM BuiltInVariable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/built_in_variables
11148    ///
11149    /// Sets the *path* path property to the given value.
11150    ///
11151    /// Even though the property as already been set when instantiating this call,
11152    /// we provide this method for API completeness.
11153    pub fn path(
11154        mut self,
11155        new_value: &str,
11156    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11157        self._path = new_value.to_string();
11158        self
11159    }
11160    /// The type of built-in variable to revert.
11161    ///
11162    /// Sets the *type* query property to the given value.
11163    pub fn type_(
11164        mut self,
11165        new_value: &str,
11166    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11167        self._type_ = Some(new_value.to_string());
11168        self
11169    }
11170    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11171    /// while executing the actual API request.
11172    ///
11173    /// ````text
11174    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11175    /// ````
11176    ///
11177    /// Sets the *delegate* property to the given value.
11178    pub fn delegate(
11179        mut self,
11180        new_value: &'a mut dyn common::Delegate,
11181    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11182        self._delegate = Some(new_value);
11183        self
11184    }
11185
11186    /// Set any additional parameter of the query string used in the request.
11187    /// It should be used to set parameters which are not yet available through their own
11188    /// setters.
11189    ///
11190    /// Please note that this method must not be used to set any of the known parameters
11191    /// which have their own setter method. If done anyway, the request will fail.
11192    ///
11193    /// # Additional Parameters
11194    ///
11195    /// * *$.xgafv* (query-string) - V1 error format.
11196    /// * *access_token* (query-string) - OAuth access token.
11197    /// * *alt* (query-string) - Data format for response.
11198    /// * *callback* (query-string) - JSONP
11199    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11200    /// * *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.
11201    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11202    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11203    /// * *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.
11204    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11205    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11206    pub fn param<T>(
11207        mut self,
11208        name: T,
11209        value: T,
11210    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11211    where
11212        T: AsRef<str>,
11213    {
11214        self._additional_params
11215            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11216        self
11217    }
11218
11219    /// Identifies the authorization scope for the method you are building.
11220    ///
11221    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11222    /// [`Scope::EditContainer`].
11223    ///
11224    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11225    /// tokens for more than one scope.
11226    ///
11227    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11228    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11229    /// sufficient, a read-write scope will do as well.
11230    pub fn add_scope<St>(
11231        mut self,
11232        scope: St,
11233    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11234    where
11235        St: AsRef<str>,
11236    {
11237        self._scopes.insert(String::from(scope.as_ref()));
11238        self
11239    }
11240    /// Identifies the authorization scope(s) for the method you are building.
11241    ///
11242    /// See [`Self::add_scope()`] for details.
11243    pub fn add_scopes<I, St>(
11244        mut self,
11245        scopes: I,
11246    ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11247    where
11248        I: IntoIterator<Item = St>,
11249        St: AsRef<str>,
11250    {
11251        self._scopes
11252            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11253        self
11254    }
11255
11256    /// Removes all scopes, and no default scope will be used either.
11257    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11258    /// for details).
11259    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11260        self._scopes.clear();
11261        self
11262    }
11263}
11264
11265/// Creates a GTM Client.
11266///
11267/// A builder for the *containers.workspaces.clients.create* method supported by a *account* resource.
11268/// It is not used directly, but through a [`AccountMethods`] instance.
11269///
11270/// # Example
11271///
11272/// Instantiate a resource method builder
11273///
11274/// ```test_harness,no_run
11275/// # extern crate hyper;
11276/// # extern crate hyper_rustls;
11277/// # extern crate google_tagmanager2 as tagmanager2;
11278/// use tagmanager2::api::Client;
11279/// # async fn dox() {
11280/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11281///
11282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11284/// #     secret,
11285/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11286/// # ).build().await.unwrap();
11287///
11288/// # let client = hyper_util::client::legacy::Client::builder(
11289/// #     hyper_util::rt::TokioExecutor::new()
11290/// # )
11291/// # .build(
11292/// #     hyper_rustls::HttpsConnectorBuilder::new()
11293/// #         .with_native_roots()
11294/// #         .unwrap()
11295/// #         .https_or_http()
11296/// #         .enable_http1()
11297/// #         .build()
11298/// # );
11299/// # let mut hub = TagManager::new(client, auth);
11300/// // As the method needs a request, you would usually fill it with the desired information
11301/// // into the respective structure. Some of the parts shown here might not be applicable !
11302/// // Values shown here are possibly random and not representative !
11303/// let mut req = Client::default();
11304///
11305/// // You can configure optional parameters by calling the respective setters at will, and
11306/// // execute the final call using `doit()`.
11307/// // Values shown here are possibly random and not representative !
11308/// let result = hub.accounts().containers_workspaces_clients_create(req, "parent")
11309///              .doit().await;
11310/// # }
11311/// ```
11312pub struct AccountContainerWorkspaceClientCreateCall<'a, C>
11313where
11314    C: 'a,
11315{
11316    hub: &'a TagManager<C>,
11317    _request: Client,
11318    _parent: String,
11319    _delegate: Option<&'a mut dyn common::Delegate>,
11320    _additional_params: HashMap<String, String>,
11321    _scopes: BTreeSet<String>,
11322}
11323
11324impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientCreateCall<'a, C> {}
11325
11326impl<'a, C> AccountContainerWorkspaceClientCreateCall<'a, C>
11327where
11328    C: common::Connector,
11329{
11330    /// Perform the operation you have build so far.
11331    pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
11332        use std::borrow::Cow;
11333        use std::io::{Read, Seek};
11334
11335        use common::{url::Params, ToParts};
11336        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11337
11338        let mut dd = common::DefaultDelegate;
11339        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11340        dlg.begin(common::MethodInfo {
11341            id: "tagmanager.accounts.containers.workspaces.clients.create",
11342            http_method: hyper::Method::POST,
11343        });
11344
11345        for &field in ["alt", "parent"].iter() {
11346            if self._additional_params.contains_key(field) {
11347                dlg.finished(false);
11348                return Err(common::Error::FieldClash(field));
11349            }
11350        }
11351
11352        let mut params = Params::with_capacity(4 + self._additional_params.len());
11353        params.push("parent", self._parent);
11354
11355        params.extend(self._additional_params.iter());
11356
11357        params.push("alt", "json");
11358        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/clients";
11359        if self._scopes.is_empty() {
11360            self._scopes
11361                .insert(Scope::EditContainer.as_ref().to_string());
11362        }
11363
11364        #[allow(clippy::single_element_loop)]
11365        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11366            url = params.uri_replacement(url, param_name, find_this, true);
11367        }
11368        {
11369            let to_remove = ["parent"];
11370            params.remove_params(&to_remove);
11371        }
11372
11373        let url = params.parse_with_url(&url);
11374
11375        let mut json_mime_type = mime::APPLICATION_JSON;
11376        let mut request_value_reader = {
11377            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11378            common::remove_json_null_values(&mut value);
11379            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11380            serde_json::to_writer(&mut dst, &value).unwrap();
11381            dst
11382        };
11383        let request_size = request_value_reader
11384            .seek(std::io::SeekFrom::End(0))
11385            .unwrap();
11386        request_value_reader
11387            .seek(std::io::SeekFrom::Start(0))
11388            .unwrap();
11389
11390        loop {
11391            let token = match self
11392                .hub
11393                .auth
11394                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11395                .await
11396            {
11397                Ok(token) => token,
11398                Err(e) => match dlg.token(e) {
11399                    Ok(token) => token,
11400                    Err(e) => {
11401                        dlg.finished(false);
11402                        return Err(common::Error::MissingToken(e));
11403                    }
11404                },
11405            };
11406            request_value_reader
11407                .seek(std::io::SeekFrom::Start(0))
11408                .unwrap();
11409            let mut req_result = {
11410                let client = &self.hub.client;
11411                dlg.pre_request();
11412                let mut req_builder = hyper::Request::builder()
11413                    .method(hyper::Method::POST)
11414                    .uri(url.as_str())
11415                    .header(USER_AGENT, self.hub._user_agent.clone());
11416
11417                if let Some(token) = token.as_ref() {
11418                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11419                }
11420
11421                let request = req_builder
11422                    .header(CONTENT_TYPE, json_mime_type.to_string())
11423                    .header(CONTENT_LENGTH, request_size as u64)
11424                    .body(common::to_body(
11425                        request_value_reader.get_ref().clone().into(),
11426                    ));
11427
11428                client.request(request.unwrap()).await
11429            };
11430
11431            match req_result {
11432                Err(err) => {
11433                    if let common::Retry::After(d) = dlg.http_error(&err) {
11434                        sleep(d).await;
11435                        continue;
11436                    }
11437                    dlg.finished(false);
11438                    return Err(common::Error::HttpError(err));
11439                }
11440                Ok(res) => {
11441                    let (mut parts, body) = res.into_parts();
11442                    let mut body = common::Body::new(body);
11443                    if !parts.status.is_success() {
11444                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11445                        let error = serde_json::from_str(&common::to_string(&bytes));
11446                        let response = common::to_response(parts, bytes.into());
11447
11448                        if let common::Retry::After(d) =
11449                            dlg.http_failure(&response, error.as_ref().ok())
11450                        {
11451                            sleep(d).await;
11452                            continue;
11453                        }
11454
11455                        dlg.finished(false);
11456
11457                        return Err(match error {
11458                            Ok(value) => common::Error::BadRequest(value),
11459                            _ => common::Error::Failure(response),
11460                        });
11461                    }
11462                    let response = {
11463                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11464                        let encoded = common::to_string(&bytes);
11465                        match serde_json::from_str(&encoded) {
11466                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11467                            Err(error) => {
11468                                dlg.response_json_decode_error(&encoded, &error);
11469                                return Err(common::Error::JsonDecodeError(
11470                                    encoded.to_string(),
11471                                    error,
11472                                ));
11473                            }
11474                        }
11475                    };
11476
11477                    dlg.finished(true);
11478                    return Ok(response);
11479                }
11480            }
11481        }
11482    }
11483
11484    ///
11485    /// Sets the *request* property to the given value.
11486    ///
11487    /// Even though the property as already been set when instantiating this call,
11488    /// we provide this method for API completeness.
11489    pub fn request(
11490        mut self,
11491        new_value: Client,
11492    ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11493        self._request = new_value;
11494        self
11495    }
11496    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
11497    ///
11498    /// Sets the *parent* path property to the given value.
11499    ///
11500    /// Even though the property as already been set when instantiating this call,
11501    /// we provide this method for API completeness.
11502    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11503        self._parent = new_value.to_string();
11504        self
11505    }
11506    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11507    /// while executing the actual API request.
11508    ///
11509    /// ````text
11510    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11511    /// ````
11512    ///
11513    /// Sets the *delegate* property to the given value.
11514    pub fn delegate(
11515        mut self,
11516        new_value: &'a mut dyn common::Delegate,
11517    ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11518        self._delegate = Some(new_value);
11519        self
11520    }
11521
11522    /// Set any additional parameter of the query string used in the request.
11523    /// It should be used to set parameters which are not yet available through their own
11524    /// setters.
11525    ///
11526    /// Please note that this method must not be used to set any of the known parameters
11527    /// which have their own setter method. If done anyway, the request will fail.
11528    ///
11529    /// # Additional Parameters
11530    ///
11531    /// * *$.xgafv* (query-string) - V1 error format.
11532    /// * *access_token* (query-string) - OAuth access token.
11533    /// * *alt* (query-string) - Data format for response.
11534    /// * *callback* (query-string) - JSONP
11535    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11536    /// * *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.
11537    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11538    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11539    /// * *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.
11540    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11541    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11542    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11543    where
11544        T: AsRef<str>,
11545    {
11546        self._additional_params
11547            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11548        self
11549    }
11550
11551    /// Identifies the authorization scope for the method you are building.
11552    ///
11553    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11554    /// [`Scope::EditContainer`].
11555    ///
11556    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11557    /// tokens for more than one scope.
11558    ///
11559    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11560    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11561    /// sufficient, a read-write scope will do as well.
11562    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11563    where
11564        St: AsRef<str>,
11565    {
11566        self._scopes.insert(String::from(scope.as_ref()));
11567        self
11568    }
11569    /// Identifies the authorization scope(s) for the method you are building.
11570    ///
11571    /// See [`Self::add_scope()`] for details.
11572    pub fn add_scopes<I, St>(
11573        mut self,
11574        scopes: I,
11575    ) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11576    where
11577        I: IntoIterator<Item = St>,
11578        St: AsRef<str>,
11579    {
11580        self._scopes
11581            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11582        self
11583    }
11584
11585    /// Removes all scopes, and no default scope will be used either.
11586    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11587    /// for details).
11588    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11589        self._scopes.clear();
11590        self
11591    }
11592}
11593
11594/// Deletes a GTM Client.
11595///
11596/// A builder for the *containers.workspaces.clients.delete* method supported by a *account* resource.
11597/// It is not used directly, but through a [`AccountMethods`] instance.
11598///
11599/// # Example
11600///
11601/// Instantiate a resource method builder
11602///
11603/// ```test_harness,no_run
11604/// # extern crate hyper;
11605/// # extern crate hyper_rustls;
11606/// # extern crate google_tagmanager2 as tagmanager2;
11607/// # async fn dox() {
11608/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11609///
11610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11611/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11612/// #     secret,
11613/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11614/// # ).build().await.unwrap();
11615///
11616/// # let client = hyper_util::client::legacy::Client::builder(
11617/// #     hyper_util::rt::TokioExecutor::new()
11618/// # )
11619/// # .build(
11620/// #     hyper_rustls::HttpsConnectorBuilder::new()
11621/// #         .with_native_roots()
11622/// #         .unwrap()
11623/// #         .https_or_http()
11624/// #         .enable_http1()
11625/// #         .build()
11626/// # );
11627/// # let mut hub = TagManager::new(client, auth);
11628/// // You can configure optional parameters by calling the respective setters at will, and
11629/// // execute the final call using `doit()`.
11630/// // Values shown here are possibly random and not representative !
11631/// let result = hub.accounts().containers_workspaces_clients_delete("path")
11632///              .doit().await;
11633/// # }
11634/// ```
11635pub struct AccountContainerWorkspaceClientDeleteCall<'a, C>
11636where
11637    C: 'a,
11638{
11639    hub: &'a TagManager<C>,
11640    _path: String,
11641    _delegate: Option<&'a mut dyn common::Delegate>,
11642    _additional_params: HashMap<String, String>,
11643    _scopes: BTreeSet<String>,
11644}
11645
11646impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientDeleteCall<'a, C> {}
11647
11648impl<'a, C> AccountContainerWorkspaceClientDeleteCall<'a, C>
11649where
11650    C: common::Connector,
11651{
11652    /// Perform the operation you have build so far.
11653    pub async fn doit(mut self) -> common::Result<common::Response> {
11654        use std::borrow::Cow;
11655        use std::io::{Read, Seek};
11656
11657        use common::{url::Params, ToParts};
11658        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11659
11660        let mut dd = common::DefaultDelegate;
11661        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11662        dlg.begin(common::MethodInfo {
11663            id: "tagmanager.accounts.containers.workspaces.clients.delete",
11664            http_method: hyper::Method::DELETE,
11665        });
11666
11667        for &field in ["path"].iter() {
11668            if self._additional_params.contains_key(field) {
11669                dlg.finished(false);
11670                return Err(common::Error::FieldClash(field));
11671            }
11672        }
11673
11674        let mut params = Params::with_capacity(2 + self._additional_params.len());
11675        params.push("path", self._path);
11676
11677        params.extend(self._additional_params.iter());
11678
11679        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
11680        if self._scopes.is_empty() {
11681            self._scopes
11682                .insert(Scope::EditContainer.as_ref().to_string());
11683        }
11684
11685        #[allow(clippy::single_element_loop)]
11686        for &(find_this, param_name) in [("{+path}", "path")].iter() {
11687            url = params.uri_replacement(url, param_name, find_this, true);
11688        }
11689        {
11690            let to_remove = ["path"];
11691            params.remove_params(&to_remove);
11692        }
11693
11694        let url = params.parse_with_url(&url);
11695
11696        loop {
11697            let token = match self
11698                .hub
11699                .auth
11700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11701                .await
11702            {
11703                Ok(token) => token,
11704                Err(e) => match dlg.token(e) {
11705                    Ok(token) => token,
11706                    Err(e) => {
11707                        dlg.finished(false);
11708                        return Err(common::Error::MissingToken(e));
11709                    }
11710                },
11711            };
11712            let mut req_result = {
11713                let client = &self.hub.client;
11714                dlg.pre_request();
11715                let mut req_builder = hyper::Request::builder()
11716                    .method(hyper::Method::DELETE)
11717                    .uri(url.as_str())
11718                    .header(USER_AGENT, self.hub._user_agent.clone());
11719
11720                if let Some(token) = token.as_ref() {
11721                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11722                }
11723
11724                let request = req_builder
11725                    .header(CONTENT_LENGTH, 0_u64)
11726                    .body(common::to_body::<String>(None));
11727
11728                client.request(request.unwrap()).await
11729            };
11730
11731            match req_result {
11732                Err(err) => {
11733                    if let common::Retry::After(d) = dlg.http_error(&err) {
11734                        sleep(d).await;
11735                        continue;
11736                    }
11737                    dlg.finished(false);
11738                    return Err(common::Error::HttpError(err));
11739                }
11740                Ok(res) => {
11741                    let (mut parts, body) = res.into_parts();
11742                    let mut body = common::Body::new(body);
11743                    if !parts.status.is_success() {
11744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11745                        let error = serde_json::from_str(&common::to_string(&bytes));
11746                        let response = common::to_response(parts, bytes.into());
11747
11748                        if let common::Retry::After(d) =
11749                            dlg.http_failure(&response, error.as_ref().ok())
11750                        {
11751                            sleep(d).await;
11752                            continue;
11753                        }
11754
11755                        dlg.finished(false);
11756
11757                        return Err(match error {
11758                            Ok(value) => common::Error::BadRequest(value),
11759                            _ => common::Error::Failure(response),
11760                        });
11761                    }
11762                    let response = common::Response::from_parts(parts, body);
11763
11764                    dlg.finished(true);
11765                    return Ok(response);
11766                }
11767            }
11768        }
11769    }
11770
11771    /// GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
11772    ///
11773    /// Sets the *path* path property to the given value.
11774    ///
11775    /// Even though the property as already been set when instantiating this call,
11776    /// we provide this method for API completeness.
11777    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
11778        self._path = new_value.to_string();
11779        self
11780    }
11781    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11782    /// while executing the actual API request.
11783    ///
11784    /// ````text
11785    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11786    /// ````
11787    ///
11788    /// Sets the *delegate* property to the given value.
11789    pub fn delegate(
11790        mut self,
11791        new_value: &'a mut dyn common::Delegate,
11792    ) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
11793        self._delegate = Some(new_value);
11794        self
11795    }
11796
11797    /// Set any additional parameter of the query string used in the request.
11798    /// It should be used to set parameters which are not yet available through their own
11799    /// setters.
11800    ///
11801    /// Please note that this method must not be used to set any of the known parameters
11802    /// which have their own setter method. If done anyway, the request will fail.
11803    ///
11804    /// # Additional Parameters
11805    ///
11806    /// * *$.xgafv* (query-string) - V1 error format.
11807    /// * *access_token* (query-string) - OAuth access token.
11808    /// * *alt* (query-string) - Data format for response.
11809    /// * *callback* (query-string) - JSONP
11810    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11811    /// * *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.
11812    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11813    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11814    /// * *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.
11815    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11816    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11817    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
11818    where
11819        T: AsRef<str>,
11820    {
11821        self._additional_params
11822            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11823        self
11824    }
11825
11826    /// Identifies the authorization scope for the method you are building.
11827    ///
11828    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11829    /// [`Scope::EditContainer`].
11830    ///
11831    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11832    /// tokens for more than one scope.
11833    ///
11834    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11835    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11836    /// sufficient, a read-write scope will do as well.
11837    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
11838    where
11839        St: AsRef<str>,
11840    {
11841        self._scopes.insert(String::from(scope.as_ref()));
11842        self
11843    }
11844    /// Identifies the authorization scope(s) for the method you are building.
11845    ///
11846    /// See [`Self::add_scope()`] for details.
11847    pub fn add_scopes<I, St>(
11848        mut self,
11849        scopes: I,
11850    ) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
11851    where
11852        I: IntoIterator<Item = St>,
11853        St: AsRef<str>,
11854    {
11855        self._scopes
11856            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11857        self
11858    }
11859
11860    /// Removes all scopes, and no default scope will be used either.
11861    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11862    /// for details).
11863    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
11864        self._scopes.clear();
11865        self
11866    }
11867}
11868
11869/// Gets a GTM Client.
11870///
11871/// A builder for the *containers.workspaces.clients.get* method supported by a *account* resource.
11872/// It is not used directly, but through a [`AccountMethods`] instance.
11873///
11874/// # Example
11875///
11876/// Instantiate a resource method builder
11877///
11878/// ```test_harness,no_run
11879/// # extern crate hyper;
11880/// # extern crate hyper_rustls;
11881/// # extern crate google_tagmanager2 as tagmanager2;
11882/// # async fn dox() {
11883/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11884///
11885/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11886/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11887/// #     secret,
11888/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11889/// # ).build().await.unwrap();
11890///
11891/// # let client = hyper_util::client::legacy::Client::builder(
11892/// #     hyper_util::rt::TokioExecutor::new()
11893/// # )
11894/// # .build(
11895/// #     hyper_rustls::HttpsConnectorBuilder::new()
11896/// #         .with_native_roots()
11897/// #         .unwrap()
11898/// #         .https_or_http()
11899/// #         .enable_http1()
11900/// #         .build()
11901/// # );
11902/// # let mut hub = TagManager::new(client, auth);
11903/// // You can configure optional parameters by calling the respective setters at will, and
11904/// // execute the final call using `doit()`.
11905/// // Values shown here are possibly random and not representative !
11906/// let result = hub.accounts().containers_workspaces_clients_get("path")
11907///              .doit().await;
11908/// # }
11909/// ```
11910pub struct AccountContainerWorkspaceClientGetCall<'a, C>
11911where
11912    C: 'a,
11913{
11914    hub: &'a TagManager<C>,
11915    _path: String,
11916    _delegate: Option<&'a mut dyn common::Delegate>,
11917    _additional_params: HashMap<String, String>,
11918    _scopes: BTreeSet<String>,
11919}
11920
11921impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientGetCall<'a, C> {}
11922
11923impl<'a, C> AccountContainerWorkspaceClientGetCall<'a, C>
11924where
11925    C: common::Connector,
11926{
11927    /// Perform the operation you have build so far.
11928    pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
11929        use std::borrow::Cow;
11930        use std::io::{Read, Seek};
11931
11932        use common::{url::Params, ToParts};
11933        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11934
11935        let mut dd = common::DefaultDelegate;
11936        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11937        dlg.begin(common::MethodInfo {
11938            id: "tagmanager.accounts.containers.workspaces.clients.get",
11939            http_method: hyper::Method::GET,
11940        });
11941
11942        for &field in ["alt", "path"].iter() {
11943            if self._additional_params.contains_key(field) {
11944                dlg.finished(false);
11945                return Err(common::Error::FieldClash(field));
11946            }
11947        }
11948
11949        let mut params = Params::with_capacity(3 + self._additional_params.len());
11950        params.push("path", self._path);
11951
11952        params.extend(self._additional_params.iter());
11953
11954        params.push("alt", "json");
11955        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
11956        if self._scopes.is_empty() {
11957            self._scopes.insert(Scope::Readonly.as_ref().to_string());
11958        }
11959
11960        #[allow(clippy::single_element_loop)]
11961        for &(find_this, param_name) in [("{+path}", "path")].iter() {
11962            url = params.uri_replacement(url, param_name, find_this, true);
11963        }
11964        {
11965            let to_remove = ["path"];
11966            params.remove_params(&to_remove);
11967        }
11968
11969        let url = params.parse_with_url(&url);
11970
11971        loop {
11972            let token = match self
11973                .hub
11974                .auth
11975                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11976                .await
11977            {
11978                Ok(token) => token,
11979                Err(e) => match dlg.token(e) {
11980                    Ok(token) => token,
11981                    Err(e) => {
11982                        dlg.finished(false);
11983                        return Err(common::Error::MissingToken(e));
11984                    }
11985                },
11986            };
11987            let mut req_result = {
11988                let client = &self.hub.client;
11989                dlg.pre_request();
11990                let mut req_builder = hyper::Request::builder()
11991                    .method(hyper::Method::GET)
11992                    .uri(url.as_str())
11993                    .header(USER_AGENT, self.hub._user_agent.clone());
11994
11995                if let Some(token) = token.as_ref() {
11996                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11997                }
11998
11999                let request = req_builder
12000                    .header(CONTENT_LENGTH, 0_u64)
12001                    .body(common::to_body::<String>(None));
12002
12003                client.request(request.unwrap()).await
12004            };
12005
12006            match req_result {
12007                Err(err) => {
12008                    if let common::Retry::After(d) = dlg.http_error(&err) {
12009                        sleep(d).await;
12010                        continue;
12011                    }
12012                    dlg.finished(false);
12013                    return Err(common::Error::HttpError(err));
12014                }
12015                Ok(res) => {
12016                    let (mut parts, body) = res.into_parts();
12017                    let mut body = common::Body::new(body);
12018                    if !parts.status.is_success() {
12019                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12020                        let error = serde_json::from_str(&common::to_string(&bytes));
12021                        let response = common::to_response(parts, bytes.into());
12022
12023                        if let common::Retry::After(d) =
12024                            dlg.http_failure(&response, error.as_ref().ok())
12025                        {
12026                            sleep(d).await;
12027                            continue;
12028                        }
12029
12030                        dlg.finished(false);
12031
12032                        return Err(match error {
12033                            Ok(value) => common::Error::BadRequest(value),
12034                            _ => common::Error::Failure(response),
12035                        });
12036                    }
12037                    let response = {
12038                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12039                        let encoded = common::to_string(&bytes);
12040                        match serde_json::from_str(&encoded) {
12041                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12042                            Err(error) => {
12043                                dlg.response_json_decode_error(&encoded, &error);
12044                                return Err(common::Error::JsonDecodeError(
12045                                    encoded.to_string(),
12046                                    error,
12047                                ));
12048                            }
12049                        }
12050                    };
12051
12052                    dlg.finished(true);
12053                    return Ok(response);
12054                }
12055            }
12056        }
12057    }
12058
12059    /// GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
12060    ///
12061    /// Sets the *path* path property to the given value.
12062    ///
12063    /// Even though the property as already been set when instantiating this call,
12064    /// we provide this method for API completeness.
12065    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12066        self._path = new_value.to_string();
12067        self
12068    }
12069    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12070    /// while executing the actual API request.
12071    ///
12072    /// ````text
12073    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12074    /// ````
12075    ///
12076    /// Sets the *delegate* property to the given value.
12077    pub fn delegate(
12078        mut self,
12079        new_value: &'a mut dyn common::Delegate,
12080    ) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12081        self._delegate = Some(new_value);
12082        self
12083    }
12084
12085    /// Set any additional parameter of the query string used in the request.
12086    /// It should be used to set parameters which are not yet available through their own
12087    /// setters.
12088    ///
12089    /// Please note that this method must not be used to set any of the known parameters
12090    /// which have their own setter method. If done anyway, the request will fail.
12091    ///
12092    /// # Additional Parameters
12093    ///
12094    /// * *$.xgafv* (query-string) - V1 error format.
12095    /// * *access_token* (query-string) - OAuth access token.
12096    /// * *alt* (query-string) - Data format for response.
12097    /// * *callback* (query-string) - JSONP
12098    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12099    /// * *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.
12100    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12101    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12102    /// * *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.
12103    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12104    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12105    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientGetCall<'a, C>
12106    where
12107        T: AsRef<str>,
12108    {
12109        self._additional_params
12110            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12111        self
12112    }
12113
12114    /// Identifies the authorization scope for the method you are building.
12115    ///
12116    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12117    /// [`Scope::Readonly`].
12118    ///
12119    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12120    /// tokens for more than one scope.
12121    ///
12122    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12123    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12124    /// sufficient, a read-write scope will do as well.
12125    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientGetCall<'a, C>
12126    where
12127        St: AsRef<str>,
12128    {
12129        self._scopes.insert(String::from(scope.as_ref()));
12130        self
12131    }
12132    /// Identifies the authorization scope(s) for the method you are building.
12133    ///
12134    /// See [`Self::add_scope()`] for details.
12135    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceClientGetCall<'a, C>
12136    where
12137        I: IntoIterator<Item = St>,
12138        St: AsRef<str>,
12139    {
12140        self._scopes
12141            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12142        self
12143    }
12144
12145    /// Removes all scopes, and no default scope will be used either.
12146    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12147    /// for details).
12148    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12149        self._scopes.clear();
12150        self
12151    }
12152}
12153
12154/// Lists all GTM Clients of a GTM container workspace.
12155///
12156/// A builder for the *containers.workspaces.clients.list* method supported by a *account* resource.
12157/// It is not used directly, but through a [`AccountMethods`] instance.
12158///
12159/// # Example
12160///
12161/// Instantiate a resource method builder
12162///
12163/// ```test_harness,no_run
12164/// # extern crate hyper;
12165/// # extern crate hyper_rustls;
12166/// # extern crate google_tagmanager2 as tagmanager2;
12167/// # async fn dox() {
12168/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12169///
12170/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12171/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12172/// #     secret,
12173/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12174/// # ).build().await.unwrap();
12175///
12176/// # let client = hyper_util::client::legacy::Client::builder(
12177/// #     hyper_util::rt::TokioExecutor::new()
12178/// # )
12179/// # .build(
12180/// #     hyper_rustls::HttpsConnectorBuilder::new()
12181/// #         .with_native_roots()
12182/// #         .unwrap()
12183/// #         .https_or_http()
12184/// #         .enable_http1()
12185/// #         .build()
12186/// # );
12187/// # let mut hub = TagManager::new(client, auth);
12188/// // You can configure optional parameters by calling the respective setters at will, and
12189/// // execute the final call using `doit()`.
12190/// // Values shown here are possibly random and not representative !
12191/// let result = hub.accounts().containers_workspaces_clients_list("parent")
12192///              .page_token("elitr")
12193///              .doit().await;
12194/// # }
12195/// ```
12196pub struct AccountContainerWorkspaceClientListCall<'a, C>
12197where
12198    C: 'a,
12199{
12200    hub: &'a TagManager<C>,
12201    _parent: String,
12202    _page_token: Option<String>,
12203    _delegate: Option<&'a mut dyn common::Delegate>,
12204    _additional_params: HashMap<String, String>,
12205    _scopes: BTreeSet<String>,
12206}
12207
12208impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientListCall<'a, C> {}
12209
12210impl<'a, C> AccountContainerWorkspaceClientListCall<'a, C>
12211where
12212    C: common::Connector,
12213{
12214    /// Perform the operation you have build so far.
12215    pub async fn doit(mut self) -> common::Result<(common::Response, ListClientsResponse)> {
12216        use std::borrow::Cow;
12217        use std::io::{Read, Seek};
12218
12219        use common::{url::Params, ToParts};
12220        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12221
12222        let mut dd = common::DefaultDelegate;
12223        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12224        dlg.begin(common::MethodInfo {
12225            id: "tagmanager.accounts.containers.workspaces.clients.list",
12226            http_method: hyper::Method::GET,
12227        });
12228
12229        for &field in ["alt", "parent", "pageToken"].iter() {
12230            if self._additional_params.contains_key(field) {
12231                dlg.finished(false);
12232                return Err(common::Error::FieldClash(field));
12233            }
12234        }
12235
12236        let mut params = Params::with_capacity(4 + self._additional_params.len());
12237        params.push("parent", self._parent);
12238        if let Some(value) = self._page_token.as_ref() {
12239            params.push("pageToken", value);
12240        }
12241
12242        params.extend(self._additional_params.iter());
12243
12244        params.push("alt", "json");
12245        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/clients";
12246        if self._scopes.is_empty() {
12247            self._scopes.insert(Scope::Readonly.as_ref().to_string());
12248        }
12249
12250        #[allow(clippy::single_element_loop)]
12251        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12252            url = params.uri_replacement(url, param_name, find_this, true);
12253        }
12254        {
12255            let to_remove = ["parent"];
12256            params.remove_params(&to_remove);
12257        }
12258
12259        let url = params.parse_with_url(&url);
12260
12261        loop {
12262            let token = match self
12263                .hub
12264                .auth
12265                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12266                .await
12267            {
12268                Ok(token) => token,
12269                Err(e) => match dlg.token(e) {
12270                    Ok(token) => token,
12271                    Err(e) => {
12272                        dlg.finished(false);
12273                        return Err(common::Error::MissingToken(e));
12274                    }
12275                },
12276            };
12277            let mut req_result = {
12278                let client = &self.hub.client;
12279                dlg.pre_request();
12280                let mut req_builder = hyper::Request::builder()
12281                    .method(hyper::Method::GET)
12282                    .uri(url.as_str())
12283                    .header(USER_AGENT, self.hub._user_agent.clone());
12284
12285                if let Some(token) = token.as_ref() {
12286                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12287                }
12288
12289                let request = req_builder
12290                    .header(CONTENT_LENGTH, 0_u64)
12291                    .body(common::to_body::<String>(None));
12292
12293                client.request(request.unwrap()).await
12294            };
12295
12296            match req_result {
12297                Err(err) => {
12298                    if let common::Retry::After(d) = dlg.http_error(&err) {
12299                        sleep(d).await;
12300                        continue;
12301                    }
12302                    dlg.finished(false);
12303                    return Err(common::Error::HttpError(err));
12304                }
12305                Ok(res) => {
12306                    let (mut parts, body) = res.into_parts();
12307                    let mut body = common::Body::new(body);
12308                    if !parts.status.is_success() {
12309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12310                        let error = serde_json::from_str(&common::to_string(&bytes));
12311                        let response = common::to_response(parts, bytes.into());
12312
12313                        if let common::Retry::After(d) =
12314                            dlg.http_failure(&response, error.as_ref().ok())
12315                        {
12316                            sleep(d).await;
12317                            continue;
12318                        }
12319
12320                        dlg.finished(false);
12321
12322                        return Err(match error {
12323                            Ok(value) => common::Error::BadRequest(value),
12324                            _ => common::Error::Failure(response),
12325                        });
12326                    }
12327                    let response = {
12328                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12329                        let encoded = common::to_string(&bytes);
12330                        match serde_json::from_str(&encoded) {
12331                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12332                            Err(error) => {
12333                                dlg.response_json_decode_error(&encoded, &error);
12334                                return Err(common::Error::JsonDecodeError(
12335                                    encoded.to_string(),
12336                                    error,
12337                                ));
12338                            }
12339                        }
12340                    };
12341
12342                    dlg.finished(true);
12343                    return Ok(response);
12344                }
12345            }
12346        }
12347    }
12348
12349    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
12350    ///
12351    /// Sets the *parent* path property to the given value.
12352    ///
12353    /// Even though the property as already been set when instantiating this call,
12354    /// we provide this method for API completeness.
12355    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceClientListCall<'a, C> {
12356        self._parent = new_value.to_string();
12357        self
12358    }
12359    /// Continuation token for fetching the next page of results.
12360    ///
12361    /// Sets the *page token* query property to the given value.
12362    pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceClientListCall<'a, C> {
12363        self._page_token = Some(new_value.to_string());
12364        self
12365    }
12366    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12367    /// while executing the actual API request.
12368    ///
12369    /// ````text
12370    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12371    /// ````
12372    ///
12373    /// Sets the *delegate* property to the given value.
12374    pub fn delegate(
12375        mut self,
12376        new_value: &'a mut dyn common::Delegate,
12377    ) -> AccountContainerWorkspaceClientListCall<'a, C> {
12378        self._delegate = Some(new_value);
12379        self
12380    }
12381
12382    /// Set any additional parameter of the query string used in the request.
12383    /// It should be used to set parameters which are not yet available through their own
12384    /// setters.
12385    ///
12386    /// Please note that this method must not be used to set any of the known parameters
12387    /// which have their own setter method. If done anyway, the request will fail.
12388    ///
12389    /// # Additional Parameters
12390    ///
12391    /// * *$.xgafv* (query-string) - V1 error format.
12392    /// * *access_token* (query-string) - OAuth access token.
12393    /// * *alt* (query-string) - Data format for response.
12394    /// * *callback* (query-string) - JSONP
12395    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12396    /// * *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.
12397    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12398    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12399    /// * *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.
12400    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12401    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12402    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientListCall<'a, C>
12403    where
12404        T: AsRef<str>,
12405    {
12406        self._additional_params
12407            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12408        self
12409    }
12410
12411    /// Identifies the authorization scope for the method you are building.
12412    ///
12413    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12414    /// [`Scope::Readonly`].
12415    ///
12416    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12417    /// tokens for more than one scope.
12418    ///
12419    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12420    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12421    /// sufficient, a read-write scope will do as well.
12422    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientListCall<'a, C>
12423    where
12424        St: AsRef<str>,
12425    {
12426        self._scopes.insert(String::from(scope.as_ref()));
12427        self
12428    }
12429    /// Identifies the authorization scope(s) for the method you are building.
12430    ///
12431    /// See [`Self::add_scope()`] for details.
12432    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceClientListCall<'a, C>
12433    where
12434        I: IntoIterator<Item = St>,
12435        St: AsRef<str>,
12436    {
12437        self._scopes
12438            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12439        self
12440    }
12441
12442    /// Removes all scopes, and no default scope will be used either.
12443    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12444    /// for details).
12445    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientListCall<'a, C> {
12446        self._scopes.clear();
12447        self
12448    }
12449}
12450
12451/// Reverts changes to a GTM Client in a GTM Workspace.
12452///
12453/// A builder for the *containers.workspaces.clients.revert* method supported by a *account* resource.
12454/// It is not used directly, but through a [`AccountMethods`] instance.
12455///
12456/// # Example
12457///
12458/// Instantiate a resource method builder
12459///
12460/// ```test_harness,no_run
12461/// # extern crate hyper;
12462/// # extern crate hyper_rustls;
12463/// # extern crate google_tagmanager2 as tagmanager2;
12464/// # async fn dox() {
12465/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12466///
12467/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12469/// #     secret,
12470/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12471/// # ).build().await.unwrap();
12472///
12473/// # let client = hyper_util::client::legacy::Client::builder(
12474/// #     hyper_util::rt::TokioExecutor::new()
12475/// # )
12476/// # .build(
12477/// #     hyper_rustls::HttpsConnectorBuilder::new()
12478/// #         .with_native_roots()
12479/// #         .unwrap()
12480/// #         .https_or_http()
12481/// #         .enable_http1()
12482/// #         .build()
12483/// # );
12484/// # let mut hub = TagManager::new(client, auth);
12485/// // You can configure optional parameters by calling the respective setters at will, and
12486/// // execute the final call using `doit()`.
12487/// // Values shown here are possibly random and not representative !
12488/// let result = hub.accounts().containers_workspaces_clients_revert("path")
12489///              .fingerprint("diam")
12490///              .doit().await;
12491/// # }
12492/// ```
12493pub struct AccountContainerWorkspaceClientRevertCall<'a, C>
12494where
12495    C: 'a,
12496{
12497    hub: &'a TagManager<C>,
12498    _path: String,
12499    _fingerprint: Option<String>,
12500    _delegate: Option<&'a mut dyn common::Delegate>,
12501    _additional_params: HashMap<String, String>,
12502    _scopes: BTreeSet<String>,
12503}
12504
12505impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientRevertCall<'a, C> {}
12506
12507impl<'a, C> AccountContainerWorkspaceClientRevertCall<'a, C>
12508where
12509    C: common::Connector,
12510{
12511    /// Perform the operation you have build so far.
12512    pub async fn doit(mut self) -> common::Result<(common::Response, RevertClientResponse)> {
12513        use std::borrow::Cow;
12514        use std::io::{Read, Seek};
12515
12516        use common::{url::Params, ToParts};
12517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12518
12519        let mut dd = common::DefaultDelegate;
12520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12521        dlg.begin(common::MethodInfo {
12522            id: "tagmanager.accounts.containers.workspaces.clients.revert",
12523            http_method: hyper::Method::POST,
12524        });
12525
12526        for &field in ["alt", "path", "fingerprint"].iter() {
12527            if self._additional_params.contains_key(field) {
12528                dlg.finished(false);
12529                return Err(common::Error::FieldClash(field));
12530            }
12531        }
12532
12533        let mut params = Params::with_capacity(4 + self._additional_params.len());
12534        params.push("path", self._path);
12535        if let Some(value) = self._fingerprint.as_ref() {
12536            params.push("fingerprint", value);
12537        }
12538
12539        params.extend(self._additional_params.iter());
12540
12541        params.push("alt", "json");
12542        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
12543        if self._scopes.is_empty() {
12544            self._scopes
12545                .insert(Scope::EditContainer.as_ref().to_string());
12546        }
12547
12548        #[allow(clippy::single_element_loop)]
12549        for &(find_this, param_name) in [("{+path}", "path")].iter() {
12550            url = params.uri_replacement(url, param_name, find_this, true);
12551        }
12552        {
12553            let to_remove = ["path"];
12554            params.remove_params(&to_remove);
12555        }
12556
12557        let url = params.parse_with_url(&url);
12558
12559        loop {
12560            let token = match self
12561                .hub
12562                .auth
12563                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12564                .await
12565            {
12566                Ok(token) => token,
12567                Err(e) => match dlg.token(e) {
12568                    Ok(token) => token,
12569                    Err(e) => {
12570                        dlg.finished(false);
12571                        return Err(common::Error::MissingToken(e));
12572                    }
12573                },
12574            };
12575            let mut req_result = {
12576                let client = &self.hub.client;
12577                dlg.pre_request();
12578                let mut req_builder = hyper::Request::builder()
12579                    .method(hyper::Method::POST)
12580                    .uri(url.as_str())
12581                    .header(USER_AGENT, self.hub._user_agent.clone());
12582
12583                if let Some(token) = token.as_ref() {
12584                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12585                }
12586
12587                let request = req_builder
12588                    .header(CONTENT_LENGTH, 0_u64)
12589                    .body(common::to_body::<String>(None));
12590
12591                client.request(request.unwrap()).await
12592            };
12593
12594            match req_result {
12595                Err(err) => {
12596                    if let common::Retry::After(d) = dlg.http_error(&err) {
12597                        sleep(d).await;
12598                        continue;
12599                    }
12600                    dlg.finished(false);
12601                    return Err(common::Error::HttpError(err));
12602                }
12603                Ok(res) => {
12604                    let (mut parts, body) = res.into_parts();
12605                    let mut body = common::Body::new(body);
12606                    if !parts.status.is_success() {
12607                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12608                        let error = serde_json::from_str(&common::to_string(&bytes));
12609                        let response = common::to_response(parts, bytes.into());
12610
12611                        if let common::Retry::After(d) =
12612                            dlg.http_failure(&response, error.as_ref().ok())
12613                        {
12614                            sleep(d).await;
12615                            continue;
12616                        }
12617
12618                        dlg.finished(false);
12619
12620                        return Err(match error {
12621                            Ok(value) => common::Error::BadRequest(value),
12622                            _ => common::Error::Failure(response),
12623                        });
12624                    }
12625                    let response = {
12626                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12627                        let encoded = common::to_string(&bytes);
12628                        match serde_json::from_str(&encoded) {
12629                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12630                            Err(error) => {
12631                                dlg.response_json_decode_error(&encoded, &error);
12632                                return Err(common::Error::JsonDecodeError(
12633                                    encoded.to_string(),
12634                                    error,
12635                                ));
12636                            }
12637                        }
12638                    };
12639
12640                    dlg.finished(true);
12641                    return Ok(response);
12642                }
12643            }
12644        }
12645    }
12646
12647    /// GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
12648    ///
12649    /// Sets the *path* path property to the given value.
12650    ///
12651    /// Even though the property as already been set when instantiating this call,
12652    /// we provide this method for API completeness.
12653    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
12654        self._path = new_value.to_string();
12655        self
12656    }
12657    /// When provided, this fingerprint must match the fingerprint of the client in storage.
12658    ///
12659    /// Sets the *fingerprint* query property to the given value.
12660    pub fn fingerprint(
12661        mut self,
12662        new_value: &str,
12663    ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
12664        self._fingerprint = Some(new_value.to_string());
12665        self
12666    }
12667    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12668    /// while executing the actual API request.
12669    ///
12670    /// ````text
12671    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12672    /// ````
12673    ///
12674    /// Sets the *delegate* property to the given value.
12675    pub fn delegate(
12676        mut self,
12677        new_value: &'a mut dyn common::Delegate,
12678    ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
12679        self._delegate = Some(new_value);
12680        self
12681    }
12682
12683    /// Set any additional parameter of the query string used in the request.
12684    /// It should be used to set parameters which are not yet available through their own
12685    /// setters.
12686    ///
12687    /// Please note that this method must not be used to set any of the known parameters
12688    /// which have their own setter method. If done anyway, the request will fail.
12689    ///
12690    /// # Additional Parameters
12691    ///
12692    /// * *$.xgafv* (query-string) - V1 error format.
12693    /// * *access_token* (query-string) - OAuth access token.
12694    /// * *alt* (query-string) - Data format for response.
12695    /// * *callback* (query-string) - JSONP
12696    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12697    /// * *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.
12698    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12699    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12700    /// * *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.
12701    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12702    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12703    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientRevertCall<'a, C>
12704    where
12705        T: AsRef<str>,
12706    {
12707        self._additional_params
12708            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12709        self
12710    }
12711
12712    /// Identifies the authorization scope for the method you are building.
12713    ///
12714    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12715    /// [`Scope::EditContainer`].
12716    ///
12717    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12718    /// tokens for more than one scope.
12719    ///
12720    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12721    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12722    /// sufficient, a read-write scope will do as well.
12723    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientRevertCall<'a, C>
12724    where
12725        St: AsRef<str>,
12726    {
12727        self._scopes.insert(String::from(scope.as_ref()));
12728        self
12729    }
12730    /// Identifies the authorization scope(s) for the method you are building.
12731    ///
12732    /// See [`Self::add_scope()`] for details.
12733    pub fn add_scopes<I, St>(
12734        mut self,
12735        scopes: I,
12736    ) -> AccountContainerWorkspaceClientRevertCall<'a, C>
12737    where
12738        I: IntoIterator<Item = St>,
12739        St: AsRef<str>,
12740    {
12741        self._scopes
12742            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12743        self
12744    }
12745
12746    /// Removes all scopes, and no default scope will be used either.
12747    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12748    /// for details).
12749    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
12750        self._scopes.clear();
12751        self
12752    }
12753}
12754
12755/// Updates a GTM Client.
12756///
12757/// A builder for the *containers.workspaces.clients.update* method supported by a *account* resource.
12758/// It is not used directly, but through a [`AccountMethods`] instance.
12759///
12760/// # Example
12761///
12762/// Instantiate a resource method builder
12763///
12764/// ```test_harness,no_run
12765/// # extern crate hyper;
12766/// # extern crate hyper_rustls;
12767/// # extern crate google_tagmanager2 as tagmanager2;
12768/// use tagmanager2::api::Client;
12769/// # async fn dox() {
12770/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12771///
12772/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12773/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12774/// #     secret,
12775/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12776/// # ).build().await.unwrap();
12777///
12778/// # let client = hyper_util::client::legacy::Client::builder(
12779/// #     hyper_util::rt::TokioExecutor::new()
12780/// # )
12781/// # .build(
12782/// #     hyper_rustls::HttpsConnectorBuilder::new()
12783/// #         .with_native_roots()
12784/// #         .unwrap()
12785/// #         .https_or_http()
12786/// #         .enable_http1()
12787/// #         .build()
12788/// # );
12789/// # let mut hub = TagManager::new(client, auth);
12790/// // As the method needs a request, you would usually fill it with the desired information
12791/// // into the respective structure. Some of the parts shown here might not be applicable !
12792/// // Values shown here are possibly random and not representative !
12793/// let mut req = Client::default();
12794///
12795/// // You can configure optional parameters by calling the respective setters at will, and
12796/// // execute the final call using `doit()`.
12797/// // Values shown here are possibly random and not representative !
12798/// let result = hub.accounts().containers_workspaces_clients_update(req, "path")
12799///              .fingerprint("ipsum")
12800///              .doit().await;
12801/// # }
12802/// ```
12803pub struct AccountContainerWorkspaceClientUpdateCall<'a, C>
12804where
12805    C: 'a,
12806{
12807    hub: &'a TagManager<C>,
12808    _request: Client,
12809    _path: String,
12810    _fingerprint: Option<String>,
12811    _delegate: Option<&'a mut dyn common::Delegate>,
12812    _additional_params: HashMap<String, String>,
12813    _scopes: BTreeSet<String>,
12814}
12815
12816impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientUpdateCall<'a, C> {}
12817
12818impl<'a, C> AccountContainerWorkspaceClientUpdateCall<'a, C>
12819where
12820    C: common::Connector,
12821{
12822    /// Perform the operation you have build so far.
12823    pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
12824        use std::borrow::Cow;
12825        use std::io::{Read, Seek};
12826
12827        use common::{url::Params, ToParts};
12828        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12829
12830        let mut dd = common::DefaultDelegate;
12831        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12832        dlg.begin(common::MethodInfo {
12833            id: "tagmanager.accounts.containers.workspaces.clients.update",
12834            http_method: hyper::Method::PUT,
12835        });
12836
12837        for &field in ["alt", "path", "fingerprint"].iter() {
12838            if self._additional_params.contains_key(field) {
12839                dlg.finished(false);
12840                return Err(common::Error::FieldClash(field));
12841            }
12842        }
12843
12844        let mut params = Params::with_capacity(5 + self._additional_params.len());
12845        params.push("path", self._path);
12846        if let Some(value) = self._fingerprint.as_ref() {
12847            params.push("fingerprint", value);
12848        }
12849
12850        params.extend(self._additional_params.iter());
12851
12852        params.push("alt", "json");
12853        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
12854        if self._scopes.is_empty() {
12855            self._scopes
12856                .insert(Scope::EditContainer.as_ref().to_string());
12857        }
12858
12859        #[allow(clippy::single_element_loop)]
12860        for &(find_this, param_name) in [("{+path}", "path")].iter() {
12861            url = params.uri_replacement(url, param_name, find_this, true);
12862        }
12863        {
12864            let to_remove = ["path"];
12865            params.remove_params(&to_remove);
12866        }
12867
12868        let url = params.parse_with_url(&url);
12869
12870        let mut json_mime_type = mime::APPLICATION_JSON;
12871        let mut request_value_reader = {
12872            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12873            common::remove_json_null_values(&mut value);
12874            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12875            serde_json::to_writer(&mut dst, &value).unwrap();
12876            dst
12877        };
12878        let request_size = request_value_reader
12879            .seek(std::io::SeekFrom::End(0))
12880            .unwrap();
12881        request_value_reader
12882            .seek(std::io::SeekFrom::Start(0))
12883            .unwrap();
12884
12885        loop {
12886            let token = match self
12887                .hub
12888                .auth
12889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12890                .await
12891            {
12892                Ok(token) => token,
12893                Err(e) => match dlg.token(e) {
12894                    Ok(token) => token,
12895                    Err(e) => {
12896                        dlg.finished(false);
12897                        return Err(common::Error::MissingToken(e));
12898                    }
12899                },
12900            };
12901            request_value_reader
12902                .seek(std::io::SeekFrom::Start(0))
12903                .unwrap();
12904            let mut req_result = {
12905                let client = &self.hub.client;
12906                dlg.pre_request();
12907                let mut req_builder = hyper::Request::builder()
12908                    .method(hyper::Method::PUT)
12909                    .uri(url.as_str())
12910                    .header(USER_AGENT, self.hub._user_agent.clone());
12911
12912                if let Some(token) = token.as_ref() {
12913                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12914                }
12915
12916                let request = req_builder
12917                    .header(CONTENT_TYPE, json_mime_type.to_string())
12918                    .header(CONTENT_LENGTH, request_size as u64)
12919                    .body(common::to_body(
12920                        request_value_reader.get_ref().clone().into(),
12921                    ));
12922
12923                client.request(request.unwrap()).await
12924            };
12925
12926            match req_result {
12927                Err(err) => {
12928                    if let common::Retry::After(d) = dlg.http_error(&err) {
12929                        sleep(d).await;
12930                        continue;
12931                    }
12932                    dlg.finished(false);
12933                    return Err(common::Error::HttpError(err));
12934                }
12935                Ok(res) => {
12936                    let (mut parts, body) = res.into_parts();
12937                    let mut body = common::Body::new(body);
12938                    if !parts.status.is_success() {
12939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12940                        let error = serde_json::from_str(&common::to_string(&bytes));
12941                        let response = common::to_response(parts, bytes.into());
12942
12943                        if let common::Retry::After(d) =
12944                            dlg.http_failure(&response, error.as_ref().ok())
12945                        {
12946                            sleep(d).await;
12947                            continue;
12948                        }
12949
12950                        dlg.finished(false);
12951
12952                        return Err(match error {
12953                            Ok(value) => common::Error::BadRequest(value),
12954                            _ => common::Error::Failure(response),
12955                        });
12956                    }
12957                    let response = {
12958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12959                        let encoded = common::to_string(&bytes);
12960                        match serde_json::from_str(&encoded) {
12961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12962                            Err(error) => {
12963                                dlg.response_json_decode_error(&encoded, &error);
12964                                return Err(common::Error::JsonDecodeError(
12965                                    encoded.to_string(),
12966                                    error,
12967                                ));
12968                            }
12969                        }
12970                    };
12971
12972                    dlg.finished(true);
12973                    return Ok(response);
12974                }
12975            }
12976        }
12977    }
12978
12979    ///
12980    /// Sets the *request* property to the given value.
12981    ///
12982    /// Even though the property as already been set when instantiating this call,
12983    /// we provide this method for API completeness.
12984    pub fn request(
12985        mut self,
12986        new_value: Client,
12987    ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
12988        self._request = new_value;
12989        self
12990    }
12991    /// GTM Client's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/clients/{client_id}
12992    ///
12993    /// Sets the *path* path property to the given value.
12994    ///
12995    /// Even though the property as already been set when instantiating this call,
12996    /// we provide this method for API completeness.
12997    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
12998        self._path = new_value.to_string();
12999        self
13000    }
13001    /// When provided, this fingerprint must match the fingerprint of the client in storage.
13002    ///
13003    /// Sets the *fingerprint* query property to the given value.
13004    pub fn fingerprint(
13005        mut self,
13006        new_value: &str,
13007    ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13008        self._fingerprint = Some(new_value.to_string());
13009        self
13010    }
13011    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13012    /// while executing the actual API request.
13013    ///
13014    /// ````text
13015    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13016    /// ````
13017    ///
13018    /// Sets the *delegate* property to the given value.
13019    pub fn delegate(
13020        mut self,
13021        new_value: &'a mut dyn common::Delegate,
13022    ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13023        self._delegate = Some(new_value);
13024        self
13025    }
13026
13027    /// Set any additional parameter of the query string used in the request.
13028    /// It should be used to set parameters which are not yet available through their own
13029    /// setters.
13030    ///
13031    /// Please note that this method must not be used to set any of the known parameters
13032    /// which have their own setter method. If done anyway, the request will fail.
13033    ///
13034    /// # Additional Parameters
13035    ///
13036    /// * *$.xgafv* (query-string) - V1 error format.
13037    /// * *access_token* (query-string) - OAuth access token.
13038    /// * *alt* (query-string) - Data format for response.
13039    /// * *callback* (query-string) - JSONP
13040    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13041    /// * *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.
13042    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13043    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13044    /// * *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.
13045    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13046    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13047    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13048    where
13049        T: AsRef<str>,
13050    {
13051        self._additional_params
13052            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13053        self
13054    }
13055
13056    /// Identifies the authorization scope for the method you are building.
13057    ///
13058    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13059    /// [`Scope::EditContainer`].
13060    ///
13061    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13062    /// tokens for more than one scope.
13063    ///
13064    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13065    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13066    /// sufficient, a read-write scope will do as well.
13067    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13068    where
13069        St: AsRef<str>,
13070    {
13071        self._scopes.insert(String::from(scope.as_ref()));
13072        self
13073    }
13074    /// Identifies the authorization scope(s) for the method you are building.
13075    ///
13076    /// See [`Self::add_scope()`] for details.
13077    pub fn add_scopes<I, St>(
13078        mut self,
13079        scopes: I,
13080    ) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13081    where
13082        I: IntoIterator<Item = St>,
13083        St: AsRef<str>,
13084    {
13085        self._scopes
13086            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13087        self
13088    }
13089
13090    /// Removes all scopes, and no default scope will be used either.
13091    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13092    /// for details).
13093    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13094        self._scopes.clear();
13095        self
13096    }
13097}
13098
13099/// Creates a GTM Folder.
13100///
13101/// A builder for the *containers.workspaces.folders.create* method supported by a *account* resource.
13102/// It is not used directly, but through a [`AccountMethods`] instance.
13103///
13104/// # Example
13105///
13106/// Instantiate a resource method builder
13107///
13108/// ```test_harness,no_run
13109/// # extern crate hyper;
13110/// # extern crate hyper_rustls;
13111/// # extern crate google_tagmanager2 as tagmanager2;
13112/// use tagmanager2::api::Folder;
13113/// # async fn dox() {
13114/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13115///
13116/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13118/// #     secret,
13119/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13120/// # ).build().await.unwrap();
13121///
13122/// # let client = hyper_util::client::legacy::Client::builder(
13123/// #     hyper_util::rt::TokioExecutor::new()
13124/// # )
13125/// # .build(
13126/// #     hyper_rustls::HttpsConnectorBuilder::new()
13127/// #         .with_native_roots()
13128/// #         .unwrap()
13129/// #         .https_or_http()
13130/// #         .enable_http1()
13131/// #         .build()
13132/// # );
13133/// # let mut hub = TagManager::new(client, auth);
13134/// // As the method needs a request, you would usually fill it with the desired information
13135/// // into the respective structure. Some of the parts shown here might not be applicable !
13136/// // Values shown here are possibly random and not representative !
13137/// let mut req = Folder::default();
13138///
13139/// // You can configure optional parameters by calling the respective setters at will, and
13140/// // execute the final call using `doit()`.
13141/// // Values shown here are possibly random and not representative !
13142/// let result = hub.accounts().containers_workspaces_folders_create(req, "parent")
13143///              .doit().await;
13144/// # }
13145/// ```
13146pub struct AccountContainerWorkspaceFolderCreateCall<'a, C>
13147where
13148    C: 'a,
13149{
13150    hub: &'a TagManager<C>,
13151    _request: Folder,
13152    _parent: String,
13153    _delegate: Option<&'a mut dyn common::Delegate>,
13154    _additional_params: HashMap<String, String>,
13155    _scopes: BTreeSet<String>,
13156}
13157
13158impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderCreateCall<'a, C> {}
13159
13160impl<'a, C> AccountContainerWorkspaceFolderCreateCall<'a, C>
13161where
13162    C: common::Connector,
13163{
13164    /// Perform the operation you have build so far.
13165    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
13166        use std::borrow::Cow;
13167        use std::io::{Read, Seek};
13168
13169        use common::{url::Params, ToParts};
13170        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13171
13172        let mut dd = common::DefaultDelegate;
13173        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13174        dlg.begin(common::MethodInfo {
13175            id: "tagmanager.accounts.containers.workspaces.folders.create",
13176            http_method: hyper::Method::POST,
13177        });
13178
13179        for &field in ["alt", "parent"].iter() {
13180            if self._additional_params.contains_key(field) {
13181                dlg.finished(false);
13182                return Err(common::Error::FieldClash(field));
13183            }
13184        }
13185
13186        let mut params = Params::with_capacity(4 + self._additional_params.len());
13187        params.push("parent", self._parent);
13188
13189        params.extend(self._additional_params.iter());
13190
13191        params.push("alt", "json");
13192        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/folders";
13193        if self._scopes.is_empty() {
13194            self._scopes
13195                .insert(Scope::EditContainer.as_ref().to_string());
13196        }
13197
13198        #[allow(clippy::single_element_loop)]
13199        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13200            url = params.uri_replacement(url, param_name, find_this, true);
13201        }
13202        {
13203            let to_remove = ["parent"];
13204            params.remove_params(&to_remove);
13205        }
13206
13207        let url = params.parse_with_url(&url);
13208
13209        let mut json_mime_type = mime::APPLICATION_JSON;
13210        let mut request_value_reader = {
13211            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13212            common::remove_json_null_values(&mut value);
13213            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13214            serde_json::to_writer(&mut dst, &value).unwrap();
13215            dst
13216        };
13217        let request_size = request_value_reader
13218            .seek(std::io::SeekFrom::End(0))
13219            .unwrap();
13220        request_value_reader
13221            .seek(std::io::SeekFrom::Start(0))
13222            .unwrap();
13223
13224        loop {
13225            let token = match self
13226                .hub
13227                .auth
13228                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13229                .await
13230            {
13231                Ok(token) => token,
13232                Err(e) => match dlg.token(e) {
13233                    Ok(token) => token,
13234                    Err(e) => {
13235                        dlg.finished(false);
13236                        return Err(common::Error::MissingToken(e));
13237                    }
13238                },
13239            };
13240            request_value_reader
13241                .seek(std::io::SeekFrom::Start(0))
13242                .unwrap();
13243            let mut req_result = {
13244                let client = &self.hub.client;
13245                dlg.pre_request();
13246                let mut req_builder = hyper::Request::builder()
13247                    .method(hyper::Method::POST)
13248                    .uri(url.as_str())
13249                    .header(USER_AGENT, self.hub._user_agent.clone());
13250
13251                if let Some(token) = token.as_ref() {
13252                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13253                }
13254
13255                let request = req_builder
13256                    .header(CONTENT_TYPE, json_mime_type.to_string())
13257                    .header(CONTENT_LENGTH, request_size as u64)
13258                    .body(common::to_body(
13259                        request_value_reader.get_ref().clone().into(),
13260                    ));
13261
13262                client.request(request.unwrap()).await
13263            };
13264
13265            match req_result {
13266                Err(err) => {
13267                    if let common::Retry::After(d) = dlg.http_error(&err) {
13268                        sleep(d).await;
13269                        continue;
13270                    }
13271                    dlg.finished(false);
13272                    return Err(common::Error::HttpError(err));
13273                }
13274                Ok(res) => {
13275                    let (mut parts, body) = res.into_parts();
13276                    let mut body = common::Body::new(body);
13277                    if !parts.status.is_success() {
13278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13279                        let error = serde_json::from_str(&common::to_string(&bytes));
13280                        let response = common::to_response(parts, bytes.into());
13281
13282                        if let common::Retry::After(d) =
13283                            dlg.http_failure(&response, error.as_ref().ok())
13284                        {
13285                            sleep(d).await;
13286                            continue;
13287                        }
13288
13289                        dlg.finished(false);
13290
13291                        return Err(match error {
13292                            Ok(value) => common::Error::BadRequest(value),
13293                            _ => common::Error::Failure(response),
13294                        });
13295                    }
13296                    let response = {
13297                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13298                        let encoded = common::to_string(&bytes);
13299                        match serde_json::from_str(&encoded) {
13300                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13301                            Err(error) => {
13302                                dlg.response_json_decode_error(&encoded, &error);
13303                                return Err(common::Error::JsonDecodeError(
13304                                    encoded.to_string(),
13305                                    error,
13306                                ));
13307                            }
13308                        }
13309                    };
13310
13311                    dlg.finished(true);
13312                    return Ok(response);
13313                }
13314            }
13315        }
13316    }
13317
13318    ///
13319    /// Sets the *request* property to the given value.
13320    ///
13321    /// Even though the property as already been set when instantiating this call,
13322    /// we provide this method for API completeness.
13323    pub fn request(
13324        mut self,
13325        new_value: Folder,
13326    ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13327        self._request = new_value;
13328        self
13329    }
13330    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
13331    ///
13332    /// Sets the *parent* path property to the given value.
13333    ///
13334    /// Even though the property as already been set when instantiating this call,
13335    /// we provide this method for API completeness.
13336    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13337        self._parent = new_value.to_string();
13338        self
13339    }
13340    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13341    /// while executing the actual API request.
13342    ///
13343    /// ````text
13344    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13345    /// ````
13346    ///
13347    /// Sets the *delegate* property to the given value.
13348    pub fn delegate(
13349        mut self,
13350        new_value: &'a mut dyn common::Delegate,
13351    ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13352        self._delegate = Some(new_value);
13353        self
13354    }
13355
13356    /// Set any additional parameter of the query string used in the request.
13357    /// It should be used to set parameters which are not yet available through their own
13358    /// setters.
13359    ///
13360    /// Please note that this method must not be used to set any of the known parameters
13361    /// which have their own setter method. If done anyway, the request will fail.
13362    ///
13363    /// # Additional Parameters
13364    ///
13365    /// * *$.xgafv* (query-string) - V1 error format.
13366    /// * *access_token* (query-string) - OAuth access token.
13367    /// * *alt* (query-string) - Data format for response.
13368    /// * *callback* (query-string) - JSONP
13369    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13370    /// * *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.
13371    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13372    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13373    /// * *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.
13374    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13375    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13376    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13377    where
13378        T: AsRef<str>,
13379    {
13380        self._additional_params
13381            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13382        self
13383    }
13384
13385    /// Identifies the authorization scope for the method you are building.
13386    ///
13387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13388    /// [`Scope::EditContainer`].
13389    ///
13390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13391    /// tokens for more than one scope.
13392    ///
13393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13395    /// sufficient, a read-write scope will do as well.
13396    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13397    where
13398        St: AsRef<str>,
13399    {
13400        self._scopes.insert(String::from(scope.as_ref()));
13401        self
13402    }
13403    /// Identifies the authorization scope(s) for the method you are building.
13404    ///
13405    /// See [`Self::add_scope()`] for details.
13406    pub fn add_scopes<I, St>(
13407        mut self,
13408        scopes: I,
13409    ) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13410    where
13411        I: IntoIterator<Item = St>,
13412        St: AsRef<str>,
13413    {
13414        self._scopes
13415            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13416        self
13417    }
13418
13419    /// Removes all scopes, and no default scope will be used either.
13420    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13421    /// for details).
13422    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13423        self._scopes.clear();
13424        self
13425    }
13426}
13427
13428/// Deletes a GTM Folder.
13429///
13430/// A builder for the *containers.workspaces.folders.delete* method supported by a *account* resource.
13431/// It is not used directly, but through a [`AccountMethods`] instance.
13432///
13433/// # Example
13434///
13435/// Instantiate a resource method builder
13436///
13437/// ```test_harness,no_run
13438/// # extern crate hyper;
13439/// # extern crate hyper_rustls;
13440/// # extern crate google_tagmanager2 as tagmanager2;
13441/// # async fn dox() {
13442/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13443///
13444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13446/// #     secret,
13447/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13448/// # ).build().await.unwrap();
13449///
13450/// # let client = hyper_util::client::legacy::Client::builder(
13451/// #     hyper_util::rt::TokioExecutor::new()
13452/// # )
13453/// # .build(
13454/// #     hyper_rustls::HttpsConnectorBuilder::new()
13455/// #         .with_native_roots()
13456/// #         .unwrap()
13457/// #         .https_or_http()
13458/// #         .enable_http1()
13459/// #         .build()
13460/// # );
13461/// # let mut hub = TagManager::new(client, auth);
13462/// // You can configure optional parameters by calling the respective setters at will, and
13463/// // execute the final call using `doit()`.
13464/// // Values shown here are possibly random and not representative !
13465/// let result = hub.accounts().containers_workspaces_folders_delete("path")
13466///              .doit().await;
13467/// # }
13468/// ```
13469pub struct AccountContainerWorkspaceFolderDeleteCall<'a, C>
13470where
13471    C: 'a,
13472{
13473    hub: &'a TagManager<C>,
13474    _path: String,
13475    _delegate: Option<&'a mut dyn common::Delegate>,
13476    _additional_params: HashMap<String, String>,
13477    _scopes: BTreeSet<String>,
13478}
13479
13480impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderDeleteCall<'a, C> {}
13481
13482impl<'a, C> AccountContainerWorkspaceFolderDeleteCall<'a, C>
13483where
13484    C: common::Connector,
13485{
13486    /// Perform the operation you have build so far.
13487    pub async fn doit(mut self) -> common::Result<common::Response> {
13488        use std::borrow::Cow;
13489        use std::io::{Read, Seek};
13490
13491        use common::{url::Params, ToParts};
13492        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13493
13494        let mut dd = common::DefaultDelegate;
13495        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13496        dlg.begin(common::MethodInfo {
13497            id: "tagmanager.accounts.containers.workspaces.folders.delete",
13498            http_method: hyper::Method::DELETE,
13499        });
13500
13501        for &field in ["path"].iter() {
13502            if self._additional_params.contains_key(field) {
13503                dlg.finished(false);
13504                return Err(common::Error::FieldClash(field));
13505            }
13506        }
13507
13508        let mut params = Params::with_capacity(2 + self._additional_params.len());
13509        params.push("path", self._path);
13510
13511        params.extend(self._additional_params.iter());
13512
13513        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
13514        if self._scopes.is_empty() {
13515            self._scopes
13516                .insert(Scope::EditContainer.as_ref().to_string());
13517        }
13518
13519        #[allow(clippy::single_element_loop)]
13520        for &(find_this, param_name) in [("{+path}", "path")].iter() {
13521            url = params.uri_replacement(url, param_name, find_this, true);
13522        }
13523        {
13524            let to_remove = ["path"];
13525            params.remove_params(&to_remove);
13526        }
13527
13528        let url = params.parse_with_url(&url);
13529
13530        loop {
13531            let token = match self
13532                .hub
13533                .auth
13534                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13535                .await
13536            {
13537                Ok(token) => token,
13538                Err(e) => match dlg.token(e) {
13539                    Ok(token) => token,
13540                    Err(e) => {
13541                        dlg.finished(false);
13542                        return Err(common::Error::MissingToken(e));
13543                    }
13544                },
13545            };
13546            let mut req_result = {
13547                let client = &self.hub.client;
13548                dlg.pre_request();
13549                let mut req_builder = hyper::Request::builder()
13550                    .method(hyper::Method::DELETE)
13551                    .uri(url.as_str())
13552                    .header(USER_AGENT, self.hub._user_agent.clone());
13553
13554                if let Some(token) = token.as_ref() {
13555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13556                }
13557
13558                let request = req_builder
13559                    .header(CONTENT_LENGTH, 0_u64)
13560                    .body(common::to_body::<String>(None));
13561
13562                client.request(request.unwrap()).await
13563            };
13564
13565            match req_result {
13566                Err(err) => {
13567                    if let common::Retry::After(d) = dlg.http_error(&err) {
13568                        sleep(d).await;
13569                        continue;
13570                    }
13571                    dlg.finished(false);
13572                    return Err(common::Error::HttpError(err));
13573                }
13574                Ok(res) => {
13575                    let (mut parts, body) = res.into_parts();
13576                    let mut body = common::Body::new(body);
13577                    if !parts.status.is_success() {
13578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13579                        let error = serde_json::from_str(&common::to_string(&bytes));
13580                        let response = common::to_response(parts, bytes.into());
13581
13582                        if let common::Retry::After(d) =
13583                            dlg.http_failure(&response, error.as_ref().ok())
13584                        {
13585                            sleep(d).await;
13586                            continue;
13587                        }
13588
13589                        dlg.finished(false);
13590
13591                        return Err(match error {
13592                            Ok(value) => common::Error::BadRequest(value),
13593                            _ => common::Error::Failure(response),
13594                        });
13595                    }
13596                    let response = common::Response::from_parts(parts, body);
13597
13598                    dlg.finished(true);
13599                    return Ok(response);
13600                }
13601            }
13602        }
13603    }
13604
13605    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
13606    ///
13607    /// Sets the *path* path property to the given value.
13608    ///
13609    /// Even though the property as already been set when instantiating this call,
13610    /// we provide this method for API completeness.
13611    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
13612        self._path = new_value.to_string();
13613        self
13614    }
13615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13616    /// while executing the actual API request.
13617    ///
13618    /// ````text
13619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13620    /// ````
13621    ///
13622    /// Sets the *delegate* property to the given value.
13623    pub fn delegate(
13624        mut self,
13625        new_value: &'a mut dyn common::Delegate,
13626    ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
13627        self._delegate = Some(new_value);
13628        self
13629    }
13630
13631    /// Set any additional parameter of the query string used in the request.
13632    /// It should be used to set parameters which are not yet available through their own
13633    /// setters.
13634    ///
13635    /// Please note that this method must not be used to set any of the known parameters
13636    /// which have their own setter method. If done anyway, the request will fail.
13637    ///
13638    /// # Additional Parameters
13639    ///
13640    /// * *$.xgafv* (query-string) - V1 error format.
13641    /// * *access_token* (query-string) - OAuth access token.
13642    /// * *alt* (query-string) - Data format for response.
13643    /// * *callback* (query-string) - JSONP
13644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13645    /// * *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.
13646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13648    /// * *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.
13649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13651    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
13652    where
13653        T: AsRef<str>,
13654    {
13655        self._additional_params
13656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13657        self
13658    }
13659
13660    /// Identifies the authorization scope for the method you are building.
13661    ///
13662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13663    /// [`Scope::EditContainer`].
13664    ///
13665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13666    /// tokens for more than one scope.
13667    ///
13668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13670    /// sufficient, a read-write scope will do as well.
13671    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
13672    where
13673        St: AsRef<str>,
13674    {
13675        self._scopes.insert(String::from(scope.as_ref()));
13676        self
13677    }
13678    /// Identifies the authorization scope(s) for the method you are building.
13679    ///
13680    /// See [`Self::add_scope()`] for details.
13681    pub fn add_scopes<I, St>(
13682        mut self,
13683        scopes: I,
13684    ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
13685    where
13686        I: IntoIterator<Item = St>,
13687        St: AsRef<str>,
13688    {
13689        self._scopes
13690            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13691        self
13692    }
13693
13694    /// Removes all scopes, and no default scope will be used either.
13695    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13696    /// for details).
13697    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
13698        self._scopes.clear();
13699        self
13700    }
13701}
13702
13703/// List all entities in a GTM Folder.
13704///
13705/// A builder for the *containers.workspaces.folders.entities* method supported by a *account* resource.
13706/// It is not used directly, but through a [`AccountMethods`] instance.
13707///
13708/// # Example
13709///
13710/// Instantiate a resource method builder
13711///
13712/// ```test_harness,no_run
13713/// # extern crate hyper;
13714/// # extern crate hyper_rustls;
13715/// # extern crate google_tagmanager2 as tagmanager2;
13716/// # async fn dox() {
13717/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13718///
13719/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13721/// #     secret,
13722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13723/// # ).build().await.unwrap();
13724///
13725/// # let client = hyper_util::client::legacy::Client::builder(
13726/// #     hyper_util::rt::TokioExecutor::new()
13727/// # )
13728/// # .build(
13729/// #     hyper_rustls::HttpsConnectorBuilder::new()
13730/// #         .with_native_roots()
13731/// #         .unwrap()
13732/// #         .https_or_http()
13733/// #         .enable_http1()
13734/// #         .build()
13735/// # );
13736/// # let mut hub = TagManager::new(client, auth);
13737/// // You can configure optional parameters by calling the respective setters at will, and
13738/// // execute the final call using `doit()`.
13739/// // Values shown here are possibly random and not representative !
13740/// let result = hub.accounts().containers_workspaces_folders_entities("path")
13741///              .page_token("voluptua.")
13742///              .doit().await;
13743/// # }
13744/// ```
13745pub struct AccountContainerWorkspaceFolderEntityCall<'a, C>
13746where
13747    C: 'a,
13748{
13749    hub: &'a TagManager<C>,
13750    _path: String,
13751    _page_token: Option<String>,
13752    _delegate: Option<&'a mut dyn common::Delegate>,
13753    _additional_params: HashMap<String, String>,
13754    _scopes: BTreeSet<String>,
13755}
13756
13757impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderEntityCall<'a, C> {}
13758
13759impl<'a, C> AccountContainerWorkspaceFolderEntityCall<'a, C>
13760where
13761    C: common::Connector,
13762{
13763    /// Perform the operation you have build so far.
13764    pub async fn doit(mut self) -> common::Result<(common::Response, FolderEntities)> {
13765        use std::borrow::Cow;
13766        use std::io::{Read, Seek};
13767
13768        use common::{url::Params, ToParts};
13769        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13770
13771        let mut dd = common::DefaultDelegate;
13772        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13773        dlg.begin(common::MethodInfo {
13774            id: "tagmanager.accounts.containers.workspaces.folders.entities",
13775            http_method: hyper::Method::POST,
13776        });
13777
13778        for &field in ["alt", "path", "pageToken"].iter() {
13779            if self._additional_params.contains_key(field) {
13780                dlg.finished(false);
13781                return Err(common::Error::FieldClash(field));
13782            }
13783        }
13784
13785        let mut params = Params::with_capacity(4 + self._additional_params.len());
13786        params.push("path", self._path);
13787        if let Some(value) = self._page_token.as_ref() {
13788            params.push("pageToken", value);
13789        }
13790
13791        params.extend(self._additional_params.iter());
13792
13793        params.push("alt", "json");
13794        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:entities";
13795        if self._scopes.is_empty() {
13796            self._scopes
13797                .insert(Scope::EditContainer.as_ref().to_string());
13798        }
13799
13800        #[allow(clippy::single_element_loop)]
13801        for &(find_this, param_name) in [("{+path}", "path")].iter() {
13802            url = params.uri_replacement(url, param_name, find_this, true);
13803        }
13804        {
13805            let to_remove = ["path"];
13806            params.remove_params(&to_remove);
13807        }
13808
13809        let url = params.parse_with_url(&url);
13810
13811        loop {
13812            let token = match self
13813                .hub
13814                .auth
13815                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13816                .await
13817            {
13818                Ok(token) => token,
13819                Err(e) => match dlg.token(e) {
13820                    Ok(token) => token,
13821                    Err(e) => {
13822                        dlg.finished(false);
13823                        return Err(common::Error::MissingToken(e));
13824                    }
13825                },
13826            };
13827            let mut req_result = {
13828                let client = &self.hub.client;
13829                dlg.pre_request();
13830                let mut req_builder = hyper::Request::builder()
13831                    .method(hyper::Method::POST)
13832                    .uri(url.as_str())
13833                    .header(USER_AGENT, self.hub._user_agent.clone());
13834
13835                if let Some(token) = token.as_ref() {
13836                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13837                }
13838
13839                let request = req_builder
13840                    .header(CONTENT_LENGTH, 0_u64)
13841                    .body(common::to_body::<String>(None));
13842
13843                client.request(request.unwrap()).await
13844            };
13845
13846            match req_result {
13847                Err(err) => {
13848                    if let common::Retry::After(d) = dlg.http_error(&err) {
13849                        sleep(d).await;
13850                        continue;
13851                    }
13852                    dlg.finished(false);
13853                    return Err(common::Error::HttpError(err));
13854                }
13855                Ok(res) => {
13856                    let (mut parts, body) = res.into_parts();
13857                    let mut body = common::Body::new(body);
13858                    if !parts.status.is_success() {
13859                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13860                        let error = serde_json::from_str(&common::to_string(&bytes));
13861                        let response = common::to_response(parts, bytes.into());
13862
13863                        if let common::Retry::After(d) =
13864                            dlg.http_failure(&response, error.as_ref().ok())
13865                        {
13866                            sleep(d).await;
13867                            continue;
13868                        }
13869
13870                        dlg.finished(false);
13871
13872                        return Err(match error {
13873                            Ok(value) => common::Error::BadRequest(value),
13874                            _ => common::Error::Failure(response),
13875                        });
13876                    }
13877                    let response = {
13878                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13879                        let encoded = common::to_string(&bytes);
13880                        match serde_json::from_str(&encoded) {
13881                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13882                            Err(error) => {
13883                                dlg.response_json_decode_error(&encoded, &error);
13884                                return Err(common::Error::JsonDecodeError(
13885                                    encoded.to_string(),
13886                                    error,
13887                                ));
13888                            }
13889                        }
13890                    };
13891
13892                    dlg.finished(true);
13893                    return Ok(response);
13894                }
13895            }
13896        }
13897    }
13898
13899    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
13900    ///
13901    /// Sets the *path* path property to the given value.
13902    ///
13903    /// Even though the property as already been set when instantiating this call,
13904    /// we provide this method for API completeness.
13905    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
13906        self._path = new_value.to_string();
13907        self
13908    }
13909    /// Continuation token for fetching the next page of results.
13910    ///
13911    /// Sets the *page token* query property to the given value.
13912    pub fn page_token(
13913        mut self,
13914        new_value: &str,
13915    ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
13916        self._page_token = Some(new_value.to_string());
13917        self
13918    }
13919    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13920    /// while executing the actual API request.
13921    ///
13922    /// ````text
13923    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13924    /// ````
13925    ///
13926    /// Sets the *delegate* property to the given value.
13927    pub fn delegate(
13928        mut self,
13929        new_value: &'a mut dyn common::Delegate,
13930    ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
13931        self._delegate = Some(new_value);
13932        self
13933    }
13934
13935    /// Set any additional parameter of the query string used in the request.
13936    /// It should be used to set parameters which are not yet available through their own
13937    /// setters.
13938    ///
13939    /// Please note that this method must not be used to set any of the known parameters
13940    /// which have their own setter method. If done anyway, the request will fail.
13941    ///
13942    /// # Additional Parameters
13943    ///
13944    /// * *$.xgafv* (query-string) - V1 error format.
13945    /// * *access_token* (query-string) - OAuth access token.
13946    /// * *alt* (query-string) - Data format for response.
13947    /// * *callback* (query-string) - JSONP
13948    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13949    /// * *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.
13950    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13951    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13952    /// * *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.
13953    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13954    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13955    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
13956    where
13957        T: AsRef<str>,
13958    {
13959        self._additional_params
13960            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13961        self
13962    }
13963
13964    /// Identifies the authorization scope for the method you are building.
13965    ///
13966    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13967    /// [`Scope::EditContainer`].
13968    ///
13969    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13970    /// tokens for more than one scope.
13971    ///
13972    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13973    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13974    /// sufficient, a read-write scope will do as well.
13975    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
13976    where
13977        St: AsRef<str>,
13978    {
13979        self._scopes.insert(String::from(scope.as_ref()));
13980        self
13981    }
13982    /// Identifies the authorization scope(s) for the method you are building.
13983    ///
13984    /// See [`Self::add_scope()`] for details.
13985    pub fn add_scopes<I, St>(
13986        mut self,
13987        scopes: I,
13988    ) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
13989    where
13990        I: IntoIterator<Item = St>,
13991        St: AsRef<str>,
13992    {
13993        self._scopes
13994            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13995        self
13996    }
13997
13998    /// Removes all scopes, and no default scope will be used either.
13999    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14000    /// for details).
14001    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
14002        self._scopes.clear();
14003        self
14004    }
14005}
14006
14007/// Gets a GTM Folder.
14008///
14009/// A builder for the *containers.workspaces.folders.get* method supported by a *account* resource.
14010/// It is not used directly, but through a [`AccountMethods`] instance.
14011///
14012/// # Example
14013///
14014/// Instantiate a resource method builder
14015///
14016/// ```test_harness,no_run
14017/// # extern crate hyper;
14018/// # extern crate hyper_rustls;
14019/// # extern crate google_tagmanager2 as tagmanager2;
14020/// # async fn dox() {
14021/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14022///
14023/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14025/// #     secret,
14026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14027/// # ).build().await.unwrap();
14028///
14029/// # let client = hyper_util::client::legacy::Client::builder(
14030/// #     hyper_util::rt::TokioExecutor::new()
14031/// # )
14032/// # .build(
14033/// #     hyper_rustls::HttpsConnectorBuilder::new()
14034/// #         .with_native_roots()
14035/// #         .unwrap()
14036/// #         .https_or_http()
14037/// #         .enable_http1()
14038/// #         .build()
14039/// # );
14040/// # let mut hub = TagManager::new(client, auth);
14041/// // You can configure optional parameters by calling the respective setters at will, and
14042/// // execute the final call using `doit()`.
14043/// // Values shown here are possibly random and not representative !
14044/// let result = hub.accounts().containers_workspaces_folders_get("path")
14045///              .doit().await;
14046/// # }
14047/// ```
14048pub struct AccountContainerWorkspaceFolderGetCall<'a, C>
14049where
14050    C: 'a,
14051{
14052    hub: &'a TagManager<C>,
14053    _path: String,
14054    _delegate: Option<&'a mut dyn common::Delegate>,
14055    _additional_params: HashMap<String, String>,
14056    _scopes: BTreeSet<String>,
14057}
14058
14059impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderGetCall<'a, C> {}
14060
14061impl<'a, C> AccountContainerWorkspaceFolderGetCall<'a, C>
14062where
14063    C: common::Connector,
14064{
14065    /// Perform the operation you have build so far.
14066    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
14067        use std::borrow::Cow;
14068        use std::io::{Read, Seek};
14069
14070        use common::{url::Params, ToParts};
14071        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14072
14073        let mut dd = common::DefaultDelegate;
14074        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14075        dlg.begin(common::MethodInfo {
14076            id: "tagmanager.accounts.containers.workspaces.folders.get",
14077            http_method: hyper::Method::GET,
14078        });
14079
14080        for &field in ["alt", "path"].iter() {
14081            if self._additional_params.contains_key(field) {
14082                dlg.finished(false);
14083                return Err(common::Error::FieldClash(field));
14084            }
14085        }
14086
14087        let mut params = Params::with_capacity(3 + self._additional_params.len());
14088        params.push("path", self._path);
14089
14090        params.extend(self._additional_params.iter());
14091
14092        params.push("alt", "json");
14093        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
14094        if self._scopes.is_empty() {
14095            self._scopes.insert(Scope::Readonly.as_ref().to_string());
14096        }
14097
14098        #[allow(clippy::single_element_loop)]
14099        for &(find_this, param_name) in [("{+path}", "path")].iter() {
14100            url = params.uri_replacement(url, param_name, find_this, true);
14101        }
14102        {
14103            let to_remove = ["path"];
14104            params.remove_params(&to_remove);
14105        }
14106
14107        let url = params.parse_with_url(&url);
14108
14109        loop {
14110            let token = match self
14111                .hub
14112                .auth
14113                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14114                .await
14115            {
14116                Ok(token) => token,
14117                Err(e) => match dlg.token(e) {
14118                    Ok(token) => token,
14119                    Err(e) => {
14120                        dlg.finished(false);
14121                        return Err(common::Error::MissingToken(e));
14122                    }
14123                },
14124            };
14125            let mut req_result = {
14126                let client = &self.hub.client;
14127                dlg.pre_request();
14128                let mut req_builder = hyper::Request::builder()
14129                    .method(hyper::Method::GET)
14130                    .uri(url.as_str())
14131                    .header(USER_AGENT, self.hub._user_agent.clone());
14132
14133                if let Some(token) = token.as_ref() {
14134                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14135                }
14136
14137                let request = req_builder
14138                    .header(CONTENT_LENGTH, 0_u64)
14139                    .body(common::to_body::<String>(None));
14140
14141                client.request(request.unwrap()).await
14142            };
14143
14144            match req_result {
14145                Err(err) => {
14146                    if let common::Retry::After(d) = dlg.http_error(&err) {
14147                        sleep(d).await;
14148                        continue;
14149                    }
14150                    dlg.finished(false);
14151                    return Err(common::Error::HttpError(err));
14152                }
14153                Ok(res) => {
14154                    let (mut parts, body) = res.into_parts();
14155                    let mut body = common::Body::new(body);
14156                    if !parts.status.is_success() {
14157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14158                        let error = serde_json::from_str(&common::to_string(&bytes));
14159                        let response = common::to_response(parts, bytes.into());
14160
14161                        if let common::Retry::After(d) =
14162                            dlg.http_failure(&response, error.as_ref().ok())
14163                        {
14164                            sleep(d).await;
14165                            continue;
14166                        }
14167
14168                        dlg.finished(false);
14169
14170                        return Err(match error {
14171                            Ok(value) => common::Error::BadRequest(value),
14172                            _ => common::Error::Failure(response),
14173                        });
14174                    }
14175                    let response = {
14176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14177                        let encoded = common::to_string(&bytes);
14178                        match serde_json::from_str(&encoded) {
14179                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14180                            Err(error) => {
14181                                dlg.response_json_decode_error(&encoded, &error);
14182                                return Err(common::Error::JsonDecodeError(
14183                                    encoded.to_string(),
14184                                    error,
14185                                ));
14186                            }
14187                        }
14188                    };
14189
14190                    dlg.finished(true);
14191                    return Ok(response);
14192                }
14193            }
14194        }
14195    }
14196
14197    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
14198    ///
14199    /// Sets the *path* path property to the given value.
14200    ///
14201    /// Even though the property as already been set when instantiating this call,
14202    /// we provide this method for API completeness.
14203    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14204        self._path = new_value.to_string();
14205        self
14206    }
14207    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14208    /// while executing the actual API request.
14209    ///
14210    /// ````text
14211    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14212    /// ````
14213    ///
14214    /// Sets the *delegate* property to the given value.
14215    pub fn delegate(
14216        mut self,
14217        new_value: &'a mut dyn common::Delegate,
14218    ) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14219        self._delegate = Some(new_value);
14220        self
14221    }
14222
14223    /// Set any additional parameter of the query string used in the request.
14224    /// It should be used to set parameters which are not yet available through their own
14225    /// setters.
14226    ///
14227    /// Please note that this method must not be used to set any of the known parameters
14228    /// which have their own setter method. If done anyway, the request will fail.
14229    ///
14230    /// # Additional Parameters
14231    ///
14232    /// * *$.xgafv* (query-string) - V1 error format.
14233    /// * *access_token* (query-string) - OAuth access token.
14234    /// * *alt* (query-string) - Data format for response.
14235    /// * *callback* (query-string) - JSONP
14236    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14237    /// * *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.
14238    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14239    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14240    /// * *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.
14241    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14242    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14243    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14244    where
14245        T: AsRef<str>,
14246    {
14247        self._additional_params
14248            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14249        self
14250    }
14251
14252    /// Identifies the authorization scope for the method you are building.
14253    ///
14254    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14255    /// [`Scope::Readonly`].
14256    ///
14257    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14258    /// tokens for more than one scope.
14259    ///
14260    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14261    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14262    /// sufficient, a read-write scope will do as well.
14263    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14264    where
14265        St: AsRef<str>,
14266    {
14267        self._scopes.insert(String::from(scope.as_ref()));
14268        self
14269    }
14270    /// Identifies the authorization scope(s) for the method you are building.
14271    ///
14272    /// See [`Self::add_scope()`] for details.
14273    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14274    where
14275        I: IntoIterator<Item = St>,
14276        St: AsRef<str>,
14277    {
14278        self._scopes
14279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14280        self
14281    }
14282
14283    /// Removes all scopes, and no default scope will be used either.
14284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14285    /// for details).
14286    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14287        self._scopes.clear();
14288        self
14289    }
14290}
14291
14292/// Lists all GTM Folders of a Container.
14293///
14294/// A builder for the *containers.workspaces.folders.list* method supported by a *account* resource.
14295/// It is not used directly, but through a [`AccountMethods`] instance.
14296///
14297/// # Example
14298///
14299/// Instantiate a resource method builder
14300///
14301/// ```test_harness,no_run
14302/// # extern crate hyper;
14303/// # extern crate hyper_rustls;
14304/// # extern crate google_tagmanager2 as tagmanager2;
14305/// # async fn dox() {
14306/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14307///
14308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14309/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14310/// #     secret,
14311/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14312/// # ).build().await.unwrap();
14313///
14314/// # let client = hyper_util::client::legacy::Client::builder(
14315/// #     hyper_util::rt::TokioExecutor::new()
14316/// # )
14317/// # .build(
14318/// #     hyper_rustls::HttpsConnectorBuilder::new()
14319/// #         .with_native_roots()
14320/// #         .unwrap()
14321/// #         .https_or_http()
14322/// #         .enable_http1()
14323/// #         .build()
14324/// # );
14325/// # let mut hub = TagManager::new(client, auth);
14326/// // You can configure optional parameters by calling the respective setters at will, and
14327/// // execute the final call using `doit()`.
14328/// // Values shown here are possibly random and not representative !
14329/// let result = hub.accounts().containers_workspaces_folders_list("parent")
14330///              .page_token("consetetur")
14331///              .doit().await;
14332/// # }
14333/// ```
14334pub struct AccountContainerWorkspaceFolderListCall<'a, C>
14335where
14336    C: 'a,
14337{
14338    hub: &'a TagManager<C>,
14339    _parent: String,
14340    _page_token: Option<String>,
14341    _delegate: Option<&'a mut dyn common::Delegate>,
14342    _additional_params: HashMap<String, String>,
14343    _scopes: BTreeSet<String>,
14344}
14345
14346impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderListCall<'a, C> {}
14347
14348impl<'a, C> AccountContainerWorkspaceFolderListCall<'a, C>
14349where
14350    C: common::Connector,
14351{
14352    /// Perform the operation you have build so far.
14353    pub async fn doit(mut self) -> common::Result<(common::Response, ListFoldersResponse)> {
14354        use std::borrow::Cow;
14355        use std::io::{Read, Seek};
14356
14357        use common::{url::Params, ToParts};
14358        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14359
14360        let mut dd = common::DefaultDelegate;
14361        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14362        dlg.begin(common::MethodInfo {
14363            id: "tagmanager.accounts.containers.workspaces.folders.list",
14364            http_method: hyper::Method::GET,
14365        });
14366
14367        for &field in ["alt", "parent", "pageToken"].iter() {
14368            if self._additional_params.contains_key(field) {
14369                dlg.finished(false);
14370                return Err(common::Error::FieldClash(field));
14371            }
14372        }
14373
14374        let mut params = Params::with_capacity(4 + self._additional_params.len());
14375        params.push("parent", self._parent);
14376        if let Some(value) = self._page_token.as_ref() {
14377            params.push("pageToken", value);
14378        }
14379
14380        params.extend(self._additional_params.iter());
14381
14382        params.push("alt", "json");
14383        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/folders";
14384        if self._scopes.is_empty() {
14385            self._scopes.insert(Scope::Readonly.as_ref().to_string());
14386        }
14387
14388        #[allow(clippy::single_element_loop)]
14389        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14390            url = params.uri_replacement(url, param_name, find_this, true);
14391        }
14392        {
14393            let to_remove = ["parent"];
14394            params.remove_params(&to_remove);
14395        }
14396
14397        let url = params.parse_with_url(&url);
14398
14399        loop {
14400            let token = match self
14401                .hub
14402                .auth
14403                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14404                .await
14405            {
14406                Ok(token) => token,
14407                Err(e) => match dlg.token(e) {
14408                    Ok(token) => token,
14409                    Err(e) => {
14410                        dlg.finished(false);
14411                        return Err(common::Error::MissingToken(e));
14412                    }
14413                },
14414            };
14415            let mut req_result = {
14416                let client = &self.hub.client;
14417                dlg.pre_request();
14418                let mut req_builder = hyper::Request::builder()
14419                    .method(hyper::Method::GET)
14420                    .uri(url.as_str())
14421                    .header(USER_AGENT, self.hub._user_agent.clone());
14422
14423                if let Some(token) = token.as_ref() {
14424                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14425                }
14426
14427                let request = req_builder
14428                    .header(CONTENT_LENGTH, 0_u64)
14429                    .body(common::to_body::<String>(None));
14430
14431                client.request(request.unwrap()).await
14432            };
14433
14434            match req_result {
14435                Err(err) => {
14436                    if let common::Retry::After(d) = dlg.http_error(&err) {
14437                        sleep(d).await;
14438                        continue;
14439                    }
14440                    dlg.finished(false);
14441                    return Err(common::Error::HttpError(err));
14442                }
14443                Ok(res) => {
14444                    let (mut parts, body) = res.into_parts();
14445                    let mut body = common::Body::new(body);
14446                    if !parts.status.is_success() {
14447                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14448                        let error = serde_json::from_str(&common::to_string(&bytes));
14449                        let response = common::to_response(parts, bytes.into());
14450
14451                        if let common::Retry::After(d) =
14452                            dlg.http_failure(&response, error.as_ref().ok())
14453                        {
14454                            sleep(d).await;
14455                            continue;
14456                        }
14457
14458                        dlg.finished(false);
14459
14460                        return Err(match error {
14461                            Ok(value) => common::Error::BadRequest(value),
14462                            _ => common::Error::Failure(response),
14463                        });
14464                    }
14465                    let response = {
14466                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14467                        let encoded = common::to_string(&bytes);
14468                        match serde_json::from_str(&encoded) {
14469                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14470                            Err(error) => {
14471                                dlg.response_json_decode_error(&encoded, &error);
14472                                return Err(common::Error::JsonDecodeError(
14473                                    encoded.to_string(),
14474                                    error,
14475                                ));
14476                            }
14477                        }
14478                    };
14479
14480                    dlg.finished(true);
14481                    return Ok(response);
14482                }
14483            }
14484        }
14485    }
14486
14487    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
14488    ///
14489    /// Sets the *parent* path property to the given value.
14490    ///
14491    /// Even though the property as already been set when instantiating this call,
14492    /// we provide this method for API completeness.
14493    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14494        self._parent = new_value.to_string();
14495        self
14496    }
14497    /// Continuation token for fetching the next page of results.
14498    ///
14499    /// Sets the *page token* query property to the given value.
14500    pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14501        self._page_token = Some(new_value.to_string());
14502        self
14503    }
14504    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14505    /// while executing the actual API request.
14506    ///
14507    /// ````text
14508    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14509    /// ````
14510    ///
14511    /// Sets the *delegate* property to the given value.
14512    pub fn delegate(
14513        mut self,
14514        new_value: &'a mut dyn common::Delegate,
14515    ) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14516        self._delegate = Some(new_value);
14517        self
14518    }
14519
14520    /// Set any additional parameter of the query string used in the request.
14521    /// It should be used to set parameters which are not yet available through their own
14522    /// setters.
14523    ///
14524    /// Please note that this method must not be used to set any of the known parameters
14525    /// which have their own setter method. If done anyway, the request will fail.
14526    ///
14527    /// # Additional Parameters
14528    ///
14529    /// * *$.xgafv* (query-string) - V1 error format.
14530    /// * *access_token* (query-string) - OAuth access token.
14531    /// * *alt* (query-string) - Data format for response.
14532    /// * *callback* (query-string) - JSONP
14533    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14534    /// * *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.
14535    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14536    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14537    /// * *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.
14538    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14539    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14540    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderListCall<'a, C>
14541    where
14542        T: AsRef<str>,
14543    {
14544        self._additional_params
14545            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14546        self
14547    }
14548
14549    /// Identifies the authorization scope for the method you are building.
14550    ///
14551    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14552    /// [`Scope::Readonly`].
14553    ///
14554    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14555    /// tokens for more than one scope.
14556    ///
14557    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14558    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14559    /// sufficient, a read-write scope will do as well.
14560    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderListCall<'a, C>
14561    where
14562        St: AsRef<str>,
14563    {
14564        self._scopes.insert(String::from(scope.as_ref()));
14565        self
14566    }
14567    /// Identifies the authorization scope(s) for the method you are building.
14568    ///
14569    /// See [`Self::add_scope()`] for details.
14570    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceFolderListCall<'a, C>
14571    where
14572        I: IntoIterator<Item = St>,
14573        St: AsRef<str>,
14574    {
14575        self._scopes
14576            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14577        self
14578    }
14579
14580    /// Removes all scopes, and no default scope will be used either.
14581    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14582    /// for details).
14583    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14584        self._scopes.clear();
14585        self
14586    }
14587}
14588
14589/// Moves entities to a GTM Folder. If {folder_id} in the request path equals 0, this will instead move entities out of the folder they currently belong to.
14590///
14591/// A builder for the *containers.workspaces.folders.move_entities_to_folder* method supported by a *account* resource.
14592/// It is not used directly, but through a [`AccountMethods`] instance.
14593///
14594/// # Example
14595///
14596/// Instantiate a resource method builder
14597///
14598/// ```test_harness,no_run
14599/// # extern crate hyper;
14600/// # extern crate hyper_rustls;
14601/// # extern crate google_tagmanager2 as tagmanager2;
14602/// use tagmanager2::api::Folder;
14603/// # async fn dox() {
14604/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14605///
14606/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14607/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14608/// #     secret,
14609/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14610/// # ).build().await.unwrap();
14611///
14612/// # let client = hyper_util::client::legacy::Client::builder(
14613/// #     hyper_util::rt::TokioExecutor::new()
14614/// # )
14615/// # .build(
14616/// #     hyper_rustls::HttpsConnectorBuilder::new()
14617/// #         .with_native_roots()
14618/// #         .unwrap()
14619/// #         .https_or_http()
14620/// #         .enable_http1()
14621/// #         .build()
14622/// # );
14623/// # let mut hub = TagManager::new(client, auth);
14624/// // As the method needs a request, you would usually fill it with the desired information
14625/// // into the respective structure. Some of the parts shown here might not be applicable !
14626/// // Values shown here are possibly random and not representative !
14627/// let mut req = Folder::default();
14628///
14629/// // You can configure optional parameters by calling the respective setters at will, and
14630/// // execute the final call using `doit()`.
14631/// // Values shown here are possibly random and not representative !
14632/// let result = hub.accounts().containers_workspaces_folders_move_entities_to_folder(req, "path")
14633///              .add_variable_id("sed")
14634///              .add_trigger_id("takimata")
14635///              .add_tag_id("dolores")
14636///              .doit().await;
14637/// # }
14638/// ```
14639pub struct AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
14640where
14641    C: 'a,
14642{
14643    hub: &'a TagManager<C>,
14644    _request: Folder,
14645    _path: String,
14646    _variable_id: Vec<String>,
14647    _trigger_id: Vec<String>,
14648    _tag_id: Vec<String>,
14649    _delegate: Option<&'a mut dyn common::Delegate>,
14650    _additional_params: HashMap<String, String>,
14651    _scopes: BTreeSet<String>,
14652}
14653
14654impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {}
14655
14656impl<'a, C> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
14657where
14658    C: common::Connector,
14659{
14660    /// Perform the operation you have build so far.
14661    pub async fn doit(mut self) -> common::Result<common::Response> {
14662        use std::borrow::Cow;
14663        use std::io::{Read, Seek};
14664
14665        use common::{url::Params, ToParts};
14666        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14667
14668        let mut dd = common::DefaultDelegate;
14669        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14670        dlg.begin(common::MethodInfo {
14671            id: "tagmanager.accounts.containers.workspaces.folders.move_entities_to_folder",
14672            http_method: hyper::Method::POST,
14673        });
14674
14675        for &field in ["path", "variableId", "triggerId", "tagId"].iter() {
14676            if self._additional_params.contains_key(field) {
14677                dlg.finished(false);
14678                return Err(common::Error::FieldClash(field));
14679            }
14680        }
14681
14682        let mut params = Params::with_capacity(6 + self._additional_params.len());
14683        params.push("path", self._path);
14684        if !self._variable_id.is_empty() {
14685            for f in self._variable_id.iter() {
14686                params.push("variableId", f);
14687            }
14688        }
14689        if !self._trigger_id.is_empty() {
14690            for f in self._trigger_id.iter() {
14691                params.push("triggerId", f);
14692            }
14693        }
14694        if !self._tag_id.is_empty() {
14695            for f in self._tag_id.iter() {
14696                params.push("tagId", f);
14697            }
14698        }
14699
14700        params.extend(self._additional_params.iter());
14701
14702        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:move_entities_to_folder";
14703        if self._scopes.is_empty() {
14704            self._scopes
14705                .insert(Scope::EditContainer.as_ref().to_string());
14706        }
14707
14708        #[allow(clippy::single_element_loop)]
14709        for &(find_this, param_name) in [("{+path}", "path")].iter() {
14710            url = params.uri_replacement(url, param_name, find_this, true);
14711        }
14712        {
14713            let to_remove = ["path"];
14714            params.remove_params(&to_remove);
14715        }
14716
14717        let url = params.parse_with_url(&url);
14718
14719        let mut json_mime_type = mime::APPLICATION_JSON;
14720        let mut request_value_reader = {
14721            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14722            common::remove_json_null_values(&mut value);
14723            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14724            serde_json::to_writer(&mut dst, &value).unwrap();
14725            dst
14726        };
14727        let request_size = request_value_reader
14728            .seek(std::io::SeekFrom::End(0))
14729            .unwrap();
14730        request_value_reader
14731            .seek(std::io::SeekFrom::Start(0))
14732            .unwrap();
14733
14734        loop {
14735            let token = match self
14736                .hub
14737                .auth
14738                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14739                .await
14740            {
14741                Ok(token) => token,
14742                Err(e) => match dlg.token(e) {
14743                    Ok(token) => token,
14744                    Err(e) => {
14745                        dlg.finished(false);
14746                        return Err(common::Error::MissingToken(e));
14747                    }
14748                },
14749            };
14750            request_value_reader
14751                .seek(std::io::SeekFrom::Start(0))
14752                .unwrap();
14753            let mut req_result = {
14754                let client = &self.hub.client;
14755                dlg.pre_request();
14756                let mut req_builder = hyper::Request::builder()
14757                    .method(hyper::Method::POST)
14758                    .uri(url.as_str())
14759                    .header(USER_AGENT, self.hub._user_agent.clone());
14760
14761                if let Some(token) = token.as_ref() {
14762                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14763                }
14764
14765                let request = req_builder
14766                    .header(CONTENT_TYPE, json_mime_type.to_string())
14767                    .header(CONTENT_LENGTH, request_size as u64)
14768                    .body(common::to_body(
14769                        request_value_reader.get_ref().clone().into(),
14770                    ));
14771
14772                client.request(request.unwrap()).await
14773            };
14774
14775            match req_result {
14776                Err(err) => {
14777                    if let common::Retry::After(d) = dlg.http_error(&err) {
14778                        sleep(d).await;
14779                        continue;
14780                    }
14781                    dlg.finished(false);
14782                    return Err(common::Error::HttpError(err));
14783                }
14784                Ok(res) => {
14785                    let (mut parts, body) = res.into_parts();
14786                    let mut body = common::Body::new(body);
14787                    if !parts.status.is_success() {
14788                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14789                        let error = serde_json::from_str(&common::to_string(&bytes));
14790                        let response = common::to_response(parts, bytes.into());
14791
14792                        if let common::Retry::After(d) =
14793                            dlg.http_failure(&response, error.as_ref().ok())
14794                        {
14795                            sleep(d).await;
14796                            continue;
14797                        }
14798
14799                        dlg.finished(false);
14800
14801                        return Err(match error {
14802                            Ok(value) => common::Error::BadRequest(value),
14803                            _ => common::Error::Failure(response),
14804                        });
14805                    }
14806                    let response = common::Response::from_parts(parts, body);
14807
14808                    dlg.finished(true);
14809                    return Ok(response);
14810                }
14811            }
14812        }
14813    }
14814
14815    ///
14816    /// Sets the *request* property to the given value.
14817    ///
14818    /// Even though the property as already been set when instantiating this call,
14819    /// we provide this method for API completeness.
14820    pub fn request(
14821        mut self,
14822        new_value: Folder,
14823    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14824        self._request = new_value;
14825        self
14826    }
14827    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
14828    ///
14829    /// Sets the *path* path property to the given value.
14830    ///
14831    /// Even though the property as already been set when instantiating this call,
14832    /// we provide this method for API completeness.
14833    pub fn path(
14834        mut self,
14835        new_value: &str,
14836    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14837        self._path = new_value.to_string();
14838        self
14839    }
14840    /// The variables to be moved to the folder.
14841    ///
14842    /// Append the given value to the *variable id* query property.
14843    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
14844    pub fn add_variable_id(
14845        mut self,
14846        new_value: &str,
14847    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14848        self._variable_id.push(new_value.to_string());
14849        self
14850    }
14851    /// The triggers to be moved to the folder.
14852    ///
14853    /// Append the given value to the *trigger id* query property.
14854    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
14855    pub fn add_trigger_id(
14856        mut self,
14857        new_value: &str,
14858    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14859        self._trigger_id.push(new_value.to_string());
14860        self
14861    }
14862    /// The tags to be moved to the folder.
14863    ///
14864    /// Append the given value to the *tag id* query property.
14865    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
14866    pub fn add_tag_id(
14867        mut self,
14868        new_value: &str,
14869    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14870        self._tag_id.push(new_value.to_string());
14871        self
14872    }
14873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14874    /// while executing the actual API request.
14875    ///
14876    /// ````text
14877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14878    /// ````
14879    ///
14880    /// Sets the *delegate* property to the given value.
14881    pub fn delegate(
14882        mut self,
14883        new_value: &'a mut dyn common::Delegate,
14884    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14885        self._delegate = Some(new_value);
14886        self
14887    }
14888
14889    /// Set any additional parameter of the query string used in the request.
14890    /// It should be used to set parameters which are not yet available through their own
14891    /// setters.
14892    ///
14893    /// Please note that this method must not be used to set any of the known parameters
14894    /// which have their own setter method. If done anyway, the request will fail.
14895    ///
14896    /// # Additional Parameters
14897    ///
14898    /// * *$.xgafv* (query-string) - V1 error format.
14899    /// * *access_token* (query-string) - OAuth access token.
14900    /// * *alt* (query-string) - Data format for response.
14901    /// * *callback* (query-string) - JSONP
14902    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14903    /// * *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.
14904    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14905    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14906    /// * *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.
14907    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14908    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14909    pub fn param<T>(
14910        mut self,
14911        name: T,
14912        value: T,
14913    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
14914    where
14915        T: AsRef<str>,
14916    {
14917        self._additional_params
14918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14919        self
14920    }
14921
14922    /// Identifies the authorization scope for the method you are building.
14923    ///
14924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14925    /// [`Scope::EditContainer`].
14926    ///
14927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14928    /// tokens for more than one scope.
14929    ///
14930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14932    /// sufficient, a read-write scope will do as well.
14933    pub fn add_scope<St>(
14934        mut self,
14935        scope: St,
14936    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
14937    where
14938        St: AsRef<str>,
14939    {
14940        self._scopes.insert(String::from(scope.as_ref()));
14941        self
14942    }
14943    /// Identifies the authorization scope(s) for the method you are building.
14944    ///
14945    /// See [`Self::add_scope()`] for details.
14946    pub fn add_scopes<I, St>(
14947        mut self,
14948        scopes: I,
14949    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
14950    where
14951        I: IntoIterator<Item = St>,
14952        St: AsRef<str>,
14953    {
14954        self._scopes
14955            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14956        self
14957    }
14958
14959    /// Removes all scopes, and no default scope will be used either.
14960    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14961    /// for details).
14962    pub fn clear_scopes(
14963        mut self,
14964    ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
14965        self._scopes.clear();
14966        self
14967    }
14968}
14969
14970/// Reverts changes to a GTM Folder in a GTM Workspace.
14971///
14972/// A builder for the *containers.workspaces.folders.revert* method supported by a *account* resource.
14973/// It is not used directly, but through a [`AccountMethods`] instance.
14974///
14975/// # Example
14976///
14977/// Instantiate a resource method builder
14978///
14979/// ```test_harness,no_run
14980/// # extern crate hyper;
14981/// # extern crate hyper_rustls;
14982/// # extern crate google_tagmanager2 as tagmanager2;
14983/// # async fn dox() {
14984/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14985///
14986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14988/// #     secret,
14989/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14990/// # ).build().await.unwrap();
14991///
14992/// # let client = hyper_util::client::legacy::Client::builder(
14993/// #     hyper_util::rt::TokioExecutor::new()
14994/// # )
14995/// # .build(
14996/// #     hyper_rustls::HttpsConnectorBuilder::new()
14997/// #         .with_native_roots()
14998/// #         .unwrap()
14999/// #         .https_or_http()
15000/// #         .enable_http1()
15001/// #         .build()
15002/// # );
15003/// # let mut hub = TagManager::new(client, auth);
15004/// // You can configure optional parameters by calling the respective setters at will, and
15005/// // execute the final call using `doit()`.
15006/// // Values shown here are possibly random and not representative !
15007/// let result = hub.accounts().containers_workspaces_folders_revert("path")
15008///              .fingerprint("et")
15009///              .doit().await;
15010/// # }
15011/// ```
15012pub struct AccountContainerWorkspaceFolderRevertCall<'a, C>
15013where
15014    C: 'a,
15015{
15016    hub: &'a TagManager<C>,
15017    _path: String,
15018    _fingerprint: Option<String>,
15019    _delegate: Option<&'a mut dyn common::Delegate>,
15020    _additional_params: HashMap<String, String>,
15021    _scopes: BTreeSet<String>,
15022}
15023
15024impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderRevertCall<'a, C> {}
15025
15026impl<'a, C> AccountContainerWorkspaceFolderRevertCall<'a, C>
15027where
15028    C: common::Connector,
15029{
15030    /// Perform the operation you have build so far.
15031    pub async fn doit(mut self) -> common::Result<(common::Response, RevertFolderResponse)> {
15032        use std::borrow::Cow;
15033        use std::io::{Read, Seek};
15034
15035        use common::{url::Params, ToParts};
15036        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15037
15038        let mut dd = common::DefaultDelegate;
15039        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15040        dlg.begin(common::MethodInfo {
15041            id: "tagmanager.accounts.containers.workspaces.folders.revert",
15042            http_method: hyper::Method::POST,
15043        });
15044
15045        for &field in ["alt", "path", "fingerprint"].iter() {
15046            if self._additional_params.contains_key(field) {
15047                dlg.finished(false);
15048                return Err(common::Error::FieldClash(field));
15049            }
15050        }
15051
15052        let mut params = Params::with_capacity(4 + self._additional_params.len());
15053        params.push("path", self._path);
15054        if let Some(value) = self._fingerprint.as_ref() {
15055            params.push("fingerprint", value);
15056        }
15057
15058        params.extend(self._additional_params.iter());
15059
15060        params.push("alt", "json");
15061        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
15062        if self._scopes.is_empty() {
15063            self._scopes
15064                .insert(Scope::EditContainer.as_ref().to_string());
15065        }
15066
15067        #[allow(clippy::single_element_loop)]
15068        for &(find_this, param_name) in [("{+path}", "path")].iter() {
15069            url = params.uri_replacement(url, param_name, find_this, true);
15070        }
15071        {
15072            let to_remove = ["path"];
15073            params.remove_params(&to_remove);
15074        }
15075
15076        let url = params.parse_with_url(&url);
15077
15078        loop {
15079            let token = match self
15080                .hub
15081                .auth
15082                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15083                .await
15084            {
15085                Ok(token) => token,
15086                Err(e) => match dlg.token(e) {
15087                    Ok(token) => token,
15088                    Err(e) => {
15089                        dlg.finished(false);
15090                        return Err(common::Error::MissingToken(e));
15091                    }
15092                },
15093            };
15094            let mut req_result = {
15095                let client = &self.hub.client;
15096                dlg.pre_request();
15097                let mut req_builder = hyper::Request::builder()
15098                    .method(hyper::Method::POST)
15099                    .uri(url.as_str())
15100                    .header(USER_AGENT, self.hub._user_agent.clone());
15101
15102                if let Some(token) = token.as_ref() {
15103                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15104                }
15105
15106                let request = req_builder
15107                    .header(CONTENT_LENGTH, 0_u64)
15108                    .body(common::to_body::<String>(None));
15109
15110                client.request(request.unwrap()).await
15111            };
15112
15113            match req_result {
15114                Err(err) => {
15115                    if let common::Retry::After(d) = dlg.http_error(&err) {
15116                        sleep(d).await;
15117                        continue;
15118                    }
15119                    dlg.finished(false);
15120                    return Err(common::Error::HttpError(err));
15121                }
15122                Ok(res) => {
15123                    let (mut parts, body) = res.into_parts();
15124                    let mut body = common::Body::new(body);
15125                    if !parts.status.is_success() {
15126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15127                        let error = serde_json::from_str(&common::to_string(&bytes));
15128                        let response = common::to_response(parts, bytes.into());
15129
15130                        if let common::Retry::After(d) =
15131                            dlg.http_failure(&response, error.as_ref().ok())
15132                        {
15133                            sleep(d).await;
15134                            continue;
15135                        }
15136
15137                        dlg.finished(false);
15138
15139                        return Err(match error {
15140                            Ok(value) => common::Error::BadRequest(value),
15141                            _ => common::Error::Failure(response),
15142                        });
15143                    }
15144                    let response = {
15145                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15146                        let encoded = common::to_string(&bytes);
15147                        match serde_json::from_str(&encoded) {
15148                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15149                            Err(error) => {
15150                                dlg.response_json_decode_error(&encoded, &error);
15151                                return Err(common::Error::JsonDecodeError(
15152                                    encoded.to_string(),
15153                                    error,
15154                                ));
15155                            }
15156                        }
15157                    };
15158
15159                    dlg.finished(true);
15160                    return Ok(response);
15161                }
15162            }
15163        }
15164    }
15165
15166    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
15167    ///
15168    /// Sets the *path* path property to the given value.
15169    ///
15170    /// Even though the property as already been set when instantiating this call,
15171    /// we provide this method for API completeness.
15172    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15173        self._path = new_value.to_string();
15174        self
15175    }
15176    /// When provided, this fingerprint must match the fingerprint of the tag in storage.
15177    ///
15178    /// Sets the *fingerprint* query property to the given value.
15179    pub fn fingerprint(
15180        mut self,
15181        new_value: &str,
15182    ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15183        self._fingerprint = Some(new_value.to_string());
15184        self
15185    }
15186    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15187    /// while executing the actual API request.
15188    ///
15189    /// ````text
15190    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15191    /// ````
15192    ///
15193    /// Sets the *delegate* property to the given value.
15194    pub fn delegate(
15195        mut self,
15196        new_value: &'a mut dyn common::Delegate,
15197    ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15198        self._delegate = Some(new_value);
15199        self
15200    }
15201
15202    /// Set any additional parameter of the query string used in the request.
15203    /// It should be used to set parameters which are not yet available through their own
15204    /// setters.
15205    ///
15206    /// Please note that this method must not be used to set any of the known parameters
15207    /// which have their own setter method. If done anyway, the request will fail.
15208    ///
15209    /// # Additional Parameters
15210    ///
15211    /// * *$.xgafv* (query-string) - V1 error format.
15212    /// * *access_token* (query-string) - OAuth access token.
15213    /// * *alt* (query-string) - Data format for response.
15214    /// * *callback* (query-string) - JSONP
15215    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15216    /// * *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.
15217    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15218    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15219    /// * *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.
15220    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15221    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15222    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15223    where
15224        T: AsRef<str>,
15225    {
15226        self._additional_params
15227            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15228        self
15229    }
15230
15231    /// Identifies the authorization scope for the method you are building.
15232    ///
15233    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15234    /// [`Scope::EditContainer`].
15235    ///
15236    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15237    /// tokens for more than one scope.
15238    ///
15239    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15240    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15241    /// sufficient, a read-write scope will do as well.
15242    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15243    where
15244        St: AsRef<str>,
15245    {
15246        self._scopes.insert(String::from(scope.as_ref()));
15247        self
15248    }
15249    /// Identifies the authorization scope(s) for the method you are building.
15250    ///
15251    /// See [`Self::add_scope()`] for details.
15252    pub fn add_scopes<I, St>(
15253        mut self,
15254        scopes: I,
15255    ) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15256    where
15257        I: IntoIterator<Item = St>,
15258        St: AsRef<str>,
15259    {
15260        self._scopes
15261            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15262        self
15263    }
15264
15265    /// Removes all scopes, and no default scope will be used either.
15266    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15267    /// for details).
15268    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15269        self._scopes.clear();
15270        self
15271    }
15272}
15273
15274/// Updates a GTM Folder.
15275///
15276/// A builder for the *containers.workspaces.folders.update* method supported by a *account* resource.
15277/// It is not used directly, but through a [`AccountMethods`] instance.
15278///
15279/// # Example
15280///
15281/// Instantiate a resource method builder
15282///
15283/// ```test_harness,no_run
15284/// # extern crate hyper;
15285/// # extern crate hyper_rustls;
15286/// # extern crate google_tagmanager2 as tagmanager2;
15287/// use tagmanager2::api::Folder;
15288/// # async fn dox() {
15289/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15290///
15291/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15293/// #     secret,
15294/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15295/// # ).build().await.unwrap();
15296///
15297/// # let client = hyper_util::client::legacy::Client::builder(
15298/// #     hyper_util::rt::TokioExecutor::new()
15299/// # )
15300/// # .build(
15301/// #     hyper_rustls::HttpsConnectorBuilder::new()
15302/// #         .with_native_roots()
15303/// #         .unwrap()
15304/// #         .https_or_http()
15305/// #         .enable_http1()
15306/// #         .build()
15307/// # );
15308/// # let mut hub = TagManager::new(client, auth);
15309/// // As the method needs a request, you would usually fill it with the desired information
15310/// // into the respective structure. Some of the parts shown here might not be applicable !
15311/// // Values shown here are possibly random and not representative !
15312/// let mut req = Folder::default();
15313///
15314/// // You can configure optional parameters by calling the respective setters at will, and
15315/// // execute the final call using `doit()`.
15316/// // Values shown here are possibly random and not representative !
15317/// let result = hub.accounts().containers_workspaces_folders_update(req, "path")
15318///              .fingerprint("voluptua.")
15319///              .doit().await;
15320/// # }
15321/// ```
15322pub struct AccountContainerWorkspaceFolderUpdateCall<'a, C>
15323where
15324    C: 'a,
15325{
15326    hub: &'a TagManager<C>,
15327    _request: Folder,
15328    _path: String,
15329    _fingerprint: Option<String>,
15330    _delegate: Option<&'a mut dyn common::Delegate>,
15331    _additional_params: HashMap<String, String>,
15332    _scopes: BTreeSet<String>,
15333}
15334
15335impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderUpdateCall<'a, C> {}
15336
15337impl<'a, C> AccountContainerWorkspaceFolderUpdateCall<'a, C>
15338where
15339    C: common::Connector,
15340{
15341    /// Perform the operation you have build so far.
15342    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
15343        use std::borrow::Cow;
15344        use std::io::{Read, Seek};
15345
15346        use common::{url::Params, ToParts};
15347        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15348
15349        let mut dd = common::DefaultDelegate;
15350        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15351        dlg.begin(common::MethodInfo {
15352            id: "tagmanager.accounts.containers.workspaces.folders.update",
15353            http_method: hyper::Method::PUT,
15354        });
15355
15356        for &field in ["alt", "path", "fingerprint"].iter() {
15357            if self._additional_params.contains_key(field) {
15358                dlg.finished(false);
15359                return Err(common::Error::FieldClash(field));
15360            }
15361        }
15362
15363        let mut params = Params::with_capacity(5 + self._additional_params.len());
15364        params.push("path", self._path);
15365        if let Some(value) = self._fingerprint.as_ref() {
15366            params.push("fingerprint", value);
15367        }
15368
15369        params.extend(self._additional_params.iter());
15370
15371        params.push("alt", "json");
15372        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
15373        if self._scopes.is_empty() {
15374            self._scopes
15375                .insert(Scope::EditContainer.as_ref().to_string());
15376        }
15377
15378        #[allow(clippy::single_element_loop)]
15379        for &(find_this, param_name) in [("{+path}", "path")].iter() {
15380            url = params.uri_replacement(url, param_name, find_this, true);
15381        }
15382        {
15383            let to_remove = ["path"];
15384            params.remove_params(&to_remove);
15385        }
15386
15387        let url = params.parse_with_url(&url);
15388
15389        let mut json_mime_type = mime::APPLICATION_JSON;
15390        let mut request_value_reader = {
15391            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15392            common::remove_json_null_values(&mut value);
15393            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15394            serde_json::to_writer(&mut dst, &value).unwrap();
15395            dst
15396        };
15397        let request_size = request_value_reader
15398            .seek(std::io::SeekFrom::End(0))
15399            .unwrap();
15400        request_value_reader
15401            .seek(std::io::SeekFrom::Start(0))
15402            .unwrap();
15403
15404        loop {
15405            let token = match self
15406                .hub
15407                .auth
15408                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15409                .await
15410            {
15411                Ok(token) => token,
15412                Err(e) => match dlg.token(e) {
15413                    Ok(token) => token,
15414                    Err(e) => {
15415                        dlg.finished(false);
15416                        return Err(common::Error::MissingToken(e));
15417                    }
15418                },
15419            };
15420            request_value_reader
15421                .seek(std::io::SeekFrom::Start(0))
15422                .unwrap();
15423            let mut req_result = {
15424                let client = &self.hub.client;
15425                dlg.pre_request();
15426                let mut req_builder = hyper::Request::builder()
15427                    .method(hyper::Method::PUT)
15428                    .uri(url.as_str())
15429                    .header(USER_AGENT, self.hub._user_agent.clone());
15430
15431                if let Some(token) = token.as_ref() {
15432                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15433                }
15434
15435                let request = req_builder
15436                    .header(CONTENT_TYPE, json_mime_type.to_string())
15437                    .header(CONTENT_LENGTH, request_size as u64)
15438                    .body(common::to_body(
15439                        request_value_reader.get_ref().clone().into(),
15440                    ));
15441
15442                client.request(request.unwrap()).await
15443            };
15444
15445            match req_result {
15446                Err(err) => {
15447                    if let common::Retry::After(d) = dlg.http_error(&err) {
15448                        sleep(d).await;
15449                        continue;
15450                    }
15451                    dlg.finished(false);
15452                    return Err(common::Error::HttpError(err));
15453                }
15454                Ok(res) => {
15455                    let (mut parts, body) = res.into_parts();
15456                    let mut body = common::Body::new(body);
15457                    if !parts.status.is_success() {
15458                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15459                        let error = serde_json::from_str(&common::to_string(&bytes));
15460                        let response = common::to_response(parts, bytes.into());
15461
15462                        if let common::Retry::After(d) =
15463                            dlg.http_failure(&response, error.as_ref().ok())
15464                        {
15465                            sleep(d).await;
15466                            continue;
15467                        }
15468
15469                        dlg.finished(false);
15470
15471                        return Err(match error {
15472                            Ok(value) => common::Error::BadRequest(value),
15473                            _ => common::Error::Failure(response),
15474                        });
15475                    }
15476                    let response = {
15477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15478                        let encoded = common::to_string(&bytes);
15479                        match serde_json::from_str(&encoded) {
15480                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15481                            Err(error) => {
15482                                dlg.response_json_decode_error(&encoded, &error);
15483                                return Err(common::Error::JsonDecodeError(
15484                                    encoded.to_string(),
15485                                    error,
15486                                ));
15487                            }
15488                        }
15489                    };
15490
15491                    dlg.finished(true);
15492                    return Ok(response);
15493                }
15494            }
15495        }
15496    }
15497
15498    ///
15499    /// Sets the *request* property to the given value.
15500    ///
15501    /// Even though the property as already been set when instantiating this call,
15502    /// we provide this method for API completeness.
15503    pub fn request(
15504        mut self,
15505        new_value: Folder,
15506    ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
15507        self._request = new_value;
15508        self
15509    }
15510    /// GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id}
15511    ///
15512    /// Sets the *path* path property to the given value.
15513    ///
15514    /// Even though the property as already been set when instantiating this call,
15515    /// we provide this method for API completeness.
15516    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
15517        self._path = new_value.to_string();
15518        self
15519    }
15520    /// When provided, this fingerprint must match the fingerprint of the folder in storage.
15521    ///
15522    /// Sets the *fingerprint* query property to the given value.
15523    pub fn fingerprint(
15524        mut self,
15525        new_value: &str,
15526    ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
15527        self._fingerprint = Some(new_value.to_string());
15528        self
15529    }
15530    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15531    /// while executing the actual API request.
15532    ///
15533    /// ````text
15534    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15535    /// ````
15536    ///
15537    /// Sets the *delegate* property to the given value.
15538    pub fn delegate(
15539        mut self,
15540        new_value: &'a mut dyn common::Delegate,
15541    ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
15542        self._delegate = Some(new_value);
15543        self
15544    }
15545
15546    /// Set any additional parameter of the query string used in the request.
15547    /// It should be used to set parameters which are not yet available through their own
15548    /// setters.
15549    ///
15550    /// Please note that this method must not be used to set any of the known parameters
15551    /// which have their own setter method. If done anyway, the request will fail.
15552    ///
15553    /// # Additional Parameters
15554    ///
15555    /// * *$.xgafv* (query-string) - V1 error format.
15556    /// * *access_token* (query-string) - OAuth access token.
15557    /// * *alt* (query-string) - Data format for response.
15558    /// * *callback* (query-string) - JSONP
15559    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15560    /// * *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.
15561    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15562    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15563    /// * *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.
15564    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15565    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15566    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
15567    where
15568        T: AsRef<str>,
15569    {
15570        self._additional_params
15571            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15572        self
15573    }
15574
15575    /// Identifies the authorization scope for the method you are building.
15576    ///
15577    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15578    /// [`Scope::EditContainer`].
15579    ///
15580    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15581    /// tokens for more than one scope.
15582    ///
15583    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15584    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15585    /// sufficient, a read-write scope will do as well.
15586    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
15587    where
15588        St: AsRef<str>,
15589    {
15590        self._scopes.insert(String::from(scope.as_ref()));
15591        self
15592    }
15593    /// Identifies the authorization scope(s) for the method you are building.
15594    ///
15595    /// See [`Self::add_scope()`] for details.
15596    pub fn add_scopes<I, St>(
15597        mut self,
15598        scopes: I,
15599    ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
15600    where
15601        I: IntoIterator<Item = St>,
15602        St: AsRef<str>,
15603    {
15604        self._scopes
15605            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15606        self
15607    }
15608
15609    /// Removes all scopes, and no default scope will be used either.
15610    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15611    /// for details).
15612    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
15613        self._scopes.clear();
15614        self
15615    }
15616}
15617
15618/// Creates a Google tag config.
15619///
15620/// A builder for the *containers.workspaces.gtag_config.create* method supported by a *account* resource.
15621/// It is not used directly, but through a [`AccountMethods`] instance.
15622///
15623/// # Example
15624///
15625/// Instantiate a resource method builder
15626///
15627/// ```test_harness,no_run
15628/// # extern crate hyper;
15629/// # extern crate hyper_rustls;
15630/// # extern crate google_tagmanager2 as tagmanager2;
15631/// use tagmanager2::api::GtagConfig;
15632/// # async fn dox() {
15633/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15634///
15635/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15636/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15637/// #     secret,
15638/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15639/// # ).build().await.unwrap();
15640///
15641/// # let client = hyper_util::client::legacy::Client::builder(
15642/// #     hyper_util::rt::TokioExecutor::new()
15643/// # )
15644/// # .build(
15645/// #     hyper_rustls::HttpsConnectorBuilder::new()
15646/// #         .with_native_roots()
15647/// #         .unwrap()
15648/// #         .https_or_http()
15649/// #         .enable_http1()
15650/// #         .build()
15651/// # );
15652/// # let mut hub = TagManager::new(client, auth);
15653/// // As the method needs a request, you would usually fill it with the desired information
15654/// // into the respective structure. Some of the parts shown here might not be applicable !
15655/// // Values shown here are possibly random and not representative !
15656/// let mut req = GtagConfig::default();
15657///
15658/// // You can configure optional parameters by calling the respective setters at will, and
15659/// // execute the final call using `doit()`.
15660/// // Values shown here are possibly random and not representative !
15661/// let result = hub.accounts().containers_workspaces_gtag_config_create(req, "parent")
15662///              .doit().await;
15663/// # }
15664/// ```
15665pub struct AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
15666where
15667    C: 'a,
15668{
15669    hub: &'a TagManager<C>,
15670    _request: GtagConfig,
15671    _parent: String,
15672    _delegate: Option<&'a mut dyn common::Delegate>,
15673    _additional_params: HashMap<String, String>,
15674    _scopes: BTreeSet<String>,
15675}
15676
15677impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {}
15678
15679impl<'a, C> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
15680where
15681    C: common::Connector,
15682{
15683    /// Perform the operation you have build so far.
15684    pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
15685        use std::borrow::Cow;
15686        use std::io::{Read, Seek};
15687
15688        use common::{url::Params, ToParts};
15689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15690
15691        let mut dd = common::DefaultDelegate;
15692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15693        dlg.begin(common::MethodInfo {
15694            id: "tagmanager.accounts.containers.workspaces.gtag_config.create",
15695            http_method: hyper::Method::POST,
15696        });
15697
15698        for &field in ["alt", "parent"].iter() {
15699            if self._additional_params.contains_key(field) {
15700                dlg.finished(false);
15701                return Err(common::Error::FieldClash(field));
15702            }
15703        }
15704
15705        let mut params = Params::with_capacity(4 + self._additional_params.len());
15706        params.push("parent", self._parent);
15707
15708        params.extend(self._additional_params.iter());
15709
15710        params.push("alt", "json");
15711        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/gtag_config";
15712        if self._scopes.is_empty() {
15713            self._scopes
15714                .insert(Scope::EditContainer.as_ref().to_string());
15715        }
15716
15717        #[allow(clippy::single_element_loop)]
15718        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15719            url = params.uri_replacement(url, param_name, find_this, true);
15720        }
15721        {
15722            let to_remove = ["parent"];
15723            params.remove_params(&to_remove);
15724        }
15725
15726        let url = params.parse_with_url(&url);
15727
15728        let mut json_mime_type = mime::APPLICATION_JSON;
15729        let mut request_value_reader = {
15730            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15731            common::remove_json_null_values(&mut value);
15732            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15733            serde_json::to_writer(&mut dst, &value).unwrap();
15734            dst
15735        };
15736        let request_size = request_value_reader
15737            .seek(std::io::SeekFrom::End(0))
15738            .unwrap();
15739        request_value_reader
15740            .seek(std::io::SeekFrom::Start(0))
15741            .unwrap();
15742
15743        loop {
15744            let token = match self
15745                .hub
15746                .auth
15747                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15748                .await
15749            {
15750                Ok(token) => token,
15751                Err(e) => match dlg.token(e) {
15752                    Ok(token) => token,
15753                    Err(e) => {
15754                        dlg.finished(false);
15755                        return Err(common::Error::MissingToken(e));
15756                    }
15757                },
15758            };
15759            request_value_reader
15760                .seek(std::io::SeekFrom::Start(0))
15761                .unwrap();
15762            let mut req_result = {
15763                let client = &self.hub.client;
15764                dlg.pre_request();
15765                let mut req_builder = hyper::Request::builder()
15766                    .method(hyper::Method::POST)
15767                    .uri(url.as_str())
15768                    .header(USER_AGENT, self.hub._user_agent.clone());
15769
15770                if let Some(token) = token.as_ref() {
15771                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15772                }
15773
15774                let request = req_builder
15775                    .header(CONTENT_TYPE, json_mime_type.to_string())
15776                    .header(CONTENT_LENGTH, request_size as u64)
15777                    .body(common::to_body(
15778                        request_value_reader.get_ref().clone().into(),
15779                    ));
15780
15781                client.request(request.unwrap()).await
15782            };
15783
15784            match req_result {
15785                Err(err) => {
15786                    if let common::Retry::After(d) = dlg.http_error(&err) {
15787                        sleep(d).await;
15788                        continue;
15789                    }
15790                    dlg.finished(false);
15791                    return Err(common::Error::HttpError(err));
15792                }
15793                Ok(res) => {
15794                    let (mut parts, body) = res.into_parts();
15795                    let mut body = common::Body::new(body);
15796                    if !parts.status.is_success() {
15797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15798                        let error = serde_json::from_str(&common::to_string(&bytes));
15799                        let response = common::to_response(parts, bytes.into());
15800
15801                        if let common::Retry::After(d) =
15802                            dlg.http_failure(&response, error.as_ref().ok())
15803                        {
15804                            sleep(d).await;
15805                            continue;
15806                        }
15807
15808                        dlg.finished(false);
15809
15810                        return Err(match error {
15811                            Ok(value) => common::Error::BadRequest(value),
15812                            _ => common::Error::Failure(response),
15813                        });
15814                    }
15815                    let response = {
15816                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15817                        let encoded = common::to_string(&bytes);
15818                        match serde_json::from_str(&encoded) {
15819                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15820                            Err(error) => {
15821                                dlg.response_json_decode_error(&encoded, &error);
15822                                return Err(common::Error::JsonDecodeError(
15823                                    encoded.to_string(),
15824                                    error,
15825                                ));
15826                            }
15827                        }
15828                    };
15829
15830                    dlg.finished(true);
15831                    return Ok(response);
15832                }
15833            }
15834        }
15835    }
15836
15837    ///
15838    /// Sets the *request* property to the given value.
15839    ///
15840    /// Even though the property as already been set when instantiating this call,
15841    /// we provide this method for API completeness.
15842    pub fn request(
15843        mut self,
15844        new_value: GtagConfig,
15845    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
15846        self._request = new_value;
15847        self
15848    }
15849    /// Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
15850    ///
15851    /// Sets the *parent* path property to the given value.
15852    ///
15853    /// Even though the property as already been set when instantiating this call,
15854    /// we provide this method for API completeness.
15855    pub fn parent(
15856        mut self,
15857        new_value: &str,
15858    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
15859        self._parent = new_value.to_string();
15860        self
15861    }
15862    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15863    /// while executing the actual API request.
15864    ///
15865    /// ````text
15866    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15867    /// ````
15868    ///
15869    /// Sets the *delegate* property to the given value.
15870    pub fn delegate(
15871        mut self,
15872        new_value: &'a mut dyn common::Delegate,
15873    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
15874        self._delegate = Some(new_value);
15875        self
15876    }
15877
15878    /// Set any additional parameter of the query string used in the request.
15879    /// It should be used to set parameters which are not yet available through their own
15880    /// setters.
15881    ///
15882    /// Please note that this method must not be used to set any of the known parameters
15883    /// which have their own setter method. If done anyway, the request will fail.
15884    ///
15885    /// # Additional Parameters
15886    ///
15887    /// * *$.xgafv* (query-string) - V1 error format.
15888    /// * *access_token* (query-string) - OAuth access token.
15889    /// * *alt* (query-string) - Data format for response.
15890    /// * *callback* (query-string) - JSONP
15891    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15892    /// * *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.
15893    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15894    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15895    /// * *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.
15896    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15897    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15898    pub fn param<T>(
15899        mut self,
15900        name: T,
15901        value: T,
15902    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
15903    where
15904        T: AsRef<str>,
15905    {
15906        self._additional_params
15907            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15908        self
15909    }
15910
15911    /// Identifies the authorization scope for the method you are building.
15912    ///
15913    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15914    /// [`Scope::EditContainer`].
15915    ///
15916    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15917    /// tokens for more than one scope.
15918    ///
15919    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15920    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15921    /// sufficient, a read-write scope will do as well.
15922    pub fn add_scope<St>(
15923        mut self,
15924        scope: St,
15925    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
15926    where
15927        St: AsRef<str>,
15928    {
15929        self._scopes.insert(String::from(scope.as_ref()));
15930        self
15931    }
15932    /// Identifies the authorization scope(s) for the method you are building.
15933    ///
15934    /// See [`Self::add_scope()`] for details.
15935    pub fn add_scopes<I, St>(
15936        mut self,
15937        scopes: I,
15938    ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
15939    where
15940        I: IntoIterator<Item = St>,
15941        St: AsRef<str>,
15942    {
15943        self._scopes
15944            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15945        self
15946    }
15947
15948    /// Removes all scopes, and no default scope will be used either.
15949    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15950    /// for details).
15951    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
15952        self._scopes.clear();
15953        self
15954    }
15955}
15956
15957/// Deletes a Google tag config.
15958///
15959/// A builder for the *containers.workspaces.gtag_config.delete* method supported by a *account* resource.
15960/// It is not used directly, but through a [`AccountMethods`] instance.
15961///
15962/// # Example
15963///
15964/// Instantiate a resource method builder
15965///
15966/// ```test_harness,no_run
15967/// # extern crate hyper;
15968/// # extern crate hyper_rustls;
15969/// # extern crate google_tagmanager2 as tagmanager2;
15970/// # async fn dox() {
15971/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15972///
15973/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15975/// #     secret,
15976/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15977/// # ).build().await.unwrap();
15978///
15979/// # let client = hyper_util::client::legacy::Client::builder(
15980/// #     hyper_util::rt::TokioExecutor::new()
15981/// # )
15982/// # .build(
15983/// #     hyper_rustls::HttpsConnectorBuilder::new()
15984/// #         .with_native_roots()
15985/// #         .unwrap()
15986/// #         .https_or_http()
15987/// #         .enable_http1()
15988/// #         .build()
15989/// # );
15990/// # let mut hub = TagManager::new(client, auth);
15991/// // You can configure optional parameters by calling the respective setters at will, and
15992/// // execute the final call using `doit()`.
15993/// // Values shown here are possibly random and not representative !
15994/// let result = hub.accounts().containers_workspaces_gtag_config_delete("path")
15995///              .doit().await;
15996/// # }
15997/// ```
15998pub struct AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
15999where
16000    C: 'a,
16001{
16002    hub: &'a TagManager<C>,
16003    _path: String,
16004    _delegate: Option<&'a mut dyn common::Delegate>,
16005    _additional_params: HashMap<String, String>,
16006    _scopes: BTreeSet<String>,
16007}
16008
16009impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {}
16010
16011impl<'a, C> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16012where
16013    C: common::Connector,
16014{
16015    /// Perform the operation you have build so far.
16016    pub async fn doit(mut self) -> common::Result<common::Response> {
16017        use std::borrow::Cow;
16018        use std::io::{Read, Seek};
16019
16020        use common::{url::Params, ToParts};
16021        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16022
16023        let mut dd = common::DefaultDelegate;
16024        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16025        dlg.begin(common::MethodInfo {
16026            id: "tagmanager.accounts.containers.workspaces.gtag_config.delete",
16027            http_method: hyper::Method::DELETE,
16028        });
16029
16030        for &field in ["path"].iter() {
16031            if self._additional_params.contains_key(field) {
16032                dlg.finished(false);
16033                return Err(common::Error::FieldClash(field));
16034            }
16035        }
16036
16037        let mut params = Params::with_capacity(2 + self._additional_params.len());
16038        params.push("path", self._path);
16039
16040        params.extend(self._additional_params.iter());
16041
16042        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
16043        if self._scopes.is_empty() {
16044            self._scopes
16045                .insert(Scope::EditContainer.as_ref().to_string());
16046        }
16047
16048        #[allow(clippy::single_element_loop)]
16049        for &(find_this, param_name) in [("{+path}", "path")].iter() {
16050            url = params.uri_replacement(url, param_name, find_this, true);
16051        }
16052        {
16053            let to_remove = ["path"];
16054            params.remove_params(&to_remove);
16055        }
16056
16057        let url = params.parse_with_url(&url);
16058
16059        loop {
16060            let token = match self
16061                .hub
16062                .auth
16063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16064                .await
16065            {
16066                Ok(token) => token,
16067                Err(e) => match dlg.token(e) {
16068                    Ok(token) => token,
16069                    Err(e) => {
16070                        dlg.finished(false);
16071                        return Err(common::Error::MissingToken(e));
16072                    }
16073                },
16074            };
16075            let mut req_result = {
16076                let client = &self.hub.client;
16077                dlg.pre_request();
16078                let mut req_builder = hyper::Request::builder()
16079                    .method(hyper::Method::DELETE)
16080                    .uri(url.as_str())
16081                    .header(USER_AGENT, self.hub._user_agent.clone());
16082
16083                if let Some(token) = token.as_ref() {
16084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16085                }
16086
16087                let request = req_builder
16088                    .header(CONTENT_LENGTH, 0_u64)
16089                    .body(common::to_body::<String>(None));
16090
16091                client.request(request.unwrap()).await
16092            };
16093
16094            match req_result {
16095                Err(err) => {
16096                    if let common::Retry::After(d) = dlg.http_error(&err) {
16097                        sleep(d).await;
16098                        continue;
16099                    }
16100                    dlg.finished(false);
16101                    return Err(common::Error::HttpError(err));
16102                }
16103                Ok(res) => {
16104                    let (mut parts, body) = res.into_parts();
16105                    let mut body = common::Body::new(body);
16106                    if !parts.status.is_success() {
16107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16108                        let error = serde_json::from_str(&common::to_string(&bytes));
16109                        let response = common::to_response(parts, bytes.into());
16110
16111                        if let common::Retry::After(d) =
16112                            dlg.http_failure(&response, error.as_ref().ok())
16113                        {
16114                            sleep(d).await;
16115                            continue;
16116                        }
16117
16118                        dlg.finished(false);
16119
16120                        return Err(match error {
16121                            Ok(value) => common::Error::BadRequest(value),
16122                            _ => common::Error::Failure(response),
16123                        });
16124                    }
16125                    let response = common::Response::from_parts(parts, body);
16126
16127                    dlg.finished(true);
16128                    return Ok(response);
16129                }
16130            }
16131        }
16132    }
16133
16134    /// Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
16135    ///
16136    /// Sets the *path* path property to the given value.
16137    ///
16138    /// Even though the property as already been set when instantiating this call,
16139    /// we provide this method for API completeness.
16140    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16141        self._path = new_value.to_string();
16142        self
16143    }
16144    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16145    /// while executing the actual API request.
16146    ///
16147    /// ````text
16148    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16149    /// ````
16150    ///
16151    /// Sets the *delegate* property to the given value.
16152    pub fn delegate(
16153        mut self,
16154        new_value: &'a mut dyn common::Delegate,
16155    ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16156        self._delegate = Some(new_value);
16157        self
16158    }
16159
16160    /// Set any additional parameter of the query string used in the request.
16161    /// It should be used to set parameters which are not yet available through their own
16162    /// setters.
16163    ///
16164    /// Please note that this method must not be used to set any of the known parameters
16165    /// which have their own setter method. If done anyway, the request will fail.
16166    ///
16167    /// # Additional Parameters
16168    ///
16169    /// * *$.xgafv* (query-string) - V1 error format.
16170    /// * *access_token* (query-string) - OAuth access token.
16171    /// * *alt* (query-string) - Data format for response.
16172    /// * *callback* (query-string) - JSONP
16173    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16174    /// * *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.
16175    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16176    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16177    /// * *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.
16178    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16179    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16180    pub fn param<T>(
16181        mut self,
16182        name: T,
16183        value: T,
16184    ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16185    where
16186        T: AsRef<str>,
16187    {
16188        self._additional_params
16189            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16190        self
16191    }
16192
16193    /// Identifies the authorization scope for the method you are building.
16194    ///
16195    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16196    /// [`Scope::EditContainer`].
16197    ///
16198    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16199    /// tokens for more than one scope.
16200    ///
16201    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16202    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16203    /// sufficient, a read-write scope will do as well.
16204    pub fn add_scope<St>(
16205        mut self,
16206        scope: St,
16207    ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16208    where
16209        St: AsRef<str>,
16210    {
16211        self._scopes.insert(String::from(scope.as_ref()));
16212        self
16213    }
16214    /// Identifies the authorization scope(s) for the method you are building.
16215    ///
16216    /// See [`Self::add_scope()`] for details.
16217    pub fn add_scopes<I, St>(
16218        mut self,
16219        scopes: I,
16220    ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16221    where
16222        I: IntoIterator<Item = St>,
16223        St: AsRef<str>,
16224    {
16225        self._scopes
16226            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16227        self
16228    }
16229
16230    /// Removes all scopes, and no default scope will be used either.
16231    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16232    /// for details).
16233    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16234        self._scopes.clear();
16235        self
16236    }
16237}
16238
16239/// Gets a Google tag config.
16240///
16241/// A builder for the *containers.workspaces.gtag_config.get* method supported by a *account* resource.
16242/// It is not used directly, but through a [`AccountMethods`] instance.
16243///
16244/// # Example
16245///
16246/// Instantiate a resource method builder
16247///
16248/// ```test_harness,no_run
16249/// # extern crate hyper;
16250/// # extern crate hyper_rustls;
16251/// # extern crate google_tagmanager2 as tagmanager2;
16252/// # async fn dox() {
16253/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16254///
16255/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16256/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16257/// #     secret,
16258/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16259/// # ).build().await.unwrap();
16260///
16261/// # let client = hyper_util::client::legacy::Client::builder(
16262/// #     hyper_util::rt::TokioExecutor::new()
16263/// # )
16264/// # .build(
16265/// #     hyper_rustls::HttpsConnectorBuilder::new()
16266/// #         .with_native_roots()
16267/// #         .unwrap()
16268/// #         .https_or_http()
16269/// #         .enable_http1()
16270/// #         .build()
16271/// # );
16272/// # let mut hub = TagManager::new(client, auth);
16273/// // You can configure optional parameters by calling the respective setters at will, and
16274/// // execute the final call using `doit()`.
16275/// // Values shown here are possibly random and not representative !
16276/// let result = hub.accounts().containers_workspaces_gtag_config_get("path")
16277///              .doit().await;
16278/// # }
16279/// ```
16280pub struct AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16281where
16282    C: 'a,
16283{
16284    hub: &'a TagManager<C>,
16285    _path: String,
16286    _delegate: Option<&'a mut dyn common::Delegate>,
16287    _additional_params: HashMap<String, String>,
16288    _scopes: BTreeSet<String>,
16289}
16290
16291impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigGetCall<'a, C> {}
16292
16293impl<'a, C> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16294where
16295    C: common::Connector,
16296{
16297    /// Perform the operation you have build so far.
16298    pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
16299        use std::borrow::Cow;
16300        use std::io::{Read, Seek};
16301
16302        use common::{url::Params, ToParts};
16303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16304
16305        let mut dd = common::DefaultDelegate;
16306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16307        dlg.begin(common::MethodInfo {
16308            id: "tagmanager.accounts.containers.workspaces.gtag_config.get",
16309            http_method: hyper::Method::GET,
16310        });
16311
16312        for &field in ["alt", "path"].iter() {
16313            if self._additional_params.contains_key(field) {
16314                dlg.finished(false);
16315                return Err(common::Error::FieldClash(field));
16316            }
16317        }
16318
16319        let mut params = Params::with_capacity(3 + self._additional_params.len());
16320        params.push("path", self._path);
16321
16322        params.extend(self._additional_params.iter());
16323
16324        params.push("alt", "json");
16325        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
16326        if self._scopes.is_empty() {
16327            self._scopes.insert(Scope::Readonly.as_ref().to_string());
16328        }
16329
16330        #[allow(clippy::single_element_loop)]
16331        for &(find_this, param_name) in [("{+path}", "path")].iter() {
16332            url = params.uri_replacement(url, param_name, find_this, true);
16333        }
16334        {
16335            let to_remove = ["path"];
16336            params.remove_params(&to_remove);
16337        }
16338
16339        let url = params.parse_with_url(&url);
16340
16341        loop {
16342            let token = match self
16343                .hub
16344                .auth
16345                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16346                .await
16347            {
16348                Ok(token) => token,
16349                Err(e) => match dlg.token(e) {
16350                    Ok(token) => token,
16351                    Err(e) => {
16352                        dlg.finished(false);
16353                        return Err(common::Error::MissingToken(e));
16354                    }
16355                },
16356            };
16357            let mut req_result = {
16358                let client = &self.hub.client;
16359                dlg.pre_request();
16360                let mut req_builder = hyper::Request::builder()
16361                    .method(hyper::Method::GET)
16362                    .uri(url.as_str())
16363                    .header(USER_AGENT, self.hub._user_agent.clone());
16364
16365                if let Some(token) = token.as_ref() {
16366                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16367                }
16368
16369                let request = req_builder
16370                    .header(CONTENT_LENGTH, 0_u64)
16371                    .body(common::to_body::<String>(None));
16372
16373                client.request(request.unwrap()).await
16374            };
16375
16376            match req_result {
16377                Err(err) => {
16378                    if let common::Retry::After(d) = dlg.http_error(&err) {
16379                        sleep(d).await;
16380                        continue;
16381                    }
16382                    dlg.finished(false);
16383                    return Err(common::Error::HttpError(err));
16384                }
16385                Ok(res) => {
16386                    let (mut parts, body) = res.into_parts();
16387                    let mut body = common::Body::new(body);
16388                    if !parts.status.is_success() {
16389                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16390                        let error = serde_json::from_str(&common::to_string(&bytes));
16391                        let response = common::to_response(parts, bytes.into());
16392
16393                        if let common::Retry::After(d) =
16394                            dlg.http_failure(&response, error.as_ref().ok())
16395                        {
16396                            sleep(d).await;
16397                            continue;
16398                        }
16399
16400                        dlg.finished(false);
16401
16402                        return Err(match error {
16403                            Ok(value) => common::Error::BadRequest(value),
16404                            _ => common::Error::Failure(response),
16405                        });
16406                    }
16407                    let response = {
16408                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16409                        let encoded = common::to_string(&bytes);
16410                        match serde_json::from_str(&encoded) {
16411                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16412                            Err(error) => {
16413                                dlg.response_json_decode_error(&encoded, &error);
16414                                return Err(common::Error::JsonDecodeError(
16415                                    encoded.to_string(),
16416                                    error,
16417                                ));
16418                            }
16419                        }
16420                    };
16421
16422                    dlg.finished(true);
16423                    return Ok(response);
16424                }
16425            }
16426        }
16427    }
16428
16429    /// Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
16430    ///
16431    /// Sets the *path* path property to the given value.
16432    ///
16433    /// Even though the property as already been set when instantiating this call,
16434    /// we provide this method for API completeness.
16435    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
16436        self._path = new_value.to_string();
16437        self
16438    }
16439    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16440    /// while executing the actual API request.
16441    ///
16442    /// ````text
16443    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16444    /// ````
16445    ///
16446    /// Sets the *delegate* property to the given value.
16447    pub fn delegate(
16448        mut self,
16449        new_value: &'a mut dyn common::Delegate,
16450    ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
16451        self._delegate = Some(new_value);
16452        self
16453    }
16454
16455    /// Set any additional parameter of the query string used in the request.
16456    /// It should be used to set parameters which are not yet available through their own
16457    /// setters.
16458    ///
16459    /// Please note that this method must not be used to set any of the known parameters
16460    /// which have their own setter method. If done anyway, the request will fail.
16461    ///
16462    /// # Additional Parameters
16463    ///
16464    /// * *$.xgafv* (query-string) - V1 error format.
16465    /// * *access_token* (query-string) - OAuth access token.
16466    /// * *alt* (query-string) - Data format for response.
16467    /// * *callback* (query-string) - JSONP
16468    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16469    /// * *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.
16470    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16471    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16472    /// * *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.
16473    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16474    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16475    pub fn param<T>(
16476        mut self,
16477        name: T,
16478        value: T,
16479    ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16480    where
16481        T: AsRef<str>,
16482    {
16483        self._additional_params
16484            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16485        self
16486    }
16487
16488    /// Identifies the authorization scope for the method you are building.
16489    ///
16490    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16491    /// [`Scope::Readonly`].
16492    ///
16493    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16494    /// tokens for more than one scope.
16495    ///
16496    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16497    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16498    /// sufficient, a read-write scope will do as well.
16499    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16500    where
16501        St: AsRef<str>,
16502    {
16503        self._scopes.insert(String::from(scope.as_ref()));
16504        self
16505    }
16506    /// Identifies the authorization scope(s) for the method you are building.
16507    ///
16508    /// See [`Self::add_scope()`] for details.
16509    pub fn add_scopes<I, St>(
16510        mut self,
16511        scopes: I,
16512    ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16513    where
16514        I: IntoIterator<Item = St>,
16515        St: AsRef<str>,
16516    {
16517        self._scopes
16518            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16519        self
16520    }
16521
16522    /// Removes all scopes, and no default scope will be used either.
16523    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16524    /// for details).
16525    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
16526        self._scopes.clear();
16527        self
16528    }
16529}
16530
16531/// Lists all Google tag configs in a Container.
16532///
16533/// A builder for the *containers.workspaces.gtag_config.list* method supported by a *account* resource.
16534/// It is not used directly, but through a [`AccountMethods`] instance.
16535///
16536/// # Example
16537///
16538/// Instantiate a resource method builder
16539///
16540/// ```test_harness,no_run
16541/// # extern crate hyper;
16542/// # extern crate hyper_rustls;
16543/// # extern crate google_tagmanager2 as tagmanager2;
16544/// # async fn dox() {
16545/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16546///
16547/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16548/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16549/// #     secret,
16550/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16551/// # ).build().await.unwrap();
16552///
16553/// # let client = hyper_util::client::legacy::Client::builder(
16554/// #     hyper_util::rt::TokioExecutor::new()
16555/// # )
16556/// # .build(
16557/// #     hyper_rustls::HttpsConnectorBuilder::new()
16558/// #         .with_native_roots()
16559/// #         .unwrap()
16560/// #         .https_or_http()
16561/// #         .enable_http1()
16562/// #         .build()
16563/// # );
16564/// # let mut hub = TagManager::new(client, auth);
16565/// // You can configure optional parameters by calling the respective setters at will, and
16566/// // execute the final call using `doit()`.
16567/// // Values shown here are possibly random and not representative !
16568/// let result = hub.accounts().containers_workspaces_gtag_config_list("parent")
16569///              .page_token("amet.")
16570///              .doit().await;
16571/// # }
16572/// ```
16573pub struct AccountContainerWorkspaceGtagConfigListCall<'a, C>
16574where
16575    C: 'a,
16576{
16577    hub: &'a TagManager<C>,
16578    _parent: String,
16579    _page_token: Option<String>,
16580    _delegate: Option<&'a mut dyn common::Delegate>,
16581    _additional_params: HashMap<String, String>,
16582    _scopes: BTreeSet<String>,
16583}
16584
16585impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigListCall<'a, C> {}
16586
16587impl<'a, C> AccountContainerWorkspaceGtagConfigListCall<'a, C>
16588where
16589    C: common::Connector,
16590{
16591    /// Perform the operation you have build so far.
16592    pub async fn doit(mut self) -> common::Result<(common::Response, ListGtagConfigResponse)> {
16593        use std::borrow::Cow;
16594        use std::io::{Read, Seek};
16595
16596        use common::{url::Params, ToParts};
16597        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16598
16599        let mut dd = common::DefaultDelegate;
16600        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16601        dlg.begin(common::MethodInfo {
16602            id: "tagmanager.accounts.containers.workspaces.gtag_config.list",
16603            http_method: hyper::Method::GET,
16604        });
16605
16606        for &field in ["alt", "parent", "pageToken"].iter() {
16607            if self._additional_params.contains_key(field) {
16608                dlg.finished(false);
16609                return Err(common::Error::FieldClash(field));
16610            }
16611        }
16612
16613        let mut params = Params::with_capacity(4 + self._additional_params.len());
16614        params.push("parent", self._parent);
16615        if let Some(value) = self._page_token.as_ref() {
16616            params.push("pageToken", value);
16617        }
16618
16619        params.extend(self._additional_params.iter());
16620
16621        params.push("alt", "json");
16622        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/gtag_config";
16623        if self._scopes.is_empty() {
16624            self._scopes.insert(Scope::Readonly.as_ref().to_string());
16625        }
16626
16627        #[allow(clippy::single_element_loop)]
16628        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16629            url = params.uri_replacement(url, param_name, find_this, true);
16630        }
16631        {
16632            let to_remove = ["parent"];
16633            params.remove_params(&to_remove);
16634        }
16635
16636        let url = params.parse_with_url(&url);
16637
16638        loop {
16639            let token = match self
16640                .hub
16641                .auth
16642                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16643                .await
16644            {
16645                Ok(token) => token,
16646                Err(e) => match dlg.token(e) {
16647                    Ok(token) => token,
16648                    Err(e) => {
16649                        dlg.finished(false);
16650                        return Err(common::Error::MissingToken(e));
16651                    }
16652                },
16653            };
16654            let mut req_result = {
16655                let client = &self.hub.client;
16656                dlg.pre_request();
16657                let mut req_builder = hyper::Request::builder()
16658                    .method(hyper::Method::GET)
16659                    .uri(url.as_str())
16660                    .header(USER_AGENT, self.hub._user_agent.clone());
16661
16662                if let Some(token) = token.as_ref() {
16663                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16664                }
16665
16666                let request = req_builder
16667                    .header(CONTENT_LENGTH, 0_u64)
16668                    .body(common::to_body::<String>(None));
16669
16670                client.request(request.unwrap()).await
16671            };
16672
16673            match req_result {
16674                Err(err) => {
16675                    if let common::Retry::After(d) = dlg.http_error(&err) {
16676                        sleep(d).await;
16677                        continue;
16678                    }
16679                    dlg.finished(false);
16680                    return Err(common::Error::HttpError(err));
16681                }
16682                Ok(res) => {
16683                    let (mut parts, body) = res.into_parts();
16684                    let mut body = common::Body::new(body);
16685                    if !parts.status.is_success() {
16686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16687                        let error = serde_json::from_str(&common::to_string(&bytes));
16688                        let response = common::to_response(parts, bytes.into());
16689
16690                        if let common::Retry::After(d) =
16691                            dlg.http_failure(&response, error.as_ref().ok())
16692                        {
16693                            sleep(d).await;
16694                            continue;
16695                        }
16696
16697                        dlg.finished(false);
16698
16699                        return Err(match error {
16700                            Ok(value) => common::Error::BadRequest(value),
16701                            _ => common::Error::Failure(response),
16702                        });
16703                    }
16704                    let response = {
16705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16706                        let encoded = common::to_string(&bytes);
16707                        match serde_json::from_str(&encoded) {
16708                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16709                            Err(error) => {
16710                                dlg.response_json_decode_error(&encoded, &error);
16711                                return Err(common::Error::JsonDecodeError(
16712                                    encoded.to_string(),
16713                                    error,
16714                                ));
16715                            }
16716                        }
16717                    };
16718
16719                    dlg.finished(true);
16720                    return Ok(response);
16721                }
16722            }
16723        }
16724    }
16725
16726    /// Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
16727    ///
16728    /// Sets the *parent* path property to the given value.
16729    ///
16730    /// Even though the property as already been set when instantiating this call,
16731    /// we provide this method for API completeness.
16732    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
16733        self._parent = new_value.to_string();
16734        self
16735    }
16736    /// Continuation token for fetching the next page of results.
16737    ///
16738    /// Sets the *page token* query property to the given value.
16739    pub fn page_token(
16740        mut self,
16741        new_value: &str,
16742    ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
16743        self._page_token = Some(new_value.to_string());
16744        self
16745    }
16746    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16747    /// while executing the actual API request.
16748    ///
16749    /// ````text
16750    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16751    /// ````
16752    ///
16753    /// Sets the *delegate* property to the given value.
16754    pub fn delegate(
16755        mut self,
16756        new_value: &'a mut dyn common::Delegate,
16757    ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
16758        self._delegate = Some(new_value);
16759        self
16760    }
16761
16762    /// Set any additional parameter of the query string used in the request.
16763    /// It should be used to set parameters which are not yet available through their own
16764    /// setters.
16765    ///
16766    /// Please note that this method must not be used to set any of the known parameters
16767    /// which have their own setter method. If done anyway, the request will fail.
16768    ///
16769    /// # Additional Parameters
16770    ///
16771    /// * *$.xgafv* (query-string) - V1 error format.
16772    /// * *access_token* (query-string) - OAuth access token.
16773    /// * *alt* (query-string) - Data format for response.
16774    /// * *callback* (query-string) - JSONP
16775    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16776    /// * *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.
16777    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16778    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16779    /// * *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.
16780    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16781    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16782    pub fn param<T>(
16783        mut self,
16784        name: T,
16785        value: T,
16786    ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
16787    where
16788        T: AsRef<str>,
16789    {
16790        self._additional_params
16791            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16792        self
16793    }
16794
16795    /// Identifies the authorization scope for the method you are building.
16796    ///
16797    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16798    /// [`Scope::Readonly`].
16799    ///
16800    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16801    /// tokens for more than one scope.
16802    ///
16803    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16804    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16805    /// sufficient, a read-write scope will do as well.
16806    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
16807    where
16808        St: AsRef<str>,
16809    {
16810        self._scopes.insert(String::from(scope.as_ref()));
16811        self
16812    }
16813    /// Identifies the authorization scope(s) for the method you are building.
16814    ///
16815    /// See [`Self::add_scope()`] for details.
16816    pub fn add_scopes<I, St>(
16817        mut self,
16818        scopes: I,
16819    ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
16820    where
16821        I: IntoIterator<Item = St>,
16822        St: AsRef<str>,
16823    {
16824        self._scopes
16825            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16826        self
16827    }
16828
16829    /// Removes all scopes, and no default scope will be used either.
16830    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16831    /// for details).
16832    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
16833        self._scopes.clear();
16834        self
16835    }
16836}
16837
16838/// Updates a Google tag config.
16839///
16840/// A builder for the *containers.workspaces.gtag_config.update* method supported by a *account* resource.
16841/// It is not used directly, but through a [`AccountMethods`] instance.
16842///
16843/// # Example
16844///
16845/// Instantiate a resource method builder
16846///
16847/// ```test_harness,no_run
16848/// # extern crate hyper;
16849/// # extern crate hyper_rustls;
16850/// # extern crate google_tagmanager2 as tagmanager2;
16851/// use tagmanager2::api::GtagConfig;
16852/// # async fn dox() {
16853/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16854///
16855/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16856/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16857/// #     secret,
16858/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16859/// # ).build().await.unwrap();
16860///
16861/// # let client = hyper_util::client::legacy::Client::builder(
16862/// #     hyper_util::rt::TokioExecutor::new()
16863/// # )
16864/// # .build(
16865/// #     hyper_rustls::HttpsConnectorBuilder::new()
16866/// #         .with_native_roots()
16867/// #         .unwrap()
16868/// #         .https_or_http()
16869/// #         .enable_http1()
16870/// #         .build()
16871/// # );
16872/// # let mut hub = TagManager::new(client, auth);
16873/// // As the method needs a request, you would usually fill it with the desired information
16874/// // into the respective structure. Some of the parts shown here might not be applicable !
16875/// // Values shown here are possibly random and not representative !
16876/// let mut req = GtagConfig::default();
16877///
16878/// // You can configure optional parameters by calling the respective setters at will, and
16879/// // execute the final call using `doit()`.
16880/// // Values shown here are possibly random and not representative !
16881/// let result = hub.accounts().containers_workspaces_gtag_config_update(req, "path")
16882///              .fingerprint("sadipscing")
16883///              .doit().await;
16884/// # }
16885/// ```
16886pub struct AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
16887where
16888    C: 'a,
16889{
16890    hub: &'a TagManager<C>,
16891    _request: GtagConfig,
16892    _path: String,
16893    _fingerprint: Option<String>,
16894    _delegate: Option<&'a mut dyn common::Delegate>,
16895    _additional_params: HashMap<String, String>,
16896    _scopes: BTreeSet<String>,
16897}
16898
16899impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {}
16900
16901impl<'a, C> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
16902where
16903    C: common::Connector,
16904{
16905    /// Perform the operation you have build so far.
16906    pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
16907        use std::borrow::Cow;
16908        use std::io::{Read, Seek};
16909
16910        use common::{url::Params, ToParts};
16911        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16912
16913        let mut dd = common::DefaultDelegate;
16914        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16915        dlg.begin(common::MethodInfo {
16916            id: "tagmanager.accounts.containers.workspaces.gtag_config.update",
16917            http_method: hyper::Method::PUT,
16918        });
16919
16920        for &field in ["alt", "path", "fingerprint"].iter() {
16921            if self._additional_params.contains_key(field) {
16922                dlg.finished(false);
16923                return Err(common::Error::FieldClash(field));
16924            }
16925        }
16926
16927        let mut params = Params::with_capacity(5 + self._additional_params.len());
16928        params.push("path", self._path);
16929        if let Some(value) = self._fingerprint.as_ref() {
16930            params.push("fingerprint", value);
16931        }
16932
16933        params.extend(self._additional_params.iter());
16934
16935        params.push("alt", "json");
16936        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
16937        if self._scopes.is_empty() {
16938            self._scopes
16939                .insert(Scope::EditContainer.as_ref().to_string());
16940        }
16941
16942        #[allow(clippy::single_element_loop)]
16943        for &(find_this, param_name) in [("{+path}", "path")].iter() {
16944            url = params.uri_replacement(url, param_name, find_this, true);
16945        }
16946        {
16947            let to_remove = ["path"];
16948            params.remove_params(&to_remove);
16949        }
16950
16951        let url = params.parse_with_url(&url);
16952
16953        let mut json_mime_type = mime::APPLICATION_JSON;
16954        let mut request_value_reader = {
16955            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16956            common::remove_json_null_values(&mut value);
16957            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16958            serde_json::to_writer(&mut dst, &value).unwrap();
16959            dst
16960        };
16961        let request_size = request_value_reader
16962            .seek(std::io::SeekFrom::End(0))
16963            .unwrap();
16964        request_value_reader
16965            .seek(std::io::SeekFrom::Start(0))
16966            .unwrap();
16967
16968        loop {
16969            let token = match self
16970                .hub
16971                .auth
16972                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16973                .await
16974            {
16975                Ok(token) => token,
16976                Err(e) => match dlg.token(e) {
16977                    Ok(token) => token,
16978                    Err(e) => {
16979                        dlg.finished(false);
16980                        return Err(common::Error::MissingToken(e));
16981                    }
16982                },
16983            };
16984            request_value_reader
16985                .seek(std::io::SeekFrom::Start(0))
16986                .unwrap();
16987            let mut req_result = {
16988                let client = &self.hub.client;
16989                dlg.pre_request();
16990                let mut req_builder = hyper::Request::builder()
16991                    .method(hyper::Method::PUT)
16992                    .uri(url.as_str())
16993                    .header(USER_AGENT, self.hub._user_agent.clone());
16994
16995                if let Some(token) = token.as_ref() {
16996                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16997                }
16998
16999                let request = req_builder
17000                    .header(CONTENT_TYPE, json_mime_type.to_string())
17001                    .header(CONTENT_LENGTH, request_size as u64)
17002                    .body(common::to_body(
17003                        request_value_reader.get_ref().clone().into(),
17004                    ));
17005
17006                client.request(request.unwrap()).await
17007            };
17008
17009            match req_result {
17010                Err(err) => {
17011                    if let common::Retry::After(d) = dlg.http_error(&err) {
17012                        sleep(d).await;
17013                        continue;
17014                    }
17015                    dlg.finished(false);
17016                    return Err(common::Error::HttpError(err));
17017                }
17018                Ok(res) => {
17019                    let (mut parts, body) = res.into_parts();
17020                    let mut body = common::Body::new(body);
17021                    if !parts.status.is_success() {
17022                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17023                        let error = serde_json::from_str(&common::to_string(&bytes));
17024                        let response = common::to_response(parts, bytes.into());
17025
17026                        if let common::Retry::After(d) =
17027                            dlg.http_failure(&response, error.as_ref().ok())
17028                        {
17029                            sleep(d).await;
17030                            continue;
17031                        }
17032
17033                        dlg.finished(false);
17034
17035                        return Err(match error {
17036                            Ok(value) => common::Error::BadRequest(value),
17037                            _ => common::Error::Failure(response),
17038                        });
17039                    }
17040                    let response = {
17041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17042                        let encoded = common::to_string(&bytes);
17043                        match serde_json::from_str(&encoded) {
17044                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17045                            Err(error) => {
17046                                dlg.response_json_decode_error(&encoded, &error);
17047                                return Err(common::Error::JsonDecodeError(
17048                                    encoded.to_string(),
17049                                    error,
17050                                ));
17051                            }
17052                        }
17053                    };
17054
17055                    dlg.finished(true);
17056                    return Ok(response);
17057                }
17058            }
17059        }
17060    }
17061
17062    ///
17063    /// Sets the *request* property to the given value.
17064    ///
17065    /// Even though the property as already been set when instantiating this call,
17066    /// we provide this method for API completeness.
17067    pub fn request(
17068        mut self,
17069        new_value: GtagConfig,
17070    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17071        self._request = new_value;
17072        self
17073    }
17074    /// Google tag config's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/gtag_config/{gtag_config_id}
17075    ///
17076    /// Sets the *path* path property to the given value.
17077    ///
17078    /// Even though the property as already been set when instantiating this call,
17079    /// we provide this method for API completeness.
17080    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17081        self._path = new_value.to_string();
17082        self
17083    }
17084    /// When provided, this fingerprint must match the fingerprint of the config in storage.
17085    ///
17086    /// Sets the *fingerprint* query property to the given value.
17087    pub fn fingerprint(
17088        mut self,
17089        new_value: &str,
17090    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17091        self._fingerprint = Some(new_value.to_string());
17092        self
17093    }
17094    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17095    /// while executing the actual API request.
17096    ///
17097    /// ````text
17098    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17099    /// ````
17100    ///
17101    /// Sets the *delegate* property to the given value.
17102    pub fn delegate(
17103        mut self,
17104        new_value: &'a mut dyn common::Delegate,
17105    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17106        self._delegate = Some(new_value);
17107        self
17108    }
17109
17110    /// Set any additional parameter of the query string used in the request.
17111    /// It should be used to set parameters which are not yet available through their own
17112    /// setters.
17113    ///
17114    /// Please note that this method must not be used to set any of the known parameters
17115    /// which have their own setter method. If done anyway, the request will fail.
17116    ///
17117    /// # Additional Parameters
17118    ///
17119    /// * *$.xgafv* (query-string) - V1 error format.
17120    /// * *access_token* (query-string) - OAuth access token.
17121    /// * *alt* (query-string) - Data format for response.
17122    /// * *callback* (query-string) - JSONP
17123    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17124    /// * *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.
17125    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17126    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17127    /// * *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.
17128    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17129    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17130    pub fn param<T>(
17131        mut self,
17132        name: T,
17133        value: T,
17134    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17135    where
17136        T: AsRef<str>,
17137    {
17138        self._additional_params
17139            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17140        self
17141    }
17142
17143    /// Identifies the authorization scope for the method you are building.
17144    ///
17145    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17146    /// [`Scope::EditContainer`].
17147    ///
17148    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17149    /// tokens for more than one scope.
17150    ///
17151    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17152    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17153    /// sufficient, a read-write scope will do as well.
17154    pub fn add_scope<St>(
17155        mut self,
17156        scope: St,
17157    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17158    where
17159        St: AsRef<str>,
17160    {
17161        self._scopes.insert(String::from(scope.as_ref()));
17162        self
17163    }
17164    /// Identifies the authorization scope(s) for the method you are building.
17165    ///
17166    /// See [`Self::add_scope()`] for details.
17167    pub fn add_scopes<I, St>(
17168        mut self,
17169        scopes: I,
17170    ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17171    where
17172        I: IntoIterator<Item = St>,
17173        St: AsRef<str>,
17174    {
17175        self._scopes
17176            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17177        self
17178    }
17179
17180    /// Removes all scopes, and no default scope will be used either.
17181    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17182    /// for details).
17183    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17184        self._scopes.clear();
17185        self
17186    }
17187}
17188
17189/// Creates a GTM Tag.
17190///
17191/// A builder for the *containers.workspaces.tags.create* method supported by a *account* resource.
17192/// It is not used directly, but through a [`AccountMethods`] instance.
17193///
17194/// # Example
17195///
17196/// Instantiate a resource method builder
17197///
17198/// ```test_harness,no_run
17199/// # extern crate hyper;
17200/// # extern crate hyper_rustls;
17201/// # extern crate google_tagmanager2 as tagmanager2;
17202/// use tagmanager2::api::Tag;
17203/// # async fn dox() {
17204/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17205///
17206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17207/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17208/// #     secret,
17209/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17210/// # ).build().await.unwrap();
17211///
17212/// # let client = hyper_util::client::legacy::Client::builder(
17213/// #     hyper_util::rt::TokioExecutor::new()
17214/// # )
17215/// # .build(
17216/// #     hyper_rustls::HttpsConnectorBuilder::new()
17217/// #         .with_native_roots()
17218/// #         .unwrap()
17219/// #         .https_or_http()
17220/// #         .enable_http1()
17221/// #         .build()
17222/// # );
17223/// # let mut hub = TagManager::new(client, auth);
17224/// // As the method needs a request, you would usually fill it with the desired information
17225/// // into the respective structure. Some of the parts shown here might not be applicable !
17226/// // Values shown here are possibly random and not representative !
17227/// let mut req = Tag::default();
17228///
17229/// // You can configure optional parameters by calling the respective setters at will, and
17230/// // execute the final call using `doit()`.
17231/// // Values shown here are possibly random and not representative !
17232/// let result = hub.accounts().containers_workspaces_tags_create(req, "parent")
17233///              .doit().await;
17234/// # }
17235/// ```
17236pub struct AccountContainerWorkspaceTagCreateCall<'a, C>
17237where
17238    C: 'a,
17239{
17240    hub: &'a TagManager<C>,
17241    _request: Tag,
17242    _parent: String,
17243    _delegate: Option<&'a mut dyn common::Delegate>,
17244    _additional_params: HashMap<String, String>,
17245    _scopes: BTreeSet<String>,
17246}
17247
17248impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagCreateCall<'a, C> {}
17249
17250impl<'a, C> AccountContainerWorkspaceTagCreateCall<'a, C>
17251where
17252    C: common::Connector,
17253{
17254    /// Perform the operation you have build so far.
17255    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
17256        use std::borrow::Cow;
17257        use std::io::{Read, Seek};
17258
17259        use common::{url::Params, ToParts};
17260        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17261
17262        let mut dd = common::DefaultDelegate;
17263        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17264        dlg.begin(common::MethodInfo {
17265            id: "tagmanager.accounts.containers.workspaces.tags.create",
17266            http_method: hyper::Method::POST,
17267        });
17268
17269        for &field in ["alt", "parent"].iter() {
17270            if self._additional_params.contains_key(field) {
17271                dlg.finished(false);
17272                return Err(common::Error::FieldClash(field));
17273            }
17274        }
17275
17276        let mut params = Params::with_capacity(4 + self._additional_params.len());
17277        params.push("parent", self._parent);
17278
17279        params.extend(self._additional_params.iter());
17280
17281        params.push("alt", "json");
17282        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/tags";
17283        if self._scopes.is_empty() {
17284            self._scopes
17285                .insert(Scope::EditContainer.as_ref().to_string());
17286        }
17287
17288        #[allow(clippy::single_element_loop)]
17289        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17290            url = params.uri_replacement(url, param_name, find_this, true);
17291        }
17292        {
17293            let to_remove = ["parent"];
17294            params.remove_params(&to_remove);
17295        }
17296
17297        let url = params.parse_with_url(&url);
17298
17299        let mut json_mime_type = mime::APPLICATION_JSON;
17300        let mut request_value_reader = {
17301            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17302            common::remove_json_null_values(&mut value);
17303            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17304            serde_json::to_writer(&mut dst, &value).unwrap();
17305            dst
17306        };
17307        let request_size = request_value_reader
17308            .seek(std::io::SeekFrom::End(0))
17309            .unwrap();
17310        request_value_reader
17311            .seek(std::io::SeekFrom::Start(0))
17312            .unwrap();
17313
17314        loop {
17315            let token = match self
17316                .hub
17317                .auth
17318                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17319                .await
17320            {
17321                Ok(token) => token,
17322                Err(e) => match dlg.token(e) {
17323                    Ok(token) => token,
17324                    Err(e) => {
17325                        dlg.finished(false);
17326                        return Err(common::Error::MissingToken(e));
17327                    }
17328                },
17329            };
17330            request_value_reader
17331                .seek(std::io::SeekFrom::Start(0))
17332                .unwrap();
17333            let mut req_result = {
17334                let client = &self.hub.client;
17335                dlg.pre_request();
17336                let mut req_builder = hyper::Request::builder()
17337                    .method(hyper::Method::POST)
17338                    .uri(url.as_str())
17339                    .header(USER_AGENT, self.hub._user_agent.clone());
17340
17341                if let Some(token) = token.as_ref() {
17342                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17343                }
17344
17345                let request = req_builder
17346                    .header(CONTENT_TYPE, json_mime_type.to_string())
17347                    .header(CONTENT_LENGTH, request_size as u64)
17348                    .body(common::to_body(
17349                        request_value_reader.get_ref().clone().into(),
17350                    ));
17351
17352                client.request(request.unwrap()).await
17353            };
17354
17355            match req_result {
17356                Err(err) => {
17357                    if let common::Retry::After(d) = dlg.http_error(&err) {
17358                        sleep(d).await;
17359                        continue;
17360                    }
17361                    dlg.finished(false);
17362                    return Err(common::Error::HttpError(err));
17363                }
17364                Ok(res) => {
17365                    let (mut parts, body) = res.into_parts();
17366                    let mut body = common::Body::new(body);
17367                    if !parts.status.is_success() {
17368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17369                        let error = serde_json::from_str(&common::to_string(&bytes));
17370                        let response = common::to_response(parts, bytes.into());
17371
17372                        if let common::Retry::After(d) =
17373                            dlg.http_failure(&response, error.as_ref().ok())
17374                        {
17375                            sleep(d).await;
17376                            continue;
17377                        }
17378
17379                        dlg.finished(false);
17380
17381                        return Err(match error {
17382                            Ok(value) => common::Error::BadRequest(value),
17383                            _ => common::Error::Failure(response),
17384                        });
17385                    }
17386                    let response = {
17387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17388                        let encoded = common::to_string(&bytes);
17389                        match serde_json::from_str(&encoded) {
17390                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17391                            Err(error) => {
17392                                dlg.response_json_decode_error(&encoded, &error);
17393                                return Err(common::Error::JsonDecodeError(
17394                                    encoded.to_string(),
17395                                    error,
17396                                ));
17397                            }
17398                        }
17399                    };
17400
17401                    dlg.finished(true);
17402                    return Ok(response);
17403                }
17404            }
17405        }
17406    }
17407
17408    ///
17409    /// Sets the *request* property to the given value.
17410    ///
17411    /// Even though the property as already been set when instantiating this call,
17412    /// we provide this method for API completeness.
17413    pub fn request(mut self, new_value: Tag) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17414        self._request = new_value;
17415        self
17416    }
17417    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
17418    ///
17419    /// Sets the *parent* path property to the given value.
17420    ///
17421    /// Even though the property as already been set when instantiating this call,
17422    /// we provide this method for API completeness.
17423    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17424        self._parent = new_value.to_string();
17425        self
17426    }
17427    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17428    /// while executing the actual API request.
17429    ///
17430    /// ````text
17431    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17432    /// ````
17433    ///
17434    /// Sets the *delegate* property to the given value.
17435    pub fn delegate(
17436        mut self,
17437        new_value: &'a mut dyn common::Delegate,
17438    ) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17439        self._delegate = Some(new_value);
17440        self
17441    }
17442
17443    /// Set any additional parameter of the query string used in the request.
17444    /// It should be used to set parameters which are not yet available through their own
17445    /// setters.
17446    ///
17447    /// Please note that this method must not be used to set any of the known parameters
17448    /// which have their own setter method. If done anyway, the request will fail.
17449    ///
17450    /// # Additional Parameters
17451    ///
17452    /// * *$.xgafv* (query-string) - V1 error format.
17453    /// * *access_token* (query-string) - OAuth access token.
17454    /// * *alt* (query-string) - Data format for response.
17455    /// * *callback* (query-string) - JSONP
17456    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17457    /// * *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.
17458    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17459    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17460    /// * *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.
17461    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17462    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17463    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagCreateCall<'a, C>
17464    where
17465        T: AsRef<str>,
17466    {
17467        self._additional_params
17468            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17469        self
17470    }
17471
17472    /// Identifies the authorization scope for the method you are building.
17473    ///
17474    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17475    /// [`Scope::EditContainer`].
17476    ///
17477    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17478    /// tokens for more than one scope.
17479    ///
17480    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17481    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17482    /// sufficient, a read-write scope will do as well.
17483    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagCreateCall<'a, C>
17484    where
17485        St: AsRef<str>,
17486    {
17487        self._scopes.insert(String::from(scope.as_ref()));
17488        self
17489    }
17490    /// Identifies the authorization scope(s) for the method you are building.
17491    ///
17492    /// See [`Self::add_scope()`] for details.
17493    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagCreateCall<'a, C>
17494    where
17495        I: IntoIterator<Item = St>,
17496        St: AsRef<str>,
17497    {
17498        self._scopes
17499            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17500        self
17501    }
17502
17503    /// Removes all scopes, and no default scope will be used either.
17504    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17505    /// for details).
17506    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17507        self._scopes.clear();
17508        self
17509    }
17510}
17511
17512/// Deletes a GTM Tag.
17513///
17514/// A builder for the *containers.workspaces.tags.delete* method supported by a *account* resource.
17515/// It is not used directly, but through a [`AccountMethods`] instance.
17516///
17517/// # Example
17518///
17519/// Instantiate a resource method builder
17520///
17521/// ```test_harness,no_run
17522/// # extern crate hyper;
17523/// # extern crate hyper_rustls;
17524/// # extern crate google_tagmanager2 as tagmanager2;
17525/// # async fn dox() {
17526/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17527///
17528/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17530/// #     secret,
17531/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17532/// # ).build().await.unwrap();
17533///
17534/// # let client = hyper_util::client::legacy::Client::builder(
17535/// #     hyper_util::rt::TokioExecutor::new()
17536/// # )
17537/// # .build(
17538/// #     hyper_rustls::HttpsConnectorBuilder::new()
17539/// #         .with_native_roots()
17540/// #         .unwrap()
17541/// #         .https_or_http()
17542/// #         .enable_http1()
17543/// #         .build()
17544/// # );
17545/// # let mut hub = TagManager::new(client, auth);
17546/// // You can configure optional parameters by calling the respective setters at will, and
17547/// // execute the final call using `doit()`.
17548/// // Values shown here are possibly random and not representative !
17549/// let result = hub.accounts().containers_workspaces_tags_delete("path")
17550///              .doit().await;
17551/// # }
17552/// ```
17553pub struct AccountContainerWorkspaceTagDeleteCall<'a, C>
17554where
17555    C: 'a,
17556{
17557    hub: &'a TagManager<C>,
17558    _path: String,
17559    _delegate: Option<&'a mut dyn common::Delegate>,
17560    _additional_params: HashMap<String, String>,
17561    _scopes: BTreeSet<String>,
17562}
17563
17564impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagDeleteCall<'a, C> {}
17565
17566impl<'a, C> AccountContainerWorkspaceTagDeleteCall<'a, C>
17567where
17568    C: common::Connector,
17569{
17570    /// Perform the operation you have build so far.
17571    pub async fn doit(mut self) -> common::Result<common::Response> {
17572        use std::borrow::Cow;
17573        use std::io::{Read, Seek};
17574
17575        use common::{url::Params, ToParts};
17576        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17577
17578        let mut dd = common::DefaultDelegate;
17579        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17580        dlg.begin(common::MethodInfo {
17581            id: "tagmanager.accounts.containers.workspaces.tags.delete",
17582            http_method: hyper::Method::DELETE,
17583        });
17584
17585        for &field in ["path"].iter() {
17586            if self._additional_params.contains_key(field) {
17587                dlg.finished(false);
17588                return Err(common::Error::FieldClash(field));
17589            }
17590        }
17591
17592        let mut params = Params::with_capacity(2 + self._additional_params.len());
17593        params.push("path", self._path);
17594
17595        params.extend(self._additional_params.iter());
17596
17597        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
17598        if self._scopes.is_empty() {
17599            self._scopes
17600                .insert(Scope::EditContainer.as_ref().to_string());
17601        }
17602
17603        #[allow(clippy::single_element_loop)]
17604        for &(find_this, param_name) in [("{+path}", "path")].iter() {
17605            url = params.uri_replacement(url, param_name, find_this, true);
17606        }
17607        {
17608            let to_remove = ["path"];
17609            params.remove_params(&to_remove);
17610        }
17611
17612        let url = params.parse_with_url(&url);
17613
17614        loop {
17615            let token = match self
17616                .hub
17617                .auth
17618                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17619                .await
17620            {
17621                Ok(token) => token,
17622                Err(e) => match dlg.token(e) {
17623                    Ok(token) => token,
17624                    Err(e) => {
17625                        dlg.finished(false);
17626                        return Err(common::Error::MissingToken(e));
17627                    }
17628                },
17629            };
17630            let mut req_result = {
17631                let client = &self.hub.client;
17632                dlg.pre_request();
17633                let mut req_builder = hyper::Request::builder()
17634                    .method(hyper::Method::DELETE)
17635                    .uri(url.as_str())
17636                    .header(USER_AGENT, self.hub._user_agent.clone());
17637
17638                if let Some(token) = token.as_ref() {
17639                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17640                }
17641
17642                let request = req_builder
17643                    .header(CONTENT_LENGTH, 0_u64)
17644                    .body(common::to_body::<String>(None));
17645
17646                client.request(request.unwrap()).await
17647            };
17648
17649            match req_result {
17650                Err(err) => {
17651                    if let common::Retry::After(d) = dlg.http_error(&err) {
17652                        sleep(d).await;
17653                        continue;
17654                    }
17655                    dlg.finished(false);
17656                    return Err(common::Error::HttpError(err));
17657                }
17658                Ok(res) => {
17659                    let (mut parts, body) = res.into_parts();
17660                    let mut body = common::Body::new(body);
17661                    if !parts.status.is_success() {
17662                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17663                        let error = serde_json::from_str(&common::to_string(&bytes));
17664                        let response = common::to_response(parts, bytes.into());
17665
17666                        if let common::Retry::After(d) =
17667                            dlg.http_failure(&response, error.as_ref().ok())
17668                        {
17669                            sleep(d).await;
17670                            continue;
17671                        }
17672
17673                        dlg.finished(false);
17674
17675                        return Err(match error {
17676                            Ok(value) => common::Error::BadRequest(value),
17677                            _ => common::Error::Failure(response),
17678                        });
17679                    }
17680                    let response = common::Response::from_parts(parts, body);
17681
17682                    dlg.finished(true);
17683                    return Ok(response);
17684                }
17685            }
17686        }
17687    }
17688
17689    /// GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
17690    ///
17691    /// Sets the *path* path property to the given value.
17692    ///
17693    /// Even though the property as already been set when instantiating this call,
17694    /// we provide this method for API completeness.
17695    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
17696        self._path = new_value.to_string();
17697        self
17698    }
17699    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17700    /// while executing the actual API request.
17701    ///
17702    /// ````text
17703    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17704    /// ````
17705    ///
17706    /// Sets the *delegate* property to the given value.
17707    pub fn delegate(
17708        mut self,
17709        new_value: &'a mut dyn common::Delegate,
17710    ) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
17711        self._delegate = Some(new_value);
17712        self
17713    }
17714
17715    /// Set any additional parameter of the query string used in the request.
17716    /// It should be used to set parameters which are not yet available through their own
17717    /// setters.
17718    ///
17719    /// Please note that this method must not be used to set any of the known parameters
17720    /// which have their own setter method. If done anyway, the request will fail.
17721    ///
17722    /// # Additional Parameters
17723    ///
17724    /// * *$.xgafv* (query-string) - V1 error format.
17725    /// * *access_token* (query-string) - OAuth access token.
17726    /// * *alt* (query-string) - Data format for response.
17727    /// * *callback* (query-string) - JSONP
17728    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17729    /// * *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.
17730    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17731    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17732    /// * *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.
17733    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17734    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17735    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
17736    where
17737        T: AsRef<str>,
17738    {
17739        self._additional_params
17740            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17741        self
17742    }
17743
17744    /// Identifies the authorization scope for the method you are building.
17745    ///
17746    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17747    /// [`Scope::EditContainer`].
17748    ///
17749    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17750    /// tokens for more than one scope.
17751    ///
17752    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17753    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17754    /// sufficient, a read-write scope will do as well.
17755    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
17756    where
17757        St: AsRef<str>,
17758    {
17759        self._scopes.insert(String::from(scope.as_ref()));
17760        self
17761    }
17762    /// Identifies the authorization scope(s) for the method you are building.
17763    ///
17764    /// See [`Self::add_scope()`] for details.
17765    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
17766    where
17767        I: IntoIterator<Item = St>,
17768        St: AsRef<str>,
17769    {
17770        self._scopes
17771            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17772        self
17773    }
17774
17775    /// Removes all scopes, and no default scope will be used either.
17776    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17777    /// for details).
17778    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
17779        self._scopes.clear();
17780        self
17781    }
17782}
17783
17784/// Gets a GTM Tag.
17785///
17786/// A builder for the *containers.workspaces.tags.get* method supported by a *account* resource.
17787/// It is not used directly, but through a [`AccountMethods`] instance.
17788///
17789/// # Example
17790///
17791/// Instantiate a resource method builder
17792///
17793/// ```test_harness,no_run
17794/// # extern crate hyper;
17795/// # extern crate hyper_rustls;
17796/// # extern crate google_tagmanager2 as tagmanager2;
17797/// # async fn dox() {
17798/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17799///
17800/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17802/// #     secret,
17803/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17804/// # ).build().await.unwrap();
17805///
17806/// # let client = hyper_util::client::legacy::Client::builder(
17807/// #     hyper_util::rt::TokioExecutor::new()
17808/// # )
17809/// # .build(
17810/// #     hyper_rustls::HttpsConnectorBuilder::new()
17811/// #         .with_native_roots()
17812/// #         .unwrap()
17813/// #         .https_or_http()
17814/// #         .enable_http1()
17815/// #         .build()
17816/// # );
17817/// # let mut hub = TagManager::new(client, auth);
17818/// // You can configure optional parameters by calling the respective setters at will, and
17819/// // execute the final call using `doit()`.
17820/// // Values shown here are possibly random and not representative !
17821/// let result = hub.accounts().containers_workspaces_tags_get("path")
17822///              .doit().await;
17823/// # }
17824/// ```
17825pub struct AccountContainerWorkspaceTagGetCall<'a, C>
17826where
17827    C: 'a,
17828{
17829    hub: &'a TagManager<C>,
17830    _path: String,
17831    _delegate: Option<&'a mut dyn common::Delegate>,
17832    _additional_params: HashMap<String, String>,
17833    _scopes: BTreeSet<String>,
17834}
17835
17836impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagGetCall<'a, C> {}
17837
17838impl<'a, C> AccountContainerWorkspaceTagGetCall<'a, C>
17839where
17840    C: common::Connector,
17841{
17842    /// Perform the operation you have build so far.
17843    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
17844        use std::borrow::Cow;
17845        use std::io::{Read, Seek};
17846
17847        use common::{url::Params, ToParts};
17848        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17849
17850        let mut dd = common::DefaultDelegate;
17851        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17852        dlg.begin(common::MethodInfo {
17853            id: "tagmanager.accounts.containers.workspaces.tags.get",
17854            http_method: hyper::Method::GET,
17855        });
17856
17857        for &field in ["alt", "path"].iter() {
17858            if self._additional_params.contains_key(field) {
17859                dlg.finished(false);
17860                return Err(common::Error::FieldClash(field));
17861            }
17862        }
17863
17864        let mut params = Params::with_capacity(3 + self._additional_params.len());
17865        params.push("path", self._path);
17866
17867        params.extend(self._additional_params.iter());
17868
17869        params.push("alt", "json");
17870        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
17871        if self._scopes.is_empty() {
17872            self._scopes.insert(Scope::Readonly.as_ref().to_string());
17873        }
17874
17875        #[allow(clippy::single_element_loop)]
17876        for &(find_this, param_name) in [("{+path}", "path")].iter() {
17877            url = params.uri_replacement(url, param_name, find_this, true);
17878        }
17879        {
17880            let to_remove = ["path"];
17881            params.remove_params(&to_remove);
17882        }
17883
17884        let url = params.parse_with_url(&url);
17885
17886        loop {
17887            let token = match self
17888                .hub
17889                .auth
17890                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17891                .await
17892            {
17893                Ok(token) => token,
17894                Err(e) => match dlg.token(e) {
17895                    Ok(token) => token,
17896                    Err(e) => {
17897                        dlg.finished(false);
17898                        return Err(common::Error::MissingToken(e));
17899                    }
17900                },
17901            };
17902            let mut req_result = {
17903                let client = &self.hub.client;
17904                dlg.pre_request();
17905                let mut req_builder = hyper::Request::builder()
17906                    .method(hyper::Method::GET)
17907                    .uri(url.as_str())
17908                    .header(USER_AGENT, self.hub._user_agent.clone());
17909
17910                if let Some(token) = token.as_ref() {
17911                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17912                }
17913
17914                let request = req_builder
17915                    .header(CONTENT_LENGTH, 0_u64)
17916                    .body(common::to_body::<String>(None));
17917
17918                client.request(request.unwrap()).await
17919            };
17920
17921            match req_result {
17922                Err(err) => {
17923                    if let common::Retry::After(d) = dlg.http_error(&err) {
17924                        sleep(d).await;
17925                        continue;
17926                    }
17927                    dlg.finished(false);
17928                    return Err(common::Error::HttpError(err));
17929                }
17930                Ok(res) => {
17931                    let (mut parts, body) = res.into_parts();
17932                    let mut body = common::Body::new(body);
17933                    if !parts.status.is_success() {
17934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17935                        let error = serde_json::from_str(&common::to_string(&bytes));
17936                        let response = common::to_response(parts, bytes.into());
17937
17938                        if let common::Retry::After(d) =
17939                            dlg.http_failure(&response, error.as_ref().ok())
17940                        {
17941                            sleep(d).await;
17942                            continue;
17943                        }
17944
17945                        dlg.finished(false);
17946
17947                        return Err(match error {
17948                            Ok(value) => common::Error::BadRequest(value),
17949                            _ => common::Error::Failure(response),
17950                        });
17951                    }
17952                    let response = {
17953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17954                        let encoded = common::to_string(&bytes);
17955                        match serde_json::from_str(&encoded) {
17956                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17957                            Err(error) => {
17958                                dlg.response_json_decode_error(&encoded, &error);
17959                                return Err(common::Error::JsonDecodeError(
17960                                    encoded.to_string(),
17961                                    error,
17962                                ));
17963                            }
17964                        }
17965                    };
17966
17967                    dlg.finished(true);
17968                    return Ok(response);
17969                }
17970            }
17971        }
17972    }
17973
17974    /// GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
17975    ///
17976    /// Sets the *path* path property to the given value.
17977    ///
17978    /// Even though the property as already been set when instantiating this call,
17979    /// we provide this method for API completeness.
17980    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagGetCall<'a, C> {
17981        self._path = new_value.to_string();
17982        self
17983    }
17984    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17985    /// while executing the actual API request.
17986    ///
17987    /// ````text
17988    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17989    /// ````
17990    ///
17991    /// Sets the *delegate* property to the given value.
17992    pub fn delegate(
17993        mut self,
17994        new_value: &'a mut dyn common::Delegate,
17995    ) -> AccountContainerWorkspaceTagGetCall<'a, C> {
17996        self._delegate = Some(new_value);
17997        self
17998    }
17999
18000    /// Set any additional parameter of the query string used in the request.
18001    /// It should be used to set parameters which are not yet available through their own
18002    /// setters.
18003    ///
18004    /// Please note that this method must not be used to set any of the known parameters
18005    /// which have their own setter method. If done anyway, the request will fail.
18006    ///
18007    /// # Additional Parameters
18008    ///
18009    /// * *$.xgafv* (query-string) - V1 error format.
18010    /// * *access_token* (query-string) - OAuth access token.
18011    /// * *alt* (query-string) - Data format for response.
18012    /// * *callback* (query-string) - JSONP
18013    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18014    /// * *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.
18015    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18016    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18017    /// * *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.
18018    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18019    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18020    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagGetCall<'a, C>
18021    where
18022        T: AsRef<str>,
18023    {
18024        self._additional_params
18025            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18026        self
18027    }
18028
18029    /// Identifies the authorization scope for the method you are building.
18030    ///
18031    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18032    /// [`Scope::Readonly`].
18033    ///
18034    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18035    /// tokens for more than one scope.
18036    ///
18037    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18038    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18039    /// sufficient, a read-write scope will do as well.
18040    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagGetCall<'a, C>
18041    where
18042        St: AsRef<str>,
18043    {
18044        self._scopes.insert(String::from(scope.as_ref()));
18045        self
18046    }
18047    /// Identifies the authorization scope(s) for the method you are building.
18048    ///
18049    /// See [`Self::add_scope()`] for details.
18050    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagGetCall<'a, C>
18051    where
18052        I: IntoIterator<Item = St>,
18053        St: AsRef<str>,
18054    {
18055        self._scopes
18056            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18057        self
18058    }
18059
18060    /// Removes all scopes, and no default scope will be used either.
18061    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18062    /// for details).
18063    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagGetCall<'a, C> {
18064        self._scopes.clear();
18065        self
18066    }
18067}
18068
18069/// Lists all GTM Tags of a Container.
18070///
18071/// A builder for the *containers.workspaces.tags.list* method supported by a *account* resource.
18072/// It is not used directly, but through a [`AccountMethods`] instance.
18073///
18074/// # Example
18075///
18076/// Instantiate a resource method builder
18077///
18078/// ```test_harness,no_run
18079/// # extern crate hyper;
18080/// # extern crate hyper_rustls;
18081/// # extern crate google_tagmanager2 as tagmanager2;
18082/// # async fn dox() {
18083/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18084///
18085/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18086/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18087/// #     secret,
18088/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18089/// # ).build().await.unwrap();
18090///
18091/// # let client = hyper_util::client::legacy::Client::builder(
18092/// #     hyper_util::rt::TokioExecutor::new()
18093/// # )
18094/// # .build(
18095/// #     hyper_rustls::HttpsConnectorBuilder::new()
18096/// #         .with_native_roots()
18097/// #         .unwrap()
18098/// #         .https_or_http()
18099/// #         .enable_http1()
18100/// #         .build()
18101/// # );
18102/// # let mut hub = TagManager::new(client, auth);
18103/// // You can configure optional parameters by calling the respective setters at will, and
18104/// // execute the final call using `doit()`.
18105/// // Values shown here are possibly random and not representative !
18106/// let result = hub.accounts().containers_workspaces_tags_list("parent")
18107///              .page_token("At")
18108///              .doit().await;
18109/// # }
18110/// ```
18111pub struct AccountContainerWorkspaceTagListCall<'a, C>
18112where
18113    C: 'a,
18114{
18115    hub: &'a TagManager<C>,
18116    _parent: String,
18117    _page_token: Option<String>,
18118    _delegate: Option<&'a mut dyn common::Delegate>,
18119    _additional_params: HashMap<String, String>,
18120    _scopes: BTreeSet<String>,
18121}
18122
18123impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagListCall<'a, C> {}
18124
18125impl<'a, C> AccountContainerWorkspaceTagListCall<'a, C>
18126where
18127    C: common::Connector,
18128{
18129    /// Perform the operation you have build so far.
18130    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagsResponse)> {
18131        use std::borrow::Cow;
18132        use std::io::{Read, Seek};
18133
18134        use common::{url::Params, ToParts};
18135        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18136
18137        let mut dd = common::DefaultDelegate;
18138        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18139        dlg.begin(common::MethodInfo {
18140            id: "tagmanager.accounts.containers.workspaces.tags.list",
18141            http_method: hyper::Method::GET,
18142        });
18143
18144        for &field in ["alt", "parent", "pageToken"].iter() {
18145            if self._additional_params.contains_key(field) {
18146                dlg.finished(false);
18147                return Err(common::Error::FieldClash(field));
18148            }
18149        }
18150
18151        let mut params = Params::with_capacity(4 + self._additional_params.len());
18152        params.push("parent", self._parent);
18153        if let Some(value) = self._page_token.as_ref() {
18154            params.push("pageToken", value);
18155        }
18156
18157        params.extend(self._additional_params.iter());
18158
18159        params.push("alt", "json");
18160        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/tags";
18161        if self._scopes.is_empty() {
18162            self._scopes.insert(Scope::Readonly.as_ref().to_string());
18163        }
18164
18165        #[allow(clippy::single_element_loop)]
18166        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18167            url = params.uri_replacement(url, param_name, find_this, true);
18168        }
18169        {
18170            let to_remove = ["parent"];
18171            params.remove_params(&to_remove);
18172        }
18173
18174        let url = params.parse_with_url(&url);
18175
18176        loop {
18177            let token = match self
18178                .hub
18179                .auth
18180                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18181                .await
18182            {
18183                Ok(token) => token,
18184                Err(e) => match dlg.token(e) {
18185                    Ok(token) => token,
18186                    Err(e) => {
18187                        dlg.finished(false);
18188                        return Err(common::Error::MissingToken(e));
18189                    }
18190                },
18191            };
18192            let mut req_result = {
18193                let client = &self.hub.client;
18194                dlg.pre_request();
18195                let mut req_builder = hyper::Request::builder()
18196                    .method(hyper::Method::GET)
18197                    .uri(url.as_str())
18198                    .header(USER_AGENT, self.hub._user_agent.clone());
18199
18200                if let Some(token) = token.as_ref() {
18201                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18202                }
18203
18204                let request = req_builder
18205                    .header(CONTENT_LENGTH, 0_u64)
18206                    .body(common::to_body::<String>(None));
18207
18208                client.request(request.unwrap()).await
18209            };
18210
18211            match req_result {
18212                Err(err) => {
18213                    if let common::Retry::After(d) = dlg.http_error(&err) {
18214                        sleep(d).await;
18215                        continue;
18216                    }
18217                    dlg.finished(false);
18218                    return Err(common::Error::HttpError(err));
18219                }
18220                Ok(res) => {
18221                    let (mut parts, body) = res.into_parts();
18222                    let mut body = common::Body::new(body);
18223                    if !parts.status.is_success() {
18224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18225                        let error = serde_json::from_str(&common::to_string(&bytes));
18226                        let response = common::to_response(parts, bytes.into());
18227
18228                        if let common::Retry::After(d) =
18229                            dlg.http_failure(&response, error.as_ref().ok())
18230                        {
18231                            sleep(d).await;
18232                            continue;
18233                        }
18234
18235                        dlg.finished(false);
18236
18237                        return Err(match error {
18238                            Ok(value) => common::Error::BadRequest(value),
18239                            _ => common::Error::Failure(response),
18240                        });
18241                    }
18242                    let response = {
18243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18244                        let encoded = common::to_string(&bytes);
18245                        match serde_json::from_str(&encoded) {
18246                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18247                            Err(error) => {
18248                                dlg.response_json_decode_error(&encoded, &error);
18249                                return Err(common::Error::JsonDecodeError(
18250                                    encoded.to_string(),
18251                                    error,
18252                                ));
18253                            }
18254                        }
18255                    };
18256
18257                    dlg.finished(true);
18258                    return Ok(response);
18259                }
18260            }
18261        }
18262    }
18263
18264    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
18265    ///
18266    /// Sets the *parent* path property to the given value.
18267    ///
18268    /// Even though the property as already been set when instantiating this call,
18269    /// we provide this method for API completeness.
18270    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTagListCall<'a, C> {
18271        self._parent = new_value.to_string();
18272        self
18273    }
18274    /// Continuation token for fetching the next page of results.
18275    ///
18276    /// Sets the *page token* query property to the given value.
18277    pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceTagListCall<'a, C> {
18278        self._page_token = Some(new_value.to_string());
18279        self
18280    }
18281    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18282    /// while executing the actual API request.
18283    ///
18284    /// ````text
18285    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18286    /// ````
18287    ///
18288    /// Sets the *delegate* property to the given value.
18289    pub fn delegate(
18290        mut self,
18291        new_value: &'a mut dyn common::Delegate,
18292    ) -> AccountContainerWorkspaceTagListCall<'a, C> {
18293        self._delegate = Some(new_value);
18294        self
18295    }
18296
18297    /// Set any additional parameter of the query string used in the request.
18298    /// It should be used to set parameters which are not yet available through their own
18299    /// setters.
18300    ///
18301    /// Please note that this method must not be used to set any of the known parameters
18302    /// which have their own setter method. If done anyway, the request will fail.
18303    ///
18304    /// # Additional Parameters
18305    ///
18306    /// * *$.xgafv* (query-string) - V1 error format.
18307    /// * *access_token* (query-string) - OAuth access token.
18308    /// * *alt* (query-string) - Data format for response.
18309    /// * *callback* (query-string) - JSONP
18310    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18311    /// * *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.
18312    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18313    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18314    /// * *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.
18315    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18316    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18317    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagListCall<'a, C>
18318    where
18319        T: AsRef<str>,
18320    {
18321        self._additional_params
18322            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18323        self
18324    }
18325
18326    /// Identifies the authorization scope for the method you are building.
18327    ///
18328    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18329    /// [`Scope::Readonly`].
18330    ///
18331    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18332    /// tokens for more than one scope.
18333    ///
18334    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18335    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18336    /// sufficient, a read-write scope will do as well.
18337    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagListCall<'a, C>
18338    where
18339        St: AsRef<str>,
18340    {
18341        self._scopes.insert(String::from(scope.as_ref()));
18342        self
18343    }
18344    /// Identifies the authorization scope(s) for the method you are building.
18345    ///
18346    /// See [`Self::add_scope()`] for details.
18347    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagListCall<'a, C>
18348    where
18349        I: IntoIterator<Item = St>,
18350        St: AsRef<str>,
18351    {
18352        self._scopes
18353            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18354        self
18355    }
18356
18357    /// Removes all scopes, and no default scope will be used either.
18358    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18359    /// for details).
18360    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagListCall<'a, C> {
18361        self._scopes.clear();
18362        self
18363    }
18364}
18365
18366/// Reverts changes to a GTM Tag in a GTM Workspace.
18367///
18368/// A builder for the *containers.workspaces.tags.revert* method supported by a *account* resource.
18369/// It is not used directly, but through a [`AccountMethods`] instance.
18370///
18371/// # Example
18372///
18373/// Instantiate a resource method builder
18374///
18375/// ```test_harness,no_run
18376/// # extern crate hyper;
18377/// # extern crate hyper_rustls;
18378/// # extern crate google_tagmanager2 as tagmanager2;
18379/// # async fn dox() {
18380/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18381///
18382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18383/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18384/// #     secret,
18385/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18386/// # ).build().await.unwrap();
18387///
18388/// # let client = hyper_util::client::legacy::Client::builder(
18389/// #     hyper_util::rt::TokioExecutor::new()
18390/// # )
18391/// # .build(
18392/// #     hyper_rustls::HttpsConnectorBuilder::new()
18393/// #         .with_native_roots()
18394/// #         .unwrap()
18395/// #         .https_or_http()
18396/// #         .enable_http1()
18397/// #         .build()
18398/// # );
18399/// # let mut hub = TagManager::new(client, auth);
18400/// // You can configure optional parameters by calling the respective setters at will, and
18401/// // execute the final call using `doit()`.
18402/// // Values shown here are possibly random and not representative !
18403/// let result = hub.accounts().containers_workspaces_tags_revert("path")
18404///              .fingerprint("sit")
18405///              .doit().await;
18406/// # }
18407/// ```
18408pub struct AccountContainerWorkspaceTagRevertCall<'a, C>
18409where
18410    C: 'a,
18411{
18412    hub: &'a TagManager<C>,
18413    _path: String,
18414    _fingerprint: Option<String>,
18415    _delegate: Option<&'a mut dyn common::Delegate>,
18416    _additional_params: HashMap<String, String>,
18417    _scopes: BTreeSet<String>,
18418}
18419
18420impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagRevertCall<'a, C> {}
18421
18422impl<'a, C> AccountContainerWorkspaceTagRevertCall<'a, C>
18423where
18424    C: common::Connector,
18425{
18426    /// Perform the operation you have build so far.
18427    pub async fn doit(mut self) -> common::Result<(common::Response, RevertTagResponse)> {
18428        use std::borrow::Cow;
18429        use std::io::{Read, Seek};
18430
18431        use common::{url::Params, ToParts};
18432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18433
18434        let mut dd = common::DefaultDelegate;
18435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18436        dlg.begin(common::MethodInfo {
18437            id: "tagmanager.accounts.containers.workspaces.tags.revert",
18438            http_method: hyper::Method::POST,
18439        });
18440
18441        for &field in ["alt", "path", "fingerprint"].iter() {
18442            if self._additional_params.contains_key(field) {
18443                dlg.finished(false);
18444                return Err(common::Error::FieldClash(field));
18445            }
18446        }
18447
18448        let mut params = Params::with_capacity(4 + self._additional_params.len());
18449        params.push("path", self._path);
18450        if let Some(value) = self._fingerprint.as_ref() {
18451            params.push("fingerprint", value);
18452        }
18453
18454        params.extend(self._additional_params.iter());
18455
18456        params.push("alt", "json");
18457        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
18458        if self._scopes.is_empty() {
18459            self._scopes
18460                .insert(Scope::EditContainer.as_ref().to_string());
18461        }
18462
18463        #[allow(clippy::single_element_loop)]
18464        for &(find_this, param_name) in [("{+path}", "path")].iter() {
18465            url = params.uri_replacement(url, param_name, find_this, true);
18466        }
18467        {
18468            let to_remove = ["path"];
18469            params.remove_params(&to_remove);
18470        }
18471
18472        let url = params.parse_with_url(&url);
18473
18474        loop {
18475            let token = match self
18476                .hub
18477                .auth
18478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18479                .await
18480            {
18481                Ok(token) => token,
18482                Err(e) => match dlg.token(e) {
18483                    Ok(token) => token,
18484                    Err(e) => {
18485                        dlg.finished(false);
18486                        return Err(common::Error::MissingToken(e));
18487                    }
18488                },
18489            };
18490            let mut req_result = {
18491                let client = &self.hub.client;
18492                dlg.pre_request();
18493                let mut req_builder = hyper::Request::builder()
18494                    .method(hyper::Method::POST)
18495                    .uri(url.as_str())
18496                    .header(USER_AGENT, self.hub._user_agent.clone());
18497
18498                if let Some(token) = token.as_ref() {
18499                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18500                }
18501
18502                let request = req_builder
18503                    .header(CONTENT_LENGTH, 0_u64)
18504                    .body(common::to_body::<String>(None));
18505
18506                client.request(request.unwrap()).await
18507            };
18508
18509            match req_result {
18510                Err(err) => {
18511                    if let common::Retry::After(d) = dlg.http_error(&err) {
18512                        sleep(d).await;
18513                        continue;
18514                    }
18515                    dlg.finished(false);
18516                    return Err(common::Error::HttpError(err));
18517                }
18518                Ok(res) => {
18519                    let (mut parts, body) = res.into_parts();
18520                    let mut body = common::Body::new(body);
18521                    if !parts.status.is_success() {
18522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18523                        let error = serde_json::from_str(&common::to_string(&bytes));
18524                        let response = common::to_response(parts, bytes.into());
18525
18526                        if let common::Retry::After(d) =
18527                            dlg.http_failure(&response, error.as_ref().ok())
18528                        {
18529                            sleep(d).await;
18530                            continue;
18531                        }
18532
18533                        dlg.finished(false);
18534
18535                        return Err(match error {
18536                            Ok(value) => common::Error::BadRequest(value),
18537                            _ => common::Error::Failure(response),
18538                        });
18539                    }
18540                    let response = {
18541                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18542                        let encoded = common::to_string(&bytes);
18543                        match serde_json::from_str(&encoded) {
18544                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18545                            Err(error) => {
18546                                dlg.response_json_decode_error(&encoded, &error);
18547                                return Err(common::Error::JsonDecodeError(
18548                                    encoded.to_string(),
18549                                    error,
18550                                ));
18551                            }
18552                        }
18553                    };
18554
18555                    dlg.finished(true);
18556                    return Ok(response);
18557                }
18558            }
18559        }
18560    }
18561
18562    /// GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
18563    ///
18564    /// Sets the *path* path property to the given value.
18565    ///
18566    /// Even though the property as already been set when instantiating this call,
18567    /// we provide this method for API completeness.
18568    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
18569        self._path = new_value.to_string();
18570        self
18571    }
18572    /// When provided, this fingerprint must match the fingerprint of thetag in storage.
18573    ///
18574    /// Sets the *fingerprint* query property to the given value.
18575    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
18576        self._fingerprint = Some(new_value.to_string());
18577        self
18578    }
18579    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18580    /// while executing the actual API request.
18581    ///
18582    /// ````text
18583    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18584    /// ````
18585    ///
18586    /// Sets the *delegate* property to the given value.
18587    pub fn delegate(
18588        mut self,
18589        new_value: &'a mut dyn common::Delegate,
18590    ) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
18591        self._delegate = Some(new_value);
18592        self
18593    }
18594
18595    /// Set any additional parameter of the query string used in the request.
18596    /// It should be used to set parameters which are not yet available through their own
18597    /// setters.
18598    ///
18599    /// Please note that this method must not be used to set any of the known parameters
18600    /// which have their own setter method. If done anyway, the request will fail.
18601    ///
18602    /// # Additional Parameters
18603    ///
18604    /// * *$.xgafv* (query-string) - V1 error format.
18605    /// * *access_token* (query-string) - OAuth access token.
18606    /// * *alt* (query-string) - Data format for response.
18607    /// * *callback* (query-string) - JSONP
18608    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18609    /// * *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.
18610    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18611    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18612    /// * *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.
18613    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18614    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18615    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagRevertCall<'a, C>
18616    where
18617        T: AsRef<str>,
18618    {
18619        self._additional_params
18620            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18621        self
18622    }
18623
18624    /// Identifies the authorization scope for the method you are building.
18625    ///
18626    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18627    /// [`Scope::EditContainer`].
18628    ///
18629    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18630    /// tokens for more than one scope.
18631    ///
18632    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18633    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18634    /// sufficient, a read-write scope will do as well.
18635    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagRevertCall<'a, C>
18636    where
18637        St: AsRef<str>,
18638    {
18639        self._scopes.insert(String::from(scope.as_ref()));
18640        self
18641    }
18642    /// Identifies the authorization scope(s) for the method you are building.
18643    ///
18644    /// See [`Self::add_scope()`] for details.
18645    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagRevertCall<'a, C>
18646    where
18647        I: IntoIterator<Item = St>,
18648        St: AsRef<str>,
18649    {
18650        self._scopes
18651            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18652        self
18653    }
18654
18655    /// Removes all scopes, and no default scope will be used either.
18656    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18657    /// for details).
18658    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
18659        self._scopes.clear();
18660        self
18661    }
18662}
18663
18664/// Updates a GTM Tag.
18665///
18666/// A builder for the *containers.workspaces.tags.update* method supported by a *account* resource.
18667/// It is not used directly, but through a [`AccountMethods`] instance.
18668///
18669/// # Example
18670///
18671/// Instantiate a resource method builder
18672///
18673/// ```test_harness,no_run
18674/// # extern crate hyper;
18675/// # extern crate hyper_rustls;
18676/// # extern crate google_tagmanager2 as tagmanager2;
18677/// use tagmanager2::api::Tag;
18678/// # async fn dox() {
18679/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18680///
18681/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18683/// #     secret,
18684/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18685/// # ).build().await.unwrap();
18686///
18687/// # let client = hyper_util::client::legacy::Client::builder(
18688/// #     hyper_util::rt::TokioExecutor::new()
18689/// # )
18690/// # .build(
18691/// #     hyper_rustls::HttpsConnectorBuilder::new()
18692/// #         .with_native_roots()
18693/// #         .unwrap()
18694/// #         .https_or_http()
18695/// #         .enable_http1()
18696/// #         .build()
18697/// # );
18698/// # let mut hub = TagManager::new(client, auth);
18699/// // As the method needs a request, you would usually fill it with the desired information
18700/// // into the respective structure. Some of the parts shown here might not be applicable !
18701/// // Values shown here are possibly random and not representative !
18702/// let mut req = Tag::default();
18703///
18704/// // You can configure optional parameters by calling the respective setters at will, and
18705/// // execute the final call using `doit()`.
18706/// // Values shown here are possibly random and not representative !
18707/// let result = hub.accounts().containers_workspaces_tags_update(req, "path")
18708///              .fingerprint("tempor")
18709///              .doit().await;
18710/// # }
18711/// ```
18712pub struct AccountContainerWorkspaceTagUpdateCall<'a, C>
18713where
18714    C: 'a,
18715{
18716    hub: &'a TagManager<C>,
18717    _request: Tag,
18718    _path: String,
18719    _fingerprint: Option<String>,
18720    _delegate: Option<&'a mut dyn common::Delegate>,
18721    _additional_params: HashMap<String, String>,
18722    _scopes: BTreeSet<String>,
18723}
18724
18725impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagUpdateCall<'a, C> {}
18726
18727impl<'a, C> AccountContainerWorkspaceTagUpdateCall<'a, C>
18728where
18729    C: common::Connector,
18730{
18731    /// Perform the operation you have build so far.
18732    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
18733        use std::borrow::Cow;
18734        use std::io::{Read, Seek};
18735
18736        use common::{url::Params, ToParts};
18737        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18738
18739        let mut dd = common::DefaultDelegate;
18740        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18741        dlg.begin(common::MethodInfo {
18742            id: "tagmanager.accounts.containers.workspaces.tags.update",
18743            http_method: hyper::Method::PUT,
18744        });
18745
18746        for &field in ["alt", "path", "fingerprint"].iter() {
18747            if self._additional_params.contains_key(field) {
18748                dlg.finished(false);
18749                return Err(common::Error::FieldClash(field));
18750            }
18751        }
18752
18753        let mut params = Params::with_capacity(5 + self._additional_params.len());
18754        params.push("path", self._path);
18755        if let Some(value) = self._fingerprint.as_ref() {
18756            params.push("fingerprint", value);
18757        }
18758
18759        params.extend(self._additional_params.iter());
18760
18761        params.push("alt", "json");
18762        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
18763        if self._scopes.is_empty() {
18764            self._scopes
18765                .insert(Scope::EditContainer.as_ref().to_string());
18766        }
18767
18768        #[allow(clippy::single_element_loop)]
18769        for &(find_this, param_name) in [("{+path}", "path")].iter() {
18770            url = params.uri_replacement(url, param_name, find_this, true);
18771        }
18772        {
18773            let to_remove = ["path"];
18774            params.remove_params(&to_remove);
18775        }
18776
18777        let url = params.parse_with_url(&url);
18778
18779        let mut json_mime_type = mime::APPLICATION_JSON;
18780        let mut request_value_reader = {
18781            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18782            common::remove_json_null_values(&mut value);
18783            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18784            serde_json::to_writer(&mut dst, &value).unwrap();
18785            dst
18786        };
18787        let request_size = request_value_reader
18788            .seek(std::io::SeekFrom::End(0))
18789            .unwrap();
18790        request_value_reader
18791            .seek(std::io::SeekFrom::Start(0))
18792            .unwrap();
18793
18794        loop {
18795            let token = match self
18796                .hub
18797                .auth
18798                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18799                .await
18800            {
18801                Ok(token) => token,
18802                Err(e) => match dlg.token(e) {
18803                    Ok(token) => token,
18804                    Err(e) => {
18805                        dlg.finished(false);
18806                        return Err(common::Error::MissingToken(e));
18807                    }
18808                },
18809            };
18810            request_value_reader
18811                .seek(std::io::SeekFrom::Start(0))
18812                .unwrap();
18813            let mut req_result = {
18814                let client = &self.hub.client;
18815                dlg.pre_request();
18816                let mut req_builder = hyper::Request::builder()
18817                    .method(hyper::Method::PUT)
18818                    .uri(url.as_str())
18819                    .header(USER_AGENT, self.hub._user_agent.clone());
18820
18821                if let Some(token) = token.as_ref() {
18822                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18823                }
18824
18825                let request = req_builder
18826                    .header(CONTENT_TYPE, json_mime_type.to_string())
18827                    .header(CONTENT_LENGTH, request_size as u64)
18828                    .body(common::to_body(
18829                        request_value_reader.get_ref().clone().into(),
18830                    ));
18831
18832                client.request(request.unwrap()).await
18833            };
18834
18835            match req_result {
18836                Err(err) => {
18837                    if let common::Retry::After(d) = dlg.http_error(&err) {
18838                        sleep(d).await;
18839                        continue;
18840                    }
18841                    dlg.finished(false);
18842                    return Err(common::Error::HttpError(err));
18843                }
18844                Ok(res) => {
18845                    let (mut parts, body) = res.into_parts();
18846                    let mut body = common::Body::new(body);
18847                    if !parts.status.is_success() {
18848                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18849                        let error = serde_json::from_str(&common::to_string(&bytes));
18850                        let response = common::to_response(parts, bytes.into());
18851
18852                        if let common::Retry::After(d) =
18853                            dlg.http_failure(&response, error.as_ref().ok())
18854                        {
18855                            sleep(d).await;
18856                            continue;
18857                        }
18858
18859                        dlg.finished(false);
18860
18861                        return Err(match error {
18862                            Ok(value) => common::Error::BadRequest(value),
18863                            _ => common::Error::Failure(response),
18864                        });
18865                    }
18866                    let response = {
18867                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18868                        let encoded = common::to_string(&bytes);
18869                        match serde_json::from_str(&encoded) {
18870                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18871                            Err(error) => {
18872                                dlg.response_json_decode_error(&encoded, &error);
18873                                return Err(common::Error::JsonDecodeError(
18874                                    encoded.to_string(),
18875                                    error,
18876                                ));
18877                            }
18878                        }
18879                    };
18880
18881                    dlg.finished(true);
18882                    return Ok(response);
18883                }
18884            }
18885        }
18886    }
18887
18888    ///
18889    /// Sets the *request* property to the given value.
18890    ///
18891    /// Even though the property as already been set when instantiating this call,
18892    /// we provide this method for API completeness.
18893    pub fn request(mut self, new_value: Tag) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
18894        self._request = new_value;
18895        self
18896    }
18897    /// GTM Tag's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/tags/{tag_id}
18898    ///
18899    /// Sets the *path* path property to the given value.
18900    ///
18901    /// Even though the property as already been set when instantiating this call,
18902    /// we provide this method for API completeness.
18903    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
18904        self._path = new_value.to_string();
18905        self
18906    }
18907    /// When provided, this fingerprint must match the fingerprint of the tag in storage.
18908    ///
18909    /// Sets the *fingerprint* query property to the given value.
18910    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
18911        self._fingerprint = Some(new_value.to_string());
18912        self
18913    }
18914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18915    /// while executing the actual API request.
18916    ///
18917    /// ````text
18918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18919    /// ````
18920    ///
18921    /// Sets the *delegate* property to the given value.
18922    pub fn delegate(
18923        mut self,
18924        new_value: &'a mut dyn common::Delegate,
18925    ) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
18926        self._delegate = Some(new_value);
18927        self
18928    }
18929
18930    /// Set any additional parameter of the query string used in the request.
18931    /// It should be used to set parameters which are not yet available through their own
18932    /// setters.
18933    ///
18934    /// Please note that this method must not be used to set any of the known parameters
18935    /// which have their own setter method. If done anyway, the request will fail.
18936    ///
18937    /// # Additional Parameters
18938    ///
18939    /// * *$.xgafv* (query-string) - V1 error format.
18940    /// * *access_token* (query-string) - OAuth access token.
18941    /// * *alt* (query-string) - Data format for response.
18942    /// * *callback* (query-string) - JSONP
18943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18944    /// * *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.
18945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18947    /// * *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.
18948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18950    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
18951    where
18952        T: AsRef<str>,
18953    {
18954        self._additional_params
18955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18956        self
18957    }
18958
18959    /// Identifies the authorization scope for the method you are building.
18960    ///
18961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18962    /// [`Scope::EditContainer`].
18963    ///
18964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18965    /// tokens for more than one scope.
18966    ///
18967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18969    /// sufficient, a read-write scope will do as well.
18970    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
18971    where
18972        St: AsRef<str>,
18973    {
18974        self._scopes.insert(String::from(scope.as_ref()));
18975        self
18976    }
18977    /// Identifies the authorization scope(s) for the method you are building.
18978    ///
18979    /// See [`Self::add_scope()`] for details.
18980    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
18981    where
18982        I: IntoIterator<Item = St>,
18983        St: AsRef<str>,
18984    {
18985        self._scopes
18986            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18987        self
18988    }
18989
18990    /// Removes all scopes, and no default scope will be used either.
18991    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18992    /// for details).
18993    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
18994        self._scopes.clear();
18995        self
18996    }
18997}
18998
18999/// Creates a GTM Custom Template.
19000///
19001/// A builder for the *containers.workspaces.templates.create* method supported by a *account* resource.
19002/// It is not used directly, but through a [`AccountMethods`] instance.
19003///
19004/// # Example
19005///
19006/// Instantiate a resource method builder
19007///
19008/// ```test_harness,no_run
19009/// # extern crate hyper;
19010/// # extern crate hyper_rustls;
19011/// # extern crate google_tagmanager2 as tagmanager2;
19012/// use tagmanager2::api::CustomTemplate;
19013/// # async fn dox() {
19014/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19015///
19016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19018/// #     secret,
19019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19020/// # ).build().await.unwrap();
19021///
19022/// # let client = hyper_util::client::legacy::Client::builder(
19023/// #     hyper_util::rt::TokioExecutor::new()
19024/// # )
19025/// # .build(
19026/// #     hyper_rustls::HttpsConnectorBuilder::new()
19027/// #         .with_native_roots()
19028/// #         .unwrap()
19029/// #         .https_or_http()
19030/// #         .enable_http1()
19031/// #         .build()
19032/// # );
19033/// # let mut hub = TagManager::new(client, auth);
19034/// // As the method needs a request, you would usually fill it with the desired information
19035/// // into the respective structure. Some of the parts shown here might not be applicable !
19036/// // Values shown here are possibly random and not representative !
19037/// let mut req = CustomTemplate::default();
19038///
19039/// // You can configure optional parameters by calling the respective setters at will, and
19040/// // execute the final call using `doit()`.
19041/// // Values shown here are possibly random and not representative !
19042/// let result = hub.accounts().containers_workspaces_templates_create(req, "parent")
19043///              .doit().await;
19044/// # }
19045/// ```
19046pub struct AccountContainerWorkspaceTemplateCreateCall<'a, C>
19047where
19048    C: 'a,
19049{
19050    hub: &'a TagManager<C>,
19051    _request: CustomTemplate,
19052    _parent: String,
19053    _delegate: Option<&'a mut dyn common::Delegate>,
19054    _additional_params: HashMap<String, String>,
19055    _scopes: BTreeSet<String>,
19056}
19057
19058impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateCreateCall<'a, C> {}
19059
19060impl<'a, C> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19061where
19062    C: common::Connector,
19063{
19064    /// Perform the operation you have build so far.
19065    pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
19066        use std::borrow::Cow;
19067        use std::io::{Read, Seek};
19068
19069        use common::{url::Params, ToParts};
19070        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19071
19072        let mut dd = common::DefaultDelegate;
19073        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19074        dlg.begin(common::MethodInfo {
19075            id: "tagmanager.accounts.containers.workspaces.templates.create",
19076            http_method: hyper::Method::POST,
19077        });
19078
19079        for &field in ["alt", "parent"].iter() {
19080            if self._additional_params.contains_key(field) {
19081                dlg.finished(false);
19082                return Err(common::Error::FieldClash(field));
19083            }
19084        }
19085
19086        let mut params = Params::with_capacity(4 + self._additional_params.len());
19087        params.push("parent", self._parent);
19088
19089        params.extend(self._additional_params.iter());
19090
19091        params.push("alt", "json");
19092        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/templates";
19093        if self._scopes.is_empty() {
19094            self._scopes
19095                .insert(Scope::EditContainer.as_ref().to_string());
19096        }
19097
19098        #[allow(clippy::single_element_loop)]
19099        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19100            url = params.uri_replacement(url, param_name, find_this, true);
19101        }
19102        {
19103            let to_remove = ["parent"];
19104            params.remove_params(&to_remove);
19105        }
19106
19107        let url = params.parse_with_url(&url);
19108
19109        let mut json_mime_type = mime::APPLICATION_JSON;
19110        let mut request_value_reader = {
19111            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19112            common::remove_json_null_values(&mut value);
19113            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19114            serde_json::to_writer(&mut dst, &value).unwrap();
19115            dst
19116        };
19117        let request_size = request_value_reader
19118            .seek(std::io::SeekFrom::End(0))
19119            .unwrap();
19120        request_value_reader
19121            .seek(std::io::SeekFrom::Start(0))
19122            .unwrap();
19123
19124        loop {
19125            let token = match self
19126                .hub
19127                .auth
19128                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19129                .await
19130            {
19131                Ok(token) => token,
19132                Err(e) => match dlg.token(e) {
19133                    Ok(token) => token,
19134                    Err(e) => {
19135                        dlg.finished(false);
19136                        return Err(common::Error::MissingToken(e));
19137                    }
19138                },
19139            };
19140            request_value_reader
19141                .seek(std::io::SeekFrom::Start(0))
19142                .unwrap();
19143            let mut req_result = {
19144                let client = &self.hub.client;
19145                dlg.pre_request();
19146                let mut req_builder = hyper::Request::builder()
19147                    .method(hyper::Method::POST)
19148                    .uri(url.as_str())
19149                    .header(USER_AGENT, self.hub._user_agent.clone());
19150
19151                if let Some(token) = token.as_ref() {
19152                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19153                }
19154
19155                let request = req_builder
19156                    .header(CONTENT_TYPE, json_mime_type.to_string())
19157                    .header(CONTENT_LENGTH, request_size as u64)
19158                    .body(common::to_body(
19159                        request_value_reader.get_ref().clone().into(),
19160                    ));
19161
19162                client.request(request.unwrap()).await
19163            };
19164
19165            match req_result {
19166                Err(err) => {
19167                    if let common::Retry::After(d) = dlg.http_error(&err) {
19168                        sleep(d).await;
19169                        continue;
19170                    }
19171                    dlg.finished(false);
19172                    return Err(common::Error::HttpError(err));
19173                }
19174                Ok(res) => {
19175                    let (mut parts, body) = res.into_parts();
19176                    let mut body = common::Body::new(body);
19177                    if !parts.status.is_success() {
19178                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19179                        let error = serde_json::from_str(&common::to_string(&bytes));
19180                        let response = common::to_response(parts, bytes.into());
19181
19182                        if let common::Retry::After(d) =
19183                            dlg.http_failure(&response, error.as_ref().ok())
19184                        {
19185                            sleep(d).await;
19186                            continue;
19187                        }
19188
19189                        dlg.finished(false);
19190
19191                        return Err(match error {
19192                            Ok(value) => common::Error::BadRequest(value),
19193                            _ => common::Error::Failure(response),
19194                        });
19195                    }
19196                    let response = {
19197                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19198                        let encoded = common::to_string(&bytes);
19199                        match serde_json::from_str(&encoded) {
19200                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19201                            Err(error) => {
19202                                dlg.response_json_decode_error(&encoded, &error);
19203                                return Err(common::Error::JsonDecodeError(
19204                                    encoded.to_string(),
19205                                    error,
19206                                ));
19207                            }
19208                        }
19209                    };
19210
19211                    dlg.finished(true);
19212                    return Ok(response);
19213                }
19214            }
19215        }
19216    }
19217
19218    ///
19219    /// Sets the *request* property to the given value.
19220    ///
19221    /// Even though the property as already been set when instantiating this call,
19222    /// we provide this method for API completeness.
19223    pub fn request(
19224        mut self,
19225        new_value: CustomTemplate,
19226    ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19227        self._request = new_value;
19228        self
19229    }
19230    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
19231    ///
19232    /// Sets the *parent* path property to the given value.
19233    ///
19234    /// Even though the property as already been set when instantiating this call,
19235    /// we provide this method for API completeness.
19236    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19237        self._parent = new_value.to_string();
19238        self
19239    }
19240    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19241    /// while executing the actual API request.
19242    ///
19243    /// ````text
19244    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19245    /// ````
19246    ///
19247    /// Sets the *delegate* property to the given value.
19248    pub fn delegate(
19249        mut self,
19250        new_value: &'a mut dyn common::Delegate,
19251    ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19252        self._delegate = Some(new_value);
19253        self
19254    }
19255
19256    /// Set any additional parameter of the query string used in the request.
19257    /// It should be used to set parameters which are not yet available through their own
19258    /// setters.
19259    ///
19260    /// Please note that this method must not be used to set any of the known parameters
19261    /// which have their own setter method. If done anyway, the request will fail.
19262    ///
19263    /// # Additional Parameters
19264    ///
19265    /// * *$.xgafv* (query-string) - V1 error format.
19266    /// * *access_token* (query-string) - OAuth access token.
19267    /// * *alt* (query-string) - Data format for response.
19268    /// * *callback* (query-string) - JSONP
19269    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19270    /// * *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.
19271    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19272    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19273    /// * *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.
19274    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19275    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19276    pub fn param<T>(
19277        mut self,
19278        name: T,
19279        value: T,
19280    ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19281    where
19282        T: AsRef<str>,
19283    {
19284        self._additional_params
19285            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19286        self
19287    }
19288
19289    /// Identifies the authorization scope for the method you are building.
19290    ///
19291    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19292    /// [`Scope::EditContainer`].
19293    ///
19294    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19295    /// tokens for more than one scope.
19296    ///
19297    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19298    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19299    /// sufficient, a read-write scope will do as well.
19300    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19301    where
19302        St: AsRef<str>,
19303    {
19304        self._scopes.insert(String::from(scope.as_ref()));
19305        self
19306    }
19307    /// Identifies the authorization scope(s) for the method you are building.
19308    ///
19309    /// See [`Self::add_scope()`] for details.
19310    pub fn add_scopes<I, St>(
19311        mut self,
19312        scopes: I,
19313    ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19314    where
19315        I: IntoIterator<Item = St>,
19316        St: AsRef<str>,
19317    {
19318        self._scopes
19319            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19320        self
19321    }
19322
19323    /// Removes all scopes, and no default scope will be used either.
19324    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19325    /// for details).
19326    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19327        self._scopes.clear();
19328        self
19329    }
19330}
19331
19332/// Deletes a GTM Template.
19333///
19334/// A builder for the *containers.workspaces.templates.delete* method supported by a *account* resource.
19335/// It is not used directly, but through a [`AccountMethods`] instance.
19336///
19337/// # Example
19338///
19339/// Instantiate a resource method builder
19340///
19341/// ```test_harness,no_run
19342/// # extern crate hyper;
19343/// # extern crate hyper_rustls;
19344/// # extern crate google_tagmanager2 as tagmanager2;
19345/// # async fn dox() {
19346/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19347///
19348/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19349/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19350/// #     secret,
19351/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19352/// # ).build().await.unwrap();
19353///
19354/// # let client = hyper_util::client::legacy::Client::builder(
19355/// #     hyper_util::rt::TokioExecutor::new()
19356/// # )
19357/// # .build(
19358/// #     hyper_rustls::HttpsConnectorBuilder::new()
19359/// #         .with_native_roots()
19360/// #         .unwrap()
19361/// #         .https_or_http()
19362/// #         .enable_http1()
19363/// #         .build()
19364/// # );
19365/// # let mut hub = TagManager::new(client, auth);
19366/// // You can configure optional parameters by calling the respective setters at will, and
19367/// // execute the final call using `doit()`.
19368/// // Values shown here are possibly random and not representative !
19369/// let result = hub.accounts().containers_workspaces_templates_delete("path")
19370///              .doit().await;
19371/// # }
19372/// ```
19373pub struct AccountContainerWorkspaceTemplateDeleteCall<'a, C>
19374where
19375    C: 'a,
19376{
19377    hub: &'a TagManager<C>,
19378    _path: String,
19379    _delegate: Option<&'a mut dyn common::Delegate>,
19380    _additional_params: HashMap<String, String>,
19381    _scopes: BTreeSet<String>,
19382}
19383
19384impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateDeleteCall<'a, C> {}
19385
19386impl<'a, C> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
19387where
19388    C: common::Connector,
19389{
19390    /// Perform the operation you have build so far.
19391    pub async fn doit(mut self) -> common::Result<common::Response> {
19392        use std::borrow::Cow;
19393        use std::io::{Read, Seek};
19394
19395        use common::{url::Params, ToParts};
19396        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19397
19398        let mut dd = common::DefaultDelegate;
19399        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19400        dlg.begin(common::MethodInfo {
19401            id: "tagmanager.accounts.containers.workspaces.templates.delete",
19402            http_method: hyper::Method::DELETE,
19403        });
19404
19405        for &field in ["path"].iter() {
19406            if self._additional_params.contains_key(field) {
19407                dlg.finished(false);
19408                return Err(common::Error::FieldClash(field));
19409            }
19410        }
19411
19412        let mut params = Params::with_capacity(2 + self._additional_params.len());
19413        params.push("path", self._path);
19414
19415        params.extend(self._additional_params.iter());
19416
19417        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
19418        if self._scopes.is_empty() {
19419            self._scopes
19420                .insert(Scope::EditContainer.as_ref().to_string());
19421        }
19422
19423        #[allow(clippy::single_element_loop)]
19424        for &(find_this, param_name) in [("{+path}", "path")].iter() {
19425            url = params.uri_replacement(url, param_name, find_this, true);
19426        }
19427        {
19428            let to_remove = ["path"];
19429            params.remove_params(&to_remove);
19430        }
19431
19432        let url = params.parse_with_url(&url);
19433
19434        loop {
19435            let token = match self
19436                .hub
19437                .auth
19438                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19439                .await
19440            {
19441                Ok(token) => token,
19442                Err(e) => match dlg.token(e) {
19443                    Ok(token) => token,
19444                    Err(e) => {
19445                        dlg.finished(false);
19446                        return Err(common::Error::MissingToken(e));
19447                    }
19448                },
19449            };
19450            let mut req_result = {
19451                let client = &self.hub.client;
19452                dlg.pre_request();
19453                let mut req_builder = hyper::Request::builder()
19454                    .method(hyper::Method::DELETE)
19455                    .uri(url.as_str())
19456                    .header(USER_AGENT, self.hub._user_agent.clone());
19457
19458                if let Some(token) = token.as_ref() {
19459                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19460                }
19461
19462                let request = req_builder
19463                    .header(CONTENT_LENGTH, 0_u64)
19464                    .body(common::to_body::<String>(None));
19465
19466                client.request(request.unwrap()).await
19467            };
19468
19469            match req_result {
19470                Err(err) => {
19471                    if let common::Retry::After(d) = dlg.http_error(&err) {
19472                        sleep(d).await;
19473                        continue;
19474                    }
19475                    dlg.finished(false);
19476                    return Err(common::Error::HttpError(err));
19477                }
19478                Ok(res) => {
19479                    let (mut parts, body) = res.into_parts();
19480                    let mut body = common::Body::new(body);
19481                    if !parts.status.is_success() {
19482                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19483                        let error = serde_json::from_str(&common::to_string(&bytes));
19484                        let response = common::to_response(parts, bytes.into());
19485
19486                        if let common::Retry::After(d) =
19487                            dlg.http_failure(&response, error.as_ref().ok())
19488                        {
19489                            sleep(d).await;
19490                            continue;
19491                        }
19492
19493                        dlg.finished(false);
19494
19495                        return Err(match error {
19496                            Ok(value) => common::Error::BadRequest(value),
19497                            _ => common::Error::Failure(response),
19498                        });
19499                    }
19500                    let response = common::Response::from_parts(parts, body);
19501
19502                    dlg.finished(true);
19503                    return Ok(response);
19504                }
19505            }
19506        }
19507    }
19508
19509    /// GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
19510    ///
19511    /// Sets the *path* path property to the given value.
19512    ///
19513    /// Even though the property as already been set when instantiating this call,
19514    /// we provide this method for API completeness.
19515    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
19516        self._path = new_value.to_string();
19517        self
19518    }
19519    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19520    /// while executing the actual API request.
19521    ///
19522    /// ````text
19523    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19524    /// ````
19525    ///
19526    /// Sets the *delegate* property to the given value.
19527    pub fn delegate(
19528        mut self,
19529        new_value: &'a mut dyn common::Delegate,
19530    ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
19531        self._delegate = Some(new_value);
19532        self
19533    }
19534
19535    /// Set any additional parameter of the query string used in the request.
19536    /// It should be used to set parameters which are not yet available through their own
19537    /// setters.
19538    ///
19539    /// Please note that this method must not be used to set any of the known parameters
19540    /// which have their own setter method. If done anyway, the request will fail.
19541    ///
19542    /// # Additional Parameters
19543    ///
19544    /// * *$.xgafv* (query-string) - V1 error format.
19545    /// * *access_token* (query-string) - OAuth access token.
19546    /// * *alt* (query-string) - Data format for response.
19547    /// * *callback* (query-string) - JSONP
19548    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19549    /// * *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.
19550    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19551    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19552    /// * *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.
19553    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19554    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19555    pub fn param<T>(
19556        mut self,
19557        name: T,
19558        value: T,
19559    ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
19560    where
19561        T: AsRef<str>,
19562    {
19563        self._additional_params
19564            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19565        self
19566    }
19567
19568    /// Identifies the authorization scope for the method you are building.
19569    ///
19570    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19571    /// [`Scope::EditContainer`].
19572    ///
19573    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19574    /// tokens for more than one scope.
19575    ///
19576    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19577    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19578    /// sufficient, a read-write scope will do as well.
19579    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
19580    where
19581        St: AsRef<str>,
19582    {
19583        self._scopes.insert(String::from(scope.as_ref()));
19584        self
19585    }
19586    /// Identifies the authorization scope(s) for the method you are building.
19587    ///
19588    /// See [`Self::add_scope()`] for details.
19589    pub fn add_scopes<I, St>(
19590        mut self,
19591        scopes: I,
19592    ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
19593    where
19594        I: IntoIterator<Item = St>,
19595        St: AsRef<str>,
19596    {
19597        self._scopes
19598            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19599        self
19600    }
19601
19602    /// Removes all scopes, and no default scope will be used either.
19603    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19604    /// for details).
19605    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
19606        self._scopes.clear();
19607        self
19608    }
19609}
19610
19611/// Gets a GTM Template.
19612///
19613/// A builder for the *containers.workspaces.templates.get* method supported by a *account* resource.
19614/// It is not used directly, but through a [`AccountMethods`] instance.
19615///
19616/// # Example
19617///
19618/// Instantiate a resource method builder
19619///
19620/// ```test_harness,no_run
19621/// # extern crate hyper;
19622/// # extern crate hyper_rustls;
19623/// # extern crate google_tagmanager2 as tagmanager2;
19624/// # async fn dox() {
19625/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19626///
19627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19629/// #     secret,
19630/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19631/// # ).build().await.unwrap();
19632///
19633/// # let client = hyper_util::client::legacy::Client::builder(
19634/// #     hyper_util::rt::TokioExecutor::new()
19635/// # )
19636/// # .build(
19637/// #     hyper_rustls::HttpsConnectorBuilder::new()
19638/// #         .with_native_roots()
19639/// #         .unwrap()
19640/// #         .https_or_http()
19641/// #         .enable_http1()
19642/// #         .build()
19643/// # );
19644/// # let mut hub = TagManager::new(client, auth);
19645/// // You can configure optional parameters by calling the respective setters at will, and
19646/// // execute the final call using `doit()`.
19647/// // Values shown here are possibly random and not representative !
19648/// let result = hub.accounts().containers_workspaces_templates_get("path")
19649///              .doit().await;
19650/// # }
19651/// ```
19652pub struct AccountContainerWorkspaceTemplateGetCall<'a, C>
19653where
19654    C: 'a,
19655{
19656    hub: &'a TagManager<C>,
19657    _path: String,
19658    _delegate: Option<&'a mut dyn common::Delegate>,
19659    _additional_params: HashMap<String, String>,
19660    _scopes: BTreeSet<String>,
19661}
19662
19663impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateGetCall<'a, C> {}
19664
19665impl<'a, C> AccountContainerWorkspaceTemplateGetCall<'a, C>
19666where
19667    C: common::Connector,
19668{
19669    /// Perform the operation you have build so far.
19670    pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
19671        use std::borrow::Cow;
19672        use std::io::{Read, Seek};
19673
19674        use common::{url::Params, ToParts};
19675        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19676
19677        let mut dd = common::DefaultDelegate;
19678        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19679        dlg.begin(common::MethodInfo {
19680            id: "tagmanager.accounts.containers.workspaces.templates.get",
19681            http_method: hyper::Method::GET,
19682        });
19683
19684        for &field in ["alt", "path"].iter() {
19685            if self._additional_params.contains_key(field) {
19686                dlg.finished(false);
19687                return Err(common::Error::FieldClash(field));
19688            }
19689        }
19690
19691        let mut params = Params::with_capacity(3 + self._additional_params.len());
19692        params.push("path", self._path);
19693
19694        params.extend(self._additional_params.iter());
19695
19696        params.push("alt", "json");
19697        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
19698        if self._scopes.is_empty() {
19699            self._scopes.insert(Scope::Readonly.as_ref().to_string());
19700        }
19701
19702        #[allow(clippy::single_element_loop)]
19703        for &(find_this, param_name) in [("{+path}", "path")].iter() {
19704            url = params.uri_replacement(url, param_name, find_this, true);
19705        }
19706        {
19707            let to_remove = ["path"];
19708            params.remove_params(&to_remove);
19709        }
19710
19711        let url = params.parse_with_url(&url);
19712
19713        loop {
19714            let token = match self
19715                .hub
19716                .auth
19717                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19718                .await
19719            {
19720                Ok(token) => token,
19721                Err(e) => match dlg.token(e) {
19722                    Ok(token) => token,
19723                    Err(e) => {
19724                        dlg.finished(false);
19725                        return Err(common::Error::MissingToken(e));
19726                    }
19727                },
19728            };
19729            let mut req_result = {
19730                let client = &self.hub.client;
19731                dlg.pre_request();
19732                let mut req_builder = hyper::Request::builder()
19733                    .method(hyper::Method::GET)
19734                    .uri(url.as_str())
19735                    .header(USER_AGENT, self.hub._user_agent.clone());
19736
19737                if let Some(token) = token.as_ref() {
19738                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19739                }
19740
19741                let request = req_builder
19742                    .header(CONTENT_LENGTH, 0_u64)
19743                    .body(common::to_body::<String>(None));
19744
19745                client.request(request.unwrap()).await
19746            };
19747
19748            match req_result {
19749                Err(err) => {
19750                    if let common::Retry::After(d) = dlg.http_error(&err) {
19751                        sleep(d).await;
19752                        continue;
19753                    }
19754                    dlg.finished(false);
19755                    return Err(common::Error::HttpError(err));
19756                }
19757                Ok(res) => {
19758                    let (mut parts, body) = res.into_parts();
19759                    let mut body = common::Body::new(body);
19760                    if !parts.status.is_success() {
19761                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19762                        let error = serde_json::from_str(&common::to_string(&bytes));
19763                        let response = common::to_response(parts, bytes.into());
19764
19765                        if let common::Retry::After(d) =
19766                            dlg.http_failure(&response, error.as_ref().ok())
19767                        {
19768                            sleep(d).await;
19769                            continue;
19770                        }
19771
19772                        dlg.finished(false);
19773
19774                        return Err(match error {
19775                            Ok(value) => common::Error::BadRequest(value),
19776                            _ => common::Error::Failure(response),
19777                        });
19778                    }
19779                    let response = {
19780                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19781                        let encoded = common::to_string(&bytes);
19782                        match serde_json::from_str(&encoded) {
19783                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19784                            Err(error) => {
19785                                dlg.response_json_decode_error(&encoded, &error);
19786                                return Err(common::Error::JsonDecodeError(
19787                                    encoded.to_string(),
19788                                    error,
19789                                ));
19790                            }
19791                        }
19792                    };
19793
19794                    dlg.finished(true);
19795                    return Ok(response);
19796                }
19797            }
19798        }
19799    }
19800
19801    /// GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
19802    ///
19803    /// Sets the *path* path property to the given value.
19804    ///
19805    /// Even though the property as already been set when instantiating this call,
19806    /// we provide this method for API completeness.
19807    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
19808        self._path = new_value.to_string();
19809        self
19810    }
19811    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19812    /// while executing the actual API request.
19813    ///
19814    /// ````text
19815    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19816    /// ````
19817    ///
19818    /// Sets the *delegate* property to the given value.
19819    pub fn delegate(
19820        mut self,
19821        new_value: &'a mut dyn common::Delegate,
19822    ) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
19823        self._delegate = Some(new_value);
19824        self
19825    }
19826
19827    /// Set any additional parameter of the query string used in the request.
19828    /// It should be used to set parameters which are not yet available through their own
19829    /// setters.
19830    ///
19831    /// Please note that this method must not be used to set any of the known parameters
19832    /// which have their own setter method. If done anyway, the request will fail.
19833    ///
19834    /// # Additional Parameters
19835    ///
19836    /// * *$.xgafv* (query-string) - V1 error format.
19837    /// * *access_token* (query-string) - OAuth access token.
19838    /// * *alt* (query-string) - Data format for response.
19839    /// * *callback* (query-string) - JSONP
19840    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19841    /// * *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.
19842    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19843    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19844    /// * *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.
19845    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19846    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19847    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
19848    where
19849        T: AsRef<str>,
19850    {
19851        self._additional_params
19852            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19853        self
19854    }
19855
19856    /// Identifies the authorization scope for the method you are building.
19857    ///
19858    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19859    /// [`Scope::Readonly`].
19860    ///
19861    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19862    /// tokens for more than one scope.
19863    ///
19864    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19865    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19866    /// sufficient, a read-write scope will do as well.
19867    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
19868    where
19869        St: AsRef<str>,
19870    {
19871        self._scopes.insert(String::from(scope.as_ref()));
19872        self
19873    }
19874    /// Identifies the authorization scope(s) for the method you are building.
19875    ///
19876    /// See [`Self::add_scope()`] for details.
19877    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
19878    where
19879        I: IntoIterator<Item = St>,
19880        St: AsRef<str>,
19881    {
19882        self._scopes
19883            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19884        self
19885    }
19886
19887    /// Removes all scopes, and no default scope will be used either.
19888    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19889    /// for details).
19890    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
19891        self._scopes.clear();
19892        self
19893    }
19894}
19895
19896/// Lists all GTM Templates of a GTM container workspace.
19897///
19898/// A builder for the *containers.workspaces.templates.list* method supported by a *account* resource.
19899/// It is not used directly, but through a [`AccountMethods`] instance.
19900///
19901/// # Example
19902///
19903/// Instantiate a resource method builder
19904///
19905/// ```test_harness,no_run
19906/// # extern crate hyper;
19907/// # extern crate hyper_rustls;
19908/// # extern crate google_tagmanager2 as tagmanager2;
19909/// # async fn dox() {
19910/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19911///
19912/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19913/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19914/// #     secret,
19915/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19916/// # ).build().await.unwrap();
19917///
19918/// # let client = hyper_util::client::legacy::Client::builder(
19919/// #     hyper_util::rt::TokioExecutor::new()
19920/// # )
19921/// # .build(
19922/// #     hyper_rustls::HttpsConnectorBuilder::new()
19923/// #         .with_native_roots()
19924/// #         .unwrap()
19925/// #         .https_or_http()
19926/// #         .enable_http1()
19927/// #         .build()
19928/// # );
19929/// # let mut hub = TagManager::new(client, auth);
19930/// // You can configure optional parameters by calling the respective setters at will, and
19931/// // execute the final call using `doit()`.
19932/// // Values shown here are possibly random and not representative !
19933/// let result = hub.accounts().containers_workspaces_templates_list("parent")
19934///              .page_token("Lorem")
19935///              .doit().await;
19936/// # }
19937/// ```
19938pub struct AccountContainerWorkspaceTemplateListCall<'a, C>
19939where
19940    C: 'a,
19941{
19942    hub: &'a TagManager<C>,
19943    _parent: String,
19944    _page_token: Option<String>,
19945    _delegate: Option<&'a mut dyn common::Delegate>,
19946    _additional_params: HashMap<String, String>,
19947    _scopes: BTreeSet<String>,
19948}
19949
19950impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateListCall<'a, C> {}
19951
19952impl<'a, C> AccountContainerWorkspaceTemplateListCall<'a, C>
19953where
19954    C: common::Connector,
19955{
19956    /// Perform the operation you have build so far.
19957    pub async fn doit(mut self) -> common::Result<(common::Response, ListTemplatesResponse)> {
19958        use std::borrow::Cow;
19959        use std::io::{Read, Seek};
19960
19961        use common::{url::Params, ToParts};
19962        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19963
19964        let mut dd = common::DefaultDelegate;
19965        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19966        dlg.begin(common::MethodInfo {
19967            id: "tagmanager.accounts.containers.workspaces.templates.list",
19968            http_method: hyper::Method::GET,
19969        });
19970
19971        for &field in ["alt", "parent", "pageToken"].iter() {
19972            if self._additional_params.contains_key(field) {
19973                dlg.finished(false);
19974                return Err(common::Error::FieldClash(field));
19975            }
19976        }
19977
19978        let mut params = Params::with_capacity(4 + self._additional_params.len());
19979        params.push("parent", self._parent);
19980        if let Some(value) = self._page_token.as_ref() {
19981            params.push("pageToken", value);
19982        }
19983
19984        params.extend(self._additional_params.iter());
19985
19986        params.push("alt", "json");
19987        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/templates";
19988        if self._scopes.is_empty() {
19989            self._scopes.insert(Scope::Readonly.as_ref().to_string());
19990        }
19991
19992        #[allow(clippy::single_element_loop)]
19993        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19994            url = params.uri_replacement(url, param_name, find_this, true);
19995        }
19996        {
19997            let to_remove = ["parent"];
19998            params.remove_params(&to_remove);
19999        }
20000
20001        let url = params.parse_with_url(&url);
20002
20003        loop {
20004            let token = match self
20005                .hub
20006                .auth
20007                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20008                .await
20009            {
20010                Ok(token) => token,
20011                Err(e) => match dlg.token(e) {
20012                    Ok(token) => token,
20013                    Err(e) => {
20014                        dlg.finished(false);
20015                        return Err(common::Error::MissingToken(e));
20016                    }
20017                },
20018            };
20019            let mut req_result = {
20020                let client = &self.hub.client;
20021                dlg.pre_request();
20022                let mut req_builder = hyper::Request::builder()
20023                    .method(hyper::Method::GET)
20024                    .uri(url.as_str())
20025                    .header(USER_AGENT, self.hub._user_agent.clone());
20026
20027                if let Some(token) = token.as_ref() {
20028                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20029                }
20030
20031                let request = req_builder
20032                    .header(CONTENT_LENGTH, 0_u64)
20033                    .body(common::to_body::<String>(None));
20034
20035                client.request(request.unwrap()).await
20036            };
20037
20038            match req_result {
20039                Err(err) => {
20040                    if let common::Retry::After(d) = dlg.http_error(&err) {
20041                        sleep(d).await;
20042                        continue;
20043                    }
20044                    dlg.finished(false);
20045                    return Err(common::Error::HttpError(err));
20046                }
20047                Ok(res) => {
20048                    let (mut parts, body) = res.into_parts();
20049                    let mut body = common::Body::new(body);
20050                    if !parts.status.is_success() {
20051                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20052                        let error = serde_json::from_str(&common::to_string(&bytes));
20053                        let response = common::to_response(parts, bytes.into());
20054
20055                        if let common::Retry::After(d) =
20056                            dlg.http_failure(&response, error.as_ref().ok())
20057                        {
20058                            sleep(d).await;
20059                            continue;
20060                        }
20061
20062                        dlg.finished(false);
20063
20064                        return Err(match error {
20065                            Ok(value) => common::Error::BadRequest(value),
20066                            _ => common::Error::Failure(response),
20067                        });
20068                    }
20069                    let response = {
20070                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20071                        let encoded = common::to_string(&bytes);
20072                        match serde_json::from_str(&encoded) {
20073                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20074                            Err(error) => {
20075                                dlg.response_json_decode_error(&encoded, &error);
20076                                return Err(common::Error::JsonDecodeError(
20077                                    encoded.to_string(),
20078                                    error,
20079                                ));
20080                            }
20081                        }
20082                    };
20083
20084                    dlg.finished(true);
20085                    return Ok(response);
20086                }
20087            }
20088        }
20089    }
20090
20091    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
20092    ///
20093    /// Sets the *parent* path property to the given value.
20094    ///
20095    /// Even though the property as already been set when instantiating this call,
20096    /// we provide this method for API completeness.
20097    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
20098        self._parent = new_value.to_string();
20099        self
20100    }
20101    /// Continuation token for fetching the next page of results.
20102    ///
20103    /// Sets the *page token* query property to the given value.
20104    pub fn page_token(
20105        mut self,
20106        new_value: &str,
20107    ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
20108        self._page_token = Some(new_value.to_string());
20109        self
20110    }
20111    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20112    /// while executing the actual API request.
20113    ///
20114    /// ````text
20115    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20116    /// ````
20117    ///
20118    /// Sets the *delegate* property to the given value.
20119    pub fn delegate(
20120        mut self,
20121        new_value: &'a mut dyn common::Delegate,
20122    ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
20123        self._delegate = Some(new_value);
20124        self
20125    }
20126
20127    /// Set any additional parameter of the query string used in the request.
20128    /// It should be used to set parameters which are not yet available through their own
20129    /// setters.
20130    ///
20131    /// Please note that this method must not be used to set any of the known parameters
20132    /// which have their own setter method. If done anyway, the request will fail.
20133    ///
20134    /// # Additional Parameters
20135    ///
20136    /// * *$.xgafv* (query-string) - V1 error format.
20137    /// * *access_token* (query-string) - OAuth access token.
20138    /// * *alt* (query-string) - Data format for response.
20139    /// * *callback* (query-string) - JSONP
20140    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20141    /// * *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.
20142    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20143    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20144    /// * *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.
20145    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20146    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20147    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTemplateListCall<'a, C>
20148    where
20149        T: AsRef<str>,
20150    {
20151        self._additional_params
20152            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20153        self
20154    }
20155
20156    /// Identifies the authorization scope for the method you are building.
20157    ///
20158    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20159    /// [`Scope::Readonly`].
20160    ///
20161    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20162    /// tokens for more than one scope.
20163    ///
20164    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20165    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20166    /// sufficient, a read-write scope will do as well.
20167    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateListCall<'a, C>
20168    where
20169        St: AsRef<str>,
20170    {
20171        self._scopes.insert(String::from(scope.as_ref()));
20172        self
20173    }
20174    /// Identifies the authorization scope(s) for the method you are building.
20175    ///
20176    /// See [`Self::add_scope()`] for details.
20177    pub fn add_scopes<I, St>(
20178        mut self,
20179        scopes: I,
20180    ) -> AccountContainerWorkspaceTemplateListCall<'a, C>
20181    where
20182        I: IntoIterator<Item = St>,
20183        St: AsRef<str>,
20184    {
20185        self._scopes
20186            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20187        self
20188    }
20189
20190    /// Removes all scopes, and no default scope will be used either.
20191    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20192    /// for details).
20193    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
20194        self._scopes.clear();
20195        self
20196    }
20197}
20198
20199/// Reverts changes to a GTM Template in a GTM Workspace.
20200///
20201/// A builder for the *containers.workspaces.templates.revert* method supported by a *account* resource.
20202/// It is not used directly, but through a [`AccountMethods`] instance.
20203///
20204/// # Example
20205///
20206/// Instantiate a resource method builder
20207///
20208/// ```test_harness,no_run
20209/// # extern crate hyper;
20210/// # extern crate hyper_rustls;
20211/// # extern crate google_tagmanager2 as tagmanager2;
20212/// # async fn dox() {
20213/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20214///
20215/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20216/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20217/// #     secret,
20218/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20219/// # ).build().await.unwrap();
20220///
20221/// # let client = hyper_util::client::legacy::Client::builder(
20222/// #     hyper_util::rt::TokioExecutor::new()
20223/// # )
20224/// # .build(
20225/// #     hyper_rustls::HttpsConnectorBuilder::new()
20226/// #         .with_native_roots()
20227/// #         .unwrap()
20228/// #         .https_or_http()
20229/// #         .enable_http1()
20230/// #         .build()
20231/// # );
20232/// # let mut hub = TagManager::new(client, auth);
20233/// // You can configure optional parameters by calling the respective setters at will, and
20234/// // execute the final call using `doit()`.
20235/// // Values shown here are possibly random and not representative !
20236/// let result = hub.accounts().containers_workspaces_templates_revert("path")
20237///              .fingerprint("sed")
20238///              .doit().await;
20239/// # }
20240/// ```
20241pub struct AccountContainerWorkspaceTemplateRevertCall<'a, C>
20242where
20243    C: 'a,
20244{
20245    hub: &'a TagManager<C>,
20246    _path: String,
20247    _fingerprint: Option<String>,
20248    _delegate: Option<&'a mut dyn common::Delegate>,
20249    _additional_params: HashMap<String, String>,
20250    _scopes: BTreeSet<String>,
20251}
20252
20253impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateRevertCall<'a, C> {}
20254
20255impl<'a, C> AccountContainerWorkspaceTemplateRevertCall<'a, C>
20256where
20257    C: common::Connector,
20258{
20259    /// Perform the operation you have build so far.
20260    pub async fn doit(mut self) -> common::Result<(common::Response, RevertTemplateResponse)> {
20261        use std::borrow::Cow;
20262        use std::io::{Read, Seek};
20263
20264        use common::{url::Params, ToParts};
20265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20266
20267        let mut dd = common::DefaultDelegate;
20268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20269        dlg.begin(common::MethodInfo {
20270            id: "tagmanager.accounts.containers.workspaces.templates.revert",
20271            http_method: hyper::Method::POST,
20272        });
20273
20274        for &field in ["alt", "path", "fingerprint"].iter() {
20275            if self._additional_params.contains_key(field) {
20276                dlg.finished(false);
20277                return Err(common::Error::FieldClash(field));
20278            }
20279        }
20280
20281        let mut params = Params::with_capacity(4 + self._additional_params.len());
20282        params.push("path", self._path);
20283        if let Some(value) = self._fingerprint.as_ref() {
20284            params.push("fingerprint", value);
20285        }
20286
20287        params.extend(self._additional_params.iter());
20288
20289        params.push("alt", "json");
20290        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
20291        if self._scopes.is_empty() {
20292            self._scopes
20293                .insert(Scope::EditContainer.as_ref().to_string());
20294        }
20295
20296        #[allow(clippy::single_element_loop)]
20297        for &(find_this, param_name) in [("{+path}", "path")].iter() {
20298            url = params.uri_replacement(url, param_name, find_this, true);
20299        }
20300        {
20301            let to_remove = ["path"];
20302            params.remove_params(&to_remove);
20303        }
20304
20305        let url = params.parse_with_url(&url);
20306
20307        loop {
20308            let token = match self
20309                .hub
20310                .auth
20311                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20312                .await
20313            {
20314                Ok(token) => token,
20315                Err(e) => match dlg.token(e) {
20316                    Ok(token) => token,
20317                    Err(e) => {
20318                        dlg.finished(false);
20319                        return Err(common::Error::MissingToken(e));
20320                    }
20321                },
20322            };
20323            let mut req_result = {
20324                let client = &self.hub.client;
20325                dlg.pre_request();
20326                let mut req_builder = hyper::Request::builder()
20327                    .method(hyper::Method::POST)
20328                    .uri(url.as_str())
20329                    .header(USER_AGENT, self.hub._user_agent.clone());
20330
20331                if let Some(token) = token.as_ref() {
20332                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20333                }
20334
20335                let request = req_builder
20336                    .header(CONTENT_LENGTH, 0_u64)
20337                    .body(common::to_body::<String>(None));
20338
20339                client.request(request.unwrap()).await
20340            };
20341
20342            match req_result {
20343                Err(err) => {
20344                    if let common::Retry::After(d) = dlg.http_error(&err) {
20345                        sleep(d).await;
20346                        continue;
20347                    }
20348                    dlg.finished(false);
20349                    return Err(common::Error::HttpError(err));
20350                }
20351                Ok(res) => {
20352                    let (mut parts, body) = res.into_parts();
20353                    let mut body = common::Body::new(body);
20354                    if !parts.status.is_success() {
20355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20356                        let error = serde_json::from_str(&common::to_string(&bytes));
20357                        let response = common::to_response(parts, bytes.into());
20358
20359                        if let common::Retry::After(d) =
20360                            dlg.http_failure(&response, error.as_ref().ok())
20361                        {
20362                            sleep(d).await;
20363                            continue;
20364                        }
20365
20366                        dlg.finished(false);
20367
20368                        return Err(match error {
20369                            Ok(value) => common::Error::BadRequest(value),
20370                            _ => common::Error::Failure(response),
20371                        });
20372                    }
20373                    let response = {
20374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20375                        let encoded = common::to_string(&bytes);
20376                        match serde_json::from_str(&encoded) {
20377                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20378                            Err(error) => {
20379                                dlg.response_json_decode_error(&encoded, &error);
20380                                return Err(common::Error::JsonDecodeError(
20381                                    encoded.to_string(),
20382                                    error,
20383                                ));
20384                            }
20385                        }
20386                    };
20387
20388                    dlg.finished(true);
20389                    return Ok(response);
20390                }
20391            }
20392        }
20393    }
20394
20395    /// GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
20396    ///
20397    /// Sets the *path* path property to the given value.
20398    ///
20399    /// Even though the property as already been set when instantiating this call,
20400    /// we provide this method for API completeness.
20401    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
20402        self._path = new_value.to_string();
20403        self
20404    }
20405    /// When provided, this fingerprint must match the fingerprint of the template in storage.
20406    ///
20407    /// Sets the *fingerprint* query property to the given value.
20408    pub fn fingerprint(
20409        mut self,
20410        new_value: &str,
20411    ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
20412        self._fingerprint = Some(new_value.to_string());
20413        self
20414    }
20415    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20416    /// while executing the actual API request.
20417    ///
20418    /// ````text
20419    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20420    /// ````
20421    ///
20422    /// Sets the *delegate* property to the given value.
20423    pub fn delegate(
20424        mut self,
20425        new_value: &'a mut dyn common::Delegate,
20426    ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
20427        self._delegate = Some(new_value);
20428        self
20429    }
20430
20431    /// Set any additional parameter of the query string used in the request.
20432    /// It should be used to set parameters which are not yet available through their own
20433    /// setters.
20434    ///
20435    /// Please note that this method must not be used to set any of the known parameters
20436    /// which have their own setter method. If done anyway, the request will fail.
20437    ///
20438    /// # Additional Parameters
20439    ///
20440    /// * *$.xgafv* (query-string) - V1 error format.
20441    /// * *access_token* (query-string) - OAuth access token.
20442    /// * *alt* (query-string) - Data format for response.
20443    /// * *callback* (query-string) - JSONP
20444    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20445    /// * *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.
20446    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20447    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20448    /// * *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.
20449    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20450    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20451    pub fn param<T>(
20452        mut self,
20453        name: T,
20454        value: T,
20455    ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
20456    where
20457        T: AsRef<str>,
20458    {
20459        self._additional_params
20460            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20461        self
20462    }
20463
20464    /// Identifies the authorization scope for the method you are building.
20465    ///
20466    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20467    /// [`Scope::EditContainer`].
20468    ///
20469    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20470    /// tokens for more than one scope.
20471    ///
20472    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20473    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20474    /// sufficient, a read-write scope will do as well.
20475    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
20476    where
20477        St: AsRef<str>,
20478    {
20479        self._scopes.insert(String::from(scope.as_ref()));
20480        self
20481    }
20482    /// Identifies the authorization scope(s) for the method you are building.
20483    ///
20484    /// See [`Self::add_scope()`] for details.
20485    pub fn add_scopes<I, St>(
20486        mut self,
20487        scopes: I,
20488    ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
20489    where
20490        I: IntoIterator<Item = St>,
20491        St: AsRef<str>,
20492    {
20493        self._scopes
20494            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20495        self
20496    }
20497
20498    /// Removes all scopes, and no default scope will be used either.
20499    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20500    /// for details).
20501    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
20502        self._scopes.clear();
20503        self
20504    }
20505}
20506
20507/// Updates a GTM Template.
20508///
20509/// A builder for the *containers.workspaces.templates.update* method supported by a *account* resource.
20510/// It is not used directly, but through a [`AccountMethods`] instance.
20511///
20512/// # Example
20513///
20514/// Instantiate a resource method builder
20515///
20516/// ```test_harness,no_run
20517/// # extern crate hyper;
20518/// # extern crate hyper_rustls;
20519/// # extern crate google_tagmanager2 as tagmanager2;
20520/// use tagmanager2::api::CustomTemplate;
20521/// # async fn dox() {
20522/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20523///
20524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20525/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20526/// #     secret,
20527/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20528/// # ).build().await.unwrap();
20529///
20530/// # let client = hyper_util::client::legacy::Client::builder(
20531/// #     hyper_util::rt::TokioExecutor::new()
20532/// # )
20533/// # .build(
20534/// #     hyper_rustls::HttpsConnectorBuilder::new()
20535/// #         .with_native_roots()
20536/// #         .unwrap()
20537/// #         .https_or_http()
20538/// #         .enable_http1()
20539/// #         .build()
20540/// # );
20541/// # let mut hub = TagManager::new(client, auth);
20542/// // As the method needs a request, you would usually fill it with the desired information
20543/// // into the respective structure. Some of the parts shown here might not be applicable !
20544/// // Values shown here are possibly random and not representative !
20545/// let mut req = CustomTemplate::default();
20546///
20547/// // You can configure optional parameters by calling the respective setters at will, and
20548/// // execute the final call using `doit()`.
20549/// // Values shown here are possibly random and not representative !
20550/// let result = hub.accounts().containers_workspaces_templates_update(req, "path")
20551///              .fingerprint("dolores")
20552///              .doit().await;
20553/// # }
20554/// ```
20555pub struct AccountContainerWorkspaceTemplateUpdateCall<'a, C>
20556where
20557    C: 'a,
20558{
20559    hub: &'a TagManager<C>,
20560    _request: CustomTemplate,
20561    _path: String,
20562    _fingerprint: Option<String>,
20563    _delegate: Option<&'a mut dyn common::Delegate>,
20564    _additional_params: HashMap<String, String>,
20565    _scopes: BTreeSet<String>,
20566}
20567
20568impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateUpdateCall<'a, C> {}
20569
20570impl<'a, C> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
20571where
20572    C: common::Connector,
20573{
20574    /// Perform the operation you have build so far.
20575    pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
20576        use std::borrow::Cow;
20577        use std::io::{Read, Seek};
20578
20579        use common::{url::Params, ToParts};
20580        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20581
20582        let mut dd = common::DefaultDelegate;
20583        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20584        dlg.begin(common::MethodInfo {
20585            id: "tagmanager.accounts.containers.workspaces.templates.update",
20586            http_method: hyper::Method::PUT,
20587        });
20588
20589        for &field in ["alt", "path", "fingerprint"].iter() {
20590            if self._additional_params.contains_key(field) {
20591                dlg.finished(false);
20592                return Err(common::Error::FieldClash(field));
20593            }
20594        }
20595
20596        let mut params = Params::with_capacity(5 + self._additional_params.len());
20597        params.push("path", self._path);
20598        if let Some(value) = self._fingerprint.as_ref() {
20599            params.push("fingerprint", value);
20600        }
20601
20602        params.extend(self._additional_params.iter());
20603
20604        params.push("alt", "json");
20605        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
20606        if self._scopes.is_empty() {
20607            self._scopes
20608                .insert(Scope::EditContainer.as_ref().to_string());
20609        }
20610
20611        #[allow(clippy::single_element_loop)]
20612        for &(find_this, param_name) in [("{+path}", "path")].iter() {
20613            url = params.uri_replacement(url, param_name, find_this, true);
20614        }
20615        {
20616            let to_remove = ["path"];
20617            params.remove_params(&to_remove);
20618        }
20619
20620        let url = params.parse_with_url(&url);
20621
20622        let mut json_mime_type = mime::APPLICATION_JSON;
20623        let mut request_value_reader = {
20624            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20625            common::remove_json_null_values(&mut value);
20626            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20627            serde_json::to_writer(&mut dst, &value).unwrap();
20628            dst
20629        };
20630        let request_size = request_value_reader
20631            .seek(std::io::SeekFrom::End(0))
20632            .unwrap();
20633        request_value_reader
20634            .seek(std::io::SeekFrom::Start(0))
20635            .unwrap();
20636
20637        loop {
20638            let token = match self
20639                .hub
20640                .auth
20641                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20642                .await
20643            {
20644                Ok(token) => token,
20645                Err(e) => match dlg.token(e) {
20646                    Ok(token) => token,
20647                    Err(e) => {
20648                        dlg.finished(false);
20649                        return Err(common::Error::MissingToken(e));
20650                    }
20651                },
20652            };
20653            request_value_reader
20654                .seek(std::io::SeekFrom::Start(0))
20655                .unwrap();
20656            let mut req_result = {
20657                let client = &self.hub.client;
20658                dlg.pre_request();
20659                let mut req_builder = hyper::Request::builder()
20660                    .method(hyper::Method::PUT)
20661                    .uri(url.as_str())
20662                    .header(USER_AGENT, self.hub._user_agent.clone());
20663
20664                if let Some(token) = token.as_ref() {
20665                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20666                }
20667
20668                let request = req_builder
20669                    .header(CONTENT_TYPE, json_mime_type.to_string())
20670                    .header(CONTENT_LENGTH, request_size as u64)
20671                    .body(common::to_body(
20672                        request_value_reader.get_ref().clone().into(),
20673                    ));
20674
20675                client.request(request.unwrap()).await
20676            };
20677
20678            match req_result {
20679                Err(err) => {
20680                    if let common::Retry::After(d) = dlg.http_error(&err) {
20681                        sleep(d).await;
20682                        continue;
20683                    }
20684                    dlg.finished(false);
20685                    return Err(common::Error::HttpError(err));
20686                }
20687                Ok(res) => {
20688                    let (mut parts, body) = res.into_parts();
20689                    let mut body = common::Body::new(body);
20690                    if !parts.status.is_success() {
20691                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20692                        let error = serde_json::from_str(&common::to_string(&bytes));
20693                        let response = common::to_response(parts, bytes.into());
20694
20695                        if let common::Retry::After(d) =
20696                            dlg.http_failure(&response, error.as_ref().ok())
20697                        {
20698                            sleep(d).await;
20699                            continue;
20700                        }
20701
20702                        dlg.finished(false);
20703
20704                        return Err(match error {
20705                            Ok(value) => common::Error::BadRequest(value),
20706                            _ => common::Error::Failure(response),
20707                        });
20708                    }
20709                    let response = {
20710                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20711                        let encoded = common::to_string(&bytes);
20712                        match serde_json::from_str(&encoded) {
20713                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20714                            Err(error) => {
20715                                dlg.response_json_decode_error(&encoded, &error);
20716                                return Err(common::Error::JsonDecodeError(
20717                                    encoded.to_string(),
20718                                    error,
20719                                ));
20720                            }
20721                        }
20722                    };
20723
20724                    dlg.finished(true);
20725                    return Ok(response);
20726                }
20727            }
20728        }
20729    }
20730
20731    ///
20732    /// Sets the *request* property to the given value.
20733    ///
20734    /// Even though the property as already been set when instantiating this call,
20735    /// we provide this method for API completeness.
20736    pub fn request(
20737        mut self,
20738        new_value: CustomTemplate,
20739    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
20740        self._request = new_value;
20741        self
20742    }
20743    /// GTM Custom Template's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/{template_id}
20744    ///
20745    /// Sets the *path* path property to the given value.
20746    ///
20747    /// Even though the property as already been set when instantiating this call,
20748    /// we provide this method for API completeness.
20749    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
20750        self._path = new_value.to_string();
20751        self
20752    }
20753    /// When provided, this fingerprint must match the fingerprint of the templates in storage.
20754    ///
20755    /// Sets the *fingerprint* query property to the given value.
20756    pub fn fingerprint(
20757        mut self,
20758        new_value: &str,
20759    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
20760        self._fingerprint = Some(new_value.to_string());
20761        self
20762    }
20763    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20764    /// while executing the actual API request.
20765    ///
20766    /// ````text
20767    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20768    /// ````
20769    ///
20770    /// Sets the *delegate* property to the given value.
20771    pub fn delegate(
20772        mut self,
20773        new_value: &'a mut dyn common::Delegate,
20774    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
20775        self._delegate = Some(new_value);
20776        self
20777    }
20778
20779    /// Set any additional parameter of the query string used in the request.
20780    /// It should be used to set parameters which are not yet available through their own
20781    /// setters.
20782    ///
20783    /// Please note that this method must not be used to set any of the known parameters
20784    /// which have their own setter method. If done anyway, the request will fail.
20785    ///
20786    /// # Additional Parameters
20787    ///
20788    /// * *$.xgafv* (query-string) - V1 error format.
20789    /// * *access_token* (query-string) - OAuth access token.
20790    /// * *alt* (query-string) - Data format for response.
20791    /// * *callback* (query-string) - JSONP
20792    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20793    /// * *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.
20794    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20795    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20796    /// * *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.
20797    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20798    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20799    pub fn param<T>(
20800        mut self,
20801        name: T,
20802        value: T,
20803    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
20804    where
20805        T: AsRef<str>,
20806    {
20807        self._additional_params
20808            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20809        self
20810    }
20811
20812    /// Identifies the authorization scope for the method you are building.
20813    ///
20814    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20815    /// [`Scope::EditContainer`].
20816    ///
20817    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20818    /// tokens for more than one scope.
20819    ///
20820    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20821    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20822    /// sufficient, a read-write scope will do as well.
20823    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
20824    where
20825        St: AsRef<str>,
20826    {
20827        self._scopes.insert(String::from(scope.as_ref()));
20828        self
20829    }
20830    /// Identifies the authorization scope(s) for the method you are building.
20831    ///
20832    /// See [`Self::add_scope()`] for details.
20833    pub fn add_scopes<I, St>(
20834        mut self,
20835        scopes: I,
20836    ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
20837    where
20838        I: IntoIterator<Item = St>,
20839        St: AsRef<str>,
20840    {
20841        self._scopes
20842            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20843        self
20844    }
20845
20846    /// Removes all scopes, and no default scope will be used either.
20847    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20848    /// for details).
20849    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
20850        self._scopes.clear();
20851        self
20852    }
20853}
20854
20855/// Creates a GTM Transformation.
20856///
20857/// A builder for the *containers.workspaces.transformations.create* method supported by a *account* resource.
20858/// It is not used directly, but through a [`AccountMethods`] instance.
20859///
20860/// # Example
20861///
20862/// Instantiate a resource method builder
20863///
20864/// ```test_harness,no_run
20865/// # extern crate hyper;
20866/// # extern crate hyper_rustls;
20867/// # extern crate google_tagmanager2 as tagmanager2;
20868/// use tagmanager2::api::Transformation;
20869/// # async fn dox() {
20870/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20871///
20872/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20873/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20874/// #     secret,
20875/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20876/// # ).build().await.unwrap();
20877///
20878/// # let client = hyper_util::client::legacy::Client::builder(
20879/// #     hyper_util::rt::TokioExecutor::new()
20880/// # )
20881/// # .build(
20882/// #     hyper_rustls::HttpsConnectorBuilder::new()
20883/// #         .with_native_roots()
20884/// #         .unwrap()
20885/// #         .https_or_http()
20886/// #         .enable_http1()
20887/// #         .build()
20888/// # );
20889/// # let mut hub = TagManager::new(client, auth);
20890/// // As the method needs a request, you would usually fill it with the desired information
20891/// // into the respective structure. Some of the parts shown here might not be applicable !
20892/// // Values shown here are possibly random and not representative !
20893/// let mut req = Transformation::default();
20894///
20895/// // You can configure optional parameters by calling the respective setters at will, and
20896/// // execute the final call using `doit()`.
20897/// // Values shown here are possibly random and not representative !
20898/// let result = hub.accounts().containers_workspaces_transformations_create(req, "parent")
20899///              .doit().await;
20900/// # }
20901/// ```
20902pub struct AccountContainerWorkspaceTransformationCreateCall<'a, C>
20903where
20904    C: 'a,
20905{
20906    hub: &'a TagManager<C>,
20907    _request: Transformation,
20908    _parent: String,
20909    _delegate: Option<&'a mut dyn common::Delegate>,
20910    _additional_params: HashMap<String, String>,
20911    _scopes: BTreeSet<String>,
20912}
20913
20914impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationCreateCall<'a, C> {}
20915
20916impl<'a, C> AccountContainerWorkspaceTransformationCreateCall<'a, C>
20917where
20918    C: common::Connector,
20919{
20920    /// Perform the operation you have build so far.
20921    pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
20922        use std::borrow::Cow;
20923        use std::io::{Read, Seek};
20924
20925        use common::{url::Params, ToParts};
20926        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20927
20928        let mut dd = common::DefaultDelegate;
20929        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20930        dlg.begin(common::MethodInfo {
20931            id: "tagmanager.accounts.containers.workspaces.transformations.create",
20932            http_method: hyper::Method::POST,
20933        });
20934
20935        for &field in ["alt", "parent"].iter() {
20936            if self._additional_params.contains_key(field) {
20937                dlg.finished(false);
20938                return Err(common::Error::FieldClash(field));
20939            }
20940        }
20941
20942        let mut params = Params::with_capacity(4 + self._additional_params.len());
20943        params.push("parent", self._parent);
20944
20945        params.extend(self._additional_params.iter());
20946
20947        params.push("alt", "json");
20948        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/transformations";
20949        if self._scopes.is_empty() {
20950            self._scopes
20951                .insert(Scope::EditContainer.as_ref().to_string());
20952        }
20953
20954        #[allow(clippy::single_element_loop)]
20955        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20956            url = params.uri_replacement(url, param_name, find_this, true);
20957        }
20958        {
20959            let to_remove = ["parent"];
20960            params.remove_params(&to_remove);
20961        }
20962
20963        let url = params.parse_with_url(&url);
20964
20965        let mut json_mime_type = mime::APPLICATION_JSON;
20966        let mut request_value_reader = {
20967            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20968            common::remove_json_null_values(&mut value);
20969            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20970            serde_json::to_writer(&mut dst, &value).unwrap();
20971            dst
20972        };
20973        let request_size = request_value_reader
20974            .seek(std::io::SeekFrom::End(0))
20975            .unwrap();
20976        request_value_reader
20977            .seek(std::io::SeekFrom::Start(0))
20978            .unwrap();
20979
20980        loop {
20981            let token = match self
20982                .hub
20983                .auth
20984                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20985                .await
20986            {
20987                Ok(token) => token,
20988                Err(e) => match dlg.token(e) {
20989                    Ok(token) => token,
20990                    Err(e) => {
20991                        dlg.finished(false);
20992                        return Err(common::Error::MissingToken(e));
20993                    }
20994                },
20995            };
20996            request_value_reader
20997                .seek(std::io::SeekFrom::Start(0))
20998                .unwrap();
20999            let mut req_result = {
21000                let client = &self.hub.client;
21001                dlg.pre_request();
21002                let mut req_builder = hyper::Request::builder()
21003                    .method(hyper::Method::POST)
21004                    .uri(url.as_str())
21005                    .header(USER_AGENT, self.hub._user_agent.clone());
21006
21007                if let Some(token) = token.as_ref() {
21008                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21009                }
21010
21011                let request = req_builder
21012                    .header(CONTENT_TYPE, json_mime_type.to_string())
21013                    .header(CONTENT_LENGTH, request_size as u64)
21014                    .body(common::to_body(
21015                        request_value_reader.get_ref().clone().into(),
21016                    ));
21017
21018                client.request(request.unwrap()).await
21019            };
21020
21021            match req_result {
21022                Err(err) => {
21023                    if let common::Retry::After(d) = dlg.http_error(&err) {
21024                        sleep(d).await;
21025                        continue;
21026                    }
21027                    dlg.finished(false);
21028                    return Err(common::Error::HttpError(err));
21029                }
21030                Ok(res) => {
21031                    let (mut parts, body) = res.into_parts();
21032                    let mut body = common::Body::new(body);
21033                    if !parts.status.is_success() {
21034                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21035                        let error = serde_json::from_str(&common::to_string(&bytes));
21036                        let response = common::to_response(parts, bytes.into());
21037
21038                        if let common::Retry::After(d) =
21039                            dlg.http_failure(&response, error.as_ref().ok())
21040                        {
21041                            sleep(d).await;
21042                            continue;
21043                        }
21044
21045                        dlg.finished(false);
21046
21047                        return Err(match error {
21048                            Ok(value) => common::Error::BadRequest(value),
21049                            _ => common::Error::Failure(response),
21050                        });
21051                    }
21052                    let response = {
21053                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21054                        let encoded = common::to_string(&bytes);
21055                        match serde_json::from_str(&encoded) {
21056                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21057                            Err(error) => {
21058                                dlg.response_json_decode_error(&encoded, &error);
21059                                return Err(common::Error::JsonDecodeError(
21060                                    encoded.to_string(),
21061                                    error,
21062                                ));
21063                            }
21064                        }
21065                    };
21066
21067                    dlg.finished(true);
21068                    return Ok(response);
21069                }
21070            }
21071        }
21072    }
21073
21074    ///
21075    /// Sets the *request* property to the given value.
21076    ///
21077    /// Even though the property as already been set when instantiating this call,
21078    /// we provide this method for API completeness.
21079    pub fn request(
21080        mut self,
21081        new_value: Transformation,
21082    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
21083        self._request = new_value;
21084        self
21085    }
21086    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
21087    ///
21088    /// Sets the *parent* path property to the given value.
21089    ///
21090    /// Even though the property as already been set when instantiating this call,
21091    /// we provide this method for API completeness.
21092    pub fn parent(
21093        mut self,
21094        new_value: &str,
21095    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
21096        self._parent = new_value.to_string();
21097        self
21098    }
21099    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21100    /// while executing the actual API request.
21101    ///
21102    /// ````text
21103    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21104    /// ````
21105    ///
21106    /// Sets the *delegate* property to the given value.
21107    pub fn delegate(
21108        mut self,
21109        new_value: &'a mut dyn common::Delegate,
21110    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
21111        self._delegate = Some(new_value);
21112        self
21113    }
21114
21115    /// Set any additional parameter of the query string used in the request.
21116    /// It should be used to set parameters which are not yet available through their own
21117    /// setters.
21118    ///
21119    /// Please note that this method must not be used to set any of the known parameters
21120    /// which have their own setter method. If done anyway, the request will fail.
21121    ///
21122    /// # Additional Parameters
21123    ///
21124    /// * *$.xgafv* (query-string) - V1 error format.
21125    /// * *access_token* (query-string) - OAuth access token.
21126    /// * *alt* (query-string) - Data format for response.
21127    /// * *callback* (query-string) - JSONP
21128    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21129    /// * *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.
21130    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21131    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21132    /// * *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.
21133    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21134    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21135    pub fn param<T>(
21136        mut self,
21137        name: T,
21138        value: T,
21139    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
21140    where
21141        T: AsRef<str>,
21142    {
21143        self._additional_params
21144            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21145        self
21146    }
21147
21148    /// Identifies the authorization scope for the method you are building.
21149    ///
21150    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21151    /// [`Scope::EditContainer`].
21152    ///
21153    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21154    /// tokens for more than one scope.
21155    ///
21156    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21157    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21158    /// sufficient, a read-write scope will do as well.
21159    pub fn add_scope<St>(
21160        mut self,
21161        scope: St,
21162    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
21163    where
21164        St: AsRef<str>,
21165    {
21166        self._scopes.insert(String::from(scope.as_ref()));
21167        self
21168    }
21169    /// Identifies the authorization scope(s) for the method you are building.
21170    ///
21171    /// See [`Self::add_scope()`] for details.
21172    pub fn add_scopes<I, St>(
21173        mut self,
21174        scopes: I,
21175    ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
21176    where
21177        I: IntoIterator<Item = St>,
21178        St: AsRef<str>,
21179    {
21180        self._scopes
21181            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21182        self
21183    }
21184
21185    /// Removes all scopes, and no default scope will be used either.
21186    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21187    /// for details).
21188    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
21189        self._scopes.clear();
21190        self
21191    }
21192}
21193
21194/// Deletes a GTM Transformation.
21195///
21196/// A builder for the *containers.workspaces.transformations.delete* method supported by a *account* resource.
21197/// It is not used directly, but through a [`AccountMethods`] instance.
21198///
21199/// # Example
21200///
21201/// Instantiate a resource method builder
21202///
21203/// ```test_harness,no_run
21204/// # extern crate hyper;
21205/// # extern crate hyper_rustls;
21206/// # extern crate google_tagmanager2 as tagmanager2;
21207/// # async fn dox() {
21208/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21209///
21210/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21211/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21212/// #     secret,
21213/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21214/// # ).build().await.unwrap();
21215///
21216/// # let client = hyper_util::client::legacy::Client::builder(
21217/// #     hyper_util::rt::TokioExecutor::new()
21218/// # )
21219/// # .build(
21220/// #     hyper_rustls::HttpsConnectorBuilder::new()
21221/// #         .with_native_roots()
21222/// #         .unwrap()
21223/// #         .https_or_http()
21224/// #         .enable_http1()
21225/// #         .build()
21226/// # );
21227/// # let mut hub = TagManager::new(client, auth);
21228/// // You can configure optional parameters by calling the respective setters at will, and
21229/// // execute the final call using `doit()`.
21230/// // Values shown here are possibly random and not representative !
21231/// let result = hub.accounts().containers_workspaces_transformations_delete("path")
21232///              .doit().await;
21233/// # }
21234/// ```
21235pub struct AccountContainerWorkspaceTransformationDeleteCall<'a, C>
21236where
21237    C: 'a,
21238{
21239    hub: &'a TagManager<C>,
21240    _path: String,
21241    _delegate: Option<&'a mut dyn common::Delegate>,
21242    _additional_params: HashMap<String, String>,
21243    _scopes: BTreeSet<String>,
21244}
21245
21246impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationDeleteCall<'a, C> {}
21247
21248impl<'a, C> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
21249where
21250    C: common::Connector,
21251{
21252    /// Perform the operation you have build so far.
21253    pub async fn doit(mut self) -> common::Result<common::Response> {
21254        use std::borrow::Cow;
21255        use std::io::{Read, Seek};
21256
21257        use common::{url::Params, ToParts};
21258        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21259
21260        let mut dd = common::DefaultDelegate;
21261        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21262        dlg.begin(common::MethodInfo {
21263            id: "tagmanager.accounts.containers.workspaces.transformations.delete",
21264            http_method: hyper::Method::DELETE,
21265        });
21266
21267        for &field in ["path"].iter() {
21268            if self._additional_params.contains_key(field) {
21269                dlg.finished(false);
21270                return Err(common::Error::FieldClash(field));
21271            }
21272        }
21273
21274        let mut params = Params::with_capacity(2 + self._additional_params.len());
21275        params.push("path", self._path);
21276
21277        params.extend(self._additional_params.iter());
21278
21279        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
21280        if self._scopes.is_empty() {
21281            self._scopes
21282                .insert(Scope::EditContainer.as_ref().to_string());
21283        }
21284
21285        #[allow(clippy::single_element_loop)]
21286        for &(find_this, param_name) in [("{+path}", "path")].iter() {
21287            url = params.uri_replacement(url, param_name, find_this, true);
21288        }
21289        {
21290            let to_remove = ["path"];
21291            params.remove_params(&to_remove);
21292        }
21293
21294        let url = params.parse_with_url(&url);
21295
21296        loop {
21297            let token = match self
21298                .hub
21299                .auth
21300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21301                .await
21302            {
21303                Ok(token) => token,
21304                Err(e) => match dlg.token(e) {
21305                    Ok(token) => token,
21306                    Err(e) => {
21307                        dlg.finished(false);
21308                        return Err(common::Error::MissingToken(e));
21309                    }
21310                },
21311            };
21312            let mut req_result = {
21313                let client = &self.hub.client;
21314                dlg.pre_request();
21315                let mut req_builder = hyper::Request::builder()
21316                    .method(hyper::Method::DELETE)
21317                    .uri(url.as_str())
21318                    .header(USER_AGENT, self.hub._user_agent.clone());
21319
21320                if let Some(token) = token.as_ref() {
21321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21322                }
21323
21324                let request = req_builder
21325                    .header(CONTENT_LENGTH, 0_u64)
21326                    .body(common::to_body::<String>(None));
21327
21328                client.request(request.unwrap()).await
21329            };
21330
21331            match req_result {
21332                Err(err) => {
21333                    if let common::Retry::After(d) = dlg.http_error(&err) {
21334                        sleep(d).await;
21335                        continue;
21336                    }
21337                    dlg.finished(false);
21338                    return Err(common::Error::HttpError(err));
21339                }
21340                Ok(res) => {
21341                    let (mut parts, body) = res.into_parts();
21342                    let mut body = common::Body::new(body);
21343                    if !parts.status.is_success() {
21344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21345                        let error = serde_json::from_str(&common::to_string(&bytes));
21346                        let response = common::to_response(parts, bytes.into());
21347
21348                        if let common::Retry::After(d) =
21349                            dlg.http_failure(&response, error.as_ref().ok())
21350                        {
21351                            sleep(d).await;
21352                            continue;
21353                        }
21354
21355                        dlg.finished(false);
21356
21357                        return Err(match error {
21358                            Ok(value) => common::Error::BadRequest(value),
21359                            _ => common::Error::Failure(response),
21360                        });
21361                    }
21362                    let response = common::Response::from_parts(parts, body);
21363
21364                    dlg.finished(true);
21365                    return Ok(response);
21366                }
21367            }
21368        }
21369    }
21370
21371    /// GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
21372    ///
21373    /// Sets the *path* path property to the given value.
21374    ///
21375    /// Even though the property as already been set when instantiating this call,
21376    /// we provide this method for API completeness.
21377    pub fn path(
21378        mut self,
21379        new_value: &str,
21380    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
21381        self._path = new_value.to_string();
21382        self
21383    }
21384    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21385    /// while executing the actual API request.
21386    ///
21387    /// ````text
21388    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21389    /// ````
21390    ///
21391    /// Sets the *delegate* property to the given value.
21392    pub fn delegate(
21393        mut self,
21394        new_value: &'a mut dyn common::Delegate,
21395    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
21396        self._delegate = Some(new_value);
21397        self
21398    }
21399
21400    /// Set any additional parameter of the query string used in the request.
21401    /// It should be used to set parameters which are not yet available through their own
21402    /// setters.
21403    ///
21404    /// Please note that this method must not be used to set any of the known parameters
21405    /// which have their own setter method. If done anyway, the request will fail.
21406    ///
21407    /// # Additional Parameters
21408    ///
21409    /// * *$.xgafv* (query-string) - V1 error format.
21410    /// * *access_token* (query-string) - OAuth access token.
21411    /// * *alt* (query-string) - Data format for response.
21412    /// * *callback* (query-string) - JSONP
21413    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21414    /// * *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.
21415    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21416    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21417    /// * *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.
21418    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21419    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21420    pub fn param<T>(
21421        mut self,
21422        name: T,
21423        value: T,
21424    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
21425    where
21426        T: AsRef<str>,
21427    {
21428        self._additional_params
21429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21430        self
21431    }
21432
21433    /// Identifies the authorization scope for the method you are building.
21434    ///
21435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21436    /// [`Scope::EditContainer`].
21437    ///
21438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21439    /// tokens for more than one scope.
21440    ///
21441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21443    /// sufficient, a read-write scope will do as well.
21444    pub fn add_scope<St>(
21445        mut self,
21446        scope: St,
21447    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
21448    where
21449        St: AsRef<str>,
21450    {
21451        self._scopes.insert(String::from(scope.as_ref()));
21452        self
21453    }
21454    /// Identifies the authorization scope(s) for the method you are building.
21455    ///
21456    /// See [`Self::add_scope()`] for details.
21457    pub fn add_scopes<I, St>(
21458        mut self,
21459        scopes: I,
21460    ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
21461    where
21462        I: IntoIterator<Item = St>,
21463        St: AsRef<str>,
21464    {
21465        self._scopes
21466            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21467        self
21468    }
21469
21470    /// Removes all scopes, and no default scope will be used either.
21471    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21472    /// for details).
21473    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
21474        self._scopes.clear();
21475        self
21476    }
21477}
21478
21479/// Gets a GTM Transformation.
21480///
21481/// A builder for the *containers.workspaces.transformations.get* method supported by a *account* resource.
21482/// It is not used directly, but through a [`AccountMethods`] instance.
21483///
21484/// # Example
21485///
21486/// Instantiate a resource method builder
21487///
21488/// ```test_harness,no_run
21489/// # extern crate hyper;
21490/// # extern crate hyper_rustls;
21491/// # extern crate google_tagmanager2 as tagmanager2;
21492/// # async fn dox() {
21493/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21494///
21495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21497/// #     secret,
21498/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21499/// # ).build().await.unwrap();
21500///
21501/// # let client = hyper_util::client::legacy::Client::builder(
21502/// #     hyper_util::rt::TokioExecutor::new()
21503/// # )
21504/// # .build(
21505/// #     hyper_rustls::HttpsConnectorBuilder::new()
21506/// #         .with_native_roots()
21507/// #         .unwrap()
21508/// #         .https_or_http()
21509/// #         .enable_http1()
21510/// #         .build()
21511/// # );
21512/// # let mut hub = TagManager::new(client, auth);
21513/// // You can configure optional parameters by calling the respective setters at will, and
21514/// // execute the final call using `doit()`.
21515/// // Values shown here are possibly random and not representative !
21516/// let result = hub.accounts().containers_workspaces_transformations_get("path")
21517///              .doit().await;
21518/// # }
21519/// ```
21520pub struct AccountContainerWorkspaceTransformationGetCall<'a, C>
21521where
21522    C: 'a,
21523{
21524    hub: &'a TagManager<C>,
21525    _path: String,
21526    _delegate: Option<&'a mut dyn common::Delegate>,
21527    _additional_params: HashMap<String, String>,
21528    _scopes: BTreeSet<String>,
21529}
21530
21531impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationGetCall<'a, C> {}
21532
21533impl<'a, C> AccountContainerWorkspaceTransformationGetCall<'a, C>
21534where
21535    C: common::Connector,
21536{
21537    /// Perform the operation you have build so far.
21538    pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
21539        use std::borrow::Cow;
21540        use std::io::{Read, Seek};
21541
21542        use common::{url::Params, ToParts};
21543        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21544
21545        let mut dd = common::DefaultDelegate;
21546        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21547        dlg.begin(common::MethodInfo {
21548            id: "tagmanager.accounts.containers.workspaces.transformations.get",
21549            http_method: hyper::Method::GET,
21550        });
21551
21552        for &field in ["alt", "path"].iter() {
21553            if self._additional_params.contains_key(field) {
21554                dlg.finished(false);
21555                return Err(common::Error::FieldClash(field));
21556            }
21557        }
21558
21559        let mut params = Params::with_capacity(3 + self._additional_params.len());
21560        params.push("path", self._path);
21561
21562        params.extend(self._additional_params.iter());
21563
21564        params.push("alt", "json");
21565        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
21566        if self._scopes.is_empty() {
21567            self._scopes.insert(Scope::Readonly.as_ref().to_string());
21568        }
21569
21570        #[allow(clippy::single_element_loop)]
21571        for &(find_this, param_name) in [("{+path}", "path")].iter() {
21572            url = params.uri_replacement(url, param_name, find_this, true);
21573        }
21574        {
21575            let to_remove = ["path"];
21576            params.remove_params(&to_remove);
21577        }
21578
21579        let url = params.parse_with_url(&url);
21580
21581        loop {
21582            let token = match self
21583                .hub
21584                .auth
21585                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21586                .await
21587            {
21588                Ok(token) => token,
21589                Err(e) => match dlg.token(e) {
21590                    Ok(token) => token,
21591                    Err(e) => {
21592                        dlg.finished(false);
21593                        return Err(common::Error::MissingToken(e));
21594                    }
21595                },
21596            };
21597            let mut req_result = {
21598                let client = &self.hub.client;
21599                dlg.pre_request();
21600                let mut req_builder = hyper::Request::builder()
21601                    .method(hyper::Method::GET)
21602                    .uri(url.as_str())
21603                    .header(USER_AGENT, self.hub._user_agent.clone());
21604
21605                if let Some(token) = token.as_ref() {
21606                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21607                }
21608
21609                let request = req_builder
21610                    .header(CONTENT_LENGTH, 0_u64)
21611                    .body(common::to_body::<String>(None));
21612
21613                client.request(request.unwrap()).await
21614            };
21615
21616            match req_result {
21617                Err(err) => {
21618                    if let common::Retry::After(d) = dlg.http_error(&err) {
21619                        sleep(d).await;
21620                        continue;
21621                    }
21622                    dlg.finished(false);
21623                    return Err(common::Error::HttpError(err));
21624                }
21625                Ok(res) => {
21626                    let (mut parts, body) = res.into_parts();
21627                    let mut body = common::Body::new(body);
21628                    if !parts.status.is_success() {
21629                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21630                        let error = serde_json::from_str(&common::to_string(&bytes));
21631                        let response = common::to_response(parts, bytes.into());
21632
21633                        if let common::Retry::After(d) =
21634                            dlg.http_failure(&response, error.as_ref().ok())
21635                        {
21636                            sleep(d).await;
21637                            continue;
21638                        }
21639
21640                        dlg.finished(false);
21641
21642                        return Err(match error {
21643                            Ok(value) => common::Error::BadRequest(value),
21644                            _ => common::Error::Failure(response),
21645                        });
21646                    }
21647                    let response = {
21648                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21649                        let encoded = common::to_string(&bytes);
21650                        match serde_json::from_str(&encoded) {
21651                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21652                            Err(error) => {
21653                                dlg.response_json_decode_error(&encoded, &error);
21654                                return Err(common::Error::JsonDecodeError(
21655                                    encoded.to_string(),
21656                                    error,
21657                                ));
21658                            }
21659                        }
21660                    };
21661
21662                    dlg.finished(true);
21663                    return Ok(response);
21664                }
21665            }
21666        }
21667    }
21668
21669    /// GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
21670    ///
21671    /// Sets the *path* path property to the given value.
21672    ///
21673    /// Even though the property as already been set when instantiating this call,
21674    /// we provide this method for API completeness.
21675    pub fn path(
21676        mut self,
21677        new_value: &str,
21678    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
21679        self._path = new_value.to_string();
21680        self
21681    }
21682    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21683    /// while executing the actual API request.
21684    ///
21685    /// ````text
21686    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21687    /// ````
21688    ///
21689    /// Sets the *delegate* property to the given value.
21690    pub fn delegate(
21691        mut self,
21692        new_value: &'a mut dyn common::Delegate,
21693    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
21694        self._delegate = Some(new_value);
21695        self
21696    }
21697
21698    /// Set any additional parameter of the query string used in the request.
21699    /// It should be used to set parameters which are not yet available through their own
21700    /// setters.
21701    ///
21702    /// Please note that this method must not be used to set any of the known parameters
21703    /// which have their own setter method. If done anyway, the request will fail.
21704    ///
21705    /// # Additional Parameters
21706    ///
21707    /// * *$.xgafv* (query-string) - V1 error format.
21708    /// * *access_token* (query-string) - OAuth access token.
21709    /// * *alt* (query-string) - Data format for response.
21710    /// * *callback* (query-string) - JSONP
21711    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21712    /// * *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.
21713    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21714    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21715    /// * *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.
21716    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21717    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21718    pub fn param<T>(
21719        mut self,
21720        name: T,
21721        value: T,
21722    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
21723    where
21724        T: AsRef<str>,
21725    {
21726        self._additional_params
21727            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21728        self
21729    }
21730
21731    /// Identifies the authorization scope for the method you are building.
21732    ///
21733    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21734    /// [`Scope::Readonly`].
21735    ///
21736    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21737    /// tokens for more than one scope.
21738    ///
21739    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21740    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21741    /// sufficient, a read-write scope will do as well.
21742    pub fn add_scope<St>(
21743        mut self,
21744        scope: St,
21745    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
21746    where
21747        St: AsRef<str>,
21748    {
21749        self._scopes.insert(String::from(scope.as_ref()));
21750        self
21751    }
21752    /// Identifies the authorization scope(s) for the method you are building.
21753    ///
21754    /// See [`Self::add_scope()`] for details.
21755    pub fn add_scopes<I, St>(
21756        mut self,
21757        scopes: I,
21758    ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
21759    where
21760        I: IntoIterator<Item = St>,
21761        St: AsRef<str>,
21762    {
21763        self._scopes
21764            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21765        self
21766    }
21767
21768    /// Removes all scopes, and no default scope will be used either.
21769    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21770    /// for details).
21771    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
21772        self._scopes.clear();
21773        self
21774    }
21775}
21776
21777/// Lists all GTM Transformations of a GTM container workspace.
21778///
21779/// A builder for the *containers.workspaces.transformations.list* method supported by a *account* resource.
21780/// It is not used directly, but through a [`AccountMethods`] instance.
21781///
21782/// # Example
21783///
21784/// Instantiate a resource method builder
21785///
21786/// ```test_harness,no_run
21787/// # extern crate hyper;
21788/// # extern crate hyper_rustls;
21789/// # extern crate google_tagmanager2 as tagmanager2;
21790/// # async fn dox() {
21791/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21792///
21793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21794/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21795/// #     secret,
21796/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21797/// # ).build().await.unwrap();
21798///
21799/// # let client = hyper_util::client::legacy::Client::builder(
21800/// #     hyper_util::rt::TokioExecutor::new()
21801/// # )
21802/// # .build(
21803/// #     hyper_rustls::HttpsConnectorBuilder::new()
21804/// #         .with_native_roots()
21805/// #         .unwrap()
21806/// #         .https_or_http()
21807/// #         .enable_http1()
21808/// #         .build()
21809/// # );
21810/// # let mut hub = TagManager::new(client, auth);
21811/// // You can configure optional parameters by calling the respective setters at will, and
21812/// // execute the final call using `doit()`.
21813/// // Values shown here are possibly random and not representative !
21814/// let result = hub.accounts().containers_workspaces_transformations_list("parent")
21815///              .page_token("et")
21816///              .doit().await;
21817/// # }
21818/// ```
21819pub struct AccountContainerWorkspaceTransformationListCall<'a, C>
21820where
21821    C: 'a,
21822{
21823    hub: &'a TagManager<C>,
21824    _parent: String,
21825    _page_token: Option<String>,
21826    _delegate: Option<&'a mut dyn common::Delegate>,
21827    _additional_params: HashMap<String, String>,
21828    _scopes: BTreeSet<String>,
21829}
21830
21831impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationListCall<'a, C> {}
21832
21833impl<'a, C> AccountContainerWorkspaceTransformationListCall<'a, C>
21834where
21835    C: common::Connector,
21836{
21837    /// Perform the operation you have build so far.
21838    pub async fn doit(mut self) -> common::Result<(common::Response, ListTransformationsResponse)> {
21839        use std::borrow::Cow;
21840        use std::io::{Read, Seek};
21841
21842        use common::{url::Params, ToParts};
21843        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21844
21845        let mut dd = common::DefaultDelegate;
21846        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21847        dlg.begin(common::MethodInfo {
21848            id: "tagmanager.accounts.containers.workspaces.transformations.list",
21849            http_method: hyper::Method::GET,
21850        });
21851
21852        for &field in ["alt", "parent", "pageToken"].iter() {
21853            if self._additional_params.contains_key(field) {
21854                dlg.finished(false);
21855                return Err(common::Error::FieldClash(field));
21856            }
21857        }
21858
21859        let mut params = Params::with_capacity(4 + self._additional_params.len());
21860        params.push("parent", self._parent);
21861        if let Some(value) = self._page_token.as_ref() {
21862            params.push("pageToken", value);
21863        }
21864
21865        params.extend(self._additional_params.iter());
21866
21867        params.push("alt", "json");
21868        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/transformations";
21869        if self._scopes.is_empty() {
21870            self._scopes.insert(Scope::Readonly.as_ref().to_string());
21871        }
21872
21873        #[allow(clippy::single_element_loop)]
21874        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21875            url = params.uri_replacement(url, param_name, find_this, true);
21876        }
21877        {
21878            let to_remove = ["parent"];
21879            params.remove_params(&to_remove);
21880        }
21881
21882        let url = params.parse_with_url(&url);
21883
21884        loop {
21885            let token = match self
21886                .hub
21887                .auth
21888                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21889                .await
21890            {
21891                Ok(token) => token,
21892                Err(e) => match dlg.token(e) {
21893                    Ok(token) => token,
21894                    Err(e) => {
21895                        dlg.finished(false);
21896                        return Err(common::Error::MissingToken(e));
21897                    }
21898                },
21899            };
21900            let mut req_result = {
21901                let client = &self.hub.client;
21902                dlg.pre_request();
21903                let mut req_builder = hyper::Request::builder()
21904                    .method(hyper::Method::GET)
21905                    .uri(url.as_str())
21906                    .header(USER_AGENT, self.hub._user_agent.clone());
21907
21908                if let Some(token) = token.as_ref() {
21909                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21910                }
21911
21912                let request = req_builder
21913                    .header(CONTENT_LENGTH, 0_u64)
21914                    .body(common::to_body::<String>(None));
21915
21916                client.request(request.unwrap()).await
21917            };
21918
21919            match req_result {
21920                Err(err) => {
21921                    if let common::Retry::After(d) = dlg.http_error(&err) {
21922                        sleep(d).await;
21923                        continue;
21924                    }
21925                    dlg.finished(false);
21926                    return Err(common::Error::HttpError(err));
21927                }
21928                Ok(res) => {
21929                    let (mut parts, body) = res.into_parts();
21930                    let mut body = common::Body::new(body);
21931                    if !parts.status.is_success() {
21932                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21933                        let error = serde_json::from_str(&common::to_string(&bytes));
21934                        let response = common::to_response(parts, bytes.into());
21935
21936                        if let common::Retry::After(d) =
21937                            dlg.http_failure(&response, error.as_ref().ok())
21938                        {
21939                            sleep(d).await;
21940                            continue;
21941                        }
21942
21943                        dlg.finished(false);
21944
21945                        return Err(match error {
21946                            Ok(value) => common::Error::BadRequest(value),
21947                            _ => common::Error::Failure(response),
21948                        });
21949                    }
21950                    let response = {
21951                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21952                        let encoded = common::to_string(&bytes);
21953                        match serde_json::from_str(&encoded) {
21954                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21955                            Err(error) => {
21956                                dlg.response_json_decode_error(&encoded, &error);
21957                                return Err(common::Error::JsonDecodeError(
21958                                    encoded.to_string(),
21959                                    error,
21960                                ));
21961                            }
21962                        }
21963                    };
21964
21965                    dlg.finished(true);
21966                    return Ok(response);
21967                }
21968            }
21969        }
21970    }
21971
21972    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
21973    ///
21974    /// Sets the *parent* path property to the given value.
21975    ///
21976    /// Even though the property as already been set when instantiating this call,
21977    /// we provide this method for API completeness.
21978    pub fn parent(
21979        mut self,
21980        new_value: &str,
21981    ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
21982        self._parent = new_value.to_string();
21983        self
21984    }
21985    /// Continuation token for fetching the next page of results.
21986    ///
21987    /// Sets the *page token* query property to the given value.
21988    pub fn page_token(
21989        mut self,
21990        new_value: &str,
21991    ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
21992        self._page_token = Some(new_value.to_string());
21993        self
21994    }
21995    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21996    /// while executing the actual API request.
21997    ///
21998    /// ````text
21999    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22000    /// ````
22001    ///
22002    /// Sets the *delegate* property to the given value.
22003    pub fn delegate(
22004        mut self,
22005        new_value: &'a mut dyn common::Delegate,
22006    ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
22007        self._delegate = Some(new_value);
22008        self
22009    }
22010
22011    /// Set any additional parameter of the query string used in the request.
22012    /// It should be used to set parameters which are not yet available through their own
22013    /// setters.
22014    ///
22015    /// Please note that this method must not be used to set any of the known parameters
22016    /// which have their own setter method. If done anyway, the request will fail.
22017    ///
22018    /// # Additional Parameters
22019    ///
22020    /// * *$.xgafv* (query-string) - V1 error format.
22021    /// * *access_token* (query-string) - OAuth access token.
22022    /// * *alt* (query-string) - Data format for response.
22023    /// * *callback* (query-string) - JSONP
22024    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22025    /// * *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.
22026    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22027    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22028    /// * *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.
22029    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22030    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22031    pub fn param<T>(
22032        mut self,
22033        name: T,
22034        value: T,
22035    ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
22036    where
22037        T: AsRef<str>,
22038    {
22039        self._additional_params
22040            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22041        self
22042    }
22043
22044    /// Identifies the authorization scope for the method you are building.
22045    ///
22046    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22047    /// [`Scope::Readonly`].
22048    ///
22049    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22050    /// tokens for more than one scope.
22051    ///
22052    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22053    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22054    /// sufficient, a read-write scope will do as well.
22055    pub fn add_scope<St>(
22056        mut self,
22057        scope: St,
22058    ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
22059    where
22060        St: AsRef<str>,
22061    {
22062        self._scopes.insert(String::from(scope.as_ref()));
22063        self
22064    }
22065    /// Identifies the authorization scope(s) for the method you are building.
22066    ///
22067    /// See [`Self::add_scope()`] for details.
22068    pub fn add_scopes<I, St>(
22069        mut self,
22070        scopes: I,
22071    ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
22072    where
22073        I: IntoIterator<Item = St>,
22074        St: AsRef<str>,
22075    {
22076        self._scopes
22077            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22078        self
22079    }
22080
22081    /// Removes all scopes, and no default scope will be used either.
22082    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22083    /// for details).
22084    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
22085        self._scopes.clear();
22086        self
22087    }
22088}
22089
22090/// Reverts changes to a GTM Transformation in a GTM Workspace.
22091///
22092/// A builder for the *containers.workspaces.transformations.revert* method supported by a *account* resource.
22093/// It is not used directly, but through a [`AccountMethods`] instance.
22094///
22095/// # Example
22096///
22097/// Instantiate a resource method builder
22098///
22099/// ```test_harness,no_run
22100/// # extern crate hyper;
22101/// # extern crate hyper_rustls;
22102/// # extern crate google_tagmanager2 as tagmanager2;
22103/// # async fn dox() {
22104/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22105///
22106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22108/// #     secret,
22109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22110/// # ).build().await.unwrap();
22111///
22112/// # let client = hyper_util::client::legacy::Client::builder(
22113/// #     hyper_util::rt::TokioExecutor::new()
22114/// # )
22115/// # .build(
22116/// #     hyper_rustls::HttpsConnectorBuilder::new()
22117/// #         .with_native_roots()
22118/// #         .unwrap()
22119/// #         .https_or_http()
22120/// #         .enable_http1()
22121/// #         .build()
22122/// # );
22123/// # let mut hub = TagManager::new(client, auth);
22124/// // You can configure optional parameters by calling the respective setters at will, and
22125/// // execute the final call using `doit()`.
22126/// // Values shown here are possibly random and not representative !
22127/// let result = hub.accounts().containers_workspaces_transformations_revert("path")
22128///              .fingerprint("sed")
22129///              .doit().await;
22130/// # }
22131/// ```
22132pub struct AccountContainerWorkspaceTransformationRevertCall<'a, C>
22133where
22134    C: 'a,
22135{
22136    hub: &'a TagManager<C>,
22137    _path: String,
22138    _fingerprint: Option<String>,
22139    _delegate: Option<&'a mut dyn common::Delegate>,
22140    _additional_params: HashMap<String, String>,
22141    _scopes: BTreeSet<String>,
22142}
22143
22144impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationRevertCall<'a, C> {}
22145
22146impl<'a, C> AccountContainerWorkspaceTransformationRevertCall<'a, C>
22147where
22148    C: common::Connector,
22149{
22150    /// Perform the operation you have build so far.
22151    pub async fn doit(
22152        mut self,
22153    ) -> common::Result<(common::Response, RevertTransformationResponse)> {
22154        use std::borrow::Cow;
22155        use std::io::{Read, Seek};
22156
22157        use common::{url::Params, ToParts};
22158        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22159
22160        let mut dd = common::DefaultDelegate;
22161        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22162        dlg.begin(common::MethodInfo {
22163            id: "tagmanager.accounts.containers.workspaces.transformations.revert",
22164            http_method: hyper::Method::POST,
22165        });
22166
22167        for &field in ["alt", "path", "fingerprint"].iter() {
22168            if self._additional_params.contains_key(field) {
22169                dlg.finished(false);
22170                return Err(common::Error::FieldClash(field));
22171            }
22172        }
22173
22174        let mut params = Params::with_capacity(4 + self._additional_params.len());
22175        params.push("path", self._path);
22176        if let Some(value) = self._fingerprint.as_ref() {
22177            params.push("fingerprint", value);
22178        }
22179
22180        params.extend(self._additional_params.iter());
22181
22182        params.push("alt", "json");
22183        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
22184        if self._scopes.is_empty() {
22185            self._scopes
22186                .insert(Scope::EditContainer.as_ref().to_string());
22187        }
22188
22189        #[allow(clippy::single_element_loop)]
22190        for &(find_this, param_name) in [("{+path}", "path")].iter() {
22191            url = params.uri_replacement(url, param_name, find_this, true);
22192        }
22193        {
22194            let to_remove = ["path"];
22195            params.remove_params(&to_remove);
22196        }
22197
22198        let url = params.parse_with_url(&url);
22199
22200        loop {
22201            let token = match self
22202                .hub
22203                .auth
22204                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22205                .await
22206            {
22207                Ok(token) => token,
22208                Err(e) => match dlg.token(e) {
22209                    Ok(token) => token,
22210                    Err(e) => {
22211                        dlg.finished(false);
22212                        return Err(common::Error::MissingToken(e));
22213                    }
22214                },
22215            };
22216            let mut req_result = {
22217                let client = &self.hub.client;
22218                dlg.pre_request();
22219                let mut req_builder = hyper::Request::builder()
22220                    .method(hyper::Method::POST)
22221                    .uri(url.as_str())
22222                    .header(USER_AGENT, self.hub._user_agent.clone());
22223
22224                if let Some(token) = token.as_ref() {
22225                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22226                }
22227
22228                let request = req_builder
22229                    .header(CONTENT_LENGTH, 0_u64)
22230                    .body(common::to_body::<String>(None));
22231
22232                client.request(request.unwrap()).await
22233            };
22234
22235            match req_result {
22236                Err(err) => {
22237                    if let common::Retry::After(d) = dlg.http_error(&err) {
22238                        sleep(d).await;
22239                        continue;
22240                    }
22241                    dlg.finished(false);
22242                    return Err(common::Error::HttpError(err));
22243                }
22244                Ok(res) => {
22245                    let (mut parts, body) = res.into_parts();
22246                    let mut body = common::Body::new(body);
22247                    if !parts.status.is_success() {
22248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22249                        let error = serde_json::from_str(&common::to_string(&bytes));
22250                        let response = common::to_response(parts, bytes.into());
22251
22252                        if let common::Retry::After(d) =
22253                            dlg.http_failure(&response, error.as_ref().ok())
22254                        {
22255                            sleep(d).await;
22256                            continue;
22257                        }
22258
22259                        dlg.finished(false);
22260
22261                        return Err(match error {
22262                            Ok(value) => common::Error::BadRequest(value),
22263                            _ => common::Error::Failure(response),
22264                        });
22265                    }
22266                    let response = {
22267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22268                        let encoded = common::to_string(&bytes);
22269                        match serde_json::from_str(&encoded) {
22270                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22271                            Err(error) => {
22272                                dlg.response_json_decode_error(&encoded, &error);
22273                                return Err(common::Error::JsonDecodeError(
22274                                    encoded.to_string(),
22275                                    error,
22276                                ));
22277                            }
22278                        }
22279                    };
22280
22281                    dlg.finished(true);
22282                    return Ok(response);
22283                }
22284            }
22285        }
22286    }
22287
22288    /// GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
22289    ///
22290    /// Sets the *path* path property to the given value.
22291    ///
22292    /// Even though the property as already been set when instantiating this call,
22293    /// we provide this method for API completeness.
22294    pub fn path(
22295        mut self,
22296        new_value: &str,
22297    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
22298        self._path = new_value.to_string();
22299        self
22300    }
22301    /// When provided, this fingerprint must match the fingerprint of the transformation in storage.
22302    ///
22303    /// Sets the *fingerprint* query property to the given value.
22304    pub fn fingerprint(
22305        mut self,
22306        new_value: &str,
22307    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
22308        self._fingerprint = Some(new_value.to_string());
22309        self
22310    }
22311    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22312    /// while executing the actual API request.
22313    ///
22314    /// ````text
22315    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22316    /// ````
22317    ///
22318    /// Sets the *delegate* property to the given value.
22319    pub fn delegate(
22320        mut self,
22321        new_value: &'a mut dyn common::Delegate,
22322    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
22323        self._delegate = Some(new_value);
22324        self
22325    }
22326
22327    /// Set any additional parameter of the query string used in the request.
22328    /// It should be used to set parameters which are not yet available through their own
22329    /// setters.
22330    ///
22331    /// Please note that this method must not be used to set any of the known parameters
22332    /// which have their own setter method. If done anyway, the request will fail.
22333    ///
22334    /// # Additional Parameters
22335    ///
22336    /// * *$.xgafv* (query-string) - V1 error format.
22337    /// * *access_token* (query-string) - OAuth access token.
22338    /// * *alt* (query-string) - Data format for response.
22339    /// * *callback* (query-string) - JSONP
22340    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22341    /// * *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.
22342    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22343    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22344    /// * *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.
22345    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22346    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22347    pub fn param<T>(
22348        mut self,
22349        name: T,
22350        value: T,
22351    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
22352    where
22353        T: AsRef<str>,
22354    {
22355        self._additional_params
22356            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22357        self
22358    }
22359
22360    /// Identifies the authorization scope for the method you are building.
22361    ///
22362    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22363    /// [`Scope::EditContainer`].
22364    ///
22365    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22366    /// tokens for more than one scope.
22367    ///
22368    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22369    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22370    /// sufficient, a read-write scope will do as well.
22371    pub fn add_scope<St>(
22372        mut self,
22373        scope: St,
22374    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
22375    where
22376        St: AsRef<str>,
22377    {
22378        self._scopes.insert(String::from(scope.as_ref()));
22379        self
22380    }
22381    /// Identifies the authorization scope(s) for the method you are building.
22382    ///
22383    /// See [`Self::add_scope()`] for details.
22384    pub fn add_scopes<I, St>(
22385        mut self,
22386        scopes: I,
22387    ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
22388    where
22389        I: IntoIterator<Item = St>,
22390        St: AsRef<str>,
22391    {
22392        self._scopes
22393            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22394        self
22395    }
22396
22397    /// Removes all scopes, and no default scope will be used either.
22398    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22399    /// for details).
22400    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
22401        self._scopes.clear();
22402        self
22403    }
22404}
22405
22406/// Updates a GTM Transformation.
22407///
22408/// A builder for the *containers.workspaces.transformations.update* method supported by a *account* resource.
22409/// It is not used directly, but through a [`AccountMethods`] instance.
22410///
22411/// # Example
22412///
22413/// Instantiate a resource method builder
22414///
22415/// ```test_harness,no_run
22416/// # extern crate hyper;
22417/// # extern crate hyper_rustls;
22418/// # extern crate google_tagmanager2 as tagmanager2;
22419/// use tagmanager2::api::Transformation;
22420/// # async fn dox() {
22421/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22422///
22423/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22424/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22425/// #     secret,
22426/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22427/// # ).build().await.unwrap();
22428///
22429/// # let client = hyper_util::client::legacy::Client::builder(
22430/// #     hyper_util::rt::TokioExecutor::new()
22431/// # )
22432/// # .build(
22433/// #     hyper_rustls::HttpsConnectorBuilder::new()
22434/// #         .with_native_roots()
22435/// #         .unwrap()
22436/// #         .https_or_http()
22437/// #         .enable_http1()
22438/// #         .build()
22439/// # );
22440/// # let mut hub = TagManager::new(client, auth);
22441/// // As the method needs a request, you would usually fill it with the desired information
22442/// // into the respective structure. Some of the parts shown here might not be applicable !
22443/// // Values shown here are possibly random and not representative !
22444/// let mut req = Transformation::default();
22445///
22446/// // You can configure optional parameters by calling the respective setters at will, and
22447/// // execute the final call using `doit()`.
22448/// // Values shown here are possibly random and not representative !
22449/// let result = hub.accounts().containers_workspaces_transformations_update(req, "path")
22450///              .fingerprint("nonumy")
22451///              .doit().await;
22452/// # }
22453/// ```
22454pub struct AccountContainerWorkspaceTransformationUpdateCall<'a, C>
22455where
22456    C: 'a,
22457{
22458    hub: &'a TagManager<C>,
22459    _request: Transformation,
22460    _path: String,
22461    _fingerprint: Option<String>,
22462    _delegate: Option<&'a mut dyn common::Delegate>,
22463    _additional_params: HashMap<String, String>,
22464    _scopes: BTreeSet<String>,
22465}
22466
22467impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationUpdateCall<'a, C> {}
22468
22469impl<'a, C> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
22470where
22471    C: common::Connector,
22472{
22473    /// Perform the operation you have build so far.
22474    pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
22475        use std::borrow::Cow;
22476        use std::io::{Read, Seek};
22477
22478        use common::{url::Params, ToParts};
22479        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22480
22481        let mut dd = common::DefaultDelegate;
22482        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22483        dlg.begin(common::MethodInfo {
22484            id: "tagmanager.accounts.containers.workspaces.transformations.update",
22485            http_method: hyper::Method::PUT,
22486        });
22487
22488        for &field in ["alt", "path", "fingerprint"].iter() {
22489            if self._additional_params.contains_key(field) {
22490                dlg.finished(false);
22491                return Err(common::Error::FieldClash(field));
22492            }
22493        }
22494
22495        let mut params = Params::with_capacity(5 + self._additional_params.len());
22496        params.push("path", self._path);
22497        if let Some(value) = self._fingerprint.as_ref() {
22498            params.push("fingerprint", value);
22499        }
22500
22501        params.extend(self._additional_params.iter());
22502
22503        params.push("alt", "json");
22504        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
22505        if self._scopes.is_empty() {
22506            self._scopes
22507                .insert(Scope::EditContainer.as_ref().to_string());
22508        }
22509
22510        #[allow(clippy::single_element_loop)]
22511        for &(find_this, param_name) in [("{+path}", "path")].iter() {
22512            url = params.uri_replacement(url, param_name, find_this, true);
22513        }
22514        {
22515            let to_remove = ["path"];
22516            params.remove_params(&to_remove);
22517        }
22518
22519        let url = params.parse_with_url(&url);
22520
22521        let mut json_mime_type = mime::APPLICATION_JSON;
22522        let mut request_value_reader = {
22523            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22524            common::remove_json_null_values(&mut value);
22525            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22526            serde_json::to_writer(&mut dst, &value).unwrap();
22527            dst
22528        };
22529        let request_size = request_value_reader
22530            .seek(std::io::SeekFrom::End(0))
22531            .unwrap();
22532        request_value_reader
22533            .seek(std::io::SeekFrom::Start(0))
22534            .unwrap();
22535
22536        loop {
22537            let token = match self
22538                .hub
22539                .auth
22540                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22541                .await
22542            {
22543                Ok(token) => token,
22544                Err(e) => match dlg.token(e) {
22545                    Ok(token) => token,
22546                    Err(e) => {
22547                        dlg.finished(false);
22548                        return Err(common::Error::MissingToken(e));
22549                    }
22550                },
22551            };
22552            request_value_reader
22553                .seek(std::io::SeekFrom::Start(0))
22554                .unwrap();
22555            let mut req_result = {
22556                let client = &self.hub.client;
22557                dlg.pre_request();
22558                let mut req_builder = hyper::Request::builder()
22559                    .method(hyper::Method::PUT)
22560                    .uri(url.as_str())
22561                    .header(USER_AGENT, self.hub._user_agent.clone());
22562
22563                if let Some(token) = token.as_ref() {
22564                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22565                }
22566
22567                let request = req_builder
22568                    .header(CONTENT_TYPE, json_mime_type.to_string())
22569                    .header(CONTENT_LENGTH, request_size as u64)
22570                    .body(common::to_body(
22571                        request_value_reader.get_ref().clone().into(),
22572                    ));
22573
22574                client.request(request.unwrap()).await
22575            };
22576
22577            match req_result {
22578                Err(err) => {
22579                    if let common::Retry::After(d) = dlg.http_error(&err) {
22580                        sleep(d).await;
22581                        continue;
22582                    }
22583                    dlg.finished(false);
22584                    return Err(common::Error::HttpError(err));
22585                }
22586                Ok(res) => {
22587                    let (mut parts, body) = res.into_parts();
22588                    let mut body = common::Body::new(body);
22589                    if !parts.status.is_success() {
22590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22591                        let error = serde_json::from_str(&common::to_string(&bytes));
22592                        let response = common::to_response(parts, bytes.into());
22593
22594                        if let common::Retry::After(d) =
22595                            dlg.http_failure(&response, error.as_ref().ok())
22596                        {
22597                            sleep(d).await;
22598                            continue;
22599                        }
22600
22601                        dlg.finished(false);
22602
22603                        return Err(match error {
22604                            Ok(value) => common::Error::BadRequest(value),
22605                            _ => common::Error::Failure(response),
22606                        });
22607                    }
22608                    let response = {
22609                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22610                        let encoded = common::to_string(&bytes);
22611                        match serde_json::from_str(&encoded) {
22612                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22613                            Err(error) => {
22614                                dlg.response_json_decode_error(&encoded, &error);
22615                                return Err(common::Error::JsonDecodeError(
22616                                    encoded.to_string(),
22617                                    error,
22618                                ));
22619                            }
22620                        }
22621                    };
22622
22623                    dlg.finished(true);
22624                    return Ok(response);
22625                }
22626            }
22627        }
22628    }
22629
22630    ///
22631    /// Sets the *request* property to the given value.
22632    ///
22633    /// Even though the property as already been set when instantiating this call,
22634    /// we provide this method for API completeness.
22635    pub fn request(
22636        mut self,
22637        new_value: Transformation,
22638    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
22639        self._request = new_value;
22640        self
22641    }
22642    /// GTM Transformation's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/transformations/{transformation_id}
22643    ///
22644    /// Sets the *path* path property to the given value.
22645    ///
22646    /// Even though the property as already been set when instantiating this call,
22647    /// we provide this method for API completeness.
22648    pub fn path(
22649        mut self,
22650        new_value: &str,
22651    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
22652        self._path = new_value.to_string();
22653        self
22654    }
22655    /// When provided, this fingerprint must match the fingerprint of the transformation in storage.
22656    ///
22657    /// Sets the *fingerprint* query property to the given value.
22658    pub fn fingerprint(
22659        mut self,
22660        new_value: &str,
22661    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
22662        self._fingerprint = Some(new_value.to_string());
22663        self
22664    }
22665    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22666    /// while executing the actual API request.
22667    ///
22668    /// ````text
22669    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22670    /// ````
22671    ///
22672    /// Sets the *delegate* property to the given value.
22673    pub fn delegate(
22674        mut self,
22675        new_value: &'a mut dyn common::Delegate,
22676    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
22677        self._delegate = Some(new_value);
22678        self
22679    }
22680
22681    /// Set any additional parameter of the query string used in the request.
22682    /// It should be used to set parameters which are not yet available through their own
22683    /// setters.
22684    ///
22685    /// Please note that this method must not be used to set any of the known parameters
22686    /// which have their own setter method. If done anyway, the request will fail.
22687    ///
22688    /// # Additional Parameters
22689    ///
22690    /// * *$.xgafv* (query-string) - V1 error format.
22691    /// * *access_token* (query-string) - OAuth access token.
22692    /// * *alt* (query-string) - Data format for response.
22693    /// * *callback* (query-string) - JSONP
22694    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22695    /// * *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.
22696    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22697    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22698    /// * *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.
22699    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22700    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22701    pub fn param<T>(
22702        mut self,
22703        name: T,
22704        value: T,
22705    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
22706    where
22707        T: AsRef<str>,
22708    {
22709        self._additional_params
22710            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22711        self
22712    }
22713
22714    /// Identifies the authorization scope for the method you are building.
22715    ///
22716    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22717    /// [`Scope::EditContainer`].
22718    ///
22719    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22720    /// tokens for more than one scope.
22721    ///
22722    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22723    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22724    /// sufficient, a read-write scope will do as well.
22725    pub fn add_scope<St>(
22726        mut self,
22727        scope: St,
22728    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
22729    where
22730        St: AsRef<str>,
22731    {
22732        self._scopes.insert(String::from(scope.as_ref()));
22733        self
22734    }
22735    /// Identifies the authorization scope(s) for the method you are building.
22736    ///
22737    /// See [`Self::add_scope()`] for details.
22738    pub fn add_scopes<I, St>(
22739        mut self,
22740        scopes: I,
22741    ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
22742    where
22743        I: IntoIterator<Item = St>,
22744        St: AsRef<str>,
22745    {
22746        self._scopes
22747            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22748        self
22749    }
22750
22751    /// Removes all scopes, and no default scope will be used either.
22752    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22753    /// for details).
22754    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
22755        self._scopes.clear();
22756        self
22757    }
22758}
22759
22760/// Creates a GTM Trigger.
22761///
22762/// A builder for the *containers.workspaces.triggers.create* method supported by a *account* resource.
22763/// It is not used directly, but through a [`AccountMethods`] instance.
22764///
22765/// # Example
22766///
22767/// Instantiate a resource method builder
22768///
22769/// ```test_harness,no_run
22770/// # extern crate hyper;
22771/// # extern crate hyper_rustls;
22772/// # extern crate google_tagmanager2 as tagmanager2;
22773/// use tagmanager2::api::Trigger;
22774/// # async fn dox() {
22775/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22776///
22777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22779/// #     secret,
22780/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22781/// # ).build().await.unwrap();
22782///
22783/// # let client = hyper_util::client::legacy::Client::builder(
22784/// #     hyper_util::rt::TokioExecutor::new()
22785/// # )
22786/// # .build(
22787/// #     hyper_rustls::HttpsConnectorBuilder::new()
22788/// #         .with_native_roots()
22789/// #         .unwrap()
22790/// #         .https_or_http()
22791/// #         .enable_http1()
22792/// #         .build()
22793/// # );
22794/// # let mut hub = TagManager::new(client, auth);
22795/// // As the method needs a request, you would usually fill it with the desired information
22796/// // into the respective structure. Some of the parts shown here might not be applicable !
22797/// // Values shown here are possibly random and not representative !
22798/// let mut req = Trigger::default();
22799///
22800/// // You can configure optional parameters by calling the respective setters at will, and
22801/// // execute the final call using `doit()`.
22802/// // Values shown here are possibly random and not representative !
22803/// let result = hub.accounts().containers_workspaces_triggers_create(req, "parent")
22804///              .doit().await;
22805/// # }
22806/// ```
22807pub struct AccountContainerWorkspaceTriggerCreateCall<'a, C>
22808where
22809    C: 'a,
22810{
22811    hub: &'a TagManager<C>,
22812    _request: Trigger,
22813    _parent: String,
22814    _delegate: Option<&'a mut dyn common::Delegate>,
22815    _additional_params: HashMap<String, String>,
22816    _scopes: BTreeSet<String>,
22817}
22818
22819impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerCreateCall<'a, C> {}
22820
22821impl<'a, C> AccountContainerWorkspaceTriggerCreateCall<'a, C>
22822where
22823    C: common::Connector,
22824{
22825    /// Perform the operation you have build so far.
22826    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
22827        use std::borrow::Cow;
22828        use std::io::{Read, Seek};
22829
22830        use common::{url::Params, ToParts};
22831        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22832
22833        let mut dd = common::DefaultDelegate;
22834        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22835        dlg.begin(common::MethodInfo {
22836            id: "tagmanager.accounts.containers.workspaces.triggers.create",
22837            http_method: hyper::Method::POST,
22838        });
22839
22840        for &field in ["alt", "parent"].iter() {
22841            if self._additional_params.contains_key(field) {
22842                dlg.finished(false);
22843                return Err(common::Error::FieldClash(field));
22844            }
22845        }
22846
22847        let mut params = Params::with_capacity(4 + self._additional_params.len());
22848        params.push("parent", self._parent);
22849
22850        params.extend(self._additional_params.iter());
22851
22852        params.push("alt", "json");
22853        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/triggers";
22854        if self._scopes.is_empty() {
22855            self._scopes
22856                .insert(Scope::EditContainer.as_ref().to_string());
22857        }
22858
22859        #[allow(clippy::single_element_loop)]
22860        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22861            url = params.uri_replacement(url, param_name, find_this, true);
22862        }
22863        {
22864            let to_remove = ["parent"];
22865            params.remove_params(&to_remove);
22866        }
22867
22868        let url = params.parse_with_url(&url);
22869
22870        let mut json_mime_type = mime::APPLICATION_JSON;
22871        let mut request_value_reader = {
22872            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22873            common::remove_json_null_values(&mut value);
22874            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22875            serde_json::to_writer(&mut dst, &value).unwrap();
22876            dst
22877        };
22878        let request_size = request_value_reader
22879            .seek(std::io::SeekFrom::End(0))
22880            .unwrap();
22881        request_value_reader
22882            .seek(std::io::SeekFrom::Start(0))
22883            .unwrap();
22884
22885        loop {
22886            let token = match self
22887                .hub
22888                .auth
22889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22890                .await
22891            {
22892                Ok(token) => token,
22893                Err(e) => match dlg.token(e) {
22894                    Ok(token) => token,
22895                    Err(e) => {
22896                        dlg.finished(false);
22897                        return Err(common::Error::MissingToken(e));
22898                    }
22899                },
22900            };
22901            request_value_reader
22902                .seek(std::io::SeekFrom::Start(0))
22903                .unwrap();
22904            let mut req_result = {
22905                let client = &self.hub.client;
22906                dlg.pre_request();
22907                let mut req_builder = hyper::Request::builder()
22908                    .method(hyper::Method::POST)
22909                    .uri(url.as_str())
22910                    .header(USER_AGENT, self.hub._user_agent.clone());
22911
22912                if let Some(token) = token.as_ref() {
22913                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22914                }
22915
22916                let request = req_builder
22917                    .header(CONTENT_TYPE, json_mime_type.to_string())
22918                    .header(CONTENT_LENGTH, request_size as u64)
22919                    .body(common::to_body(
22920                        request_value_reader.get_ref().clone().into(),
22921                    ));
22922
22923                client.request(request.unwrap()).await
22924            };
22925
22926            match req_result {
22927                Err(err) => {
22928                    if let common::Retry::After(d) = dlg.http_error(&err) {
22929                        sleep(d).await;
22930                        continue;
22931                    }
22932                    dlg.finished(false);
22933                    return Err(common::Error::HttpError(err));
22934                }
22935                Ok(res) => {
22936                    let (mut parts, body) = res.into_parts();
22937                    let mut body = common::Body::new(body);
22938                    if !parts.status.is_success() {
22939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22940                        let error = serde_json::from_str(&common::to_string(&bytes));
22941                        let response = common::to_response(parts, bytes.into());
22942
22943                        if let common::Retry::After(d) =
22944                            dlg.http_failure(&response, error.as_ref().ok())
22945                        {
22946                            sleep(d).await;
22947                            continue;
22948                        }
22949
22950                        dlg.finished(false);
22951
22952                        return Err(match error {
22953                            Ok(value) => common::Error::BadRequest(value),
22954                            _ => common::Error::Failure(response),
22955                        });
22956                    }
22957                    let response = {
22958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22959                        let encoded = common::to_string(&bytes);
22960                        match serde_json::from_str(&encoded) {
22961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22962                            Err(error) => {
22963                                dlg.response_json_decode_error(&encoded, &error);
22964                                return Err(common::Error::JsonDecodeError(
22965                                    encoded.to_string(),
22966                                    error,
22967                                ));
22968                            }
22969                        }
22970                    };
22971
22972                    dlg.finished(true);
22973                    return Ok(response);
22974                }
22975            }
22976        }
22977    }
22978
22979    ///
22980    /// Sets the *request* property to the given value.
22981    ///
22982    /// Even though the property as already been set when instantiating this call,
22983    /// we provide this method for API completeness.
22984    pub fn request(
22985        mut self,
22986        new_value: Trigger,
22987    ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
22988        self._request = new_value;
22989        self
22990    }
22991    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
22992    ///
22993    /// Sets the *parent* path property to the given value.
22994    ///
22995    /// Even though the property as already been set when instantiating this call,
22996    /// we provide this method for API completeness.
22997    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
22998        self._parent = new_value.to_string();
22999        self
23000    }
23001    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23002    /// while executing the actual API request.
23003    ///
23004    /// ````text
23005    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23006    /// ````
23007    ///
23008    /// Sets the *delegate* property to the given value.
23009    pub fn delegate(
23010        mut self,
23011        new_value: &'a mut dyn common::Delegate,
23012    ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
23013        self._delegate = Some(new_value);
23014        self
23015    }
23016
23017    /// Set any additional parameter of the query string used in the request.
23018    /// It should be used to set parameters which are not yet available through their own
23019    /// setters.
23020    ///
23021    /// Please note that this method must not be used to set any of the known parameters
23022    /// which have their own setter method. If done anyway, the request will fail.
23023    ///
23024    /// # Additional Parameters
23025    ///
23026    /// * *$.xgafv* (query-string) - V1 error format.
23027    /// * *access_token* (query-string) - OAuth access token.
23028    /// * *alt* (query-string) - Data format for response.
23029    /// * *callback* (query-string) - JSONP
23030    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23031    /// * *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.
23032    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23033    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23034    /// * *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.
23035    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23036    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23037    pub fn param<T>(
23038        mut self,
23039        name: T,
23040        value: T,
23041    ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
23042    where
23043        T: AsRef<str>,
23044    {
23045        self._additional_params
23046            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23047        self
23048    }
23049
23050    /// Identifies the authorization scope for the method you are building.
23051    ///
23052    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23053    /// [`Scope::EditContainer`].
23054    ///
23055    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23056    /// tokens for more than one scope.
23057    ///
23058    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23059    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23060    /// sufficient, a read-write scope will do as well.
23061    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
23062    where
23063        St: AsRef<str>,
23064    {
23065        self._scopes.insert(String::from(scope.as_ref()));
23066        self
23067    }
23068    /// Identifies the authorization scope(s) for the method you are building.
23069    ///
23070    /// See [`Self::add_scope()`] for details.
23071    pub fn add_scopes<I, St>(
23072        mut self,
23073        scopes: I,
23074    ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
23075    where
23076        I: IntoIterator<Item = St>,
23077        St: AsRef<str>,
23078    {
23079        self._scopes
23080            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23081        self
23082    }
23083
23084    /// Removes all scopes, and no default scope will be used either.
23085    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23086    /// for details).
23087    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
23088        self._scopes.clear();
23089        self
23090    }
23091}
23092
23093/// Deletes a GTM Trigger.
23094///
23095/// A builder for the *containers.workspaces.triggers.delete* method supported by a *account* resource.
23096/// It is not used directly, but through a [`AccountMethods`] instance.
23097///
23098/// # Example
23099///
23100/// Instantiate a resource method builder
23101///
23102/// ```test_harness,no_run
23103/// # extern crate hyper;
23104/// # extern crate hyper_rustls;
23105/// # extern crate google_tagmanager2 as tagmanager2;
23106/// # async fn dox() {
23107/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23108///
23109/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23110/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23111/// #     secret,
23112/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23113/// # ).build().await.unwrap();
23114///
23115/// # let client = hyper_util::client::legacy::Client::builder(
23116/// #     hyper_util::rt::TokioExecutor::new()
23117/// # )
23118/// # .build(
23119/// #     hyper_rustls::HttpsConnectorBuilder::new()
23120/// #         .with_native_roots()
23121/// #         .unwrap()
23122/// #         .https_or_http()
23123/// #         .enable_http1()
23124/// #         .build()
23125/// # );
23126/// # let mut hub = TagManager::new(client, auth);
23127/// // You can configure optional parameters by calling the respective setters at will, and
23128/// // execute the final call using `doit()`.
23129/// // Values shown here are possibly random and not representative !
23130/// let result = hub.accounts().containers_workspaces_triggers_delete("path")
23131///              .doit().await;
23132/// # }
23133/// ```
23134pub struct AccountContainerWorkspaceTriggerDeleteCall<'a, C>
23135where
23136    C: 'a,
23137{
23138    hub: &'a TagManager<C>,
23139    _path: String,
23140    _delegate: Option<&'a mut dyn common::Delegate>,
23141    _additional_params: HashMap<String, String>,
23142    _scopes: BTreeSet<String>,
23143}
23144
23145impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerDeleteCall<'a, C> {}
23146
23147impl<'a, C> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
23148where
23149    C: common::Connector,
23150{
23151    /// Perform the operation you have build so far.
23152    pub async fn doit(mut self) -> common::Result<common::Response> {
23153        use std::borrow::Cow;
23154        use std::io::{Read, Seek};
23155
23156        use common::{url::Params, ToParts};
23157        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23158
23159        let mut dd = common::DefaultDelegate;
23160        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23161        dlg.begin(common::MethodInfo {
23162            id: "tagmanager.accounts.containers.workspaces.triggers.delete",
23163            http_method: hyper::Method::DELETE,
23164        });
23165
23166        for &field in ["path"].iter() {
23167            if self._additional_params.contains_key(field) {
23168                dlg.finished(false);
23169                return Err(common::Error::FieldClash(field));
23170            }
23171        }
23172
23173        let mut params = Params::with_capacity(2 + self._additional_params.len());
23174        params.push("path", self._path);
23175
23176        params.extend(self._additional_params.iter());
23177
23178        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
23179        if self._scopes.is_empty() {
23180            self._scopes
23181                .insert(Scope::EditContainer.as_ref().to_string());
23182        }
23183
23184        #[allow(clippy::single_element_loop)]
23185        for &(find_this, param_name) in [("{+path}", "path")].iter() {
23186            url = params.uri_replacement(url, param_name, find_this, true);
23187        }
23188        {
23189            let to_remove = ["path"];
23190            params.remove_params(&to_remove);
23191        }
23192
23193        let url = params.parse_with_url(&url);
23194
23195        loop {
23196            let token = match self
23197                .hub
23198                .auth
23199                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23200                .await
23201            {
23202                Ok(token) => token,
23203                Err(e) => match dlg.token(e) {
23204                    Ok(token) => token,
23205                    Err(e) => {
23206                        dlg.finished(false);
23207                        return Err(common::Error::MissingToken(e));
23208                    }
23209                },
23210            };
23211            let mut req_result = {
23212                let client = &self.hub.client;
23213                dlg.pre_request();
23214                let mut req_builder = hyper::Request::builder()
23215                    .method(hyper::Method::DELETE)
23216                    .uri(url.as_str())
23217                    .header(USER_AGENT, self.hub._user_agent.clone());
23218
23219                if let Some(token) = token.as_ref() {
23220                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23221                }
23222
23223                let request = req_builder
23224                    .header(CONTENT_LENGTH, 0_u64)
23225                    .body(common::to_body::<String>(None));
23226
23227                client.request(request.unwrap()).await
23228            };
23229
23230            match req_result {
23231                Err(err) => {
23232                    if let common::Retry::After(d) = dlg.http_error(&err) {
23233                        sleep(d).await;
23234                        continue;
23235                    }
23236                    dlg.finished(false);
23237                    return Err(common::Error::HttpError(err));
23238                }
23239                Ok(res) => {
23240                    let (mut parts, body) = res.into_parts();
23241                    let mut body = common::Body::new(body);
23242                    if !parts.status.is_success() {
23243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23244                        let error = serde_json::from_str(&common::to_string(&bytes));
23245                        let response = common::to_response(parts, bytes.into());
23246
23247                        if let common::Retry::After(d) =
23248                            dlg.http_failure(&response, error.as_ref().ok())
23249                        {
23250                            sleep(d).await;
23251                            continue;
23252                        }
23253
23254                        dlg.finished(false);
23255
23256                        return Err(match error {
23257                            Ok(value) => common::Error::BadRequest(value),
23258                            _ => common::Error::Failure(response),
23259                        });
23260                    }
23261                    let response = common::Response::from_parts(parts, body);
23262
23263                    dlg.finished(true);
23264                    return Ok(response);
23265                }
23266            }
23267        }
23268    }
23269
23270    /// GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
23271    ///
23272    /// Sets the *path* path property to the given value.
23273    ///
23274    /// Even though the property as already been set when instantiating this call,
23275    /// we provide this method for API completeness.
23276    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
23277        self._path = new_value.to_string();
23278        self
23279    }
23280    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23281    /// while executing the actual API request.
23282    ///
23283    /// ````text
23284    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23285    /// ````
23286    ///
23287    /// Sets the *delegate* property to the given value.
23288    pub fn delegate(
23289        mut self,
23290        new_value: &'a mut dyn common::Delegate,
23291    ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
23292        self._delegate = Some(new_value);
23293        self
23294    }
23295
23296    /// Set any additional parameter of the query string used in the request.
23297    /// It should be used to set parameters which are not yet available through their own
23298    /// setters.
23299    ///
23300    /// Please note that this method must not be used to set any of the known parameters
23301    /// which have their own setter method. If done anyway, the request will fail.
23302    ///
23303    /// # Additional Parameters
23304    ///
23305    /// * *$.xgafv* (query-string) - V1 error format.
23306    /// * *access_token* (query-string) - OAuth access token.
23307    /// * *alt* (query-string) - Data format for response.
23308    /// * *callback* (query-string) - JSONP
23309    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23310    /// * *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.
23311    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23312    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23313    /// * *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.
23314    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23315    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23316    pub fn param<T>(
23317        mut self,
23318        name: T,
23319        value: T,
23320    ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
23321    where
23322        T: AsRef<str>,
23323    {
23324        self._additional_params
23325            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23326        self
23327    }
23328
23329    /// Identifies the authorization scope for the method you are building.
23330    ///
23331    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23332    /// [`Scope::EditContainer`].
23333    ///
23334    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23335    /// tokens for more than one scope.
23336    ///
23337    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23338    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23339    /// sufficient, a read-write scope will do as well.
23340    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
23341    where
23342        St: AsRef<str>,
23343    {
23344        self._scopes.insert(String::from(scope.as_ref()));
23345        self
23346    }
23347    /// Identifies the authorization scope(s) for the method you are building.
23348    ///
23349    /// See [`Self::add_scope()`] for details.
23350    pub fn add_scopes<I, St>(
23351        mut self,
23352        scopes: I,
23353    ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
23354    where
23355        I: IntoIterator<Item = St>,
23356        St: AsRef<str>,
23357    {
23358        self._scopes
23359            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23360        self
23361    }
23362
23363    /// Removes all scopes, and no default scope will be used either.
23364    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23365    /// for details).
23366    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
23367        self._scopes.clear();
23368        self
23369    }
23370}
23371
23372/// Gets a GTM Trigger.
23373///
23374/// A builder for the *containers.workspaces.triggers.get* method supported by a *account* resource.
23375/// It is not used directly, but through a [`AccountMethods`] instance.
23376///
23377/// # Example
23378///
23379/// Instantiate a resource method builder
23380///
23381/// ```test_harness,no_run
23382/// # extern crate hyper;
23383/// # extern crate hyper_rustls;
23384/// # extern crate google_tagmanager2 as tagmanager2;
23385/// # async fn dox() {
23386/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23387///
23388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23390/// #     secret,
23391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23392/// # ).build().await.unwrap();
23393///
23394/// # let client = hyper_util::client::legacy::Client::builder(
23395/// #     hyper_util::rt::TokioExecutor::new()
23396/// # )
23397/// # .build(
23398/// #     hyper_rustls::HttpsConnectorBuilder::new()
23399/// #         .with_native_roots()
23400/// #         .unwrap()
23401/// #         .https_or_http()
23402/// #         .enable_http1()
23403/// #         .build()
23404/// # );
23405/// # let mut hub = TagManager::new(client, auth);
23406/// // You can configure optional parameters by calling the respective setters at will, and
23407/// // execute the final call using `doit()`.
23408/// // Values shown here are possibly random and not representative !
23409/// let result = hub.accounts().containers_workspaces_triggers_get("path")
23410///              .doit().await;
23411/// # }
23412/// ```
23413pub struct AccountContainerWorkspaceTriggerGetCall<'a, C>
23414where
23415    C: 'a,
23416{
23417    hub: &'a TagManager<C>,
23418    _path: String,
23419    _delegate: Option<&'a mut dyn common::Delegate>,
23420    _additional_params: HashMap<String, String>,
23421    _scopes: BTreeSet<String>,
23422}
23423
23424impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerGetCall<'a, C> {}
23425
23426impl<'a, C> AccountContainerWorkspaceTriggerGetCall<'a, C>
23427where
23428    C: common::Connector,
23429{
23430    /// Perform the operation you have build so far.
23431    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
23432        use std::borrow::Cow;
23433        use std::io::{Read, Seek};
23434
23435        use common::{url::Params, ToParts};
23436        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23437
23438        let mut dd = common::DefaultDelegate;
23439        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23440        dlg.begin(common::MethodInfo {
23441            id: "tagmanager.accounts.containers.workspaces.triggers.get",
23442            http_method: hyper::Method::GET,
23443        });
23444
23445        for &field in ["alt", "path"].iter() {
23446            if self._additional_params.contains_key(field) {
23447                dlg.finished(false);
23448                return Err(common::Error::FieldClash(field));
23449            }
23450        }
23451
23452        let mut params = Params::with_capacity(3 + self._additional_params.len());
23453        params.push("path", self._path);
23454
23455        params.extend(self._additional_params.iter());
23456
23457        params.push("alt", "json");
23458        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
23459        if self._scopes.is_empty() {
23460            self._scopes.insert(Scope::Readonly.as_ref().to_string());
23461        }
23462
23463        #[allow(clippy::single_element_loop)]
23464        for &(find_this, param_name) in [("{+path}", "path")].iter() {
23465            url = params.uri_replacement(url, param_name, find_this, true);
23466        }
23467        {
23468            let to_remove = ["path"];
23469            params.remove_params(&to_remove);
23470        }
23471
23472        let url = params.parse_with_url(&url);
23473
23474        loop {
23475            let token = match self
23476                .hub
23477                .auth
23478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23479                .await
23480            {
23481                Ok(token) => token,
23482                Err(e) => match dlg.token(e) {
23483                    Ok(token) => token,
23484                    Err(e) => {
23485                        dlg.finished(false);
23486                        return Err(common::Error::MissingToken(e));
23487                    }
23488                },
23489            };
23490            let mut req_result = {
23491                let client = &self.hub.client;
23492                dlg.pre_request();
23493                let mut req_builder = hyper::Request::builder()
23494                    .method(hyper::Method::GET)
23495                    .uri(url.as_str())
23496                    .header(USER_AGENT, self.hub._user_agent.clone());
23497
23498                if let Some(token) = token.as_ref() {
23499                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23500                }
23501
23502                let request = req_builder
23503                    .header(CONTENT_LENGTH, 0_u64)
23504                    .body(common::to_body::<String>(None));
23505
23506                client.request(request.unwrap()).await
23507            };
23508
23509            match req_result {
23510                Err(err) => {
23511                    if let common::Retry::After(d) = dlg.http_error(&err) {
23512                        sleep(d).await;
23513                        continue;
23514                    }
23515                    dlg.finished(false);
23516                    return Err(common::Error::HttpError(err));
23517                }
23518                Ok(res) => {
23519                    let (mut parts, body) = res.into_parts();
23520                    let mut body = common::Body::new(body);
23521                    if !parts.status.is_success() {
23522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23523                        let error = serde_json::from_str(&common::to_string(&bytes));
23524                        let response = common::to_response(parts, bytes.into());
23525
23526                        if let common::Retry::After(d) =
23527                            dlg.http_failure(&response, error.as_ref().ok())
23528                        {
23529                            sleep(d).await;
23530                            continue;
23531                        }
23532
23533                        dlg.finished(false);
23534
23535                        return Err(match error {
23536                            Ok(value) => common::Error::BadRequest(value),
23537                            _ => common::Error::Failure(response),
23538                        });
23539                    }
23540                    let response = {
23541                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23542                        let encoded = common::to_string(&bytes);
23543                        match serde_json::from_str(&encoded) {
23544                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23545                            Err(error) => {
23546                                dlg.response_json_decode_error(&encoded, &error);
23547                                return Err(common::Error::JsonDecodeError(
23548                                    encoded.to_string(),
23549                                    error,
23550                                ));
23551                            }
23552                        }
23553                    };
23554
23555                    dlg.finished(true);
23556                    return Ok(response);
23557                }
23558            }
23559        }
23560    }
23561
23562    /// GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
23563    ///
23564    /// Sets the *path* path property to the given value.
23565    ///
23566    /// Even though the property as already been set when instantiating this call,
23567    /// we provide this method for API completeness.
23568    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
23569        self._path = new_value.to_string();
23570        self
23571    }
23572    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23573    /// while executing the actual API request.
23574    ///
23575    /// ````text
23576    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23577    /// ````
23578    ///
23579    /// Sets the *delegate* property to the given value.
23580    pub fn delegate(
23581        mut self,
23582        new_value: &'a mut dyn common::Delegate,
23583    ) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
23584        self._delegate = Some(new_value);
23585        self
23586    }
23587
23588    /// Set any additional parameter of the query string used in the request.
23589    /// It should be used to set parameters which are not yet available through their own
23590    /// setters.
23591    ///
23592    /// Please note that this method must not be used to set any of the known parameters
23593    /// which have their own setter method. If done anyway, the request will fail.
23594    ///
23595    /// # Additional Parameters
23596    ///
23597    /// * *$.xgafv* (query-string) - V1 error format.
23598    /// * *access_token* (query-string) - OAuth access token.
23599    /// * *alt* (query-string) - Data format for response.
23600    /// * *callback* (query-string) - JSONP
23601    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23602    /// * *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.
23603    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23604    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23605    /// * *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.
23606    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23607    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23608    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
23609    where
23610        T: AsRef<str>,
23611    {
23612        self._additional_params
23613            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23614        self
23615    }
23616
23617    /// Identifies the authorization scope for the method you are building.
23618    ///
23619    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23620    /// [`Scope::Readonly`].
23621    ///
23622    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23623    /// tokens for more than one scope.
23624    ///
23625    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23626    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23627    /// sufficient, a read-write scope will do as well.
23628    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
23629    where
23630        St: AsRef<str>,
23631    {
23632        self._scopes.insert(String::from(scope.as_ref()));
23633        self
23634    }
23635    /// Identifies the authorization scope(s) for the method you are building.
23636    ///
23637    /// See [`Self::add_scope()`] for details.
23638    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
23639    where
23640        I: IntoIterator<Item = St>,
23641        St: AsRef<str>,
23642    {
23643        self._scopes
23644            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23645        self
23646    }
23647
23648    /// Removes all scopes, and no default scope will be used either.
23649    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23650    /// for details).
23651    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
23652        self._scopes.clear();
23653        self
23654    }
23655}
23656
23657/// Lists all GTM Triggers of a Container.
23658///
23659/// A builder for the *containers.workspaces.triggers.list* method supported by a *account* resource.
23660/// It is not used directly, but through a [`AccountMethods`] instance.
23661///
23662/// # Example
23663///
23664/// Instantiate a resource method builder
23665///
23666/// ```test_harness,no_run
23667/// # extern crate hyper;
23668/// # extern crate hyper_rustls;
23669/// # extern crate google_tagmanager2 as tagmanager2;
23670/// # async fn dox() {
23671/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23672///
23673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23674/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23675/// #     secret,
23676/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23677/// # ).build().await.unwrap();
23678///
23679/// # let client = hyper_util::client::legacy::Client::builder(
23680/// #     hyper_util::rt::TokioExecutor::new()
23681/// # )
23682/// # .build(
23683/// #     hyper_rustls::HttpsConnectorBuilder::new()
23684/// #         .with_native_roots()
23685/// #         .unwrap()
23686/// #         .https_or_http()
23687/// #         .enable_http1()
23688/// #         .build()
23689/// # );
23690/// # let mut hub = TagManager::new(client, auth);
23691/// // You can configure optional parameters by calling the respective setters at will, and
23692/// // execute the final call using `doit()`.
23693/// // Values shown here are possibly random and not representative !
23694/// let result = hub.accounts().containers_workspaces_triggers_list("parent")
23695///              .page_token("sadipscing")
23696///              .doit().await;
23697/// # }
23698/// ```
23699pub struct AccountContainerWorkspaceTriggerListCall<'a, C>
23700where
23701    C: 'a,
23702{
23703    hub: &'a TagManager<C>,
23704    _parent: String,
23705    _page_token: Option<String>,
23706    _delegate: Option<&'a mut dyn common::Delegate>,
23707    _additional_params: HashMap<String, String>,
23708    _scopes: BTreeSet<String>,
23709}
23710
23711impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerListCall<'a, C> {}
23712
23713impl<'a, C> AccountContainerWorkspaceTriggerListCall<'a, C>
23714where
23715    C: common::Connector,
23716{
23717    /// Perform the operation you have build so far.
23718    pub async fn doit(mut self) -> common::Result<(common::Response, ListTriggersResponse)> {
23719        use std::borrow::Cow;
23720        use std::io::{Read, Seek};
23721
23722        use common::{url::Params, ToParts};
23723        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23724
23725        let mut dd = common::DefaultDelegate;
23726        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23727        dlg.begin(common::MethodInfo {
23728            id: "tagmanager.accounts.containers.workspaces.triggers.list",
23729            http_method: hyper::Method::GET,
23730        });
23731
23732        for &field in ["alt", "parent", "pageToken"].iter() {
23733            if self._additional_params.contains_key(field) {
23734                dlg.finished(false);
23735                return Err(common::Error::FieldClash(field));
23736            }
23737        }
23738
23739        let mut params = Params::with_capacity(4 + self._additional_params.len());
23740        params.push("parent", self._parent);
23741        if let Some(value) = self._page_token.as_ref() {
23742            params.push("pageToken", value);
23743        }
23744
23745        params.extend(self._additional_params.iter());
23746
23747        params.push("alt", "json");
23748        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/triggers";
23749        if self._scopes.is_empty() {
23750            self._scopes.insert(Scope::Readonly.as_ref().to_string());
23751        }
23752
23753        #[allow(clippy::single_element_loop)]
23754        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23755            url = params.uri_replacement(url, param_name, find_this, true);
23756        }
23757        {
23758            let to_remove = ["parent"];
23759            params.remove_params(&to_remove);
23760        }
23761
23762        let url = params.parse_with_url(&url);
23763
23764        loop {
23765            let token = match self
23766                .hub
23767                .auth
23768                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23769                .await
23770            {
23771                Ok(token) => token,
23772                Err(e) => match dlg.token(e) {
23773                    Ok(token) => token,
23774                    Err(e) => {
23775                        dlg.finished(false);
23776                        return Err(common::Error::MissingToken(e));
23777                    }
23778                },
23779            };
23780            let mut req_result = {
23781                let client = &self.hub.client;
23782                dlg.pre_request();
23783                let mut req_builder = hyper::Request::builder()
23784                    .method(hyper::Method::GET)
23785                    .uri(url.as_str())
23786                    .header(USER_AGENT, self.hub._user_agent.clone());
23787
23788                if let Some(token) = token.as_ref() {
23789                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23790                }
23791
23792                let request = req_builder
23793                    .header(CONTENT_LENGTH, 0_u64)
23794                    .body(common::to_body::<String>(None));
23795
23796                client.request(request.unwrap()).await
23797            };
23798
23799            match req_result {
23800                Err(err) => {
23801                    if let common::Retry::After(d) = dlg.http_error(&err) {
23802                        sleep(d).await;
23803                        continue;
23804                    }
23805                    dlg.finished(false);
23806                    return Err(common::Error::HttpError(err));
23807                }
23808                Ok(res) => {
23809                    let (mut parts, body) = res.into_parts();
23810                    let mut body = common::Body::new(body);
23811                    if !parts.status.is_success() {
23812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23813                        let error = serde_json::from_str(&common::to_string(&bytes));
23814                        let response = common::to_response(parts, bytes.into());
23815
23816                        if let common::Retry::After(d) =
23817                            dlg.http_failure(&response, error.as_ref().ok())
23818                        {
23819                            sleep(d).await;
23820                            continue;
23821                        }
23822
23823                        dlg.finished(false);
23824
23825                        return Err(match error {
23826                            Ok(value) => common::Error::BadRequest(value),
23827                            _ => common::Error::Failure(response),
23828                        });
23829                    }
23830                    let response = {
23831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23832                        let encoded = common::to_string(&bytes);
23833                        match serde_json::from_str(&encoded) {
23834                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23835                            Err(error) => {
23836                                dlg.response_json_decode_error(&encoded, &error);
23837                                return Err(common::Error::JsonDecodeError(
23838                                    encoded.to_string(),
23839                                    error,
23840                                ));
23841                            }
23842                        }
23843                    };
23844
23845                    dlg.finished(true);
23846                    return Ok(response);
23847                }
23848            }
23849        }
23850    }
23851
23852    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
23853    ///
23854    /// Sets the *parent* path property to the given value.
23855    ///
23856    /// Even though the property as already been set when instantiating this call,
23857    /// we provide this method for API completeness.
23858    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
23859        self._parent = new_value.to_string();
23860        self
23861    }
23862    /// Continuation token for fetching the next page of results.
23863    ///
23864    /// Sets the *page token* query property to the given value.
23865    pub fn page_token(
23866        mut self,
23867        new_value: &str,
23868    ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
23869        self._page_token = Some(new_value.to_string());
23870        self
23871    }
23872    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23873    /// while executing the actual API request.
23874    ///
23875    /// ````text
23876    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23877    /// ````
23878    ///
23879    /// Sets the *delegate* property to the given value.
23880    pub fn delegate(
23881        mut self,
23882        new_value: &'a mut dyn common::Delegate,
23883    ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
23884        self._delegate = Some(new_value);
23885        self
23886    }
23887
23888    /// Set any additional parameter of the query string used in the request.
23889    /// It should be used to set parameters which are not yet available through their own
23890    /// setters.
23891    ///
23892    /// Please note that this method must not be used to set any of the known parameters
23893    /// which have their own setter method. If done anyway, the request will fail.
23894    ///
23895    /// # Additional Parameters
23896    ///
23897    /// * *$.xgafv* (query-string) - V1 error format.
23898    /// * *access_token* (query-string) - OAuth access token.
23899    /// * *alt* (query-string) - Data format for response.
23900    /// * *callback* (query-string) - JSONP
23901    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23902    /// * *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.
23903    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23904    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23905    /// * *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.
23906    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23907    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23908    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerListCall<'a, C>
23909    where
23910        T: AsRef<str>,
23911    {
23912        self._additional_params
23913            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23914        self
23915    }
23916
23917    /// Identifies the authorization scope for the method you are building.
23918    ///
23919    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23920    /// [`Scope::Readonly`].
23921    ///
23922    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23923    /// tokens for more than one scope.
23924    ///
23925    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23926    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23927    /// sufficient, a read-write scope will do as well.
23928    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerListCall<'a, C>
23929    where
23930        St: AsRef<str>,
23931    {
23932        self._scopes.insert(String::from(scope.as_ref()));
23933        self
23934    }
23935    /// Identifies the authorization scope(s) for the method you are building.
23936    ///
23937    /// See [`Self::add_scope()`] for details.
23938    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTriggerListCall<'a, C>
23939    where
23940        I: IntoIterator<Item = St>,
23941        St: AsRef<str>,
23942    {
23943        self._scopes
23944            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23945        self
23946    }
23947
23948    /// Removes all scopes, and no default scope will be used either.
23949    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23950    /// for details).
23951    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
23952        self._scopes.clear();
23953        self
23954    }
23955}
23956
23957/// Reverts changes to a GTM Trigger in a GTM Workspace.
23958///
23959/// A builder for the *containers.workspaces.triggers.revert* method supported by a *account* resource.
23960/// It is not used directly, but through a [`AccountMethods`] instance.
23961///
23962/// # Example
23963///
23964/// Instantiate a resource method builder
23965///
23966/// ```test_harness,no_run
23967/// # extern crate hyper;
23968/// # extern crate hyper_rustls;
23969/// # extern crate google_tagmanager2 as tagmanager2;
23970/// # async fn dox() {
23971/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23972///
23973/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23975/// #     secret,
23976/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23977/// # ).build().await.unwrap();
23978///
23979/// # let client = hyper_util::client::legacy::Client::builder(
23980/// #     hyper_util::rt::TokioExecutor::new()
23981/// # )
23982/// # .build(
23983/// #     hyper_rustls::HttpsConnectorBuilder::new()
23984/// #         .with_native_roots()
23985/// #         .unwrap()
23986/// #         .https_or_http()
23987/// #         .enable_http1()
23988/// #         .build()
23989/// # );
23990/// # let mut hub = TagManager::new(client, auth);
23991/// // You can configure optional parameters by calling the respective setters at will, and
23992/// // execute the final call using `doit()`.
23993/// // Values shown here are possibly random and not representative !
23994/// let result = hub.accounts().containers_workspaces_triggers_revert("path")
23995///              .fingerprint("aliquyam")
23996///              .doit().await;
23997/// # }
23998/// ```
23999pub struct AccountContainerWorkspaceTriggerRevertCall<'a, C>
24000where
24001    C: 'a,
24002{
24003    hub: &'a TagManager<C>,
24004    _path: String,
24005    _fingerprint: Option<String>,
24006    _delegate: Option<&'a mut dyn common::Delegate>,
24007    _additional_params: HashMap<String, String>,
24008    _scopes: BTreeSet<String>,
24009}
24010
24011impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerRevertCall<'a, C> {}
24012
24013impl<'a, C> AccountContainerWorkspaceTriggerRevertCall<'a, C>
24014where
24015    C: common::Connector,
24016{
24017    /// Perform the operation you have build so far.
24018    pub async fn doit(mut self) -> common::Result<(common::Response, RevertTriggerResponse)> {
24019        use std::borrow::Cow;
24020        use std::io::{Read, Seek};
24021
24022        use common::{url::Params, ToParts};
24023        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24024
24025        let mut dd = common::DefaultDelegate;
24026        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24027        dlg.begin(common::MethodInfo {
24028            id: "tagmanager.accounts.containers.workspaces.triggers.revert",
24029            http_method: hyper::Method::POST,
24030        });
24031
24032        for &field in ["alt", "path", "fingerprint"].iter() {
24033            if self._additional_params.contains_key(field) {
24034                dlg.finished(false);
24035                return Err(common::Error::FieldClash(field));
24036            }
24037        }
24038
24039        let mut params = Params::with_capacity(4 + self._additional_params.len());
24040        params.push("path", self._path);
24041        if let Some(value) = self._fingerprint.as_ref() {
24042            params.push("fingerprint", value);
24043        }
24044
24045        params.extend(self._additional_params.iter());
24046
24047        params.push("alt", "json");
24048        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
24049        if self._scopes.is_empty() {
24050            self._scopes
24051                .insert(Scope::EditContainer.as_ref().to_string());
24052        }
24053
24054        #[allow(clippy::single_element_loop)]
24055        for &(find_this, param_name) in [("{+path}", "path")].iter() {
24056            url = params.uri_replacement(url, param_name, find_this, true);
24057        }
24058        {
24059            let to_remove = ["path"];
24060            params.remove_params(&to_remove);
24061        }
24062
24063        let url = params.parse_with_url(&url);
24064
24065        loop {
24066            let token = match self
24067                .hub
24068                .auth
24069                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24070                .await
24071            {
24072                Ok(token) => token,
24073                Err(e) => match dlg.token(e) {
24074                    Ok(token) => token,
24075                    Err(e) => {
24076                        dlg.finished(false);
24077                        return Err(common::Error::MissingToken(e));
24078                    }
24079                },
24080            };
24081            let mut req_result = {
24082                let client = &self.hub.client;
24083                dlg.pre_request();
24084                let mut req_builder = hyper::Request::builder()
24085                    .method(hyper::Method::POST)
24086                    .uri(url.as_str())
24087                    .header(USER_AGENT, self.hub._user_agent.clone());
24088
24089                if let Some(token) = token.as_ref() {
24090                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24091                }
24092
24093                let request = req_builder
24094                    .header(CONTENT_LENGTH, 0_u64)
24095                    .body(common::to_body::<String>(None));
24096
24097                client.request(request.unwrap()).await
24098            };
24099
24100            match req_result {
24101                Err(err) => {
24102                    if let common::Retry::After(d) = dlg.http_error(&err) {
24103                        sleep(d).await;
24104                        continue;
24105                    }
24106                    dlg.finished(false);
24107                    return Err(common::Error::HttpError(err));
24108                }
24109                Ok(res) => {
24110                    let (mut parts, body) = res.into_parts();
24111                    let mut body = common::Body::new(body);
24112                    if !parts.status.is_success() {
24113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24114                        let error = serde_json::from_str(&common::to_string(&bytes));
24115                        let response = common::to_response(parts, bytes.into());
24116
24117                        if let common::Retry::After(d) =
24118                            dlg.http_failure(&response, error.as_ref().ok())
24119                        {
24120                            sleep(d).await;
24121                            continue;
24122                        }
24123
24124                        dlg.finished(false);
24125
24126                        return Err(match error {
24127                            Ok(value) => common::Error::BadRequest(value),
24128                            _ => common::Error::Failure(response),
24129                        });
24130                    }
24131                    let response = {
24132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24133                        let encoded = common::to_string(&bytes);
24134                        match serde_json::from_str(&encoded) {
24135                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24136                            Err(error) => {
24137                                dlg.response_json_decode_error(&encoded, &error);
24138                                return Err(common::Error::JsonDecodeError(
24139                                    encoded.to_string(),
24140                                    error,
24141                                ));
24142                            }
24143                        }
24144                    };
24145
24146                    dlg.finished(true);
24147                    return Ok(response);
24148                }
24149            }
24150        }
24151    }
24152
24153    /// GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
24154    ///
24155    /// Sets the *path* path property to the given value.
24156    ///
24157    /// Even though the property as already been set when instantiating this call,
24158    /// we provide this method for API completeness.
24159    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
24160        self._path = new_value.to_string();
24161        self
24162    }
24163    /// When provided, this fingerprint must match the fingerprint of the trigger in storage.
24164    ///
24165    /// Sets the *fingerprint* query property to the given value.
24166    pub fn fingerprint(
24167        mut self,
24168        new_value: &str,
24169    ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
24170        self._fingerprint = Some(new_value.to_string());
24171        self
24172    }
24173    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24174    /// while executing the actual API request.
24175    ///
24176    /// ````text
24177    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24178    /// ````
24179    ///
24180    /// Sets the *delegate* property to the given value.
24181    pub fn delegate(
24182        mut self,
24183        new_value: &'a mut dyn common::Delegate,
24184    ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
24185        self._delegate = Some(new_value);
24186        self
24187    }
24188
24189    /// Set any additional parameter of the query string used in the request.
24190    /// It should be used to set parameters which are not yet available through their own
24191    /// setters.
24192    ///
24193    /// Please note that this method must not be used to set any of the known parameters
24194    /// which have their own setter method. If done anyway, the request will fail.
24195    ///
24196    /// # Additional Parameters
24197    ///
24198    /// * *$.xgafv* (query-string) - V1 error format.
24199    /// * *access_token* (query-string) - OAuth access token.
24200    /// * *alt* (query-string) - Data format for response.
24201    /// * *callback* (query-string) - JSONP
24202    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24203    /// * *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.
24204    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24205    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24206    /// * *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.
24207    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24208    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24209    pub fn param<T>(
24210        mut self,
24211        name: T,
24212        value: T,
24213    ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
24214    where
24215        T: AsRef<str>,
24216    {
24217        self._additional_params
24218            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24219        self
24220    }
24221
24222    /// Identifies the authorization scope for the method you are building.
24223    ///
24224    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24225    /// [`Scope::EditContainer`].
24226    ///
24227    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24228    /// tokens for more than one scope.
24229    ///
24230    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24231    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24232    /// sufficient, a read-write scope will do as well.
24233    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
24234    where
24235        St: AsRef<str>,
24236    {
24237        self._scopes.insert(String::from(scope.as_ref()));
24238        self
24239    }
24240    /// Identifies the authorization scope(s) for the method you are building.
24241    ///
24242    /// See [`Self::add_scope()`] for details.
24243    pub fn add_scopes<I, St>(
24244        mut self,
24245        scopes: I,
24246    ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
24247    where
24248        I: IntoIterator<Item = St>,
24249        St: AsRef<str>,
24250    {
24251        self._scopes
24252            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24253        self
24254    }
24255
24256    /// Removes all scopes, and no default scope will be used either.
24257    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24258    /// for details).
24259    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
24260        self._scopes.clear();
24261        self
24262    }
24263}
24264
24265/// Updates a GTM Trigger.
24266///
24267/// A builder for the *containers.workspaces.triggers.update* method supported by a *account* resource.
24268/// It is not used directly, but through a [`AccountMethods`] instance.
24269///
24270/// # Example
24271///
24272/// Instantiate a resource method builder
24273///
24274/// ```test_harness,no_run
24275/// # extern crate hyper;
24276/// # extern crate hyper_rustls;
24277/// # extern crate google_tagmanager2 as tagmanager2;
24278/// use tagmanager2::api::Trigger;
24279/// # async fn dox() {
24280/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24281///
24282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24284/// #     secret,
24285/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24286/// # ).build().await.unwrap();
24287///
24288/// # let client = hyper_util::client::legacy::Client::builder(
24289/// #     hyper_util::rt::TokioExecutor::new()
24290/// # )
24291/// # .build(
24292/// #     hyper_rustls::HttpsConnectorBuilder::new()
24293/// #         .with_native_roots()
24294/// #         .unwrap()
24295/// #         .https_or_http()
24296/// #         .enable_http1()
24297/// #         .build()
24298/// # );
24299/// # let mut hub = TagManager::new(client, auth);
24300/// // As the method needs a request, you would usually fill it with the desired information
24301/// // into the respective structure. Some of the parts shown here might not be applicable !
24302/// // Values shown here are possibly random and not representative !
24303/// let mut req = Trigger::default();
24304///
24305/// // You can configure optional parameters by calling the respective setters at will, and
24306/// // execute the final call using `doit()`.
24307/// // Values shown here are possibly random and not representative !
24308/// let result = hub.accounts().containers_workspaces_triggers_update(req, "path")
24309///              .fingerprint("est")
24310///              .doit().await;
24311/// # }
24312/// ```
24313pub struct AccountContainerWorkspaceTriggerUpdateCall<'a, C>
24314where
24315    C: 'a,
24316{
24317    hub: &'a TagManager<C>,
24318    _request: Trigger,
24319    _path: String,
24320    _fingerprint: Option<String>,
24321    _delegate: Option<&'a mut dyn common::Delegate>,
24322    _additional_params: HashMap<String, String>,
24323    _scopes: BTreeSet<String>,
24324}
24325
24326impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerUpdateCall<'a, C> {}
24327
24328impl<'a, C> AccountContainerWorkspaceTriggerUpdateCall<'a, C>
24329where
24330    C: common::Connector,
24331{
24332    /// Perform the operation you have build so far.
24333    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
24334        use std::borrow::Cow;
24335        use std::io::{Read, Seek};
24336
24337        use common::{url::Params, ToParts};
24338        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24339
24340        let mut dd = common::DefaultDelegate;
24341        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24342        dlg.begin(common::MethodInfo {
24343            id: "tagmanager.accounts.containers.workspaces.triggers.update",
24344            http_method: hyper::Method::PUT,
24345        });
24346
24347        for &field in ["alt", "path", "fingerprint"].iter() {
24348            if self._additional_params.contains_key(field) {
24349                dlg.finished(false);
24350                return Err(common::Error::FieldClash(field));
24351            }
24352        }
24353
24354        let mut params = Params::with_capacity(5 + self._additional_params.len());
24355        params.push("path", self._path);
24356        if let Some(value) = self._fingerprint.as_ref() {
24357            params.push("fingerprint", value);
24358        }
24359
24360        params.extend(self._additional_params.iter());
24361
24362        params.push("alt", "json");
24363        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
24364        if self._scopes.is_empty() {
24365            self._scopes
24366                .insert(Scope::EditContainer.as_ref().to_string());
24367        }
24368
24369        #[allow(clippy::single_element_loop)]
24370        for &(find_this, param_name) in [("{+path}", "path")].iter() {
24371            url = params.uri_replacement(url, param_name, find_this, true);
24372        }
24373        {
24374            let to_remove = ["path"];
24375            params.remove_params(&to_remove);
24376        }
24377
24378        let url = params.parse_with_url(&url);
24379
24380        let mut json_mime_type = mime::APPLICATION_JSON;
24381        let mut request_value_reader = {
24382            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24383            common::remove_json_null_values(&mut value);
24384            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24385            serde_json::to_writer(&mut dst, &value).unwrap();
24386            dst
24387        };
24388        let request_size = request_value_reader
24389            .seek(std::io::SeekFrom::End(0))
24390            .unwrap();
24391        request_value_reader
24392            .seek(std::io::SeekFrom::Start(0))
24393            .unwrap();
24394
24395        loop {
24396            let token = match self
24397                .hub
24398                .auth
24399                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24400                .await
24401            {
24402                Ok(token) => token,
24403                Err(e) => match dlg.token(e) {
24404                    Ok(token) => token,
24405                    Err(e) => {
24406                        dlg.finished(false);
24407                        return Err(common::Error::MissingToken(e));
24408                    }
24409                },
24410            };
24411            request_value_reader
24412                .seek(std::io::SeekFrom::Start(0))
24413                .unwrap();
24414            let mut req_result = {
24415                let client = &self.hub.client;
24416                dlg.pre_request();
24417                let mut req_builder = hyper::Request::builder()
24418                    .method(hyper::Method::PUT)
24419                    .uri(url.as_str())
24420                    .header(USER_AGENT, self.hub._user_agent.clone());
24421
24422                if let Some(token) = token.as_ref() {
24423                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24424                }
24425
24426                let request = req_builder
24427                    .header(CONTENT_TYPE, json_mime_type.to_string())
24428                    .header(CONTENT_LENGTH, request_size as u64)
24429                    .body(common::to_body(
24430                        request_value_reader.get_ref().clone().into(),
24431                    ));
24432
24433                client.request(request.unwrap()).await
24434            };
24435
24436            match req_result {
24437                Err(err) => {
24438                    if let common::Retry::After(d) = dlg.http_error(&err) {
24439                        sleep(d).await;
24440                        continue;
24441                    }
24442                    dlg.finished(false);
24443                    return Err(common::Error::HttpError(err));
24444                }
24445                Ok(res) => {
24446                    let (mut parts, body) = res.into_parts();
24447                    let mut body = common::Body::new(body);
24448                    if !parts.status.is_success() {
24449                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24450                        let error = serde_json::from_str(&common::to_string(&bytes));
24451                        let response = common::to_response(parts, bytes.into());
24452
24453                        if let common::Retry::After(d) =
24454                            dlg.http_failure(&response, error.as_ref().ok())
24455                        {
24456                            sleep(d).await;
24457                            continue;
24458                        }
24459
24460                        dlg.finished(false);
24461
24462                        return Err(match error {
24463                            Ok(value) => common::Error::BadRequest(value),
24464                            _ => common::Error::Failure(response),
24465                        });
24466                    }
24467                    let response = {
24468                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24469                        let encoded = common::to_string(&bytes);
24470                        match serde_json::from_str(&encoded) {
24471                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24472                            Err(error) => {
24473                                dlg.response_json_decode_error(&encoded, &error);
24474                                return Err(common::Error::JsonDecodeError(
24475                                    encoded.to_string(),
24476                                    error,
24477                                ));
24478                            }
24479                        }
24480                    };
24481
24482                    dlg.finished(true);
24483                    return Ok(response);
24484                }
24485            }
24486        }
24487    }
24488
24489    ///
24490    /// Sets the *request* property to the given value.
24491    ///
24492    /// Even though the property as already been set when instantiating this call,
24493    /// we provide this method for API completeness.
24494    pub fn request(
24495        mut self,
24496        new_value: Trigger,
24497    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
24498        self._request = new_value;
24499        self
24500    }
24501    /// GTM Trigger's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/triggers/{trigger_id}
24502    ///
24503    /// Sets the *path* path property to the given value.
24504    ///
24505    /// Even though the property as already been set when instantiating this call,
24506    /// we provide this method for API completeness.
24507    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
24508        self._path = new_value.to_string();
24509        self
24510    }
24511    /// When provided, this fingerprint must match the fingerprint of the trigger in storage.
24512    ///
24513    /// Sets the *fingerprint* query property to the given value.
24514    pub fn fingerprint(
24515        mut self,
24516        new_value: &str,
24517    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
24518        self._fingerprint = Some(new_value.to_string());
24519        self
24520    }
24521    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24522    /// while executing the actual API request.
24523    ///
24524    /// ````text
24525    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24526    /// ````
24527    ///
24528    /// Sets the *delegate* property to the given value.
24529    pub fn delegate(
24530        mut self,
24531        new_value: &'a mut dyn common::Delegate,
24532    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
24533        self._delegate = Some(new_value);
24534        self
24535    }
24536
24537    /// Set any additional parameter of the query string used in the request.
24538    /// It should be used to set parameters which are not yet available through their own
24539    /// setters.
24540    ///
24541    /// Please note that this method must not be used to set any of the known parameters
24542    /// which have their own setter method. If done anyway, the request will fail.
24543    ///
24544    /// # Additional Parameters
24545    ///
24546    /// * *$.xgafv* (query-string) - V1 error format.
24547    /// * *access_token* (query-string) - OAuth access token.
24548    /// * *alt* (query-string) - Data format for response.
24549    /// * *callback* (query-string) - JSONP
24550    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24551    /// * *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.
24552    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24553    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24554    /// * *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.
24555    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24556    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24557    pub fn param<T>(
24558        mut self,
24559        name: T,
24560        value: T,
24561    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C>
24562    where
24563        T: AsRef<str>,
24564    {
24565        self._additional_params
24566            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24567        self
24568    }
24569
24570    /// Identifies the authorization scope for the method you are building.
24571    ///
24572    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24573    /// [`Scope::EditContainer`].
24574    ///
24575    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24576    /// tokens for more than one scope.
24577    ///
24578    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24579    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24580    /// sufficient, a read-write scope will do as well.
24581    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C>
24582    where
24583        St: AsRef<str>,
24584    {
24585        self._scopes.insert(String::from(scope.as_ref()));
24586        self
24587    }
24588    /// Identifies the authorization scope(s) for the method you are building.
24589    ///
24590    /// See [`Self::add_scope()`] for details.
24591    pub fn add_scopes<I, St>(
24592        mut self,
24593        scopes: I,
24594    ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C>
24595    where
24596        I: IntoIterator<Item = St>,
24597        St: AsRef<str>,
24598    {
24599        self._scopes
24600            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24601        self
24602    }
24603
24604    /// Removes all scopes, and no default scope will be used either.
24605    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24606    /// for details).
24607    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
24608        self._scopes.clear();
24609        self
24610    }
24611}
24612
24613/// Creates a GTM Variable.
24614///
24615/// A builder for the *containers.workspaces.variables.create* method supported by a *account* resource.
24616/// It is not used directly, but through a [`AccountMethods`] instance.
24617///
24618/// # Example
24619///
24620/// Instantiate a resource method builder
24621///
24622/// ```test_harness,no_run
24623/// # extern crate hyper;
24624/// # extern crate hyper_rustls;
24625/// # extern crate google_tagmanager2 as tagmanager2;
24626/// use tagmanager2::api::Variable;
24627/// # async fn dox() {
24628/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24629///
24630/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24631/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24632/// #     secret,
24633/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24634/// # ).build().await.unwrap();
24635///
24636/// # let client = hyper_util::client::legacy::Client::builder(
24637/// #     hyper_util::rt::TokioExecutor::new()
24638/// # )
24639/// # .build(
24640/// #     hyper_rustls::HttpsConnectorBuilder::new()
24641/// #         .with_native_roots()
24642/// #         .unwrap()
24643/// #         .https_or_http()
24644/// #         .enable_http1()
24645/// #         .build()
24646/// # );
24647/// # let mut hub = TagManager::new(client, auth);
24648/// // As the method needs a request, you would usually fill it with the desired information
24649/// // into the respective structure. Some of the parts shown here might not be applicable !
24650/// // Values shown here are possibly random and not representative !
24651/// let mut req = Variable::default();
24652///
24653/// // You can configure optional parameters by calling the respective setters at will, and
24654/// // execute the final call using `doit()`.
24655/// // Values shown here are possibly random and not representative !
24656/// let result = hub.accounts().containers_workspaces_variables_create(req, "parent")
24657///              .doit().await;
24658/// # }
24659/// ```
24660pub struct AccountContainerWorkspaceVariableCreateCall<'a, C>
24661where
24662    C: 'a,
24663{
24664    hub: &'a TagManager<C>,
24665    _request: Variable,
24666    _parent: String,
24667    _delegate: Option<&'a mut dyn common::Delegate>,
24668    _additional_params: HashMap<String, String>,
24669    _scopes: BTreeSet<String>,
24670}
24671
24672impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableCreateCall<'a, C> {}
24673
24674impl<'a, C> AccountContainerWorkspaceVariableCreateCall<'a, C>
24675where
24676    C: common::Connector,
24677{
24678    /// Perform the operation you have build so far.
24679    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
24680        use std::borrow::Cow;
24681        use std::io::{Read, Seek};
24682
24683        use common::{url::Params, ToParts};
24684        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24685
24686        let mut dd = common::DefaultDelegate;
24687        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24688        dlg.begin(common::MethodInfo {
24689            id: "tagmanager.accounts.containers.workspaces.variables.create",
24690            http_method: hyper::Method::POST,
24691        });
24692
24693        for &field in ["alt", "parent"].iter() {
24694            if self._additional_params.contains_key(field) {
24695                dlg.finished(false);
24696                return Err(common::Error::FieldClash(field));
24697            }
24698        }
24699
24700        let mut params = Params::with_capacity(4 + self._additional_params.len());
24701        params.push("parent", self._parent);
24702
24703        params.extend(self._additional_params.iter());
24704
24705        params.push("alt", "json");
24706        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/variables";
24707        if self._scopes.is_empty() {
24708            self._scopes
24709                .insert(Scope::EditContainer.as_ref().to_string());
24710        }
24711
24712        #[allow(clippy::single_element_loop)]
24713        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24714            url = params.uri_replacement(url, param_name, find_this, true);
24715        }
24716        {
24717            let to_remove = ["parent"];
24718            params.remove_params(&to_remove);
24719        }
24720
24721        let url = params.parse_with_url(&url);
24722
24723        let mut json_mime_type = mime::APPLICATION_JSON;
24724        let mut request_value_reader = {
24725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24726            common::remove_json_null_values(&mut value);
24727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24728            serde_json::to_writer(&mut dst, &value).unwrap();
24729            dst
24730        };
24731        let request_size = request_value_reader
24732            .seek(std::io::SeekFrom::End(0))
24733            .unwrap();
24734        request_value_reader
24735            .seek(std::io::SeekFrom::Start(0))
24736            .unwrap();
24737
24738        loop {
24739            let token = match self
24740                .hub
24741                .auth
24742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24743                .await
24744            {
24745                Ok(token) => token,
24746                Err(e) => match dlg.token(e) {
24747                    Ok(token) => token,
24748                    Err(e) => {
24749                        dlg.finished(false);
24750                        return Err(common::Error::MissingToken(e));
24751                    }
24752                },
24753            };
24754            request_value_reader
24755                .seek(std::io::SeekFrom::Start(0))
24756                .unwrap();
24757            let mut req_result = {
24758                let client = &self.hub.client;
24759                dlg.pre_request();
24760                let mut req_builder = hyper::Request::builder()
24761                    .method(hyper::Method::POST)
24762                    .uri(url.as_str())
24763                    .header(USER_AGENT, self.hub._user_agent.clone());
24764
24765                if let Some(token) = token.as_ref() {
24766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24767                }
24768
24769                let request = req_builder
24770                    .header(CONTENT_TYPE, json_mime_type.to_string())
24771                    .header(CONTENT_LENGTH, request_size as u64)
24772                    .body(common::to_body(
24773                        request_value_reader.get_ref().clone().into(),
24774                    ));
24775
24776                client.request(request.unwrap()).await
24777            };
24778
24779            match req_result {
24780                Err(err) => {
24781                    if let common::Retry::After(d) = dlg.http_error(&err) {
24782                        sleep(d).await;
24783                        continue;
24784                    }
24785                    dlg.finished(false);
24786                    return Err(common::Error::HttpError(err));
24787                }
24788                Ok(res) => {
24789                    let (mut parts, body) = res.into_parts();
24790                    let mut body = common::Body::new(body);
24791                    if !parts.status.is_success() {
24792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24793                        let error = serde_json::from_str(&common::to_string(&bytes));
24794                        let response = common::to_response(parts, bytes.into());
24795
24796                        if let common::Retry::After(d) =
24797                            dlg.http_failure(&response, error.as_ref().ok())
24798                        {
24799                            sleep(d).await;
24800                            continue;
24801                        }
24802
24803                        dlg.finished(false);
24804
24805                        return Err(match error {
24806                            Ok(value) => common::Error::BadRequest(value),
24807                            _ => common::Error::Failure(response),
24808                        });
24809                    }
24810                    let response = {
24811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24812                        let encoded = common::to_string(&bytes);
24813                        match serde_json::from_str(&encoded) {
24814                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24815                            Err(error) => {
24816                                dlg.response_json_decode_error(&encoded, &error);
24817                                return Err(common::Error::JsonDecodeError(
24818                                    encoded.to_string(),
24819                                    error,
24820                                ));
24821                            }
24822                        }
24823                    };
24824
24825                    dlg.finished(true);
24826                    return Ok(response);
24827                }
24828            }
24829        }
24830    }
24831
24832    ///
24833    /// Sets the *request* property to the given value.
24834    ///
24835    /// Even though the property as already been set when instantiating this call,
24836    /// we provide this method for API completeness.
24837    pub fn request(
24838        mut self,
24839        new_value: Variable,
24840    ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
24841        self._request = new_value;
24842        self
24843    }
24844    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
24845    ///
24846    /// Sets the *parent* path property to the given value.
24847    ///
24848    /// Even though the property as already been set when instantiating this call,
24849    /// we provide this method for API completeness.
24850    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
24851        self._parent = new_value.to_string();
24852        self
24853    }
24854    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24855    /// while executing the actual API request.
24856    ///
24857    /// ````text
24858    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24859    /// ````
24860    ///
24861    /// Sets the *delegate* property to the given value.
24862    pub fn delegate(
24863        mut self,
24864        new_value: &'a mut dyn common::Delegate,
24865    ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
24866        self._delegate = Some(new_value);
24867        self
24868    }
24869
24870    /// Set any additional parameter of the query string used in the request.
24871    /// It should be used to set parameters which are not yet available through their own
24872    /// setters.
24873    ///
24874    /// Please note that this method must not be used to set any of the known parameters
24875    /// which have their own setter method. If done anyway, the request will fail.
24876    ///
24877    /// # Additional Parameters
24878    ///
24879    /// * *$.xgafv* (query-string) - V1 error format.
24880    /// * *access_token* (query-string) - OAuth access token.
24881    /// * *alt* (query-string) - Data format for response.
24882    /// * *callback* (query-string) - JSONP
24883    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24884    /// * *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.
24885    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24886    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24887    /// * *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.
24888    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24889    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24890    pub fn param<T>(
24891        mut self,
24892        name: T,
24893        value: T,
24894    ) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
24895    where
24896        T: AsRef<str>,
24897    {
24898        self._additional_params
24899            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24900        self
24901    }
24902
24903    /// Identifies the authorization scope for the method you are building.
24904    ///
24905    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24906    /// [`Scope::EditContainer`].
24907    ///
24908    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24909    /// tokens for more than one scope.
24910    ///
24911    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24912    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24913    /// sufficient, a read-write scope will do as well.
24914    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
24915    where
24916        St: AsRef<str>,
24917    {
24918        self._scopes.insert(String::from(scope.as_ref()));
24919        self
24920    }
24921    /// Identifies the authorization scope(s) for the method you are building.
24922    ///
24923    /// See [`Self::add_scope()`] for details.
24924    pub fn add_scopes<I, St>(
24925        mut self,
24926        scopes: I,
24927    ) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
24928    where
24929        I: IntoIterator<Item = St>,
24930        St: AsRef<str>,
24931    {
24932        self._scopes
24933            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24934        self
24935    }
24936
24937    /// Removes all scopes, and no default scope will be used either.
24938    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24939    /// for details).
24940    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
24941        self._scopes.clear();
24942        self
24943    }
24944}
24945
24946/// Deletes a GTM Variable.
24947///
24948/// A builder for the *containers.workspaces.variables.delete* method supported by a *account* resource.
24949/// It is not used directly, but through a [`AccountMethods`] instance.
24950///
24951/// # Example
24952///
24953/// Instantiate a resource method builder
24954///
24955/// ```test_harness,no_run
24956/// # extern crate hyper;
24957/// # extern crate hyper_rustls;
24958/// # extern crate google_tagmanager2 as tagmanager2;
24959/// # async fn dox() {
24960/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24961///
24962/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24963/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24964/// #     secret,
24965/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24966/// # ).build().await.unwrap();
24967///
24968/// # let client = hyper_util::client::legacy::Client::builder(
24969/// #     hyper_util::rt::TokioExecutor::new()
24970/// # )
24971/// # .build(
24972/// #     hyper_rustls::HttpsConnectorBuilder::new()
24973/// #         .with_native_roots()
24974/// #         .unwrap()
24975/// #         .https_or_http()
24976/// #         .enable_http1()
24977/// #         .build()
24978/// # );
24979/// # let mut hub = TagManager::new(client, auth);
24980/// // You can configure optional parameters by calling the respective setters at will, and
24981/// // execute the final call using `doit()`.
24982/// // Values shown here are possibly random and not representative !
24983/// let result = hub.accounts().containers_workspaces_variables_delete("path")
24984///              .doit().await;
24985/// # }
24986/// ```
24987pub struct AccountContainerWorkspaceVariableDeleteCall<'a, C>
24988where
24989    C: 'a,
24990{
24991    hub: &'a TagManager<C>,
24992    _path: String,
24993    _delegate: Option<&'a mut dyn common::Delegate>,
24994    _additional_params: HashMap<String, String>,
24995    _scopes: BTreeSet<String>,
24996}
24997
24998impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableDeleteCall<'a, C> {}
24999
25000impl<'a, C> AccountContainerWorkspaceVariableDeleteCall<'a, C>
25001where
25002    C: common::Connector,
25003{
25004    /// Perform the operation you have build so far.
25005    pub async fn doit(mut self) -> common::Result<common::Response> {
25006        use std::borrow::Cow;
25007        use std::io::{Read, Seek};
25008
25009        use common::{url::Params, ToParts};
25010        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25011
25012        let mut dd = common::DefaultDelegate;
25013        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25014        dlg.begin(common::MethodInfo {
25015            id: "tagmanager.accounts.containers.workspaces.variables.delete",
25016            http_method: hyper::Method::DELETE,
25017        });
25018
25019        for &field in ["path"].iter() {
25020            if self._additional_params.contains_key(field) {
25021                dlg.finished(false);
25022                return Err(common::Error::FieldClash(field));
25023            }
25024        }
25025
25026        let mut params = Params::with_capacity(2 + self._additional_params.len());
25027        params.push("path", self._path);
25028
25029        params.extend(self._additional_params.iter());
25030
25031        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
25032        if self._scopes.is_empty() {
25033            self._scopes
25034                .insert(Scope::EditContainer.as_ref().to_string());
25035        }
25036
25037        #[allow(clippy::single_element_loop)]
25038        for &(find_this, param_name) in [("{+path}", "path")].iter() {
25039            url = params.uri_replacement(url, param_name, find_this, true);
25040        }
25041        {
25042            let to_remove = ["path"];
25043            params.remove_params(&to_remove);
25044        }
25045
25046        let url = params.parse_with_url(&url);
25047
25048        loop {
25049            let token = match self
25050                .hub
25051                .auth
25052                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25053                .await
25054            {
25055                Ok(token) => token,
25056                Err(e) => match dlg.token(e) {
25057                    Ok(token) => token,
25058                    Err(e) => {
25059                        dlg.finished(false);
25060                        return Err(common::Error::MissingToken(e));
25061                    }
25062                },
25063            };
25064            let mut req_result = {
25065                let client = &self.hub.client;
25066                dlg.pre_request();
25067                let mut req_builder = hyper::Request::builder()
25068                    .method(hyper::Method::DELETE)
25069                    .uri(url.as_str())
25070                    .header(USER_AGENT, self.hub._user_agent.clone());
25071
25072                if let Some(token) = token.as_ref() {
25073                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25074                }
25075
25076                let request = req_builder
25077                    .header(CONTENT_LENGTH, 0_u64)
25078                    .body(common::to_body::<String>(None));
25079
25080                client.request(request.unwrap()).await
25081            };
25082
25083            match req_result {
25084                Err(err) => {
25085                    if let common::Retry::After(d) = dlg.http_error(&err) {
25086                        sleep(d).await;
25087                        continue;
25088                    }
25089                    dlg.finished(false);
25090                    return Err(common::Error::HttpError(err));
25091                }
25092                Ok(res) => {
25093                    let (mut parts, body) = res.into_parts();
25094                    let mut body = common::Body::new(body);
25095                    if !parts.status.is_success() {
25096                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25097                        let error = serde_json::from_str(&common::to_string(&bytes));
25098                        let response = common::to_response(parts, bytes.into());
25099
25100                        if let common::Retry::After(d) =
25101                            dlg.http_failure(&response, error.as_ref().ok())
25102                        {
25103                            sleep(d).await;
25104                            continue;
25105                        }
25106
25107                        dlg.finished(false);
25108
25109                        return Err(match error {
25110                            Ok(value) => common::Error::BadRequest(value),
25111                            _ => common::Error::Failure(response),
25112                        });
25113                    }
25114                    let response = common::Response::from_parts(parts, body);
25115
25116                    dlg.finished(true);
25117                    return Ok(response);
25118                }
25119            }
25120        }
25121    }
25122
25123    /// GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
25124    ///
25125    /// Sets the *path* path property to the given value.
25126    ///
25127    /// Even though the property as already been set when instantiating this call,
25128    /// we provide this method for API completeness.
25129    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
25130        self._path = new_value.to_string();
25131        self
25132    }
25133    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25134    /// while executing the actual API request.
25135    ///
25136    /// ````text
25137    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25138    /// ````
25139    ///
25140    /// Sets the *delegate* property to the given value.
25141    pub fn delegate(
25142        mut self,
25143        new_value: &'a mut dyn common::Delegate,
25144    ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
25145        self._delegate = Some(new_value);
25146        self
25147    }
25148
25149    /// Set any additional parameter of the query string used in the request.
25150    /// It should be used to set parameters which are not yet available through their own
25151    /// setters.
25152    ///
25153    /// Please note that this method must not be used to set any of the known parameters
25154    /// which have their own setter method. If done anyway, the request will fail.
25155    ///
25156    /// # Additional Parameters
25157    ///
25158    /// * *$.xgafv* (query-string) - V1 error format.
25159    /// * *access_token* (query-string) - OAuth access token.
25160    /// * *alt* (query-string) - Data format for response.
25161    /// * *callback* (query-string) - JSONP
25162    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25163    /// * *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.
25164    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25165    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25166    /// * *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.
25167    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25168    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25169    pub fn param<T>(
25170        mut self,
25171        name: T,
25172        value: T,
25173    ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
25174    where
25175        T: AsRef<str>,
25176    {
25177        self._additional_params
25178            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25179        self
25180    }
25181
25182    /// Identifies the authorization scope for the method you are building.
25183    ///
25184    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25185    /// [`Scope::EditContainer`].
25186    ///
25187    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25188    /// tokens for more than one scope.
25189    ///
25190    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25191    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25192    /// sufficient, a read-write scope will do as well.
25193    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
25194    where
25195        St: AsRef<str>,
25196    {
25197        self._scopes.insert(String::from(scope.as_ref()));
25198        self
25199    }
25200    /// Identifies the authorization scope(s) for the method you are building.
25201    ///
25202    /// See [`Self::add_scope()`] for details.
25203    pub fn add_scopes<I, St>(
25204        mut self,
25205        scopes: I,
25206    ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
25207    where
25208        I: IntoIterator<Item = St>,
25209        St: AsRef<str>,
25210    {
25211        self._scopes
25212            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25213        self
25214    }
25215
25216    /// Removes all scopes, and no default scope will be used either.
25217    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25218    /// for details).
25219    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
25220        self._scopes.clear();
25221        self
25222    }
25223}
25224
25225/// Gets a GTM Variable.
25226///
25227/// A builder for the *containers.workspaces.variables.get* method supported by a *account* resource.
25228/// It is not used directly, but through a [`AccountMethods`] instance.
25229///
25230/// # Example
25231///
25232/// Instantiate a resource method builder
25233///
25234/// ```test_harness,no_run
25235/// # extern crate hyper;
25236/// # extern crate hyper_rustls;
25237/// # extern crate google_tagmanager2 as tagmanager2;
25238/// # async fn dox() {
25239/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25240///
25241/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25243/// #     secret,
25244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25245/// # ).build().await.unwrap();
25246///
25247/// # let client = hyper_util::client::legacy::Client::builder(
25248/// #     hyper_util::rt::TokioExecutor::new()
25249/// # )
25250/// # .build(
25251/// #     hyper_rustls::HttpsConnectorBuilder::new()
25252/// #         .with_native_roots()
25253/// #         .unwrap()
25254/// #         .https_or_http()
25255/// #         .enable_http1()
25256/// #         .build()
25257/// # );
25258/// # let mut hub = TagManager::new(client, auth);
25259/// // You can configure optional parameters by calling the respective setters at will, and
25260/// // execute the final call using `doit()`.
25261/// // Values shown here are possibly random and not representative !
25262/// let result = hub.accounts().containers_workspaces_variables_get("path")
25263///              .doit().await;
25264/// # }
25265/// ```
25266pub struct AccountContainerWorkspaceVariableGetCall<'a, C>
25267where
25268    C: 'a,
25269{
25270    hub: &'a TagManager<C>,
25271    _path: String,
25272    _delegate: Option<&'a mut dyn common::Delegate>,
25273    _additional_params: HashMap<String, String>,
25274    _scopes: BTreeSet<String>,
25275}
25276
25277impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableGetCall<'a, C> {}
25278
25279impl<'a, C> AccountContainerWorkspaceVariableGetCall<'a, C>
25280where
25281    C: common::Connector,
25282{
25283    /// Perform the operation you have build so far.
25284    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
25285        use std::borrow::Cow;
25286        use std::io::{Read, Seek};
25287
25288        use common::{url::Params, ToParts};
25289        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25290
25291        let mut dd = common::DefaultDelegate;
25292        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25293        dlg.begin(common::MethodInfo {
25294            id: "tagmanager.accounts.containers.workspaces.variables.get",
25295            http_method: hyper::Method::GET,
25296        });
25297
25298        for &field in ["alt", "path"].iter() {
25299            if self._additional_params.contains_key(field) {
25300                dlg.finished(false);
25301                return Err(common::Error::FieldClash(field));
25302            }
25303        }
25304
25305        let mut params = Params::with_capacity(3 + self._additional_params.len());
25306        params.push("path", self._path);
25307
25308        params.extend(self._additional_params.iter());
25309
25310        params.push("alt", "json");
25311        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
25312        if self._scopes.is_empty() {
25313            self._scopes.insert(Scope::Readonly.as_ref().to_string());
25314        }
25315
25316        #[allow(clippy::single_element_loop)]
25317        for &(find_this, param_name) in [("{+path}", "path")].iter() {
25318            url = params.uri_replacement(url, param_name, find_this, true);
25319        }
25320        {
25321            let to_remove = ["path"];
25322            params.remove_params(&to_remove);
25323        }
25324
25325        let url = params.parse_with_url(&url);
25326
25327        loop {
25328            let token = match self
25329                .hub
25330                .auth
25331                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25332                .await
25333            {
25334                Ok(token) => token,
25335                Err(e) => match dlg.token(e) {
25336                    Ok(token) => token,
25337                    Err(e) => {
25338                        dlg.finished(false);
25339                        return Err(common::Error::MissingToken(e));
25340                    }
25341                },
25342            };
25343            let mut req_result = {
25344                let client = &self.hub.client;
25345                dlg.pre_request();
25346                let mut req_builder = hyper::Request::builder()
25347                    .method(hyper::Method::GET)
25348                    .uri(url.as_str())
25349                    .header(USER_AGENT, self.hub._user_agent.clone());
25350
25351                if let Some(token) = token.as_ref() {
25352                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25353                }
25354
25355                let request = req_builder
25356                    .header(CONTENT_LENGTH, 0_u64)
25357                    .body(common::to_body::<String>(None));
25358
25359                client.request(request.unwrap()).await
25360            };
25361
25362            match req_result {
25363                Err(err) => {
25364                    if let common::Retry::After(d) = dlg.http_error(&err) {
25365                        sleep(d).await;
25366                        continue;
25367                    }
25368                    dlg.finished(false);
25369                    return Err(common::Error::HttpError(err));
25370                }
25371                Ok(res) => {
25372                    let (mut parts, body) = res.into_parts();
25373                    let mut body = common::Body::new(body);
25374                    if !parts.status.is_success() {
25375                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25376                        let error = serde_json::from_str(&common::to_string(&bytes));
25377                        let response = common::to_response(parts, bytes.into());
25378
25379                        if let common::Retry::After(d) =
25380                            dlg.http_failure(&response, error.as_ref().ok())
25381                        {
25382                            sleep(d).await;
25383                            continue;
25384                        }
25385
25386                        dlg.finished(false);
25387
25388                        return Err(match error {
25389                            Ok(value) => common::Error::BadRequest(value),
25390                            _ => common::Error::Failure(response),
25391                        });
25392                    }
25393                    let response = {
25394                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25395                        let encoded = common::to_string(&bytes);
25396                        match serde_json::from_str(&encoded) {
25397                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25398                            Err(error) => {
25399                                dlg.response_json_decode_error(&encoded, &error);
25400                                return Err(common::Error::JsonDecodeError(
25401                                    encoded.to_string(),
25402                                    error,
25403                                ));
25404                            }
25405                        }
25406                    };
25407
25408                    dlg.finished(true);
25409                    return Ok(response);
25410                }
25411            }
25412        }
25413    }
25414
25415    /// GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
25416    ///
25417    /// Sets the *path* path property to the given value.
25418    ///
25419    /// Even though the property as already been set when instantiating this call,
25420    /// we provide this method for API completeness.
25421    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
25422        self._path = new_value.to_string();
25423        self
25424    }
25425    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25426    /// while executing the actual API request.
25427    ///
25428    /// ````text
25429    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25430    /// ````
25431    ///
25432    /// Sets the *delegate* property to the given value.
25433    pub fn delegate(
25434        mut self,
25435        new_value: &'a mut dyn common::Delegate,
25436    ) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
25437        self._delegate = Some(new_value);
25438        self
25439    }
25440
25441    /// Set any additional parameter of the query string used in the request.
25442    /// It should be used to set parameters which are not yet available through their own
25443    /// setters.
25444    ///
25445    /// Please note that this method must not be used to set any of the known parameters
25446    /// which have their own setter method. If done anyway, the request will fail.
25447    ///
25448    /// # Additional Parameters
25449    ///
25450    /// * *$.xgafv* (query-string) - V1 error format.
25451    /// * *access_token* (query-string) - OAuth access token.
25452    /// * *alt* (query-string) - Data format for response.
25453    /// * *callback* (query-string) - JSONP
25454    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25455    /// * *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.
25456    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25457    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25458    /// * *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.
25459    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25460    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25461    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceVariableGetCall<'a, C>
25462    where
25463        T: AsRef<str>,
25464    {
25465        self._additional_params
25466            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25467        self
25468    }
25469
25470    /// Identifies the authorization scope for the method you are building.
25471    ///
25472    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25473    /// [`Scope::Readonly`].
25474    ///
25475    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25476    /// tokens for more than one scope.
25477    ///
25478    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25479    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25480    /// sufficient, a read-write scope will do as well.
25481    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableGetCall<'a, C>
25482    where
25483        St: AsRef<str>,
25484    {
25485        self._scopes.insert(String::from(scope.as_ref()));
25486        self
25487    }
25488    /// Identifies the authorization scope(s) for the method you are building.
25489    ///
25490    /// See [`Self::add_scope()`] for details.
25491    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceVariableGetCall<'a, C>
25492    where
25493        I: IntoIterator<Item = St>,
25494        St: AsRef<str>,
25495    {
25496        self._scopes
25497            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25498        self
25499    }
25500
25501    /// Removes all scopes, and no default scope will be used either.
25502    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25503    /// for details).
25504    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
25505        self._scopes.clear();
25506        self
25507    }
25508}
25509
25510/// Lists all GTM Variables of a Container.
25511///
25512/// A builder for the *containers.workspaces.variables.list* method supported by a *account* resource.
25513/// It is not used directly, but through a [`AccountMethods`] instance.
25514///
25515/// # Example
25516///
25517/// Instantiate a resource method builder
25518///
25519/// ```test_harness,no_run
25520/// # extern crate hyper;
25521/// # extern crate hyper_rustls;
25522/// # extern crate google_tagmanager2 as tagmanager2;
25523/// # async fn dox() {
25524/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25525///
25526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25528/// #     secret,
25529/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25530/// # ).build().await.unwrap();
25531///
25532/// # let client = hyper_util::client::legacy::Client::builder(
25533/// #     hyper_util::rt::TokioExecutor::new()
25534/// # )
25535/// # .build(
25536/// #     hyper_rustls::HttpsConnectorBuilder::new()
25537/// #         .with_native_roots()
25538/// #         .unwrap()
25539/// #         .https_or_http()
25540/// #         .enable_http1()
25541/// #         .build()
25542/// # );
25543/// # let mut hub = TagManager::new(client, auth);
25544/// // You can configure optional parameters by calling the respective setters at will, and
25545/// // execute the final call using `doit()`.
25546/// // Values shown here are possibly random and not representative !
25547/// let result = hub.accounts().containers_workspaces_variables_list("parent")
25548///              .page_token("Stet")
25549///              .doit().await;
25550/// # }
25551/// ```
25552pub struct AccountContainerWorkspaceVariableListCall<'a, C>
25553where
25554    C: 'a,
25555{
25556    hub: &'a TagManager<C>,
25557    _parent: String,
25558    _page_token: Option<String>,
25559    _delegate: Option<&'a mut dyn common::Delegate>,
25560    _additional_params: HashMap<String, String>,
25561    _scopes: BTreeSet<String>,
25562}
25563
25564impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableListCall<'a, C> {}
25565
25566impl<'a, C> AccountContainerWorkspaceVariableListCall<'a, C>
25567where
25568    C: common::Connector,
25569{
25570    /// Perform the operation you have build so far.
25571    pub async fn doit(mut self) -> common::Result<(common::Response, ListVariablesResponse)> {
25572        use std::borrow::Cow;
25573        use std::io::{Read, Seek};
25574
25575        use common::{url::Params, ToParts};
25576        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25577
25578        let mut dd = common::DefaultDelegate;
25579        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25580        dlg.begin(common::MethodInfo {
25581            id: "tagmanager.accounts.containers.workspaces.variables.list",
25582            http_method: hyper::Method::GET,
25583        });
25584
25585        for &field in ["alt", "parent", "pageToken"].iter() {
25586            if self._additional_params.contains_key(field) {
25587                dlg.finished(false);
25588                return Err(common::Error::FieldClash(field));
25589            }
25590        }
25591
25592        let mut params = Params::with_capacity(4 + self._additional_params.len());
25593        params.push("parent", self._parent);
25594        if let Some(value) = self._page_token.as_ref() {
25595            params.push("pageToken", value);
25596        }
25597
25598        params.extend(self._additional_params.iter());
25599
25600        params.push("alt", "json");
25601        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/variables";
25602        if self._scopes.is_empty() {
25603            self._scopes.insert(Scope::Readonly.as_ref().to_string());
25604        }
25605
25606        #[allow(clippy::single_element_loop)]
25607        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25608            url = params.uri_replacement(url, param_name, find_this, true);
25609        }
25610        {
25611            let to_remove = ["parent"];
25612            params.remove_params(&to_remove);
25613        }
25614
25615        let url = params.parse_with_url(&url);
25616
25617        loop {
25618            let token = match self
25619                .hub
25620                .auth
25621                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25622                .await
25623            {
25624                Ok(token) => token,
25625                Err(e) => match dlg.token(e) {
25626                    Ok(token) => token,
25627                    Err(e) => {
25628                        dlg.finished(false);
25629                        return Err(common::Error::MissingToken(e));
25630                    }
25631                },
25632            };
25633            let mut req_result = {
25634                let client = &self.hub.client;
25635                dlg.pre_request();
25636                let mut req_builder = hyper::Request::builder()
25637                    .method(hyper::Method::GET)
25638                    .uri(url.as_str())
25639                    .header(USER_AGENT, self.hub._user_agent.clone());
25640
25641                if let Some(token) = token.as_ref() {
25642                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25643                }
25644
25645                let request = req_builder
25646                    .header(CONTENT_LENGTH, 0_u64)
25647                    .body(common::to_body::<String>(None));
25648
25649                client.request(request.unwrap()).await
25650            };
25651
25652            match req_result {
25653                Err(err) => {
25654                    if let common::Retry::After(d) = dlg.http_error(&err) {
25655                        sleep(d).await;
25656                        continue;
25657                    }
25658                    dlg.finished(false);
25659                    return Err(common::Error::HttpError(err));
25660                }
25661                Ok(res) => {
25662                    let (mut parts, body) = res.into_parts();
25663                    let mut body = common::Body::new(body);
25664                    if !parts.status.is_success() {
25665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25666                        let error = serde_json::from_str(&common::to_string(&bytes));
25667                        let response = common::to_response(parts, bytes.into());
25668
25669                        if let common::Retry::After(d) =
25670                            dlg.http_failure(&response, error.as_ref().ok())
25671                        {
25672                            sleep(d).await;
25673                            continue;
25674                        }
25675
25676                        dlg.finished(false);
25677
25678                        return Err(match error {
25679                            Ok(value) => common::Error::BadRequest(value),
25680                            _ => common::Error::Failure(response),
25681                        });
25682                    }
25683                    let response = {
25684                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25685                        let encoded = common::to_string(&bytes);
25686                        match serde_json::from_str(&encoded) {
25687                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25688                            Err(error) => {
25689                                dlg.response_json_decode_error(&encoded, &error);
25690                                return Err(common::Error::JsonDecodeError(
25691                                    encoded.to_string(),
25692                                    error,
25693                                ));
25694                            }
25695                        }
25696                    };
25697
25698                    dlg.finished(true);
25699                    return Ok(response);
25700                }
25701            }
25702        }
25703    }
25704
25705    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
25706    ///
25707    /// Sets the *parent* path property to the given value.
25708    ///
25709    /// Even though the property as already been set when instantiating this call,
25710    /// we provide this method for API completeness.
25711    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceVariableListCall<'a, C> {
25712        self._parent = new_value.to_string();
25713        self
25714    }
25715    /// Continuation token for fetching the next page of results.
25716    ///
25717    /// Sets the *page token* query property to the given value.
25718    pub fn page_token(
25719        mut self,
25720        new_value: &str,
25721    ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
25722        self._page_token = Some(new_value.to_string());
25723        self
25724    }
25725    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25726    /// while executing the actual API request.
25727    ///
25728    /// ````text
25729    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25730    /// ````
25731    ///
25732    /// Sets the *delegate* property to the given value.
25733    pub fn delegate(
25734        mut self,
25735        new_value: &'a mut dyn common::Delegate,
25736    ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
25737        self._delegate = Some(new_value);
25738        self
25739    }
25740
25741    /// Set any additional parameter of the query string used in the request.
25742    /// It should be used to set parameters which are not yet available through their own
25743    /// setters.
25744    ///
25745    /// Please note that this method must not be used to set any of the known parameters
25746    /// which have their own setter method. If done anyway, the request will fail.
25747    ///
25748    /// # Additional Parameters
25749    ///
25750    /// * *$.xgafv* (query-string) - V1 error format.
25751    /// * *access_token* (query-string) - OAuth access token.
25752    /// * *alt* (query-string) - Data format for response.
25753    /// * *callback* (query-string) - JSONP
25754    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25755    /// * *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.
25756    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25757    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25758    /// * *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.
25759    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25760    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25761    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceVariableListCall<'a, C>
25762    where
25763        T: AsRef<str>,
25764    {
25765        self._additional_params
25766            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25767        self
25768    }
25769
25770    /// Identifies the authorization scope for the method you are building.
25771    ///
25772    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25773    /// [`Scope::Readonly`].
25774    ///
25775    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25776    /// tokens for more than one scope.
25777    ///
25778    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25779    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25780    /// sufficient, a read-write scope will do as well.
25781    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableListCall<'a, C>
25782    where
25783        St: AsRef<str>,
25784    {
25785        self._scopes.insert(String::from(scope.as_ref()));
25786        self
25787    }
25788    /// Identifies the authorization scope(s) for the method you are building.
25789    ///
25790    /// See [`Self::add_scope()`] for details.
25791    pub fn add_scopes<I, St>(
25792        mut self,
25793        scopes: I,
25794    ) -> AccountContainerWorkspaceVariableListCall<'a, C>
25795    where
25796        I: IntoIterator<Item = St>,
25797        St: AsRef<str>,
25798    {
25799        self._scopes
25800            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25801        self
25802    }
25803
25804    /// Removes all scopes, and no default scope will be used either.
25805    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25806    /// for details).
25807    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableListCall<'a, C> {
25808        self._scopes.clear();
25809        self
25810    }
25811}
25812
25813/// Reverts changes to a GTM Variable in a GTM Workspace.
25814///
25815/// A builder for the *containers.workspaces.variables.revert* method supported by a *account* resource.
25816/// It is not used directly, but through a [`AccountMethods`] instance.
25817///
25818/// # Example
25819///
25820/// Instantiate a resource method builder
25821///
25822/// ```test_harness,no_run
25823/// # extern crate hyper;
25824/// # extern crate hyper_rustls;
25825/// # extern crate google_tagmanager2 as tagmanager2;
25826/// # async fn dox() {
25827/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25828///
25829/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25831/// #     secret,
25832/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25833/// # ).build().await.unwrap();
25834///
25835/// # let client = hyper_util::client::legacy::Client::builder(
25836/// #     hyper_util::rt::TokioExecutor::new()
25837/// # )
25838/// # .build(
25839/// #     hyper_rustls::HttpsConnectorBuilder::new()
25840/// #         .with_native_roots()
25841/// #         .unwrap()
25842/// #         .https_or_http()
25843/// #         .enable_http1()
25844/// #         .build()
25845/// # );
25846/// # let mut hub = TagManager::new(client, auth);
25847/// // You can configure optional parameters by calling the respective setters at will, and
25848/// // execute the final call using `doit()`.
25849/// // Values shown here are possibly random and not representative !
25850/// let result = hub.accounts().containers_workspaces_variables_revert("path")
25851///              .fingerprint("aliquyam")
25852///              .doit().await;
25853/// # }
25854/// ```
25855pub struct AccountContainerWorkspaceVariableRevertCall<'a, C>
25856where
25857    C: 'a,
25858{
25859    hub: &'a TagManager<C>,
25860    _path: String,
25861    _fingerprint: Option<String>,
25862    _delegate: Option<&'a mut dyn common::Delegate>,
25863    _additional_params: HashMap<String, String>,
25864    _scopes: BTreeSet<String>,
25865}
25866
25867impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableRevertCall<'a, C> {}
25868
25869impl<'a, C> AccountContainerWorkspaceVariableRevertCall<'a, C>
25870where
25871    C: common::Connector,
25872{
25873    /// Perform the operation you have build so far.
25874    pub async fn doit(mut self) -> common::Result<(common::Response, RevertVariableResponse)> {
25875        use std::borrow::Cow;
25876        use std::io::{Read, Seek};
25877
25878        use common::{url::Params, ToParts};
25879        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25880
25881        let mut dd = common::DefaultDelegate;
25882        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25883        dlg.begin(common::MethodInfo {
25884            id: "tagmanager.accounts.containers.workspaces.variables.revert",
25885            http_method: hyper::Method::POST,
25886        });
25887
25888        for &field in ["alt", "path", "fingerprint"].iter() {
25889            if self._additional_params.contains_key(field) {
25890                dlg.finished(false);
25891                return Err(common::Error::FieldClash(field));
25892            }
25893        }
25894
25895        let mut params = Params::with_capacity(4 + self._additional_params.len());
25896        params.push("path", self._path);
25897        if let Some(value) = self._fingerprint.as_ref() {
25898            params.push("fingerprint", value);
25899        }
25900
25901        params.extend(self._additional_params.iter());
25902
25903        params.push("alt", "json");
25904        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
25905        if self._scopes.is_empty() {
25906            self._scopes
25907                .insert(Scope::EditContainer.as_ref().to_string());
25908        }
25909
25910        #[allow(clippy::single_element_loop)]
25911        for &(find_this, param_name) in [("{+path}", "path")].iter() {
25912            url = params.uri_replacement(url, param_name, find_this, true);
25913        }
25914        {
25915            let to_remove = ["path"];
25916            params.remove_params(&to_remove);
25917        }
25918
25919        let url = params.parse_with_url(&url);
25920
25921        loop {
25922            let token = match self
25923                .hub
25924                .auth
25925                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25926                .await
25927            {
25928                Ok(token) => token,
25929                Err(e) => match dlg.token(e) {
25930                    Ok(token) => token,
25931                    Err(e) => {
25932                        dlg.finished(false);
25933                        return Err(common::Error::MissingToken(e));
25934                    }
25935                },
25936            };
25937            let mut req_result = {
25938                let client = &self.hub.client;
25939                dlg.pre_request();
25940                let mut req_builder = hyper::Request::builder()
25941                    .method(hyper::Method::POST)
25942                    .uri(url.as_str())
25943                    .header(USER_AGENT, self.hub._user_agent.clone());
25944
25945                if let Some(token) = token.as_ref() {
25946                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25947                }
25948
25949                let request = req_builder
25950                    .header(CONTENT_LENGTH, 0_u64)
25951                    .body(common::to_body::<String>(None));
25952
25953                client.request(request.unwrap()).await
25954            };
25955
25956            match req_result {
25957                Err(err) => {
25958                    if let common::Retry::After(d) = dlg.http_error(&err) {
25959                        sleep(d).await;
25960                        continue;
25961                    }
25962                    dlg.finished(false);
25963                    return Err(common::Error::HttpError(err));
25964                }
25965                Ok(res) => {
25966                    let (mut parts, body) = res.into_parts();
25967                    let mut body = common::Body::new(body);
25968                    if !parts.status.is_success() {
25969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25970                        let error = serde_json::from_str(&common::to_string(&bytes));
25971                        let response = common::to_response(parts, bytes.into());
25972
25973                        if let common::Retry::After(d) =
25974                            dlg.http_failure(&response, error.as_ref().ok())
25975                        {
25976                            sleep(d).await;
25977                            continue;
25978                        }
25979
25980                        dlg.finished(false);
25981
25982                        return Err(match error {
25983                            Ok(value) => common::Error::BadRequest(value),
25984                            _ => common::Error::Failure(response),
25985                        });
25986                    }
25987                    let response = {
25988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25989                        let encoded = common::to_string(&bytes);
25990                        match serde_json::from_str(&encoded) {
25991                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25992                            Err(error) => {
25993                                dlg.response_json_decode_error(&encoded, &error);
25994                                return Err(common::Error::JsonDecodeError(
25995                                    encoded.to_string(),
25996                                    error,
25997                                ));
25998                            }
25999                        }
26000                    };
26001
26002                    dlg.finished(true);
26003                    return Ok(response);
26004                }
26005            }
26006        }
26007    }
26008
26009    /// GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
26010    ///
26011    /// Sets the *path* path property to the given value.
26012    ///
26013    /// Even though the property as already been set when instantiating this call,
26014    /// we provide this method for API completeness.
26015    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
26016        self._path = new_value.to_string();
26017        self
26018    }
26019    /// When provided, this fingerprint must match the fingerprint of the variable in storage.
26020    ///
26021    /// Sets the *fingerprint* query property to the given value.
26022    pub fn fingerprint(
26023        mut self,
26024        new_value: &str,
26025    ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
26026        self._fingerprint = Some(new_value.to_string());
26027        self
26028    }
26029    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26030    /// while executing the actual API request.
26031    ///
26032    /// ````text
26033    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26034    /// ````
26035    ///
26036    /// Sets the *delegate* property to the given value.
26037    pub fn delegate(
26038        mut self,
26039        new_value: &'a mut dyn common::Delegate,
26040    ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
26041        self._delegate = Some(new_value);
26042        self
26043    }
26044
26045    /// Set any additional parameter of the query string used in the request.
26046    /// It should be used to set parameters which are not yet available through their own
26047    /// setters.
26048    ///
26049    /// Please note that this method must not be used to set any of the known parameters
26050    /// which have their own setter method. If done anyway, the request will fail.
26051    ///
26052    /// # Additional Parameters
26053    ///
26054    /// * *$.xgafv* (query-string) - V1 error format.
26055    /// * *access_token* (query-string) - OAuth access token.
26056    /// * *alt* (query-string) - Data format for response.
26057    /// * *callback* (query-string) - JSONP
26058    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26059    /// * *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.
26060    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26061    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26062    /// * *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.
26063    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26064    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26065    pub fn param<T>(
26066        mut self,
26067        name: T,
26068        value: T,
26069    ) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
26070    where
26071        T: AsRef<str>,
26072    {
26073        self._additional_params
26074            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26075        self
26076    }
26077
26078    /// Identifies the authorization scope for the method you are building.
26079    ///
26080    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26081    /// [`Scope::EditContainer`].
26082    ///
26083    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26084    /// tokens for more than one scope.
26085    ///
26086    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26087    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26088    /// sufficient, a read-write scope will do as well.
26089    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
26090    where
26091        St: AsRef<str>,
26092    {
26093        self._scopes.insert(String::from(scope.as_ref()));
26094        self
26095    }
26096    /// Identifies the authorization scope(s) for the method you are building.
26097    ///
26098    /// See [`Self::add_scope()`] for details.
26099    pub fn add_scopes<I, St>(
26100        mut self,
26101        scopes: I,
26102    ) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
26103    where
26104        I: IntoIterator<Item = St>,
26105        St: AsRef<str>,
26106    {
26107        self._scopes
26108            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26109        self
26110    }
26111
26112    /// Removes all scopes, and no default scope will be used either.
26113    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26114    /// for details).
26115    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
26116        self._scopes.clear();
26117        self
26118    }
26119}
26120
26121/// Updates a GTM Variable.
26122///
26123/// A builder for the *containers.workspaces.variables.update* method supported by a *account* resource.
26124/// It is not used directly, but through a [`AccountMethods`] instance.
26125///
26126/// # Example
26127///
26128/// Instantiate a resource method builder
26129///
26130/// ```test_harness,no_run
26131/// # extern crate hyper;
26132/// # extern crate hyper_rustls;
26133/// # extern crate google_tagmanager2 as tagmanager2;
26134/// use tagmanager2::api::Variable;
26135/// # async fn dox() {
26136/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26137///
26138/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26139/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26140/// #     secret,
26141/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26142/// # ).build().await.unwrap();
26143///
26144/// # let client = hyper_util::client::legacy::Client::builder(
26145/// #     hyper_util::rt::TokioExecutor::new()
26146/// # )
26147/// # .build(
26148/// #     hyper_rustls::HttpsConnectorBuilder::new()
26149/// #         .with_native_roots()
26150/// #         .unwrap()
26151/// #         .https_or_http()
26152/// #         .enable_http1()
26153/// #         .build()
26154/// # );
26155/// # let mut hub = TagManager::new(client, auth);
26156/// // As the method needs a request, you would usually fill it with the desired information
26157/// // into the respective structure. Some of the parts shown here might not be applicable !
26158/// // Values shown here are possibly random and not representative !
26159/// let mut req = Variable::default();
26160///
26161/// // You can configure optional parameters by calling the respective setters at will, and
26162/// // execute the final call using `doit()`.
26163/// // Values shown here are possibly random and not representative !
26164/// let result = hub.accounts().containers_workspaces_variables_update(req, "path")
26165///              .fingerprint("duo")
26166///              .doit().await;
26167/// # }
26168/// ```
26169pub struct AccountContainerWorkspaceVariableUpdateCall<'a, C>
26170where
26171    C: 'a,
26172{
26173    hub: &'a TagManager<C>,
26174    _request: Variable,
26175    _path: String,
26176    _fingerprint: Option<String>,
26177    _delegate: Option<&'a mut dyn common::Delegate>,
26178    _additional_params: HashMap<String, String>,
26179    _scopes: BTreeSet<String>,
26180}
26181
26182impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableUpdateCall<'a, C> {}
26183
26184impl<'a, C> AccountContainerWorkspaceVariableUpdateCall<'a, C>
26185where
26186    C: common::Connector,
26187{
26188    /// Perform the operation you have build so far.
26189    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
26190        use std::borrow::Cow;
26191        use std::io::{Read, Seek};
26192
26193        use common::{url::Params, ToParts};
26194        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26195
26196        let mut dd = common::DefaultDelegate;
26197        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26198        dlg.begin(common::MethodInfo {
26199            id: "tagmanager.accounts.containers.workspaces.variables.update",
26200            http_method: hyper::Method::PUT,
26201        });
26202
26203        for &field in ["alt", "path", "fingerprint"].iter() {
26204            if self._additional_params.contains_key(field) {
26205                dlg.finished(false);
26206                return Err(common::Error::FieldClash(field));
26207            }
26208        }
26209
26210        let mut params = Params::with_capacity(5 + self._additional_params.len());
26211        params.push("path", self._path);
26212        if let Some(value) = self._fingerprint.as_ref() {
26213            params.push("fingerprint", value);
26214        }
26215
26216        params.extend(self._additional_params.iter());
26217
26218        params.push("alt", "json");
26219        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
26220        if self._scopes.is_empty() {
26221            self._scopes
26222                .insert(Scope::EditContainer.as_ref().to_string());
26223        }
26224
26225        #[allow(clippy::single_element_loop)]
26226        for &(find_this, param_name) in [("{+path}", "path")].iter() {
26227            url = params.uri_replacement(url, param_name, find_this, true);
26228        }
26229        {
26230            let to_remove = ["path"];
26231            params.remove_params(&to_remove);
26232        }
26233
26234        let url = params.parse_with_url(&url);
26235
26236        let mut json_mime_type = mime::APPLICATION_JSON;
26237        let mut request_value_reader = {
26238            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26239            common::remove_json_null_values(&mut value);
26240            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26241            serde_json::to_writer(&mut dst, &value).unwrap();
26242            dst
26243        };
26244        let request_size = request_value_reader
26245            .seek(std::io::SeekFrom::End(0))
26246            .unwrap();
26247        request_value_reader
26248            .seek(std::io::SeekFrom::Start(0))
26249            .unwrap();
26250
26251        loop {
26252            let token = match self
26253                .hub
26254                .auth
26255                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26256                .await
26257            {
26258                Ok(token) => token,
26259                Err(e) => match dlg.token(e) {
26260                    Ok(token) => token,
26261                    Err(e) => {
26262                        dlg.finished(false);
26263                        return Err(common::Error::MissingToken(e));
26264                    }
26265                },
26266            };
26267            request_value_reader
26268                .seek(std::io::SeekFrom::Start(0))
26269                .unwrap();
26270            let mut req_result = {
26271                let client = &self.hub.client;
26272                dlg.pre_request();
26273                let mut req_builder = hyper::Request::builder()
26274                    .method(hyper::Method::PUT)
26275                    .uri(url.as_str())
26276                    .header(USER_AGENT, self.hub._user_agent.clone());
26277
26278                if let Some(token) = token.as_ref() {
26279                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26280                }
26281
26282                let request = req_builder
26283                    .header(CONTENT_TYPE, json_mime_type.to_string())
26284                    .header(CONTENT_LENGTH, request_size as u64)
26285                    .body(common::to_body(
26286                        request_value_reader.get_ref().clone().into(),
26287                    ));
26288
26289                client.request(request.unwrap()).await
26290            };
26291
26292            match req_result {
26293                Err(err) => {
26294                    if let common::Retry::After(d) = dlg.http_error(&err) {
26295                        sleep(d).await;
26296                        continue;
26297                    }
26298                    dlg.finished(false);
26299                    return Err(common::Error::HttpError(err));
26300                }
26301                Ok(res) => {
26302                    let (mut parts, body) = res.into_parts();
26303                    let mut body = common::Body::new(body);
26304                    if !parts.status.is_success() {
26305                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26306                        let error = serde_json::from_str(&common::to_string(&bytes));
26307                        let response = common::to_response(parts, bytes.into());
26308
26309                        if let common::Retry::After(d) =
26310                            dlg.http_failure(&response, error.as_ref().ok())
26311                        {
26312                            sleep(d).await;
26313                            continue;
26314                        }
26315
26316                        dlg.finished(false);
26317
26318                        return Err(match error {
26319                            Ok(value) => common::Error::BadRequest(value),
26320                            _ => common::Error::Failure(response),
26321                        });
26322                    }
26323                    let response = {
26324                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26325                        let encoded = common::to_string(&bytes);
26326                        match serde_json::from_str(&encoded) {
26327                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26328                            Err(error) => {
26329                                dlg.response_json_decode_error(&encoded, &error);
26330                                return Err(common::Error::JsonDecodeError(
26331                                    encoded.to_string(),
26332                                    error,
26333                                ));
26334                            }
26335                        }
26336                    };
26337
26338                    dlg.finished(true);
26339                    return Ok(response);
26340                }
26341            }
26342        }
26343    }
26344
26345    ///
26346    /// Sets the *request* property to the given value.
26347    ///
26348    /// Even though the property as already been set when instantiating this call,
26349    /// we provide this method for API completeness.
26350    pub fn request(
26351        mut self,
26352        new_value: Variable,
26353    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
26354        self._request = new_value;
26355        self
26356    }
26357    /// GTM Variable's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/variables/{variable_id}
26358    ///
26359    /// Sets the *path* path property to the given value.
26360    ///
26361    /// Even though the property as already been set when instantiating this call,
26362    /// we provide this method for API completeness.
26363    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
26364        self._path = new_value.to_string();
26365        self
26366    }
26367    /// When provided, this fingerprint must match the fingerprint of the variable in storage.
26368    ///
26369    /// Sets the *fingerprint* query property to the given value.
26370    pub fn fingerprint(
26371        mut self,
26372        new_value: &str,
26373    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
26374        self._fingerprint = Some(new_value.to_string());
26375        self
26376    }
26377    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26378    /// while executing the actual API request.
26379    ///
26380    /// ````text
26381    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26382    /// ````
26383    ///
26384    /// Sets the *delegate* property to the given value.
26385    pub fn delegate(
26386        mut self,
26387        new_value: &'a mut dyn common::Delegate,
26388    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
26389        self._delegate = Some(new_value);
26390        self
26391    }
26392
26393    /// Set any additional parameter of the query string used in the request.
26394    /// It should be used to set parameters which are not yet available through their own
26395    /// setters.
26396    ///
26397    /// Please note that this method must not be used to set any of the known parameters
26398    /// which have their own setter method. If done anyway, the request will fail.
26399    ///
26400    /// # Additional Parameters
26401    ///
26402    /// * *$.xgafv* (query-string) - V1 error format.
26403    /// * *access_token* (query-string) - OAuth access token.
26404    /// * *alt* (query-string) - Data format for response.
26405    /// * *callback* (query-string) - JSONP
26406    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26407    /// * *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.
26408    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26409    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26410    /// * *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.
26411    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26412    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26413    pub fn param<T>(
26414        mut self,
26415        name: T,
26416        value: T,
26417    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
26418    where
26419        T: AsRef<str>,
26420    {
26421        self._additional_params
26422            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26423        self
26424    }
26425
26426    /// Identifies the authorization scope for the method you are building.
26427    ///
26428    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26429    /// [`Scope::EditContainer`].
26430    ///
26431    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26432    /// tokens for more than one scope.
26433    ///
26434    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26435    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26436    /// sufficient, a read-write scope will do as well.
26437    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
26438    where
26439        St: AsRef<str>,
26440    {
26441        self._scopes.insert(String::from(scope.as_ref()));
26442        self
26443    }
26444    /// Identifies the authorization scope(s) for the method you are building.
26445    ///
26446    /// See [`Self::add_scope()`] for details.
26447    pub fn add_scopes<I, St>(
26448        mut self,
26449        scopes: I,
26450    ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
26451    where
26452        I: IntoIterator<Item = St>,
26453        St: AsRef<str>,
26454    {
26455        self._scopes
26456            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26457        self
26458    }
26459
26460    /// Removes all scopes, and no default scope will be used either.
26461    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26462    /// for details).
26463    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
26464        self._scopes.clear();
26465        self
26466    }
26467}
26468
26469/// Creates a GTM Zone.
26470///
26471/// A builder for the *containers.workspaces.zones.create* method supported by a *account* resource.
26472/// It is not used directly, but through a [`AccountMethods`] instance.
26473///
26474/// # Example
26475///
26476/// Instantiate a resource method builder
26477///
26478/// ```test_harness,no_run
26479/// # extern crate hyper;
26480/// # extern crate hyper_rustls;
26481/// # extern crate google_tagmanager2 as tagmanager2;
26482/// use tagmanager2::api::Zone;
26483/// # async fn dox() {
26484/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26485///
26486/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26487/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26488/// #     secret,
26489/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26490/// # ).build().await.unwrap();
26491///
26492/// # let client = hyper_util::client::legacy::Client::builder(
26493/// #     hyper_util::rt::TokioExecutor::new()
26494/// # )
26495/// # .build(
26496/// #     hyper_rustls::HttpsConnectorBuilder::new()
26497/// #         .with_native_roots()
26498/// #         .unwrap()
26499/// #         .https_or_http()
26500/// #         .enable_http1()
26501/// #         .build()
26502/// # );
26503/// # let mut hub = TagManager::new(client, auth);
26504/// // As the method needs a request, you would usually fill it with the desired information
26505/// // into the respective structure. Some of the parts shown here might not be applicable !
26506/// // Values shown here are possibly random and not representative !
26507/// let mut req = Zone::default();
26508///
26509/// // You can configure optional parameters by calling the respective setters at will, and
26510/// // execute the final call using `doit()`.
26511/// // Values shown here are possibly random and not representative !
26512/// let result = hub.accounts().containers_workspaces_zones_create(req, "parent")
26513///              .doit().await;
26514/// # }
26515/// ```
26516pub struct AccountContainerWorkspaceZoneCreateCall<'a, C>
26517where
26518    C: 'a,
26519{
26520    hub: &'a TagManager<C>,
26521    _request: Zone,
26522    _parent: String,
26523    _delegate: Option<&'a mut dyn common::Delegate>,
26524    _additional_params: HashMap<String, String>,
26525    _scopes: BTreeSet<String>,
26526}
26527
26528impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneCreateCall<'a, C> {}
26529
26530impl<'a, C> AccountContainerWorkspaceZoneCreateCall<'a, C>
26531where
26532    C: common::Connector,
26533{
26534    /// Perform the operation you have build so far.
26535    pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
26536        use std::borrow::Cow;
26537        use std::io::{Read, Seek};
26538
26539        use common::{url::Params, ToParts};
26540        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26541
26542        let mut dd = common::DefaultDelegate;
26543        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26544        dlg.begin(common::MethodInfo {
26545            id: "tagmanager.accounts.containers.workspaces.zones.create",
26546            http_method: hyper::Method::POST,
26547        });
26548
26549        for &field in ["alt", "parent"].iter() {
26550            if self._additional_params.contains_key(field) {
26551                dlg.finished(false);
26552                return Err(common::Error::FieldClash(field));
26553            }
26554        }
26555
26556        let mut params = Params::with_capacity(4 + self._additional_params.len());
26557        params.push("parent", self._parent);
26558
26559        params.extend(self._additional_params.iter());
26560
26561        params.push("alt", "json");
26562        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/zones";
26563        if self._scopes.is_empty() {
26564            self._scopes
26565                .insert(Scope::EditContainer.as_ref().to_string());
26566        }
26567
26568        #[allow(clippy::single_element_loop)]
26569        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26570            url = params.uri_replacement(url, param_name, find_this, true);
26571        }
26572        {
26573            let to_remove = ["parent"];
26574            params.remove_params(&to_remove);
26575        }
26576
26577        let url = params.parse_with_url(&url);
26578
26579        let mut json_mime_type = mime::APPLICATION_JSON;
26580        let mut request_value_reader = {
26581            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26582            common::remove_json_null_values(&mut value);
26583            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26584            serde_json::to_writer(&mut dst, &value).unwrap();
26585            dst
26586        };
26587        let request_size = request_value_reader
26588            .seek(std::io::SeekFrom::End(0))
26589            .unwrap();
26590        request_value_reader
26591            .seek(std::io::SeekFrom::Start(0))
26592            .unwrap();
26593
26594        loop {
26595            let token = match self
26596                .hub
26597                .auth
26598                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26599                .await
26600            {
26601                Ok(token) => token,
26602                Err(e) => match dlg.token(e) {
26603                    Ok(token) => token,
26604                    Err(e) => {
26605                        dlg.finished(false);
26606                        return Err(common::Error::MissingToken(e));
26607                    }
26608                },
26609            };
26610            request_value_reader
26611                .seek(std::io::SeekFrom::Start(0))
26612                .unwrap();
26613            let mut req_result = {
26614                let client = &self.hub.client;
26615                dlg.pre_request();
26616                let mut req_builder = hyper::Request::builder()
26617                    .method(hyper::Method::POST)
26618                    .uri(url.as_str())
26619                    .header(USER_AGENT, self.hub._user_agent.clone());
26620
26621                if let Some(token) = token.as_ref() {
26622                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26623                }
26624
26625                let request = req_builder
26626                    .header(CONTENT_TYPE, json_mime_type.to_string())
26627                    .header(CONTENT_LENGTH, request_size as u64)
26628                    .body(common::to_body(
26629                        request_value_reader.get_ref().clone().into(),
26630                    ));
26631
26632                client.request(request.unwrap()).await
26633            };
26634
26635            match req_result {
26636                Err(err) => {
26637                    if let common::Retry::After(d) = dlg.http_error(&err) {
26638                        sleep(d).await;
26639                        continue;
26640                    }
26641                    dlg.finished(false);
26642                    return Err(common::Error::HttpError(err));
26643                }
26644                Ok(res) => {
26645                    let (mut parts, body) = res.into_parts();
26646                    let mut body = common::Body::new(body);
26647                    if !parts.status.is_success() {
26648                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26649                        let error = serde_json::from_str(&common::to_string(&bytes));
26650                        let response = common::to_response(parts, bytes.into());
26651
26652                        if let common::Retry::After(d) =
26653                            dlg.http_failure(&response, error.as_ref().ok())
26654                        {
26655                            sleep(d).await;
26656                            continue;
26657                        }
26658
26659                        dlg.finished(false);
26660
26661                        return Err(match error {
26662                            Ok(value) => common::Error::BadRequest(value),
26663                            _ => common::Error::Failure(response),
26664                        });
26665                    }
26666                    let response = {
26667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26668                        let encoded = common::to_string(&bytes);
26669                        match serde_json::from_str(&encoded) {
26670                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26671                            Err(error) => {
26672                                dlg.response_json_decode_error(&encoded, &error);
26673                                return Err(common::Error::JsonDecodeError(
26674                                    encoded.to_string(),
26675                                    error,
26676                                ));
26677                            }
26678                        }
26679                    };
26680
26681                    dlg.finished(true);
26682                    return Ok(response);
26683                }
26684            }
26685        }
26686    }
26687
26688    ///
26689    /// Sets the *request* property to the given value.
26690    ///
26691    /// Even though the property as already been set when instantiating this call,
26692    /// we provide this method for API completeness.
26693    pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
26694        self._request = new_value;
26695        self
26696    }
26697    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
26698    ///
26699    /// Sets the *parent* path property to the given value.
26700    ///
26701    /// Even though the property as already been set when instantiating this call,
26702    /// we provide this method for API completeness.
26703    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
26704        self._parent = new_value.to_string();
26705        self
26706    }
26707    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26708    /// while executing the actual API request.
26709    ///
26710    /// ````text
26711    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26712    /// ````
26713    ///
26714    /// Sets the *delegate* property to the given value.
26715    pub fn delegate(
26716        mut self,
26717        new_value: &'a mut dyn common::Delegate,
26718    ) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
26719        self._delegate = Some(new_value);
26720        self
26721    }
26722
26723    /// Set any additional parameter of the query string used in the request.
26724    /// It should be used to set parameters which are not yet available through their own
26725    /// setters.
26726    ///
26727    /// Please note that this method must not be used to set any of the known parameters
26728    /// which have their own setter method. If done anyway, the request will fail.
26729    ///
26730    /// # Additional Parameters
26731    ///
26732    /// * *$.xgafv* (query-string) - V1 error format.
26733    /// * *access_token* (query-string) - OAuth access token.
26734    /// * *alt* (query-string) - Data format for response.
26735    /// * *callback* (query-string) - JSONP
26736    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26737    /// * *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.
26738    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26739    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26740    /// * *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.
26741    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26742    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26743    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
26744    where
26745        T: AsRef<str>,
26746    {
26747        self._additional_params
26748            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26749        self
26750    }
26751
26752    /// Identifies the authorization scope for the method you are building.
26753    ///
26754    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26755    /// [`Scope::EditContainer`].
26756    ///
26757    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26758    /// tokens for more than one scope.
26759    ///
26760    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26761    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26762    /// sufficient, a read-write scope will do as well.
26763    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
26764    where
26765        St: AsRef<str>,
26766    {
26767        self._scopes.insert(String::from(scope.as_ref()));
26768        self
26769    }
26770    /// Identifies the authorization scope(s) for the method you are building.
26771    ///
26772    /// See [`Self::add_scope()`] for details.
26773    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
26774    where
26775        I: IntoIterator<Item = St>,
26776        St: AsRef<str>,
26777    {
26778        self._scopes
26779            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26780        self
26781    }
26782
26783    /// Removes all scopes, and no default scope will be used either.
26784    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26785    /// for details).
26786    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
26787        self._scopes.clear();
26788        self
26789    }
26790}
26791
26792/// Deletes a GTM Zone.
26793///
26794/// A builder for the *containers.workspaces.zones.delete* method supported by a *account* resource.
26795/// It is not used directly, but through a [`AccountMethods`] instance.
26796///
26797/// # Example
26798///
26799/// Instantiate a resource method builder
26800///
26801/// ```test_harness,no_run
26802/// # extern crate hyper;
26803/// # extern crate hyper_rustls;
26804/// # extern crate google_tagmanager2 as tagmanager2;
26805/// # async fn dox() {
26806/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26807///
26808/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26809/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26810/// #     secret,
26811/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26812/// # ).build().await.unwrap();
26813///
26814/// # let client = hyper_util::client::legacy::Client::builder(
26815/// #     hyper_util::rt::TokioExecutor::new()
26816/// # )
26817/// # .build(
26818/// #     hyper_rustls::HttpsConnectorBuilder::new()
26819/// #         .with_native_roots()
26820/// #         .unwrap()
26821/// #         .https_or_http()
26822/// #         .enable_http1()
26823/// #         .build()
26824/// # );
26825/// # let mut hub = TagManager::new(client, auth);
26826/// // You can configure optional parameters by calling the respective setters at will, and
26827/// // execute the final call using `doit()`.
26828/// // Values shown here are possibly random and not representative !
26829/// let result = hub.accounts().containers_workspaces_zones_delete("path")
26830///              .doit().await;
26831/// # }
26832/// ```
26833pub struct AccountContainerWorkspaceZoneDeleteCall<'a, C>
26834where
26835    C: 'a,
26836{
26837    hub: &'a TagManager<C>,
26838    _path: String,
26839    _delegate: Option<&'a mut dyn common::Delegate>,
26840    _additional_params: HashMap<String, String>,
26841    _scopes: BTreeSet<String>,
26842}
26843
26844impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneDeleteCall<'a, C> {}
26845
26846impl<'a, C> AccountContainerWorkspaceZoneDeleteCall<'a, C>
26847where
26848    C: common::Connector,
26849{
26850    /// Perform the operation you have build so far.
26851    pub async fn doit(mut self) -> common::Result<common::Response> {
26852        use std::borrow::Cow;
26853        use std::io::{Read, Seek};
26854
26855        use common::{url::Params, ToParts};
26856        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26857
26858        let mut dd = common::DefaultDelegate;
26859        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26860        dlg.begin(common::MethodInfo {
26861            id: "tagmanager.accounts.containers.workspaces.zones.delete",
26862            http_method: hyper::Method::DELETE,
26863        });
26864
26865        for &field in ["path"].iter() {
26866            if self._additional_params.contains_key(field) {
26867                dlg.finished(false);
26868                return Err(common::Error::FieldClash(field));
26869            }
26870        }
26871
26872        let mut params = Params::with_capacity(2 + self._additional_params.len());
26873        params.push("path", self._path);
26874
26875        params.extend(self._additional_params.iter());
26876
26877        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
26878        if self._scopes.is_empty() {
26879            self._scopes
26880                .insert(Scope::EditContainer.as_ref().to_string());
26881        }
26882
26883        #[allow(clippy::single_element_loop)]
26884        for &(find_this, param_name) in [("{+path}", "path")].iter() {
26885            url = params.uri_replacement(url, param_name, find_this, true);
26886        }
26887        {
26888            let to_remove = ["path"];
26889            params.remove_params(&to_remove);
26890        }
26891
26892        let url = params.parse_with_url(&url);
26893
26894        loop {
26895            let token = match self
26896                .hub
26897                .auth
26898                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26899                .await
26900            {
26901                Ok(token) => token,
26902                Err(e) => match dlg.token(e) {
26903                    Ok(token) => token,
26904                    Err(e) => {
26905                        dlg.finished(false);
26906                        return Err(common::Error::MissingToken(e));
26907                    }
26908                },
26909            };
26910            let mut req_result = {
26911                let client = &self.hub.client;
26912                dlg.pre_request();
26913                let mut req_builder = hyper::Request::builder()
26914                    .method(hyper::Method::DELETE)
26915                    .uri(url.as_str())
26916                    .header(USER_AGENT, self.hub._user_agent.clone());
26917
26918                if let Some(token) = token.as_ref() {
26919                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26920                }
26921
26922                let request = req_builder
26923                    .header(CONTENT_LENGTH, 0_u64)
26924                    .body(common::to_body::<String>(None));
26925
26926                client.request(request.unwrap()).await
26927            };
26928
26929            match req_result {
26930                Err(err) => {
26931                    if let common::Retry::After(d) = dlg.http_error(&err) {
26932                        sleep(d).await;
26933                        continue;
26934                    }
26935                    dlg.finished(false);
26936                    return Err(common::Error::HttpError(err));
26937                }
26938                Ok(res) => {
26939                    let (mut parts, body) = res.into_parts();
26940                    let mut body = common::Body::new(body);
26941                    if !parts.status.is_success() {
26942                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26943                        let error = serde_json::from_str(&common::to_string(&bytes));
26944                        let response = common::to_response(parts, bytes.into());
26945
26946                        if let common::Retry::After(d) =
26947                            dlg.http_failure(&response, error.as_ref().ok())
26948                        {
26949                            sleep(d).await;
26950                            continue;
26951                        }
26952
26953                        dlg.finished(false);
26954
26955                        return Err(match error {
26956                            Ok(value) => common::Error::BadRequest(value),
26957                            _ => common::Error::Failure(response),
26958                        });
26959                    }
26960                    let response = common::Response::from_parts(parts, body);
26961
26962                    dlg.finished(true);
26963                    return Ok(response);
26964                }
26965            }
26966        }
26967    }
26968
26969    /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
26970    ///
26971    /// Sets the *path* path property to the given value.
26972    ///
26973    /// Even though the property as already been set when instantiating this call,
26974    /// we provide this method for API completeness.
26975    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
26976        self._path = new_value.to_string();
26977        self
26978    }
26979    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26980    /// while executing the actual API request.
26981    ///
26982    /// ````text
26983    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26984    /// ````
26985    ///
26986    /// Sets the *delegate* property to the given value.
26987    pub fn delegate(
26988        mut self,
26989        new_value: &'a mut dyn common::Delegate,
26990    ) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
26991        self._delegate = Some(new_value);
26992        self
26993    }
26994
26995    /// Set any additional parameter of the query string used in the request.
26996    /// It should be used to set parameters which are not yet available through their own
26997    /// setters.
26998    ///
26999    /// Please note that this method must not be used to set any of the known parameters
27000    /// which have their own setter method. If done anyway, the request will fail.
27001    ///
27002    /// # Additional Parameters
27003    ///
27004    /// * *$.xgafv* (query-string) - V1 error format.
27005    /// * *access_token* (query-string) - OAuth access token.
27006    /// * *alt* (query-string) - Data format for response.
27007    /// * *callback* (query-string) - JSONP
27008    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27009    /// * *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.
27010    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27011    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27012    /// * *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.
27013    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27014    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27015    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
27016    where
27017        T: AsRef<str>,
27018    {
27019        self._additional_params
27020            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27021        self
27022    }
27023
27024    /// Identifies the authorization scope for the method you are building.
27025    ///
27026    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27027    /// [`Scope::EditContainer`].
27028    ///
27029    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27030    /// tokens for more than one scope.
27031    ///
27032    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27033    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27034    /// sufficient, a read-write scope will do as well.
27035    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
27036    where
27037        St: AsRef<str>,
27038    {
27039        self._scopes.insert(String::from(scope.as_ref()));
27040        self
27041    }
27042    /// Identifies the authorization scope(s) for the method you are building.
27043    ///
27044    /// See [`Self::add_scope()`] for details.
27045    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
27046    where
27047        I: IntoIterator<Item = St>,
27048        St: AsRef<str>,
27049    {
27050        self._scopes
27051            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27052        self
27053    }
27054
27055    /// Removes all scopes, and no default scope will be used either.
27056    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27057    /// for details).
27058    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
27059        self._scopes.clear();
27060        self
27061    }
27062}
27063
27064/// Gets a GTM Zone.
27065///
27066/// A builder for the *containers.workspaces.zones.get* method supported by a *account* resource.
27067/// It is not used directly, but through a [`AccountMethods`] instance.
27068///
27069/// # Example
27070///
27071/// Instantiate a resource method builder
27072///
27073/// ```test_harness,no_run
27074/// # extern crate hyper;
27075/// # extern crate hyper_rustls;
27076/// # extern crate google_tagmanager2 as tagmanager2;
27077/// # async fn dox() {
27078/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27079///
27080/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27081/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27082/// #     secret,
27083/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27084/// # ).build().await.unwrap();
27085///
27086/// # let client = hyper_util::client::legacy::Client::builder(
27087/// #     hyper_util::rt::TokioExecutor::new()
27088/// # )
27089/// # .build(
27090/// #     hyper_rustls::HttpsConnectorBuilder::new()
27091/// #         .with_native_roots()
27092/// #         .unwrap()
27093/// #         .https_or_http()
27094/// #         .enable_http1()
27095/// #         .build()
27096/// # );
27097/// # let mut hub = TagManager::new(client, auth);
27098/// // You can configure optional parameters by calling the respective setters at will, and
27099/// // execute the final call using `doit()`.
27100/// // Values shown here are possibly random and not representative !
27101/// let result = hub.accounts().containers_workspaces_zones_get("path")
27102///              .doit().await;
27103/// # }
27104/// ```
27105pub struct AccountContainerWorkspaceZoneGetCall<'a, C>
27106where
27107    C: 'a,
27108{
27109    hub: &'a TagManager<C>,
27110    _path: String,
27111    _delegate: Option<&'a mut dyn common::Delegate>,
27112    _additional_params: HashMap<String, String>,
27113    _scopes: BTreeSet<String>,
27114}
27115
27116impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneGetCall<'a, C> {}
27117
27118impl<'a, C> AccountContainerWorkspaceZoneGetCall<'a, C>
27119where
27120    C: common::Connector,
27121{
27122    /// Perform the operation you have build so far.
27123    pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
27124        use std::borrow::Cow;
27125        use std::io::{Read, Seek};
27126
27127        use common::{url::Params, ToParts};
27128        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27129
27130        let mut dd = common::DefaultDelegate;
27131        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27132        dlg.begin(common::MethodInfo {
27133            id: "tagmanager.accounts.containers.workspaces.zones.get",
27134            http_method: hyper::Method::GET,
27135        });
27136
27137        for &field in ["alt", "path"].iter() {
27138            if self._additional_params.contains_key(field) {
27139                dlg.finished(false);
27140                return Err(common::Error::FieldClash(field));
27141            }
27142        }
27143
27144        let mut params = Params::with_capacity(3 + self._additional_params.len());
27145        params.push("path", self._path);
27146
27147        params.extend(self._additional_params.iter());
27148
27149        params.push("alt", "json");
27150        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
27151        if self._scopes.is_empty() {
27152            self._scopes.insert(Scope::Readonly.as_ref().to_string());
27153        }
27154
27155        #[allow(clippy::single_element_loop)]
27156        for &(find_this, param_name) in [("{+path}", "path")].iter() {
27157            url = params.uri_replacement(url, param_name, find_this, true);
27158        }
27159        {
27160            let to_remove = ["path"];
27161            params.remove_params(&to_remove);
27162        }
27163
27164        let url = params.parse_with_url(&url);
27165
27166        loop {
27167            let token = match self
27168                .hub
27169                .auth
27170                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27171                .await
27172            {
27173                Ok(token) => token,
27174                Err(e) => match dlg.token(e) {
27175                    Ok(token) => token,
27176                    Err(e) => {
27177                        dlg.finished(false);
27178                        return Err(common::Error::MissingToken(e));
27179                    }
27180                },
27181            };
27182            let mut req_result = {
27183                let client = &self.hub.client;
27184                dlg.pre_request();
27185                let mut req_builder = hyper::Request::builder()
27186                    .method(hyper::Method::GET)
27187                    .uri(url.as_str())
27188                    .header(USER_AGENT, self.hub._user_agent.clone());
27189
27190                if let Some(token) = token.as_ref() {
27191                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27192                }
27193
27194                let request = req_builder
27195                    .header(CONTENT_LENGTH, 0_u64)
27196                    .body(common::to_body::<String>(None));
27197
27198                client.request(request.unwrap()).await
27199            };
27200
27201            match req_result {
27202                Err(err) => {
27203                    if let common::Retry::After(d) = dlg.http_error(&err) {
27204                        sleep(d).await;
27205                        continue;
27206                    }
27207                    dlg.finished(false);
27208                    return Err(common::Error::HttpError(err));
27209                }
27210                Ok(res) => {
27211                    let (mut parts, body) = res.into_parts();
27212                    let mut body = common::Body::new(body);
27213                    if !parts.status.is_success() {
27214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27215                        let error = serde_json::from_str(&common::to_string(&bytes));
27216                        let response = common::to_response(parts, bytes.into());
27217
27218                        if let common::Retry::After(d) =
27219                            dlg.http_failure(&response, error.as_ref().ok())
27220                        {
27221                            sleep(d).await;
27222                            continue;
27223                        }
27224
27225                        dlg.finished(false);
27226
27227                        return Err(match error {
27228                            Ok(value) => common::Error::BadRequest(value),
27229                            _ => common::Error::Failure(response),
27230                        });
27231                    }
27232                    let response = {
27233                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27234                        let encoded = common::to_string(&bytes);
27235                        match serde_json::from_str(&encoded) {
27236                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27237                            Err(error) => {
27238                                dlg.response_json_decode_error(&encoded, &error);
27239                                return Err(common::Error::JsonDecodeError(
27240                                    encoded.to_string(),
27241                                    error,
27242                                ));
27243                            }
27244                        }
27245                    };
27246
27247                    dlg.finished(true);
27248                    return Ok(response);
27249                }
27250            }
27251        }
27252    }
27253
27254    /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
27255    ///
27256    /// Sets the *path* path property to the given value.
27257    ///
27258    /// Even though the property as already been set when instantiating this call,
27259    /// we provide this method for API completeness.
27260    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
27261        self._path = new_value.to_string();
27262        self
27263    }
27264    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27265    /// while executing the actual API request.
27266    ///
27267    /// ````text
27268    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27269    /// ````
27270    ///
27271    /// Sets the *delegate* property to the given value.
27272    pub fn delegate(
27273        mut self,
27274        new_value: &'a mut dyn common::Delegate,
27275    ) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
27276        self._delegate = Some(new_value);
27277        self
27278    }
27279
27280    /// Set any additional parameter of the query string used in the request.
27281    /// It should be used to set parameters which are not yet available through their own
27282    /// setters.
27283    ///
27284    /// Please note that this method must not be used to set any of the known parameters
27285    /// which have their own setter method. If done anyway, the request will fail.
27286    ///
27287    /// # Additional Parameters
27288    ///
27289    /// * *$.xgafv* (query-string) - V1 error format.
27290    /// * *access_token* (query-string) - OAuth access token.
27291    /// * *alt* (query-string) - Data format for response.
27292    /// * *callback* (query-string) - JSONP
27293    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27294    /// * *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.
27295    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27296    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27297    /// * *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.
27298    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27299    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27300    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneGetCall<'a, C>
27301    where
27302        T: AsRef<str>,
27303    {
27304        self._additional_params
27305            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27306        self
27307    }
27308
27309    /// Identifies the authorization scope for the method you are building.
27310    ///
27311    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27312    /// [`Scope::Readonly`].
27313    ///
27314    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27315    /// tokens for more than one scope.
27316    ///
27317    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27318    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27319    /// sufficient, a read-write scope will do as well.
27320    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneGetCall<'a, C>
27321    where
27322        St: AsRef<str>,
27323    {
27324        self._scopes.insert(String::from(scope.as_ref()));
27325        self
27326    }
27327    /// Identifies the authorization scope(s) for the method you are building.
27328    ///
27329    /// See [`Self::add_scope()`] for details.
27330    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneGetCall<'a, C>
27331    where
27332        I: IntoIterator<Item = St>,
27333        St: AsRef<str>,
27334    {
27335        self._scopes
27336            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27337        self
27338    }
27339
27340    /// Removes all scopes, and no default scope will be used either.
27341    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27342    /// for details).
27343    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
27344        self._scopes.clear();
27345        self
27346    }
27347}
27348
27349/// Lists all GTM Zones of a GTM container workspace.
27350///
27351/// A builder for the *containers.workspaces.zones.list* method supported by a *account* resource.
27352/// It is not used directly, but through a [`AccountMethods`] instance.
27353///
27354/// # Example
27355///
27356/// Instantiate a resource method builder
27357///
27358/// ```test_harness,no_run
27359/// # extern crate hyper;
27360/// # extern crate hyper_rustls;
27361/// # extern crate google_tagmanager2 as tagmanager2;
27362/// # async fn dox() {
27363/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27364///
27365/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27366/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27367/// #     secret,
27368/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27369/// # ).build().await.unwrap();
27370///
27371/// # let client = hyper_util::client::legacy::Client::builder(
27372/// #     hyper_util::rt::TokioExecutor::new()
27373/// # )
27374/// # .build(
27375/// #     hyper_rustls::HttpsConnectorBuilder::new()
27376/// #         .with_native_roots()
27377/// #         .unwrap()
27378/// #         .https_or_http()
27379/// #         .enable_http1()
27380/// #         .build()
27381/// # );
27382/// # let mut hub = TagManager::new(client, auth);
27383/// // You can configure optional parameters by calling the respective setters at will, and
27384/// // execute the final call using `doit()`.
27385/// // Values shown here are possibly random and not representative !
27386/// let result = hub.accounts().containers_workspaces_zones_list("parent")
27387///              .page_token("eos")
27388///              .doit().await;
27389/// # }
27390/// ```
27391pub struct AccountContainerWorkspaceZoneListCall<'a, C>
27392where
27393    C: 'a,
27394{
27395    hub: &'a TagManager<C>,
27396    _parent: String,
27397    _page_token: Option<String>,
27398    _delegate: Option<&'a mut dyn common::Delegate>,
27399    _additional_params: HashMap<String, String>,
27400    _scopes: BTreeSet<String>,
27401}
27402
27403impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneListCall<'a, C> {}
27404
27405impl<'a, C> AccountContainerWorkspaceZoneListCall<'a, C>
27406where
27407    C: common::Connector,
27408{
27409    /// Perform the operation you have build so far.
27410    pub async fn doit(mut self) -> common::Result<(common::Response, ListZonesResponse)> {
27411        use std::borrow::Cow;
27412        use std::io::{Read, Seek};
27413
27414        use common::{url::Params, ToParts};
27415        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27416
27417        let mut dd = common::DefaultDelegate;
27418        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27419        dlg.begin(common::MethodInfo {
27420            id: "tagmanager.accounts.containers.workspaces.zones.list",
27421            http_method: hyper::Method::GET,
27422        });
27423
27424        for &field in ["alt", "parent", "pageToken"].iter() {
27425            if self._additional_params.contains_key(field) {
27426                dlg.finished(false);
27427                return Err(common::Error::FieldClash(field));
27428            }
27429        }
27430
27431        let mut params = Params::with_capacity(4 + self._additional_params.len());
27432        params.push("parent", self._parent);
27433        if let Some(value) = self._page_token.as_ref() {
27434            params.push("pageToken", value);
27435        }
27436
27437        params.extend(self._additional_params.iter());
27438
27439        params.push("alt", "json");
27440        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/zones";
27441        if self._scopes.is_empty() {
27442            self._scopes.insert(Scope::Readonly.as_ref().to_string());
27443        }
27444
27445        #[allow(clippy::single_element_loop)]
27446        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27447            url = params.uri_replacement(url, param_name, find_this, true);
27448        }
27449        {
27450            let to_remove = ["parent"];
27451            params.remove_params(&to_remove);
27452        }
27453
27454        let url = params.parse_with_url(&url);
27455
27456        loop {
27457            let token = match self
27458                .hub
27459                .auth
27460                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27461                .await
27462            {
27463                Ok(token) => token,
27464                Err(e) => match dlg.token(e) {
27465                    Ok(token) => token,
27466                    Err(e) => {
27467                        dlg.finished(false);
27468                        return Err(common::Error::MissingToken(e));
27469                    }
27470                },
27471            };
27472            let mut req_result = {
27473                let client = &self.hub.client;
27474                dlg.pre_request();
27475                let mut req_builder = hyper::Request::builder()
27476                    .method(hyper::Method::GET)
27477                    .uri(url.as_str())
27478                    .header(USER_AGENT, self.hub._user_agent.clone());
27479
27480                if let Some(token) = token.as_ref() {
27481                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27482                }
27483
27484                let request = req_builder
27485                    .header(CONTENT_LENGTH, 0_u64)
27486                    .body(common::to_body::<String>(None));
27487
27488                client.request(request.unwrap()).await
27489            };
27490
27491            match req_result {
27492                Err(err) => {
27493                    if let common::Retry::After(d) = dlg.http_error(&err) {
27494                        sleep(d).await;
27495                        continue;
27496                    }
27497                    dlg.finished(false);
27498                    return Err(common::Error::HttpError(err));
27499                }
27500                Ok(res) => {
27501                    let (mut parts, body) = res.into_parts();
27502                    let mut body = common::Body::new(body);
27503                    if !parts.status.is_success() {
27504                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27505                        let error = serde_json::from_str(&common::to_string(&bytes));
27506                        let response = common::to_response(parts, bytes.into());
27507
27508                        if let common::Retry::After(d) =
27509                            dlg.http_failure(&response, error.as_ref().ok())
27510                        {
27511                            sleep(d).await;
27512                            continue;
27513                        }
27514
27515                        dlg.finished(false);
27516
27517                        return Err(match error {
27518                            Ok(value) => common::Error::BadRequest(value),
27519                            _ => common::Error::Failure(response),
27520                        });
27521                    }
27522                    let response = {
27523                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27524                        let encoded = common::to_string(&bytes);
27525                        match serde_json::from_str(&encoded) {
27526                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27527                            Err(error) => {
27528                                dlg.response_json_decode_error(&encoded, &error);
27529                                return Err(common::Error::JsonDecodeError(
27530                                    encoded.to_string(),
27531                                    error,
27532                                ));
27533                            }
27534                        }
27535                    };
27536
27537                    dlg.finished(true);
27538                    return Ok(response);
27539                }
27540            }
27541        }
27542    }
27543
27544    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
27545    ///
27546    /// Sets the *parent* path property to the given value.
27547    ///
27548    /// Even though the property as already been set when instantiating this call,
27549    /// we provide this method for API completeness.
27550    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C> {
27551        self._parent = new_value.to_string();
27552        self
27553    }
27554    /// Continuation token for fetching the next page of results.
27555    ///
27556    /// Sets the *page token* query property to the given value.
27557    pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C> {
27558        self._page_token = Some(new_value.to_string());
27559        self
27560    }
27561    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27562    /// while executing the actual API request.
27563    ///
27564    /// ````text
27565    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27566    /// ````
27567    ///
27568    /// Sets the *delegate* property to the given value.
27569    pub fn delegate(
27570        mut self,
27571        new_value: &'a mut dyn common::Delegate,
27572    ) -> AccountContainerWorkspaceZoneListCall<'a, C> {
27573        self._delegate = Some(new_value);
27574        self
27575    }
27576
27577    /// Set any additional parameter of the query string used in the request.
27578    /// It should be used to set parameters which are not yet available through their own
27579    /// setters.
27580    ///
27581    /// Please note that this method must not be used to set any of the known parameters
27582    /// which have their own setter method. If done anyway, the request will fail.
27583    ///
27584    /// # Additional Parameters
27585    ///
27586    /// * *$.xgafv* (query-string) - V1 error format.
27587    /// * *access_token* (query-string) - OAuth access token.
27588    /// * *alt* (query-string) - Data format for response.
27589    /// * *callback* (query-string) - JSONP
27590    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27591    /// * *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.
27592    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27593    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27594    /// * *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.
27595    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27596    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27597    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneListCall<'a, C>
27598    where
27599        T: AsRef<str>,
27600    {
27601        self._additional_params
27602            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27603        self
27604    }
27605
27606    /// Identifies the authorization scope for the method you are building.
27607    ///
27608    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27609    /// [`Scope::Readonly`].
27610    ///
27611    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27612    /// tokens for more than one scope.
27613    ///
27614    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27615    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27616    /// sufficient, a read-write scope will do as well.
27617    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneListCall<'a, C>
27618    where
27619        St: AsRef<str>,
27620    {
27621        self._scopes.insert(String::from(scope.as_ref()));
27622        self
27623    }
27624    /// Identifies the authorization scope(s) for the method you are building.
27625    ///
27626    /// See [`Self::add_scope()`] for details.
27627    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneListCall<'a, C>
27628    where
27629        I: IntoIterator<Item = St>,
27630        St: AsRef<str>,
27631    {
27632        self._scopes
27633            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27634        self
27635    }
27636
27637    /// Removes all scopes, and no default scope will be used either.
27638    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27639    /// for details).
27640    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneListCall<'a, C> {
27641        self._scopes.clear();
27642        self
27643    }
27644}
27645
27646/// Reverts changes to a GTM Zone in a GTM Workspace.
27647///
27648/// A builder for the *containers.workspaces.zones.revert* method supported by a *account* resource.
27649/// It is not used directly, but through a [`AccountMethods`] instance.
27650///
27651/// # Example
27652///
27653/// Instantiate a resource method builder
27654///
27655/// ```test_harness,no_run
27656/// # extern crate hyper;
27657/// # extern crate hyper_rustls;
27658/// # extern crate google_tagmanager2 as tagmanager2;
27659/// # async fn dox() {
27660/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27661///
27662/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27663/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27664/// #     secret,
27665/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27666/// # ).build().await.unwrap();
27667///
27668/// # let client = hyper_util::client::legacy::Client::builder(
27669/// #     hyper_util::rt::TokioExecutor::new()
27670/// # )
27671/// # .build(
27672/// #     hyper_rustls::HttpsConnectorBuilder::new()
27673/// #         .with_native_roots()
27674/// #         .unwrap()
27675/// #         .https_or_http()
27676/// #         .enable_http1()
27677/// #         .build()
27678/// # );
27679/// # let mut hub = TagManager::new(client, auth);
27680/// // You can configure optional parameters by calling the respective setters at will, and
27681/// // execute the final call using `doit()`.
27682/// // Values shown here are possibly random and not representative !
27683/// let result = hub.accounts().containers_workspaces_zones_revert("path")
27684///              .fingerprint("ea")
27685///              .doit().await;
27686/// # }
27687/// ```
27688pub struct AccountContainerWorkspaceZoneRevertCall<'a, C>
27689where
27690    C: 'a,
27691{
27692    hub: &'a TagManager<C>,
27693    _path: String,
27694    _fingerprint: Option<String>,
27695    _delegate: Option<&'a mut dyn common::Delegate>,
27696    _additional_params: HashMap<String, String>,
27697    _scopes: BTreeSet<String>,
27698}
27699
27700impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneRevertCall<'a, C> {}
27701
27702impl<'a, C> AccountContainerWorkspaceZoneRevertCall<'a, C>
27703where
27704    C: common::Connector,
27705{
27706    /// Perform the operation you have build so far.
27707    pub async fn doit(mut self) -> common::Result<(common::Response, RevertZoneResponse)> {
27708        use std::borrow::Cow;
27709        use std::io::{Read, Seek};
27710
27711        use common::{url::Params, ToParts};
27712        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27713
27714        let mut dd = common::DefaultDelegate;
27715        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27716        dlg.begin(common::MethodInfo {
27717            id: "tagmanager.accounts.containers.workspaces.zones.revert",
27718            http_method: hyper::Method::POST,
27719        });
27720
27721        for &field in ["alt", "path", "fingerprint"].iter() {
27722            if self._additional_params.contains_key(field) {
27723                dlg.finished(false);
27724                return Err(common::Error::FieldClash(field));
27725            }
27726        }
27727
27728        let mut params = Params::with_capacity(4 + self._additional_params.len());
27729        params.push("path", self._path);
27730        if let Some(value) = self._fingerprint.as_ref() {
27731            params.push("fingerprint", value);
27732        }
27733
27734        params.extend(self._additional_params.iter());
27735
27736        params.push("alt", "json");
27737        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
27738        if self._scopes.is_empty() {
27739            self._scopes
27740                .insert(Scope::EditContainer.as_ref().to_string());
27741        }
27742
27743        #[allow(clippy::single_element_loop)]
27744        for &(find_this, param_name) in [("{+path}", "path")].iter() {
27745            url = params.uri_replacement(url, param_name, find_this, true);
27746        }
27747        {
27748            let to_remove = ["path"];
27749            params.remove_params(&to_remove);
27750        }
27751
27752        let url = params.parse_with_url(&url);
27753
27754        loop {
27755            let token = match self
27756                .hub
27757                .auth
27758                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27759                .await
27760            {
27761                Ok(token) => token,
27762                Err(e) => match dlg.token(e) {
27763                    Ok(token) => token,
27764                    Err(e) => {
27765                        dlg.finished(false);
27766                        return Err(common::Error::MissingToken(e));
27767                    }
27768                },
27769            };
27770            let mut req_result = {
27771                let client = &self.hub.client;
27772                dlg.pre_request();
27773                let mut req_builder = hyper::Request::builder()
27774                    .method(hyper::Method::POST)
27775                    .uri(url.as_str())
27776                    .header(USER_AGENT, self.hub._user_agent.clone());
27777
27778                if let Some(token) = token.as_ref() {
27779                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27780                }
27781
27782                let request = req_builder
27783                    .header(CONTENT_LENGTH, 0_u64)
27784                    .body(common::to_body::<String>(None));
27785
27786                client.request(request.unwrap()).await
27787            };
27788
27789            match req_result {
27790                Err(err) => {
27791                    if let common::Retry::After(d) = dlg.http_error(&err) {
27792                        sleep(d).await;
27793                        continue;
27794                    }
27795                    dlg.finished(false);
27796                    return Err(common::Error::HttpError(err));
27797                }
27798                Ok(res) => {
27799                    let (mut parts, body) = res.into_parts();
27800                    let mut body = common::Body::new(body);
27801                    if !parts.status.is_success() {
27802                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27803                        let error = serde_json::from_str(&common::to_string(&bytes));
27804                        let response = common::to_response(parts, bytes.into());
27805
27806                        if let common::Retry::After(d) =
27807                            dlg.http_failure(&response, error.as_ref().ok())
27808                        {
27809                            sleep(d).await;
27810                            continue;
27811                        }
27812
27813                        dlg.finished(false);
27814
27815                        return Err(match error {
27816                            Ok(value) => common::Error::BadRequest(value),
27817                            _ => common::Error::Failure(response),
27818                        });
27819                    }
27820                    let response = {
27821                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27822                        let encoded = common::to_string(&bytes);
27823                        match serde_json::from_str(&encoded) {
27824                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27825                            Err(error) => {
27826                                dlg.response_json_decode_error(&encoded, &error);
27827                                return Err(common::Error::JsonDecodeError(
27828                                    encoded.to_string(),
27829                                    error,
27830                                ));
27831                            }
27832                        }
27833                    };
27834
27835                    dlg.finished(true);
27836                    return Ok(response);
27837                }
27838            }
27839        }
27840    }
27841
27842    /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
27843    ///
27844    /// Sets the *path* path property to the given value.
27845    ///
27846    /// Even though the property as already been set when instantiating this call,
27847    /// we provide this method for API completeness.
27848    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
27849        self._path = new_value.to_string();
27850        self
27851    }
27852    /// When provided, this fingerprint must match the fingerprint of the zone in storage.
27853    ///
27854    /// Sets the *fingerprint* query property to the given value.
27855    pub fn fingerprint(
27856        mut self,
27857        new_value: &str,
27858    ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
27859        self._fingerprint = Some(new_value.to_string());
27860        self
27861    }
27862    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27863    /// while executing the actual API request.
27864    ///
27865    /// ````text
27866    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27867    /// ````
27868    ///
27869    /// Sets the *delegate* property to the given value.
27870    pub fn delegate(
27871        mut self,
27872        new_value: &'a mut dyn common::Delegate,
27873    ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
27874        self._delegate = Some(new_value);
27875        self
27876    }
27877
27878    /// Set any additional parameter of the query string used in the request.
27879    /// It should be used to set parameters which are not yet available through their own
27880    /// setters.
27881    ///
27882    /// Please note that this method must not be used to set any of the known parameters
27883    /// which have their own setter method. If done anyway, the request will fail.
27884    ///
27885    /// # Additional Parameters
27886    ///
27887    /// * *$.xgafv* (query-string) - V1 error format.
27888    /// * *access_token* (query-string) - OAuth access token.
27889    /// * *alt* (query-string) - Data format for response.
27890    /// * *callback* (query-string) - JSONP
27891    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27892    /// * *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.
27893    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27894    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27895    /// * *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.
27896    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27897    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27898    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
27899    where
27900        T: AsRef<str>,
27901    {
27902        self._additional_params
27903            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27904        self
27905    }
27906
27907    /// Identifies the authorization scope for the method you are building.
27908    ///
27909    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27910    /// [`Scope::EditContainer`].
27911    ///
27912    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27913    /// tokens for more than one scope.
27914    ///
27915    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27916    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27917    /// sufficient, a read-write scope will do as well.
27918    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
27919    where
27920        St: AsRef<str>,
27921    {
27922        self._scopes.insert(String::from(scope.as_ref()));
27923        self
27924    }
27925    /// Identifies the authorization scope(s) for the method you are building.
27926    ///
27927    /// See [`Self::add_scope()`] for details.
27928    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
27929    where
27930        I: IntoIterator<Item = St>,
27931        St: AsRef<str>,
27932    {
27933        self._scopes
27934            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27935        self
27936    }
27937
27938    /// Removes all scopes, and no default scope will be used either.
27939    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27940    /// for details).
27941    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
27942        self._scopes.clear();
27943        self
27944    }
27945}
27946
27947/// Updates a GTM Zone.
27948///
27949/// A builder for the *containers.workspaces.zones.update* method supported by a *account* resource.
27950/// It is not used directly, but through a [`AccountMethods`] instance.
27951///
27952/// # Example
27953///
27954/// Instantiate a resource method builder
27955///
27956/// ```test_harness,no_run
27957/// # extern crate hyper;
27958/// # extern crate hyper_rustls;
27959/// # extern crate google_tagmanager2 as tagmanager2;
27960/// use tagmanager2::api::Zone;
27961/// # async fn dox() {
27962/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27963///
27964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27965/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27966/// #     secret,
27967/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27968/// # ).build().await.unwrap();
27969///
27970/// # let client = hyper_util::client::legacy::Client::builder(
27971/// #     hyper_util::rt::TokioExecutor::new()
27972/// # )
27973/// # .build(
27974/// #     hyper_rustls::HttpsConnectorBuilder::new()
27975/// #         .with_native_roots()
27976/// #         .unwrap()
27977/// #         .https_or_http()
27978/// #         .enable_http1()
27979/// #         .build()
27980/// # );
27981/// # let mut hub = TagManager::new(client, auth);
27982/// // As the method needs a request, you would usually fill it with the desired information
27983/// // into the respective structure. Some of the parts shown here might not be applicable !
27984/// // Values shown here are possibly random and not representative !
27985/// let mut req = Zone::default();
27986///
27987/// // You can configure optional parameters by calling the respective setters at will, and
27988/// // execute the final call using `doit()`.
27989/// // Values shown here are possibly random and not representative !
27990/// let result = hub.accounts().containers_workspaces_zones_update(req, "path")
27991///              .fingerprint("dolores")
27992///              .doit().await;
27993/// # }
27994/// ```
27995pub struct AccountContainerWorkspaceZoneUpdateCall<'a, C>
27996where
27997    C: 'a,
27998{
27999    hub: &'a TagManager<C>,
28000    _request: Zone,
28001    _path: String,
28002    _fingerprint: Option<String>,
28003    _delegate: Option<&'a mut dyn common::Delegate>,
28004    _additional_params: HashMap<String, String>,
28005    _scopes: BTreeSet<String>,
28006}
28007
28008impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneUpdateCall<'a, C> {}
28009
28010impl<'a, C> AccountContainerWorkspaceZoneUpdateCall<'a, C>
28011where
28012    C: common::Connector,
28013{
28014    /// Perform the operation you have build so far.
28015    pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
28016        use std::borrow::Cow;
28017        use std::io::{Read, Seek};
28018
28019        use common::{url::Params, ToParts};
28020        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28021
28022        let mut dd = common::DefaultDelegate;
28023        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28024        dlg.begin(common::MethodInfo {
28025            id: "tagmanager.accounts.containers.workspaces.zones.update",
28026            http_method: hyper::Method::PUT,
28027        });
28028
28029        for &field in ["alt", "path", "fingerprint"].iter() {
28030            if self._additional_params.contains_key(field) {
28031                dlg.finished(false);
28032                return Err(common::Error::FieldClash(field));
28033            }
28034        }
28035
28036        let mut params = Params::with_capacity(5 + self._additional_params.len());
28037        params.push("path", self._path);
28038        if let Some(value) = self._fingerprint.as_ref() {
28039            params.push("fingerprint", value);
28040        }
28041
28042        params.extend(self._additional_params.iter());
28043
28044        params.push("alt", "json");
28045        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
28046        if self._scopes.is_empty() {
28047            self._scopes
28048                .insert(Scope::EditContainer.as_ref().to_string());
28049        }
28050
28051        #[allow(clippy::single_element_loop)]
28052        for &(find_this, param_name) in [("{+path}", "path")].iter() {
28053            url = params.uri_replacement(url, param_name, find_this, true);
28054        }
28055        {
28056            let to_remove = ["path"];
28057            params.remove_params(&to_remove);
28058        }
28059
28060        let url = params.parse_with_url(&url);
28061
28062        let mut json_mime_type = mime::APPLICATION_JSON;
28063        let mut request_value_reader = {
28064            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28065            common::remove_json_null_values(&mut value);
28066            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28067            serde_json::to_writer(&mut dst, &value).unwrap();
28068            dst
28069        };
28070        let request_size = request_value_reader
28071            .seek(std::io::SeekFrom::End(0))
28072            .unwrap();
28073        request_value_reader
28074            .seek(std::io::SeekFrom::Start(0))
28075            .unwrap();
28076
28077        loop {
28078            let token = match self
28079                .hub
28080                .auth
28081                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28082                .await
28083            {
28084                Ok(token) => token,
28085                Err(e) => match dlg.token(e) {
28086                    Ok(token) => token,
28087                    Err(e) => {
28088                        dlg.finished(false);
28089                        return Err(common::Error::MissingToken(e));
28090                    }
28091                },
28092            };
28093            request_value_reader
28094                .seek(std::io::SeekFrom::Start(0))
28095                .unwrap();
28096            let mut req_result = {
28097                let client = &self.hub.client;
28098                dlg.pre_request();
28099                let mut req_builder = hyper::Request::builder()
28100                    .method(hyper::Method::PUT)
28101                    .uri(url.as_str())
28102                    .header(USER_AGENT, self.hub._user_agent.clone());
28103
28104                if let Some(token) = token.as_ref() {
28105                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28106                }
28107
28108                let request = req_builder
28109                    .header(CONTENT_TYPE, json_mime_type.to_string())
28110                    .header(CONTENT_LENGTH, request_size as u64)
28111                    .body(common::to_body(
28112                        request_value_reader.get_ref().clone().into(),
28113                    ));
28114
28115                client.request(request.unwrap()).await
28116            };
28117
28118            match req_result {
28119                Err(err) => {
28120                    if let common::Retry::After(d) = dlg.http_error(&err) {
28121                        sleep(d).await;
28122                        continue;
28123                    }
28124                    dlg.finished(false);
28125                    return Err(common::Error::HttpError(err));
28126                }
28127                Ok(res) => {
28128                    let (mut parts, body) = res.into_parts();
28129                    let mut body = common::Body::new(body);
28130                    if !parts.status.is_success() {
28131                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28132                        let error = serde_json::from_str(&common::to_string(&bytes));
28133                        let response = common::to_response(parts, bytes.into());
28134
28135                        if let common::Retry::After(d) =
28136                            dlg.http_failure(&response, error.as_ref().ok())
28137                        {
28138                            sleep(d).await;
28139                            continue;
28140                        }
28141
28142                        dlg.finished(false);
28143
28144                        return Err(match error {
28145                            Ok(value) => common::Error::BadRequest(value),
28146                            _ => common::Error::Failure(response),
28147                        });
28148                    }
28149                    let response = {
28150                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28151                        let encoded = common::to_string(&bytes);
28152                        match serde_json::from_str(&encoded) {
28153                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28154                            Err(error) => {
28155                                dlg.response_json_decode_error(&encoded, &error);
28156                                return Err(common::Error::JsonDecodeError(
28157                                    encoded.to_string(),
28158                                    error,
28159                                ));
28160                            }
28161                        }
28162                    };
28163
28164                    dlg.finished(true);
28165                    return Ok(response);
28166                }
28167            }
28168        }
28169    }
28170
28171    ///
28172    /// Sets the *request* property to the given value.
28173    ///
28174    /// Even though the property as already been set when instantiating this call,
28175    /// we provide this method for API completeness.
28176    pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
28177        self._request = new_value;
28178        self
28179    }
28180    /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}
28181    ///
28182    /// Sets the *path* path property to the given value.
28183    ///
28184    /// Even though the property as already been set when instantiating this call,
28185    /// we provide this method for API completeness.
28186    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
28187        self._path = new_value.to_string();
28188        self
28189    }
28190    /// When provided, this fingerprint must match the fingerprint of the zone in storage.
28191    ///
28192    /// Sets the *fingerprint* query property to the given value.
28193    pub fn fingerprint(
28194        mut self,
28195        new_value: &str,
28196    ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
28197        self._fingerprint = Some(new_value.to_string());
28198        self
28199    }
28200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28201    /// while executing the actual API request.
28202    ///
28203    /// ````text
28204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28205    /// ````
28206    ///
28207    /// Sets the *delegate* property to the given value.
28208    pub fn delegate(
28209        mut self,
28210        new_value: &'a mut dyn common::Delegate,
28211    ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
28212        self._delegate = Some(new_value);
28213        self
28214    }
28215
28216    /// Set any additional parameter of the query string used in the request.
28217    /// It should be used to set parameters which are not yet available through their own
28218    /// setters.
28219    ///
28220    /// Please note that this method must not be used to set any of the known parameters
28221    /// which have their own setter method. If done anyway, the request will fail.
28222    ///
28223    /// # Additional Parameters
28224    ///
28225    /// * *$.xgafv* (query-string) - V1 error format.
28226    /// * *access_token* (query-string) - OAuth access token.
28227    /// * *alt* (query-string) - Data format for response.
28228    /// * *callback* (query-string) - JSONP
28229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28230    /// * *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.
28231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28233    /// * *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.
28234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28236    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
28237    where
28238        T: AsRef<str>,
28239    {
28240        self._additional_params
28241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28242        self
28243    }
28244
28245    /// Identifies the authorization scope for the method you are building.
28246    ///
28247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28248    /// [`Scope::EditContainer`].
28249    ///
28250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28251    /// tokens for more than one scope.
28252    ///
28253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28255    /// sufficient, a read-write scope will do as well.
28256    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
28257    where
28258        St: AsRef<str>,
28259    {
28260        self._scopes.insert(String::from(scope.as_ref()));
28261        self
28262    }
28263    /// Identifies the authorization scope(s) for the method you are building.
28264    ///
28265    /// See [`Self::add_scope()`] for details.
28266    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
28267    where
28268        I: IntoIterator<Item = St>,
28269        St: AsRef<str>,
28270    {
28271        self._scopes
28272            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28273        self
28274    }
28275
28276    /// Removes all scopes, and no default scope will be used either.
28277    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28278    /// for details).
28279    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
28280        self._scopes.clear();
28281        self
28282    }
28283}
28284
28285/// Creates a Workspace.
28286///
28287/// A builder for the *containers.workspaces.create* method supported by a *account* resource.
28288/// It is not used directly, but through a [`AccountMethods`] instance.
28289///
28290/// # Example
28291///
28292/// Instantiate a resource method builder
28293///
28294/// ```test_harness,no_run
28295/// # extern crate hyper;
28296/// # extern crate hyper_rustls;
28297/// # extern crate google_tagmanager2 as tagmanager2;
28298/// use tagmanager2::api::Workspace;
28299/// # async fn dox() {
28300/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28301///
28302/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28303/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28304/// #     secret,
28305/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28306/// # ).build().await.unwrap();
28307///
28308/// # let client = hyper_util::client::legacy::Client::builder(
28309/// #     hyper_util::rt::TokioExecutor::new()
28310/// # )
28311/// # .build(
28312/// #     hyper_rustls::HttpsConnectorBuilder::new()
28313/// #         .with_native_roots()
28314/// #         .unwrap()
28315/// #         .https_or_http()
28316/// #         .enable_http1()
28317/// #         .build()
28318/// # );
28319/// # let mut hub = TagManager::new(client, auth);
28320/// // As the method needs a request, you would usually fill it with the desired information
28321/// // into the respective structure. Some of the parts shown here might not be applicable !
28322/// // Values shown here are possibly random and not representative !
28323/// let mut req = Workspace::default();
28324///
28325/// // You can configure optional parameters by calling the respective setters at will, and
28326/// // execute the final call using `doit()`.
28327/// // Values shown here are possibly random and not representative !
28328/// let result = hub.accounts().containers_workspaces_create(req, "parent")
28329///              .doit().await;
28330/// # }
28331/// ```
28332pub struct AccountContainerWorkspaceCreateCall<'a, C>
28333where
28334    C: 'a,
28335{
28336    hub: &'a TagManager<C>,
28337    _request: Workspace,
28338    _parent: String,
28339    _delegate: Option<&'a mut dyn common::Delegate>,
28340    _additional_params: HashMap<String, String>,
28341    _scopes: BTreeSet<String>,
28342}
28343
28344impl<'a, C> common::CallBuilder for AccountContainerWorkspaceCreateCall<'a, C> {}
28345
28346impl<'a, C> AccountContainerWorkspaceCreateCall<'a, C>
28347where
28348    C: common::Connector,
28349{
28350    /// Perform the operation you have build so far.
28351    pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
28352        use std::borrow::Cow;
28353        use std::io::{Read, Seek};
28354
28355        use common::{url::Params, ToParts};
28356        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28357
28358        let mut dd = common::DefaultDelegate;
28359        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28360        dlg.begin(common::MethodInfo {
28361            id: "tagmanager.accounts.containers.workspaces.create",
28362            http_method: hyper::Method::POST,
28363        });
28364
28365        for &field in ["alt", "parent"].iter() {
28366            if self._additional_params.contains_key(field) {
28367                dlg.finished(false);
28368                return Err(common::Error::FieldClash(field));
28369            }
28370        }
28371
28372        let mut params = Params::with_capacity(4 + self._additional_params.len());
28373        params.push("parent", self._parent);
28374
28375        params.extend(self._additional_params.iter());
28376
28377        params.push("alt", "json");
28378        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/workspaces";
28379        if self._scopes.is_empty() {
28380            self._scopes
28381                .insert(Scope::EditContainer.as_ref().to_string());
28382        }
28383
28384        #[allow(clippy::single_element_loop)]
28385        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
28386            url = params.uri_replacement(url, param_name, find_this, true);
28387        }
28388        {
28389            let to_remove = ["parent"];
28390            params.remove_params(&to_remove);
28391        }
28392
28393        let url = params.parse_with_url(&url);
28394
28395        let mut json_mime_type = mime::APPLICATION_JSON;
28396        let mut request_value_reader = {
28397            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28398            common::remove_json_null_values(&mut value);
28399            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28400            serde_json::to_writer(&mut dst, &value).unwrap();
28401            dst
28402        };
28403        let request_size = request_value_reader
28404            .seek(std::io::SeekFrom::End(0))
28405            .unwrap();
28406        request_value_reader
28407            .seek(std::io::SeekFrom::Start(0))
28408            .unwrap();
28409
28410        loop {
28411            let token = match self
28412                .hub
28413                .auth
28414                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28415                .await
28416            {
28417                Ok(token) => token,
28418                Err(e) => match dlg.token(e) {
28419                    Ok(token) => token,
28420                    Err(e) => {
28421                        dlg.finished(false);
28422                        return Err(common::Error::MissingToken(e));
28423                    }
28424                },
28425            };
28426            request_value_reader
28427                .seek(std::io::SeekFrom::Start(0))
28428                .unwrap();
28429            let mut req_result = {
28430                let client = &self.hub.client;
28431                dlg.pre_request();
28432                let mut req_builder = hyper::Request::builder()
28433                    .method(hyper::Method::POST)
28434                    .uri(url.as_str())
28435                    .header(USER_AGENT, self.hub._user_agent.clone());
28436
28437                if let Some(token) = token.as_ref() {
28438                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28439                }
28440
28441                let request = req_builder
28442                    .header(CONTENT_TYPE, json_mime_type.to_string())
28443                    .header(CONTENT_LENGTH, request_size as u64)
28444                    .body(common::to_body(
28445                        request_value_reader.get_ref().clone().into(),
28446                    ));
28447
28448                client.request(request.unwrap()).await
28449            };
28450
28451            match req_result {
28452                Err(err) => {
28453                    if let common::Retry::After(d) = dlg.http_error(&err) {
28454                        sleep(d).await;
28455                        continue;
28456                    }
28457                    dlg.finished(false);
28458                    return Err(common::Error::HttpError(err));
28459                }
28460                Ok(res) => {
28461                    let (mut parts, body) = res.into_parts();
28462                    let mut body = common::Body::new(body);
28463                    if !parts.status.is_success() {
28464                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28465                        let error = serde_json::from_str(&common::to_string(&bytes));
28466                        let response = common::to_response(parts, bytes.into());
28467
28468                        if let common::Retry::After(d) =
28469                            dlg.http_failure(&response, error.as_ref().ok())
28470                        {
28471                            sleep(d).await;
28472                            continue;
28473                        }
28474
28475                        dlg.finished(false);
28476
28477                        return Err(match error {
28478                            Ok(value) => common::Error::BadRequest(value),
28479                            _ => common::Error::Failure(response),
28480                        });
28481                    }
28482                    let response = {
28483                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28484                        let encoded = common::to_string(&bytes);
28485                        match serde_json::from_str(&encoded) {
28486                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28487                            Err(error) => {
28488                                dlg.response_json_decode_error(&encoded, &error);
28489                                return Err(common::Error::JsonDecodeError(
28490                                    encoded.to_string(),
28491                                    error,
28492                                ));
28493                            }
28494                        }
28495                    };
28496
28497                    dlg.finished(true);
28498                    return Ok(response);
28499                }
28500            }
28501        }
28502    }
28503
28504    ///
28505    /// Sets the *request* property to the given value.
28506    ///
28507    /// Even though the property as already been set when instantiating this call,
28508    /// we provide this method for API completeness.
28509    pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceCreateCall<'a, C> {
28510        self._request = new_value;
28511        self
28512    }
28513    /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
28514    ///
28515    /// Sets the *parent* path property to the given value.
28516    ///
28517    /// Even though the property as already been set when instantiating this call,
28518    /// we provide this method for API completeness.
28519    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceCreateCall<'a, C> {
28520        self._parent = new_value.to_string();
28521        self
28522    }
28523    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28524    /// while executing the actual API request.
28525    ///
28526    /// ````text
28527    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28528    /// ````
28529    ///
28530    /// Sets the *delegate* property to the given value.
28531    pub fn delegate(
28532        mut self,
28533        new_value: &'a mut dyn common::Delegate,
28534    ) -> AccountContainerWorkspaceCreateCall<'a, C> {
28535        self._delegate = Some(new_value);
28536        self
28537    }
28538
28539    /// Set any additional parameter of the query string used in the request.
28540    /// It should be used to set parameters which are not yet available through their own
28541    /// setters.
28542    ///
28543    /// Please note that this method must not be used to set any of the known parameters
28544    /// which have their own setter method. If done anyway, the request will fail.
28545    ///
28546    /// # Additional Parameters
28547    ///
28548    /// * *$.xgafv* (query-string) - V1 error format.
28549    /// * *access_token* (query-string) - OAuth access token.
28550    /// * *alt* (query-string) - Data format for response.
28551    /// * *callback* (query-string) - JSONP
28552    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28553    /// * *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.
28554    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28555    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28556    /// * *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.
28557    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28558    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28559    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceCreateCall<'a, C>
28560    where
28561        T: AsRef<str>,
28562    {
28563        self._additional_params
28564            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28565        self
28566    }
28567
28568    /// Identifies the authorization scope for the method you are building.
28569    ///
28570    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28571    /// [`Scope::EditContainer`].
28572    ///
28573    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28574    /// tokens for more than one scope.
28575    ///
28576    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28577    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28578    /// sufficient, a read-write scope will do as well.
28579    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceCreateCall<'a, C>
28580    where
28581        St: AsRef<str>,
28582    {
28583        self._scopes.insert(String::from(scope.as_ref()));
28584        self
28585    }
28586    /// Identifies the authorization scope(s) for the method you are building.
28587    ///
28588    /// See [`Self::add_scope()`] for details.
28589    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceCreateCall<'a, C>
28590    where
28591        I: IntoIterator<Item = St>,
28592        St: AsRef<str>,
28593    {
28594        self._scopes
28595            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28596        self
28597    }
28598
28599    /// Removes all scopes, and no default scope will be used either.
28600    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28601    /// for details).
28602    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceCreateCall<'a, C> {
28603        self._scopes.clear();
28604        self
28605    }
28606}
28607
28608/// Creates a Container Version from the entities present in the workspace, deletes the workspace, and sets the base container version to the newly created version.
28609///
28610/// A builder for the *containers.workspaces.create_version* method supported by a *account* resource.
28611/// It is not used directly, but through a [`AccountMethods`] instance.
28612///
28613/// # Example
28614///
28615/// Instantiate a resource method builder
28616///
28617/// ```test_harness,no_run
28618/// # extern crate hyper;
28619/// # extern crate hyper_rustls;
28620/// # extern crate google_tagmanager2 as tagmanager2;
28621/// use tagmanager2::api::CreateContainerVersionRequestVersionOptions;
28622/// # async fn dox() {
28623/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28624///
28625/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28626/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28627/// #     secret,
28628/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28629/// # ).build().await.unwrap();
28630///
28631/// # let client = hyper_util::client::legacy::Client::builder(
28632/// #     hyper_util::rt::TokioExecutor::new()
28633/// # )
28634/// # .build(
28635/// #     hyper_rustls::HttpsConnectorBuilder::new()
28636/// #         .with_native_roots()
28637/// #         .unwrap()
28638/// #         .https_or_http()
28639/// #         .enable_http1()
28640/// #         .build()
28641/// # );
28642/// # let mut hub = TagManager::new(client, auth);
28643/// // As the method needs a request, you would usually fill it with the desired information
28644/// // into the respective structure. Some of the parts shown here might not be applicable !
28645/// // Values shown here are possibly random and not representative !
28646/// let mut req = CreateContainerVersionRequestVersionOptions::default();
28647///
28648/// // You can configure optional parameters by calling the respective setters at will, and
28649/// // execute the final call using `doit()`.
28650/// // Values shown here are possibly random and not representative !
28651/// let result = hub.accounts().containers_workspaces_create_version(req, "path")
28652///              .doit().await;
28653/// # }
28654/// ```
28655pub struct AccountContainerWorkspaceCreateVersionCall<'a, C>
28656where
28657    C: 'a,
28658{
28659    hub: &'a TagManager<C>,
28660    _request: CreateContainerVersionRequestVersionOptions,
28661    _path: String,
28662    _delegate: Option<&'a mut dyn common::Delegate>,
28663    _additional_params: HashMap<String, String>,
28664    _scopes: BTreeSet<String>,
28665}
28666
28667impl<'a, C> common::CallBuilder for AccountContainerWorkspaceCreateVersionCall<'a, C> {}
28668
28669impl<'a, C> AccountContainerWorkspaceCreateVersionCall<'a, C>
28670where
28671    C: common::Connector,
28672{
28673    /// Perform the operation you have build so far.
28674    pub async fn doit(
28675        mut self,
28676    ) -> common::Result<(common::Response, CreateContainerVersionResponse)> {
28677        use std::borrow::Cow;
28678        use std::io::{Read, Seek};
28679
28680        use common::{url::Params, ToParts};
28681        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28682
28683        let mut dd = common::DefaultDelegate;
28684        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28685        dlg.begin(common::MethodInfo {
28686            id: "tagmanager.accounts.containers.workspaces.create_version",
28687            http_method: hyper::Method::POST,
28688        });
28689
28690        for &field in ["alt", "path"].iter() {
28691            if self._additional_params.contains_key(field) {
28692                dlg.finished(false);
28693                return Err(common::Error::FieldClash(field));
28694            }
28695        }
28696
28697        let mut params = Params::with_capacity(4 + self._additional_params.len());
28698        params.push("path", self._path);
28699
28700        params.extend(self._additional_params.iter());
28701
28702        params.push("alt", "json");
28703        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:create_version";
28704        if self._scopes.is_empty() {
28705            self._scopes
28706                .insert(Scope::EditContainerversion.as_ref().to_string());
28707        }
28708
28709        #[allow(clippy::single_element_loop)]
28710        for &(find_this, param_name) in [("{+path}", "path")].iter() {
28711            url = params.uri_replacement(url, param_name, find_this, true);
28712        }
28713        {
28714            let to_remove = ["path"];
28715            params.remove_params(&to_remove);
28716        }
28717
28718        let url = params.parse_with_url(&url);
28719
28720        let mut json_mime_type = mime::APPLICATION_JSON;
28721        let mut request_value_reader = {
28722            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28723            common::remove_json_null_values(&mut value);
28724            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28725            serde_json::to_writer(&mut dst, &value).unwrap();
28726            dst
28727        };
28728        let request_size = request_value_reader
28729            .seek(std::io::SeekFrom::End(0))
28730            .unwrap();
28731        request_value_reader
28732            .seek(std::io::SeekFrom::Start(0))
28733            .unwrap();
28734
28735        loop {
28736            let token = match self
28737                .hub
28738                .auth
28739                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28740                .await
28741            {
28742                Ok(token) => token,
28743                Err(e) => match dlg.token(e) {
28744                    Ok(token) => token,
28745                    Err(e) => {
28746                        dlg.finished(false);
28747                        return Err(common::Error::MissingToken(e));
28748                    }
28749                },
28750            };
28751            request_value_reader
28752                .seek(std::io::SeekFrom::Start(0))
28753                .unwrap();
28754            let mut req_result = {
28755                let client = &self.hub.client;
28756                dlg.pre_request();
28757                let mut req_builder = hyper::Request::builder()
28758                    .method(hyper::Method::POST)
28759                    .uri(url.as_str())
28760                    .header(USER_AGENT, self.hub._user_agent.clone());
28761
28762                if let Some(token) = token.as_ref() {
28763                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28764                }
28765
28766                let request = req_builder
28767                    .header(CONTENT_TYPE, json_mime_type.to_string())
28768                    .header(CONTENT_LENGTH, request_size as u64)
28769                    .body(common::to_body(
28770                        request_value_reader.get_ref().clone().into(),
28771                    ));
28772
28773                client.request(request.unwrap()).await
28774            };
28775
28776            match req_result {
28777                Err(err) => {
28778                    if let common::Retry::After(d) = dlg.http_error(&err) {
28779                        sleep(d).await;
28780                        continue;
28781                    }
28782                    dlg.finished(false);
28783                    return Err(common::Error::HttpError(err));
28784                }
28785                Ok(res) => {
28786                    let (mut parts, body) = res.into_parts();
28787                    let mut body = common::Body::new(body);
28788                    if !parts.status.is_success() {
28789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28790                        let error = serde_json::from_str(&common::to_string(&bytes));
28791                        let response = common::to_response(parts, bytes.into());
28792
28793                        if let common::Retry::After(d) =
28794                            dlg.http_failure(&response, error.as_ref().ok())
28795                        {
28796                            sleep(d).await;
28797                            continue;
28798                        }
28799
28800                        dlg.finished(false);
28801
28802                        return Err(match error {
28803                            Ok(value) => common::Error::BadRequest(value),
28804                            _ => common::Error::Failure(response),
28805                        });
28806                    }
28807                    let response = {
28808                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28809                        let encoded = common::to_string(&bytes);
28810                        match serde_json::from_str(&encoded) {
28811                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28812                            Err(error) => {
28813                                dlg.response_json_decode_error(&encoded, &error);
28814                                return Err(common::Error::JsonDecodeError(
28815                                    encoded.to_string(),
28816                                    error,
28817                                ));
28818                            }
28819                        }
28820                    };
28821
28822                    dlg.finished(true);
28823                    return Ok(response);
28824                }
28825            }
28826        }
28827    }
28828
28829    ///
28830    /// Sets the *request* property to the given value.
28831    ///
28832    /// Even though the property as already been set when instantiating this call,
28833    /// we provide this method for API completeness.
28834    pub fn request(
28835        mut self,
28836        new_value: CreateContainerVersionRequestVersionOptions,
28837    ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
28838        self._request = new_value;
28839        self
28840    }
28841    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
28842    ///
28843    /// Sets the *path* path property to the given value.
28844    ///
28845    /// Even though the property as already been set when instantiating this call,
28846    /// we provide this method for API completeness.
28847    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
28848        self._path = new_value.to_string();
28849        self
28850    }
28851    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28852    /// while executing the actual API request.
28853    ///
28854    /// ````text
28855    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28856    /// ````
28857    ///
28858    /// Sets the *delegate* property to the given value.
28859    pub fn delegate(
28860        mut self,
28861        new_value: &'a mut dyn common::Delegate,
28862    ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
28863        self._delegate = Some(new_value);
28864        self
28865    }
28866
28867    /// Set any additional parameter of the query string used in the request.
28868    /// It should be used to set parameters which are not yet available through their own
28869    /// setters.
28870    ///
28871    /// Please note that this method must not be used to set any of the known parameters
28872    /// which have their own setter method. If done anyway, the request will fail.
28873    ///
28874    /// # Additional Parameters
28875    ///
28876    /// * *$.xgafv* (query-string) - V1 error format.
28877    /// * *access_token* (query-string) - OAuth access token.
28878    /// * *alt* (query-string) - Data format for response.
28879    /// * *callback* (query-string) - JSONP
28880    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28881    /// * *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.
28882    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28883    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28884    /// * *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.
28885    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28886    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28887    pub fn param<T>(
28888        mut self,
28889        name: T,
28890        value: T,
28891    ) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
28892    where
28893        T: AsRef<str>,
28894    {
28895        self._additional_params
28896            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28897        self
28898    }
28899
28900    /// Identifies the authorization scope for the method you are building.
28901    ///
28902    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28903    /// [`Scope::EditContainerversion`].
28904    ///
28905    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28906    /// tokens for more than one scope.
28907    ///
28908    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28909    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28910    /// sufficient, a read-write scope will do as well.
28911    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
28912    where
28913        St: AsRef<str>,
28914    {
28915        self._scopes.insert(String::from(scope.as_ref()));
28916        self
28917    }
28918    /// Identifies the authorization scope(s) for the method you are building.
28919    ///
28920    /// See [`Self::add_scope()`] for details.
28921    pub fn add_scopes<I, St>(
28922        mut self,
28923        scopes: I,
28924    ) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
28925    where
28926        I: IntoIterator<Item = St>,
28927        St: AsRef<str>,
28928    {
28929        self._scopes
28930            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28931        self
28932    }
28933
28934    /// Removes all scopes, and no default scope will be used either.
28935    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28936    /// for details).
28937    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
28938        self._scopes.clear();
28939        self
28940    }
28941}
28942
28943/// Deletes a Workspace.
28944///
28945/// A builder for the *containers.workspaces.delete* method supported by a *account* resource.
28946/// It is not used directly, but through a [`AccountMethods`] instance.
28947///
28948/// # Example
28949///
28950/// Instantiate a resource method builder
28951///
28952/// ```test_harness,no_run
28953/// # extern crate hyper;
28954/// # extern crate hyper_rustls;
28955/// # extern crate google_tagmanager2 as tagmanager2;
28956/// # async fn dox() {
28957/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28958///
28959/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28960/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28961/// #     secret,
28962/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28963/// # ).build().await.unwrap();
28964///
28965/// # let client = hyper_util::client::legacy::Client::builder(
28966/// #     hyper_util::rt::TokioExecutor::new()
28967/// # )
28968/// # .build(
28969/// #     hyper_rustls::HttpsConnectorBuilder::new()
28970/// #         .with_native_roots()
28971/// #         .unwrap()
28972/// #         .https_or_http()
28973/// #         .enable_http1()
28974/// #         .build()
28975/// # );
28976/// # let mut hub = TagManager::new(client, auth);
28977/// // You can configure optional parameters by calling the respective setters at will, and
28978/// // execute the final call using `doit()`.
28979/// // Values shown here are possibly random and not representative !
28980/// let result = hub.accounts().containers_workspaces_delete("path")
28981///              .doit().await;
28982/// # }
28983/// ```
28984pub struct AccountContainerWorkspaceDeleteCall<'a, C>
28985where
28986    C: 'a,
28987{
28988    hub: &'a TagManager<C>,
28989    _path: String,
28990    _delegate: Option<&'a mut dyn common::Delegate>,
28991    _additional_params: HashMap<String, String>,
28992    _scopes: BTreeSet<String>,
28993}
28994
28995impl<'a, C> common::CallBuilder for AccountContainerWorkspaceDeleteCall<'a, C> {}
28996
28997impl<'a, C> AccountContainerWorkspaceDeleteCall<'a, C>
28998where
28999    C: common::Connector,
29000{
29001    /// Perform the operation you have build so far.
29002    pub async fn doit(mut self) -> common::Result<common::Response> {
29003        use std::borrow::Cow;
29004        use std::io::{Read, Seek};
29005
29006        use common::{url::Params, ToParts};
29007        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29008
29009        let mut dd = common::DefaultDelegate;
29010        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29011        dlg.begin(common::MethodInfo {
29012            id: "tagmanager.accounts.containers.workspaces.delete",
29013            http_method: hyper::Method::DELETE,
29014        });
29015
29016        for &field in ["path"].iter() {
29017            if self._additional_params.contains_key(field) {
29018                dlg.finished(false);
29019                return Err(common::Error::FieldClash(field));
29020            }
29021        }
29022
29023        let mut params = Params::with_capacity(2 + self._additional_params.len());
29024        params.push("path", self._path);
29025
29026        params.extend(self._additional_params.iter());
29027
29028        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
29029        if self._scopes.is_empty() {
29030            self._scopes
29031                .insert(Scope::DeleteContainer.as_ref().to_string());
29032        }
29033
29034        #[allow(clippy::single_element_loop)]
29035        for &(find_this, param_name) in [("{+path}", "path")].iter() {
29036            url = params.uri_replacement(url, param_name, find_this, true);
29037        }
29038        {
29039            let to_remove = ["path"];
29040            params.remove_params(&to_remove);
29041        }
29042
29043        let url = params.parse_with_url(&url);
29044
29045        loop {
29046            let token = match self
29047                .hub
29048                .auth
29049                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29050                .await
29051            {
29052                Ok(token) => token,
29053                Err(e) => match dlg.token(e) {
29054                    Ok(token) => token,
29055                    Err(e) => {
29056                        dlg.finished(false);
29057                        return Err(common::Error::MissingToken(e));
29058                    }
29059                },
29060            };
29061            let mut req_result = {
29062                let client = &self.hub.client;
29063                dlg.pre_request();
29064                let mut req_builder = hyper::Request::builder()
29065                    .method(hyper::Method::DELETE)
29066                    .uri(url.as_str())
29067                    .header(USER_AGENT, self.hub._user_agent.clone());
29068
29069                if let Some(token) = token.as_ref() {
29070                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29071                }
29072
29073                let request = req_builder
29074                    .header(CONTENT_LENGTH, 0_u64)
29075                    .body(common::to_body::<String>(None));
29076
29077                client.request(request.unwrap()).await
29078            };
29079
29080            match req_result {
29081                Err(err) => {
29082                    if let common::Retry::After(d) = dlg.http_error(&err) {
29083                        sleep(d).await;
29084                        continue;
29085                    }
29086                    dlg.finished(false);
29087                    return Err(common::Error::HttpError(err));
29088                }
29089                Ok(res) => {
29090                    let (mut parts, body) = res.into_parts();
29091                    let mut body = common::Body::new(body);
29092                    if !parts.status.is_success() {
29093                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29094                        let error = serde_json::from_str(&common::to_string(&bytes));
29095                        let response = common::to_response(parts, bytes.into());
29096
29097                        if let common::Retry::After(d) =
29098                            dlg.http_failure(&response, error.as_ref().ok())
29099                        {
29100                            sleep(d).await;
29101                            continue;
29102                        }
29103
29104                        dlg.finished(false);
29105
29106                        return Err(match error {
29107                            Ok(value) => common::Error::BadRequest(value),
29108                            _ => common::Error::Failure(response),
29109                        });
29110                    }
29111                    let response = common::Response::from_parts(parts, body);
29112
29113                    dlg.finished(true);
29114                    return Ok(response);
29115                }
29116            }
29117        }
29118    }
29119
29120    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
29121    ///
29122    /// Sets the *path* path property to the given value.
29123    ///
29124    /// Even though the property as already been set when instantiating this call,
29125    /// we provide this method for API completeness.
29126    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceDeleteCall<'a, C> {
29127        self._path = new_value.to_string();
29128        self
29129    }
29130    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29131    /// while executing the actual API request.
29132    ///
29133    /// ````text
29134    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29135    /// ````
29136    ///
29137    /// Sets the *delegate* property to the given value.
29138    pub fn delegate(
29139        mut self,
29140        new_value: &'a mut dyn common::Delegate,
29141    ) -> AccountContainerWorkspaceDeleteCall<'a, C> {
29142        self._delegate = Some(new_value);
29143        self
29144    }
29145
29146    /// Set any additional parameter of the query string used in the request.
29147    /// It should be used to set parameters which are not yet available through their own
29148    /// setters.
29149    ///
29150    /// Please note that this method must not be used to set any of the known parameters
29151    /// which have their own setter method. If done anyway, the request will fail.
29152    ///
29153    /// # Additional Parameters
29154    ///
29155    /// * *$.xgafv* (query-string) - V1 error format.
29156    /// * *access_token* (query-string) - OAuth access token.
29157    /// * *alt* (query-string) - Data format for response.
29158    /// * *callback* (query-string) - JSONP
29159    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29160    /// * *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.
29161    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29162    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29163    /// * *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.
29164    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29165    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29166    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceDeleteCall<'a, C>
29167    where
29168        T: AsRef<str>,
29169    {
29170        self._additional_params
29171            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29172        self
29173    }
29174
29175    /// Identifies the authorization scope for the method you are building.
29176    ///
29177    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29178    /// [`Scope::DeleteContainer`].
29179    ///
29180    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29181    /// tokens for more than one scope.
29182    ///
29183    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29184    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29185    /// sufficient, a read-write scope will do as well.
29186    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceDeleteCall<'a, C>
29187    where
29188        St: AsRef<str>,
29189    {
29190        self._scopes.insert(String::from(scope.as_ref()));
29191        self
29192    }
29193    /// Identifies the authorization scope(s) for the method you are building.
29194    ///
29195    /// See [`Self::add_scope()`] for details.
29196    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceDeleteCall<'a, C>
29197    where
29198        I: IntoIterator<Item = St>,
29199        St: AsRef<str>,
29200    {
29201        self._scopes
29202            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29203        self
29204    }
29205
29206    /// Removes all scopes, and no default scope will be used either.
29207    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29208    /// for details).
29209    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceDeleteCall<'a, C> {
29210        self._scopes.clear();
29211        self
29212    }
29213}
29214
29215/// Gets a Workspace.
29216///
29217/// A builder for the *containers.workspaces.get* method supported by a *account* resource.
29218/// It is not used directly, but through a [`AccountMethods`] instance.
29219///
29220/// # Example
29221///
29222/// Instantiate a resource method builder
29223///
29224/// ```test_harness,no_run
29225/// # extern crate hyper;
29226/// # extern crate hyper_rustls;
29227/// # extern crate google_tagmanager2 as tagmanager2;
29228/// # async fn dox() {
29229/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29230///
29231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29232/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29233/// #     secret,
29234/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29235/// # ).build().await.unwrap();
29236///
29237/// # let client = hyper_util::client::legacy::Client::builder(
29238/// #     hyper_util::rt::TokioExecutor::new()
29239/// # )
29240/// # .build(
29241/// #     hyper_rustls::HttpsConnectorBuilder::new()
29242/// #         .with_native_roots()
29243/// #         .unwrap()
29244/// #         .https_or_http()
29245/// #         .enable_http1()
29246/// #         .build()
29247/// # );
29248/// # let mut hub = TagManager::new(client, auth);
29249/// // You can configure optional parameters by calling the respective setters at will, and
29250/// // execute the final call using `doit()`.
29251/// // Values shown here are possibly random and not representative !
29252/// let result = hub.accounts().containers_workspaces_get("path")
29253///              .doit().await;
29254/// # }
29255/// ```
29256pub struct AccountContainerWorkspaceGetCall<'a, C>
29257where
29258    C: 'a,
29259{
29260    hub: &'a TagManager<C>,
29261    _path: String,
29262    _delegate: Option<&'a mut dyn common::Delegate>,
29263    _additional_params: HashMap<String, String>,
29264    _scopes: BTreeSet<String>,
29265}
29266
29267impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGetCall<'a, C> {}
29268
29269impl<'a, C> AccountContainerWorkspaceGetCall<'a, C>
29270where
29271    C: common::Connector,
29272{
29273    /// Perform the operation you have build so far.
29274    pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
29275        use std::borrow::Cow;
29276        use std::io::{Read, Seek};
29277
29278        use common::{url::Params, ToParts};
29279        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29280
29281        let mut dd = common::DefaultDelegate;
29282        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29283        dlg.begin(common::MethodInfo {
29284            id: "tagmanager.accounts.containers.workspaces.get",
29285            http_method: hyper::Method::GET,
29286        });
29287
29288        for &field in ["alt", "path"].iter() {
29289            if self._additional_params.contains_key(field) {
29290                dlg.finished(false);
29291                return Err(common::Error::FieldClash(field));
29292            }
29293        }
29294
29295        let mut params = Params::with_capacity(3 + self._additional_params.len());
29296        params.push("path", self._path);
29297
29298        params.extend(self._additional_params.iter());
29299
29300        params.push("alt", "json");
29301        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
29302        if self._scopes.is_empty() {
29303            self._scopes.insert(Scope::Readonly.as_ref().to_string());
29304        }
29305
29306        #[allow(clippy::single_element_loop)]
29307        for &(find_this, param_name) in [("{+path}", "path")].iter() {
29308            url = params.uri_replacement(url, param_name, find_this, true);
29309        }
29310        {
29311            let to_remove = ["path"];
29312            params.remove_params(&to_remove);
29313        }
29314
29315        let url = params.parse_with_url(&url);
29316
29317        loop {
29318            let token = match self
29319                .hub
29320                .auth
29321                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29322                .await
29323            {
29324                Ok(token) => token,
29325                Err(e) => match dlg.token(e) {
29326                    Ok(token) => token,
29327                    Err(e) => {
29328                        dlg.finished(false);
29329                        return Err(common::Error::MissingToken(e));
29330                    }
29331                },
29332            };
29333            let mut req_result = {
29334                let client = &self.hub.client;
29335                dlg.pre_request();
29336                let mut req_builder = hyper::Request::builder()
29337                    .method(hyper::Method::GET)
29338                    .uri(url.as_str())
29339                    .header(USER_AGENT, self.hub._user_agent.clone());
29340
29341                if let Some(token) = token.as_ref() {
29342                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29343                }
29344
29345                let request = req_builder
29346                    .header(CONTENT_LENGTH, 0_u64)
29347                    .body(common::to_body::<String>(None));
29348
29349                client.request(request.unwrap()).await
29350            };
29351
29352            match req_result {
29353                Err(err) => {
29354                    if let common::Retry::After(d) = dlg.http_error(&err) {
29355                        sleep(d).await;
29356                        continue;
29357                    }
29358                    dlg.finished(false);
29359                    return Err(common::Error::HttpError(err));
29360                }
29361                Ok(res) => {
29362                    let (mut parts, body) = res.into_parts();
29363                    let mut body = common::Body::new(body);
29364                    if !parts.status.is_success() {
29365                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29366                        let error = serde_json::from_str(&common::to_string(&bytes));
29367                        let response = common::to_response(parts, bytes.into());
29368
29369                        if let common::Retry::After(d) =
29370                            dlg.http_failure(&response, error.as_ref().ok())
29371                        {
29372                            sleep(d).await;
29373                            continue;
29374                        }
29375
29376                        dlg.finished(false);
29377
29378                        return Err(match error {
29379                            Ok(value) => common::Error::BadRequest(value),
29380                            _ => common::Error::Failure(response),
29381                        });
29382                    }
29383                    let response = {
29384                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29385                        let encoded = common::to_string(&bytes);
29386                        match serde_json::from_str(&encoded) {
29387                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29388                            Err(error) => {
29389                                dlg.response_json_decode_error(&encoded, &error);
29390                                return Err(common::Error::JsonDecodeError(
29391                                    encoded.to_string(),
29392                                    error,
29393                                ));
29394                            }
29395                        }
29396                    };
29397
29398                    dlg.finished(true);
29399                    return Ok(response);
29400                }
29401            }
29402        }
29403    }
29404
29405    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
29406    ///
29407    /// Sets the *path* path property to the given value.
29408    ///
29409    /// Even though the property as already been set when instantiating this call,
29410    /// we provide this method for API completeness.
29411    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetCall<'a, C> {
29412        self._path = new_value.to_string();
29413        self
29414    }
29415    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29416    /// while executing the actual API request.
29417    ///
29418    /// ````text
29419    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29420    /// ````
29421    ///
29422    /// Sets the *delegate* property to the given value.
29423    pub fn delegate(
29424        mut self,
29425        new_value: &'a mut dyn common::Delegate,
29426    ) -> AccountContainerWorkspaceGetCall<'a, C> {
29427        self._delegate = Some(new_value);
29428        self
29429    }
29430
29431    /// Set any additional parameter of the query string used in the request.
29432    /// It should be used to set parameters which are not yet available through their own
29433    /// setters.
29434    ///
29435    /// Please note that this method must not be used to set any of the known parameters
29436    /// which have their own setter method. If done anyway, the request will fail.
29437    ///
29438    /// # Additional Parameters
29439    ///
29440    /// * *$.xgafv* (query-string) - V1 error format.
29441    /// * *access_token* (query-string) - OAuth access token.
29442    /// * *alt* (query-string) - Data format for response.
29443    /// * *callback* (query-string) - JSONP
29444    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29445    /// * *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.
29446    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29447    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29448    /// * *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.
29449    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29450    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29451    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceGetCall<'a, C>
29452    where
29453        T: AsRef<str>,
29454    {
29455        self._additional_params
29456            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29457        self
29458    }
29459
29460    /// Identifies the authorization scope for the method you are building.
29461    ///
29462    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29463    /// [`Scope::Readonly`].
29464    ///
29465    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29466    /// tokens for more than one scope.
29467    ///
29468    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29469    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29470    /// sufficient, a read-write scope will do as well.
29471    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGetCall<'a, C>
29472    where
29473        St: AsRef<str>,
29474    {
29475        self._scopes.insert(String::from(scope.as_ref()));
29476        self
29477    }
29478    /// Identifies the authorization scope(s) for the method you are building.
29479    ///
29480    /// See [`Self::add_scope()`] for details.
29481    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceGetCall<'a, C>
29482    where
29483        I: IntoIterator<Item = St>,
29484        St: AsRef<str>,
29485    {
29486        self._scopes
29487            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29488        self
29489    }
29490
29491    /// Removes all scopes, and no default scope will be used either.
29492    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29493    /// for details).
29494    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGetCall<'a, C> {
29495        self._scopes.clear();
29496        self
29497    }
29498}
29499
29500/// Finds conflicting and modified entities in the workspace.
29501///
29502/// A builder for the *containers.workspaces.getStatus* method supported by a *account* resource.
29503/// It is not used directly, but through a [`AccountMethods`] instance.
29504///
29505/// # Example
29506///
29507/// Instantiate a resource method builder
29508///
29509/// ```test_harness,no_run
29510/// # extern crate hyper;
29511/// # extern crate hyper_rustls;
29512/// # extern crate google_tagmanager2 as tagmanager2;
29513/// # async fn dox() {
29514/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29515///
29516/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29517/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29518/// #     secret,
29519/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29520/// # ).build().await.unwrap();
29521///
29522/// # let client = hyper_util::client::legacy::Client::builder(
29523/// #     hyper_util::rt::TokioExecutor::new()
29524/// # )
29525/// # .build(
29526/// #     hyper_rustls::HttpsConnectorBuilder::new()
29527/// #         .with_native_roots()
29528/// #         .unwrap()
29529/// #         .https_or_http()
29530/// #         .enable_http1()
29531/// #         .build()
29532/// # );
29533/// # let mut hub = TagManager::new(client, auth);
29534/// // You can configure optional parameters by calling the respective setters at will, and
29535/// // execute the final call using `doit()`.
29536/// // Values shown here are possibly random and not representative !
29537/// let result = hub.accounts().containers_workspaces_get_status("path")
29538///              .doit().await;
29539/// # }
29540/// ```
29541pub struct AccountContainerWorkspaceGetStatuCall<'a, C>
29542where
29543    C: 'a,
29544{
29545    hub: &'a TagManager<C>,
29546    _path: String,
29547    _delegate: Option<&'a mut dyn common::Delegate>,
29548    _additional_params: HashMap<String, String>,
29549    _scopes: BTreeSet<String>,
29550}
29551
29552impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGetStatuCall<'a, C> {}
29553
29554impl<'a, C> AccountContainerWorkspaceGetStatuCall<'a, C>
29555where
29556    C: common::Connector,
29557{
29558    /// Perform the operation you have build so far.
29559    pub async fn doit(mut self) -> common::Result<(common::Response, GetWorkspaceStatusResponse)> {
29560        use std::borrow::Cow;
29561        use std::io::{Read, Seek};
29562
29563        use common::{url::Params, ToParts};
29564        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29565
29566        let mut dd = common::DefaultDelegate;
29567        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29568        dlg.begin(common::MethodInfo {
29569            id: "tagmanager.accounts.containers.workspaces.getStatus",
29570            http_method: hyper::Method::GET,
29571        });
29572
29573        for &field in ["alt", "path"].iter() {
29574            if self._additional_params.contains_key(field) {
29575                dlg.finished(false);
29576                return Err(common::Error::FieldClash(field));
29577            }
29578        }
29579
29580        let mut params = Params::with_capacity(3 + self._additional_params.len());
29581        params.push("path", self._path);
29582
29583        params.extend(self._additional_params.iter());
29584
29585        params.push("alt", "json");
29586        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}/status";
29587        if self._scopes.is_empty() {
29588            self._scopes.insert(Scope::Readonly.as_ref().to_string());
29589        }
29590
29591        #[allow(clippy::single_element_loop)]
29592        for &(find_this, param_name) in [("{+path}", "path")].iter() {
29593            url = params.uri_replacement(url, param_name, find_this, true);
29594        }
29595        {
29596            let to_remove = ["path"];
29597            params.remove_params(&to_remove);
29598        }
29599
29600        let url = params.parse_with_url(&url);
29601
29602        loop {
29603            let token = match self
29604                .hub
29605                .auth
29606                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29607                .await
29608            {
29609                Ok(token) => token,
29610                Err(e) => match dlg.token(e) {
29611                    Ok(token) => token,
29612                    Err(e) => {
29613                        dlg.finished(false);
29614                        return Err(common::Error::MissingToken(e));
29615                    }
29616                },
29617            };
29618            let mut req_result = {
29619                let client = &self.hub.client;
29620                dlg.pre_request();
29621                let mut req_builder = hyper::Request::builder()
29622                    .method(hyper::Method::GET)
29623                    .uri(url.as_str())
29624                    .header(USER_AGENT, self.hub._user_agent.clone());
29625
29626                if let Some(token) = token.as_ref() {
29627                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29628                }
29629
29630                let request = req_builder
29631                    .header(CONTENT_LENGTH, 0_u64)
29632                    .body(common::to_body::<String>(None));
29633
29634                client.request(request.unwrap()).await
29635            };
29636
29637            match req_result {
29638                Err(err) => {
29639                    if let common::Retry::After(d) = dlg.http_error(&err) {
29640                        sleep(d).await;
29641                        continue;
29642                    }
29643                    dlg.finished(false);
29644                    return Err(common::Error::HttpError(err));
29645                }
29646                Ok(res) => {
29647                    let (mut parts, body) = res.into_parts();
29648                    let mut body = common::Body::new(body);
29649                    if !parts.status.is_success() {
29650                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29651                        let error = serde_json::from_str(&common::to_string(&bytes));
29652                        let response = common::to_response(parts, bytes.into());
29653
29654                        if let common::Retry::After(d) =
29655                            dlg.http_failure(&response, error.as_ref().ok())
29656                        {
29657                            sleep(d).await;
29658                            continue;
29659                        }
29660
29661                        dlg.finished(false);
29662
29663                        return Err(match error {
29664                            Ok(value) => common::Error::BadRequest(value),
29665                            _ => common::Error::Failure(response),
29666                        });
29667                    }
29668                    let response = {
29669                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29670                        let encoded = common::to_string(&bytes);
29671                        match serde_json::from_str(&encoded) {
29672                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29673                            Err(error) => {
29674                                dlg.response_json_decode_error(&encoded, &error);
29675                                return Err(common::Error::JsonDecodeError(
29676                                    encoded.to_string(),
29677                                    error,
29678                                ));
29679                            }
29680                        }
29681                    };
29682
29683                    dlg.finished(true);
29684                    return Ok(response);
29685                }
29686            }
29687        }
29688    }
29689
29690    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
29691    ///
29692    /// Sets the *path* path property to the given value.
29693    ///
29694    /// Even though the property as already been set when instantiating this call,
29695    /// we provide this method for API completeness.
29696    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
29697        self._path = new_value.to_string();
29698        self
29699    }
29700    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29701    /// while executing the actual API request.
29702    ///
29703    /// ````text
29704    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29705    /// ````
29706    ///
29707    /// Sets the *delegate* property to the given value.
29708    pub fn delegate(
29709        mut self,
29710        new_value: &'a mut dyn common::Delegate,
29711    ) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
29712        self._delegate = Some(new_value);
29713        self
29714    }
29715
29716    /// Set any additional parameter of the query string used in the request.
29717    /// It should be used to set parameters which are not yet available through their own
29718    /// setters.
29719    ///
29720    /// Please note that this method must not be used to set any of the known parameters
29721    /// which have their own setter method. If done anyway, the request will fail.
29722    ///
29723    /// # Additional Parameters
29724    ///
29725    /// * *$.xgafv* (query-string) - V1 error format.
29726    /// * *access_token* (query-string) - OAuth access token.
29727    /// * *alt* (query-string) - Data format for response.
29728    /// * *callback* (query-string) - JSONP
29729    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29730    /// * *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.
29731    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29732    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29733    /// * *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.
29734    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29735    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29736    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceGetStatuCall<'a, C>
29737    where
29738        T: AsRef<str>,
29739    {
29740        self._additional_params
29741            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29742        self
29743    }
29744
29745    /// Identifies the authorization scope for the method you are building.
29746    ///
29747    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29748    /// [`Scope::Readonly`].
29749    ///
29750    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29751    /// tokens for more than one scope.
29752    ///
29753    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29754    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29755    /// sufficient, a read-write scope will do as well.
29756    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGetStatuCall<'a, C>
29757    where
29758        St: AsRef<str>,
29759    {
29760        self._scopes.insert(String::from(scope.as_ref()));
29761        self
29762    }
29763    /// Identifies the authorization scope(s) for the method you are building.
29764    ///
29765    /// See [`Self::add_scope()`] for details.
29766    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceGetStatuCall<'a, C>
29767    where
29768        I: IntoIterator<Item = St>,
29769        St: AsRef<str>,
29770    {
29771        self._scopes
29772            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29773        self
29774    }
29775
29776    /// Removes all scopes, and no default scope will be used either.
29777    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29778    /// for details).
29779    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
29780        self._scopes.clear();
29781        self
29782    }
29783}
29784
29785/// Lists all Workspaces that belong to a GTM Container.
29786///
29787/// A builder for the *containers.workspaces.list* method supported by a *account* resource.
29788/// It is not used directly, but through a [`AccountMethods`] instance.
29789///
29790/// # Example
29791///
29792/// Instantiate a resource method builder
29793///
29794/// ```test_harness,no_run
29795/// # extern crate hyper;
29796/// # extern crate hyper_rustls;
29797/// # extern crate google_tagmanager2 as tagmanager2;
29798/// # async fn dox() {
29799/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29800///
29801/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29802/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29803/// #     secret,
29804/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29805/// # ).build().await.unwrap();
29806///
29807/// # let client = hyper_util::client::legacy::Client::builder(
29808/// #     hyper_util::rt::TokioExecutor::new()
29809/// # )
29810/// # .build(
29811/// #     hyper_rustls::HttpsConnectorBuilder::new()
29812/// #         .with_native_roots()
29813/// #         .unwrap()
29814/// #         .https_or_http()
29815/// #         .enable_http1()
29816/// #         .build()
29817/// # );
29818/// # let mut hub = TagManager::new(client, auth);
29819/// // You can configure optional parameters by calling the respective setters at will, and
29820/// // execute the final call using `doit()`.
29821/// // Values shown here are possibly random and not representative !
29822/// let result = hub.accounts().containers_workspaces_list("parent")
29823///              .page_token("eirmod")
29824///              .doit().await;
29825/// # }
29826/// ```
29827pub struct AccountContainerWorkspaceListCall<'a, C>
29828where
29829    C: 'a,
29830{
29831    hub: &'a TagManager<C>,
29832    _parent: String,
29833    _page_token: Option<String>,
29834    _delegate: Option<&'a mut dyn common::Delegate>,
29835    _additional_params: HashMap<String, String>,
29836    _scopes: BTreeSet<String>,
29837}
29838
29839impl<'a, C> common::CallBuilder for AccountContainerWorkspaceListCall<'a, C> {}
29840
29841impl<'a, C> AccountContainerWorkspaceListCall<'a, C>
29842where
29843    C: common::Connector,
29844{
29845    /// Perform the operation you have build so far.
29846    pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkspacesResponse)> {
29847        use std::borrow::Cow;
29848        use std::io::{Read, Seek};
29849
29850        use common::{url::Params, ToParts};
29851        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29852
29853        let mut dd = common::DefaultDelegate;
29854        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29855        dlg.begin(common::MethodInfo {
29856            id: "tagmanager.accounts.containers.workspaces.list",
29857            http_method: hyper::Method::GET,
29858        });
29859
29860        for &field in ["alt", "parent", "pageToken"].iter() {
29861            if self._additional_params.contains_key(field) {
29862                dlg.finished(false);
29863                return Err(common::Error::FieldClash(field));
29864            }
29865        }
29866
29867        let mut params = Params::with_capacity(4 + self._additional_params.len());
29868        params.push("parent", self._parent);
29869        if let Some(value) = self._page_token.as_ref() {
29870            params.push("pageToken", value);
29871        }
29872
29873        params.extend(self._additional_params.iter());
29874
29875        params.push("alt", "json");
29876        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/workspaces";
29877        if self._scopes.is_empty() {
29878            self._scopes.insert(Scope::Readonly.as_ref().to_string());
29879        }
29880
29881        #[allow(clippy::single_element_loop)]
29882        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
29883            url = params.uri_replacement(url, param_name, find_this, true);
29884        }
29885        {
29886            let to_remove = ["parent"];
29887            params.remove_params(&to_remove);
29888        }
29889
29890        let url = params.parse_with_url(&url);
29891
29892        loop {
29893            let token = match self
29894                .hub
29895                .auth
29896                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29897                .await
29898            {
29899                Ok(token) => token,
29900                Err(e) => match dlg.token(e) {
29901                    Ok(token) => token,
29902                    Err(e) => {
29903                        dlg.finished(false);
29904                        return Err(common::Error::MissingToken(e));
29905                    }
29906                },
29907            };
29908            let mut req_result = {
29909                let client = &self.hub.client;
29910                dlg.pre_request();
29911                let mut req_builder = hyper::Request::builder()
29912                    .method(hyper::Method::GET)
29913                    .uri(url.as_str())
29914                    .header(USER_AGENT, self.hub._user_agent.clone());
29915
29916                if let Some(token) = token.as_ref() {
29917                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29918                }
29919
29920                let request = req_builder
29921                    .header(CONTENT_LENGTH, 0_u64)
29922                    .body(common::to_body::<String>(None));
29923
29924                client.request(request.unwrap()).await
29925            };
29926
29927            match req_result {
29928                Err(err) => {
29929                    if let common::Retry::After(d) = dlg.http_error(&err) {
29930                        sleep(d).await;
29931                        continue;
29932                    }
29933                    dlg.finished(false);
29934                    return Err(common::Error::HttpError(err));
29935                }
29936                Ok(res) => {
29937                    let (mut parts, body) = res.into_parts();
29938                    let mut body = common::Body::new(body);
29939                    if !parts.status.is_success() {
29940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29941                        let error = serde_json::from_str(&common::to_string(&bytes));
29942                        let response = common::to_response(parts, bytes.into());
29943
29944                        if let common::Retry::After(d) =
29945                            dlg.http_failure(&response, error.as_ref().ok())
29946                        {
29947                            sleep(d).await;
29948                            continue;
29949                        }
29950
29951                        dlg.finished(false);
29952
29953                        return Err(match error {
29954                            Ok(value) => common::Error::BadRequest(value),
29955                            _ => common::Error::Failure(response),
29956                        });
29957                    }
29958                    let response = {
29959                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29960                        let encoded = common::to_string(&bytes);
29961                        match serde_json::from_str(&encoded) {
29962                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29963                            Err(error) => {
29964                                dlg.response_json_decode_error(&encoded, &error);
29965                                return Err(common::Error::JsonDecodeError(
29966                                    encoded.to_string(),
29967                                    error,
29968                                ));
29969                            }
29970                        }
29971                    };
29972
29973                    dlg.finished(true);
29974                    return Ok(response);
29975                }
29976            }
29977        }
29978    }
29979
29980    /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
29981    ///
29982    /// Sets the *parent* path property to the given value.
29983    ///
29984    /// Even though the property as already been set when instantiating this call,
29985    /// we provide this method for API completeness.
29986    pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceListCall<'a, C> {
29987        self._parent = new_value.to_string();
29988        self
29989    }
29990    /// Continuation token for fetching the next page of results.
29991    ///
29992    /// Sets the *page token* query property to the given value.
29993    pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceListCall<'a, C> {
29994        self._page_token = Some(new_value.to_string());
29995        self
29996    }
29997    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29998    /// while executing the actual API request.
29999    ///
30000    /// ````text
30001    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30002    /// ````
30003    ///
30004    /// Sets the *delegate* property to the given value.
30005    pub fn delegate(
30006        mut self,
30007        new_value: &'a mut dyn common::Delegate,
30008    ) -> AccountContainerWorkspaceListCall<'a, C> {
30009        self._delegate = Some(new_value);
30010        self
30011    }
30012
30013    /// Set any additional parameter of the query string used in the request.
30014    /// It should be used to set parameters which are not yet available through their own
30015    /// setters.
30016    ///
30017    /// Please note that this method must not be used to set any of the known parameters
30018    /// which have their own setter method. If done anyway, the request will fail.
30019    ///
30020    /// # Additional Parameters
30021    ///
30022    /// * *$.xgafv* (query-string) - V1 error format.
30023    /// * *access_token* (query-string) - OAuth access token.
30024    /// * *alt* (query-string) - Data format for response.
30025    /// * *callback* (query-string) - JSONP
30026    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30027    /// * *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.
30028    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30029    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30030    /// * *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.
30031    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30032    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30033    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceListCall<'a, C>
30034    where
30035        T: AsRef<str>,
30036    {
30037        self._additional_params
30038            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30039        self
30040    }
30041
30042    /// Identifies the authorization scope for the method you are building.
30043    ///
30044    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30045    /// [`Scope::Readonly`].
30046    ///
30047    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30048    /// tokens for more than one scope.
30049    ///
30050    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30051    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30052    /// sufficient, a read-write scope will do as well.
30053    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceListCall<'a, C>
30054    where
30055        St: AsRef<str>,
30056    {
30057        self._scopes.insert(String::from(scope.as_ref()));
30058        self
30059    }
30060    /// Identifies the authorization scope(s) for the method you are building.
30061    ///
30062    /// See [`Self::add_scope()`] for details.
30063    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceListCall<'a, C>
30064    where
30065        I: IntoIterator<Item = St>,
30066        St: AsRef<str>,
30067    {
30068        self._scopes
30069            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30070        self
30071    }
30072
30073    /// Removes all scopes, and no default scope will be used either.
30074    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30075    /// for details).
30076    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceListCall<'a, C> {
30077        self._scopes.clear();
30078        self
30079    }
30080}
30081
30082/// Quick previews a workspace by creating a fake container version from all entities in the provided workspace.
30083///
30084/// A builder for the *containers.workspaces.quick_preview* method supported by a *account* resource.
30085/// It is not used directly, but through a [`AccountMethods`] instance.
30086///
30087/// # Example
30088///
30089/// Instantiate a resource method builder
30090///
30091/// ```test_harness,no_run
30092/// # extern crate hyper;
30093/// # extern crate hyper_rustls;
30094/// # extern crate google_tagmanager2 as tagmanager2;
30095/// # async fn dox() {
30096/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30097///
30098/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30099/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30100/// #     secret,
30101/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30102/// # ).build().await.unwrap();
30103///
30104/// # let client = hyper_util::client::legacy::Client::builder(
30105/// #     hyper_util::rt::TokioExecutor::new()
30106/// # )
30107/// # .build(
30108/// #     hyper_rustls::HttpsConnectorBuilder::new()
30109/// #         .with_native_roots()
30110/// #         .unwrap()
30111/// #         .https_or_http()
30112/// #         .enable_http1()
30113/// #         .build()
30114/// # );
30115/// # let mut hub = TagManager::new(client, auth);
30116/// // You can configure optional parameters by calling the respective setters at will, and
30117/// // execute the final call using `doit()`.
30118/// // Values shown here are possibly random and not representative !
30119/// let result = hub.accounts().containers_workspaces_quick_preview("path")
30120///              .doit().await;
30121/// # }
30122/// ```
30123pub struct AccountContainerWorkspaceQuickPreviewCall<'a, C>
30124where
30125    C: 'a,
30126{
30127    hub: &'a TagManager<C>,
30128    _path: String,
30129    _delegate: Option<&'a mut dyn common::Delegate>,
30130    _additional_params: HashMap<String, String>,
30131    _scopes: BTreeSet<String>,
30132}
30133
30134impl<'a, C> common::CallBuilder for AccountContainerWorkspaceQuickPreviewCall<'a, C> {}
30135
30136impl<'a, C> AccountContainerWorkspaceQuickPreviewCall<'a, C>
30137where
30138    C: common::Connector,
30139{
30140    /// Perform the operation you have build so far.
30141    pub async fn doit(mut self) -> common::Result<(common::Response, QuickPreviewResponse)> {
30142        use std::borrow::Cow;
30143        use std::io::{Read, Seek};
30144
30145        use common::{url::Params, ToParts};
30146        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30147
30148        let mut dd = common::DefaultDelegate;
30149        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30150        dlg.begin(common::MethodInfo {
30151            id: "tagmanager.accounts.containers.workspaces.quick_preview",
30152            http_method: hyper::Method::POST,
30153        });
30154
30155        for &field in ["alt", "path"].iter() {
30156            if self._additional_params.contains_key(field) {
30157                dlg.finished(false);
30158                return Err(common::Error::FieldClash(field));
30159            }
30160        }
30161
30162        let mut params = Params::with_capacity(3 + self._additional_params.len());
30163        params.push("path", self._path);
30164
30165        params.extend(self._additional_params.iter());
30166
30167        params.push("alt", "json");
30168        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:quick_preview";
30169        if self._scopes.is_empty() {
30170            self._scopes
30171                .insert(Scope::EditContainerversion.as_ref().to_string());
30172        }
30173
30174        #[allow(clippy::single_element_loop)]
30175        for &(find_this, param_name) in [("{+path}", "path")].iter() {
30176            url = params.uri_replacement(url, param_name, find_this, true);
30177        }
30178        {
30179            let to_remove = ["path"];
30180            params.remove_params(&to_remove);
30181        }
30182
30183        let url = params.parse_with_url(&url);
30184
30185        loop {
30186            let token = match self
30187                .hub
30188                .auth
30189                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30190                .await
30191            {
30192                Ok(token) => token,
30193                Err(e) => match dlg.token(e) {
30194                    Ok(token) => token,
30195                    Err(e) => {
30196                        dlg.finished(false);
30197                        return Err(common::Error::MissingToken(e));
30198                    }
30199                },
30200            };
30201            let mut req_result = {
30202                let client = &self.hub.client;
30203                dlg.pre_request();
30204                let mut req_builder = hyper::Request::builder()
30205                    .method(hyper::Method::POST)
30206                    .uri(url.as_str())
30207                    .header(USER_AGENT, self.hub._user_agent.clone());
30208
30209                if let Some(token) = token.as_ref() {
30210                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30211                }
30212
30213                let request = req_builder
30214                    .header(CONTENT_LENGTH, 0_u64)
30215                    .body(common::to_body::<String>(None));
30216
30217                client.request(request.unwrap()).await
30218            };
30219
30220            match req_result {
30221                Err(err) => {
30222                    if let common::Retry::After(d) = dlg.http_error(&err) {
30223                        sleep(d).await;
30224                        continue;
30225                    }
30226                    dlg.finished(false);
30227                    return Err(common::Error::HttpError(err));
30228                }
30229                Ok(res) => {
30230                    let (mut parts, body) = res.into_parts();
30231                    let mut body = common::Body::new(body);
30232                    if !parts.status.is_success() {
30233                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30234                        let error = serde_json::from_str(&common::to_string(&bytes));
30235                        let response = common::to_response(parts, bytes.into());
30236
30237                        if let common::Retry::After(d) =
30238                            dlg.http_failure(&response, error.as_ref().ok())
30239                        {
30240                            sleep(d).await;
30241                            continue;
30242                        }
30243
30244                        dlg.finished(false);
30245
30246                        return Err(match error {
30247                            Ok(value) => common::Error::BadRequest(value),
30248                            _ => common::Error::Failure(response),
30249                        });
30250                    }
30251                    let response = {
30252                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30253                        let encoded = common::to_string(&bytes);
30254                        match serde_json::from_str(&encoded) {
30255                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30256                            Err(error) => {
30257                                dlg.response_json_decode_error(&encoded, &error);
30258                                return Err(common::Error::JsonDecodeError(
30259                                    encoded.to_string(),
30260                                    error,
30261                                ));
30262                            }
30263                        }
30264                    };
30265
30266                    dlg.finished(true);
30267                    return Ok(response);
30268                }
30269            }
30270        }
30271    }
30272
30273    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
30274    ///
30275    /// Sets the *path* path property to the given value.
30276    ///
30277    /// Even though the property as already been set when instantiating this call,
30278    /// we provide this method for API completeness.
30279    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
30280        self._path = new_value.to_string();
30281        self
30282    }
30283    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30284    /// while executing the actual API request.
30285    ///
30286    /// ````text
30287    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30288    /// ````
30289    ///
30290    /// Sets the *delegate* property to the given value.
30291    pub fn delegate(
30292        mut self,
30293        new_value: &'a mut dyn common::Delegate,
30294    ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
30295        self._delegate = Some(new_value);
30296        self
30297    }
30298
30299    /// Set any additional parameter of the query string used in the request.
30300    /// It should be used to set parameters which are not yet available through their own
30301    /// setters.
30302    ///
30303    /// Please note that this method must not be used to set any of the known parameters
30304    /// which have their own setter method. If done anyway, the request will fail.
30305    ///
30306    /// # Additional Parameters
30307    ///
30308    /// * *$.xgafv* (query-string) - V1 error format.
30309    /// * *access_token* (query-string) - OAuth access token.
30310    /// * *alt* (query-string) - Data format for response.
30311    /// * *callback* (query-string) - JSONP
30312    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30313    /// * *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.
30314    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30315    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30316    /// * *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.
30317    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30318    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30319    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
30320    where
30321        T: AsRef<str>,
30322    {
30323        self._additional_params
30324            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30325        self
30326    }
30327
30328    /// Identifies the authorization scope for the method you are building.
30329    ///
30330    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30331    /// [`Scope::EditContainerversion`].
30332    ///
30333    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30334    /// tokens for more than one scope.
30335    ///
30336    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30337    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30338    /// sufficient, a read-write scope will do as well.
30339    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
30340    where
30341        St: AsRef<str>,
30342    {
30343        self._scopes.insert(String::from(scope.as_ref()));
30344        self
30345    }
30346    /// Identifies the authorization scope(s) for the method you are building.
30347    ///
30348    /// See [`Self::add_scope()`] for details.
30349    pub fn add_scopes<I, St>(
30350        mut self,
30351        scopes: I,
30352    ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
30353    where
30354        I: IntoIterator<Item = St>,
30355        St: AsRef<str>,
30356    {
30357        self._scopes
30358            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30359        self
30360    }
30361
30362    /// Removes all scopes, and no default scope will be used either.
30363    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30364    /// for details).
30365    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
30366        self._scopes.clear();
30367        self
30368    }
30369}
30370
30371/// Resolves a merge conflict for a workspace entity by updating it to the resolved entity passed in the request.
30372///
30373/// A builder for the *containers.workspaces.resolve_conflict* method supported by a *account* resource.
30374/// It is not used directly, but through a [`AccountMethods`] instance.
30375///
30376/// # Example
30377///
30378/// Instantiate a resource method builder
30379///
30380/// ```test_harness,no_run
30381/// # extern crate hyper;
30382/// # extern crate hyper_rustls;
30383/// # extern crate google_tagmanager2 as tagmanager2;
30384/// use tagmanager2::api::Entity;
30385/// # async fn dox() {
30386/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30387///
30388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30390/// #     secret,
30391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30392/// # ).build().await.unwrap();
30393///
30394/// # let client = hyper_util::client::legacy::Client::builder(
30395/// #     hyper_util::rt::TokioExecutor::new()
30396/// # )
30397/// # .build(
30398/// #     hyper_rustls::HttpsConnectorBuilder::new()
30399/// #         .with_native_roots()
30400/// #         .unwrap()
30401/// #         .https_or_http()
30402/// #         .enable_http1()
30403/// #         .build()
30404/// # );
30405/// # let mut hub = TagManager::new(client, auth);
30406/// // As the method needs a request, you would usually fill it with the desired information
30407/// // into the respective structure. Some of the parts shown here might not be applicable !
30408/// // Values shown here are possibly random and not representative !
30409/// let mut req = Entity::default();
30410///
30411/// // You can configure optional parameters by calling the respective setters at will, and
30412/// // execute the final call using `doit()`.
30413/// // Values shown here are possibly random and not representative !
30414/// let result = hub.accounts().containers_workspaces_resolve_conflict(req, "path")
30415///              .fingerprint("amet")
30416///              .doit().await;
30417/// # }
30418/// ```
30419pub struct AccountContainerWorkspaceResolveConflictCall<'a, C>
30420where
30421    C: 'a,
30422{
30423    hub: &'a TagManager<C>,
30424    _request: Entity,
30425    _path: String,
30426    _fingerprint: Option<String>,
30427    _delegate: Option<&'a mut dyn common::Delegate>,
30428    _additional_params: HashMap<String, String>,
30429    _scopes: BTreeSet<String>,
30430}
30431
30432impl<'a, C> common::CallBuilder for AccountContainerWorkspaceResolveConflictCall<'a, C> {}
30433
30434impl<'a, C> AccountContainerWorkspaceResolveConflictCall<'a, C>
30435where
30436    C: common::Connector,
30437{
30438    /// Perform the operation you have build so far.
30439    pub async fn doit(mut self) -> common::Result<common::Response> {
30440        use std::borrow::Cow;
30441        use std::io::{Read, Seek};
30442
30443        use common::{url::Params, ToParts};
30444        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30445
30446        let mut dd = common::DefaultDelegate;
30447        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30448        dlg.begin(common::MethodInfo {
30449            id: "tagmanager.accounts.containers.workspaces.resolve_conflict",
30450            http_method: hyper::Method::POST,
30451        });
30452
30453        for &field in ["path", "fingerprint"].iter() {
30454            if self._additional_params.contains_key(field) {
30455                dlg.finished(false);
30456                return Err(common::Error::FieldClash(field));
30457            }
30458        }
30459
30460        let mut params = Params::with_capacity(4 + self._additional_params.len());
30461        params.push("path", self._path);
30462        if let Some(value) = self._fingerprint.as_ref() {
30463            params.push("fingerprint", value);
30464        }
30465
30466        params.extend(self._additional_params.iter());
30467
30468        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:resolve_conflict";
30469        if self._scopes.is_empty() {
30470            self._scopes
30471                .insert(Scope::EditContainer.as_ref().to_string());
30472        }
30473
30474        #[allow(clippy::single_element_loop)]
30475        for &(find_this, param_name) in [("{+path}", "path")].iter() {
30476            url = params.uri_replacement(url, param_name, find_this, true);
30477        }
30478        {
30479            let to_remove = ["path"];
30480            params.remove_params(&to_remove);
30481        }
30482
30483        let url = params.parse_with_url(&url);
30484
30485        let mut json_mime_type = mime::APPLICATION_JSON;
30486        let mut request_value_reader = {
30487            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30488            common::remove_json_null_values(&mut value);
30489            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30490            serde_json::to_writer(&mut dst, &value).unwrap();
30491            dst
30492        };
30493        let request_size = request_value_reader
30494            .seek(std::io::SeekFrom::End(0))
30495            .unwrap();
30496        request_value_reader
30497            .seek(std::io::SeekFrom::Start(0))
30498            .unwrap();
30499
30500        loop {
30501            let token = match self
30502                .hub
30503                .auth
30504                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30505                .await
30506            {
30507                Ok(token) => token,
30508                Err(e) => match dlg.token(e) {
30509                    Ok(token) => token,
30510                    Err(e) => {
30511                        dlg.finished(false);
30512                        return Err(common::Error::MissingToken(e));
30513                    }
30514                },
30515            };
30516            request_value_reader
30517                .seek(std::io::SeekFrom::Start(0))
30518                .unwrap();
30519            let mut req_result = {
30520                let client = &self.hub.client;
30521                dlg.pre_request();
30522                let mut req_builder = hyper::Request::builder()
30523                    .method(hyper::Method::POST)
30524                    .uri(url.as_str())
30525                    .header(USER_AGENT, self.hub._user_agent.clone());
30526
30527                if let Some(token) = token.as_ref() {
30528                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30529                }
30530
30531                let request = req_builder
30532                    .header(CONTENT_TYPE, json_mime_type.to_string())
30533                    .header(CONTENT_LENGTH, request_size as u64)
30534                    .body(common::to_body(
30535                        request_value_reader.get_ref().clone().into(),
30536                    ));
30537
30538                client.request(request.unwrap()).await
30539            };
30540
30541            match req_result {
30542                Err(err) => {
30543                    if let common::Retry::After(d) = dlg.http_error(&err) {
30544                        sleep(d).await;
30545                        continue;
30546                    }
30547                    dlg.finished(false);
30548                    return Err(common::Error::HttpError(err));
30549                }
30550                Ok(res) => {
30551                    let (mut parts, body) = res.into_parts();
30552                    let mut body = common::Body::new(body);
30553                    if !parts.status.is_success() {
30554                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30555                        let error = serde_json::from_str(&common::to_string(&bytes));
30556                        let response = common::to_response(parts, bytes.into());
30557
30558                        if let common::Retry::After(d) =
30559                            dlg.http_failure(&response, error.as_ref().ok())
30560                        {
30561                            sleep(d).await;
30562                            continue;
30563                        }
30564
30565                        dlg.finished(false);
30566
30567                        return Err(match error {
30568                            Ok(value) => common::Error::BadRequest(value),
30569                            _ => common::Error::Failure(response),
30570                        });
30571                    }
30572                    let response = common::Response::from_parts(parts, body);
30573
30574                    dlg.finished(true);
30575                    return Ok(response);
30576                }
30577            }
30578        }
30579    }
30580
30581    ///
30582    /// Sets the *request* property to the given value.
30583    ///
30584    /// Even though the property as already been set when instantiating this call,
30585    /// we provide this method for API completeness.
30586    pub fn request(
30587        mut self,
30588        new_value: Entity,
30589    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
30590        self._request = new_value;
30591        self
30592    }
30593    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
30594    ///
30595    /// Sets the *path* path property to the given value.
30596    ///
30597    /// Even though the property as already been set when instantiating this call,
30598    /// we provide this method for API completeness.
30599    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
30600        self._path = new_value.to_string();
30601        self
30602    }
30603    /// When provided, this fingerprint must match the fingerprint of the entity_in_workspace in the merge conflict.
30604    ///
30605    /// Sets the *fingerprint* query property to the given value.
30606    pub fn fingerprint(
30607        mut self,
30608        new_value: &str,
30609    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
30610        self._fingerprint = Some(new_value.to_string());
30611        self
30612    }
30613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30614    /// while executing the actual API request.
30615    ///
30616    /// ````text
30617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30618    /// ````
30619    ///
30620    /// Sets the *delegate* property to the given value.
30621    pub fn delegate(
30622        mut self,
30623        new_value: &'a mut dyn common::Delegate,
30624    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
30625        self._delegate = Some(new_value);
30626        self
30627    }
30628
30629    /// Set any additional parameter of the query string used in the request.
30630    /// It should be used to set parameters which are not yet available through their own
30631    /// setters.
30632    ///
30633    /// Please note that this method must not be used to set any of the known parameters
30634    /// which have their own setter method. If done anyway, the request will fail.
30635    ///
30636    /// # Additional Parameters
30637    ///
30638    /// * *$.xgafv* (query-string) - V1 error format.
30639    /// * *access_token* (query-string) - OAuth access token.
30640    /// * *alt* (query-string) - Data format for response.
30641    /// * *callback* (query-string) - JSONP
30642    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30643    /// * *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.
30644    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30645    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30646    /// * *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.
30647    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30648    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30649    pub fn param<T>(
30650        mut self,
30651        name: T,
30652        value: T,
30653    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
30654    where
30655        T: AsRef<str>,
30656    {
30657        self._additional_params
30658            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30659        self
30660    }
30661
30662    /// Identifies the authorization scope for the method you are building.
30663    ///
30664    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30665    /// [`Scope::EditContainer`].
30666    ///
30667    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30668    /// tokens for more than one scope.
30669    ///
30670    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30671    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30672    /// sufficient, a read-write scope will do as well.
30673    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
30674    where
30675        St: AsRef<str>,
30676    {
30677        self._scopes.insert(String::from(scope.as_ref()));
30678        self
30679    }
30680    /// Identifies the authorization scope(s) for the method you are building.
30681    ///
30682    /// See [`Self::add_scope()`] for details.
30683    pub fn add_scopes<I, St>(
30684        mut self,
30685        scopes: I,
30686    ) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
30687    where
30688        I: IntoIterator<Item = St>,
30689        St: AsRef<str>,
30690    {
30691        self._scopes
30692            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30693        self
30694    }
30695
30696    /// Removes all scopes, and no default scope will be used either.
30697    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30698    /// for details).
30699    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
30700        self._scopes.clear();
30701        self
30702    }
30703}
30704
30705/// Syncs a workspace to the latest container version by updating all unmodified workspace entities and displaying conflicts for modified entities.
30706///
30707/// A builder for the *containers.workspaces.sync* method supported by a *account* resource.
30708/// It is not used directly, but through a [`AccountMethods`] instance.
30709///
30710/// # Example
30711///
30712/// Instantiate a resource method builder
30713///
30714/// ```test_harness,no_run
30715/// # extern crate hyper;
30716/// # extern crate hyper_rustls;
30717/// # extern crate google_tagmanager2 as tagmanager2;
30718/// # async fn dox() {
30719/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30720///
30721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30723/// #     secret,
30724/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30725/// # ).build().await.unwrap();
30726///
30727/// # let client = hyper_util::client::legacy::Client::builder(
30728/// #     hyper_util::rt::TokioExecutor::new()
30729/// # )
30730/// # .build(
30731/// #     hyper_rustls::HttpsConnectorBuilder::new()
30732/// #         .with_native_roots()
30733/// #         .unwrap()
30734/// #         .https_or_http()
30735/// #         .enable_http1()
30736/// #         .build()
30737/// # );
30738/// # let mut hub = TagManager::new(client, auth);
30739/// // You can configure optional parameters by calling the respective setters at will, and
30740/// // execute the final call using `doit()`.
30741/// // Values shown here are possibly random and not representative !
30742/// let result = hub.accounts().containers_workspaces_sync("path")
30743///              .doit().await;
30744/// # }
30745/// ```
30746pub struct AccountContainerWorkspaceSyncCall<'a, C>
30747where
30748    C: 'a,
30749{
30750    hub: &'a TagManager<C>,
30751    _path: String,
30752    _delegate: Option<&'a mut dyn common::Delegate>,
30753    _additional_params: HashMap<String, String>,
30754    _scopes: BTreeSet<String>,
30755}
30756
30757impl<'a, C> common::CallBuilder for AccountContainerWorkspaceSyncCall<'a, C> {}
30758
30759impl<'a, C> AccountContainerWorkspaceSyncCall<'a, C>
30760where
30761    C: common::Connector,
30762{
30763    /// Perform the operation you have build so far.
30764    pub async fn doit(mut self) -> common::Result<(common::Response, SyncWorkspaceResponse)> {
30765        use std::borrow::Cow;
30766        use std::io::{Read, Seek};
30767
30768        use common::{url::Params, ToParts};
30769        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30770
30771        let mut dd = common::DefaultDelegate;
30772        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30773        dlg.begin(common::MethodInfo {
30774            id: "tagmanager.accounts.containers.workspaces.sync",
30775            http_method: hyper::Method::POST,
30776        });
30777
30778        for &field in ["alt", "path"].iter() {
30779            if self._additional_params.contains_key(field) {
30780                dlg.finished(false);
30781                return Err(common::Error::FieldClash(field));
30782            }
30783        }
30784
30785        let mut params = Params::with_capacity(3 + self._additional_params.len());
30786        params.push("path", self._path);
30787
30788        params.extend(self._additional_params.iter());
30789
30790        params.push("alt", "json");
30791        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:sync";
30792        if self._scopes.is_empty() {
30793            self._scopes
30794                .insert(Scope::EditContainer.as_ref().to_string());
30795        }
30796
30797        #[allow(clippy::single_element_loop)]
30798        for &(find_this, param_name) in [("{+path}", "path")].iter() {
30799            url = params.uri_replacement(url, param_name, find_this, true);
30800        }
30801        {
30802            let to_remove = ["path"];
30803            params.remove_params(&to_remove);
30804        }
30805
30806        let url = params.parse_with_url(&url);
30807
30808        loop {
30809            let token = match self
30810                .hub
30811                .auth
30812                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30813                .await
30814            {
30815                Ok(token) => token,
30816                Err(e) => match dlg.token(e) {
30817                    Ok(token) => token,
30818                    Err(e) => {
30819                        dlg.finished(false);
30820                        return Err(common::Error::MissingToken(e));
30821                    }
30822                },
30823            };
30824            let mut req_result = {
30825                let client = &self.hub.client;
30826                dlg.pre_request();
30827                let mut req_builder = hyper::Request::builder()
30828                    .method(hyper::Method::POST)
30829                    .uri(url.as_str())
30830                    .header(USER_AGENT, self.hub._user_agent.clone());
30831
30832                if let Some(token) = token.as_ref() {
30833                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30834                }
30835
30836                let request = req_builder
30837                    .header(CONTENT_LENGTH, 0_u64)
30838                    .body(common::to_body::<String>(None));
30839
30840                client.request(request.unwrap()).await
30841            };
30842
30843            match req_result {
30844                Err(err) => {
30845                    if let common::Retry::After(d) = dlg.http_error(&err) {
30846                        sleep(d).await;
30847                        continue;
30848                    }
30849                    dlg.finished(false);
30850                    return Err(common::Error::HttpError(err));
30851                }
30852                Ok(res) => {
30853                    let (mut parts, body) = res.into_parts();
30854                    let mut body = common::Body::new(body);
30855                    if !parts.status.is_success() {
30856                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30857                        let error = serde_json::from_str(&common::to_string(&bytes));
30858                        let response = common::to_response(parts, bytes.into());
30859
30860                        if let common::Retry::After(d) =
30861                            dlg.http_failure(&response, error.as_ref().ok())
30862                        {
30863                            sleep(d).await;
30864                            continue;
30865                        }
30866
30867                        dlg.finished(false);
30868
30869                        return Err(match error {
30870                            Ok(value) => common::Error::BadRequest(value),
30871                            _ => common::Error::Failure(response),
30872                        });
30873                    }
30874                    let response = {
30875                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30876                        let encoded = common::to_string(&bytes);
30877                        match serde_json::from_str(&encoded) {
30878                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30879                            Err(error) => {
30880                                dlg.response_json_decode_error(&encoded, &error);
30881                                return Err(common::Error::JsonDecodeError(
30882                                    encoded.to_string(),
30883                                    error,
30884                                ));
30885                            }
30886                        }
30887                    };
30888
30889                    dlg.finished(true);
30890                    return Ok(response);
30891                }
30892            }
30893        }
30894    }
30895
30896    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
30897    ///
30898    /// Sets the *path* path property to the given value.
30899    ///
30900    /// Even though the property as already been set when instantiating this call,
30901    /// we provide this method for API completeness.
30902    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceSyncCall<'a, C> {
30903        self._path = new_value.to_string();
30904        self
30905    }
30906    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30907    /// while executing the actual API request.
30908    ///
30909    /// ````text
30910    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30911    /// ````
30912    ///
30913    /// Sets the *delegate* property to the given value.
30914    pub fn delegate(
30915        mut self,
30916        new_value: &'a mut dyn common::Delegate,
30917    ) -> AccountContainerWorkspaceSyncCall<'a, C> {
30918        self._delegate = Some(new_value);
30919        self
30920    }
30921
30922    /// Set any additional parameter of the query string used in the request.
30923    /// It should be used to set parameters which are not yet available through their own
30924    /// setters.
30925    ///
30926    /// Please note that this method must not be used to set any of the known parameters
30927    /// which have their own setter method. If done anyway, the request will fail.
30928    ///
30929    /// # Additional Parameters
30930    ///
30931    /// * *$.xgafv* (query-string) - V1 error format.
30932    /// * *access_token* (query-string) - OAuth access token.
30933    /// * *alt* (query-string) - Data format for response.
30934    /// * *callback* (query-string) - JSONP
30935    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30936    /// * *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.
30937    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30938    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30939    /// * *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.
30940    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30941    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30942    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceSyncCall<'a, C>
30943    where
30944        T: AsRef<str>,
30945    {
30946        self._additional_params
30947            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30948        self
30949    }
30950
30951    /// Identifies the authorization scope for the method you are building.
30952    ///
30953    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30954    /// [`Scope::EditContainer`].
30955    ///
30956    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30957    /// tokens for more than one scope.
30958    ///
30959    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30960    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30961    /// sufficient, a read-write scope will do as well.
30962    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceSyncCall<'a, C>
30963    where
30964        St: AsRef<str>,
30965    {
30966        self._scopes.insert(String::from(scope.as_ref()));
30967        self
30968    }
30969    /// Identifies the authorization scope(s) for the method you are building.
30970    ///
30971    /// See [`Self::add_scope()`] for details.
30972    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceSyncCall<'a, C>
30973    where
30974        I: IntoIterator<Item = St>,
30975        St: AsRef<str>,
30976    {
30977        self._scopes
30978            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30979        self
30980    }
30981
30982    /// Removes all scopes, and no default scope will be used either.
30983    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30984    /// for details).
30985    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceSyncCall<'a, C> {
30986        self._scopes.clear();
30987        self
30988    }
30989}
30990
30991/// Updates a Workspace.
30992///
30993/// A builder for the *containers.workspaces.update* method supported by a *account* resource.
30994/// It is not used directly, but through a [`AccountMethods`] instance.
30995///
30996/// # Example
30997///
30998/// Instantiate a resource method builder
30999///
31000/// ```test_harness,no_run
31001/// # extern crate hyper;
31002/// # extern crate hyper_rustls;
31003/// # extern crate google_tagmanager2 as tagmanager2;
31004/// use tagmanager2::api::Workspace;
31005/// # async fn dox() {
31006/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31007///
31008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31009/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31010/// #     secret,
31011/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31012/// # ).build().await.unwrap();
31013///
31014/// # let client = hyper_util::client::legacy::Client::builder(
31015/// #     hyper_util::rt::TokioExecutor::new()
31016/// # )
31017/// # .build(
31018/// #     hyper_rustls::HttpsConnectorBuilder::new()
31019/// #         .with_native_roots()
31020/// #         .unwrap()
31021/// #         .https_or_http()
31022/// #         .enable_http1()
31023/// #         .build()
31024/// # );
31025/// # let mut hub = TagManager::new(client, auth);
31026/// // As the method needs a request, you would usually fill it with the desired information
31027/// // into the respective structure. Some of the parts shown here might not be applicable !
31028/// // Values shown here are possibly random and not representative !
31029/// let mut req = Workspace::default();
31030///
31031/// // You can configure optional parameters by calling the respective setters at will, and
31032/// // execute the final call using `doit()`.
31033/// // Values shown here are possibly random and not representative !
31034/// let result = hub.accounts().containers_workspaces_update(req, "path")
31035///              .fingerprint("erat")
31036///              .doit().await;
31037/// # }
31038/// ```
31039pub struct AccountContainerWorkspaceUpdateCall<'a, C>
31040where
31041    C: 'a,
31042{
31043    hub: &'a TagManager<C>,
31044    _request: Workspace,
31045    _path: String,
31046    _fingerprint: Option<String>,
31047    _delegate: Option<&'a mut dyn common::Delegate>,
31048    _additional_params: HashMap<String, String>,
31049    _scopes: BTreeSet<String>,
31050}
31051
31052impl<'a, C> common::CallBuilder for AccountContainerWorkspaceUpdateCall<'a, C> {}
31053
31054impl<'a, C> AccountContainerWorkspaceUpdateCall<'a, C>
31055where
31056    C: common::Connector,
31057{
31058    /// Perform the operation you have build so far.
31059    pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
31060        use std::borrow::Cow;
31061        use std::io::{Read, Seek};
31062
31063        use common::{url::Params, ToParts};
31064        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31065
31066        let mut dd = common::DefaultDelegate;
31067        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31068        dlg.begin(common::MethodInfo {
31069            id: "tagmanager.accounts.containers.workspaces.update",
31070            http_method: hyper::Method::PUT,
31071        });
31072
31073        for &field in ["alt", "path", "fingerprint"].iter() {
31074            if self._additional_params.contains_key(field) {
31075                dlg.finished(false);
31076                return Err(common::Error::FieldClash(field));
31077            }
31078        }
31079
31080        let mut params = Params::with_capacity(5 + self._additional_params.len());
31081        params.push("path", self._path);
31082        if let Some(value) = self._fingerprint.as_ref() {
31083            params.push("fingerprint", value);
31084        }
31085
31086        params.extend(self._additional_params.iter());
31087
31088        params.push("alt", "json");
31089        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
31090        if self._scopes.is_empty() {
31091            self._scopes
31092                .insert(Scope::EditContainer.as_ref().to_string());
31093        }
31094
31095        #[allow(clippy::single_element_loop)]
31096        for &(find_this, param_name) in [("{+path}", "path")].iter() {
31097            url = params.uri_replacement(url, param_name, find_this, true);
31098        }
31099        {
31100            let to_remove = ["path"];
31101            params.remove_params(&to_remove);
31102        }
31103
31104        let url = params.parse_with_url(&url);
31105
31106        let mut json_mime_type = mime::APPLICATION_JSON;
31107        let mut request_value_reader = {
31108            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31109            common::remove_json_null_values(&mut value);
31110            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31111            serde_json::to_writer(&mut dst, &value).unwrap();
31112            dst
31113        };
31114        let request_size = request_value_reader
31115            .seek(std::io::SeekFrom::End(0))
31116            .unwrap();
31117        request_value_reader
31118            .seek(std::io::SeekFrom::Start(0))
31119            .unwrap();
31120
31121        loop {
31122            let token = match self
31123                .hub
31124                .auth
31125                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31126                .await
31127            {
31128                Ok(token) => token,
31129                Err(e) => match dlg.token(e) {
31130                    Ok(token) => token,
31131                    Err(e) => {
31132                        dlg.finished(false);
31133                        return Err(common::Error::MissingToken(e));
31134                    }
31135                },
31136            };
31137            request_value_reader
31138                .seek(std::io::SeekFrom::Start(0))
31139                .unwrap();
31140            let mut req_result = {
31141                let client = &self.hub.client;
31142                dlg.pre_request();
31143                let mut req_builder = hyper::Request::builder()
31144                    .method(hyper::Method::PUT)
31145                    .uri(url.as_str())
31146                    .header(USER_AGENT, self.hub._user_agent.clone());
31147
31148                if let Some(token) = token.as_ref() {
31149                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31150                }
31151
31152                let request = req_builder
31153                    .header(CONTENT_TYPE, json_mime_type.to_string())
31154                    .header(CONTENT_LENGTH, request_size as u64)
31155                    .body(common::to_body(
31156                        request_value_reader.get_ref().clone().into(),
31157                    ));
31158
31159                client.request(request.unwrap()).await
31160            };
31161
31162            match req_result {
31163                Err(err) => {
31164                    if let common::Retry::After(d) = dlg.http_error(&err) {
31165                        sleep(d).await;
31166                        continue;
31167                    }
31168                    dlg.finished(false);
31169                    return Err(common::Error::HttpError(err));
31170                }
31171                Ok(res) => {
31172                    let (mut parts, body) = res.into_parts();
31173                    let mut body = common::Body::new(body);
31174                    if !parts.status.is_success() {
31175                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31176                        let error = serde_json::from_str(&common::to_string(&bytes));
31177                        let response = common::to_response(parts, bytes.into());
31178
31179                        if let common::Retry::After(d) =
31180                            dlg.http_failure(&response, error.as_ref().ok())
31181                        {
31182                            sleep(d).await;
31183                            continue;
31184                        }
31185
31186                        dlg.finished(false);
31187
31188                        return Err(match error {
31189                            Ok(value) => common::Error::BadRequest(value),
31190                            _ => common::Error::Failure(response),
31191                        });
31192                    }
31193                    let response = {
31194                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31195                        let encoded = common::to_string(&bytes);
31196                        match serde_json::from_str(&encoded) {
31197                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31198                            Err(error) => {
31199                                dlg.response_json_decode_error(&encoded, &error);
31200                                return Err(common::Error::JsonDecodeError(
31201                                    encoded.to_string(),
31202                                    error,
31203                                ));
31204                            }
31205                        }
31206                    };
31207
31208                    dlg.finished(true);
31209                    return Ok(response);
31210                }
31211            }
31212        }
31213    }
31214
31215    ///
31216    /// Sets the *request* property to the given value.
31217    ///
31218    /// Even though the property as already been set when instantiating this call,
31219    /// we provide this method for API completeness.
31220    pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceUpdateCall<'a, C> {
31221        self._request = new_value;
31222        self
31223    }
31224    /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
31225    ///
31226    /// Sets the *path* path property to the given value.
31227    ///
31228    /// Even though the property as already been set when instantiating this call,
31229    /// we provide this method for API completeness.
31230    pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceUpdateCall<'a, C> {
31231        self._path = new_value.to_string();
31232        self
31233    }
31234    /// When provided, this fingerprint must match the fingerprint of the workspace in storage.
31235    ///
31236    /// Sets the *fingerprint* query property to the given value.
31237    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceUpdateCall<'a, C> {
31238        self._fingerprint = Some(new_value.to_string());
31239        self
31240    }
31241    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31242    /// while executing the actual API request.
31243    ///
31244    /// ````text
31245    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31246    /// ````
31247    ///
31248    /// Sets the *delegate* property to the given value.
31249    pub fn delegate(
31250        mut self,
31251        new_value: &'a mut dyn common::Delegate,
31252    ) -> AccountContainerWorkspaceUpdateCall<'a, C> {
31253        self._delegate = Some(new_value);
31254        self
31255    }
31256
31257    /// Set any additional parameter of the query string used in the request.
31258    /// It should be used to set parameters which are not yet available through their own
31259    /// setters.
31260    ///
31261    /// Please note that this method must not be used to set any of the known parameters
31262    /// which have their own setter method. If done anyway, the request will fail.
31263    ///
31264    /// # Additional Parameters
31265    ///
31266    /// * *$.xgafv* (query-string) - V1 error format.
31267    /// * *access_token* (query-string) - OAuth access token.
31268    /// * *alt* (query-string) - Data format for response.
31269    /// * *callback* (query-string) - JSONP
31270    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31271    /// * *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.
31272    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31273    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31274    /// * *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.
31275    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31276    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31277    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceUpdateCall<'a, C>
31278    where
31279        T: AsRef<str>,
31280    {
31281        self._additional_params
31282            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31283        self
31284    }
31285
31286    /// Identifies the authorization scope for the method you are building.
31287    ///
31288    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31289    /// [`Scope::EditContainer`].
31290    ///
31291    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31292    /// tokens for more than one scope.
31293    ///
31294    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31295    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31296    /// sufficient, a read-write scope will do as well.
31297    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceUpdateCall<'a, C>
31298    where
31299        St: AsRef<str>,
31300    {
31301        self._scopes.insert(String::from(scope.as_ref()));
31302        self
31303    }
31304    /// Identifies the authorization scope(s) for the method you are building.
31305    ///
31306    /// See [`Self::add_scope()`] for details.
31307    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceUpdateCall<'a, C>
31308    where
31309        I: IntoIterator<Item = St>,
31310        St: AsRef<str>,
31311    {
31312        self._scopes
31313            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31314        self
31315    }
31316
31317    /// Removes all scopes, and no default scope will be used either.
31318    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31319    /// for details).
31320    pub fn clear_scopes(mut self) -> AccountContainerWorkspaceUpdateCall<'a, C> {
31321        self._scopes.clear();
31322        self
31323    }
31324}
31325
31326/// Combines Containers.
31327///
31328/// A builder for the *containers.combine* method supported by a *account* resource.
31329/// It is not used directly, but through a [`AccountMethods`] instance.
31330///
31331/// # Example
31332///
31333/// Instantiate a resource method builder
31334///
31335/// ```test_harness,no_run
31336/// # extern crate hyper;
31337/// # extern crate hyper_rustls;
31338/// # extern crate google_tagmanager2 as tagmanager2;
31339/// # async fn dox() {
31340/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31341///
31342/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31344/// #     secret,
31345/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31346/// # ).build().await.unwrap();
31347///
31348/// # let client = hyper_util::client::legacy::Client::builder(
31349/// #     hyper_util::rt::TokioExecutor::new()
31350/// # )
31351/// # .build(
31352/// #     hyper_rustls::HttpsConnectorBuilder::new()
31353/// #         .with_native_roots()
31354/// #         .unwrap()
31355/// #         .https_or_http()
31356/// #         .enable_http1()
31357/// #         .build()
31358/// # );
31359/// # let mut hub = TagManager::new(client, auth);
31360/// // You can configure optional parameters by calling the respective setters at will, and
31361/// // execute the final call using `doit()`.
31362/// // Values shown here are possibly random and not representative !
31363/// let result = hub.accounts().containers_combine("path")
31364///              .setting_source("sea")
31365///              .container_id("takimata")
31366///              .allow_user_permission_feature_update(true)
31367///              .doit().await;
31368/// # }
31369/// ```
31370pub struct AccountContainerCombineCall<'a, C>
31371where
31372    C: 'a,
31373{
31374    hub: &'a TagManager<C>,
31375    _path: String,
31376    _setting_source: Option<String>,
31377    _container_id: Option<String>,
31378    _allow_user_permission_feature_update: Option<bool>,
31379    _delegate: Option<&'a mut dyn common::Delegate>,
31380    _additional_params: HashMap<String, String>,
31381    _scopes: BTreeSet<String>,
31382}
31383
31384impl<'a, C> common::CallBuilder for AccountContainerCombineCall<'a, C> {}
31385
31386impl<'a, C> AccountContainerCombineCall<'a, C>
31387where
31388    C: common::Connector,
31389{
31390    /// Perform the operation you have build so far.
31391    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
31392        use std::borrow::Cow;
31393        use std::io::{Read, Seek};
31394
31395        use common::{url::Params, ToParts};
31396        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31397
31398        let mut dd = common::DefaultDelegate;
31399        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31400        dlg.begin(common::MethodInfo {
31401            id: "tagmanager.accounts.containers.combine",
31402            http_method: hyper::Method::POST,
31403        });
31404
31405        for &field in [
31406            "alt",
31407            "path",
31408            "settingSource",
31409            "containerId",
31410            "allowUserPermissionFeatureUpdate",
31411        ]
31412        .iter()
31413        {
31414            if self._additional_params.contains_key(field) {
31415                dlg.finished(false);
31416                return Err(common::Error::FieldClash(field));
31417            }
31418        }
31419
31420        let mut params = Params::with_capacity(6 + self._additional_params.len());
31421        params.push("path", self._path);
31422        if let Some(value) = self._setting_source.as_ref() {
31423            params.push("settingSource", value);
31424        }
31425        if let Some(value) = self._container_id.as_ref() {
31426            params.push("containerId", value);
31427        }
31428        if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
31429            params.push("allowUserPermissionFeatureUpdate", value.to_string());
31430        }
31431
31432        params.extend(self._additional_params.iter());
31433
31434        params.push("alt", "json");
31435        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:combine";
31436        if self._scopes.is_empty() {
31437            self._scopes
31438                .insert(Scope::EditContainer.as_ref().to_string());
31439        }
31440
31441        #[allow(clippy::single_element_loop)]
31442        for &(find_this, param_name) in [("{+path}", "path")].iter() {
31443            url = params.uri_replacement(url, param_name, find_this, true);
31444        }
31445        {
31446            let to_remove = ["path"];
31447            params.remove_params(&to_remove);
31448        }
31449
31450        let url = params.parse_with_url(&url);
31451
31452        loop {
31453            let token = match self
31454                .hub
31455                .auth
31456                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31457                .await
31458            {
31459                Ok(token) => token,
31460                Err(e) => match dlg.token(e) {
31461                    Ok(token) => token,
31462                    Err(e) => {
31463                        dlg.finished(false);
31464                        return Err(common::Error::MissingToken(e));
31465                    }
31466                },
31467            };
31468            let mut req_result = {
31469                let client = &self.hub.client;
31470                dlg.pre_request();
31471                let mut req_builder = hyper::Request::builder()
31472                    .method(hyper::Method::POST)
31473                    .uri(url.as_str())
31474                    .header(USER_AGENT, self.hub._user_agent.clone());
31475
31476                if let Some(token) = token.as_ref() {
31477                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31478                }
31479
31480                let request = req_builder
31481                    .header(CONTENT_LENGTH, 0_u64)
31482                    .body(common::to_body::<String>(None));
31483
31484                client.request(request.unwrap()).await
31485            };
31486
31487            match req_result {
31488                Err(err) => {
31489                    if let common::Retry::After(d) = dlg.http_error(&err) {
31490                        sleep(d).await;
31491                        continue;
31492                    }
31493                    dlg.finished(false);
31494                    return Err(common::Error::HttpError(err));
31495                }
31496                Ok(res) => {
31497                    let (mut parts, body) = res.into_parts();
31498                    let mut body = common::Body::new(body);
31499                    if !parts.status.is_success() {
31500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31501                        let error = serde_json::from_str(&common::to_string(&bytes));
31502                        let response = common::to_response(parts, bytes.into());
31503
31504                        if let common::Retry::After(d) =
31505                            dlg.http_failure(&response, error.as_ref().ok())
31506                        {
31507                            sleep(d).await;
31508                            continue;
31509                        }
31510
31511                        dlg.finished(false);
31512
31513                        return Err(match error {
31514                            Ok(value) => common::Error::BadRequest(value),
31515                            _ => common::Error::Failure(response),
31516                        });
31517                    }
31518                    let response = {
31519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31520                        let encoded = common::to_string(&bytes);
31521                        match serde_json::from_str(&encoded) {
31522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31523                            Err(error) => {
31524                                dlg.response_json_decode_error(&encoded, &error);
31525                                return Err(common::Error::JsonDecodeError(
31526                                    encoded.to_string(),
31527                                    error,
31528                                ));
31529                            }
31530                        }
31531                    };
31532
31533                    dlg.finished(true);
31534                    return Ok(response);
31535                }
31536            }
31537        }
31538    }
31539
31540    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
31541    ///
31542    /// Sets the *path* path property to the given value.
31543    ///
31544    /// Even though the property as already been set when instantiating this call,
31545    /// we provide this method for API completeness.
31546    pub fn path(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
31547        self._path = new_value.to_string();
31548        self
31549    }
31550    /// Specify the source of config setting after combine
31551    ///
31552    /// Sets the *setting source* query property to the given value.
31553    pub fn setting_source(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
31554        self._setting_source = Some(new_value.to_string());
31555        self
31556    }
31557    /// ID of container that will be merged into the current container.
31558    ///
31559    /// Sets the *container id* query property to the given value.
31560    pub fn container_id(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
31561        self._container_id = Some(new_value.to_string());
31562        self
31563    }
31564    /// Must be set to true to allow features.user_permissions to change from false to true. If this operation causes an update but this bit is false, the operation will fail.
31565    ///
31566    /// Sets the *allow user permission feature update* query property to the given value.
31567    pub fn allow_user_permission_feature_update(
31568        mut self,
31569        new_value: bool,
31570    ) -> AccountContainerCombineCall<'a, C> {
31571        self._allow_user_permission_feature_update = Some(new_value);
31572        self
31573    }
31574    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31575    /// while executing the actual API request.
31576    ///
31577    /// ````text
31578    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31579    /// ````
31580    ///
31581    /// Sets the *delegate* property to the given value.
31582    pub fn delegate(
31583        mut self,
31584        new_value: &'a mut dyn common::Delegate,
31585    ) -> AccountContainerCombineCall<'a, C> {
31586        self._delegate = Some(new_value);
31587        self
31588    }
31589
31590    /// Set any additional parameter of the query string used in the request.
31591    /// It should be used to set parameters which are not yet available through their own
31592    /// setters.
31593    ///
31594    /// Please note that this method must not be used to set any of the known parameters
31595    /// which have their own setter method. If done anyway, the request will fail.
31596    ///
31597    /// # Additional Parameters
31598    ///
31599    /// * *$.xgafv* (query-string) - V1 error format.
31600    /// * *access_token* (query-string) - OAuth access token.
31601    /// * *alt* (query-string) - Data format for response.
31602    /// * *callback* (query-string) - JSONP
31603    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31604    /// * *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.
31605    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31606    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31607    /// * *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.
31608    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31609    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31610    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerCombineCall<'a, C>
31611    where
31612        T: AsRef<str>,
31613    {
31614        self._additional_params
31615            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31616        self
31617    }
31618
31619    /// Identifies the authorization scope for the method you are building.
31620    ///
31621    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31622    /// [`Scope::EditContainer`].
31623    ///
31624    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31625    /// tokens for more than one scope.
31626    ///
31627    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31628    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31629    /// sufficient, a read-write scope will do as well.
31630    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerCombineCall<'a, C>
31631    where
31632        St: AsRef<str>,
31633    {
31634        self._scopes.insert(String::from(scope.as_ref()));
31635        self
31636    }
31637    /// Identifies the authorization scope(s) for the method you are building.
31638    ///
31639    /// See [`Self::add_scope()`] for details.
31640    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerCombineCall<'a, C>
31641    where
31642        I: IntoIterator<Item = St>,
31643        St: AsRef<str>,
31644    {
31645        self._scopes
31646            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31647        self
31648    }
31649
31650    /// Removes all scopes, and no default scope will be used either.
31651    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31652    /// for details).
31653    pub fn clear_scopes(mut self) -> AccountContainerCombineCall<'a, C> {
31654        self._scopes.clear();
31655        self
31656    }
31657}
31658
31659/// Creates a Container.
31660///
31661/// A builder for the *containers.create* method supported by a *account* resource.
31662/// It is not used directly, but through a [`AccountMethods`] instance.
31663///
31664/// # Example
31665///
31666/// Instantiate a resource method builder
31667///
31668/// ```test_harness,no_run
31669/// # extern crate hyper;
31670/// # extern crate hyper_rustls;
31671/// # extern crate google_tagmanager2 as tagmanager2;
31672/// use tagmanager2::api::Container;
31673/// # async fn dox() {
31674/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31675///
31676/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31678/// #     secret,
31679/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31680/// # ).build().await.unwrap();
31681///
31682/// # let client = hyper_util::client::legacy::Client::builder(
31683/// #     hyper_util::rt::TokioExecutor::new()
31684/// # )
31685/// # .build(
31686/// #     hyper_rustls::HttpsConnectorBuilder::new()
31687/// #         .with_native_roots()
31688/// #         .unwrap()
31689/// #         .https_or_http()
31690/// #         .enable_http1()
31691/// #         .build()
31692/// # );
31693/// # let mut hub = TagManager::new(client, auth);
31694/// // As the method needs a request, you would usually fill it with the desired information
31695/// // into the respective structure. Some of the parts shown here might not be applicable !
31696/// // Values shown here are possibly random and not representative !
31697/// let mut req = Container::default();
31698///
31699/// // You can configure optional parameters by calling the respective setters at will, and
31700/// // execute the final call using `doit()`.
31701/// // Values shown here are possibly random and not representative !
31702/// let result = hub.accounts().containers_create(req, "parent")
31703///              .doit().await;
31704/// # }
31705/// ```
31706pub struct AccountContainerCreateCall<'a, C>
31707where
31708    C: 'a,
31709{
31710    hub: &'a TagManager<C>,
31711    _request: Container,
31712    _parent: String,
31713    _delegate: Option<&'a mut dyn common::Delegate>,
31714    _additional_params: HashMap<String, String>,
31715    _scopes: BTreeSet<String>,
31716}
31717
31718impl<'a, C> common::CallBuilder for AccountContainerCreateCall<'a, C> {}
31719
31720impl<'a, C> AccountContainerCreateCall<'a, C>
31721where
31722    C: common::Connector,
31723{
31724    /// Perform the operation you have build so far.
31725    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
31726        use std::borrow::Cow;
31727        use std::io::{Read, Seek};
31728
31729        use common::{url::Params, ToParts};
31730        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31731
31732        let mut dd = common::DefaultDelegate;
31733        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31734        dlg.begin(common::MethodInfo {
31735            id: "tagmanager.accounts.containers.create",
31736            http_method: hyper::Method::POST,
31737        });
31738
31739        for &field in ["alt", "parent"].iter() {
31740            if self._additional_params.contains_key(field) {
31741                dlg.finished(false);
31742                return Err(common::Error::FieldClash(field));
31743            }
31744        }
31745
31746        let mut params = Params::with_capacity(4 + self._additional_params.len());
31747        params.push("parent", self._parent);
31748
31749        params.extend(self._additional_params.iter());
31750
31751        params.push("alt", "json");
31752        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/containers";
31753        if self._scopes.is_empty() {
31754            self._scopes
31755                .insert(Scope::EditContainer.as_ref().to_string());
31756        }
31757
31758        #[allow(clippy::single_element_loop)]
31759        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
31760            url = params.uri_replacement(url, param_name, find_this, true);
31761        }
31762        {
31763            let to_remove = ["parent"];
31764            params.remove_params(&to_remove);
31765        }
31766
31767        let url = params.parse_with_url(&url);
31768
31769        let mut json_mime_type = mime::APPLICATION_JSON;
31770        let mut request_value_reader = {
31771            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31772            common::remove_json_null_values(&mut value);
31773            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31774            serde_json::to_writer(&mut dst, &value).unwrap();
31775            dst
31776        };
31777        let request_size = request_value_reader
31778            .seek(std::io::SeekFrom::End(0))
31779            .unwrap();
31780        request_value_reader
31781            .seek(std::io::SeekFrom::Start(0))
31782            .unwrap();
31783
31784        loop {
31785            let token = match self
31786                .hub
31787                .auth
31788                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31789                .await
31790            {
31791                Ok(token) => token,
31792                Err(e) => match dlg.token(e) {
31793                    Ok(token) => token,
31794                    Err(e) => {
31795                        dlg.finished(false);
31796                        return Err(common::Error::MissingToken(e));
31797                    }
31798                },
31799            };
31800            request_value_reader
31801                .seek(std::io::SeekFrom::Start(0))
31802                .unwrap();
31803            let mut req_result = {
31804                let client = &self.hub.client;
31805                dlg.pre_request();
31806                let mut req_builder = hyper::Request::builder()
31807                    .method(hyper::Method::POST)
31808                    .uri(url.as_str())
31809                    .header(USER_AGENT, self.hub._user_agent.clone());
31810
31811                if let Some(token) = token.as_ref() {
31812                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31813                }
31814
31815                let request = req_builder
31816                    .header(CONTENT_TYPE, json_mime_type.to_string())
31817                    .header(CONTENT_LENGTH, request_size as u64)
31818                    .body(common::to_body(
31819                        request_value_reader.get_ref().clone().into(),
31820                    ));
31821
31822                client.request(request.unwrap()).await
31823            };
31824
31825            match req_result {
31826                Err(err) => {
31827                    if let common::Retry::After(d) = dlg.http_error(&err) {
31828                        sleep(d).await;
31829                        continue;
31830                    }
31831                    dlg.finished(false);
31832                    return Err(common::Error::HttpError(err));
31833                }
31834                Ok(res) => {
31835                    let (mut parts, body) = res.into_parts();
31836                    let mut body = common::Body::new(body);
31837                    if !parts.status.is_success() {
31838                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31839                        let error = serde_json::from_str(&common::to_string(&bytes));
31840                        let response = common::to_response(parts, bytes.into());
31841
31842                        if let common::Retry::After(d) =
31843                            dlg.http_failure(&response, error.as_ref().ok())
31844                        {
31845                            sleep(d).await;
31846                            continue;
31847                        }
31848
31849                        dlg.finished(false);
31850
31851                        return Err(match error {
31852                            Ok(value) => common::Error::BadRequest(value),
31853                            _ => common::Error::Failure(response),
31854                        });
31855                    }
31856                    let response = {
31857                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31858                        let encoded = common::to_string(&bytes);
31859                        match serde_json::from_str(&encoded) {
31860                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31861                            Err(error) => {
31862                                dlg.response_json_decode_error(&encoded, &error);
31863                                return Err(common::Error::JsonDecodeError(
31864                                    encoded.to_string(),
31865                                    error,
31866                                ));
31867                            }
31868                        }
31869                    };
31870
31871                    dlg.finished(true);
31872                    return Ok(response);
31873                }
31874            }
31875        }
31876    }
31877
31878    ///
31879    /// Sets the *request* property to the given value.
31880    ///
31881    /// Even though the property as already been set when instantiating this call,
31882    /// we provide this method for API completeness.
31883    pub fn request(mut self, new_value: Container) -> AccountContainerCreateCall<'a, C> {
31884        self._request = new_value;
31885        self
31886    }
31887    /// GTM Account's API relative path. Example: accounts/{account_id}.
31888    ///
31889    /// Sets the *parent* path property to the given value.
31890    ///
31891    /// Even though the property as already been set when instantiating this call,
31892    /// we provide this method for API completeness.
31893    pub fn parent(mut self, new_value: &str) -> AccountContainerCreateCall<'a, C> {
31894        self._parent = new_value.to_string();
31895        self
31896    }
31897    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31898    /// while executing the actual API request.
31899    ///
31900    /// ````text
31901    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31902    /// ````
31903    ///
31904    /// Sets the *delegate* property to the given value.
31905    pub fn delegate(
31906        mut self,
31907        new_value: &'a mut dyn common::Delegate,
31908    ) -> AccountContainerCreateCall<'a, C> {
31909        self._delegate = Some(new_value);
31910        self
31911    }
31912
31913    /// Set any additional parameter of the query string used in the request.
31914    /// It should be used to set parameters which are not yet available through their own
31915    /// setters.
31916    ///
31917    /// Please note that this method must not be used to set any of the known parameters
31918    /// which have their own setter method. If done anyway, the request will fail.
31919    ///
31920    /// # Additional Parameters
31921    ///
31922    /// * *$.xgafv* (query-string) - V1 error format.
31923    /// * *access_token* (query-string) - OAuth access token.
31924    /// * *alt* (query-string) - Data format for response.
31925    /// * *callback* (query-string) - JSONP
31926    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31927    /// * *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.
31928    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31929    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31930    /// * *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.
31931    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31932    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31933    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerCreateCall<'a, C>
31934    where
31935        T: AsRef<str>,
31936    {
31937        self._additional_params
31938            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31939        self
31940    }
31941
31942    /// Identifies the authorization scope for the method you are building.
31943    ///
31944    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31945    /// [`Scope::EditContainer`].
31946    ///
31947    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31948    /// tokens for more than one scope.
31949    ///
31950    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31951    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31952    /// sufficient, a read-write scope will do as well.
31953    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerCreateCall<'a, C>
31954    where
31955        St: AsRef<str>,
31956    {
31957        self._scopes.insert(String::from(scope.as_ref()));
31958        self
31959    }
31960    /// Identifies the authorization scope(s) for the method you are building.
31961    ///
31962    /// See [`Self::add_scope()`] for details.
31963    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerCreateCall<'a, C>
31964    where
31965        I: IntoIterator<Item = St>,
31966        St: AsRef<str>,
31967    {
31968        self._scopes
31969            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31970        self
31971    }
31972
31973    /// Removes all scopes, and no default scope will be used either.
31974    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31975    /// for details).
31976    pub fn clear_scopes(mut self) -> AccountContainerCreateCall<'a, C> {
31977        self._scopes.clear();
31978        self
31979    }
31980}
31981
31982/// Deletes a Container.
31983///
31984/// A builder for the *containers.delete* method supported by a *account* resource.
31985/// It is not used directly, but through a [`AccountMethods`] instance.
31986///
31987/// # Example
31988///
31989/// Instantiate a resource method builder
31990///
31991/// ```test_harness,no_run
31992/// # extern crate hyper;
31993/// # extern crate hyper_rustls;
31994/// # extern crate google_tagmanager2 as tagmanager2;
31995/// # async fn dox() {
31996/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31997///
31998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32000/// #     secret,
32001/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32002/// # ).build().await.unwrap();
32003///
32004/// # let client = hyper_util::client::legacy::Client::builder(
32005/// #     hyper_util::rt::TokioExecutor::new()
32006/// # )
32007/// # .build(
32008/// #     hyper_rustls::HttpsConnectorBuilder::new()
32009/// #         .with_native_roots()
32010/// #         .unwrap()
32011/// #         .https_or_http()
32012/// #         .enable_http1()
32013/// #         .build()
32014/// # );
32015/// # let mut hub = TagManager::new(client, auth);
32016/// // You can configure optional parameters by calling the respective setters at will, and
32017/// // execute the final call using `doit()`.
32018/// // Values shown here are possibly random and not representative !
32019/// let result = hub.accounts().containers_delete("path")
32020///              .doit().await;
32021/// # }
32022/// ```
32023pub struct AccountContainerDeleteCall<'a, C>
32024where
32025    C: 'a,
32026{
32027    hub: &'a TagManager<C>,
32028    _path: String,
32029    _delegate: Option<&'a mut dyn common::Delegate>,
32030    _additional_params: HashMap<String, String>,
32031    _scopes: BTreeSet<String>,
32032}
32033
32034impl<'a, C> common::CallBuilder for AccountContainerDeleteCall<'a, C> {}
32035
32036impl<'a, C> AccountContainerDeleteCall<'a, C>
32037where
32038    C: common::Connector,
32039{
32040    /// Perform the operation you have build so far.
32041    pub async fn doit(mut self) -> common::Result<common::Response> {
32042        use std::borrow::Cow;
32043        use std::io::{Read, Seek};
32044
32045        use common::{url::Params, ToParts};
32046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32047
32048        let mut dd = common::DefaultDelegate;
32049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32050        dlg.begin(common::MethodInfo {
32051            id: "tagmanager.accounts.containers.delete",
32052            http_method: hyper::Method::DELETE,
32053        });
32054
32055        for &field in ["path"].iter() {
32056            if self._additional_params.contains_key(field) {
32057                dlg.finished(false);
32058                return Err(common::Error::FieldClash(field));
32059            }
32060        }
32061
32062        let mut params = Params::with_capacity(2 + self._additional_params.len());
32063        params.push("path", self._path);
32064
32065        params.extend(self._additional_params.iter());
32066
32067        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
32068        if self._scopes.is_empty() {
32069            self._scopes
32070                .insert(Scope::DeleteContainer.as_ref().to_string());
32071        }
32072
32073        #[allow(clippy::single_element_loop)]
32074        for &(find_this, param_name) in [("{+path}", "path")].iter() {
32075            url = params.uri_replacement(url, param_name, find_this, true);
32076        }
32077        {
32078            let to_remove = ["path"];
32079            params.remove_params(&to_remove);
32080        }
32081
32082        let url = params.parse_with_url(&url);
32083
32084        loop {
32085            let token = match self
32086                .hub
32087                .auth
32088                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32089                .await
32090            {
32091                Ok(token) => token,
32092                Err(e) => match dlg.token(e) {
32093                    Ok(token) => token,
32094                    Err(e) => {
32095                        dlg.finished(false);
32096                        return Err(common::Error::MissingToken(e));
32097                    }
32098                },
32099            };
32100            let mut req_result = {
32101                let client = &self.hub.client;
32102                dlg.pre_request();
32103                let mut req_builder = hyper::Request::builder()
32104                    .method(hyper::Method::DELETE)
32105                    .uri(url.as_str())
32106                    .header(USER_AGENT, self.hub._user_agent.clone());
32107
32108                if let Some(token) = token.as_ref() {
32109                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32110                }
32111
32112                let request = req_builder
32113                    .header(CONTENT_LENGTH, 0_u64)
32114                    .body(common::to_body::<String>(None));
32115
32116                client.request(request.unwrap()).await
32117            };
32118
32119            match req_result {
32120                Err(err) => {
32121                    if let common::Retry::After(d) = dlg.http_error(&err) {
32122                        sleep(d).await;
32123                        continue;
32124                    }
32125                    dlg.finished(false);
32126                    return Err(common::Error::HttpError(err));
32127                }
32128                Ok(res) => {
32129                    let (mut parts, body) = res.into_parts();
32130                    let mut body = common::Body::new(body);
32131                    if !parts.status.is_success() {
32132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32133                        let error = serde_json::from_str(&common::to_string(&bytes));
32134                        let response = common::to_response(parts, bytes.into());
32135
32136                        if let common::Retry::After(d) =
32137                            dlg.http_failure(&response, error.as_ref().ok())
32138                        {
32139                            sleep(d).await;
32140                            continue;
32141                        }
32142
32143                        dlg.finished(false);
32144
32145                        return Err(match error {
32146                            Ok(value) => common::Error::BadRequest(value),
32147                            _ => common::Error::Failure(response),
32148                        });
32149                    }
32150                    let response = common::Response::from_parts(parts, body);
32151
32152                    dlg.finished(true);
32153                    return Ok(response);
32154                }
32155            }
32156        }
32157    }
32158
32159    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
32160    ///
32161    /// Sets the *path* path property to the given value.
32162    ///
32163    /// Even though the property as already been set when instantiating this call,
32164    /// we provide this method for API completeness.
32165    pub fn path(mut self, new_value: &str) -> AccountContainerDeleteCall<'a, C> {
32166        self._path = new_value.to_string();
32167        self
32168    }
32169    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32170    /// while executing the actual API request.
32171    ///
32172    /// ````text
32173    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32174    /// ````
32175    ///
32176    /// Sets the *delegate* property to the given value.
32177    pub fn delegate(
32178        mut self,
32179        new_value: &'a mut dyn common::Delegate,
32180    ) -> AccountContainerDeleteCall<'a, C> {
32181        self._delegate = Some(new_value);
32182        self
32183    }
32184
32185    /// Set any additional parameter of the query string used in the request.
32186    /// It should be used to set parameters which are not yet available through their own
32187    /// setters.
32188    ///
32189    /// Please note that this method must not be used to set any of the known parameters
32190    /// which have their own setter method. If done anyway, the request will fail.
32191    ///
32192    /// # Additional Parameters
32193    ///
32194    /// * *$.xgafv* (query-string) - V1 error format.
32195    /// * *access_token* (query-string) - OAuth access token.
32196    /// * *alt* (query-string) - Data format for response.
32197    /// * *callback* (query-string) - JSONP
32198    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32199    /// * *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.
32200    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32201    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32202    /// * *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.
32203    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32204    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32205    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDeleteCall<'a, C>
32206    where
32207        T: AsRef<str>,
32208    {
32209        self._additional_params
32210            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32211        self
32212    }
32213
32214    /// Identifies the authorization scope for the method you are building.
32215    ///
32216    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32217    /// [`Scope::DeleteContainer`].
32218    ///
32219    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32220    /// tokens for more than one scope.
32221    ///
32222    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32223    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32224    /// sufficient, a read-write scope will do as well.
32225    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDeleteCall<'a, C>
32226    where
32227        St: AsRef<str>,
32228    {
32229        self._scopes.insert(String::from(scope.as_ref()));
32230        self
32231    }
32232    /// Identifies the authorization scope(s) for the method you are building.
32233    ///
32234    /// See [`Self::add_scope()`] for details.
32235    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDeleteCall<'a, C>
32236    where
32237        I: IntoIterator<Item = St>,
32238        St: AsRef<str>,
32239    {
32240        self._scopes
32241            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32242        self
32243    }
32244
32245    /// Removes all scopes, and no default scope will be used either.
32246    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32247    /// for details).
32248    pub fn clear_scopes(mut self) -> AccountContainerDeleteCall<'a, C> {
32249        self._scopes.clear();
32250        self
32251    }
32252}
32253
32254/// Gets a Container.
32255///
32256/// A builder for the *containers.get* method supported by a *account* resource.
32257/// It is not used directly, but through a [`AccountMethods`] instance.
32258///
32259/// # Example
32260///
32261/// Instantiate a resource method builder
32262///
32263/// ```test_harness,no_run
32264/// # extern crate hyper;
32265/// # extern crate hyper_rustls;
32266/// # extern crate google_tagmanager2 as tagmanager2;
32267/// # async fn dox() {
32268/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32269///
32270/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32271/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32272/// #     secret,
32273/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32274/// # ).build().await.unwrap();
32275///
32276/// # let client = hyper_util::client::legacy::Client::builder(
32277/// #     hyper_util::rt::TokioExecutor::new()
32278/// # )
32279/// # .build(
32280/// #     hyper_rustls::HttpsConnectorBuilder::new()
32281/// #         .with_native_roots()
32282/// #         .unwrap()
32283/// #         .https_or_http()
32284/// #         .enable_http1()
32285/// #         .build()
32286/// # );
32287/// # let mut hub = TagManager::new(client, auth);
32288/// // You can configure optional parameters by calling the respective setters at will, and
32289/// // execute the final call using `doit()`.
32290/// // Values shown here are possibly random and not representative !
32291/// let result = hub.accounts().containers_get("path")
32292///              .doit().await;
32293/// # }
32294/// ```
32295pub struct AccountContainerGetCall<'a, C>
32296where
32297    C: 'a,
32298{
32299    hub: &'a TagManager<C>,
32300    _path: String,
32301    _delegate: Option<&'a mut dyn common::Delegate>,
32302    _additional_params: HashMap<String, String>,
32303    _scopes: BTreeSet<String>,
32304}
32305
32306impl<'a, C> common::CallBuilder for AccountContainerGetCall<'a, C> {}
32307
32308impl<'a, C> AccountContainerGetCall<'a, C>
32309where
32310    C: common::Connector,
32311{
32312    /// Perform the operation you have build so far.
32313    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
32314        use std::borrow::Cow;
32315        use std::io::{Read, Seek};
32316
32317        use common::{url::Params, ToParts};
32318        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32319
32320        let mut dd = common::DefaultDelegate;
32321        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32322        dlg.begin(common::MethodInfo {
32323            id: "tagmanager.accounts.containers.get",
32324            http_method: hyper::Method::GET,
32325        });
32326
32327        for &field in ["alt", "path"].iter() {
32328            if self._additional_params.contains_key(field) {
32329                dlg.finished(false);
32330                return Err(common::Error::FieldClash(field));
32331            }
32332        }
32333
32334        let mut params = Params::with_capacity(3 + self._additional_params.len());
32335        params.push("path", self._path);
32336
32337        params.extend(self._additional_params.iter());
32338
32339        params.push("alt", "json");
32340        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
32341        if self._scopes.is_empty() {
32342            self._scopes.insert(Scope::Readonly.as_ref().to_string());
32343        }
32344
32345        #[allow(clippy::single_element_loop)]
32346        for &(find_this, param_name) in [("{+path}", "path")].iter() {
32347            url = params.uri_replacement(url, param_name, find_this, true);
32348        }
32349        {
32350            let to_remove = ["path"];
32351            params.remove_params(&to_remove);
32352        }
32353
32354        let url = params.parse_with_url(&url);
32355
32356        loop {
32357            let token = match self
32358                .hub
32359                .auth
32360                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32361                .await
32362            {
32363                Ok(token) => token,
32364                Err(e) => match dlg.token(e) {
32365                    Ok(token) => token,
32366                    Err(e) => {
32367                        dlg.finished(false);
32368                        return Err(common::Error::MissingToken(e));
32369                    }
32370                },
32371            };
32372            let mut req_result = {
32373                let client = &self.hub.client;
32374                dlg.pre_request();
32375                let mut req_builder = hyper::Request::builder()
32376                    .method(hyper::Method::GET)
32377                    .uri(url.as_str())
32378                    .header(USER_AGENT, self.hub._user_agent.clone());
32379
32380                if let Some(token) = token.as_ref() {
32381                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32382                }
32383
32384                let request = req_builder
32385                    .header(CONTENT_LENGTH, 0_u64)
32386                    .body(common::to_body::<String>(None));
32387
32388                client.request(request.unwrap()).await
32389            };
32390
32391            match req_result {
32392                Err(err) => {
32393                    if let common::Retry::After(d) = dlg.http_error(&err) {
32394                        sleep(d).await;
32395                        continue;
32396                    }
32397                    dlg.finished(false);
32398                    return Err(common::Error::HttpError(err));
32399                }
32400                Ok(res) => {
32401                    let (mut parts, body) = res.into_parts();
32402                    let mut body = common::Body::new(body);
32403                    if !parts.status.is_success() {
32404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32405                        let error = serde_json::from_str(&common::to_string(&bytes));
32406                        let response = common::to_response(parts, bytes.into());
32407
32408                        if let common::Retry::After(d) =
32409                            dlg.http_failure(&response, error.as_ref().ok())
32410                        {
32411                            sleep(d).await;
32412                            continue;
32413                        }
32414
32415                        dlg.finished(false);
32416
32417                        return Err(match error {
32418                            Ok(value) => common::Error::BadRequest(value),
32419                            _ => common::Error::Failure(response),
32420                        });
32421                    }
32422                    let response = {
32423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32424                        let encoded = common::to_string(&bytes);
32425                        match serde_json::from_str(&encoded) {
32426                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32427                            Err(error) => {
32428                                dlg.response_json_decode_error(&encoded, &error);
32429                                return Err(common::Error::JsonDecodeError(
32430                                    encoded.to_string(),
32431                                    error,
32432                                ));
32433                            }
32434                        }
32435                    };
32436
32437                    dlg.finished(true);
32438                    return Ok(response);
32439                }
32440            }
32441        }
32442    }
32443
32444    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
32445    ///
32446    /// Sets the *path* path property to the given value.
32447    ///
32448    /// Even though the property as already been set when instantiating this call,
32449    /// we provide this method for API completeness.
32450    pub fn path(mut self, new_value: &str) -> AccountContainerGetCall<'a, C> {
32451        self._path = new_value.to_string();
32452        self
32453    }
32454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32455    /// while executing the actual API request.
32456    ///
32457    /// ````text
32458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32459    /// ````
32460    ///
32461    /// Sets the *delegate* property to the given value.
32462    pub fn delegate(
32463        mut self,
32464        new_value: &'a mut dyn common::Delegate,
32465    ) -> AccountContainerGetCall<'a, C> {
32466        self._delegate = Some(new_value);
32467        self
32468    }
32469
32470    /// Set any additional parameter of the query string used in the request.
32471    /// It should be used to set parameters which are not yet available through their own
32472    /// setters.
32473    ///
32474    /// Please note that this method must not be used to set any of the known parameters
32475    /// which have their own setter method. If done anyway, the request will fail.
32476    ///
32477    /// # Additional Parameters
32478    ///
32479    /// * *$.xgafv* (query-string) - V1 error format.
32480    /// * *access_token* (query-string) - OAuth access token.
32481    /// * *alt* (query-string) - Data format for response.
32482    /// * *callback* (query-string) - JSONP
32483    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32484    /// * *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.
32485    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32486    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32487    /// * *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.
32488    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32489    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32490    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerGetCall<'a, C>
32491    where
32492        T: AsRef<str>,
32493    {
32494        self._additional_params
32495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32496        self
32497    }
32498
32499    /// Identifies the authorization scope for the method you are building.
32500    ///
32501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32502    /// [`Scope::Readonly`].
32503    ///
32504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32505    /// tokens for more than one scope.
32506    ///
32507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32509    /// sufficient, a read-write scope will do as well.
32510    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerGetCall<'a, C>
32511    where
32512        St: AsRef<str>,
32513    {
32514        self._scopes.insert(String::from(scope.as_ref()));
32515        self
32516    }
32517    /// Identifies the authorization scope(s) for the method you are building.
32518    ///
32519    /// See [`Self::add_scope()`] for details.
32520    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerGetCall<'a, C>
32521    where
32522        I: IntoIterator<Item = St>,
32523        St: AsRef<str>,
32524    {
32525        self._scopes
32526            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32527        self
32528    }
32529
32530    /// Removes all scopes, and no default scope will be used either.
32531    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32532    /// for details).
32533    pub fn clear_scopes(mut self) -> AccountContainerGetCall<'a, C> {
32534        self._scopes.clear();
32535        self
32536    }
32537}
32538
32539/// Lists all Containers that belongs to a GTM Account.
32540///
32541/// A builder for the *containers.list* method supported by a *account* resource.
32542/// It is not used directly, but through a [`AccountMethods`] instance.
32543///
32544/// # Example
32545///
32546/// Instantiate a resource method builder
32547///
32548/// ```test_harness,no_run
32549/// # extern crate hyper;
32550/// # extern crate hyper_rustls;
32551/// # extern crate google_tagmanager2 as tagmanager2;
32552/// # async fn dox() {
32553/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32554///
32555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32556/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32557/// #     secret,
32558/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32559/// # ).build().await.unwrap();
32560///
32561/// # let client = hyper_util::client::legacy::Client::builder(
32562/// #     hyper_util::rt::TokioExecutor::new()
32563/// # )
32564/// # .build(
32565/// #     hyper_rustls::HttpsConnectorBuilder::new()
32566/// #         .with_native_roots()
32567/// #         .unwrap()
32568/// #         .https_or_http()
32569/// #         .enable_http1()
32570/// #         .build()
32571/// # );
32572/// # let mut hub = TagManager::new(client, auth);
32573/// // You can configure optional parameters by calling the respective setters at will, and
32574/// // execute the final call using `doit()`.
32575/// // Values shown here are possibly random and not representative !
32576/// let result = hub.accounts().containers_list("parent")
32577///              .page_token("sit")
32578///              .doit().await;
32579/// # }
32580/// ```
32581pub struct AccountContainerListCall<'a, C>
32582where
32583    C: 'a,
32584{
32585    hub: &'a TagManager<C>,
32586    _parent: String,
32587    _page_token: Option<String>,
32588    _delegate: Option<&'a mut dyn common::Delegate>,
32589    _additional_params: HashMap<String, String>,
32590    _scopes: BTreeSet<String>,
32591}
32592
32593impl<'a, C> common::CallBuilder for AccountContainerListCall<'a, C> {}
32594
32595impl<'a, C> AccountContainerListCall<'a, C>
32596where
32597    C: common::Connector,
32598{
32599    /// Perform the operation you have build so far.
32600    pub async fn doit(mut self) -> common::Result<(common::Response, ListContainersResponse)> {
32601        use std::borrow::Cow;
32602        use std::io::{Read, Seek};
32603
32604        use common::{url::Params, ToParts};
32605        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32606
32607        let mut dd = common::DefaultDelegate;
32608        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32609        dlg.begin(common::MethodInfo {
32610            id: "tagmanager.accounts.containers.list",
32611            http_method: hyper::Method::GET,
32612        });
32613
32614        for &field in ["alt", "parent", "pageToken"].iter() {
32615            if self._additional_params.contains_key(field) {
32616                dlg.finished(false);
32617                return Err(common::Error::FieldClash(field));
32618            }
32619        }
32620
32621        let mut params = Params::with_capacity(4 + self._additional_params.len());
32622        params.push("parent", self._parent);
32623        if let Some(value) = self._page_token.as_ref() {
32624            params.push("pageToken", value);
32625        }
32626
32627        params.extend(self._additional_params.iter());
32628
32629        params.push("alt", "json");
32630        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/containers";
32631        if self._scopes.is_empty() {
32632            self._scopes.insert(Scope::Readonly.as_ref().to_string());
32633        }
32634
32635        #[allow(clippy::single_element_loop)]
32636        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
32637            url = params.uri_replacement(url, param_name, find_this, true);
32638        }
32639        {
32640            let to_remove = ["parent"];
32641            params.remove_params(&to_remove);
32642        }
32643
32644        let url = params.parse_with_url(&url);
32645
32646        loop {
32647            let token = match self
32648                .hub
32649                .auth
32650                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32651                .await
32652            {
32653                Ok(token) => token,
32654                Err(e) => match dlg.token(e) {
32655                    Ok(token) => token,
32656                    Err(e) => {
32657                        dlg.finished(false);
32658                        return Err(common::Error::MissingToken(e));
32659                    }
32660                },
32661            };
32662            let mut req_result = {
32663                let client = &self.hub.client;
32664                dlg.pre_request();
32665                let mut req_builder = hyper::Request::builder()
32666                    .method(hyper::Method::GET)
32667                    .uri(url.as_str())
32668                    .header(USER_AGENT, self.hub._user_agent.clone());
32669
32670                if let Some(token) = token.as_ref() {
32671                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32672                }
32673
32674                let request = req_builder
32675                    .header(CONTENT_LENGTH, 0_u64)
32676                    .body(common::to_body::<String>(None));
32677
32678                client.request(request.unwrap()).await
32679            };
32680
32681            match req_result {
32682                Err(err) => {
32683                    if let common::Retry::After(d) = dlg.http_error(&err) {
32684                        sleep(d).await;
32685                        continue;
32686                    }
32687                    dlg.finished(false);
32688                    return Err(common::Error::HttpError(err));
32689                }
32690                Ok(res) => {
32691                    let (mut parts, body) = res.into_parts();
32692                    let mut body = common::Body::new(body);
32693                    if !parts.status.is_success() {
32694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32695                        let error = serde_json::from_str(&common::to_string(&bytes));
32696                        let response = common::to_response(parts, bytes.into());
32697
32698                        if let common::Retry::After(d) =
32699                            dlg.http_failure(&response, error.as_ref().ok())
32700                        {
32701                            sleep(d).await;
32702                            continue;
32703                        }
32704
32705                        dlg.finished(false);
32706
32707                        return Err(match error {
32708                            Ok(value) => common::Error::BadRequest(value),
32709                            _ => common::Error::Failure(response),
32710                        });
32711                    }
32712                    let response = {
32713                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32714                        let encoded = common::to_string(&bytes);
32715                        match serde_json::from_str(&encoded) {
32716                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32717                            Err(error) => {
32718                                dlg.response_json_decode_error(&encoded, &error);
32719                                return Err(common::Error::JsonDecodeError(
32720                                    encoded.to_string(),
32721                                    error,
32722                                ));
32723                            }
32724                        }
32725                    };
32726
32727                    dlg.finished(true);
32728                    return Ok(response);
32729                }
32730            }
32731        }
32732    }
32733
32734    /// GTM Account's API relative path. Example: accounts/{account_id}.
32735    ///
32736    /// Sets the *parent* path property to the given value.
32737    ///
32738    /// Even though the property as already been set when instantiating this call,
32739    /// we provide this method for API completeness.
32740    pub fn parent(mut self, new_value: &str) -> AccountContainerListCall<'a, C> {
32741        self._parent = new_value.to_string();
32742        self
32743    }
32744    /// Continuation token for fetching the next page of results.
32745    ///
32746    /// Sets the *page token* query property to the given value.
32747    pub fn page_token(mut self, new_value: &str) -> AccountContainerListCall<'a, C> {
32748        self._page_token = Some(new_value.to_string());
32749        self
32750    }
32751    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32752    /// while executing the actual API request.
32753    ///
32754    /// ````text
32755    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32756    /// ````
32757    ///
32758    /// Sets the *delegate* property to the given value.
32759    pub fn delegate(
32760        mut self,
32761        new_value: &'a mut dyn common::Delegate,
32762    ) -> AccountContainerListCall<'a, C> {
32763        self._delegate = Some(new_value);
32764        self
32765    }
32766
32767    /// Set any additional parameter of the query string used in the request.
32768    /// It should be used to set parameters which are not yet available through their own
32769    /// setters.
32770    ///
32771    /// Please note that this method must not be used to set any of the known parameters
32772    /// which have their own setter method. If done anyway, the request will fail.
32773    ///
32774    /// # Additional Parameters
32775    ///
32776    /// * *$.xgafv* (query-string) - V1 error format.
32777    /// * *access_token* (query-string) - OAuth access token.
32778    /// * *alt* (query-string) - Data format for response.
32779    /// * *callback* (query-string) - JSONP
32780    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32781    /// * *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.
32782    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32783    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32784    /// * *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.
32785    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32786    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32787    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerListCall<'a, C>
32788    where
32789        T: AsRef<str>,
32790    {
32791        self._additional_params
32792            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32793        self
32794    }
32795
32796    /// Identifies the authorization scope for the method you are building.
32797    ///
32798    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32799    /// [`Scope::Readonly`].
32800    ///
32801    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32802    /// tokens for more than one scope.
32803    ///
32804    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32805    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32806    /// sufficient, a read-write scope will do as well.
32807    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerListCall<'a, C>
32808    where
32809        St: AsRef<str>,
32810    {
32811        self._scopes.insert(String::from(scope.as_ref()));
32812        self
32813    }
32814    /// Identifies the authorization scope(s) for the method you are building.
32815    ///
32816    /// See [`Self::add_scope()`] for details.
32817    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerListCall<'a, C>
32818    where
32819        I: IntoIterator<Item = St>,
32820        St: AsRef<str>,
32821    {
32822        self._scopes
32823            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32824        self
32825    }
32826
32827    /// Removes all scopes, and no default scope will be used either.
32828    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32829    /// for details).
32830    pub fn clear_scopes(mut self) -> AccountContainerListCall<'a, C> {
32831        self._scopes.clear();
32832        self
32833    }
32834}
32835
32836/// Looks up a Container by destination ID.
32837///
32838/// A builder for the *containers.lookup* method supported by a *account* resource.
32839/// It is not used directly, but through a [`AccountMethods`] instance.
32840///
32841/// # Example
32842///
32843/// Instantiate a resource method builder
32844///
32845/// ```test_harness,no_run
32846/// # extern crate hyper;
32847/// # extern crate hyper_rustls;
32848/// # extern crate google_tagmanager2 as tagmanager2;
32849/// # async fn dox() {
32850/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32851///
32852/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32854/// #     secret,
32855/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32856/// # ).build().await.unwrap();
32857///
32858/// # let client = hyper_util::client::legacy::Client::builder(
32859/// #     hyper_util::rt::TokioExecutor::new()
32860/// # )
32861/// # .build(
32862/// #     hyper_rustls::HttpsConnectorBuilder::new()
32863/// #         .with_native_roots()
32864/// #         .unwrap()
32865/// #         .https_or_http()
32866/// #         .enable_http1()
32867/// #         .build()
32868/// # );
32869/// # let mut hub = TagManager::new(client, auth);
32870/// // You can configure optional parameters by calling the respective setters at will, and
32871/// // execute the final call using `doit()`.
32872/// // Values shown here are possibly random and not representative !
32873/// let result = hub.accounts().containers_lookup()
32874///              .destination_id("erat")
32875///              .doit().await;
32876/// # }
32877/// ```
32878pub struct AccountContainerLookupCall<'a, C>
32879where
32880    C: 'a,
32881{
32882    hub: &'a TagManager<C>,
32883    _destination_id: Option<String>,
32884    _delegate: Option<&'a mut dyn common::Delegate>,
32885    _additional_params: HashMap<String, String>,
32886    _scopes: BTreeSet<String>,
32887}
32888
32889impl<'a, C> common::CallBuilder for AccountContainerLookupCall<'a, C> {}
32890
32891impl<'a, C> AccountContainerLookupCall<'a, C>
32892where
32893    C: common::Connector,
32894{
32895    /// Perform the operation you have build so far.
32896    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
32897        use std::borrow::Cow;
32898        use std::io::{Read, Seek};
32899
32900        use common::{url::Params, ToParts};
32901        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32902
32903        let mut dd = common::DefaultDelegate;
32904        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32905        dlg.begin(common::MethodInfo {
32906            id: "tagmanager.accounts.containers.lookup",
32907            http_method: hyper::Method::GET,
32908        });
32909
32910        for &field in ["alt", "destinationId"].iter() {
32911            if self._additional_params.contains_key(field) {
32912                dlg.finished(false);
32913                return Err(common::Error::FieldClash(field));
32914            }
32915        }
32916
32917        let mut params = Params::with_capacity(3 + self._additional_params.len());
32918        if let Some(value) = self._destination_id.as_ref() {
32919            params.push("destinationId", value);
32920        }
32921
32922        params.extend(self._additional_params.iter());
32923
32924        params.push("alt", "json");
32925        let mut url = self.hub._base_url.clone() + "tagmanager/v2/accounts/containers:lookup";
32926        if self._scopes.is_empty() {
32927            self._scopes.insert(Scope::Readonly.as_ref().to_string());
32928        }
32929
32930        let url = params.parse_with_url(&url);
32931
32932        loop {
32933            let token = match self
32934                .hub
32935                .auth
32936                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32937                .await
32938            {
32939                Ok(token) => token,
32940                Err(e) => match dlg.token(e) {
32941                    Ok(token) => token,
32942                    Err(e) => {
32943                        dlg.finished(false);
32944                        return Err(common::Error::MissingToken(e));
32945                    }
32946                },
32947            };
32948            let mut req_result = {
32949                let client = &self.hub.client;
32950                dlg.pre_request();
32951                let mut req_builder = hyper::Request::builder()
32952                    .method(hyper::Method::GET)
32953                    .uri(url.as_str())
32954                    .header(USER_AGENT, self.hub._user_agent.clone());
32955
32956                if let Some(token) = token.as_ref() {
32957                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32958                }
32959
32960                let request = req_builder
32961                    .header(CONTENT_LENGTH, 0_u64)
32962                    .body(common::to_body::<String>(None));
32963
32964                client.request(request.unwrap()).await
32965            };
32966
32967            match req_result {
32968                Err(err) => {
32969                    if let common::Retry::After(d) = dlg.http_error(&err) {
32970                        sleep(d).await;
32971                        continue;
32972                    }
32973                    dlg.finished(false);
32974                    return Err(common::Error::HttpError(err));
32975                }
32976                Ok(res) => {
32977                    let (mut parts, body) = res.into_parts();
32978                    let mut body = common::Body::new(body);
32979                    if !parts.status.is_success() {
32980                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32981                        let error = serde_json::from_str(&common::to_string(&bytes));
32982                        let response = common::to_response(parts, bytes.into());
32983
32984                        if let common::Retry::After(d) =
32985                            dlg.http_failure(&response, error.as_ref().ok())
32986                        {
32987                            sleep(d).await;
32988                            continue;
32989                        }
32990
32991                        dlg.finished(false);
32992
32993                        return Err(match error {
32994                            Ok(value) => common::Error::BadRequest(value),
32995                            _ => common::Error::Failure(response),
32996                        });
32997                    }
32998                    let response = {
32999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33000                        let encoded = common::to_string(&bytes);
33001                        match serde_json::from_str(&encoded) {
33002                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33003                            Err(error) => {
33004                                dlg.response_json_decode_error(&encoded, &error);
33005                                return Err(common::Error::JsonDecodeError(
33006                                    encoded.to_string(),
33007                                    error,
33008                                ));
33009                            }
33010                        }
33011                    };
33012
33013                    dlg.finished(true);
33014                    return Ok(response);
33015                }
33016            }
33017        }
33018    }
33019
33020    /// Destination ID linked to a GTM Container, e.g. AW-123456789. Example: accounts/containers:lookup?destination_id={destination_id}.
33021    ///
33022    /// Sets the *destination id* query property to the given value.
33023    pub fn destination_id(mut self, new_value: &str) -> AccountContainerLookupCall<'a, C> {
33024        self._destination_id = Some(new_value.to_string());
33025        self
33026    }
33027    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33028    /// while executing the actual API request.
33029    ///
33030    /// ````text
33031    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33032    /// ````
33033    ///
33034    /// Sets the *delegate* property to the given value.
33035    pub fn delegate(
33036        mut self,
33037        new_value: &'a mut dyn common::Delegate,
33038    ) -> AccountContainerLookupCall<'a, C> {
33039        self._delegate = Some(new_value);
33040        self
33041    }
33042
33043    /// Set any additional parameter of the query string used in the request.
33044    /// It should be used to set parameters which are not yet available through their own
33045    /// setters.
33046    ///
33047    /// Please note that this method must not be used to set any of the known parameters
33048    /// which have their own setter method. If done anyway, the request will fail.
33049    ///
33050    /// # Additional Parameters
33051    ///
33052    /// * *$.xgafv* (query-string) - V1 error format.
33053    /// * *access_token* (query-string) - OAuth access token.
33054    /// * *alt* (query-string) - Data format for response.
33055    /// * *callback* (query-string) - JSONP
33056    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33057    /// * *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.
33058    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33059    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33060    /// * *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.
33061    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33062    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33063    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerLookupCall<'a, C>
33064    where
33065        T: AsRef<str>,
33066    {
33067        self._additional_params
33068            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33069        self
33070    }
33071
33072    /// Identifies the authorization scope for the method you are building.
33073    ///
33074    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33075    /// [`Scope::Readonly`].
33076    ///
33077    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33078    /// tokens for more than one scope.
33079    ///
33080    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33081    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33082    /// sufficient, a read-write scope will do as well.
33083    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerLookupCall<'a, C>
33084    where
33085        St: AsRef<str>,
33086    {
33087        self._scopes.insert(String::from(scope.as_ref()));
33088        self
33089    }
33090    /// Identifies the authorization scope(s) for the method you are building.
33091    ///
33092    /// See [`Self::add_scope()`] for details.
33093    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerLookupCall<'a, C>
33094    where
33095        I: IntoIterator<Item = St>,
33096        St: AsRef<str>,
33097    {
33098        self._scopes
33099            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33100        self
33101    }
33102
33103    /// Removes all scopes, and no default scope will be used either.
33104    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33105    /// for details).
33106    pub fn clear_scopes(mut self) -> AccountContainerLookupCall<'a, C> {
33107        self._scopes.clear();
33108        self
33109    }
33110}
33111
33112/// Move Tag ID out of a Container.
33113///
33114/// A builder for the *containers.move_tag_id* method supported by a *account* resource.
33115/// It is not used directly, but through a [`AccountMethods`] instance.
33116///
33117/// # Example
33118///
33119/// Instantiate a resource method builder
33120///
33121/// ```test_harness,no_run
33122/// # extern crate hyper;
33123/// # extern crate hyper_rustls;
33124/// # extern crate google_tagmanager2 as tagmanager2;
33125/// # async fn dox() {
33126/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33127///
33128/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33129/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33130/// #     secret,
33131/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33132/// # ).build().await.unwrap();
33133///
33134/// # let client = hyper_util::client::legacy::Client::builder(
33135/// #     hyper_util::rt::TokioExecutor::new()
33136/// # )
33137/// # .build(
33138/// #     hyper_rustls::HttpsConnectorBuilder::new()
33139/// #         .with_native_roots()
33140/// #         .unwrap()
33141/// #         .https_or_http()
33142/// #         .enable_http1()
33143/// #         .build()
33144/// # );
33145/// # let mut hub = TagManager::new(client, auth);
33146/// // You can configure optional parameters by calling the respective setters at will, and
33147/// // execute the final call using `doit()`.
33148/// // Values shown here are possibly random and not representative !
33149/// let result = hub.accounts().containers_move_tag_id("path")
33150///              .tag_name("nonumy")
33151///              .tag_id("et")
33152///              .copy_users(true)
33153///              .copy_terms_of_service(false)
33154///              .copy_settings(false)
33155///              .allow_user_permission_feature_update(false)
33156///              .doit().await;
33157/// # }
33158/// ```
33159pub struct AccountContainerMoveTagIdCall<'a, C>
33160where
33161    C: 'a,
33162{
33163    hub: &'a TagManager<C>,
33164    _path: String,
33165    _tag_name: Option<String>,
33166    _tag_id: Option<String>,
33167    _copy_users: Option<bool>,
33168    _copy_terms_of_service: Option<bool>,
33169    _copy_settings: Option<bool>,
33170    _allow_user_permission_feature_update: Option<bool>,
33171    _delegate: Option<&'a mut dyn common::Delegate>,
33172    _additional_params: HashMap<String, String>,
33173    _scopes: BTreeSet<String>,
33174}
33175
33176impl<'a, C> common::CallBuilder for AccountContainerMoveTagIdCall<'a, C> {}
33177
33178impl<'a, C> AccountContainerMoveTagIdCall<'a, C>
33179where
33180    C: common::Connector,
33181{
33182    /// Perform the operation you have build so far.
33183    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
33184        use std::borrow::Cow;
33185        use std::io::{Read, Seek};
33186
33187        use common::{url::Params, ToParts};
33188        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33189
33190        let mut dd = common::DefaultDelegate;
33191        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33192        dlg.begin(common::MethodInfo {
33193            id: "tagmanager.accounts.containers.move_tag_id",
33194            http_method: hyper::Method::POST,
33195        });
33196
33197        for &field in [
33198            "alt",
33199            "path",
33200            "tagName",
33201            "tagId",
33202            "copyUsers",
33203            "copyTermsOfService",
33204            "copySettings",
33205            "allowUserPermissionFeatureUpdate",
33206        ]
33207        .iter()
33208        {
33209            if self._additional_params.contains_key(field) {
33210                dlg.finished(false);
33211                return Err(common::Error::FieldClash(field));
33212            }
33213        }
33214
33215        let mut params = Params::with_capacity(9 + self._additional_params.len());
33216        params.push("path", self._path);
33217        if let Some(value) = self._tag_name.as_ref() {
33218            params.push("tagName", value);
33219        }
33220        if let Some(value) = self._tag_id.as_ref() {
33221            params.push("tagId", value);
33222        }
33223        if let Some(value) = self._copy_users.as_ref() {
33224            params.push("copyUsers", value.to_string());
33225        }
33226        if let Some(value) = self._copy_terms_of_service.as_ref() {
33227            params.push("copyTermsOfService", value.to_string());
33228        }
33229        if let Some(value) = self._copy_settings.as_ref() {
33230            params.push("copySettings", value.to_string());
33231        }
33232        if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
33233            params.push("allowUserPermissionFeatureUpdate", value.to_string());
33234        }
33235
33236        params.extend(self._additional_params.iter());
33237
33238        params.push("alt", "json");
33239        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:move_tag_id";
33240        if self._scopes.is_empty() {
33241            self._scopes
33242                .insert(Scope::EditContainer.as_ref().to_string());
33243        }
33244
33245        #[allow(clippy::single_element_loop)]
33246        for &(find_this, param_name) in [("{+path}", "path")].iter() {
33247            url = params.uri_replacement(url, param_name, find_this, true);
33248        }
33249        {
33250            let to_remove = ["path"];
33251            params.remove_params(&to_remove);
33252        }
33253
33254        let url = params.parse_with_url(&url);
33255
33256        loop {
33257            let token = match self
33258                .hub
33259                .auth
33260                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33261                .await
33262            {
33263                Ok(token) => token,
33264                Err(e) => match dlg.token(e) {
33265                    Ok(token) => token,
33266                    Err(e) => {
33267                        dlg.finished(false);
33268                        return Err(common::Error::MissingToken(e));
33269                    }
33270                },
33271            };
33272            let mut req_result = {
33273                let client = &self.hub.client;
33274                dlg.pre_request();
33275                let mut req_builder = hyper::Request::builder()
33276                    .method(hyper::Method::POST)
33277                    .uri(url.as_str())
33278                    .header(USER_AGENT, self.hub._user_agent.clone());
33279
33280                if let Some(token) = token.as_ref() {
33281                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33282                }
33283
33284                let request = req_builder
33285                    .header(CONTENT_LENGTH, 0_u64)
33286                    .body(common::to_body::<String>(None));
33287
33288                client.request(request.unwrap()).await
33289            };
33290
33291            match req_result {
33292                Err(err) => {
33293                    if let common::Retry::After(d) = dlg.http_error(&err) {
33294                        sleep(d).await;
33295                        continue;
33296                    }
33297                    dlg.finished(false);
33298                    return Err(common::Error::HttpError(err));
33299                }
33300                Ok(res) => {
33301                    let (mut parts, body) = res.into_parts();
33302                    let mut body = common::Body::new(body);
33303                    if !parts.status.is_success() {
33304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33305                        let error = serde_json::from_str(&common::to_string(&bytes));
33306                        let response = common::to_response(parts, bytes.into());
33307
33308                        if let common::Retry::After(d) =
33309                            dlg.http_failure(&response, error.as_ref().ok())
33310                        {
33311                            sleep(d).await;
33312                            continue;
33313                        }
33314
33315                        dlg.finished(false);
33316
33317                        return Err(match error {
33318                            Ok(value) => common::Error::BadRequest(value),
33319                            _ => common::Error::Failure(response),
33320                        });
33321                    }
33322                    let response = {
33323                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33324                        let encoded = common::to_string(&bytes);
33325                        match serde_json::from_str(&encoded) {
33326                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33327                            Err(error) => {
33328                                dlg.response_json_decode_error(&encoded, &error);
33329                                return Err(common::Error::JsonDecodeError(
33330                                    encoded.to_string(),
33331                                    error,
33332                                ));
33333                            }
33334                        }
33335                    };
33336
33337                    dlg.finished(true);
33338                    return Ok(response);
33339                }
33340            }
33341        }
33342    }
33343
33344    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
33345    ///
33346    /// Sets the *path* path property to the given value.
33347    ///
33348    /// Even though the property as already been set when instantiating this call,
33349    /// we provide this method for API completeness.
33350    pub fn path(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
33351        self._path = new_value.to_string();
33352        self
33353    }
33354    /// The name for the newly created tag.
33355    ///
33356    /// Sets the *tag name* query property to the given value.
33357    pub fn tag_name(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
33358        self._tag_name = Some(new_value.to_string());
33359        self
33360    }
33361    /// Tag ID to be removed from the current Container.
33362    ///
33363    /// Sets the *tag id* query property to the given value.
33364    pub fn tag_id(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
33365        self._tag_id = Some(new_value.to_string());
33366        self
33367    }
33368    /// Whether or not to copy users from this tag to the new tag.
33369    ///
33370    /// Sets the *copy users* query property to the given value.
33371    pub fn copy_users(mut self, new_value: bool) -> AccountContainerMoveTagIdCall<'a, C> {
33372        self._copy_users = Some(new_value);
33373        self
33374    }
33375    /// Must be set to true to accept all terms of service agreements copied from the current tag to the newly created tag. If this bit is false, the operation will fail.
33376    ///
33377    /// Sets the *copy terms of service* query property to the given value.
33378    pub fn copy_terms_of_service(
33379        mut self,
33380        new_value: bool,
33381    ) -> AccountContainerMoveTagIdCall<'a, C> {
33382        self._copy_terms_of_service = Some(new_value);
33383        self
33384    }
33385    /// Whether or not to copy tag settings from this tag to the new tag.
33386    ///
33387    /// Sets the *copy settings* query property to the given value.
33388    pub fn copy_settings(mut self, new_value: bool) -> AccountContainerMoveTagIdCall<'a, C> {
33389        self._copy_settings = Some(new_value);
33390        self
33391    }
33392    /// Must be set to true to allow features.user_permissions to change from false to true. If this operation causes an update but this bit is false, the operation will fail.
33393    ///
33394    /// Sets the *allow user permission feature update* query property to the given value.
33395    pub fn allow_user_permission_feature_update(
33396        mut self,
33397        new_value: bool,
33398    ) -> AccountContainerMoveTagIdCall<'a, C> {
33399        self._allow_user_permission_feature_update = Some(new_value);
33400        self
33401    }
33402    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33403    /// while executing the actual API request.
33404    ///
33405    /// ````text
33406    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33407    /// ````
33408    ///
33409    /// Sets the *delegate* property to the given value.
33410    pub fn delegate(
33411        mut self,
33412        new_value: &'a mut dyn common::Delegate,
33413    ) -> AccountContainerMoveTagIdCall<'a, C> {
33414        self._delegate = Some(new_value);
33415        self
33416    }
33417
33418    /// Set any additional parameter of the query string used in the request.
33419    /// It should be used to set parameters which are not yet available through their own
33420    /// setters.
33421    ///
33422    /// Please note that this method must not be used to set any of the known parameters
33423    /// which have their own setter method. If done anyway, the request will fail.
33424    ///
33425    /// # Additional Parameters
33426    ///
33427    /// * *$.xgafv* (query-string) - V1 error format.
33428    /// * *access_token* (query-string) - OAuth access token.
33429    /// * *alt* (query-string) - Data format for response.
33430    /// * *callback* (query-string) - JSONP
33431    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33432    /// * *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.
33433    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33434    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33435    /// * *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.
33436    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33437    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33438    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerMoveTagIdCall<'a, C>
33439    where
33440        T: AsRef<str>,
33441    {
33442        self._additional_params
33443            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33444        self
33445    }
33446
33447    /// Identifies the authorization scope for the method you are building.
33448    ///
33449    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33450    /// [`Scope::EditContainer`].
33451    ///
33452    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33453    /// tokens for more than one scope.
33454    ///
33455    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33456    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33457    /// sufficient, a read-write scope will do as well.
33458    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerMoveTagIdCall<'a, C>
33459    where
33460        St: AsRef<str>,
33461    {
33462        self._scopes.insert(String::from(scope.as_ref()));
33463        self
33464    }
33465    /// Identifies the authorization scope(s) for the method you are building.
33466    ///
33467    /// See [`Self::add_scope()`] for details.
33468    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerMoveTagIdCall<'a, C>
33469    where
33470        I: IntoIterator<Item = St>,
33471        St: AsRef<str>,
33472    {
33473        self._scopes
33474            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33475        self
33476    }
33477
33478    /// Removes all scopes, and no default scope will be used either.
33479    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33480    /// for details).
33481    pub fn clear_scopes(mut self) -> AccountContainerMoveTagIdCall<'a, C> {
33482        self._scopes.clear();
33483        self
33484    }
33485}
33486
33487/// Gets the tagging snippet for a Container.
33488///
33489/// A builder for the *containers.snippet* method supported by a *account* resource.
33490/// It is not used directly, but through a [`AccountMethods`] instance.
33491///
33492/// # Example
33493///
33494/// Instantiate a resource method builder
33495///
33496/// ```test_harness,no_run
33497/// # extern crate hyper;
33498/// # extern crate hyper_rustls;
33499/// # extern crate google_tagmanager2 as tagmanager2;
33500/// # async fn dox() {
33501/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33502///
33503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33505/// #     secret,
33506/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33507/// # ).build().await.unwrap();
33508///
33509/// # let client = hyper_util::client::legacy::Client::builder(
33510/// #     hyper_util::rt::TokioExecutor::new()
33511/// # )
33512/// # .build(
33513/// #     hyper_rustls::HttpsConnectorBuilder::new()
33514/// #         .with_native_roots()
33515/// #         .unwrap()
33516/// #         .https_or_http()
33517/// #         .enable_http1()
33518/// #         .build()
33519/// # );
33520/// # let mut hub = TagManager::new(client, auth);
33521/// // You can configure optional parameters by calling the respective setters at will, and
33522/// // execute the final call using `doit()`.
33523/// // Values shown here are possibly random and not representative !
33524/// let result = hub.accounts().containers_snippet("path")
33525///              .doit().await;
33526/// # }
33527/// ```
33528pub struct AccountContainerSnippetCall<'a, C>
33529where
33530    C: 'a,
33531{
33532    hub: &'a TagManager<C>,
33533    _path: String,
33534    _delegate: Option<&'a mut dyn common::Delegate>,
33535    _additional_params: HashMap<String, String>,
33536    _scopes: BTreeSet<String>,
33537}
33538
33539impl<'a, C> common::CallBuilder for AccountContainerSnippetCall<'a, C> {}
33540
33541impl<'a, C> AccountContainerSnippetCall<'a, C>
33542where
33543    C: common::Connector,
33544{
33545    /// Perform the operation you have build so far.
33546    pub async fn doit(mut self) -> common::Result<(common::Response, GetContainerSnippetResponse)> {
33547        use std::borrow::Cow;
33548        use std::io::{Read, Seek};
33549
33550        use common::{url::Params, ToParts};
33551        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33552
33553        let mut dd = common::DefaultDelegate;
33554        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33555        dlg.begin(common::MethodInfo {
33556            id: "tagmanager.accounts.containers.snippet",
33557            http_method: hyper::Method::GET,
33558        });
33559
33560        for &field in ["alt", "path"].iter() {
33561            if self._additional_params.contains_key(field) {
33562                dlg.finished(false);
33563                return Err(common::Error::FieldClash(field));
33564            }
33565        }
33566
33567        let mut params = Params::with_capacity(3 + self._additional_params.len());
33568        params.push("path", self._path);
33569
33570        params.extend(self._additional_params.iter());
33571
33572        params.push("alt", "json");
33573        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:snippet";
33574        if self._scopes.is_empty() {
33575            self._scopes.insert(Scope::Readonly.as_ref().to_string());
33576        }
33577
33578        #[allow(clippy::single_element_loop)]
33579        for &(find_this, param_name) in [("{+path}", "path")].iter() {
33580            url = params.uri_replacement(url, param_name, find_this, true);
33581        }
33582        {
33583            let to_remove = ["path"];
33584            params.remove_params(&to_remove);
33585        }
33586
33587        let url = params.parse_with_url(&url);
33588
33589        loop {
33590            let token = match self
33591                .hub
33592                .auth
33593                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33594                .await
33595            {
33596                Ok(token) => token,
33597                Err(e) => match dlg.token(e) {
33598                    Ok(token) => token,
33599                    Err(e) => {
33600                        dlg.finished(false);
33601                        return Err(common::Error::MissingToken(e));
33602                    }
33603                },
33604            };
33605            let mut req_result = {
33606                let client = &self.hub.client;
33607                dlg.pre_request();
33608                let mut req_builder = hyper::Request::builder()
33609                    .method(hyper::Method::GET)
33610                    .uri(url.as_str())
33611                    .header(USER_AGENT, self.hub._user_agent.clone());
33612
33613                if let Some(token) = token.as_ref() {
33614                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33615                }
33616
33617                let request = req_builder
33618                    .header(CONTENT_LENGTH, 0_u64)
33619                    .body(common::to_body::<String>(None));
33620
33621                client.request(request.unwrap()).await
33622            };
33623
33624            match req_result {
33625                Err(err) => {
33626                    if let common::Retry::After(d) = dlg.http_error(&err) {
33627                        sleep(d).await;
33628                        continue;
33629                    }
33630                    dlg.finished(false);
33631                    return Err(common::Error::HttpError(err));
33632                }
33633                Ok(res) => {
33634                    let (mut parts, body) = res.into_parts();
33635                    let mut body = common::Body::new(body);
33636                    if !parts.status.is_success() {
33637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33638                        let error = serde_json::from_str(&common::to_string(&bytes));
33639                        let response = common::to_response(parts, bytes.into());
33640
33641                        if let common::Retry::After(d) =
33642                            dlg.http_failure(&response, error.as_ref().ok())
33643                        {
33644                            sleep(d).await;
33645                            continue;
33646                        }
33647
33648                        dlg.finished(false);
33649
33650                        return Err(match error {
33651                            Ok(value) => common::Error::BadRequest(value),
33652                            _ => common::Error::Failure(response),
33653                        });
33654                    }
33655                    let response = {
33656                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33657                        let encoded = common::to_string(&bytes);
33658                        match serde_json::from_str(&encoded) {
33659                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33660                            Err(error) => {
33661                                dlg.response_json_decode_error(&encoded, &error);
33662                                return Err(common::Error::JsonDecodeError(
33663                                    encoded.to_string(),
33664                                    error,
33665                                ));
33666                            }
33667                        }
33668                    };
33669
33670                    dlg.finished(true);
33671                    return Ok(response);
33672                }
33673            }
33674        }
33675    }
33676
33677    /// Container snippet's API relative path. Example: accounts/{account_id}/containers/{container_id}:snippet
33678    ///
33679    /// Sets the *path* path property to the given value.
33680    ///
33681    /// Even though the property as already been set when instantiating this call,
33682    /// we provide this method for API completeness.
33683    pub fn path(mut self, new_value: &str) -> AccountContainerSnippetCall<'a, C> {
33684        self._path = new_value.to_string();
33685        self
33686    }
33687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33688    /// while executing the actual API request.
33689    ///
33690    /// ````text
33691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33692    /// ````
33693    ///
33694    /// Sets the *delegate* property to the given value.
33695    pub fn delegate(
33696        mut self,
33697        new_value: &'a mut dyn common::Delegate,
33698    ) -> AccountContainerSnippetCall<'a, C> {
33699        self._delegate = Some(new_value);
33700        self
33701    }
33702
33703    /// Set any additional parameter of the query string used in the request.
33704    /// It should be used to set parameters which are not yet available through their own
33705    /// setters.
33706    ///
33707    /// Please note that this method must not be used to set any of the known parameters
33708    /// which have their own setter method. If done anyway, the request will fail.
33709    ///
33710    /// # Additional Parameters
33711    ///
33712    /// * *$.xgafv* (query-string) - V1 error format.
33713    /// * *access_token* (query-string) - OAuth access token.
33714    /// * *alt* (query-string) - Data format for response.
33715    /// * *callback* (query-string) - JSONP
33716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33717    /// * *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.
33718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33720    /// * *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.
33721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33723    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerSnippetCall<'a, C>
33724    where
33725        T: AsRef<str>,
33726    {
33727        self._additional_params
33728            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33729        self
33730    }
33731
33732    /// Identifies the authorization scope for the method you are building.
33733    ///
33734    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33735    /// [`Scope::Readonly`].
33736    ///
33737    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33738    /// tokens for more than one scope.
33739    ///
33740    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33741    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33742    /// sufficient, a read-write scope will do as well.
33743    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerSnippetCall<'a, C>
33744    where
33745        St: AsRef<str>,
33746    {
33747        self._scopes.insert(String::from(scope.as_ref()));
33748        self
33749    }
33750    /// Identifies the authorization scope(s) for the method you are building.
33751    ///
33752    /// See [`Self::add_scope()`] for details.
33753    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerSnippetCall<'a, C>
33754    where
33755        I: IntoIterator<Item = St>,
33756        St: AsRef<str>,
33757    {
33758        self._scopes
33759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33760        self
33761    }
33762
33763    /// Removes all scopes, and no default scope will be used either.
33764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33765    /// for details).
33766    pub fn clear_scopes(mut self) -> AccountContainerSnippetCall<'a, C> {
33767        self._scopes.clear();
33768        self
33769    }
33770}
33771
33772/// Updates a Container.
33773///
33774/// A builder for the *containers.update* method supported by a *account* resource.
33775/// It is not used directly, but through a [`AccountMethods`] instance.
33776///
33777/// # Example
33778///
33779/// Instantiate a resource method builder
33780///
33781/// ```test_harness,no_run
33782/// # extern crate hyper;
33783/// # extern crate hyper_rustls;
33784/// # extern crate google_tagmanager2 as tagmanager2;
33785/// use tagmanager2::api::Container;
33786/// # async fn dox() {
33787/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33788///
33789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33791/// #     secret,
33792/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33793/// # ).build().await.unwrap();
33794///
33795/// # let client = hyper_util::client::legacy::Client::builder(
33796/// #     hyper_util::rt::TokioExecutor::new()
33797/// # )
33798/// # .build(
33799/// #     hyper_rustls::HttpsConnectorBuilder::new()
33800/// #         .with_native_roots()
33801/// #         .unwrap()
33802/// #         .https_or_http()
33803/// #         .enable_http1()
33804/// #         .build()
33805/// # );
33806/// # let mut hub = TagManager::new(client, auth);
33807/// // As the method needs a request, you would usually fill it with the desired information
33808/// // into the respective structure. Some of the parts shown here might not be applicable !
33809/// // Values shown here are possibly random and not representative !
33810/// let mut req = Container::default();
33811///
33812/// // You can configure optional parameters by calling the respective setters at will, and
33813/// // execute the final call using `doit()`.
33814/// // Values shown here are possibly random and not representative !
33815/// let result = hub.accounts().containers_update(req, "path")
33816///              .fingerprint("gubergren")
33817///              .doit().await;
33818/// # }
33819/// ```
33820pub struct AccountContainerUpdateCall<'a, C>
33821where
33822    C: 'a,
33823{
33824    hub: &'a TagManager<C>,
33825    _request: Container,
33826    _path: String,
33827    _fingerprint: Option<String>,
33828    _delegate: Option<&'a mut dyn common::Delegate>,
33829    _additional_params: HashMap<String, String>,
33830    _scopes: BTreeSet<String>,
33831}
33832
33833impl<'a, C> common::CallBuilder for AccountContainerUpdateCall<'a, C> {}
33834
33835impl<'a, C> AccountContainerUpdateCall<'a, C>
33836where
33837    C: common::Connector,
33838{
33839    /// Perform the operation you have build so far.
33840    pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
33841        use std::borrow::Cow;
33842        use std::io::{Read, Seek};
33843
33844        use common::{url::Params, ToParts};
33845        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33846
33847        let mut dd = common::DefaultDelegate;
33848        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33849        dlg.begin(common::MethodInfo {
33850            id: "tagmanager.accounts.containers.update",
33851            http_method: hyper::Method::PUT,
33852        });
33853
33854        for &field in ["alt", "path", "fingerprint"].iter() {
33855            if self._additional_params.contains_key(field) {
33856                dlg.finished(false);
33857                return Err(common::Error::FieldClash(field));
33858            }
33859        }
33860
33861        let mut params = Params::with_capacity(5 + self._additional_params.len());
33862        params.push("path", self._path);
33863        if let Some(value) = self._fingerprint.as_ref() {
33864            params.push("fingerprint", value);
33865        }
33866
33867        params.extend(self._additional_params.iter());
33868
33869        params.push("alt", "json");
33870        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
33871        if self._scopes.is_empty() {
33872            self._scopes
33873                .insert(Scope::EditContainer.as_ref().to_string());
33874        }
33875
33876        #[allow(clippy::single_element_loop)]
33877        for &(find_this, param_name) in [("{+path}", "path")].iter() {
33878            url = params.uri_replacement(url, param_name, find_this, true);
33879        }
33880        {
33881            let to_remove = ["path"];
33882            params.remove_params(&to_remove);
33883        }
33884
33885        let url = params.parse_with_url(&url);
33886
33887        let mut json_mime_type = mime::APPLICATION_JSON;
33888        let mut request_value_reader = {
33889            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33890            common::remove_json_null_values(&mut value);
33891            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33892            serde_json::to_writer(&mut dst, &value).unwrap();
33893            dst
33894        };
33895        let request_size = request_value_reader
33896            .seek(std::io::SeekFrom::End(0))
33897            .unwrap();
33898        request_value_reader
33899            .seek(std::io::SeekFrom::Start(0))
33900            .unwrap();
33901
33902        loop {
33903            let token = match self
33904                .hub
33905                .auth
33906                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33907                .await
33908            {
33909                Ok(token) => token,
33910                Err(e) => match dlg.token(e) {
33911                    Ok(token) => token,
33912                    Err(e) => {
33913                        dlg.finished(false);
33914                        return Err(common::Error::MissingToken(e));
33915                    }
33916                },
33917            };
33918            request_value_reader
33919                .seek(std::io::SeekFrom::Start(0))
33920                .unwrap();
33921            let mut req_result = {
33922                let client = &self.hub.client;
33923                dlg.pre_request();
33924                let mut req_builder = hyper::Request::builder()
33925                    .method(hyper::Method::PUT)
33926                    .uri(url.as_str())
33927                    .header(USER_AGENT, self.hub._user_agent.clone());
33928
33929                if let Some(token) = token.as_ref() {
33930                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33931                }
33932
33933                let request = req_builder
33934                    .header(CONTENT_TYPE, json_mime_type.to_string())
33935                    .header(CONTENT_LENGTH, request_size as u64)
33936                    .body(common::to_body(
33937                        request_value_reader.get_ref().clone().into(),
33938                    ));
33939
33940                client.request(request.unwrap()).await
33941            };
33942
33943            match req_result {
33944                Err(err) => {
33945                    if let common::Retry::After(d) = dlg.http_error(&err) {
33946                        sleep(d).await;
33947                        continue;
33948                    }
33949                    dlg.finished(false);
33950                    return Err(common::Error::HttpError(err));
33951                }
33952                Ok(res) => {
33953                    let (mut parts, body) = res.into_parts();
33954                    let mut body = common::Body::new(body);
33955                    if !parts.status.is_success() {
33956                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33957                        let error = serde_json::from_str(&common::to_string(&bytes));
33958                        let response = common::to_response(parts, bytes.into());
33959
33960                        if let common::Retry::After(d) =
33961                            dlg.http_failure(&response, error.as_ref().ok())
33962                        {
33963                            sleep(d).await;
33964                            continue;
33965                        }
33966
33967                        dlg.finished(false);
33968
33969                        return Err(match error {
33970                            Ok(value) => common::Error::BadRequest(value),
33971                            _ => common::Error::Failure(response),
33972                        });
33973                    }
33974                    let response = {
33975                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33976                        let encoded = common::to_string(&bytes);
33977                        match serde_json::from_str(&encoded) {
33978                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33979                            Err(error) => {
33980                                dlg.response_json_decode_error(&encoded, &error);
33981                                return Err(common::Error::JsonDecodeError(
33982                                    encoded.to_string(),
33983                                    error,
33984                                ));
33985                            }
33986                        }
33987                    };
33988
33989                    dlg.finished(true);
33990                    return Ok(response);
33991                }
33992            }
33993        }
33994    }
33995
33996    ///
33997    /// Sets the *request* property to the given value.
33998    ///
33999    /// Even though the property as already been set when instantiating this call,
34000    /// we provide this method for API completeness.
34001    pub fn request(mut self, new_value: Container) -> AccountContainerUpdateCall<'a, C> {
34002        self._request = new_value;
34003        self
34004    }
34005    /// GTM Container's API relative path. Example: accounts/{account_id}/containers/{container_id}
34006    ///
34007    /// Sets the *path* path property to the given value.
34008    ///
34009    /// Even though the property as already been set when instantiating this call,
34010    /// we provide this method for API completeness.
34011    pub fn path(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
34012        self._path = new_value.to_string();
34013        self
34014    }
34015    /// When provided, this fingerprint must match the fingerprint of the container in storage.
34016    ///
34017    /// Sets the *fingerprint* query property to the given value.
34018    pub fn fingerprint(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
34019        self._fingerprint = Some(new_value.to_string());
34020        self
34021    }
34022    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34023    /// while executing the actual API request.
34024    ///
34025    /// ````text
34026    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34027    /// ````
34028    ///
34029    /// Sets the *delegate* property to the given value.
34030    pub fn delegate(
34031        mut self,
34032        new_value: &'a mut dyn common::Delegate,
34033    ) -> AccountContainerUpdateCall<'a, C> {
34034        self._delegate = Some(new_value);
34035        self
34036    }
34037
34038    /// Set any additional parameter of the query string used in the request.
34039    /// It should be used to set parameters which are not yet available through their own
34040    /// setters.
34041    ///
34042    /// Please note that this method must not be used to set any of the known parameters
34043    /// which have their own setter method. If done anyway, the request will fail.
34044    ///
34045    /// # Additional Parameters
34046    ///
34047    /// * *$.xgafv* (query-string) - V1 error format.
34048    /// * *access_token* (query-string) - OAuth access token.
34049    /// * *alt* (query-string) - Data format for response.
34050    /// * *callback* (query-string) - JSONP
34051    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34052    /// * *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.
34053    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34054    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34055    /// * *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.
34056    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34057    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34058    pub fn param<T>(mut self, name: T, value: T) -> AccountContainerUpdateCall<'a, C>
34059    where
34060        T: AsRef<str>,
34061    {
34062        self._additional_params
34063            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34064        self
34065    }
34066
34067    /// Identifies the authorization scope for the method you are building.
34068    ///
34069    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34070    /// [`Scope::EditContainer`].
34071    ///
34072    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34073    /// tokens for more than one scope.
34074    ///
34075    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34076    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34077    /// sufficient, a read-write scope will do as well.
34078    pub fn add_scope<St>(mut self, scope: St) -> AccountContainerUpdateCall<'a, C>
34079    where
34080        St: AsRef<str>,
34081    {
34082        self._scopes.insert(String::from(scope.as_ref()));
34083        self
34084    }
34085    /// Identifies the authorization scope(s) for the method you are building.
34086    ///
34087    /// See [`Self::add_scope()`] for details.
34088    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerUpdateCall<'a, C>
34089    where
34090        I: IntoIterator<Item = St>,
34091        St: AsRef<str>,
34092    {
34093        self._scopes
34094            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34095        self
34096    }
34097
34098    /// Removes all scopes, and no default scope will be used either.
34099    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34100    /// for details).
34101    pub fn clear_scopes(mut self) -> AccountContainerUpdateCall<'a, C> {
34102        self._scopes.clear();
34103        self
34104    }
34105}
34106
34107/// Creates a user's Account & Container access.
34108///
34109/// A builder for the *user_permissions.create* method supported by a *account* resource.
34110/// It is not used directly, but through a [`AccountMethods`] instance.
34111///
34112/// # Example
34113///
34114/// Instantiate a resource method builder
34115///
34116/// ```test_harness,no_run
34117/// # extern crate hyper;
34118/// # extern crate hyper_rustls;
34119/// # extern crate google_tagmanager2 as tagmanager2;
34120/// use tagmanager2::api::UserPermission;
34121/// # async fn dox() {
34122/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34123///
34124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34126/// #     secret,
34127/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34128/// # ).build().await.unwrap();
34129///
34130/// # let client = hyper_util::client::legacy::Client::builder(
34131/// #     hyper_util::rt::TokioExecutor::new()
34132/// # )
34133/// # .build(
34134/// #     hyper_rustls::HttpsConnectorBuilder::new()
34135/// #         .with_native_roots()
34136/// #         .unwrap()
34137/// #         .https_or_http()
34138/// #         .enable_http1()
34139/// #         .build()
34140/// # );
34141/// # let mut hub = TagManager::new(client, auth);
34142/// // As the method needs a request, you would usually fill it with the desired information
34143/// // into the respective structure. Some of the parts shown here might not be applicable !
34144/// // Values shown here are possibly random and not representative !
34145/// let mut req = UserPermission::default();
34146///
34147/// // You can configure optional parameters by calling the respective setters at will, and
34148/// // execute the final call using `doit()`.
34149/// // Values shown here are possibly random and not representative !
34150/// let result = hub.accounts().user_permissions_create(req, "parent")
34151///              .doit().await;
34152/// # }
34153/// ```
34154pub struct AccountUserPermissionCreateCall<'a, C>
34155where
34156    C: 'a,
34157{
34158    hub: &'a TagManager<C>,
34159    _request: UserPermission,
34160    _parent: String,
34161    _delegate: Option<&'a mut dyn common::Delegate>,
34162    _additional_params: HashMap<String, String>,
34163    _scopes: BTreeSet<String>,
34164}
34165
34166impl<'a, C> common::CallBuilder for AccountUserPermissionCreateCall<'a, C> {}
34167
34168impl<'a, C> AccountUserPermissionCreateCall<'a, C>
34169where
34170    C: common::Connector,
34171{
34172    /// Perform the operation you have build so far.
34173    pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
34174        use std::borrow::Cow;
34175        use std::io::{Read, Seek};
34176
34177        use common::{url::Params, ToParts};
34178        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34179
34180        let mut dd = common::DefaultDelegate;
34181        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34182        dlg.begin(common::MethodInfo {
34183            id: "tagmanager.accounts.user_permissions.create",
34184            http_method: hyper::Method::POST,
34185        });
34186
34187        for &field in ["alt", "parent"].iter() {
34188            if self._additional_params.contains_key(field) {
34189                dlg.finished(false);
34190                return Err(common::Error::FieldClash(field));
34191            }
34192        }
34193
34194        let mut params = Params::with_capacity(4 + self._additional_params.len());
34195        params.push("parent", self._parent);
34196
34197        params.extend(self._additional_params.iter());
34198
34199        params.push("alt", "json");
34200        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/user_permissions";
34201        if self._scopes.is_empty() {
34202            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
34203        }
34204
34205        #[allow(clippy::single_element_loop)]
34206        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
34207            url = params.uri_replacement(url, param_name, find_this, true);
34208        }
34209        {
34210            let to_remove = ["parent"];
34211            params.remove_params(&to_remove);
34212        }
34213
34214        let url = params.parse_with_url(&url);
34215
34216        let mut json_mime_type = mime::APPLICATION_JSON;
34217        let mut request_value_reader = {
34218            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34219            common::remove_json_null_values(&mut value);
34220            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34221            serde_json::to_writer(&mut dst, &value).unwrap();
34222            dst
34223        };
34224        let request_size = request_value_reader
34225            .seek(std::io::SeekFrom::End(0))
34226            .unwrap();
34227        request_value_reader
34228            .seek(std::io::SeekFrom::Start(0))
34229            .unwrap();
34230
34231        loop {
34232            let token = match self
34233                .hub
34234                .auth
34235                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34236                .await
34237            {
34238                Ok(token) => token,
34239                Err(e) => match dlg.token(e) {
34240                    Ok(token) => token,
34241                    Err(e) => {
34242                        dlg.finished(false);
34243                        return Err(common::Error::MissingToken(e));
34244                    }
34245                },
34246            };
34247            request_value_reader
34248                .seek(std::io::SeekFrom::Start(0))
34249                .unwrap();
34250            let mut req_result = {
34251                let client = &self.hub.client;
34252                dlg.pre_request();
34253                let mut req_builder = hyper::Request::builder()
34254                    .method(hyper::Method::POST)
34255                    .uri(url.as_str())
34256                    .header(USER_AGENT, self.hub._user_agent.clone());
34257
34258                if let Some(token) = token.as_ref() {
34259                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34260                }
34261
34262                let request = req_builder
34263                    .header(CONTENT_TYPE, json_mime_type.to_string())
34264                    .header(CONTENT_LENGTH, request_size as u64)
34265                    .body(common::to_body(
34266                        request_value_reader.get_ref().clone().into(),
34267                    ));
34268
34269                client.request(request.unwrap()).await
34270            };
34271
34272            match req_result {
34273                Err(err) => {
34274                    if let common::Retry::After(d) = dlg.http_error(&err) {
34275                        sleep(d).await;
34276                        continue;
34277                    }
34278                    dlg.finished(false);
34279                    return Err(common::Error::HttpError(err));
34280                }
34281                Ok(res) => {
34282                    let (mut parts, body) = res.into_parts();
34283                    let mut body = common::Body::new(body);
34284                    if !parts.status.is_success() {
34285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34286                        let error = serde_json::from_str(&common::to_string(&bytes));
34287                        let response = common::to_response(parts, bytes.into());
34288
34289                        if let common::Retry::After(d) =
34290                            dlg.http_failure(&response, error.as_ref().ok())
34291                        {
34292                            sleep(d).await;
34293                            continue;
34294                        }
34295
34296                        dlg.finished(false);
34297
34298                        return Err(match error {
34299                            Ok(value) => common::Error::BadRequest(value),
34300                            _ => common::Error::Failure(response),
34301                        });
34302                    }
34303                    let response = {
34304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34305                        let encoded = common::to_string(&bytes);
34306                        match serde_json::from_str(&encoded) {
34307                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34308                            Err(error) => {
34309                                dlg.response_json_decode_error(&encoded, &error);
34310                                return Err(common::Error::JsonDecodeError(
34311                                    encoded.to_string(),
34312                                    error,
34313                                ));
34314                            }
34315                        }
34316                    };
34317
34318                    dlg.finished(true);
34319                    return Ok(response);
34320                }
34321            }
34322        }
34323    }
34324
34325    ///
34326    /// Sets the *request* property to the given value.
34327    ///
34328    /// Even though the property as already been set when instantiating this call,
34329    /// we provide this method for API completeness.
34330    pub fn request(mut self, new_value: UserPermission) -> AccountUserPermissionCreateCall<'a, C> {
34331        self._request = new_value;
34332        self
34333    }
34334    /// GTM Account's API relative path. Example: accounts/{account_id}
34335    ///
34336    /// Sets the *parent* path property to the given value.
34337    ///
34338    /// Even though the property as already been set when instantiating this call,
34339    /// we provide this method for API completeness.
34340    pub fn parent(mut self, new_value: &str) -> AccountUserPermissionCreateCall<'a, C> {
34341        self._parent = new_value.to_string();
34342        self
34343    }
34344    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34345    /// while executing the actual API request.
34346    ///
34347    /// ````text
34348    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34349    /// ````
34350    ///
34351    /// Sets the *delegate* property to the given value.
34352    pub fn delegate(
34353        mut self,
34354        new_value: &'a mut dyn common::Delegate,
34355    ) -> AccountUserPermissionCreateCall<'a, C> {
34356        self._delegate = Some(new_value);
34357        self
34358    }
34359
34360    /// Set any additional parameter of the query string used in the request.
34361    /// It should be used to set parameters which are not yet available through their own
34362    /// setters.
34363    ///
34364    /// Please note that this method must not be used to set any of the known parameters
34365    /// which have their own setter method. If done anyway, the request will fail.
34366    ///
34367    /// # Additional Parameters
34368    ///
34369    /// * *$.xgafv* (query-string) - V1 error format.
34370    /// * *access_token* (query-string) - OAuth access token.
34371    /// * *alt* (query-string) - Data format for response.
34372    /// * *callback* (query-string) - JSONP
34373    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34374    /// * *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.
34375    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34376    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34377    /// * *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.
34378    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34379    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34380    pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionCreateCall<'a, C>
34381    where
34382        T: AsRef<str>,
34383    {
34384        self._additional_params
34385            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34386        self
34387    }
34388
34389    /// Identifies the authorization scope for the method you are building.
34390    ///
34391    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34392    /// [`Scope::ManageUser`].
34393    ///
34394    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34395    /// tokens for more than one scope.
34396    ///
34397    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34398    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34399    /// sufficient, a read-write scope will do as well.
34400    pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionCreateCall<'a, C>
34401    where
34402        St: AsRef<str>,
34403    {
34404        self._scopes.insert(String::from(scope.as_ref()));
34405        self
34406    }
34407    /// Identifies the authorization scope(s) for the method you are building.
34408    ///
34409    /// See [`Self::add_scope()`] for details.
34410    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionCreateCall<'a, C>
34411    where
34412        I: IntoIterator<Item = St>,
34413        St: AsRef<str>,
34414    {
34415        self._scopes
34416            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34417        self
34418    }
34419
34420    /// Removes all scopes, and no default scope will be used either.
34421    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34422    /// for details).
34423    pub fn clear_scopes(mut self) -> AccountUserPermissionCreateCall<'a, C> {
34424        self._scopes.clear();
34425        self
34426    }
34427}
34428
34429/// Removes a user from the account, revoking access to it and all of its containers.
34430///
34431/// A builder for the *user_permissions.delete* method supported by a *account* resource.
34432/// It is not used directly, but through a [`AccountMethods`] instance.
34433///
34434/// # Example
34435///
34436/// Instantiate a resource method builder
34437///
34438/// ```test_harness,no_run
34439/// # extern crate hyper;
34440/// # extern crate hyper_rustls;
34441/// # extern crate google_tagmanager2 as tagmanager2;
34442/// # async fn dox() {
34443/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34444///
34445/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34446/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34447/// #     secret,
34448/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34449/// # ).build().await.unwrap();
34450///
34451/// # let client = hyper_util::client::legacy::Client::builder(
34452/// #     hyper_util::rt::TokioExecutor::new()
34453/// # )
34454/// # .build(
34455/// #     hyper_rustls::HttpsConnectorBuilder::new()
34456/// #         .with_native_roots()
34457/// #         .unwrap()
34458/// #         .https_or_http()
34459/// #         .enable_http1()
34460/// #         .build()
34461/// # );
34462/// # let mut hub = TagManager::new(client, auth);
34463/// // You can configure optional parameters by calling the respective setters at will, and
34464/// // execute the final call using `doit()`.
34465/// // Values shown here are possibly random and not representative !
34466/// let result = hub.accounts().user_permissions_delete("path")
34467///              .doit().await;
34468/// # }
34469/// ```
34470pub struct AccountUserPermissionDeleteCall<'a, C>
34471where
34472    C: 'a,
34473{
34474    hub: &'a TagManager<C>,
34475    _path: String,
34476    _delegate: Option<&'a mut dyn common::Delegate>,
34477    _additional_params: HashMap<String, String>,
34478    _scopes: BTreeSet<String>,
34479}
34480
34481impl<'a, C> common::CallBuilder for AccountUserPermissionDeleteCall<'a, C> {}
34482
34483impl<'a, C> AccountUserPermissionDeleteCall<'a, C>
34484where
34485    C: common::Connector,
34486{
34487    /// Perform the operation you have build so far.
34488    pub async fn doit(mut self) -> common::Result<common::Response> {
34489        use std::borrow::Cow;
34490        use std::io::{Read, Seek};
34491
34492        use common::{url::Params, ToParts};
34493        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34494
34495        let mut dd = common::DefaultDelegate;
34496        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34497        dlg.begin(common::MethodInfo {
34498            id: "tagmanager.accounts.user_permissions.delete",
34499            http_method: hyper::Method::DELETE,
34500        });
34501
34502        for &field in ["path"].iter() {
34503            if self._additional_params.contains_key(field) {
34504                dlg.finished(false);
34505                return Err(common::Error::FieldClash(field));
34506            }
34507        }
34508
34509        let mut params = Params::with_capacity(2 + self._additional_params.len());
34510        params.push("path", self._path);
34511
34512        params.extend(self._additional_params.iter());
34513
34514        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
34515        if self._scopes.is_empty() {
34516            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
34517        }
34518
34519        #[allow(clippy::single_element_loop)]
34520        for &(find_this, param_name) in [("{+path}", "path")].iter() {
34521            url = params.uri_replacement(url, param_name, find_this, true);
34522        }
34523        {
34524            let to_remove = ["path"];
34525            params.remove_params(&to_remove);
34526        }
34527
34528        let url = params.parse_with_url(&url);
34529
34530        loop {
34531            let token = match self
34532                .hub
34533                .auth
34534                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34535                .await
34536            {
34537                Ok(token) => token,
34538                Err(e) => match dlg.token(e) {
34539                    Ok(token) => token,
34540                    Err(e) => {
34541                        dlg.finished(false);
34542                        return Err(common::Error::MissingToken(e));
34543                    }
34544                },
34545            };
34546            let mut req_result = {
34547                let client = &self.hub.client;
34548                dlg.pre_request();
34549                let mut req_builder = hyper::Request::builder()
34550                    .method(hyper::Method::DELETE)
34551                    .uri(url.as_str())
34552                    .header(USER_AGENT, self.hub._user_agent.clone());
34553
34554                if let Some(token) = token.as_ref() {
34555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34556                }
34557
34558                let request = req_builder
34559                    .header(CONTENT_LENGTH, 0_u64)
34560                    .body(common::to_body::<String>(None));
34561
34562                client.request(request.unwrap()).await
34563            };
34564
34565            match req_result {
34566                Err(err) => {
34567                    if let common::Retry::After(d) = dlg.http_error(&err) {
34568                        sleep(d).await;
34569                        continue;
34570                    }
34571                    dlg.finished(false);
34572                    return Err(common::Error::HttpError(err));
34573                }
34574                Ok(res) => {
34575                    let (mut parts, body) = res.into_parts();
34576                    let mut body = common::Body::new(body);
34577                    if !parts.status.is_success() {
34578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34579                        let error = serde_json::from_str(&common::to_string(&bytes));
34580                        let response = common::to_response(parts, bytes.into());
34581
34582                        if let common::Retry::After(d) =
34583                            dlg.http_failure(&response, error.as_ref().ok())
34584                        {
34585                            sleep(d).await;
34586                            continue;
34587                        }
34588
34589                        dlg.finished(false);
34590
34591                        return Err(match error {
34592                            Ok(value) => common::Error::BadRequest(value),
34593                            _ => common::Error::Failure(response),
34594                        });
34595                    }
34596                    let response = common::Response::from_parts(parts, body);
34597
34598                    dlg.finished(true);
34599                    return Ok(response);
34600                }
34601            }
34602        }
34603    }
34604
34605    /// GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
34606    ///
34607    /// Sets the *path* path property to the given value.
34608    ///
34609    /// Even though the property as already been set when instantiating this call,
34610    /// we provide this method for API completeness.
34611    pub fn path(mut self, new_value: &str) -> AccountUserPermissionDeleteCall<'a, C> {
34612        self._path = new_value.to_string();
34613        self
34614    }
34615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34616    /// while executing the actual API request.
34617    ///
34618    /// ````text
34619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34620    /// ````
34621    ///
34622    /// Sets the *delegate* property to the given value.
34623    pub fn delegate(
34624        mut self,
34625        new_value: &'a mut dyn common::Delegate,
34626    ) -> AccountUserPermissionDeleteCall<'a, C> {
34627        self._delegate = Some(new_value);
34628        self
34629    }
34630
34631    /// Set any additional parameter of the query string used in the request.
34632    /// It should be used to set parameters which are not yet available through their own
34633    /// setters.
34634    ///
34635    /// Please note that this method must not be used to set any of the known parameters
34636    /// which have their own setter method. If done anyway, the request will fail.
34637    ///
34638    /// # Additional Parameters
34639    ///
34640    /// * *$.xgafv* (query-string) - V1 error format.
34641    /// * *access_token* (query-string) - OAuth access token.
34642    /// * *alt* (query-string) - Data format for response.
34643    /// * *callback* (query-string) - JSONP
34644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34645    /// * *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.
34646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34648    /// * *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.
34649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34651    pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionDeleteCall<'a, C>
34652    where
34653        T: AsRef<str>,
34654    {
34655        self._additional_params
34656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34657        self
34658    }
34659
34660    /// Identifies the authorization scope for the method you are building.
34661    ///
34662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34663    /// [`Scope::ManageUser`].
34664    ///
34665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34666    /// tokens for more than one scope.
34667    ///
34668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34670    /// sufficient, a read-write scope will do as well.
34671    pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionDeleteCall<'a, C>
34672    where
34673        St: AsRef<str>,
34674    {
34675        self._scopes.insert(String::from(scope.as_ref()));
34676        self
34677    }
34678    /// Identifies the authorization scope(s) for the method you are building.
34679    ///
34680    /// See [`Self::add_scope()`] for details.
34681    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionDeleteCall<'a, C>
34682    where
34683        I: IntoIterator<Item = St>,
34684        St: AsRef<str>,
34685    {
34686        self._scopes
34687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34688        self
34689    }
34690
34691    /// Removes all scopes, and no default scope will be used either.
34692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34693    /// for details).
34694    pub fn clear_scopes(mut self) -> AccountUserPermissionDeleteCall<'a, C> {
34695        self._scopes.clear();
34696        self
34697    }
34698}
34699
34700/// Gets a user's Account & Container access.
34701///
34702/// A builder for the *user_permissions.get* method supported by a *account* resource.
34703/// It is not used directly, but through a [`AccountMethods`] instance.
34704///
34705/// # Example
34706///
34707/// Instantiate a resource method builder
34708///
34709/// ```test_harness,no_run
34710/// # extern crate hyper;
34711/// # extern crate hyper_rustls;
34712/// # extern crate google_tagmanager2 as tagmanager2;
34713/// # async fn dox() {
34714/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34715///
34716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34718/// #     secret,
34719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34720/// # ).build().await.unwrap();
34721///
34722/// # let client = hyper_util::client::legacy::Client::builder(
34723/// #     hyper_util::rt::TokioExecutor::new()
34724/// # )
34725/// # .build(
34726/// #     hyper_rustls::HttpsConnectorBuilder::new()
34727/// #         .with_native_roots()
34728/// #         .unwrap()
34729/// #         .https_or_http()
34730/// #         .enable_http1()
34731/// #         .build()
34732/// # );
34733/// # let mut hub = TagManager::new(client, auth);
34734/// // You can configure optional parameters by calling the respective setters at will, and
34735/// // execute the final call using `doit()`.
34736/// // Values shown here are possibly random and not representative !
34737/// let result = hub.accounts().user_permissions_get("path")
34738///              .doit().await;
34739/// # }
34740/// ```
34741pub struct AccountUserPermissionGetCall<'a, C>
34742where
34743    C: 'a,
34744{
34745    hub: &'a TagManager<C>,
34746    _path: String,
34747    _delegate: Option<&'a mut dyn common::Delegate>,
34748    _additional_params: HashMap<String, String>,
34749    _scopes: BTreeSet<String>,
34750}
34751
34752impl<'a, C> common::CallBuilder for AccountUserPermissionGetCall<'a, C> {}
34753
34754impl<'a, C> AccountUserPermissionGetCall<'a, C>
34755where
34756    C: common::Connector,
34757{
34758    /// Perform the operation you have build so far.
34759    pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
34760        use std::borrow::Cow;
34761        use std::io::{Read, Seek};
34762
34763        use common::{url::Params, ToParts};
34764        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34765
34766        let mut dd = common::DefaultDelegate;
34767        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34768        dlg.begin(common::MethodInfo {
34769            id: "tagmanager.accounts.user_permissions.get",
34770            http_method: hyper::Method::GET,
34771        });
34772
34773        for &field in ["alt", "path"].iter() {
34774            if self._additional_params.contains_key(field) {
34775                dlg.finished(false);
34776                return Err(common::Error::FieldClash(field));
34777            }
34778        }
34779
34780        let mut params = Params::with_capacity(3 + self._additional_params.len());
34781        params.push("path", self._path);
34782
34783        params.extend(self._additional_params.iter());
34784
34785        params.push("alt", "json");
34786        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
34787        if self._scopes.is_empty() {
34788            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
34789        }
34790
34791        #[allow(clippy::single_element_loop)]
34792        for &(find_this, param_name) in [("{+path}", "path")].iter() {
34793            url = params.uri_replacement(url, param_name, find_this, true);
34794        }
34795        {
34796            let to_remove = ["path"];
34797            params.remove_params(&to_remove);
34798        }
34799
34800        let url = params.parse_with_url(&url);
34801
34802        loop {
34803            let token = match self
34804                .hub
34805                .auth
34806                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34807                .await
34808            {
34809                Ok(token) => token,
34810                Err(e) => match dlg.token(e) {
34811                    Ok(token) => token,
34812                    Err(e) => {
34813                        dlg.finished(false);
34814                        return Err(common::Error::MissingToken(e));
34815                    }
34816                },
34817            };
34818            let mut req_result = {
34819                let client = &self.hub.client;
34820                dlg.pre_request();
34821                let mut req_builder = hyper::Request::builder()
34822                    .method(hyper::Method::GET)
34823                    .uri(url.as_str())
34824                    .header(USER_AGENT, self.hub._user_agent.clone());
34825
34826                if let Some(token) = token.as_ref() {
34827                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34828                }
34829
34830                let request = req_builder
34831                    .header(CONTENT_LENGTH, 0_u64)
34832                    .body(common::to_body::<String>(None));
34833
34834                client.request(request.unwrap()).await
34835            };
34836
34837            match req_result {
34838                Err(err) => {
34839                    if let common::Retry::After(d) = dlg.http_error(&err) {
34840                        sleep(d).await;
34841                        continue;
34842                    }
34843                    dlg.finished(false);
34844                    return Err(common::Error::HttpError(err));
34845                }
34846                Ok(res) => {
34847                    let (mut parts, body) = res.into_parts();
34848                    let mut body = common::Body::new(body);
34849                    if !parts.status.is_success() {
34850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34851                        let error = serde_json::from_str(&common::to_string(&bytes));
34852                        let response = common::to_response(parts, bytes.into());
34853
34854                        if let common::Retry::After(d) =
34855                            dlg.http_failure(&response, error.as_ref().ok())
34856                        {
34857                            sleep(d).await;
34858                            continue;
34859                        }
34860
34861                        dlg.finished(false);
34862
34863                        return Err(match error {
34864                            Ok(value) => common::Error::BadRequest(value),
34865                            _ => common::Error::Failure(response),
34866                        });
34867                    }
34868                    let response = {
34869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34870                        let encoded = common::to_string(&bytes);
34871                        match serde_json::from_str(&encoded) {
34872                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34873                            Err(error) => {
34874                                dlg.response_json_decode_error(&encoded, &error);
34875                                return Err(common::Error::JsonDecodeError(
34876                                    encoded.to_string(),
34877                                    error,
34878                                ));
34879                            }
34880                        }
34881                    };
34882
34883                    dlg.finished(true);
34884                    return Ok(response);
34885                }
34886            }
34887        }
34888    }
34889
34890    /// GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
34891    ///
34892    /// Sets the *path* path property to the given value.
34893    ///
34894    /// Even though the property as already been set when instantiating this call,
34895    /// we provide this method for API completeness.
34896    pub fn path(mut self, new_value: &str) -> AccountUserPermissionGetCall<'a, C> {
34897        self._path = new_value.to_string();
34898        self
34899    }
34900    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34901    /// while executing the actual API request.
34902    ///
34903    /// ````text
34904    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34905    /// ````
34906    ///
34907    /// Sets the *delegate* property to the given value.
34908    pub fn delegate(
34909        mut self,
34910        new_value: &'a mut dyn common::Delegate,
34911    ) -> AccountUserPermissionGetCall<'a, C> {
34912        self._delegate = Some(new_value);
34913        self
34914    }
34915
34916    /// Set any additional parameter of the query string used in the request.
34917    /// It should be used to set parameters which are not yet available through their own
34918    /// setters.
34919    ///
34920    /// Please note that this method must not be used to set any of the known parameters
34921    /// which have their own setter method. If done anyway, the request will fail.
34922    ///
34923    /// # Additional Parameters
34924    ///
34925    /// * *$.xgafv* (query-string) - V1 error format.
34926    /// * *access_token* (query-string) - OAuth access token.
34927    /// * *alt* (query-string) - Data format for response.
34928    /// * *callback* (query-string) - JSONP
34929    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34930    /// * *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.
34931    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34932    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34933    /// * *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.
34934    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34935    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34936    pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionGetCall<'a, C>
34937    where
34938        T: AsRef<str>,
34939    {
34940        self._additional_params
34941            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34942        self
34943    }
34944
34945    /// Identifies the authorization scope for the method you are building.
34946    ///
34947    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34948    /// [`Scope::ManageUser`].
34949    ///
34950    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34951    /// tokens for more than one scope.
34952    ///
34953    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34954    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34955    /// sufficient, a read-write scope will do as well.
34956    pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionGetCall<'a, C>
34957    where
34958        St: AsRef<str>,
34959    {
34960        self._scopes.insert(String::from(scope.as_ref()));
34961        self
34962    }
34963    /// Identifies the authorization scope(s) for the method you are building.
34964    ///
34965    /// See [`Self::add_scope()`] for details.
34966    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionGetCall<'a, C>
34967    where
34968        I: IntoIterator<Item = St>,
34969        St: AsRef<str>,
34970    {
34971        self._scopes
34972            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34973        self
34974    }
34975
34976    /// Removes all scopes, and no default scope will be used either.
34977    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34978    /// for details).
34979    pub fn clear_scopes(mut self) -> AccountUserPermissionGetCall<'a, C> {
34980        self._scopes.clear();
34981        self
34982    }
34983}
34984
34985/// List all users that have access to the account along with Account and Container user access granted to each of them.
34986///
34987/// A builder for the *user_permissions.list* method supported by a *account* resource.
34988/// It is not used directly, but through a [`AccountMethods`] instance.
34989///
34990/// # Example
34991///
34992/// Instantiate a resource method builder
34993///
34994/// ```test_harness,no_run
34995/// # extern crate hyper;
34996/// # extern crate hyper_rustls;
34997/// # extern crate google_tagmanager2 as tagmanager2;
34998/// # async fn dox() {
34999/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35000///
35001/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35002/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35003/// #     secret,
35004/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35005/// # ).build().await.unwrap();
35006///
35007/// # let client = hyper_util::client::legacy::Client::builder(
35008/// #     hyper_util::rt::TokioExecutor::new()
35009/// # )
35010/// # .build(
35011/// #     hyper_rustls::HttpsConnectorBuilder::new()
35012/// #         .with_native_roots()
35013/// #         .unwrap()
35014/// #         .https_or_http()
35015/// #         .enable_http1()
35016/// #         .build()
35017/// # );
35018/// # let mut hub = TagManager::new(client, auth);
35019/// // You can configure optional parameters by calling the respective setters at will, and
35020/// // execute the final call using `doit()`.
35021/// // Values shown here are possibly random and not representative !
35022/// let result = hub.accounts().user_permissions_list("parent")
35023///              .page_token("ipsum")
35024///              .doit().await;
35025/// # }
35026/// ```
35027pub struct AccountUserPermissionListCall<'a, C>
35028where
35029    C: 'a,
35030{
35031    hub: &'a TagManager<C>,
35032    _parent: String,
35033    _page_token: Option<String>,
35034    _delegate: Option<&'a mut dyn common::Delegate>,
35035    _additional_params: HashMap<String, String>,
35036    _scopes: BTreeSet<String>,
35037}
35038
35039impl<'a, C> common::CallBuilder for AccountUserPermissionListCall<'a, C> {}
35040
35041impl<'a, C> AccountUserPermissionListCall<'a, C>
35042where
35043    C: common::Connector,
35044{
35045    /// Perform the operation you have build so far.
35046    pub async fn doit(mut self) -> common::Result<(common::Response, ListUserPermissionsResponse)> {
35047        use std::borrow::Cow;
35048        use std::io::{Read, Seek};
35049
35050        use common::{url::Params, ToParts};
35051        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35052
35053        let mut dd = common::DefaultDelegate;
35054        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35055        dlg.begin(common::MethodInfo {
35056            id: "tagmanager.accounts.user_permissions.list",
35057            http_method: hyper::Method::GET,
35058        });
35059
35060        for &field in ["alt", "parent", "pageToken"].iter() {
35061            if self._additional_params.contains_key(field) {
35062                dlg.finished(false);
35063                return Err(common::Error::FieldClash(field));
35064            }
35065        }
35066
35067        let mut params = Params::with_capacity(4 + self._additional_params.len());
35068        params.push("parent", self._parent);
35069        if let Some(value) = self._page_token.as_ref() {
35070            params.push("pageToken", value);
35071        }
35072
35073        params.extend(self._additional_params.iter());
35074
35075        params.push("alt", "json");
35076        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/user_permissions";
35077        if self._scopes.is_empty() {
35078            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
35079        }
35080
35081        #[allow(clippy::single_element_loop)]
35082        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
35083            url = params.uri_replacement(url, param_name, find_this, true);
35084        }
35085        {
35086            let to_remove = ["parent"];
35087            params.remove_params(&to_remove);
35088        }
35089
35090        let url = params.parse_with_url(&url);
35091
35092        loop {
35093            let token = match self
35094                .hub
35095                .auth
35096                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35097                .await
35098            {
35099                Ok(token) => token,
35100                Err(e) => match dlg.token(e) {
35101                    Ok(token) => token,
35102                    Err(e) => {
35103                        dlg.finished(false);
35104                        return Err(common::Error::MissingToken(e));
35105                    }
35106                },
35107            };
35108            let mut req_result = {
35109                let client = &self.hub.client;
35110                dlg.pre_request();
35111                let mut req_builder = hyper::Request::builder()
35112                    .method(hyper::Method::GET)
35113                    .uri(url.as_str())
35114                    .header(USER_AGENT, self.hub._user_agent.clone());
35115
35116                if let Some(token) = token.as_ref() {
35117                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35118                }
35119
35120                let request = req_builder
35121                    .header(CONTENT_LENGTH, 0_u64)
35122                    .body(common::to_body::<String>(None));
35123
35124                client.request(request.unwrap()).await
35125            };
35126
35127            match req_result {
35128                Err(err) => {
35129                    if let common::Retry::After(d) = dlg.http_error(&err) {
35130                        sleep(d).await;
35131                        continue;
35132                    }
35133                    dlg.finished(false);
35134                    return Err(common::Error::HttpError(err));
35135                }
35136                Ok(res) => {
35137                    let (mut parts, body) = res.into_parts();
35138                    let mut body = common::Body::new(body);
35139                    if !parts.status.is_success() {
35140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35141                        let error = serde_json::from_str(&common::to_string(&bytes));
35142                        let response = common::to_response(parts, bytes.into());
35143
35144                        if let common::Retry::After(d) =
35145                            dlg.http_failure(&response, error.as_ref().ok())
35146                        {
35147                            sleep(d).await;
35148                            continue;
35149                        }
35150
35151                        dlg.finished(false);
35152
35153                        return Err(match error {
35154                            Ok(value) => common::Error::BadRequest(value),
35155                            _ => common::Error::Failure(response),
35156                        });
35157                    }
35158                    let response = {
35159                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35160                        let encoded = common::to_string(&bytes);
35161                        match serde_json::from_str(&encoded) {
35162                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35163                            Err(error) => {
35164                                dlg.response_json_decode_error(&encoded, &error);
35165                                return Err(common::Error::JsonDecodeError(
35166                                    encoded.to_string(),
35167                                    error,
35168                                ));
35169                            }
35170                        }
35171                    };
35172
35173                    dlg.finished(true);
35174                    return Ok(response);
35175                }
35176            }
35177        }
35178    }
35179
35180    /// GTM Account's API relative path. Example: accounts/{account_id}
35181    ///
35182    /// Sets the *parent* path property to the given value.
35183    ///
35184    /// Even though the property as already been set when instantiating this call,
35185    /// we provide this method for API completeness.
35186    pub fn parent(mut self, new_value: &str) -> AccountUserPermissionListCall<'a, C> {
35187        self._parent = new_value.to_string();
35188        self
35189    }
35190    /// Continuation token for fetching the next page of results.
35191    ///
35192    /// Sets the *page token* query property to the given value.
35193    pub fn page_token(mut self, new_value: &str) -> AccountUserPermissionListCall<'a, C> {
35194        self._page_token = Some(new_value.to_string());
35195        self
35196    }
35197    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35198    /// while executing the actual API request.
35199    ///
35200    /// ````text
35201    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35202    /// ````
35203    ///
35204    /// Sets the *delegate* property to the given value.
35205    pub fn delegate(
35206        mut self,
35207        new_value: &'a mut dyn common::Delegate,
35208    ) -> AccountUserPermissionListCall<'a, C> {
35209        self._delegate = Some(new_value);
35210        self
35211    }
35212
35213    /// Set any additional parameter of the query string used in the request.
35214    /// It should be used to set parameters which are not yet available through their own
35215    /// setters.
35216    ///
35217    /// Please note that this method must not be used to set any of the known parameters
35218    /// which have their own setter method. If done anyway, the request will fail.
35219    ///
35220    /// # Additional Parameters
35221    ///
35222    /// * *$.xgafv* (query-string) - V1 error format.
35223    /// * *access_token* (query-string) - OAuth access token.
35224    /// * *alt* (query-string) - Data format for response.
35225    /// * *callback* (query-string) - JSONP
35226    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35227    /// * *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.
35228    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35229    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35230    /// * *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.
35231    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35232    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35233    pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionListCall<'a, C>
35234    where
35235        T: AsRef<str>,
35236    {
35237        self._additional_params
35238            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35239        self
35240    }
35241
35242    /// Identifies the authorization scope for the method you are building.
35243    ///
35244    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35245    /// [`Scope::ManageUser`].
35246    ///
35247    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35248    /// tokens for more than one scope.
35249    ///
35250    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35251    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35252    /// sufficient, a read-write scope will do as well.
35253    pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionListCall<'a, C>
35254    where
35255        St: AsRef<str>,
35256    {
35257        self._scopes.insert(String::from(scope.as_ref()));
35258        self
35259    }
35260    /// Identifies the authorization scope(s) for the method you are building.
35261    ///
35262    /// See [`Self::add_scope()`] for details.
35263    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionListCall<'a, C>
35264    where
35265        I: IntoIterator<Item = St>,
35266        St: AsRef<str>,
35267    {
35268        self._scopes
35269            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35270        self
35271    }
35272
35273    /// Removes all scopes, and no default scope will be used either.
35274    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35275    /// for details).
35276    pub fn clear_scopes(mut self) -> AccountUserPermissionListCall<'a, C> {
35277        self._scopes.clear();
35278        self
35279    }
35280}
35281
35282/// Updates a user's Account & Container access.
35283///
35284/// A builder for the *user_permissions.update* method supported by a *account* resource.
35285/// It is not used directly, but through a [`AccountMethods`] instance.
35286///
35287/// # Example
35288///
35289/// Instantiate a resource method builder
35290///
35291/// ```test_harness,no_run
35292/// # extern crate hyper;
35293/// # extern crate hyper_rustls;
35294/// # extern crate google_tagmanager2 as tagmanager2;
35295/// use tagmanager2::api::UserPermission;
35296/// # async fn dox() {
35297/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35298///
35299/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35300/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35301/// #     secret,
35302/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35303/// # ).build().await.unwrap();
35304///
35305/// # let client = hyper_util::client::legacy::Client::builder(
35306/// #     hyper_util::rt::TokioExecutor::new()
35307/// # )
35308/// # .build(
35309/// #     hyper_rustls::HttpsConnectorBuilder::new()
35310/// #         .with_native_roots()
35311/// #         .unwrap()
35312/// #         .https_or_http()
35313/// #         .enable_http1()
35314/// #         .build()
35315/// # );
35316/// # let mut hub = TagManager::new(client, auth);
35317/// // As the method needs a request, you would usually fill it with the desired information
35318/// // into the respective structure. Some of the parts shown here might not be applicable !
35319/// // Values shown here are possibly random and not representative !
35320/// let mut req = UserPermission::default();
35321///
35322/// // You can configure optional parameters by calling the respective setters at will, and
35323/// // execute the final call using `doit()`.
35324/// // Values shown here are possibly random and not representative !
35325/// let result = hub.accounts().user_permissions_update(req, "path")
35326///              .doit().await;
35327/// # }
35328/// ```
35329pub struct AccountUserPermissionUpdateCall<'a, C>
35330where
35331    C: 'a,
35332{
35333    hub: &'a TagManager<C>,
35334    _request: UserPermission,
35335    _path: String,
35336    _delegate: Option<&'a mut dyn common::Delegate>,
35337    _additional_params: HashMap<String, String>,
35338    _scopes: BTreeSet<String>,
35339}
35340
35341impl<'a, C> common::CallBuilder for AccountUserPermissionUpdateCall<'a, C> {}
35342
35343impl<'a, C> AccountUserPermissionUpdateCall<'a, C>
35344where
35345    C: common::Connector,
35346{
35347    /// Perform the operation you have build so far.
35348    pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
35349        use std::borrow::Cow;
35350        use std::io::{Read, Seek};
35351
35352        use common::{url::Params, ToParts};
35353        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35354
35355        let mut dd = common::DefaultDelegate;
35356        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35357        dlg.begin(common::MethodInfo {
35358            id: "tagmanager.accounts.user_permissions.update",
35359            http_method: hyper::Method::PUT,
35360        });
35361
35362        for &field in ["alt", "path"].iter() {
35363            if self._additional_params.contains_key(field) {
35364                dlg.finished(false);
35365                return Err(common::Error::FieldClash(field));
35366            }
35367        }
35368
35369        let mut params = Params::with_capacity(4 + self._additional_params.len());
35370        params.push("path", self._path);
35371
35372        params.extend(self._additional_params.iter());
35373
35374        params.push("alt", "json");
35375        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
35376        if self._scopes.is_empty() {
35377            self._scopes.insert(Scope::ManageUser.as_ref().to_string());
35378        }
35379
35380        #[allow(clippy::single_element_loop)]
35381        for &(find_this, param_name) in [("{+path}", "path")].iter() {
35382            url = params.uri_replacement(url, param_name, find_this, true);
35383        }
35384        {
35385            let to_remove = ["path"];
35386            params.remove_params(&to_remove);
35387        }
35388
35389        let url = params.parse_with_url(&url);
35390
35391        let mut json_mime_type = mime::APPLICATION_JSON;
35392        let mut request_value_reader = {
35393            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35394            common::remove_json_null_values(&mut value);
35395            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35396            serde_json::to_writer(&mut dst, &value).unwrap();
35397            dst
35398        };
35399        let request_size = request_value_reader
35400            .seek(std::io::SeekFrom::End(0))
35401            .unwrap();
35402        request_value_reader
35403            .seek(std::io::SeekFrom::Start(0))
35404            .unwrap();
35405
35406        loop {
35407            let token = match self
35408                .hub
35409                .auth
35410                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35411                .await
35412            {
35413                Ok(token) => token,
35414                Err(e) => match dlg.token(e) {
35415                    Ok(token) => token,
35416                    Err(e) => {
35417                        dlg.finished(false);
35418                        return Err(common::Error::MissingToken(e));
35419                    }
35420                },
35421            };
35422            request_value_reader
35423                .seek(std::io::SeekFrom::Start(0))
35424                .unwrap();
35425            let mut req_result = {
35426                let client = &self.hub.client;
35427                dlg.pre_request();
35428                let mut req_builder = hyper::Request::builder()
35429                    .method(hyper::Method::PUT)
35430                    .uri(url.as_str())
35431                    .header(USER_AGENT, self.hub._user_agent.clone());
35432
35433                if let Some(token) = token.as_ref() {
35434                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35435                }
35436
35437                let request = req_builder
35438                    .header(CONTENT_TYPE, json_mime_type.to_string())
35439                    .header(CONTENT_LENGTH, request_size as u64)
35440                    .body(common::to_body(
35441                        request_value_reader.get_ref().clone().into(),
35442                    ));
35443
35444                client.request(request.unwrap()).await
35445            };
35446
35447            match req_result {
35448                Err(err) => {
35449                    if let common::Retry::After(d) = dlg.http_error(&err) {
35450                        sleep(d).await;
35451                        continue;
35452                    }
35453                    dlg.finished(false);
35454                    return Err(common::Error::HttpError(err));
35455                }
35456                Ok(res) => {
35457                    let (mut parts, body) = res.into_parts();
35458                    let mut body = common::Body::new(body);
35459                    if !parts.status.is_success() {
35460                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35461                        let error = serde_json::from_str(&common::to_string(&bytes));
35462                        let response = common::to_response(parts, bytes.into());
35463
35464                        if let common::Retry::After(d) =
35465                            dlg.http_failure(&response, error.as_ref().ok())
35466                        {
35467                            sleep(d).await;
35468                            continue;
35469                        }
35470
35471                        dlg.finished(false);
35472
35473                        return Err(match error {
35474                            Ok(value) => common::Error::BadRequest(value),
35475                            _ => common::Error::Failure(response),
35476                        });
35477                    }
35478                    let response = {
35479                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35480                        let encoded = common::to_string(&bytes);
35481                        match serde_json::from_str(&encoded) {
35482                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35483                            Err(error) => {
35484                                dlg.response_json_decode_error(&encoded, &error);
35485                                return Err(common::Error::JsonDecodeError(
35486                                    encoded.to_string(),
35487                                    error,
35488                                ));
35489                            }
35490                        }
35491                    };
35492
35493                    dlg.finished(true);
35494                    return Ok(response);
35495                }
35496            }
35497        }
35498    }
35499
35500    ///
35501    /// Sets the *request* property to the given value.
35502    ///
35503    /// Even though the property as already been set when instantiating this call,
35504    /// we provide this method for API completeness.
35505    pub fn request(mut self, new_value: UserPermission) -> AccountUserPermissionUpdateCall<'a, C> {
35506        self._request = new_value;
35507        self
35508    }
35509    /// GTM UserPermission's API relative path. Example: accounts/{account_id}/user_permissions/{user_permission_id}
35510    ///
35511    /// Sets the *path* path property to the given value.
35512    ///
35513    /// Even though the property as already been set when instantiating this call,
35514    /// we provide this method for API completeness.
35515    pub fn path(mut self, new_value: &str) -> AccountUserPermissionUpdateCall<'a, C> {
35516        self._path = new_value.to_string();
35517        self
35518    }
35519    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35520    /// while executing the actual API request.
35521    ///
35522    /// ````text
35523    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35524    /// ````
35525    ///
35526    /// Sets the *delegate* property to the given value.
35527    pub fn delegate(
35528        mut self,
35529        new_value: &'a mut dyn common::Delegate,
35530    ) -> AccountUserPermissionUpdateCall<'a, C> {
35531        self._delegate = Some(new_value);
35532        self
35533    }
35534
35535    /// Set any additional parameter of the query string used in the request.
35536    /// It should be used to set parameters which are not yet available through their own
35537    /// setters.
35538    ///
35539    /// Please note that this method must not be used to set any of the known parameters
35540    /// which have their own setter method. If done anyway, the request will fail.
35541    ///
35542    /// # Additional Parameters
35543    ///
35544    /// * *$.xgafv* (query-string) - V1 error format.
35545    /// * *access_token* (query-string) - OAuth access token.
35546    /// * *alt* (query-string) - Data format for response.
35547    /// * *callback* (query-string) - JSONP
35548    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35549    /// * *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.
35550    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35551    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35552    /// * *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.
35553    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35554    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35555    pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionUpdateCall<'a, C>
35556    where
35557        T: AsRef<str>,
35558    {
35559        self._additional_params
35560            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35561        self
35562    }
35563
35564    /// Identifies the authorization scope for the method you are building.
35565    ///
35566    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35567    /// [`Scope::ManageUser`].
35568    ///
35569    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35570    /// tokens for more than one scope.
35571    ///
35572    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35573    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35574    /// sufficient, a read-write scope will do as well.
35575    pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionUpdateCall<'a, C>
35576    where
35577        St: AsRef<str>,
35578    {
35579        self._scopes.insert(String::from(scope.as_ref()));
35580        self
35581    }
35582    /// Identifies the authorization scope(s) for the method you are building.
35583    ///
35584    /// See [`Self::add_scope()`] for details.
35585    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionUpdateCall<'a, C>
35586    where
35587        I: IntoIterator<Item = St>,
35588        St: AsRef<str>,
35589    {
35590        self._scopes
35591            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35592        self
35593    }
35594
35595    /// Removes all scopes, and no default scope will be used either.
35596    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35597    /// for details).
35598    pub fn clear_scopes(mut self) -> AccountUserPermissionUpdateCall<'a, C> {
35599        self._scopes.clear();
35600        self
35601    }
35602}
35603
35604/// Gets a GTM Account.
35605///
35606/// A builder for the *get* method supported by a *account* resource.
35607/// It is not used directly, but through a [`AccountMethods`] instance.
35608///
35609/// # Example
35610///
35611/// Instantiate a resource method builder
35612///
35613/// ```test_harness,no_run
35614/// # extern crate hyper;
35615/// # extern crate hyper_rustls;
35616/// # extern crate google_tagmanager2 as tagmanager2;
35617/// # async fn dox() {
35618/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35619///
35620/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35621/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35622/// #     secret,
35623/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35624/// # ).build().await.unwrap();
35625///
35626/// # let client = hyper_util::client::legacy::Client::builder(
35627/// #     hyper_util::rt::TokioExecutor::new()
35628/// # )
35629/// # .build(
35630/// #     hyper_rustls::HttpsConnectorBuilder::new()
35631/// #         .with_native_roots()
35632/// #         .unwrap()
35633/// #         .https_or_http()
35634/// #         .enable_http1()
35635/// #         .build()
35636/// # );
35637/// # let mut hub = TagManager::new(client, auth);
35638/// // You can configure optional parameters by calling the respective setters at will, and
35639/// // execute the final call using `doit()`.
35640/// // Values shown here are possibly random and not representative !
35641/// let result = hub.accounts().get("path")
35642///              .doit().await;
35643/// # }
35644/// ```
35645pub struct AccountGetCall<'a, C>
35646where
35647    C: 'a,
35648{
35649    hub: &'a TagManager<C>,
35650    _path: String,
35651    _delegate: Option<&'a mut dyn common::Delegate>,
35652    _additional_params: HashMap<String, String>,
35653    _scopes: BTreeSet<String>,
35654}
35655
35656impl<'a, C> common::CallBuilder for AccountGetCall<'a, C> {}
35657
35658impl<'a, C> AccountGetCall<'a, C>
35659where
35660    C: common::Connector,
35661{
35662    /// Perform the operation you have build so far.
35663    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
35664        use std::borrow::Cow;
35665        use std::io::{Read, Seek};
35666
35667        use common::{url::Params, ToParts};
35668        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35669
35670        let mut dd = common::DefaultDelegate;
35671        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35672        dlg.begin(common::MethodInfo {
35673            id: "tagmanager.accounts.get",
35674            http_method: hyper::Method::GET,
35675        });
35676
35677        for &field in ["alt", "path"].iter() {
35678            if self._additional_params.contains_key(field) {
35679                dlg.finished(false);
35680                return Err(common::Error::FieldClash(field));
35681            }
35682        }
35683
35684        let mut params = Params::with_capacity(3 + self._additional_params.len());
35685        params.push("path", self._path);
35686
35687        params.extend(self._additional_params.iter());
35688
35689        params.push("alt", "json");
35690        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
35691        if self._scopes.is_empty() {
35692            self._scopes.insert(Scope::Readonly.as_ref().to_string());
35693        }
35694
35695        #[allow(clippy::single_element_loop)]
35696        for &(find_this, param_name) in [("{+path}", "path")].iter() {
35697            url = params.uri_replacement(url, param_name, find_this, true);
35698        }
35699        {
35700            let to_remove = ["path"];
35701            params.remove_params(&to_remove);
35702        }
35703
35704        let url = params.parse_with_url(&url);
35705
35706        loop {
35707            let token = match self
35708                .hub
35709                .auth
35710                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35711                .await
35712            {
35713                Ok(token) => token,
35714                Err(e) => match dlg.token(e) {
35715                    Ok(token) => token,
35716                    Err(e) => {
35717                        dlg.finished(false);
35718                        return Err(common::Error::MissingToken(e));
35719                    }
35720                },
35721            };
35722            let mut req_result = {
35723                let client = &self.hub.client;
35724                dlg.pre_request();
35725                let mut req_builder = hyper::Request::builder()
35726                    .method(hyper::Method::GET)
35727                    .uri(url.as_str())
35728                    .header(USER_AGENT, self.hub._user_agent.clone());
35729
35730                if let Some(token) = token.as_ref() {
35731                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35732                }
35733
35734                let request = req_builder
35735                    .header(CONTENT_LENGTH, 0_u64)
35736                    .body(common::to_body::<String>(None));
35737
35738                client.request(request.unwrap()).await
35739            };
35740
35741            match req_result {
35742                Err(err) => {
35743                    if let common::Retry::After(d) = dlg.http_error(&err) {
35744                        sleep(d).await;
35745                        continue;
35746                    }
35747                    dlg.finished(false);
35748                    return Err(common::Error::HttpError(err));
35749                }
35750                Ok(res) => {
35751                    let (mut parts, body) = res.into_parts();
35752                    let mut body = common::Body::new(body);
35753                    if !parts.status.is_success() {
35754                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35755                        let error = serde_json::from_str(&common::to_string(&bytes));
35756                        let response = common::to_response(parts, bytes.into());
35757
35758                        if let common::Retry::After(d) =
35759                            dlg.http_failure(&response, error.as_ref().ok())
35760                        {
35761                            sleep(d).await;
35762                            continue;
35763                        }
35764
35765                        dlg.finished(false);
35766
35767                        return Err(match error {
35768                            Ok(value) => common::Error::BadRequest(value),
35769                            _ => common::Error::Failure(response),
35770                        });
35771                    }
35772                    let response = {
35773                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35774                        let encoded = common::to_string(&bytes);
35775                        match serde_json::from_str(&encoded) {
35776                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35777                            Err(error) => {
35778                                dlg.response_json_decode_error(&encoded, &error);
35779                                return Err(common::Error::JsonDecodeError(
35780                                    encoded.to_string(),
35781                                    error,
35782                                ));
35783                            }
35784                        }
35785                    };
35786
35787                    dlg.finished(true);
35788                    return Ok(response);
35789                }
35790            }
35791        }
35792    }
35793
35794    /// GTM Account's API relative path. Example: accounts/{account_id}
35795    ///
35796    /// Sets the *path* path property to the given value.
35797    ///
35798    /// Even though the property as already been set when instantiating this call,
35799    /// we provide this method for API completeness.
35800    pub fn path(mut self, new_value: &str) -> AccountGetCall<'a, C> {
35801        self._path = new_value.to_string();
35802        self
35803    }
35804    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35805    /// while executing the actual API request.
35806    ///
35807    /// ````text
35808    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35809    /// ````
35810    ///
35811    /// Sets the *delegate* property to the given value.
35812    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountGetCall<'a, C> {
35813        self._delegate = Some(new_value);
35814        self
35815    }
35816
35817    /// Set any additional parameter of the query string used in the request.
35818    /// It should be used to set parameters which are not yet available through their own
35819    /// setters.
35820    ///
35821    /// Please note that this method must not be used to set any of the known parameters
35822    /// which have their own setter method. If done anyway, the request will fail.
35823    ///
35824    /// # Additional Parameters
35825    ///
35826    /// * *$.xgafv* (query-string) - V1 error format.
35827    /// * *access_token* (query-string) - OAuth access token.
35828    /// * *alt* (query-string) - Data format for response.
35829    /// * *callback* (query-string) - JSONP
35830    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35831    /// * *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.
35832    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35833    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35834    /// * *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.
35835    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35836    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35837    pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, C>
35838    where
35839        T: AsRef<str>,
35840    {
35841        self._additional_params
35842            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35843        self
35844    }
35845
35846    /// Identifies the authorization scope for the method you are building.
35847    ///
35848    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35849    /// [`Scope::Readonly`].
35850    ///
35851    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35852    /// tokens for more than one scope.
35853    ///
35854    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35855    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35856    /// sufficient, a read-write scope will do as well.
35857    pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, C>
35858    where
35859        St: AsRef<str>,
35860    {
35861        self._scopes.insert(String::from(scope.as_ref()));
35862        self
35863    }
35864    /// Identifies the authorization scope(s) for the method you are building.
35865    ///
35866    /// See [`Self::add_scope()`] for details.
35867    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, C>
35868    where
35869        I: IntoIterator<Item = St>,
35870        St: AsRef<str>,
35871    {
35872        self._scopes
35873            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35874        self
35875    }
35876
35877    /// Removes all scopes, and no default scope will be used either.
35878    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35879    /// for details).
35880    pub fn clear_scopes(mut self) -> AccountGetCall<'a, C> {
35881        self._scopes.clear();
35882        self
35883    }
35884}
35885
35886/// Lists all GTM Accounts that a user has access to.
35887///
35888/// A builder for the *list* method supported by a *account* resource.
35889/// It is not used directly, but through a [`AccountMethods`] instance.
35890///
35891/// # Example
35892///
35893/// Instantiate a resource method builder
35894///
35895/// ```test_harness,no_run
35896/// # extern crate hyper;
35897/// # extern crate hyper_rustls;
35898/// # extern crate google_tagmanager2 as tagmanager2;
35899/// # async fn dox() {
35900/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35901///
35902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35904/// #     secret,
35905/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35906/// # ).build().await.unwrap();
35907///
35908/// # let client = hyper_util::client::legacy::Client::builder(
35909/// #     hyper_util::rt::TokioExecutor::new()
35910/// # )
35911/// # .build(
35912/// #     hyper_rustls::HttpsConnectorBuilder::new()
35913/// #         .with_native_roots()
35914/// #         .unwrap()
35915/// #         .https_or_http()
35916/// #         .enable_http1()
35917/// #         .build()
35918/// # );
35919/// # let mut hub = TagManager::new(client, auth);
35920/// // You can configure optional parameters by calling the respective setters at will, and
35921/// // execute the final call using `doit()`.
35922/// // Values shown here are possibly random and not representative !
35923/// let result = hub.accounts().list()
35924///              .page_token("gubergren")
35925///              .include_google_tags(true)
35926///              .doit().await;
35927/// # }
35928/// ```
35929pub struct AccountListCall<'a, C>
35930where
35931    C: 'a,
35932{
35933    hub: &'a TagManager<C>,
35934    _page_token: Option<String>,
35935    _include_google_tags: Option<bool>,
35936    _delegate: Option<&'a mut dyn common::Delegate>,
35937    _additional_params: HashMap<String, String>,
35938    _scopes: BTreeSet<String>,
35939}
35940
35941impl<'a, C> common::CallBuilder for AccountListCall<'a, C> {}
35942
35943impl<'a, C> AccountListCall<'a, C>
35944where
35945    C: common::Connector,
35946{
35947    /// Perform the operation you have build so far.
35948    pub async fn doit(mut self) -> common::Result<(common::Response, ListAccountsResponse)> {
35949        use std::borrow::Cow;
35950        use std::io::{Read, Seek};
35951
35952        use common::{url::Params, ToParts};
35953        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35954
35955        let mut dd = common::DefaultDelegate;
35956        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35957        dlg.begin(common::MethodInfo {
35958            id: "tagmanager.accounts.list",
35959            http_method: hyper::Method::GET,
35960        });
35961
35962        for &field in ["alt", "pageToken", "includeGoogleTags"].iter() {
35963            if self._additional_params.contains_key(field) {
35964                dlg.finished(false);
35965                return Err(common::Error::FieldClash(field));
35966            }
35967        }
35968
35969        let mut params = Params::with_capacity(4 + self._additional_params.len());
35970        if let Some(value) = self._page_token.as_ref() {
35971            params.push("pageToken", value);
35972        }
35973        if let Some(value) = self._include_google_tags.as_ref() {
35974            params.push("includeGoogleTags", value.to_string());
35975        }
35976
35977        params.extend(self._additional_params.iter());
35978
35979        params.push("alt", "json");
35980        let mut url = self.hub._base_url.clone() + "tagmanager/v2/accounts";
35981        if self._scopes.is_empty() {
35982            self._scopes.insert(Scope::Readonly.as_ref().to_string());
35983        }
35984
35985        let url = params.parse_with_url(&url);
35986
35987        loop {
35988            let token = match self
35989                .hub
35990                .auth
35991                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35992                .await
35993            {
35994                Ok(token) => token,
35995                Err(e) => match dlg.token(e) {
35996                    Ok(token) => token,
35997                    Err(e) => {
35998                        dlg.finished(false);
35999                        return Err(common::Error::MissingToken(e));
36000                    }
36001                },
36002            };
36003            let mut req_result = {
36004                let client = &self.hub.client;
36005                dlg.pre_request();
36006                let mut req_builder = hyper::Request::builder()
36007                    .method(hyper::Method::GET)
36008                    .uri(url.as_str())
36009                    .header(USER_AGENT, self.hub._user_agent.clone());
36010
36011                if let Some(token) = token.as_ref() {
36012                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36013                }
36014
36015                let request = req_builder
36016                    .header(CONTENT_LENGTH, 0_u64)
36017                    .body(common::to_body::<String>(None));
36018
36019                client.request(request.unwrap()).await
36020            };
36021
36022            match req_result {
36023                Err(err) => {
36024                    if let common::Retry::After(d) = dlg.http_error(&err) {
36025                        sleep(d).await;
36026                        continue;
36027                    }
36028                    dlg.finished(false);
36029                    return Err(common::Error::HttpError(err));
36030                }
36031                Ok(res) => {
36032                    let (mut parts, body) = res.into_parts();
36033                    let mut body = common::Body::new(body);
36034                    if !parts.status.is_success() {
36035                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36036                        let error = serde_json::from_str(&common::to_string(&bytes));
36037                        let response = common::to_response(parts, bytes.into());
36038
36039                        if let common::Retry::After(d) =
36040                            dlg.http_failure(&response, error.as_ref().ok())
36041                        {
36042                            sleep(d).await;
36043                            continue;
36044                        }
36045
36046                        dlg.finished(false);
36047
36048                        return Err(match error {
36049                            Ok(value) => common::Error::BadRequest(value),
36050                            _ => common::Error::Failure(response),
36051                        });
36052                    }
36053                    let response = {
36054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36055                        let encoded = common::to_string(&bytes);
36056                        match serde_json::from_str(&encoded) {
36057                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36058                            Err(error) => {
36059                                dlg.response_json_decode_error(&encoded, &error);
36060                                return Err(common::Error::JsonDecodeError(
36061                                    encoded.to_string(),
36062                                    error,
36063                                ));
36064                            }
36065                        }
36066                    };
36067
36068                    dlg.finished(true);
36069                    return Ok(response);
36070                }
36071            }
36072        }
36073    }
36074
36075    /// Continuation token for fetching the next page of results.
36076    ///
36077    /// Sets the *page token* query property to the given value.
36078    pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C> {
36079        self._page_token = Some(new_value.to_string());
36080        self
36081    }
36082    /// Also retrieve accounts associated with Google Tag when true.
36083    ///
36084    /// Sets the *include google tags* query property to the given value.
36085    pub fn include_google_tags(mut self, new_value: bool) -> AccountListCall<'a, C> {
36086        self._include_google_tags = Some(new_value);
36087        self
36088    }
36089    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36090    /// while executing the actual API request.
36091    ///
36092    /// ````text
36093    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36094    /// ````
36095    ///
36096    /// Sets the *delegate* property to the given value.
36097    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountListCall<'a, C> {
36098        self._delegate = Some(new_value);
36099        self
36100    }
36101
36102    /// Set any additional parameter of the query string used in the request.
36103    /// It should be used to set parameters which are not yet available through their own
36104    /// setters.
36105    ///
36106    /// Please note that this method must not be used to set any of the known parameters
36107    /// which have their own setter method. If done anyway, the request will fail.
36108    ///
36109    /// # Additional Parameters
36110    ///
36111    /// * *$.xgafv* (query-string) - V1 error format.
36112    /// * *access_token* (query-string) - OAuth access token.
36113    /// * *alt* (query-string) - Data format for response.
36114    /// * *callback* (query-string) - JSONP
36115    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36116    /// * *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.
36117    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36118    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36119    /// * *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.
36120    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36121    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36122    pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, C>
36123    where
36124        T: AsRef<str>,
36125    {
36126        self._additional_params
36127            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36128        self
36129    }
36130
36131    /// Identifies the authorization scope for the method you are building.
36132    ///
36133    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36134    /// [`Scope::Readonly`].
36135    ///
36136    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36137    /// tokens for more than one scope.
36138    ///
36139    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36140    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36141    /// sufficient, a read-write scope will do as well.
36142    pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, C>
36143    where
36144        St: AsRef<str>,
36145    {
36146        self._scopes.insert(String::from(scope.as_ref()));
36147        self
36148    }
36149    /// Identifies the authorization scope(s) for the method you are building.
36150    ///
36151    /// See [`Self::add_scope()`] for details.
36152    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, C>
36153    where
36154        I: IntoIterator<Item = St>,
36155        St: AsRef<str>,
36156    {
36157        self._scopes
36158            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36159        self
36160    }
36161
36162    /// Removes all scopes, and no default scope will be used either.
36163    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36164    /// for details).
36165    pub fn clear_scopes(mut self) -> AccountListCall<'a, C> {
36166        self._scopes.clear();
36167        self
36168    }
36169}
36170
36171/// Updates a GTM Account.
36172///
36173/// A builder for the *update* method supported by a *account* resource.
36174/// It is not used directly, but through a [`AccountMethods`] instance.
36175///
36176/// # Example
36177///
36178/// Instantiate a resource method builder
36179///
36180/// ```test_harness,no_run
36181/// # extern crate hyper;
36182/// # extern crate hyper_rustls;
36183/// # extern crate google_tagmanager2 as tagmanager2;
36184/// use tagmanager2::api::Account;
36185/// # async fn dox() {
36186/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36187///
36188/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36190/// #     secret,
36191/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36192/// # ).build().await.unwrap();
36193///
36194/// # let client = hyper_util::client::legacy::Client::builder(
36195/// #     hyper_util::rt::TokioExecutor::new()
36196/// # )
36197/// # .build(
36198/// #     hyper_rustls::HttpsConnectorBuilder::new()
36199/// #         .with_native_roots()
36200/// #         .unwrap()
36201/// #         .https_or_http()
36202/// #         .enable_http1()
36203/// #         .build()
36204/// # );
36205/// # let mut hub = TagManager::new(client, auth);
36206/// // As the method needs a request, you would usually fill it with the desired information
36207/// // into the respective structure. Some of the parts shown here might not be applicable !
36208/// // Values shown here are possibly random and not representative !
36209/// let mut req = Account::default();
36210///
36211/// // You can configure optional parameters by calling the respective setters at will, and
36212/// // execute the final call using `doit()`.
36213/// // Values shown here are possibly random and not representative !
36214/// let result = hub.accounts().update(req, "path")
36215///              .fingerprint("sit")
36216///              .doit().await;
36217/// # }
36218/// ```
36219pub struct AccountUpdateCall<'a, C>
36220where
36221    C: 'a,
36222{
36223    hub: &'a TagManager<C>,
36224    _request: Account,
36225    _path: String,
36226    _fingerprint: Option<String>,
36227    _delegate: Option<&'a mut dyn common::Delegate>,
36228    _additional_params: HashMap<String, String>,
36229    _scopes: BTreeSet<String>,
36230}
36231
36232impl<'a, C> common::CallBuilder for AccountUpdateCall<'a, C> {}
36233
36234impl<'a, C> AccountUpdateCall<'a, C>
36235where
36236    C: common::Connector,
36237{
36238    /// Perform the operation you have build so far.
36239    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
36240        use std::borrow::Cow;
36241        use std::io::{Read, Seek};
36242
36243        use common::{url::Params, ToParts};
36244        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36245
36246        let mut dd = common::DefaultDelegate;
36247        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36248        dlg.begin(common::MethodInfo {
36249            id: "tagmanager.accounts.update",
36250            http_method: hyper::Method::PUT,
36251        });
36252
36253        for &field in ["alt", "path", "fingerprint"].iter() {
36254            if self._additional_params.contains_key(field) {
36255                dlg.finished(false);
36256                return Err(common::Error::FieldClash(field));
36257            }
36258        }
36259
36260        let mut params = Params::with_capacity(5 + self._additional_params.len());
36261        params.push("path", self._path);
36262        if let Some(value) = self._fingerprint.as_ref() {
36263            params.push("fingerprint", value);
36264        }
36265
36266        params.extend(self._additional_params.iter());
36267
36268        params.push("alt", "json");
36269        let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
36270        if self._scopes.is_empty() {
36271            self._scopes
36272                .insert(Scope::ManageAccount.as_ref().to_string());
36273        }
36274
36275        #[allow(clippy::single_element_loop)]
36276        for &(find_this, param_name) in [("{+path}", "path")].iter() {
36277            url = params.uri_replacement(url, param_name, find_this, true);
36278        }
36279        {
36280            let to_remove = ["path"];
36281            params.remove_params(&to_remove);
36282        }
36283
36284        let url = params.parse_with_url(&url);
36285
36286        let mut json_mime_type = mime::APPLICATION_JSON;
36287        let mut request_value_reader = {
36288            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36289            common::remove_json_null_values(&mut value);
36290            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36291            serde_json::to_writer(&mut dst, &value).unwrap();
36292            dst
36293        };
36294        let request_size = request_value_reader
36295            .seek(std::io::SeekFrom::End(0))
36296            .unwrap();
36297        request_value_reader
36298            .seek(std::io::SeekFrom::Start(0))
36299            .unwrap();
36300
36301        loop {
36302            let token = match self
36303                .hub
36304                .auth
36305                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36306                .await
36307            {
36308                Ok(token) => token,
36309                Err(e) => match dlg.token(e) {
36310                    Ok(token) => token,
36311                    Err(e) => {
36312                        dlg.finished(false);
36313                        return Err(common::Error::MissingToken(e));
36314                    }
36315                },
36316            };
36317            request_value_reader
36318                .seek(std::io::SeekFrom::Start(0))
36319                .unwrap();
36320            let mut req_result = {
36321                let client = &self.hub.client;
36322                dlg.pre_request();
36323                let mut req_builder = hyper::Request::builder()
36324                    .method(hyper::Method::PUT)
36325                    .uri(url.as_str())
36326                    .header(USER_AGENT, self.hub._user_agent.clone());
36327
36328                if let Some(token) = token.as_ref() {
36329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36330                }
36331
36332                let request = req_builder
36333                    .header(CONTENT_TYPE, json_mime_type.to_string())
36334                    .header(CONTENT_LENGTH, request_size as u64)
36335                    .body(common::to_body(
36336                        request_value_reader.get_ref().clone().into(),
36337                    ));
36338
36339                client.request(request.unwrap()).await
36340            };
36341
36342            match req_result {
36343                Err(err) => {
36344                    if let common::Retry::After(d) = dlg.http_error(&err) {
36345                        sleep(d).await;
36346                        continue;
36347                    }
36348                    dlg.finished(false);
36349                    return Err(common::Error::HttpError(err));
36350                }
36351                Ok(res) => {
36352                    let (mut parts, body) = res.into_parts();
36353                    let mut body = common::Body::new(body);
36354                    if !parts.status.is_success() {
36355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36356                        let error = serde_json::from_str(&common::to_string(&bytes));
36357                        let response = common::to_response(parts, bytes.into());
36358
36359                        if let common::Retry::After(d) =
36360                            dlg.http_failure(&response, error.as_ref().ok())
36361                        {
36362                            sleep(d).await;
36363                            continue;
36364                        }
36365
36366                        dlg.finished(false);
36367
36368                        return Err(match error {
36369                            Ok(value) => common::Error::BadRequest(value),
36370                            _ => common::Error::Failure(response),
36371                        });
36372                    }
36373                    let response = {
36374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36375                        let encoded = common::to_string(&bytes);
36376                        match serde_json::from_str(&encoded) {
36377                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36378                            Err(error) => {
36379                                dlg.response_json_decode_error(&encoded, &error);
36380                                return Err(common::Error::JsonDecodeError(
36381                                    encoded.to_string(),
36382                                    error,
36383                                ));
36384                            }
36385                        }
36386                    };
36387
36388                    dlg.finished(true);
36389                    return Ok(response);
36390                }
36391            }
36392        }
36393    }
36394
36395    ///
36396    /// Sets the *request* property to the given value.
36397    ///
36398    /// Even though the property as already been set when instantiating this call,
36399    /// we provide this method for API completeness.
36400    pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C> {
36401        self._request = new_value;
36402        self
36403    }
36404    /// GTM Account's API relative path. Example: accounts/{account_id}
36405    ///
36406    /// Sets the *path* path property to the given value.
36407    ///
36408    /// Even though the property as already been set when instantiating this call,
36409    /// we provide this method for API completeness.
36410    pub fn path(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
36411        self._path = new_value.to_string();
36412        self
36413    }
36414    /// When provided, this fingerprint must match the fingerprint of the account in storage.
36415    ///
36416    /// Sets the *fingerprint* query property to the given value.
36417    pub fn fingerprint(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
36418        self._fingerprint = Some(new_value.to_string());
36419        self
36420    }
36421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36422    /// while executing the actual API request.
36423    ///
36424    /// ````text
36425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36426    /// ````
36427    ///
36428    /// Sets the *delegate* property to the given value.
36429    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountUpdateCall<'a, C> {
36430        self._delegate = Some(new_value);
36431        self
36432    }
36433
36434    /// Set any additional parameter of the query string used in the request.
36435    /// It should be used to set parameters which are not yet available through their own
36436    /// setters.
36437    ///
36438    /// Please note that this method must not be used to set any of the known parameters
36439    /// which have their own setter method. If done anyway, the request will fail.
36440    ///
36441    /// # Additional Parameters
36442    ///
36443    /// * *$.xgafv* (query-string) - V1 error format.
36444    /// * *access_token* (query-string) - OAuth access token.
36445    /// * *alt* (query-string) - Data format for response.
36446    /// * *callback* (query-string) - JSONP
36447    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36448    /// * *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.
36449    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36450    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36451    /// * *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.
36452    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36453    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36454    pub fn param<T>(mut self, name: T, value: T) -> AccountUpdateCall<'a, C>
36455    where
36456        T: AsRef<str>,
36457    {
36458        self._additional_params
36459            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36460        self
36461    }
36462
36463    /// Identifies the authorization scope for the method you are building.
36464    ///
36465    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36466    /// [`Scope::ManageAccount`].
36467    ///
36468    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36469    /// tokens for more than one scope.
36470    ///
36471    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36472    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36473    /// sufficient, a read-write scope will do as well.
36474    pub fn add_scope<St>(mut self, scope: St) -> AccountUpdateCall<'a, C>
36475    where
36476        St: AsRef<str>,
36477    {
36478        self._scopes.insert(String::from(scope.as_ref()));
36479        self
36480    }
36481    /// Identifies the authorization scope(s) for the method you are building.
36482    ///
36483    /// See [`Self::add_scope()`] for details.
36484    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUpdateCall<'a, C>
36485    where
36486        I: IntoIterator<Item = St>,
36487        St: AsRef<str>,
36488    {
36489        self._scopes
36490            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36491        self
36492    }
36493
36494    /// Removes all scopes, and no default scope will be used either.
36495    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36496    /// for details).
36497    pub fn clear_scopes(mut self) -> AccountUpdateCall<'a, C> {
36498        self._scopes.clear();
36499        self
36500    }
36501}