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 connector = hyper_rustls::HttpsConnectorBuilder::new()
90/// .with_native_roots()
91/// .unwrap()
92/// .https_only()
93/// .enable_http2()
94/// .build();
95///
96/// let executor = hyper_util::rt::TokioExecutor::new();
97/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
98/// secret,
99/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
100/// yup_oauth2::client::CustomHyperClientBuilder::from(
101/// hyper_util::client::legacy::Client::builder(executor).build(connector),
102/// ),
103/// ).build().await.unwrap();
104///
105/// let client = hyper_util::client::legacy::Client::builder(
106/// hyper_util::rt::TokioExecutor::new()
107/// )
108/// .build(
109/// hyper_rustls::HttpsConnectorBuilder::new()
110/// .with_native_roots()
111/// .unwrap()
112/// .https_or_http()
113/// .enable_http2()
114/// .build()
115/// );
116/// let mut hub = TagManager::new(client, auth);
117/// // You can configure optional parameters by calling the respective setters at will, and
118/// // execute the final call using `doit()`.
119/// // Values shown here are possibly random and not representative !
120/// let result = hub.accounts().containers_move_tag_id("path")
121/// .tag_name("duo")
122/// .tag_id("ipsum")
123/// .copy_users(false)
124/// .copy_terms_of_service(true)
125/// .copy_settings(true)
126/// .allow_user_permission_feature_update(true)
127/// .doit().await;
128///
129/// match result {
130/// Err(e) => match e {
131/// // The Error enum provides details about what exactly happened.
132/// // You can also just use its `Debug`, `Display` or `Error` traits
133/// Error::HttpError(_)
134/// |Error::Io(_)
135/// |Error::MissingAPIKey
136/// |Error::MissingToken(_)
137/// |Error::Cancelled
138/// |Error::UploadSizeLimitExceeded(_, _)
139/// |Error::Failure(_)
140/// |Error::BadRequest(_)
141/// |Error::FieldClash(_)
142/// |Error::JsonDecodeError(_, _) => println!("{}", e),
143/// },
144/// Ok(res) => println!("Success: {:?}", res),
145/// }
146/// # }
147/// ```
148#[derive(Clone)]
149pub struct TagManager<C> {
150 pub client: common::Client<C>,
151 pub auth: Box<dyn common::GetToken>,
152 _user_agent: String,
153 _base_url: String,
154 _root_url: String,
155}
156
157impl<C> common::Hub for TagManager<C> {}
158
159impl<'a, C> TagManager<C> {
160 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> TagManager<C> {
161 TagManager {
162 client,
163 auth: Box::new(auth),
164 _user_agent: "google-api-rust-client/7.0.0".to_string(),
165 _base_url: "https://tagmanager.googleapis.com/".to_string(),
166 _root_url: "https://tagmanager.googleapis.com/".to_string(),
167 }
168 }
169
170 pub fn accounts(&'a self) -> AccountMethods<'a, C> {
171 AccountMethods { hub: self }
172 }
173
174 /// Set the user-agent header field to use in all requests to the server.
175 /// It defaults to `google-api-rust-client/7.0.0`.
176 ///
177 /// Returns the previously set user-agent.
178 pub fn user_agent(&mut self, agent_name: String) -> String {
179 std::mem::replace(&mut self._user_agent, agent_name)
180 }
181
182 /// Set the base url to use in all requests to the server.
183 /// It defaults to `https://tagmanager.googleapis.com/`.
184 ///
185 /// Returns the previously set base url.
186 pub fn base_url(&mut self, new_base_url: String) -> String {
187 std::mem::replace(&mut self._base_url, new_base_url)
188 }
189
190 /// Set the root url to use in all requests to the server.
191 /// It defaults to `https://tagmanager.googleapis.com/`.
192 ///
193 /// Returns the previously set root url.
194 pub fn root_url(&mut self, new_root_url: String) -> String {
195 std::mem::replace(&mut self._root_url, new_root_url)
196 }
197}
198
199// ############
200// SCHEMAS ###
201// ##########
202/// Represents a Google Tag Manager Account.
203///
204/// # Activities
205///
206/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
207/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
208///
209/// * [containers destinations get accounts](AccountContainerDestinationGetCall) (none)
210/// * [containers destinations link accounts](AccountContainerDestinationLinkCall) (none)
211/// * [containers destinations list accounts](AccountContainerDestinationListCall) (none)
212/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (none)
213/// * [containers environments delete accounts](AccountContainerEnvironmentDeleteCall) (none)
214/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (none)
215/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (none)
216/// * [containers environments reauthorize accounts](AccountContainerEnvironmentReauthorizeCall) (none)
217/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (none)
218/// * [containers version_headers latest accounts](AccountContainerVersionHeaderLatestCall) (none)
219/// * [containers version_headers list accounts](AccountContainerVersionHeaderListCall) (none)
220/// * [containers versions delete accounts](AccountContainerVersionDeleteCall) (none)
221/// * [containers versions get accounts](AccountContainerVersionGetCall) (none)
222/// * [containers versions live accounts](AccountContainerVersionLiveCall) (none)
223/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (none)
224/// * [containers versions set_latest accounts](AccountContainerVersionSetLatestCall) (none)
225/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (none)
226/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (none)
227/// * [containers workspaces built_in_variables create accounts](AccountContainerWorkspaceBuiltInVariableCreateCall) (none)
228/// * [containers workspaces built_in_variables delete accounts](AccountContainerWorkspaceBuiltInVariableDeleteCall) (none)
229/// * [containers workspaces built_in_variables list accounts](AccountContainerWorkspaceBuiltInVariableListCall) (none)
230/// * [containers workspaces built_in_variables revert accounts](AccountContainerWorkspaceBuiltInVariableRevertCall) (none)
231/// * [containers workspaces clients create accounts](AccountContainerWorkspaceClientCreateCall) (none)
232/// * [containers workspaces clients delete accounts](AccountContainerWorkspaceClientDeleteCall) (none)
233/// * [containers workspaces clients get accounts](AccountContainerWorkspaceClientGetCall) (none)
234/// * [containers workspaces clients list accounts](AccountContainerWorkspaceClientListCall) (none)
235/// * [containers workspaces clients revert accounts](AccountContainerWorkspaceClientRevertCall) (none)
236/// * [containers workspaces clients update accounts](AccountContainerWorkspaceClientUpdateCall) (none)
237/// * [containers workspaces folders create accounts](AccountContainerWorkspaceFolderCreateCall) (none)
238/// * [containers workspaces folders delete accounts](AccountContainerWorkspaceFolderDeleteCall) (none)
239/// * [containers workspaces folders entities accounts](AccountContainerWorkspaceFolderEntityCall) (none)
240/// * [containers workspaces folders get accounts](AccountContainerWorkspaceFolderGetCall) (none)
241/// * [containers workspaces folders list accounts](AccountContainerWorkspaceFolderListCall) (none)
242/// * [containers workspaces folders move_entities_to_folder accounts](AccountContainerWorkspaceFolderMoveEntitiesToFolderCall) (none)
243/// * [containers workspaces folders revert accounts](AccountContainerWorkspaceFolderRevertCall) (none)
244/// * [containers workspaces folders update accounts](AccountContainerWorkspaceFolderUpdateCall) (none)
245/// * [containers workspaces gtag_config create accounts](AccountContainerWorkspaceGtagConfigCreateCall) (none)
246/// * [containers workspaces gtag_config delete accounts](AccountContainerWorkspaceGtagConfigDeleteCall) (none)
247/// * [containers workspaces gtag_config get accounts](AccountContainerWorkspaceGtagConfigGetCall) (none)
248/// * [containers workspaces gtag_config list accounts](AccountContainerWorkspaceGtagConfigListCall) (none)
249/// * [containers workspaces gtag_config update accounts](AccountContainerWorkspaceGtagConfigUpdateCall) (none)
250/// * [containers workspaces tags create accounts](AccountContainerWorkspaceTagCreateCall) (none)
251/// * [containers workspaces tags delete accounts](AccountContainerWorkspaceTagDeleteCall) (none)
252/// * [containers workspaces tags get accounts](AccountContainerWorkspaceTagGetCall) (none)
253/// * [containers workspaces tags list accounts](AccountContainerWorkspaceTagListCall) (none)
254/// * [containers workspaces tags revert accounts](AccountContainerWorkspaceTagRevertCall) (none)
255/// * [containers workspaces tags update accounts](AccountContainerWorkspaceTagUpdateCall) (none)
256/// * [containers workspaces templates create accounts](AccountContainerWorkspaceTemplateCreateCall) (none)
257/// * [containers workspaces templates delete accounts](AccountContainerWorkspaceTemplateDeleteCall) (none)
258/// * [containers workspaces templates get accounts](AccountContainerWorkspaceTemplateGetCall) (none)
259/// * [containers workspaces templates import_from_gallery accounts](AccountContainerWorkspaceTemplateImportFromGalleryCall) (none)
260/// * [containers workspaces templates list accounts](AccountContainerWorkspaceTemplateListCall) (none)
261/// * [containers workspaces templates revert accounts](AccountContainerWorkspaceTemplateRevertCall) (none)
262/// * [containers workspaces templates update accounts](AccountContainerWorkspaceTemplateUpdateCall) (none)
263/// * [containers workspaces transformations create accounts](AccountContainerWorkspaceTransformationCreateCall) (none)
264/// * [containers workspaces transformations delete accounts](AccountContainerWorkspaceTransformationDeleteCall) (none)
265/// * [containers workspaces transformations get accounts](AccountContainerWorkspaceTransformationGetCall) (none)
266/// * [containers workspaces transformations list accounts](AccountContainerWorkspaceTransformationListCall) (none)
267/// * [containers workspaces transformations revert accounts](AccountContainerWorkspaceTransformationRevertCall) (none)
268/// * [containers workspaces transformations update accounts](AccountContainerWorkspaceTransformationUpdateCall) (none)
269/// * [containers workspaces triggers create accounts](AccountContainerWorkspaceTriggerCreateCall) (none)
270/// * [containers workspaces triggers delete accounts](AccountContainerWorkspaceTriggerDeleteCall) (none)
271/// * [containers workspaces triggers get accounts](AccountContainerWorkspaceTriggerGetCall) (none)
272/// * [containers workspaces triggers list accounts](AccountContainerWorkspaceTriggerListCall) (none)
273/// * [containers workspaces triggers revert accounts](AccountContainerWorkspaceTriggerRevertCall) (none)
274/// * [containers workspaces triggers update accounts](AccountContainerWorkspaceTriggerUpdateCall) (none)
275/// * [containers workspaces variables create accounts](AccountContainerWorkspaceVariableCreateCall) (none)
276/// * [containers workspaces variables delete accounts](AccountContainerWorkspaceVariableDeleteCall) (none)
277/// * [containers workspaces variables get accounts](AccountContainerWorkspaceVariableGetCall) (none)
278/// * [containers workspaces variables list accounts](AccountContainerWorkspaceVariableListCall) (none)
279/// * [containers workspaces variables revert accounts](AccountContainerWorkspaceVariableRevertCall) (none)
280/// * [containers workspaces variables update accounts](AccountContainerWorkspaceVariableUpdateCall) (none)
281/// * [containers workspaces zones create accounts](AccountContainerWorkspaceZoneCreateCall) (none)
282/// * [containers workspaces zones delete accounts](AccountContainerWorkspaceZoneDeleteCall) (none)
283/// * [containers workspaces zones get accounts](AccountContainerWorkspaceZoneGetCall) (none)
284/// * [containers workspaces zones list accounts](AccountContainerWorkspaceZoneListCall) (none)
285/// * [containers workspaces zones revert accounts](AccountContainerWorkspaceZoneRevertCall) (none)
286/// * [containers workspaces zones update accounts](AccountContainerWorkspaceZoneUpdateCall) (none)
287/// * [containers workspaces bulk_update accounts](AccountContainerWorkspaceBulkUpdateCall) (none)
288/// * [containers workspaces create accounts](AccountContainerWorkspaceCreateCall) (none)
289/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (none)
290/// * [containers workspaces delete accounts](AccountContainerWorkspaceDeleteCall) (none)
291/// * [containers workspaces get accounts](AccountContainerWorkspaceGetCall) (none)
292/// * [containers workspaces get status accounts](AccountContainerWorkspaceGetStatuCall) (none)
293/// * [containers workspaces list accounts](AccountContainerWorkspaceListCall) (none)
294/// * [containers workspaces quick_preview accounts](AccountContainerWorkspaceQuickPreviewCall) (none)
295/// * [containers workspaces resolve_conflict accounts](AccountContainerWorkspaceResolveConflictCall) (none)
296/// * [containers workspaces sync accounts](AccountContainerWorkspaceSyncCall) (none)
297/// * [containers workspaces update accounts](AccountContainerWorkspaceUpdateCall) (none)
298/// * [containers combine accounts](AccountContainerCombineCall) (none)
299/// * [containers create accounts](AccountContainerCreateCall) (none)
300/// * [containers delete accounts](AccountContainerDeleteCall) (none)
301/// * [containers get accounts](AccountContainerGetCall) (none)
302/// * [containers list accounts](AccountContainerListCall) (none)
303/// * [containers lookup accounts](AccountContainerLookupCall) (none)
304/// * [containers move_tag_id accounts](AccountContainerMoveTagIdCall) (none)
305/// * [containers snippet accounts](AccountContainerSnippetCall) (none)
306/// * [containers update accounts](AccountContainerUpdateCall) (none)
307/// * [user_permissions create accounts](AccountUserPermissionCreateCall) (none)
308/// * [user_permissions delete accounts](AccountUserPermissionDeleteCall) (none)
309/// * [user_permissions get accounts](AccountUserPermissionGetCall) (none)
310/// * [user_permissions list accounts](AccountUserPermissionListCall) (none)
311/// * [user_permissions update accounts](AccountUserPermissionUpdateCall) (none)
312/// * [get accounts](AccountGetCall) (response)
313/// * [list accounts](AccountListCall) (none)
314/// * [update accounts](AccountUpdateCall) (request|response)
315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
316#[serde_with::serde_as]
317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
318pub struct Account {
319 /// The Account ID uniquely identifies the GTM Account.
320 #[serde(rename = "accountId")]
321 pub account_id: Option<String>,
322 /// Read-only Account feature set
323 pub features: Option<AccountFeatures>,
324 /// The fingerprint of the GTM Account as computed at storage time. This value is recomputed whenever the account is modified.
325 pub fingerprint: Option<String>,
326 /// Account display name.
327 pub name: Option<String>,
328 /// GTM Account's API relative path.
329 pub path: Option<String>,
330 /// 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.
331 #[serde(rename = "shareData")]
332 pub share_data: Option<bool>,
333 /// Auto generated link to the tag manager UI
334 #[serde(rename = "tagManagerUrl")]
335 pub tag_manager_url: Option<String>,
336}
337
338impl common::RequestValue for Account {}
339impl common::Resource for Account {}
340impl common::ResponseResult for Account {}
341
342/// Defines the Google Tag Manager Account access permissions.
343///
344/// This type is not used in any activity, and only used as *part* of another schema.
345///
346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
347#[serde_with::serde_as]
348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
349pub struct AccountAccess {
350 /// Whether the user has no access, user access, or admin access to an account.
351 pub permission: Option<String>,
352}
353
354impl common::Part for AccountAccess {}
355
356/// There is no detailed description.
357///
358/// This type is not used in any activity, and only used as *part* of another schema.
359///
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct AccountFeatures {
364 /// Whether this Account supports multiple Containers.
365 #[serde(rename = "supportMultipleContainers")]
366 pub support_multiple_containers: Option<bool>,
367 /// Whether this Account supports user permissions managed by GTM.
368 #[serde(rename = "supportUserPermissions")]
369 pub support_user_permissions: Option<bool>,
370}
371
372impl common::Part for AccountFeatures {}
373
374/// 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.
375///
376/// This type is not used in any activity, and only used as *part* of another schema.
377///
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct BuiltInVariable {
382 /// GTM Account ID.
383 #[serde(rename = "accountId")]
384 pub account_id: Option<String>,
385 /// GTM Container ID.
386 #[serde(rename = "containerId")]
387 pub container_id: Option<String>,
388 /// Name of the built-in variable to be used to refer to the built-in variable.
389 pub name: Option<String>,
390 /// GTM BuiltInVariable's API relative path.
391 pub path: Option<String>,
392 /// Type of built-in variable.
393 #[serde(rename = "type")]
394 pub type_: Option<String>,
395 /// GTM Workspace ID.
396 #[serde(rename = "workspaceId")]
397 pub workspace_id: Option<String>,
398}
399
400impl common::Part for BuiltInVariable {}
401
402/// There is no detailed description.
403///
404/// # Activities
405///
406/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
407/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
408///
409/// * [containers workspaces bulk_update accounts](AccountContainerWorkspaceBulkUpdateCall) (response)
410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
411#[serde_with::serde_as]
412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
413pub struct BulkUpdateWorkspaceResponse {
414 /// The entities that were added or updated during the bulk-update. Does not include entities that were deleted or updated by the system.
415 pub changes: Option<Vec<Entity>>,
416}
417
418impl common::ResponseResult for BulkUpdateWorkspaceResponse {}
419
420/// There is no detailed description.
421///
422/// # Activities
423///
424/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
425/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
426///
427/// * [containers workspaces clients create accounts](AccountContainerWorkspaceClientCreateCall) (request|response)
428/// * [containers workspaces clients get accounts](AccountContainerWorkspaceClientGetCall) (response)
429/// * [containers workspaces clients update accounts](AccountContainerWorkspaceClientUpdateCall) (request|response)
430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
431#[serde_with::serde_as]
432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
433pub struct Client {
434 /// GTM Account ID.
435 #[serde(rename = "accountId")]
436 pub account_id: Option<String>,
437 /// The Client ID uniquely identifies the GTM client.
438 #[serde(rename = "clientId")]
439 pub client_id: Option<String>,
440 /// GTM Container ID.
441 #[serde(rename = "containerId")]
442 pub container_id: Option<String>,
443 /// The fingerprint of the GTM Client as computed at storage time. This value is recomputed whenever the client is modified.
444 pub fingerprint: Option<String>,
445 /// Client display name.
446 pub name: Option<String>,
447 /// User notes on how to apply this tag in the container.
448 pub notes: Option<String>,
449 /// The client's parameters.
450 pub parameter: Option<Vec<Parameter>>,
451 /// Parent folder id.
452 #[serde(rename = "parentFolderId")]
453 pub parent_folder_id: Option<String>,
454 /// GTM client's API relative path.
455 pub path: Option<String>,
456 /// Priority determines relative firing order.
457 pub priority: Option<i32>,
458 /// Auto generated link to the tag manager UI
459 #[serde(rename = "tagManagerUrl")]
460 pub tag_manager_url: Option<String>,
461 /// Client type.
462 #[serde(rename = "type")]
463 pub type_: Option<String>,
464 /// GTM Workspace ID.
465 #[serde(rename = "workspaceId")]
466 pub workspace_id: Option<String>,
467}
468
469impl common::RequestValue for Client {}
470impl common::ResponseResult for Client {}
471
472/// Represents a predicate.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct Condition {
480 /// 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.
481 pub parameter: Option<Vec<Parameter>>,
482 /// The type of operator for this condition.
483 #[serde(rename = "type")]
484 pub type_: Option<String>,
485}
486
487impl common::Part for Condition {}
488
489/// Represents a Google Tag Manager Container, which specifies the platform tags will run on, manages workspaces, and retains container versions.
490///
491/// # Activities
492///
493/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
494/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
495///
496/// * [containers combine accounts](AccountContainerCombineCall) (response)
497/// * [containers create accounts](AccountContainerCreateCall) (request|response)
498/// * [containers get accounts](AccountContainerGetCall) (response)
499/// * [containers lookup accounts](AccountContainerLookupCall) (response)
500/// * [containers move_tag_id accounts](AccountContainerMoveTagIdCall) (response)
501/// * [containers update accounts](AccountContainerUpdateCall) (request|response)
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct Container {
506 /// GTM Account ID.
507 #[serde(rename = "accountId")]
508 pub account_id: Option<String>,
509 /// The Container ID uniquely identifies the GTM Container.
510 #[serde(rename = "containerId")]
511 pub container_id: Option<String>,
512 /// List of domain names associated with the Container.
513 #[serde(rename = "domainName")]
514 pub domain_name: Option<Vec<String>>,
515 /// Read-only Container feature set.
516 pub features: Option<ContainerFeatures>,
517 /// The fingerprint of the GTM Container as computed at storage time. This value is recomputed whenever the account is modified.
518 pub fingerprint: Option<String>,
519 /// Container display name.
520 pub name: Option<String>,
521 /// Container Notes.
522 pub notes: Option<String>,
523 /// GTM Container's API relative path.
524 pub path: Option<String>,
525 /// Container Public ID.
526 #[serde(rename = "publicId")]
527 pub public_id: Option<String>,
528 /// All Tag IDs that refer to this Container.
529 #[serde(rename = "tagIds")]
530 pub tag_ids: Option<Vec<String>>,
531 /// Auto generated link to the tag manager UI
532 #[serde(rename = "tagManagerUrl")]
533 pub tag_manager_url: Option<String>,
534 /// List of server-side container URLs for the Container. If multiple URLs are provided, all URL paths must match.
535 #[serde(rename = "taggingServerUrls")]
536 pub tagging_server_urls: Option<Vec<String>>,
537 /// List of Usage Contexts for the Container. Valid values include: web, android, or ios.
538 #[serde(rename = "usageContext")]
539 pub usage_context: Option<Vec<String>>,
540}
541
542impl common::RequestValue for Container {}
543impl common::ResponseResult for Container {}
544
545/// Defines the Google Tag Manager Container access permissions.
546///
547/// This type is not used in any activity, and only used as *part* of another schema.
548///
549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
550#[serde_with::serde_as]
551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
552pub struct ContainerAccess {
553 /// GTM Container ID.
554 #[serde(rename = "containerId")]
555 pub container_id: Option<String>,
556 /// List of Container permissions.
557 pub permission: Option<String>,
558}
559
560impl common::Part for ContainerAccess {}
561
562/// There is no detailed description.
563///
564/// This type is not used in any activity, and only used as *part* of another schema.
565///
566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
567#[serde_with::serde_as]
568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
569pub struct ContainerFeatures {
570 /// Whether this Container supports built-in variables
571 #[serde(rename = "supportBuiltInVariables")]
572 pub support_built_in_variables: Option<bool>,
573 /// Whether this Container supports clients.
574 #[serde(rename = "supportClients")]
575 pub support_clients: Option<bool>,
576 /// Whether this Container supports environments.
577 #[serde(rename = "supportEnvironments")]
578 pub support_environments: Option<bool>,
579 /// Whether this Container supports folders.
580 #[serde(rename = "supportFolders")]
581 pub support_folders: Option<bool>,
582 /// Whether this Container supports Google tag config.
583 #[serde(rename = "supportGtagConfigs")]
584 pub support_gtag_configs: Option<bool>,
585 /// Whether this Container supports tags.
586 #[serde(rename = "supportTags")]
587 pub support_tags: Option<bool>,
588 /// Whether this Container supports templates.
589 #[serde(rename = "supportTemplates")]
590 pub support_templates: Option<bool>,
591 /// Whether this Container supports transformations.
592 #[serde(rename = "supportTransformations")]
593 pub support_transformations: Option<bool>,
594 /// Whether this Container supports triggers.
595 #[serde(rename = "supportTriggers")]
596 pub support_triggers: Option<bool>,
597 /// Whether this Container supports user permissions managed by GTM.
598 #[serde(rename = "supportUserPermissions")]
599 pub support_user_permissions: Option<bool>,
600 /// Whether this Container supports variables.
601 #[serde(rename = "supportVariables")]
602 pub support_variables: Option<bool>,
603 /// Whether this Container supports Container versions.
604 #[serde(rename = "supportVersions")]
605 pub support_versions: Option<bool>,
606 /// Whether this Container supports workspaces.
607 #[serde(rename = "supportWorkspaces")]
608 pub support_workspaces: Option<bool>,
609 /// Whether this Container supports zones.
610 #[serde(rename = "supportZones")]
611 pub support_zones: Option<bool>,
612}
613
614impl common::Part for ContainerFeatures {}
615
616/// Represents a Google Tag Manager Container Version.
617///
618/// # Activities
619///
620/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
621/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
622///
623/// * [containers versions get accounts](AccountContainerVersionGetCall) (response)
624/// * [containers versions live accounts](AccountContainerVersionLiveCall) (response)
625/// * [containers versions set_latest accounts](AccountContainerVersionSetLatestCall) (response)
626/// * [containers versions undelete accounts](AccountContainerVersionUndeleteCall) (response)
627/// * [containers versions update accounts](AccountContainerVersionUpdateCall) (request|response)
628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
629#[serde_with::serde_as]
630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
631pub struct ContainerVersion {
632 /// GTM Account ID.
633 #[serde(rename = "accountId")]
634 pub account_id: Option<String>,
635 /// The built-in variables in the container that this version was taken from.
636 #[serde(rename = "builtInVariable")]
637 pub built_in_variable: Option<Vec<BuiltInVariable>>,
638 /// The clients in the container that this version was taken from.
639 pub client: Option<Vec<Client>>,
640 /// The container that this version was taken from.
641 pub container: Option<Container>,
642 /// GTM Container ID.
643 #[serde(rename = "containerId")]
644 pub container_id: Option<String>,
645 /// The Container Version ID uniquely identifies the GTM Container Version.
646 #[serde(rename = "containerVersionId")]
647 pub container_version_id: Option<String>,
648 /// The custom templates in the container that this version was taken from.
649 #[serde(rename = "customTemplate")]
650 pub custom_template: Option<Vec<CustomTemplate>>,
651 /// A value of true indicates this container version has been deleted.
652 pub deleted: Option<bool>,
653 /// Container version description.
654 pub description: Option<String>,
655 /// The fingerprint of the GTM Container Version as computed at storage time. This value is recomputed whenever the container version is modified.
656 pub fingerprint: Option<String>,
657 /// The folders in the container that this version was taken from.
658 pub folder: Option<Vec<Folder>>,
659 /// The Google tag configs in the container that this version was taken from.
660 #[serde(rename = "gtagConfig")]
661 pub gtag_config: Option<Vec<GtagConfig>>,
662 /// Container version display name.
663 pub name: Option<String>,
664 /// GTM Container Version's API relative path.
665 pub path: Option<String>,
666 /// The tags in the container that this version was taken from.
667 pub tag: Option<Vec<Tag>>,
668 /// Auto generated link to the tag manager UI
669 #[serde(rename = "tagManagerUrl")]
670 pub tag_manager_url: Option<String>,
671 /// The transformations in the container that this version was taken from.
672 pub transformation: Option<Vec<Transformation>>,
673 /// The triggers in the container that this version was taken from.
674 pub trigger: Option<Vec<Trigger>>,
675 /// The variables in the container that this version was taken from.
676 pub variable: Option<Vec<Variable>>,
677 /// The zones in the container that this version was taken from.
678 pub zone: Option<Vec<Zone>>,
679}
680
681impl common::RequestValue for ContainerVersion {}
682impl common::ResponseResult for ContainerVersion {}
683
684/// Represents a Google Tag Manager Container Version Header.
685///
686/// # Activities
687///
688/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
689/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
690///
691/// * [containers version_headers latest accounts](AccountContainerVersionHeaderLatestCall) (response)
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct ContainerVersionHeader {
696 /// GTM Account ID.
697 #[serde(rename = "accountId")]
698 pub account_id: Option<String>,
699 /// GTM Container ID.
700 #[serde(rename = "containerId")]
701 pub container_id: Option<String>,
702 /// The Container Version ID uniquely identifies the GTM Container Version.
703 #[serde(rename = "containerVersionId")]
704 pub container_version_id: Option<String>,
705 /// A value of true indicates this container version has been deleted.
706 pub deleted: Option<bool>,
707 /// Container version display name.
708 pub name: Option<String>,
709 /// Number of clients in the container version.
710 #[serde(rename = "numClients")]
711 pub num_clients: Option<String>,
712 /// Number of custom templates in the container version.
713 #[serde(rename = "numCustomTemplates")]
714 pub num_custom_templates: Option<String>,
715 /// Number of Google tag configs in the container version.
716 #[serde(rename = "numGtagConfigs")]
717 pub num_gtag_configs: Option<String>,
718 /// Number of tags in the container version.
719 #[serde(rename = "numTags")]
720 pub num_tags: Option<String>,
721 /// Number of transformations in the container version.
722 #[serde(rename = "numTransformations")]
723 pub num_transformations: Option<String>,
724 /// Number of triggers in the container version.
725 #[serde(rename = "numTriggers")]
726 pub num_triggers: Option<String>,
727 /// Number of variables in the container version.
728 #[serde(rename = "numVariables")]
729 pub num_variables: Option<String>,
730 /// Number of zones in the container version.
731 #[serde(rename = "numZones")]
732 pub num_zones: Option<String>,
733 /// GTM Container Version's API relative path.
734 pub path: Option<String>,
735}
736
737impl common::ResponseResult for ContainerVersionHeader {}
738
739/// There is no detailed description.
740///
741/// # Activities
742///
743/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
744/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
745///
746/// * [containers workspaces built_in_variables create accounts](AccountContainerWorkspaceBuiltInVariableCreateCall) (response)
747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
748#[serde_with::serde_as]
749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
750pub struct CreateBuiltInVariableResponse {
751 /// List of created built-in variables.
752 #[serde(rename = "builtInVariable")]
753 pub built_in_variable: Option<Vec<BuiltInVariable>>,
754}
755
756impl common::ResponseResult for CreateBuiltInVariableResponse {}
757
758/// Options for new container versions.
759///
760/// # Activities
761///
762/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
763/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
764///
765/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (request)
766#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
767#[serde_with::serde_as]
768#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
769pub struct CreateContainerVersionRequestVersionOptions {
770 /// The name of the container version to be created.
771 pub name: Option<String>,
772 /// The notes of the container version to be created.
773 pub notes: Option<String>,
774}
775
776impl common::RequestValue for CreateContainerVersionRequestVersionOptions {}
777
778/// Create container versions response.
779///
780/// # Activities
781///
782/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
783/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
784///
785/// * [containers workspaces create_version accounts](AccountContainerWorkspaceCreateVersionCall) (response)
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct CreateContainerVersionResponse {
790 /// Compiler errors or not.
791 #[serde(rename = "compilerError")]
792 pub compiler_error: Option<bool>,
793 /// The container version created.
794 #[serde(rename = "containerVersion")]
795 pub container_version: Option<ContainerVersion>,
796 /// 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.
797 #[serde(rename = "newWorkspacePath")]
798 pub new_workspace_path: Option<String>,
799 /// Whether version creation failed when syncing the workspace to the latest container version.
800 #[serde(rename = "syncStatus")]
801 pub sync_status: Option<SyncStatus>,
802}
803
804impl common::ResponseResult for CreateContainerVersionResponse {}
805
806/// Represents a Google Tag Manager Custom Template’s contents.
807///
808/// # Activities
809///
810/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
811/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
812///
813/// * [containers workspaces templates create accounts](AccountContainerWorkspaceTemplateCreateCall) (request|response)
814/// * [containers workspaces templates get accounts](AccountContainerWorkspaceTemplateGetCall) (response)
815/// * [containers workspaces templates import_from_gallery accounts](AccountContainerWorkspaceTemplateImportFromGalleryCall) (response)
816/// * [containers workspaces templates update accounts](AccountContainerWorkspaceTemplateUpdateCall) (request|response)
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct CustomTemplate {
821 /// GTM Account ID.
822 #[serde(rename = "accountId")]
823 pub account_id: Option<String>,
824 /// GTM Container ID.
825 #[serde(rename = "containerId")]
826 pub container_id: Option<String>,
827 /// The fingerprint of the GTM Custom Template as computed at storage time. This value is recomputed whenever the template is modified.
828 pub fingerprint: Option<String>,
829 /// A reference to the Community Template Gallery entry.
830 #[serde(rename = "galleryReference")]
831 pub gallery_reference: Option<GalleryReference>,
832 /// Custom Template display name.
833 pub name: Option<String>,
834 /// GTM Custom Template's API relative path.
835 pub path: Option<String>,
836 /// Auto generated link to the tag manager UI
837 #[serde(rename = "tagManagerUrl")]
838 pub tag_manager_url: Option<String>,
839 /// The custom template in text format.
840 #[serde(rename = "templateData")]
841 pub template_data: Option<String>,
842 /// The Custom Template ID uniquely identifies the GTM custom template.
843 #[serde(rename = "templateId")]
844 pub template_id: Option<String>,
845 /// GTM Workspace ID.
846 #[serde(rename = "workspaceId")]
847 pub workspace_id: Option<String>,
848}
849
850impl common::RequestValue for CustomTemplate {}
851impl common::ResponseResult for CustomTemplate {}
852
853/// Represents a Google Tag Destination.
854///
855/// # Activities
856///
857/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
858/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
859///
860/// * [containers destinations get accounts](AccountContainerDestinationGetCall) (response)
861/// * [containers destinations link accounts](AccountContainerDestinationLinkCall) (response)
862#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
863#[serde_with::serde_as]
864#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
865pub struct Destination {
866 /// GTM Account ID.
867 #[serde(rename = "accountId")]
868 pub account_id: Option<String>,
869 /// GTM Container ID.
870 #[serde(rename = "containerId")]
871 pub container_id: Option<String>,
872 /// Destination ID.
873 #[serde(rename = "destinationId")]
874 pub destination_id: Option<String>,
875 /// The Destination link ID uniquely identifies the Destination.
876 #[serde(rename = "destinationLinkId")]
877 pub destination_link_id: Option<String>,
878 /// The fingerprint of the Google Tag Destination as computed at storage time. This value is recomputed whenever the destination is modified.
879 pub fingerprint: Option<String>,
880 /// Destination display name.
881 pub name: Option<String>,
882 /// Destination's API relative path.
883 pub path: Option<String>,
884 /// Auto generated link to the tag manager UI.
885 #[serde(rename = "tagManagerUrl")]
886 pub tag_manager_url: Option<String>,
887}
888
889impl common::ResponseResult for Destination {}
890
891/// A workspace entity that may represent a tag, trigger, variable, or folder in addition to its status in the workspace.
892///
893/// # Activities
894///
895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
897///
898/// * [containers workspaces resolve_conflict accounts](AccountContainerWorkspaceResolveConflictCall) (request)
899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
900#[serde_with::serde_as]
901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct Entity {
903 /// The built in variable being represented by the entity.
904 #[serde(rename = "builtInVariable")]
905 pub built_in_variable: Option<BuiltInVariable>,
906 /// Represents how the entity has been changed in the workspace.
907 #[serde(rename = "changeStatus")]
908 pub change_status: Option<String>,
909 /// The client being represented by the entity.
910 pub client: Option<Client>,
911 /// The custom template being represented by the entity.
912 #[serde(rename = "customTemplate")]
913 pub custom_template: Option<CustomTemplate>,
914 /// The folder being represented by the entity.
915 pub folder: Option<Folder>,
916 /// The gtag config being represented by the entity.
917 #[serde(rename = "gtagConfig")]
918 pub gtag_config: Option<GtagConfig>,
919 /// The tag being represented by the entity.
920 pub tag: Option<Tag>,
921 /// The transformation being represented by the entity.
922 pub transformation: Option<Transformation>,
923 /// The trigger being represented by the entity.
924 pub trigger: Option<Trigger>,
925 /// The variable being represented by the entity.
926 pub variable: Option<Variable>,
927 /// The zone being represented by the entity.
928 pub zone: Option<Zone>,
929}
930
931impl common::RequestValue for Entity {}
932
933/// 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.
934///
935/// # Activities
936///
937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
939///
940/// * [containers environments create accounts](AccountContainerEnvironmentCreateCall) (request|response)
941/// * [containers environments get accounts](AccountContainerEnvironmentGetCall) (response)
942/// * [containers environments reauthorize accounts](AccountContainerEnvironmentReauthorizeCall) (request|response)
943/// * [containers environments update accounts](AccountContainerEnvironmentUpdateCall) (request|response)
944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
945#[serde_with::serde_as]
946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
947pub struct Environment {
948 /// GTM Account ID.
949 #[serde(rename = "accountId")]
950 pub account_id: Option<String>,
951 /// The environment authorization code.
952 #[serde(rename = "authorizationCode")]
953 pub authorization_code: Option<String>,
954 /// The last update time-stamp for the authorization code.
955 #[serde(rename = "authorizationTimestamp")]
956 pub authorization_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
957 /// GTM Container ID.
958 #[serde(rename = "containerId")]
959 pub container_id: Option<String>,
960 /// Represents a link to a container version.
961 #[serde(rename = "containerVersionId")]
962 pub container_version_id: Option<String>,
963 /// The environment description. Can be set or changed only on USER type environments.
964 pub description: Option<String>,
965 /// Whether or not to enable debug by default for the environment.
966 #[serde(rename = "enableDebug")]
967 pub enable_debug: Option<bool>,
968 /// GTM Environment ID uniquely identifies the GTM Environment.
969 #[serde(rename = "environmentId")]
970 pub environment_id: Option<String>,
971 /// The fingerprint of the GTM environment as computed at storage time. This value is recomputed whenever the environment is modified.
972 pub fingerprint: Option<String>,
973 /// The environment display name. Can be set or changed only on USER type environments.
974 pub name: Option<String>,
975 /// GTM Environment's API relative path.
976 pub path: Option<String>,
977 /// Auto generated link to the tag manager UI
978 #[serde(rename = "tagManagerUrl")]
979 pub tag_manager_url: Option<String>,
980 /// The type of this environment.
981 #[serde(rename = "type")]
982 pub type_: Option<String>,
983 /// Default preview page url for the environment.
984 pub url: Option<String>,
985 /// Represents a link to a quick preview of a workspace.
986 #[serde(rename = "workspaceId")]
987 pub workspace_id: Option<String>,
988}
989
990impl common::RequestValue for Environment {}
991impl common::ResponseResult for Environment {}
992
993/// Represents a Google Tag Manager Folder.
994///
995/// # Activities
996///
997/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
998/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
999///
1000/// * [containers workspaces folders create accounts](AccountContainerWorkspaceFolderCreateCall) (request|response)
1001/// * [containers workspaces folders get accounts](AccountContainerWorkspaceFolderGetCall) (response)
1002/// * [containers workspaces folders move_entities_to_folder accounts](AccountContainerWorkspaceFolderMoveEntitiesToFolderCall) (request)
1003/// * [containers workspaces folders update accounts](AccountContainerWorkspaceFolderUpdateCall) (request|response)
1004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1005#[serde_with::serde_as]
1006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1007pub struct Folder {
1008 /// GTM Account ID.
1009 #[serde(rename = "accountId")]
1010 pub account_id: Option<String>,
1011 /// GTM Container ID.
1012 #[serde(rename = "containerId")]
1013 pub container_id: Option<String>,
1014 /// The fingerprint of the GTM Folder as computed at storage time. This value is recomputed whenever the folder is modified.
1015 pub fingerprint: Option<String>,
1016 /// The Folder ID uniquely identifies the GTM Folder.
1017 #[serde(rename = "folderId")]
1018 pub folder_id: Option<String>,
1019 /// Folder display name.
1020 pub name: Option<String>,
1021 /// User notes on how to apply this folder in the container.
1022 pub notes: Option<String>,
1023 /// GTM Folder's API relative path.
1024 pub path: Option<String>,
1025 /// Auto generated link to the tag manager UI
1026 #[serde(rename = "tagManagerUrl")]
1027 pub tag_manager_url: Option<String>,
1028 /// GTM Workspace ID.
1029 #[serde(rename = "workspaceId")]
1030 pub workspace_id: Option<String>,
1031}
1032
1033impl common::RequestValue for Folder {}
1034impl common::ResponseResult for Folder {}
1035
1036/// Represents a Google Tag Manager Folder’s contents.
1037///
1038/// # Activities
1039///
1040/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1041/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1042///
1043/// * [containers workspaces folders entities accounts](AccountContainerWorkspaceFolderEntityCall) (response)
1044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1045#[serde_with::serde_as]
1046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1047pub struct FolderEntities {
1048 /// Continuation token for fetching the next page of results.
1049 #[serde(rename = "nextPageToken")]
1050 pub next_page_token: Option<String>,
1051 /// The list of tags inside the folder.
1052 pub tag: Option<Vec<Tag>>,
1053 /// The list of triggers inside the folder.
1054 pub trigger: Option<Vec<Trigger>>,
1055 /// The list of variables inside the folder.
1056 pub variable: Option<Vec<Variable>>,
1057}
1058
1059impl common::ResponseResult for FolderEntities {}
1060
1061/// Represents the link between a custom template and an entry on the Community Template Gallery site.
1062///
1063/// This type is not used in any activity, and only used as *part* of another schema.
1064///
1065#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1066#[serde_with::serde_as]
1067#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1068pub struct GalleryReference {
1069 /// ID for the gallery template that is generated once during first sync and travels with the template redirects.
1070 #[serde(rename = "galleryTemplateId")]
1071 pub gallery_template_id: Option<String>,
1072 /// The name of the host for the community gallery template.
1073 pub host: Option<String>,
1074 /// If a user has manually edited the community gallery template.
1075 #[serde(rename = "isModified")]
1076 pub is_modified: Option<bool>,
1077 /// The name of the owner for the community gallery template.
1078 pub owner: Option<String>,
1079 /// The name of the repository for the community gallery template.
1080 pub repository: Option<String>,
1081 /// The signature of the community gallery template as computed at import time. This value is recomputed whenever the template is updated from the gallery.
1082 pub signature: Option<String>,
1083 /// The developer id of the community gallery template. This value is set whenever the template is created from the gallery.
1084 #[serde(rename = "templateDeveloperId")]
1085 pub template_developer_id: Option<String>,
1086 /// The version of the community gallery template.
1087 pub version: Option<String>,
1088}
1089
1090impl common::Part for GalleryReference {}
1091
1092/// There is no detailed description.
1093///
1094/// # Activities
1095///
1096/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1097/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1098///
1099/// * [containers snippet accounts](AccountContainerSnippetCall) (response)
1100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1101#[serde_with::serde_as]
1102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1103pub struct GetContainerSnippetResponse {
1104 /// Server container config param for manually provisioning a tagging server.
1105 #[serde(rename = "containerConfig")]
1106 pub container_config: Option<String>,
1107 /// Tagging snippet for a Container.
1108 pub snippet: Option<String>,
1109}
1110
1111impl common::ResponseResult for GetContainerSnippetResponse {}
1112
1113/// The changes that have occurred in the workspace since the base container version.
1114///
1115/// # Activities
1116///
1117/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1118/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1119///
1120/// * [containers workspaces get status accounts](AccountContainerWorkspaceGetStatuCall) (response)
1121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1122#[serde_with::serde_as]
1123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1124pub struct GetWorkspaceStatusResponse {
1125 /// The merge conflict after sync.
1126 #[serde(rename = "mergeConflict")]
1127 pub merge_conflict: Option<Vec<MergeConflict>>,
1128 /// Entities that have been changed in the workspace.
1129 #[serde(rename = "workspaceChange")]
1130 pub workspace_change: Option<Vec<Entity>>,
1131}
1132
1133impl common::ResponseResult for GetWorkspaceStatusResponse {}
1134
1135/// Represents a Google tag configuration.
1136///
1137/// # Activities
1138///
1139/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1140/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1141///
1142/// * [containers workspaces gtag_config create accounts](AccountContainerWorkspaceGtagConfigCreateCall) (request|response)
1143/// * [containers workspaces gtag_config get accounts](AccountContainerWorkspaceGtagConfigGetCall) (response)
1144/// * [containers workspaces gtag_config update accounts](AccountContainerWorkspaceGtagConfigUpdateCall) (request|response)
1145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1146#[serde_with::serde_as]
1147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1148pub struct GtagConfig {
1149 /// Google tag account ID.
1150 #[serde(rename = "accountId")]
1151 pub account_id: Option<String>,
1152 /// Google tag container ID.
1153 #[serde(rename = "containerId")]
1154 pub container_id: Option<String>,
1155 /// The fingerprint of the Google tag config as computed at storage time. This value is recomputed whenever the config is modified.
1156 pub fingerprint: Option<String>,
1157 /// The ID uniquely identifies the Google tag config.
1158 #[serde(rename = "gtagConfigId")]
1159 pub gtag_config_id: Option<String>,
1160 /// The Google tag config's parameters.
1161 pub parameter: Option<Vec<Parameter>>,
1162 /// Google tag config's API relative path.
1163 pub path: Option<String>,
1164 /// Auto generated link to the tag manager UI
1165 #[serde(rename = "tagManagerUrl")]
1166 pub tag_manager_url: Option<String>,
1167 /// Google tag config type.
1168 #[serde(rename = "type")]
1169 pub type_: Option<String>,
1170 /// Google tag workspace ID. Only used by GTM containers. Set to 0 otherwise.
1171 #[serde(rename = "workspaceId")]
1172 pub workspace_id: Option<String>,
1173}
1174
1175impl common::RequestValue for GtagConfig {}
1176impl common::ResponseResult for GtagConfig {}
1177
1178/// List Accounts Response.
1179///
1180/// # Activities
1181///
1182/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1183/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1184///
1185/// * [list accounts](AccountListCall) (response)
1186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1187#[serde_with::serde_as]
1188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1189pub struct ListAccountsResponse {
1190 /// List of GTM Accounts that a user has access to.
1191 pub account: Option<Vec<Account>>,
1192 /// Continuation token for fetching the next page of results.
1193 #[serde(rename = "nextPageToken")]
1194 pub next_page_token: Option<String>,
1195}
1196
1197impl common::ResponseResult for ListAccountsResponse {}
1198
1199/// There is no detailed description.
1200///
1201/// # Activities
1202///
1203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1205///
1206/// * [containers workspaces clients list accounts](AccountContainerWorkspaceClientListCall) (response)
1207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1208#[serde_with::serde_as]
1209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1210pub struct ListClientsResponse {
1211 /// All GTM Clients of a GTM Container.
1212 pub client: Option<Vec<Client>>,
1213 /// Continuation token for fetching the next page of results.
1214 #[serde(rename = "nextPageToken")]
1215 pub next_page_token: Option<String>,
1216}
1217
1218impl common::ResponseResult for ListClientsResponse {}
1219
1220/// List container versions response.
1221///
1222/// # Activities
1223///
1224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1226///
1227/// * [containers version_headers list accounts](AccountContainerVersionHeaderListCall) (response)
1228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1229#[serde_with::serde_as]
1230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1231pub struct ListContainerVersionsResponse {
1232 /// All container version headers of a GTM Container.
1233 #[serde(rename = "containerVersionHeader")]
1234 pub container_version_header: Option<Vec<ContainerVersionHeader>>,
1235 /// Continuation token for fetching the next page of results.
1236 #[serde(rename = "nextPageToken")]
1237 pub next_page_token: Option<String>,
1238}
1239
1240impl common::ResponseResult for ListContainerVersionsResponse {}
1241
1242/// List Containers Response.
1243///
1244/// # Activities
1245///
1246/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1247/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1248///
1249/// * [containers list accounts](AccountContainerListCall) (response)
1250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1251#[serde_with::serde_as]
1252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1253pub struct ListContainersResponse {
1254 /// All Containers of a GTM Account.
1255 pub container: Option<Vec<Container>>,
1256 /// Continuation token for fetching the next page of results.
1257 #[serde(rename = "nextPageToken")]
1258 pub next_page_token: Option<String>,
1259}
1260
1261impl common::ResponseResult for ListContainersResponse {}
1262
1263/// There is no detailed description.
1264///
1265/// # Activities
1266///
1267/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1268/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1269///
1270/// * [containers destinations list accounts](AccountContainerDestinationListCall) (response)
1271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1272#[serde_with::serde_as]
1273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1274pub struct ListDestinationsResponse {
1275 /// All Destinations linked to a GTM Container.
1276 pub destination: Option<Vec<Destination>>,
1277 /// Continuation token for fetching the next page of results.
1278 #[serde(rename = "nextPageToken")]
1279 pub next_page_token: Option<String>,
1280}
1281
1282impl common::ResponseResult for ListDestinationsResponse {}
1283
1284/// A list of enabled built-in variables.
1285///
1286/// # Activities
1287///
1288/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1289/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1290///
1291/// * [containers workspaces built_in_variables list accounts](AccountContainerWorkspaceBuiltInVariableListCall) (response)
1292#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1293#[serde_with::serde_as]
1294#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1295pub struct ListEnabledBuiltInVariablesResponse {
1296 /// All GTM BuiltInVariables of a GTM container.
1297 #[serde(rename = "builtInVariable")]
1298 pub built_in_variable: Option<Vec<BuiltInVariable>>,
1299 /// Continuation token for fetching the next page of results.
1300 #[serde(rename = "nextPageToken")]
1301 pub next_page_token: Option<String>,
1302}
1303
1304impl common::ResponseResult for ListEnabledBuiltInVariablesResponse {}
1305
1306/// List Environments Response.
1307///
1308/// # Activities
1309///
1310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1312///
1313/// * [containers environments list accounts](AccountContainerEnvironmentListCall) (response)
1314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1315#[serde_with::serde_as]
1316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1317pub struct ListEnvironmentsResponse {
1318 /// All Environments of a GTM Container.
1319 pub environment: Option<Vec<Environment>>,
1320 /// Continuation token for fetching the next page of results.
1321 #[serde(rename = "nextPageToken")]
1322 pub next_page_token: Option<String>,
1323}
1324
1325impl common::ResponseResult for ListEnvironmentsResponse {}
1326
1327/// List Folders Response.
1328///
1329/// # Activities
1330///
1331/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1332/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1333///
1334/// * [containers workspaces folders list accounts](AccountContainerWorkspaceFolderListCall) (response)
1335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1336#[serde_with::serde_as]
1337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1338pub struct ListFoldersResponse {
1339 /// All GTM Folders of a GTM Container.
1340 pub folder: Option<Vec<Folder>>,
1341 /// Continuation token for fetching the next page of results.
1342 #[serde(rename = "nextPageToken")]
1343 pub next_page_token: Option<String>,
1344}
1345
1346impl common::ResponseResult for ListFoldersResponse {}
1347
1348/// There is no detailed description.
1349///
1350/// # Activities
1351///
1352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1354///
1355/// * [containers workspaces gtag_config list accounts](AccountContainerWorkspaceGtagConfigListCall) (response)
1356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1357#[serde_with::serde_as]
1358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1359pub struct ListGtagConfigResponse {
1360 /// All Google tag configs in a Container.
1361 #[serde(rename = "gtagConfig")]
1362 pub gtag_config: Option<Vec<GtagConfig>>,
1363 /// Continuation token for fetching the next page of results.
1364 #[serde(rename = "nextPageToken")]
1365 pub next_page_token: Option<String>,
1366}
1367
1368impl common::ResponseResult for ListGtagConfigResponse {}
1369
1370/// List Tags Response.
1371///
1372/// # Activities
1373///
1374/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1375/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1376///
1377/// * [containers workspaces tags list accounts](AccountContainerWorkspaceTagListCall) (response)
1378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1379#[serde_with::serde_as]
1380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1381pub struct ListTagsResponse {
1382 /// Continuation token for fetching the next page of results.
1383 #[serde(rename = "nextPageToken")]
1384 pub next_page_token: Option<String>,
1385 /// All GTM Tags of a GTM Container.
1386 pub tag: Option<Vec<Tag>>,
1387}
1388
1389impl common::ResponseResult for ListTagsResponse {}
1390
1391/// There is no detailed description.
1392///
1393/// # Activities
1394///
1395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1397///
1398/// * [containers workspaces templates list accounts](AccountContainerWorkspaceTemplateListCall) (response)
1399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1400#[serde_with::serde_as]
1401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1402pub struct ListTemplatesResponse {
1403 /// Continuation token for fetching the next page of results.
1404 #[serde(rename = "nextPageToken")]
1405 pub next_page_token: Option<String>,
1406 /// All GTM Custom Templates of a GTM Container.
1407 pub template: Option<Vec<CustomTemplate>>,
1408}
1409
1410impl common::ResponseResult for ListTemplatesResponse {}
1411
1412/// There is no detailed description.
1413///
1414/// # Activities
1415///
1416/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1417/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1418///
1419/// * [containers workspaces transformations list accounts](AccountContainerWorkspaceTransformationListCall) (response)
1420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1421#[serde_with::serde_as]
1422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1423pub struct ListTransformationsResponse {
1424 /// Continuation token for fetching the next page of results.
1425 #[serde(rename = "nextPageToken")]
1426 pub next_page_token: Option<String>,
1427 /// All GTM Transformations of a GTM Container.
1428 pub transformation: Option<Vec<Transformation>>,
1429}
1430
1431impl common::ResponseResult for ListTransformationsResponse {}
1432
1433/// List triggers response.
1434///
1435/// # Activities
1436///
1437/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1438/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1439///
1440/// * [containers workspaces triggers list accounts](AccountContainerWorkspaceTriggerListCall) (response)
1441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1442#[serde_with::serde_as]
1443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1444pub struct ListTriggersResponse {
1445 /// Continuation token for fetching the next page of results.
1446 #[serde(rename = "nextPageToken")]
1447 pub next_page_token: Option<String>,
1448 /// All GTM Triggers of a GTM Container.
1449 pub trigger: Option<Vec<Trigger>>,
1450}
1451
1452impl common::ResponseResult for ListTriggersResponse {}
1453
1454/// List user permissions response.
1455///
1456/// # Activities
1457///
1458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1460///
1461/// * [user_permissions list accounts](AccountUserPermissionListCall) (response)
1462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1463#[serde_with::serde_as]
1464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1465pub struct ListUserPermissionsResponse {
1466 /// Continuation token for fetching the next page of results.
1467 #[serde(rename = "nextPageToken")]
1468 pub next_page_token: Option<String>,
1469 /// All GTM UserPermissions of a GTM Account.
1470 #[serde(rename = "userPermission")]
1471 pub user_permission: Option<Vec<UserPermission>>,
1472}
1473
1474impl common::ResponseResult for ListUserPermissionsResponse {}
1475
1476/// List Variables Response.
1477///
1478/// # Activities
1479///
1480/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1481/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1482///
1483/// * [containers workspaces variables list accounts](AccountContainerWorkspaceVariableListCall) (response)
1484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1485#[serde_with::serde_as]
1486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct ListVariablesResponse {
1488 /// Continuation token for fetching the next page of results.
1489 #[serde(rename = "nextPageToken")]
1490 pub next_page_token: Option<String>,
1491 /// All GTM Variables of a GTM Container.
1492 pub variable: Option<Vec<Variable>>,
1493}
1494
1495impl common::ResponseResult for ListVariablesResponse {}
1496
1497/// A list of workspaces in a container.
1498///
1499/// # Activities
1500///
1501/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1502/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1503///
1504/// * [containers workspaces list accounts](AccountContainerWorkspaceListCall) (response)
1505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1506#[serde_with::serde_as]
1507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1508pub struct ListWorkspacesResponse {
1509 /// Continuation token for fetching the next page of results.
1510 #[serde(rename = "nextPageToken")]
1511 pub next_page_token: Option<String>,
1512 /// All Workspaces of a GTM Container.
1513 pub workspace: Option<Vec<Workspace>>,
1514}
1515
1516impl common::ResponseResult for ListWorkspacesResponse {}
1517
1518/// There is no detailed description.
1519///
1520/// # Activities
1521///
1522/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1523/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1524///
1525/// * [containers workspaces zones list accounts](AccountContainerWorkspaceZoneListCall) (response)
1526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1527#[serde_with::serde_as]
1528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1529pub struct ListZonesResponse {
1530 /// Continuation token for fetching the next page of results.
1531 #[serde(rename = "nextPageToken")]
1532 pub next_page_token: Option<String>,
1533 /// All GTM Zones of a GTM Container.
1534 pub zone: Option<Vec<Zone>>,
1535}
1536
1537impl common::ResponseResult for ListZonesResponse {}
1538
1539/// Represents a merge conflict.
1540///
1541/// This type is not used in any activity, and only used as *part* of another schema.
1542///
1543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1544#[serde_with::serde_as]
1545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1546pub struct MergeConflict {
1547 /// 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.
1548 #[serde(rename = "entityInBaseVersion")]
1549 pub entity_in_base_version: Option<Entity>,
1550 /// 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.
1551 #[serde(rename = "entityInWorkspace")]
1552 pub entity_in_workspace: Option<Entity>,
1553}
1554
1555impl common::Part for MergeConflict {}
1556
1557/// Represents a Google Tag Manager Parameter.
1558///
1559/// This type is not used in any activity, and only used as *part* of another schema.
1560///
1561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1562#[serde_with::serde_as]
1563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1564pub struct Parameter {
1565 /// Whether or not a reference type parameter is strongly or weakly referenced. Only used by Transformations.
1566 #[serde(rename = "isWeakReference")]
1567 pub is_weak_reference: Option<bool>,
1568 /// The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values.
1569 pub key: Option<String>,
1570 /// This list parameter's parameters (keys will be ignored).
1571 pub list: Option<Vec<Parameter>>,
1572 /// This map parameter's parameters (must have keys; keys must be unique).
1573 pub map: Option<Vec<Parameter>>,
1574 /// 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
1575 #[serde(rename = "type")]
1576 pub type_: Option<String>,
1577 /// A parameter's value (may contain variable references). as appropriate to the specified type.
1578 pub value: Option<String>,
1579}
1580
1581impl common::Part for Parameter {}
1582
1583/// There is no detailed description.
1584///
1585/// # Activities
1586///
1587/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1588/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1589///
1590/// * [containers workspaces bulk_update accounts](AccountContainerWorkspaceBulkUpdateCall) (request)
1591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1592#[serde_with::serde_as]
1593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1594pub struct ProposedChange {
1595 /// The list of workspace changes to be applied.
1596 pub changes: Option<Vec<Entity>>,
1597}
1598
1599impl common::RequestValue for ProposedChange {}
1600
1601/// Publish container version response.
1602///
1603/// # Activities
1604///
1605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1607///
1608/// * [containers versions publish accounts](AccountContainerVersionPublishCall) (response)
1609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1610#[serde_with::serde_as]
1611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1612pub struct PublishContainerVersionResponse {
1613 /// Compiler errors or not.
1614 #[serde(rename = "compilerError")]
1615 pub compiler_error: Option<bool>,
1616 /// The container version created.
1617 #[serde(rename = "containerVersion")]
1618 pub container_version: Option<ContainerVersion>,
1619}
1620
1621impl common::ResponseResult for PublishContainerVersionResponse {}
1622
1623/// Response to quick previewing a workspace.
1624///
1625/// # Activities
1626///
1627/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1628/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1629///
1630/// * [containers workspaces quick_preview accounts](AccountContainerWorkspaceQuickPreviewCall) (response)
1631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1632#[serde_with::serde_as]
1633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1634pub struct QuickPreviewResponse {
1635 /// Were there compiler errors or not.
1636 #[serde(rename = "compilerError")]
1637 pub compiler_error: Option<bool>,
1638 /// The quick previewed container version.
1639 #[serde(rename = "containerVersion")]
1640 pub container_version: Option<ContainerVersion>,
1641 /// Whether quick previewing failed when syncing the workspace to the latest container version.
1642 #[serde(rename = "syncStatus")]
1643 pub sync_status: Option<SyncStatus>,
1644}
1645
1646impl common::ResponseResult for QuickPreviewResponse {}
1647
1648/// The result of reverting a built-in variable in a workspace.
1649///
1650/// # Activities
1651///
1652/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1653/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1654///
1655/// * [containers workspaces built_in_variables revert accounts](AccountContainerWorkspaceBuiltInVariableRevertCall) (response)
1656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1657#[serde_with::serde_as]
1658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1659pub struct RevertBuiltInVariableResponse {
1660 /// Whether the built-in variable is enabled after reversion.
1661 pub enabled: Option<bool>,
1662}
1663
1664impl common::ResponseResult for RevertBuiltInVariableResponse {}
1665
1666/// The result of reverting a client in a workspace.
1667///
1668/// # Activities
1669///
1670/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1671/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1672///
1673/// * [containers workspaces clients revert accounts](AccountContainerWorkspaceClientRevertCall) (response)
1674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1675#[serde_with::serde_as]
1676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1677pub struct RevertClientResponse {
1678 /// 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.
1679 pub client: Option<Client>,
1680}
1681
1682impl common::ResponseResult for RevertClientResponse {}
1683
1684/// The result of reverting folder changes in a workspace.
1685///
1686/// # Activities
1687///
1688/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1689/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1690///
1691/// * [containers workspaces folders revert accounts](AccountContainerWorkspaceFolderRevertCall) (response)
1692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1693#[serde_with::serde_as]
1694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1695pub struct RevertFolderResponse {
1696 /// 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.
1697 pub folder: Option<Folder>,
1698}
1699
1700impl common::ResponseResult for RevertFolderResponse {}
1701
1702/// The result of reverting a tag in a workspace.
1703///
1704/// # Activities
1705///
1706/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1707/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1708///
1709/// * [containers workspaces tags revert accounts](AccountContainerWorkspaceTagRevertCall) (response)
1710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1711#[serde_with::serde_as]
1712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1713pub struct RevertTagResponse {
1714 /// 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.
1715 pub tag: Option<Tag>,
1716}
1717
1718impl common::ResponseResult for RevertTagResponse {}
1719
1720/// The result of reverting a template in a workspace.
1721///
1722/// # Activities
1723///
1724/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1725/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1726///
1727/// * [containers workspaces templates revert accounts](AccountContainerWorkspaceTemplateRevertCall) (response)
1728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1729#[serde_with::serde_as]
1730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1731pub struct RevertTemplateResponse {
1732 /// 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.
1733 pub template: Option<CustomTemplate>,
1734}
1735
1736impl common::ResponseResult for RevertTemplateResponse {}
1737
1738/// The result of reverting a transformation in a workspace.
1739///
1740/// # Activities
1741///
1742/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1743/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1744///
1745/// * [containers workspaces transformations revert accounts](AccountContainerWorkspaceTransformationRevertCall) (response)
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct RevertTransformationResponse {
1750 /// 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.
1751 pub transformation: Option<Transformation>,
1752}
1753
1754impl common::ResponseResult for RevertTransformationResponse {}
1755
1756/// The result of reverting a trigger in a workspace.
1757///
1758/// # Activities
1759///
1760/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1761/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1762///
1763/// * [containers workspaces triggers revert accounts](AccountContainerWorkspaceTriggerRevertCall) (response)
1764#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1765#[serde_with::serde_as]
1766#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1767pub struct RevertTriggerResponse {
1768 /// 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.
1769 pub trigger: Option<Trigger>,
1770}
1771
1772impl common::ResponseResult for RevertTriggerResponse {}
1773
1774/// The result of reverting a variable in a workspace.
1775///
1776/// # Activities
1777///
1778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1780///
1781/// * [containers workspaces variables revert accounts](AccountContainerWorkspaceVariableRevertCall) (response)
1782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1783#[serde_with::serde_as]
1784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1785pub struct RevertVariableResponse {
1786 /// 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.
1787 pub variable: Option<Variable>,
1788}
1789
1790impl common::ResponseResult for RevertVariableResponse {}
1791
1792/// The result of reverting a zone in a workspace.
1793///
1794/// # Activities
1795///
1796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1798///
1799/// * [containers workspaces zones revert accounts](AccountContainerWorkspaceZoneRevertCall) (response)
1800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1801#[serde_with::serde_as]
1802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1803pub struct RevertZoneResponse {
1804 /// 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.
1805 pub zone: Option<Zone>,
1806}
1807
1808impl common::ResponseResult for RevertZoneResponse {}
1809
1810/// Represents a reference to atag that fires before another tag in order to set up dependencies.
1811///
1812/// This type is not used in any activity, and only used as *part* of another schema.
1813///
1814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1815#[serde_with::serde_as]
1816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1817pub struct SetupTag {
1818 /// 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.
1819 #[serde(rename = "stopOnSetupFailure")]
1820 pub stop_on_setup_failure: Option<bool>,
1821 /// The name of the setup tag.
1822 #[serde(rename = "tagName")]
1823 pub tag_name: Option<String>,
1824}
1825
1826impl common::Part for SetupTag {}
1827
1828/// The status of a workspace after synchronization.
1829///
1830/// This type is not used in any activity, and only used as *part* of another schema.
1831///
1832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1833#[serde_with::serde_as]
1834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1835pub struct SyncStatus {
1836 /// Synchornization operation detected a merge conflict.
1837 #[serde(rename = "mergeConflict")]
1838 pub merge_conflict: Option<bool>,
1839 /// An error occurred during the synchronization operation.
1840 #[serde(rename = "syncError")]
1841 pub sync_error: Option<bool>,
1842}
1843
1844impl common::Part for SyncStatus {}
1845
1846/// A response after synchronizing the workspace to the latest container version.
1847///
1848/// # Activities
1849///
1850/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1851/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1852///
1853/// * [containers workspaces sync accounts](AccountContainerWorkspaceSyncCall) (response)
1854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1855#[serde_with::serde_as]
1856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1857pub struct SyncWorkspaceResponse {
1858 /// 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.
1859 #[serde(rename = "mergeConflict")]
1860 pub merge_conflict: Option<Vec<MergeConflict>>,
1861 /// Indicates whether synchronization caused a merge conflict or sync error.
1862 #[serde(rename = "syncStatus")]
1863 pub sync_status: Option<SyncStatus>,
1864}
1865
1866impl common::ResponseResult for SyncWorkspaceResponse {}
1867
1868/// Represents a Google Tag Manager Tag.
1869///
1870/// # Activities
1871///
1872/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1873/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1874///
1875/// * [containers workspaces tags create accounts](AccountContainerWorkspaceTagCreateCall) (request|response)
1876/// * [containers workspaces tags get accounts](AccountContainerWorkspaceTagGetCall) (response)
1877/// * [containers workspaces tags update accounts](AccountContainerWorkspaceTagUpdateCall) (request|response)
1878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1879#[serde_with::serde_as]
1880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1881pub struct Tag {
1882 /// GTM Account ID.
1883 #[serde(rename = "accountId")]
1884 pub account_id: Option<String>,
1885 /// Blocking trigger IDs. If any of the listed triggers evaluate to true, the tag will not fire.
1886 #[serde(rename = "blockingTriggerId")]
1887 pub blocking_trigger_id: Option<Vec<String>>,
1888 /// Consent settings of a tag.
1889 #[serde(rename = "consentSettings")]
1890 pub consent_settings: Option<TagConsentSetting>,
1891 /// GTM Container ID.
1892 #[serde(rename = "containerId")]
1893 pub container_id: Option<String>,
1894 /// The fingerprint of the GTM Tag as computed at storage time. This value is recomputed whenever the tag is modified.
1895 pub fingerprint: Option<String>,
1896 /// 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.
1897 #[serde(rename = "firingTriggerId")]
1898 pub firing_trigger_id: Option<Vec<String>>,
1899 /// If set to true, this tag will only fire in the live environment (e.g. not in preview or debug mode).
1900 #[serde(rename = "liveOnly")]
1901 pub live_only: Option<bool>,
1902 /// 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.
1903 #[serde(rename = "monitoringMetadata")]
1904 pub monitoring_metadata: Option<Parameter>,
1905 /// If non-empty, then the tag display name will be included in the monitoring metadata map using the key specified.
1906 #[serde(rename = "monitoringMetadataTagNameKey")]
1907 pub monitoring_metadata_tag_name_key: Option<String>,
1908 /// Tag display name.
1909 pub name: Option<String>,
1910 /// User notes on how to apply this tag in the container.
1911 pub notes: Option<String>,
1912 /// The tag's parameters.
1913 pub parameter: Option<Vec<Parameter>>,
1914 /// Parent folder id.
1915 #[serde(rename = "parentFolderId")]
1916 pub parent_folder_id: Option<String>,
1917 /// GTM Tag's API relative path.
1918 pub path: Option<String>,
1919 /// Indicates whether the tag is paused, which prevents the tag from firing.
1920 pub paused: Option<bool>,
1921 /// 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.
1922 pub priority: Option<Parameter>,
1923 /// The end timestamp in milliseconds to schedule a tag.
1924 #[serde(rename = "scheduleEndMs")]
1925 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1926 pub schedule_end_ms: Option<i64>,
1927 /// The start timestamp in milliseconds to schedule a tag.
1928 #[serde(rename = "scheduleStartMs")]
1929 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1930 pub schedule_start_ms: Option<i64>,
1931 /// The list of setup tags. Currently we only allow one.
1932 #[serde(rename = "setupTag")]
1933 pub setup_tag: Option<Vec<SetupTag>>,
1934 /// Option to fire this tag.
1935 #[serde(rename = "tagFiringOption")]
1936 pub tag_firing_option: Option<String>,
1937 /// The Tag ID uniquely identifies the GTM Tag.
1938 #[serde(rename = "tagId")]
1939 pub tag_id: Option<String>,
1940 /// Auto generated link to the tag manager UI
1941 #[serde(rename = "tagManagerUrl")]
1942 pub tag_manager_url: Option<String>,
1943 /// The list of teardown tags. Currently we only allow one.
1944 #[serde(rename = "teardownTag")]
1945 pub teardown_tag: Option<Vec<TeardownTag>>,
1946 /// GTM Tag Type.
1947 #[serde(rename = "type")]
1948 pub type_: Option<String>,
1949 /// GTM Workspace ID.
1950 #[serde(rename = "workspaceId")]
1951 pub workspace_id: Option<String>,
1952}
1953
1954impl common::RequestValue for Tag {}
1955impl common::ResponseResult for Tag {}
1956
1957/// There is no detailed description.
1958///
1959/// This type is not used in any activity, and only used as *part* of another schema.
1960///
1961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1962#[serde_with::serde_as]
1963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1964pub struct TagConsentSetting {
1965 /// 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.
1966 #[serde(rename = "consentStatus")]
1967 pub consent_status: Option<String>,
1968 /// 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.
1969 #[serde(rename = "consentType")]
1970 pub consent_type: Option<Parameter>,
1971}
1972
1973impl common::Part for TagConsentSetting {}
1974
1975/// Represents a tag that fires after another tag in order to tear down dependencies.
1976///
1977/// This type is not used in any activity, and only used as *part* of another schema.
1978///
1979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1980#[serde_with::serde_as]
1981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1982pub struct TeardownTag {
1983 /// 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.
1984 #[serde(rename = "stopTeardownOnFailure")]
1985 pub stop_teardown_on_failure: Option<bool>,
1986 /// The name of the teardown tag.
1987 #[serde(rename = "tagName")]
1988 pub tag_name: Option<String>,
1989}
1990
1991impl common::Part for TeardownTag {}
1992
1993/// Represents a Google Tag Manager Transformation.
1994///
1995/// # Activities
1996///
1997/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1998/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1999///
2000/// * [containers workspaces transformations create accounts](AccountContainerWorkspaceTransformationCreateCall) (request|response)
2001/// * [containers workspaces transformations get accounts](AccountContainerWorkspaceTransformationGetCall) (response)
2002/// * [containers workspaces transformations update accounts](AccountContainerWorkspaceTransformationUpdateCall) (request|response)
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct Transformation {
2007 /// GTM Account ID.
2008 #[serde(rename = "accountId")]
2009 pub account_id: Option<String>,
2010 /// GTM Container ID.
2011 #[serde(rename = "containerId")]
2012 pub container_id: Option<String>,
2013 /// The fingerprint of the GTM Transformation as computed at storage time. This value is recomputed whenever the transformation is modified.
2014 pub fingerprint: Option<String>,
2015 /// Transformation display name.
2016 pub name: Option<String>,
2017 /// User notes on how to apply this transformation in the container.
2018 pub notes: Option<String>,
2019 /// The transformation's parameters.
2020 pub parameter: Option<Vec<Parameter>>,
2021 /// Parent folder id.
2022 #[serde(rename = "parentFolderId")]
2023 pub parent_folder_id: Option<String>,
2024 /// GTM transformation's API relative path.
2025 pub path: Option<String>,
2026 /// Auto generated link to the tag manager UI
2027 #[serde(rename = "tagManagerUrl")]
2028 pub tag_manager_url: Option<String>,
2029 /// The Transformation ID uniquely identifies the GTM transformation.
2030 #[serde(rename = "transformationId")]
2031 pub transformation_id: Option<String>,
2032 /// Transformation type.
2033 #[serde(rename = "type")]
2034 pub type_: Option<String>,
2035 /// GTM Workspace ID.
2036 #[serde(rename = "workspaceId")]
2037 pub workspace_id: Option<String>,
2038}
2039
2040impl common::RequestValue for Transformation {}
2041impl common::ResponseResult for Transformation {}
2042
2043/// Represents a Google Tag Manager Trigger
2044///
2045/// # Activities
2046///
2047/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2048/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2049///
2050/// * [containers workspaces triggers create accounts](AccountContainerWorkspaceTriggerCreateCall) (request|response)
2051/// * [containers workspaces triggers get accounts](AccountContainerWorkspaceTriggerGetCall) (response)
2052/// * [containers workspaces triggers update accounts](AccountContainerWorkspaceTriggerUpdateCall) (request|response)
2053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2054#[serde_with::serde_as]
2055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2056pub struct Trigger {
2057 /// GTM Account ID.
2058 #[serde(rename = "accountId")]
2059 pub account_id: Option<String>,
2060 /// Used in the case of auto event tracking.
2061 #[serde(rename = "autoEventFilter")]
2062 pub auto_event_filter: Option<Vec<Condition>>,
2063 /// 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.
2064 #[serde(rename = "checkValidation")]
2065 pub check_validation: Option<Parameter>,
2066 /// GTM Container ID.
2067 #[serde(rename = "containerId")]
2068 pub container_id: Option<String>,
2069 /// A visibility trigger minimum continuous visible time (in milliseconds). Only valid for AMP Visibility trigger.
2070 #[serde(rename = "continuousTimeMinMilliseconds")]
2071 pub continuous_time_min_milliseconds: Option<Parameter>,
2072 /// Used in the case of custom event, which is fired iff all Conditions are true.
2073 #[serde(rename = "customEventFilter")]
2074 pub custom_event_filter: Option<Vec<Condition>>,
2075 /// Name of the GTM event that is fired. Only valid for Timer triggers.
2076 #[serde(rename = "eventName")]
2077 pub event_name: Option<Parameter>,
2078 /// The trigger will only fire iff all Conditions are true.
2079 pub filter: Option<Vec<Condition>>,
2080 /// The fingerprint of the GTM Trigger as computed at storage time. This value is recomputed whenever the trigger is modified.
2081 pub fingerprint: Option<String>,
2082 /// 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.
2083 #[serde(rename = "horizontalScrollPercentageList")]
2084 pub horizontal_scroll_percentage_list: Option<Parameter>,
2085 /// Time between triggering recurring Timer Events (in milliseconds). Only valid for Timer triggers.
2086 pub interval: Option<Parameter>,
2087 /// Time between Timer Events to fire (in seconds). Only valid for AMP Timer trigger.
2088 #[serde(rename = "intervalSeconds")]
2089 pub interval_seconds: Option<Parameter>,
2090 /// 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.
2091 pub limit: Option<Parameter>,
2092 /// Max time to fire Timer Events (in seconds). Only valid for AMP Timer trigger.
2093 #[serde(rename = "maxTimerLengthSeconds")]
2094 pub max_timer_length_seconds: Option<Parameter>,
2095 /// Trigger display name.
2096 pub name: Option<String>,
2097 /// User notes on how to apply this trigger in the container.
2098 pub notes: Option<String>,
2099 /// Additional parameters.
2100 pub parameter: Option<Vec<Parameter>>,
2101 /// Parent folder id.
2102 #[serde(rename = "parentFolderId")]
2103 pub parent_folder_id: Option<String>,
2104 /// GTM Trigger's API relative path.
2105 pub path: Option<String>,
2106 /// A click trigger CSS selector (i.e. "a", "button" etc.). Only valid for AMP Click trigger.
2107 pub selector: Option<Parameter>,
2108 /// Auto generated link to the tag manager UI
2109 #[serde(rename = "tagManagerUrl")]
2110 pub tag_manager_url: Option<String>,
2111 /// A visibility trigger minimum total visible time (in milliseconds). Only valid for AMP Visibility trigger.
2112 #[serde(rename = "totalTimeMinMilliseconds")]
2113 pub total_time_min_milliseconds: Option<Parameter>,
2114 /// The Trigger ID uniquely identifies the GTM Trigger.
2115 #[serde(rename = "triggerId")]
2116 pub trigger_id: Option<String>,
2117 /// Defines the data layer event that causes this trigger.
2118 #[serde(rename = "type")]
2119 pub type_: Option<String>,
2120 /// 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.
2121 #[serde(rename = "uniqueTriggerId")]
2122 pub unique_trigger_id: Option<Parameter>,
2123 /// 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.
2124 #[serde(rename = "verticalScrollPercentageList")]
2125 pub vertical_scroll_percentage_list: Option<Parameter>,
2126 /// A visibility trigger CSS selector (i.e. "#id"). Only valid for AMP Visibility trigger.
2127 #[serde(rename = "visibilitySelector")]
2128 pub visibility_selector: Option<Parameter>,
2129 /// A visibility trigger maximum percent visibility. Only valid for AMP Visibility trigger.
2130 #[serde(rename = "visiblePercentageMax")]
2131 pub visible_percentage_max: Option<Parameter>,
2132 /// A visibility trigger minimum percent visibility. Only valid for AMP Visibility trigger.
2133 #[serde(rename = "visiblePercentageMin")]
2134 pub visible_percentage_min: Option<Parameter>,
2135 /// 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.
2136 #[serde(rename = "waitForTags")]
2137 pub wait_for_tags: Option<Parameter>,
2138 /// 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.
2139 #[serde(rename = "waitForTagsTimeout")]
2140 pub wait_for_tags_timeout: Option<Parameter>,
2141 /// GTM Workspace ID.
2142 #[serde(rename = "workspaceId")]
2143 pub workspace_id: Option<String>,
2144}
2145
2146impl common::RequestValue for Trigger {}
2147impl common::ResponseResult for Trigger {}
2148
2149/// Represents a user’s permissions to an account and its container.
2150///
2151/// # Activities
2152///
2153/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2154/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2155///
2156/// * [user_permissions create accounts](AccountUserPermissionCreateCall) (request|response)
2157/// * [user_permissions get accounts](AccountUserPermissionGetCall) (response)
2158/// * [user_permissions update accounts](AccountUserPermissionUpdateCall) (request|response)
2159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2160#[serde_with::serde_as]
2161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2162pub struct UserPermission {
2163 /// GTM Account access permissions.
2164 #[serde(rename = "accountAccess")]
2165 pub account_access: Option<AccountAccess>,
2166 /// The Account ID uniquely identifies the GTM Account.
2167 #[serde(rename = "accountId")]
2168 pub account_id: Option<String>,
2169 /// GTM Container access permissions.
2170 #[serde(rename = "containerAccess")]
2171 pub container_access: Option<Vec<ContainerAccess>>,
2172 /// User's email address.
2173 #[serde(rename = "emailAddress")]
2174 pub email_address: Option<String>,
2175 /// GTM UserPermission's API relative path.
2176 pub path: Option<String>,
2177}
2178
2179impl common::RequestValue for UserPermission {}
2180impl common::ResponseResult for UserPermission {}
2181
2182/// Represents a Google Tag Manager Variable.
2183///
2184/// # Activities
2185///
2186/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2187/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2188///
2189/// * [containers workspaces variables create accounts](AccountContainerWorkspaceVariableCreateCall) (request|response)
2190/// * [containers workspaces variables get accounts](AccountContainerWorkspaceVariableGetCall) (response)
2191/// * [containers workspaces variables update accounts](AccountContainerWorkspaceVariableUpdateCall) (request|response)
2192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2193#[serde_with::serde_as]
2194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2195pub struct Variable {
2196 /// GTM Account ID.
2197 #[serde(rename = "accountId")]
2198 pub account_id: Option<String>,
2199 /// GTM Container ID.
2200 #[serde(rename = "containerId")]
2201 pub container_id: Option<String>,
2202 /// 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.
2203 #[serde(rename = "disablingTriggerId")]
2204 pub disabling_trigger_id: Option<Vec<String>>,
2205 /// 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.
2206 #[serde(rename = "enablingTriggerId")]
2207 pub enabling_trigger_id: Option<Vec<String>>,
2208 /// The fingerprint of the GTM Variable as computed at storage time. This value is recomputed whenever the variable is modified.
2209 pub fingerprint: Option<String>,
2210 /// Option to convert a variable value to other value.
2211 #[serde(rename = "formatValue")]
2212 pub format_value: Option<VariableFormatValue>,
2213 /// Variable display name.
2214 pub name: Option<String>,
2215 /// User notes on how to apply this variable in the container.
2216 pub notes: Option<String>,
2217 /// The variable's parameters.
2218 pub parameter: Option<Vec<Parameter>>,
2219 /// Parent folder id.
2220 #[serde(rename = "parentFolderId")]
2221 pub parent_folder_id: Option<String>,
2222 /// GTM Variable's API relative path.
2223 pub path: Option<String>,
2224 /// The end timestamp in milliseconds to schedule a variable.
2225 #[serde(rename = "scheduleEndMs")]
2226 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2227 pub schedule_end_ms: Option<i64>,
2228 /// The start timestamp in milliseconds to schedule a variable.
2229 #[serde(rename = "scheduleStartMs")]
2230 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2231 pub schedule_start_ms: Option<i64>,
2232 /// Auto generated link to the tag manager UI
2233 #[serde(rename = "tagManagerUrl")]
2234 pub tag_manager_url: Option<String>,
2235 /// GTM Variable Type.
2236 #[serde(rename = "type")]
2237 pub type_: Option<String>,
2238 /// The Variable ID uniquely identifies the GTM Variable.
2239 #[serde(rename = "variableId")]
2240 pub variable_id: Option<String>,
2241 /// GTM Workspace ID.
2242 #[serde(rename = "workspaceId")]
2243 pub workspace_id: Option<String>,
2244}
2245
2246impl common::RequestValue for Variable {}
2247impl common::ResponseResult for Variable {}
2248
2249/// There is no detailed description.
2250///
2251/// This type is not used in any activity, and only used as *part* of another schema.
2252///
2253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2254#[serde_with::serde_as]
2255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2256pub struct VariableFormatValue {
2257 /// The option to convert a string-type variable value to either lowercase or uppercase.
2258 #[serde(rename = "caseConversionType")]
2259 pub case_conversion_type: Option<String>,
2260 /// The value to convert if a variable value is false.
2261 #[serde(rename = "convertFalseToValue")]
2262 pub convert_false_to_value: Option<Parameter>,
2263 /// The value to convert if a variable value is null.
2264 #[serde(rename = "convertNullToValue")]
2265 pub convert_null_to_value: Option<Parameter>,
2266 /// The value to convert if a variable value is true.
2267 #[serde(rename = "convertTrueToValue")]
2268 pub convert_true_to_value: Option<Parameter>,
2269 /// The value to convert if a variable value is undefined.
2270 #[serde(rename = "convertUndefinedToValue")]
2271 pub convert_undefined_to_value: Option<Parameter>,
2272}
2273
2274impl common::Part for VariableFormatValue {}
2275
2276/// Represents a Google Tag Manager Container Workspace.
2277///
2278/// # Activities
2279///
2280/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2281/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2282///
2283/// * [containers workspaces create accounts](AccountContainerWorkspaceCreateCall) (request|response)
2284/// * [containers workspaces get accounts](AccountContainerWorkspaceGetCall) (response)
2285/// * [containers workspaces update accounts](AccountContainerWorkspaceUpdateCall) (request|response)
2286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2287#[serde_with::serde_as]
2288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2289pub struct Workspace {
2290 /// GTM Account ID.
2291 #[serde(rename = "accountId")]
2292 pub account_id: Option<String>,
2293 /// GTM Container ID.
2294 #[serde(rename = "containerId")]
2295 pub container_id: Option<String>,
2296 /// Workspace description.
2297 pub description: Option<String>,
2298 /// The fingerprint of the GTM Workspace as computed at storage time. This value is recomputed whenever the workspace is modified.
2299 pub fingerprint: Option<String>,
2300 /// Workspace display name.
2301 pub name: Option<String>,
2302 /// GTM Workspace's API relative path.
2303 pub path: Option<String>,
2304 /// Auto generated link to the tag manager UI
2305 #[serde(rename = "tagManagerUrl")]
2306 pub tag_manager_url: Option<String>,
2307 /// The Workspace ID uniquely identifies the GTM Workspace.
2308 #[serde(rename = "workspaceId")]
2309 pub workspace_id: Option<String>,
2310}
2311
2312impl common::RequestValue for Workspace {}
2313impl common::ResponseResult for Workspace {}
2314
2315/// Represents a Google Tag Manager Zone’s contents.
2316///
2317/// # Activities
2318///
2319/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2320/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2321///
2322/// * [containers workspaces zones create accounts](AccountContainerWorkspaceZoneCreateCall) (request|response)
2323/// * [containers workspaces zones get accounts](AccountContainerWorkspaceZoneGetCall) (response)
2324/// * [containers workspaces zones update accounts](AccountContainerWorkspaceZoneUpdateCall) (request|response)
2325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2326#[serde_with::serde_as]
2327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2328pub struct Zone {
2329 /// GTM Account ID.
2330 #[serde(rename = "accountId")]
2331 pub account_id: Option<String>,
2332 /// This Zone's boundary.
2333 pub boundary: Option<ZoneBoundary>,
2334 /// Containers that are children of this Zone.
2335 #[serde(rename = "childContainer")]
2336 pub child_container: Option<Vec<ZoneChildContainer>>,
2337 /// GTM Container ID.
2338 #[serde(rename = "containerId")]
2339 pub container_id: Option<String>,
2340 /// The fingerprint of the GTM Zone as computed at storage time. This value is recomputed whenever the zone is modified.
2341 pub fingerprint: Option<String>,
2342 /// Zone display name.
2343 pub name: Option<String>,
2344 /// User notes on how to apply this zone in the container.
2345 pub notes: Option<String>,
2346 /// GTM Zone's API relative path.
2347 pub path: Option<String>,
2348 /// Auto generated link to the tag manager UI
2349 #[serde(rename = "tagManagerUrl")]
2350 pub tag_manager_url: Option<String>,
2351 /// This Zone's type restrictions.
2352 #[serde(rename = "typeRestriction")]
2353 pub type_restriction: Option<ZoneTypeRestriction>,
2354 /// GTM Workspace ID.
2355 #[serde(rename = "workspaceId")]
2356 pub workspace_id: Option<String>,
2357 /// The Zone ID uniquely identifies the GTM Zone.
2358 #[serde(rename = "zoneId")]
2359 pub zone_id: Option<String>,
2360}
2361
2362impl common::RequestValue for Zone {}
2363impl common::ResponseResult for Zone {}
2364
2365/// Represents a Zone's boundaries.
2366///
2367/// This type is not used in any activity, and only used as *part* of another schema.
2368///
2369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2370#[serde_with::serde_as]
2371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2372pub struct ZoneBoundary {
2373 /// The conditions that, when conjoined, make up the boundary.
2374 pub condition: Option<Vec<Condition>>,
2375 /// Custom evaluation trigger IDs. A zone will evaluate its boundary conditions when any of the listed triggers are true.
2376 #[serde(rename = "customEvaluationTriggerId")]
2377 pub custom_evaluation_trigger_id: Option<Vec<String>>,
2378}
2379
2380impl common::Part for ZoneBoundary {}
2381
2382/// Represents a child container of a Zone.
2383///
2384/// This type is not used in any activity, and only used as *part* of another schema.
2385///
2386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2387#[serde_with::serde_as]
2388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2389pub struct ZoneChildContainer {
2390 /// The zone's nickname for the child container.
2391 pub nickname: Option<String>,
2392 /// The child container's public id.
2393 #[serde(rename = "publicId")]
2394 pub public_id: Option<String>,
2395}
2396
2397impl common::Part for ZoneChildContainer {}
2398
2399/// Represents a Zone's type restrictions.
2400///
2401/// This type is not used in any activity, and only used as *part* of another schema.
2402///
2403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2404#[serde_with::serde_as]
2405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2406pub struct ZoneTypeRestriction {
2407 /// True if type restrictions have been enabled for this Zone.
2408 pub enable: Option<bool>,
2409 /// List of type public ids that have been whitelisted for use in this Zone.
2410 #[serde(rename = "whitelistedTypeId")]
2411 pub whitelisted_type_id: Option<Vec<String>>,
2412}
2413
2414impl common::Part for ZoneTypeRestriction {}
2415
2416// ###################
2417// MethodBuilders ###
2418// #################
2419
2420/// A builder providing access to all methods supported on *account* resources.
2421/// It is not used directly, but through the [`TagManager`] hub.
2422///
2423/// # Example
2424///
2425/// Instantiate a resource builder
2426///
2427/// ```test_harness,no_run
2428/// extern crate hyper;
2429/// extern crate hyper_rustls;
2430/// extern crate google_tagmanager2 as tagmanager2;
2431///
2432/// # async fn dox() {
2433/// use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2434///
2435/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2436/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2437/// .with_native_roots()
2438/// .unwrap()
2439/// .https_only()
2440/// .enable_http2()
2441/// .build();
2442///
2443/// let executor = hyper_util::rt::TokioExecutor::new();
2444/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2445/// secret,
2446/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2447/// yup_oauth2::client::CustomHyperClientBuilder::from(
2448/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2449/// ),
2450/// ).build().await.unwrap();
2451///
2452/// let client = hyper_util::client::legacy::Client::builder(
2453/// hyper_util::rt::TokioExecutor::new()
2454/// )
2455/// .build(
2456/// hyper_rustls::HttpsConnectorBuilder::new()
2457/// .with_native_roots()
2458/// .unwrap()
2459/// .https_or_http()
2460/// .enable_http2()
2461/// .build()
2462/// );
2463/// let mut hub = TagManager::new(client, auth);
2464/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2465/// // 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_bulk_update(...)`, `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_import_from_gallery(...)`, `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(...)`
2466/// // to build up your call.
2467/// let rb = hub.accounts();
2468/// # }
2469/// ```
2470pub struct AccountMethods<'a, C>
2471where
2472 C: 'a,
2473{
2474 hub: &'a TagManager<C>,
2475}
2476
2477impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
2478
2479impl<'a, C> AccountMethods<'a, C> {
2480 /// Create a builder to help you perform the following task:
2481 ///
2482 /// Gets a Destination.
2483 ///
2484 /// # Arguments
2485 ///
2486 /// * `path` - Google Tag Destination's API relative path.
2487 pub fn containers_destinations_get(
2488 &self,
2489 path: &str,
2490 ) -> AccountContainerDestinationGetCall<'a, C> {
2491 AccountContainerDestinationGetCall {
2492 hub: self.hub,
2493 _path: path.to_string(),
2494 _delegate: Default::default(),
2495 _additional_params: Default::default(),
2496 _scopes: Default::default(),
2497 }
2498 }
2499
2500 /// Create a builder to help you perform the following task:
2501 ///
2502 /// Adds a Destination to this Container and removes it from the Container to which it is currently linked.
2503 ///
2504 /// # Arguments
2505 ///
2506 /// * `parent` - GTM parent Container's API relative path.
2507 pub fn containers_destinations_link(
2508 &self,
2509 parent: &str,
2510 ) -> AccountContainerDestinationLinkCall<'a, C> {
2511 AccountContainerDestinationLinkCall {
2512 hub: self.hub,
2513 _parent: parent.to_string(),
2514 _destination_id: Default::default(),
2515 _allow_user_permission_feature_update: Default::default(),
2516 _delegate: Default::default(),
2517 _additional_params: Default::default(),
2518 _scopes: Default::default(),
2519 }
2520 }
2521
2522 /// Create a builder to help you perform the following task:
2523 ///
2524 /// Lists all Destinations linked to a GTM Container.
2525 ///
2526 /// # Arguments
2527 ///
2528 /// * `parent` - GTM parent Container's API relative path.
2529 pub fn containers_destinations_list(
2530 &self,
2531 parent: &str,
2532 ) -> AccountContainerDestinationListCall<'a, C> {
2533 AccountContainerDestinationListCall {
2534 hub: self.hub,
2535 _parent: parent.to_string(),
2536 _delegate: Default::default(),
2537 _additional_params: Default::default(),
2538 _scopes: Default::default(),
2539 }
2540 }
2541
2542 /// Create a builder to help you perform the following task:
2543 ///
2544 /// Creates a GTM Environment.
2545 ///
2546 /// # Arguments
2547 ///
2548 /// * `request` - No description provided.
2549 /// * `parent` - GTM Container's API relative path.
2550 pub fn containers_environments_create(
2551 &self,
2552 request: Environment,
2553 parent: &str,
2554 ) -> AccountContainerEnvironmentCreateCall<'a, C> {
2555 AccountContainerEnvironmentCreateCall {
2556 hub: self.hub,
2557 _request: request,
2558 _parent: parent.to_string(),
2559 _delegate: Default::default(),
2560 _additional_params: Default::default(),
2561 _scopes: Default::default(),
2562 }
2563 }
2564
2565 /// Create a builder to help you perform the following task:
2566 ///
2567 /// Deletes a GTM Environment.
2568 ///
2569 /// # Arguments
2570 ///
2571 /// * `path` - GTM Environment's API relative path.
2572 pub fn containers_environments_delete(
2573 &self,
2574 path: &str,
2575 ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
2576 AccountContainerEnvironmentDeleteCall {
2577 hub: self.hub,
2578 _path: path.to_string(),
2579 _delegate: Default::default(),
2580 _additional_params: Default::default(),
2581 _scopes: Default::default(),
2582 }
2583 }
2584
2585 /// Create a builder to help you perform the following task:
2586 ///
2587 /// Gets a GTM Environment.
2588 ///
2589 /// # Arguments
2590 ///
2591 /// * `path` - GTM Environment's API relative path.
2592 pub fn containers_environments_get(
2593 &self,
2594 path: &str,
2595 ) -> AccountContainerEnvironmentGetCall<'a, C> {
2596 AccountContainerEnvironmentGetCall {
2597 hub: self.hub,
2598 _path: path.to_string(),
2599 _delegate: Default::default(),
2600 _additional_params: Default::default(),
2601 _scopes: Default::default(),
2602 }
2603 }
2604
2605 /// Create a builder to help you perform the following task:
2606 ///
2607 /// Lists all GTM Environments of a GTM Container.
2608 ///
2609 /// # Arguments
2610 ///
2611 /// * `parent` - GTM Container's API relative path.
2612 pub fn containers_environments_list(
2613 &self,
2614 parent: &str,
2615 ) -> AccountContainerEnvironmentListCall<'a, C> {
2616 AccountContainerEnvironmentListCall {
2617 hub: self.hub,
2618 _parent: parent.to_string(),
2619 _page_token: Default::default(),
2620 _delegate: Default::default(),
2621 _additional_params: Default::default(),
2622 _scopes: Default::default(),
2623 }
2624 }
2625
2626 /// Create a builder to help you perform the following task:
2627 ///
2628 /// Re-generates the authorization code for a GTM Environment.
2629 ///
2630 /// # Arguments
2631 ///
2632 /// * `request` - No description provided.
2633 /// * `path` - GTM Environment's API relative path.
2634 pub fn containers_environments_reauthorize(
2635 &self,
2636 request: Environment,
2637 path: &str,
2638 ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
2639 AccountContainerEnvironmentReauthorizeCall {
2640 hub: self.hub,
2641 _request: request,
2642 _path: path.to_string(),
2643 _delegate: Default::default(),
2644 _additional_params: Default::default(),
2645 _scopes: Default::default(),
2646 }
2647 }
2648
2649 /// Create a builder to help you perform the following task:
2650 ///
2651 /// Updates a GTM Environment.
2652 ///
2653 /// # Arguments
2654 ///
2655 /// * `request` - No description provided.
2656 /// * `path` - GTM Environment's API relative path.
2657 pub fn containers_environments_update(
2658 &self,
2659 request: Environment,
2660 path: &str,
2661 ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
2662 AccountContainerEnvironmentUpdateCall {
2663 hub: self.hub,
2664 _request: request,
2665 _path: path.to_string(),
2666 _fingerprint: Default::default(),
2667 _delegate: Default::default(),
2668 _additional_params: Default::default(),
2669 _scopes: Default::default(),
2670 }
2671 }
2672
2673 /// Create a builder to help you perform the following task:
2674 ///
2675 /// Gets the latest container version header
2676 ///
2677 /// # Arguments
2678 ///
2679 /// * `parent` - GTM Container's API relative path.
2680 pub fn containers_version_headers_latest(
2681 &self,
2682 parent: &str,
2683 ) -> AccountContainerVersionHeaderLatestCall<'a, C> {
2684 AccountContainerVersionHeaderLatestCall {
2685 hub: self.hub,
2686 _parent: parent.to_string(),
2687 _delegate: Default::default(),
2688 _additional_params: Default::default(),
2689 _scopes: Default::default(),
2690 }
2691 }
2692
2693 /// Create a builder to help you perform the following task:
2694 ///
2695 /// Lists all Container Versions of a GTM Container.
2696 ///
2697 /// # Arguments
2698 ///
2699 /// * `parent` - GTM Container's API relative path.
2700 pub fn containers_version_headers_list(
2701 &self,
2702 parent: &str,
2703 ) -> AccountContainerVersionHeaderListCall<'a, C> {
2704 AccountContainerVersionHeaderListCall {
2705 hub: self.hub,
2706 _parent: parent.to_string(),
2707 _page_token: Default::default(),
2708 _include_deleted: Default::default(),
2709 _delegate: Default::default(),
2710 _additional_params: Default::default(),
2711 _scopes: Default::default(),
2712 }
2713 }
2714
2715 /// Create a builder to help you perform the following task:
2716 ///
2717 /// Deletes a Container Version.
2718 ///
2719 /// # Arguments
2720 ///
2721 /// * `path` - GTM ContainerVersion's API relative path.
2722 pub fn containers_versions_delete(
2723 &self,
2724 path: &str,
2725 ) -> AccountContainerVersionDeleteCall<'a, C> {
2726 AccountContainerVersionDeleteCall {
2727 hub: self.hub,
2728 _path: path.to_string(),
2729 _delegate: Default::default(),
2730 _additional_params: Default::default(),
2731 _scopes: Default::default(),
2732 }
2733 }
2734
2735 /// Create a builder to help you perform the following task:
2736 ///
2737 /// Gets a Container Version.
2738 ///
2739 /// # Arguments
2740 ///
2741 /// * `path` - GTM ContainerVersion's API relative path.
2742 pub fn containers_versions_get(&self, path: &str) -> AccountContainerVersionGetCall<'a, C> {
2743 AccountContainerVersionGetCall {
2744 hub: self.hub,
2745 _path: path.to_string(),
2746 _container_version_id: Default::default(),
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 /// Gets the live (i.e. published) container version
2756 ///
2757 /// # Arguments
2758 ///
2759 /// * `parent` - GTM Container's API relative path.
2760 pub fn containers_versions_live(&self, parent: &str) -> AccountContainerVersionLiveCall<'a, C> {
2761 AccountContainerVersionLiveCall {
2762 hub: self.hub,
2763 _parent: parent.to_string(),
2764 _delegate: Default::default(),
2765 _additional_params: Default::default(),
2766 _scopes: Default::default(),
2767 }
2768 }
2769
2770 /// Create a builder to help you perform the following task:
2771 ///
2772 /// Publishes a Container Version.
2773 ///
2774 /// # Arguments
2775 ///
2776 /// * `path` - GTM ContainerVersion's API relative path.
2777 pub fn containers_versions_publish(
2778 &self,
2779 path: &str,
2780 ) -> AccountContainerVersionPublishCall<'a, C> {
2781 AccountContainerVersionPublishCall {
2782 hub: self.hub,
2783 _path: path.to_string(),
2784 _fingerprint: Default::default(),
2785 _delegate: Default::default(),
2786 _additional_params: Default::default(),
2787 _scopes: Default::default(),
2788 }
2789 }
2790
2791 /// Create a builder to help you perform the following task:
2792 ///
2793 /// Sets the latest version used for synchronization of workspaces when detecting conflicts and errors.
2794 ///
2795 /// # Arguments
2796 ///
2797 /// * `path` - GTM ContainerVersion's API relative path.
2798 pub fn containers_versions_set_latest(
2799 &self,
2800 path: &str,
2801 ) -> AccountContainerVersionSetLatestCall<'a, C> {
2802 AccountContainerVersionSetLatestCall {
2803 hub: self.hub,
2804 _path: path.to_string(),
2805 _delegate: Default::default(),
2806 _additional_params: Default::default(),
2807 _scopes: Default::default(),
2808 }
2809 }
2810
2811 /// Create a builder to help you perform the following task:
2812 ///
2813 /// Undeletes a Container Version.
2814 ///
2815 /// # Arguments
2816 ///
2817 /// * `path` - GTM ContainerVersion's API relative path.
2818 pub fn containers_versions_undelete(
2819 &self,
2820 path: &str,
2821 ) -> AccountContainerVersionUndeleteCall<'a, C> {
2822 AccountContainerVersionUndeleteCall {
2823 hub: self.hub,
2824 _path: path.to_string(),
2825 _delegate: Default::default(),
2826 _additional_params: Default::default(),
2827 _scopes: Default::default(),
2828 }
2829 }
2830
2831 /// Create a builder to help you perform the following task:
2832 ///
2833 /// Updates a Container Version.
2834 ///
2835 /// # Arguments
2836 ///
2837 /// * `request` - No description provided.
2838 /// * `path` - GTM ContainerVersion's API relative path.
2839 pub fn containers_versions_update(
2840 &self,
2841 request: ContainerVersion,
2842 path: &str,
2843 ) -> AccountContainerVersionUpdateCall<'a, C> {
2844 AccountContainerVersionUpdateCall {
2845 hub: self.hub,
2846 _request: request,
2847 _path: path.to_string(),
2848 _fingerprint: Default::default(),
2849 _delegate: Default::default(),
2850 _additional_params: Default::default(),
2851 _scopes: Default::default(),
2852 }
2853 }
2854
2855 /// Create a builder to help you perform the following task:
2856 ///
2857 /// Creates one or more GTM Built-In Variables.
2858 ///
2859 /// # Arguments
2860 ///
2861 /// * `parent` - GTM Workspace's API relative path.
2862 pub fn containers_workspaces_built_in_variables_create(
2863 &self,
2864 parent: &str,
2865 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
2866 AccountContainerWorkspaceBuiltInVariableCreateCall {
2867 hub: self.hub,
2868 _parent: parent.to_string(),
2869 _type_: Default::default(),
2870 _delegate: Default::default(),
2871 _additional_params: Default::default(),
2872 _scopes: Default::default(),
2873 }
2874 }
2875
2876 /// Create a builder to help you perform the following task:
2877 ///
2878 /// Deletes one or more GTM Built-In Variables.
2879 ///
2880 /// # Arguments
2881 ///
2882 /// * `path` - GTM BuiltInVariable's API relative path.
2883 pub fn containers_workspaces_built_in_variables_delete(
2884 &self,
2885 path: &str,
2886 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
2887 AccountContainerWorkspaceBuiltInVariableDeleteCall {
2888 hub: self.hub,
2889 _path: path.to_string(),
2890 _type_: Default::default(),
2891 _delegate: Default::default(),
2892 _additional_params: Default::default(),
2893 _scopes: Default::default(),
2894 }
2895 }
2896
2897 /// Create a builder to help you perform the following task:
2898 ///
2899 /// Lists all the enabled Built-In Variables of a GTM Container.
2900 ///
2901 /// # Arguments
2902 ///
2903 /// * `parent` - GTM Workspace's API relative path.
2904 pub fn containers_workspaces_built_in_variables_list(
2905 &self,
2906 parent: &str,
2907 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
2908 AccountContainerWorkspaceBuiltInVariableListCall {
2909 hub: self.hub,
2910 _parent: parent.to_string(),
2911 _page_token: Default::default(),
2912 _delegate: Default::default(),
2913 _additional_params: Default::default(),
2914 _scopes: Default::default(),
2915 }
2916 }
2917
2918 /// Create a builder to help you perform the following task:
2919 ///
2920 /// Reverts changes to a GTM Built-In Variables in a GTM Workspace.
2921 ///
2922 /// # Arguments
2923 ///
2924 /// * `path` - GTM BuiltInVariable's API relative path.
2925 pub fn containers_workspaces_built_in_variables_revert(
2926 &self,
2927 path: &str,
2928 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
2929 AccountContainerWorkspaceBuiltInVariableRevertCall {
2930 hub: self.hub,
2931 _path: path.to_string(),
2932 _type_: Default::default(),
2933 _delegate: Default::default(),
2934 _additional_params: Default::default(),
2935 _scopes: Default::default(),
2936 }
2937 }
2938
2939 /// Create a builder to help you perform the following task:
2940 ///
2941 /// Creates a GTM Client.
2942 ///
2943 /// # Arguments
2944 ///
2945 /// * `request` - No description provided.
2946 /// * `parent` - GTM Workspace's API relative path.
2947 pub fn containers_workspaces_clients_create(
2948 &self,
2949 request: Client,
2950 parent: &str,
2951 ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
2952 AccountContainerWorkspaceClientCreateCall {
2953 hub: self.hub,
2954 _request: request,
2955 _parent: parent.to_string(),
2956 _delegate: Default::default(),
2957 _additional_params: Default::default(),
2958 _scopes: Default::default(),
2959 }
2960 }
2961
2962 /// Create a builder to help you perform the following task:
2963 ///
2964 /// Deletes a GTM Client.
2965 ///
2966 /// # Arguments
2967 ///
2968 /// * `path` - GTM Client's API relative path.
2969 pub fn containers_workspaces_clients_delete(
2970 &self,
2971 path: &str,
2972 ) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
2973 AccountContainerWorkspaceClientDeleteCall {
2974 hub: self.hub,
2975 _path: path.to_string(),
2976 _delegate: Default::default(),
2977 _additional_params: Default::default(),
2978 _scopes: Default::default(),
2979 }
2980 }
2981
2982 /// Create a builder to help you perform the following task:
2983 ///
2984 /// Gets a GTM Client.
2985 ///
2986 /// # Arguments
2987 ///
2988 /// * `path` - GTM Client's API relative path.
2989 pub fn containers_workspaces_clients_get(
2990 &self,
2991 path: &str,
2992 ) -> AccountContainerWorkspaceClientGetCall<'a, C> {
2993 AccountContainerWorkspaceClientGetCall {
2994 hub: self.hub,
2995 _path: path.to_string(),
2996 _delegate: Default::default(),
2997 _additional_params: Default::default(),
2998 _scopes: Default::default(),
2999 }
3000 }
3001
3002 /// Create a builder to help you perform the following task:
3003 ///
3004 /// Lists all GTM Clients of a GTM container workspace.
3005 ///
3006 /// # Arguments
3007 ///
3008 /// * `parent` - GTM Workspace's API relative path.
3009 pub fn containers_workspaces_clients_list(
3010 &self,
3011 parent: &str,
3012 ) -> AccountContainerWorkspaceClientListCall<'a, C> {
3013 AccountContainerWorkspaceClientListCall {
3014 hub: self.hub,
3015 _parent: parent.to_string(),
3016 _page_token: Default::default(),
3017 _delegate: Default::default(),
3018 _additional_params: Default::default(),
3019 _scopes: Default::default(),
3020 }
3021 }
3022
3023 /// Create a builder to help you perform the following task:
3024 ///
3025 /// Reverts changes to a GTM Client in a GTM Workspace.
3026 ///
3027 /// # Arguments
3028 ///
3029 /// * `path` - GTM Client's API relative path.
3030 pub fn containers_workspaces_clients_revert(
3031 &self,
3032 path: &str,
3033 ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
3034 AccountContainerWorkspaceClientRevertCall {
3035 hub: self.hub,
3036 _path: path.to_string(),
3037 _fingerprint: Default::default(),
3038 _delegate: Default::default(),
3039 _additional_params: Default::default(),
3040 _scopes: Default::default(),
3041 }
3042 }
3043
3044 /// Create a builder to help you perform the following task:
3045 ///
3046 /// Updates a GTM Client.
3047 ///
3048 /// # Arguments
3049 ///
3050 /// * `request` - No description provided.
3051 /// * `path` - GTM Client's API relative path.
3052 pub fn containers_workspaces_clients_update(
3053 &self,
3054 request: Client,
3055 path: &str,
3056 ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
3057 AccountContainerWorkspaceClientUpdateCall {
3058 hub: self.hub,
3059 _request: request,
3060 _path: path.to_string(),
3061 _fingerprint: Default::default(),
3062 _delegate: Default::default(),
3063 _additional_params: Default::default(),
3064 _scopes: Default::default(),
3065 }
3066 }
3067
3068 /// Create a builder to help you perform the following task:
3069 ///
3070 /// Creates a GTM Folder.
3071 ///
3072 /// # Arguments
3073 ///
3074 /// * `request` - No description provided.
3075 /// * `parent` - GTM Workspace's API relative path.
3076 pub fn containers_workspaces_folders_create(
3077 &self,
3078 request: Folder,
3079 parent: &str,
3080 ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
3081 AccountContainerWorkspaceFolderCreateCall {
3082 hub: self.hub,
3083 _request: request,
3084 _parent: parent.to_string(),
3085 _delegate: Default::default(),
3086 _additional_params: Default::default(),
3087 _scopes: Default::default(),
3088 }
3089 }
3090
3091 /// Create a builder to help you perform the following task:
3092 ///
3093 /// Deletes a GTM Folder.
3094 ///
3095 /// # Arguments
3096 ///
3097 /// * `path` - GTM Folder's API relative path.
3098 pub fn containers_workspaces_folders_delete(
3099 &self,
3100 path: &str,
3101 ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
3102 AccountContainerWorkspaceFolderDeleteCall {
3103 hub: self.hub,
3104 _path: path.to_string(),
3105 _delegate: Default::default(),
3106 _additional_params: Default::default(),
3107 _scopes: Default::default(),
3108 }
3109 }
3110
3111 /// Create a builder to help you perform the following task:
3112 ///
3113 /// List all entities in a GTM Folder.
3114 ///
3115 /// # Arguments
3116 ///
3117 /// * `path` - GTM Folder's API relative path.
3118 pub fn containers_workspaces_folders_entities(
3119 &self,
3120 path: &str,
3121 ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
3122 AccountContainerWorkspaceFolderEntityCall {
3123 hub: self.hub,
3124 _path: path.to_string(),
3125 _page_token: Default::default(),
3126 _delegate: Default::default(),
3127 _additional_params: Default::default(),
3128 _scopes: Default::default(),
3129 }
3130 }
3131
3132 /// Create a builder to help you perform the following task:
3133 ///
3134 /// Gets a GTM Folder.
3135 ///
3136 /// # Arguments
3137 ///
3138 /// * `path` - GTM Folder's API relative path.
3139 pub fn containers_workspaces_folders_get(
3140 &self,
3141 path: &str,
3142 ) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
3143 AccountContainerWorkspaceFolderGetCall {
3144 hub: self.hub,
3145 _path: path.to_string(),
3146 _delegate: Default::default(),
3147 _additional_params: Default::default(),
3148 _scopes: Default::default(),
3149 }
3150 }
3151
3152 /// Create a builder to help you perform the following task:
3153 ///
3154 /// Lists all GTM Folders of a Container.
3155 ///
3156 /// # Arguments
3157 ///
3158 /// * `parent` - GTM Workspace's API relative path.
3159 pub fn containers_workspaces_folders_list(
3160 &self,
3161 parent: &str,
3162 ) -> AccountContainerWorkspaceFolderListCall<'a, C> {
3163 AccountContainerWorkspaceFolderListCall {
3164 hub: self.hub,
3165 _parent: parent.to_string(),
3166 _page_token: Default::default(),
3167 _delegate: Default::default(),
3168 _additional_params: Default::default(),
3169 _scopes: Default::default(),
3170 }
3171 }
3172
3173 /// Create a builder to help you perform the following task:
3174 ///
3175 /// 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.
3176 ///
3177 /// # Arguments
3178 ///
3179 /// * `request` - No description provided.
3180 /// * `path` - GTM Folder's API relative path.
3181 pub fn containers_workspaces_folders_move_entities_to_folder(
3182 &self,
3183 request: Folder,
3184 path: &str,
3185 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
3186 AccountContainerWorkspaceFolderMoveEntitiesToFolderCall {
3187 hub: self.hub,
3188 _request: request,
3189 _path: path.to_string(),
3190 _variable_id: Default::default(),
3191 _trigger_id: Default::default(),
3192 _tag_id: Default::default(),
3193 _delegate: Default::default(),
3194 _additional_params: Default::default(),
3195 _scopes: Default::default(),
3196 }
3197 }
3198
3199 /// Create a builder to help you perform the following task:
3200 ///
3201 /// Reverts changes to a GTM Folder in a GTM Workspace.
3202 ///
3203 /// # Arguments
3204 ///
3205 /// * `path` - GTM Folder's API relative path.
3206 pub fn containers_workspaces_folders_revert(
3207 &self,
3208 path: &str,
3209 ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
3210 AccountContainerWorkspaceFolderRevertCall {
3211 hub: self.hub,
3212 _path: path.to_string(),
3213 _fingerprint: Default::default(),
3214 _delegate: Default::default(),
3215 _additional_params: Default::default(),
3216 _scopes: Default::default(),
3217 }
3218 }
3219
3220 /// Create a builder to help you perform the following task:
3221 ///
3222 /// Updates a GTM Folder.
3223 ///
3224 /// # Arguments
3225 ///
3226 /// * `request` - No description provided.
3227 /// * `path` - GTM Folder's API relative path.
3228 pub fn containers_workspaces_folders_update(
3229 &self,
3230 request: Folder,
3231 path: &str,
3232 ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
3233 AccountContainerWorkspaceFolderUpdateCall {
3234 hub: self.hub,
3235 _request: request,
3236 _path: path.to_string(),
3237 _fingerprint: Default::default(),
3238 _delegate: Default::default(),
3239 _additional_params: Default::default(),
3240 _scopes: Default::default(),
3241 }
3242 }
3243
3244 /// Create a builder to help you perform the following task:
3245 ///
3246 /// Creates a Google tag config.
3247 ///
3248 /// # Arguments
3249 ///
3250 /// * `request` - No description provided.
3251 /// * `parent` - Workspace's API relative path.
3252 pub fn containers_workspaces_gtag_config_create(
3253 &self,
3254 request: GtagConfig,
3255 parent: &str,
3256 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
3257 AccountContainerWorkspaceGtagConfigCreateCall {
3258 hub: self.hub,
3259 _request: request,
3260 _parent: parent.to_string(),
3261 _delegate: Default::default(),
3262 _additional_params: Default::default(),
3263 _scopes: Default::default(),
3264 }
3265 }
3266
3267 /// Create a builder to help you perform the following task:
3268 ///
3269 /// Deletes a Google tag config.
3270 ///
3271 /// # Arguments
3272 ///
3273 /// * `path` - Google tag config's API relative path.
3274 pub fn containers_workspaces_gtag_config_delete(
3275 &self,
3276 path: &str,
3277 ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
3278 AccountContainerWorkspaceGtagConfigDeleteCall {
3279 hub: self.hub,
3280 _path: path.to_string(),
3281 _delegate: Default::default(),
3282 _additional_params: Default::default(),
3283 _scopes: Default::default(),
3284 }
3285 }
3286
3287 /// Create a builder to help you perform the following task:
3288 ///
3289 /// Gets a Google tag config.
3290 ///
3291 /// # Arguments
3292 ///
3293 /// * `path` - Google tag config's API relative path.
3294 pub fn containers_workspaces_gtag_config_get(
3295 &self,
3296 path: &str,
3297 ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
3298 AccountContainerWorkspaceGtagConfigGetCall {
3299 hub: self.hub,
3300 _path: path.to_string(),
3301 _delegate: Default::default(),
3302 _additional_params: Default::default(),
3303 _scopes: Default::default(),
3304 }
3305 }
3306
3307 /// Create a builder to help you perform the following task:
3308 ///
3309 /// Lists all Google tag configs in a Container.
3310 ///
3311 /// # Arguments
3312 ///
3313 /// * `parent` - Workspace's API relative path.
3314 pub fn containers_workspaces_gtag_config_list(
3315 &self,
3316 parent: &str,
3317 ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
3318 AccountContainerWorkspaceGtagConfigListCall {
3319 hub: self.hub,
3320 _parent: parent.to_string(),
3321 _page_token: Default::default(),
3322 _delegate: Default::default(),
3323 _additional_params: Default::default(),
3324 _scopes: Default::default(),
3325 }
3326 }
3327
3328 /// Create a builder to help you perform the following task:
3329 ///
3330 /// Updates a Google tag config.
3331 ///
3332 /// # Arguments
3333 ///
3334 /// * `request` - No description provided.
3335 /// * `path` - Google tag config's API relative path.
3336 pub fn containers_workspaces_gtag_config_update(
3337 &self,
3338 request: GtagConfig,
3339 path: &str,
3340 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
3341 AccountContainerWorkspaceGtagConfigUpdateCall {
3342 hub: self.hub,
3343 _request: request,
3344 _path: path.to_string(),
3345 _fingerprint: Default::default(),
3346 _delegate: Default::default(),
3347 _additional_params: Default::default(),
3348 _scopes: Default::default(),
3349 }
3350 }
3351
3352 /// Create a builder to help you perform the following task:
3353 ///
3354 /// Creates a GTM Tag.
3355 ///
3356 /// # Arguments
3357 ///
3358 /// * `request` - No description provided.
3359 /// * `parent` - GTM Workspace's API relative path.
3360 pub fn containers_workspaces_tags_create(
3361 &self,
3362 request: Tag,
3363 parent: &str,
3364 ) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
3365 AccountContainerWorkspaceTagCreateCall {
3366 hub: self.hub,
3367 _request: request,
3368 _parent: parent.to_string(),
3369 _delegate: Default::default(),
3370 _additional_params: Default::default(),
3371 _scopes: Default::default(),
3372 }
3373 }
3374
3375 /// Create a builder to help you perform the following task:
3376 ///
3377 /// Deletes a GTM Tag.
3378 ///
3379 /// # Arguments
3380 ///
3381 /// * `path` - GTM Tag's API relative path.
3382 pub fn containers_workspaces_tags_delete(
3383 &self,
3384 path: &str,
3385 ) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
3386 AccountContainerWorkspaceTagDeleteCall {
3387 hub: self.hub,
3388 _path: path.to_string(),
3389 _delegate: Default::default(),
3390 _additional_params: Default::default(),
3391 _scopes: Default::default(),
3392 }
3393 }
3394
3395 /// Create a builder to help you perform the following task:
3396 ///
3397 /// Gets a GTM Tag.
3398 ///
3399 /// # Arguments
3400 ///
3401 /// * `path` - GTM Tag's API relative path.
3402 pub fn containers_workspaces_tags_get(
3403 &self,
3404 path: &str,
3405 ) -> AccountContainerWorkspaceTagGetCall<'a, C> {
3406 AccountContainerWorkspaceTagGetCall {
3407 hub: self.hub,
3408 _path: path.to_string(),
3409 _delegate: Default::default(),
3410 _additional_params: Default::default(),
3411 _scopes: Default::default(),
3412 }
3413 }
3414
3415 /// Create a builder to help you perform the following task:
3416 ///
3417 /// Lists all GTM Tags of a Container.
3418 ///
3419 /// # Arguments
3420 ///
3421 /// * `parent` - GTM Workspace's API relative path.
3422 pub fn containers_workspaces_tags_list(
3423 &self,
3424 parent: &str,
3425 ) -> AccountContainerWorkspaceTagListCall<'a, C> {
3426 AccountContainerWorkspaceTagListCall {
3427 hub: self.hub,
3428 _parent: parent.to_string(),
3429 _page_token: Default::default(),
3430 _delegate: Default::default(),
3431 _additional_params: Default::default(),
3432 _scopes: Default::default(),
3433 }
3434 }
3435
3436 /// Create a builder to help you perform the following task:
3437 ///
3438 /// Reverts changes to a GTM Tag in a GTM Workspace.
3439 ///
3440 /// # Arguments
3441 ///
3442 /// * `path` - GTM Tag's API relative path.
3443 pub fn containers_workspaces_tags_revert(
3444 &self,
3445 path: &str,
3446 ) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
3447 AccountContainerWorkspaceTagRevertCall {
3448 hub: self.hub,
3449 _path: path.to_string(),
3450 _fingerprint: Default::default(),
3451 _delegate: Default::default(),
3452 _additional_params: Default::default(),
3453 _scopes: Default::default(),
3454 }
3455 }
3456
3457 /// Create a builder to help you perform the following task:
3458 ///
3459 /// Updates a GTM Tag.
3460 ///
3461 /// # Arguments
3462 ///
3463 /// * `request` - No description provided.
3464 /// * `path` - GTM Tag's API relative path.
3465 pub fn containers_workspaces_tags_update(
3466 &self,
3467 request: Tag,
3468 path: &str,
3469 ) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
3470 AccountContainerWorkspaceTagUpdateCall {
3471 hub: self.hub,
3472 _request: request,
3473 _path: path.to_string(),
3474 _fingerprint: Default::default(),
3475 _delegate: Default::default(),
3476 _additional_params: Default::default(),
3477 _scopes: Default::default(),
3478 }
3479 }
3480
3481 /// Create a builder to help you perform the following task:
3482 ///
3483 /// Creates a GTM Custom Template.
3484 ///
3485 /// # Arguments
3486 ///
3487 /// * `request` - No description provided.
3488 /// * `parent` - GTM Workspace's API relative path.
3489 pub fn containers_workspaces_templates_create(
3490 &self,
3491 request: CustomTemplate,
3492 parent: &str,
3493 ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
3494 AccountContainerWorkspaceTemplateCreateCall {
3495 hub: self.hub,
3496 _request: request,
3497 _parent: parent.to_string(),
3498 _delegate: Default::default(),
3499 _additional_params: Default::default(),
3500 _scopes: Default::default(),
3501 }
3502 }
3503
3504 /// Create a builder to help you perform the following task:
3505 ///
3506 /// Deletes a GTM Template.
3507 ///
3508 /// # Arguments
3509 ///
3510 /// * `path` - GTM Custom Template's API relative path.
3511 pub fn containers_workspaces_templates_delete(
3512 &self,
3513 path: &str,
3514 ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
3515 AccountContainerWorkspaceTemplateDeleteCall {
3516 hub: self.hub,
3517 _path: path.to_string(),
3518 _delegate: Default::default(),
3519 _additional_params: Default::default(),
3520 _scopes: Default::default(),
3521 }
3522 }
3523
3524 /// Create a builder to help you perform the following task:
3525 ///
3526 /// Gets a GTM Template.
3527 ///
3528 /// # Arguments
3529 ///
3530 /// * `path` - GTM Custom Template's API relative path.
3531 pub fn containers_workspaces_templates_get(
3532 &self,
3533 path: &str,
3534 ) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
3535 AccountContainerWorkspaceTemplateGetCall {
3536 hub: self.hub,
3537 _path: path.to_string(),
3538 _delegate: Default::default(),
3539 _additional_params: Default::default(),
3540 _scopes: Default::default(),
3541 }
3542 }
3543
3544 /// Create a builder to help you perform the following task:
3545 ///
3546 /// Imports a GTM Custom Template from Gallery.
3547 ///
3548 /// # Arguments
3549 ///
3550 /// * `parent` - GTM Workspace's API relative path.
3551 pub fn containers_workspaces_templates_import_from_gallery(
3552 &self,
3553 parent: &str,
3554 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
3555 AccountContainerWorkspaceTemplateImportFromGalleryCall {
3556 hub: self.hub,
3557 _parent: parent.to_string(),
3558 _gallery_sha: Default::default(),
3559 _gallery_repository: Default::default(),
3560 _gallery_owner: Default::default(),
3561 _acknowledge_permissions: Default::default(),
3562 _delegate: Default::default(),
3563 _additional_params: Default::default(),
3564 _scopes: Default::default(),
3565 }
3566 }
3567
3568 /// Create a builder to help you perform the following task:
3569 ///
3570 /// Lists all GTM Templates of a GTM container workspace.
3571 ///
3572 /// # Arguments
3573 ///
3574 /// * `parent` - GTM Workspace's API relative path.
3575 pub fn containers_workspaces_templates_list(
3576 &self,
3577 parent: &str,
3578 ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
3579 AccountContainerWorkspaceTemplateListCall {
3580 hub: self.hub,
3581 _parent: parent.to_string(),
3582 _page_token: Default::default(),
3583 _delegate: Default::default(),
3584 _additional_params: Default::default(),
3585 _scopes: Default::default(),
3586 }
3587 }
3588
3589 /// Create a builder to help you perform the following task:
3590 ///
3591 /// Reverts changes to a GTM Template in a GTM Workspace.
3592 ///
3593 /// # Arguments
3594 ///
3595 /// * `path` - GTM Custom Template's API relative path.
3596 pub fn containers_workspaces_templates_revert(
3597 &self,
3598 path: &str,
3599 ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
3600 AccountContainerWorkspaceTemplateRevertCall {
3601 hub: self.hub,
3602 _path: path.to_string(),
3603 _fingerprint: Default::default(),
3604 _delegate: Default::default(),
3605 _additional_params: Default::default(),
3606 _scopes: Default::default(),
3607 }
3608 }
3609
3610 /// Create a builder to help you perform the following task:
3611 ///
3612 /// Updates a GTM Template.
3613 ///
3614 /// # Arguments
3615 ///
3616 /// * `request` - No description provided.
3617 /// * `path` - GTM Custom Template's API relative path.
3618 pub fn containers_workspaces_templates_update(
3619 &self,
3620 request: CustomTemplate,
3621 path: &str,
3622 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
3623 AccountContainerWorkspaceTemplateUpdateCall {
3624 hub: self.hub,
3625 _request: request,
3626 _path: path.to_string(),
3627 _fingerprint: Default::default(),
3628 _delegate: Default::default(),
3629 _additional_params: Default::default(),
3630 _scopes: Default::default(),
3631 }
3632 }
3633
3634 /// Create a builder to help you perform the following task:
3635 ///
3636 /// Creates a GTM Transformation.
3637 ///
3638 /// # Arguments
3639 ///
3640 /// * `request` - No description provided.
3641 /// * `parent` - GTM Workspace's API relative path.
3642 pub fn containers_workspaces_transformations_create(
3643 &self,
3644 request: Transformation,
3645 parent: &str,
3646 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
3647 AccountContainerWorkspaceTransformationCreateCall {
3648 hub: self.hub,
3649 _request: request,
3650 _parent: parent.to_string(),
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 /// Deletes a GTM Transformation.
3660 ///
3661 /// # Arguments
3662 ///
3663 /// * `path` - GTM Transformation's API relative path.
3664 pub fn containers_workspaces_transformations_delete(
3665 &self,
3666 path: &str,
3667 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
3668 AccountContainerWorkspaceTransformationDeleteCall {
3669 hub: self.hub,
3670 _path: path.to_string(),
3671 _delegate: Default::default(),
3672 _additional_params: Default::default(),
3673 _scopes: Default::default(),
3674 }
3675 }
3676
3677 /// Create a builder to help you perform the following task:
3678 ///
3679 /// Gets a GTM Transformation.
3680 ///
3681 /// # Arguments
3682 ///
3683 /// * `path` - GTM Transformation's API relative path.
3684 pub fn containers_workspaces_transformations_get(
3685 &self,
3686 path: &str,
3687 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
3688 AccountContainerWorkspaceTransformationGetCall {
3689 hub: self.hub,
3690 _path: path.to_string(),
3691 _delegate: Default::default(),
3692 _additional_params: Default::default(),
3693 _scopes: Default::default(),
3694 }
3695 }
3696
3697 /// Create a builder to help you perform the following task:
3698 ///
3699 /// Lists all GTM Transformations of a GTM container workspace.
3700 ///
3701 /// # Arguments
3702 ///
3703 /// * `parent` - GTM Workspace's API relative path.
3704 pub fn containers_workspaces_transformations_list(
3705 &self,
3706 parent: &str,
3707 ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
3708 AccountContainerWorkspaceTransformationListCall {
3709 hub: self.hub,
3710 _parent: parent.to_string(),
3711 _page_token: Default::default(),
3712 _delegate: Default::default(),
3713 _additional_params: Default::default(),
3714 _scopes: Default::default(),
3715 }
3716 }
3717
3718 /// Create a builder to help you perform the following task:
3719 ///
3720 /// Reverts changes to a GTM Transformation in a GTM Workspace.
3721 ///
3722 /// # Arguments
3723 ///
3724 /// * `path` - GTM Transformation's API relative path.
3725 pub fn containers_workspaces_transformations_revert(
3726 &self,
3727 path: &str,
3728 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
3729 AccountContainerWorkspaceTransformationRevertCall {
3730 hub: self.hub,
3731 _path: path.to_string(),
3732 _fingerprint: Default::default(),
3733 _delegate: Default::default(),
3734 _additional_params: Default::default(),
3735 _scopes: Default::default(),
3736 }
3737 }
3738
3739 /// Create a builder to help you perform the following task:
3740 ///
3741 /// Updates a GTM Transformation.
3742 ///
3743 /// # Arguments
3744 ///
3745 /// * `request` - No description provided.
3746 /// * `path` - GTM Transformation's API relative path.
3747 pub fn containers_workspaces_transformations_update(
3748 &self,
3749 request: Transformation,
3750 path: &str,
3751 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
3752 AccountContainerWorkspaceTransformationUpdateCall {
3753 hub: self.hub,
3754 _request: request,
3755 _path: path.to_string(),
3756 _fingerprint: Default::default(),
3757 _delegate: Default::default(),
3758 _additional_params: Default::default(),
3759 _scopes: Default::default(),
3760 }
3761 }
3762
3763 /// Create a builder to help you perform the following task:
3764 ///
3765 /// Creates a GTM Trigger.
3766 ///
3767 /// # Arguments
3768 ///
3769 /// * `request` - No description provided.
3770 /// * `parent` - GTM Workspace's API relative path.
3771 pub fn containers_workspaces_triggers_create(
3772 &self,
3773 request: Trigger,
3774 parent: &str,
3775 ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
3776 AccountContainerWorkspaceTriggerCreateCall {
3777 hub: self.hub,
3778 _request: request,
3779 _parent: parent.to_string(),
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 /// Deletes a GTM Trigger.
3789 ///
3790 /// # Arguments
3791 ///
3792 /// * `path` - GTM Trigger's API relative path.
3793 pub fn containers_workspaces_triggers_delete(
3794 &self,
3795 path: &str,
3796 ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
3797 AccountContainerWorkspaceTriggerDeleteCall {
3798 hub: self.hub,
3799 _path: path.to_string(),
3800 _delegate: Default::default(),
3801 _additional_params: Default::default(),
3802 _scopes: Default::default(),
3803 }
3804 }
3805
3806 /// Create a builder to help you perform the following task:
3807 ///
3808 /// Gets a GTM Trigger.
3809 ///
3810 /// # Arguments
3811 ///
3812 /// * `path` - GTM Trigger's API relative path.
3813 pub fn containers_workspaces_triggers_get(
3814 &self,
3815 path: &str,
3816 ) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
3817 AccountContainerWorkspaceTriggerGetCall {
3818 hub: self.hub,
3819 _path: path.to_string(),
3820 _delegate: Default::default(),
3821 _additional_params: Default::default(),
3822 _scopes: Default::default(),
3823 }
3824 }
3825
3826 /// Create a builder to help you perform the following task:
3827 ///
3828 /// Lists all GTM Triggers of a Container.
3829 ///
3830 /// # Arguments
3831 ///
3832 /// * `parent` - GTM Workspace's API relative path.
3833 pub fn containers_workspaces_triggers_list(
3834 &self,
3835 parent: &str,
3836 ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
3837 AccountContainerWorkspaceTriggerListCall {
3838 hub: self.hub,
3839 _parent: parent.to_string(),
3840 _page_token: Default::default(),
3841 _delegate: Default::default(),
3842 _additional_params: Default::default(),
3843 _scopes: Default::default(),
3844 }
3845 }
3846
3847 /// Create a builder to help you perform the following task:
3848 ///
3849 /// Reverts changes to a GTM Trigger in a GTM Workspace.
3850 ///
3851 /// # Arguments
3852 ///
3853 /// * `path` - GTM Trigger's API relative path.
3854 pub fn containers_workspaces_triggers_revert(
3855 &self,
3856 path: &str,
3857 ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
3858 AccountContainerWorkspaceTriggerRevertCall {
3859 hub: self.hub,
3860 _path: path.to_string(),
3861 _fingerprint: Default::default(),
3862 _delegate: Default::default(),
3863 _additional_params: Default::default(),
3864 _scopes: Default::default(),
3865 }
3866 }
3867
3868 /// Create a builder to help you perform the following task:
3869 ///
3870 /// Updates a GTM Trigger.
3871 ///
3872 /// # Arguments
3873 ///
3874 /// * `request` - No description provided.
3875 /// * `path` - GTM Trigger's API relative path.
3876 pub fn containers_workspaces_triggers_update(
3877 &self,
3878 request: Trigger,
3879 path: &str,
3880 ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
3881 AccountContainerWorkspaceTriggerUpdateCall {
3882 hub: self.hub,
3883 _request: request,
3884 _path: path.to_string(),
3885 _fingerprint: Default::default(),
3886 _delegate: Default::default(),
3887 _additional_params: Default::default(),
3888 _scopes: Default::default(),
3889 }
3890 }
3891
3892 /// Create a builder to help you perform the following task:
3893 ///
3894 /// Creates a GTM Variable.
3895 ///
3896 /// # Arguments
3897 ///
3898 /// * `request` - No description provided.
3899 /// * `parent` - GTM Workspace's API relative path.
3900 pub fn containers_workspaces_variables_create(
3901 &self,
3902 request: Variable,
3903 parent: &str,
3904 ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
3905 AccountContainerWorkspaceVariableCreateCall {
3906 hub: self.hub,
3907 _request: request,
3908 _parent: parent.to_string(),
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 /// Deletes a GTM Variable.
3918 ///
3919 /// # Arguments
3920 ///
3921 /// * `path` - GTM Variable's API relative path.
3922 pub fn containers_workspaces_variables_delete(
3923 &self,
3924 path: &str,
3925 ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
3926 AccountContainerWorkspaceVariableDeleteCall {
3927 hub: self.hub,
3928 _path: path.to_string(),
3929 _delegate: Default::default(),
3930 _additional_params: Default::default(),
3931 _scopes: Default::default(),
3932 }
3933 }
3934
3935 /// Create a builder to help you perform the following task:
3936 ///
3937 /// Gets a GTM Variable.
3938 ///
3939 /// # Arguments
3940 ///
3941 /// * `path` - GTM Variable's API relative path.
3942 pub fn containers_workspaces_variables_get(
3943 &self,
3944 path: &str,
3945 ) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
3946 AccountContainerWorkspaceVariableGetCall {
3947 hub: self.hub,
3948 _path: path.to_string(),
3949 _delegate: Default::default(),
3950 _additional_params: Default::default(),
3951 _scopes: Default::default(),
3952 }
3953 }
3954
3955 /// Create a builder to help you perform the following task:
3956 ///
3957 /// Lists all GTM Variables of a Container.
3958 ///
3959 /// # Arguments
3960 ///
3961 /// * `parent` - GTM Workspace's API relative path.
3962 pub fn containers_workspaces_variables_list(
3963 &self,
3964 parent: &str,
3965 ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
3966 AccountContainerWorkspaceVariableListCall {
3967 hub: self.hub,
3968 _parent: parent.to_string(),
3969 _page_token: Default::default(),
3970 _delegate: Default::default(),
3971 _additional_params: Default::default(),
3972 _scopes: Default::default(),
3973 }
3974 }
3975
3976 /// Create a builder to help you perform the following task:
3977 ///
3978 /// Reverts changes to a GTM Variable in a GTM Workspace.
3979 ///
3980 /// # Arguments
3981 ///
3982 /// * `path` - GTM Variable's API relative path.
3983 pub fn containers_workspaces_variables_revert(
3984 &self,
3985 path: &str,
3986 ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
3987 AccountContainerWorkspaceVariableRevertCall {
3988 hub: self.hub,
3989 _path: path.to_string(),
3990 _fingerprint: Default::default(),
3991 _delegate: Default::default(),
3992 _additional_params: Default::default(),
3993 _scopes: Default::default(),
3994 }
3995 }
3996
3997 /// Create a builder to help you perform the following task:
3998 ///
3999 /// Updates a GTM Variable.
4000 ///
4001 /// # Arguments
4002 ///
4003 /// * `request` - No description provided.
4004 /// * `path` - GTM Variable's API relative path.
4005 pub fn containers_workspaces_variables_update(
4006 &self,
4007 request: Variable,
4008 path: &str,
4009 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
4010 AccountContainerWorkspaceVariableUpdateCall {
4011 hub: self.hub,
4012 _request: request,
4013 _path: path.to_string(),
4014 _fingerprint: Default::default(),
4015 _delegate: Default::default(),
4016 _additional_params: Default::default(),
4017 _scopes: Default::default(),
4018 }
4019 }
4020
4021 /// Create a builder to help you perform the following task:
4022 ///
4023 /// Creates a GTM Zone.
4024 ///
4025 /// # Arguments
4026 ///
4027 /// * `request` - No description provided.
4028 /// * `parent` - GTM Workspace's API relative path.
4029 pub fn containers_workspaces_zones_create(
4030 &self,
4031 request: Zone,
4032 parent: &str,
4033 ) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
4034 AccountContainerWorkspaceZoneCreateCall {
4035 hub: self.hub,
4036 _request: request,
4037 _parent: parent.to_string(),
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 /// Deletes a GTM Zone.
4047 ///
4048 /// # Arguments
4049 ///
4050 /// * `path` - GTM Zone's API relative path.
4051 pub fn containers_workspaces_zones_delete(
4052 &self,
4053 path: &str,
4054 ) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
4055 AccountContainerWorkspaceZoneDeleteCall {
4056 hub: self.hub,
4057 _path: path.to_string(),
4058 _delegate: Default::default(),
4059 _additional_params: Default::default(),
4060 _scopes: Default::default(),
4061 }
4062 }
4063
4064 /// Create a builder to help you perform the following task:
4065 ///
4066 /// Gets a GTM Zone.
4067 ///
4068 /// # Arguments
4069 ///
4070 /// * `path` - GTM Zone's API relative path.
4071 pub fn containers_workspaces_zones_get(
4072 &self,
4073 path: &str,
4074 ) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
4075 AccountContainerWorkspaceZoneGetCall {
4076 hub: self.hub,
4077 _path: path.to_string(),
4078 _delegate: Default::default(),
4079 _additional_params: Default::default(),
4080 _scopes: Default::default(),
4081 }
4082 }
4083
4084 /// Create a builder to help you perform the following task:
4085 ///
4086 /// Lists all GTM Zones of a GTM container workspace.
4087 ///
4088 /// # Arguments
4089 ///
4090 /// * `parent` - GTM Workspace's API relative path.
4091 pub fn containers_workspaces_zones_list(
4092 &self,
4093 parent: &str,
4094 ) -> AccountContainerWorkspaceZoneListCall<'a, C> {
4095 AccountContainerWorkspaceZoneListCall {
4096 hub: self.hub,
4097 _parent: parent.to_string(),
4098 _page_token: Default::default(),
4099 _delegate: Default::default(),
4100 _additional_params: Default::default(),
4101 _scopes: Default::default(),
4102 }
4103 }
4104
4105 /// Create a builder to help you perform the following task:
4106 ///
4107 /// Reverts changes to a GTM Zone in a GTM Workspace.
4108 ///
4109 /// # Arguments
4110 ///
4111 /// * `path` - GTM Zone's API relative path.
4112 pub fn containers_workspaces_zones_revert(
4113 &self,
4114 path: &str,
4115 ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
4116 AccountContainerWorkspaceZoneRevertCall {
4117 hub: self.hub,
4118 _path: path.to_string(),
4119 _fingerprint: Default::default(),
4120 _delegate: Default::default(),
4121 _additional_params: Default::default(),
4122 _scopes: Default::default(),
4123 }
4124 }
4125
4126 /// Create a builder to help you perform the following task:
4127 ///
4128 /// Updates a GTM Zone.
4129 ///
4130 /// # Arguments
4131 ///
4132 /// * `request` - No description provided.
4133 /// * `path` - GTM Zone's API relative path.
4134 pub fn containers_workspaces_zones_update(
4135 &self,
4136 request: Zone,
4137 path: &str,
4138 ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
4139 AccountContainerWorkspaceZoneUpdateCall {
4140 hub: self.hub,
4141 _request: request,
4142 _path: path.to_string(),
4143 _fingerprint: Default::default(),
4144 _delegate: Default::default(),
4145 _additional_params: Default::default(),
4146 _scopes: Default::default(),
4147 }
4148 }
4149
4150 /// Create a builder to help you perform the following task:
4151 ///
4152 /// Applies multiple entity changes to a workspace in one call. When creating new entities, their entity IDs must be unique and in correct format. That is, they must start with "new_" and followed by number, e.g. "new_1", "new_2". Example body snippet to create myNewTag under myNewFolder is: ``` "changes": [ { "folder": { "folderId": "new_1", "name": "myNewFolder", ... }, "changeStatus": "added" }, { "tag": { "tagId": "new_2", "name": "myNewTag", "parentFolderId": "new_1", ... }, "changeStatus": "added" } ] ```
4153 ///
4154 /// # Arguments
4155 ///
4156 /// * `request` - No description provided.
4157 /// * `path` - GTM Workspace's API relative path.
4158 pub fn containers_workspaces_bulk_update(
4159 &self,
4160 request: ProposedChange,
4161 path: &str,
4162 ) -> AccountContainerWorkspaceBulkUpdateCall<'a, C> {
4163 AccountContainerWorkspaceBulkUpdateCall {
4164 hub: self.hub,
4165 _request: request,
4166 _path: path.to_string(),
4167 _delegate: Default::default(),
4168 _additional_params: Default::default(),
4169 _scopes: Default::default(),
4170 }
4171 }
4172
4173 /// Create a builder to help you perform the following task:
4174 ///
4175 /// Creates a Workspace.
4176 ///
4177 /// # Arguments
4178 ///
4179 /// * `request` - No description provided.
4180 /// * `parent` - GTM parent Container's API relative path.
4181 pub fn containers_workspaces_create(
4182 &self,
4183 request: Workspace,
4184 parent: &str,
4185 ) -> AccountContainerWorkspaceCreateCall<'a, C> {
4186 AccountContainerWorkspaceCreateCall {
4187 hub: self.hub,
4188 _request: request,
4189 _parent: parent.to_string(),
4190 _delegate: Default::default(),
4191 _additional_params: Default::default(),
4192 _scopes: Default::default(),
4193 }
4194 }
4195
4196 /// Create a builder to help you perform the following task:
4197 ///
4198 /// 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.
4199 ///
4200 /// # Arguments
4201 ///
4202 /// * `request` - No description provided.
4203 /// * `path` - GTM Workspace's API relative path.
4204 pub fn containers_workspaces_create_version(
4205 &self,
4206 request: CreateContainerVersionRequestVersionOptions,
4207 path: &str,
4208 ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
4209 AccountContainerWorkspaceCreateVersionCall {
4210 hub: self.hub,
4211 _request: request,
4212 _path: path.to_string(),
4213 _delegate: Default::default(),
4214 _additional_params: Default::default(),
4215 _scopes: Default::default(),
4216 }
4217 }
4218
4219 /// Create a builder to help you perform the following task:
4220 ///
4221 /// Deletes a Workspace.
4222 ///
4223 /// # Arguments
4224 ///
4225 /// * `path` - GTM Workspace's API relative path.
4226 pub fn containers_workspaces_delete(
4227 &self,
4228 path: &str,
4229 ) -> AccountContainerWorkspaceDeleteCall<'a, C> {
4230 AccountContainerWorkspaceDeleteCall {
4231 hub: self.hub,
4232 _path: path.to_string(),
4233 _delegate: Default::default(),
4234 _additional_params: Default::default(),
4235 _scopes: Default::default(),
4236 }
4237 }
4238
4239 /// Create a builder to help you perform the following task:
4240 ///
4241 /// Gets a Workspace.
4242 ///
4243 /// # Arguments
4244 ///
4245 /// * `path` - GTM Workspace's API relative path.
4246 pub fn containers_workspaces_get(&self, path: &str) -> AccountContainerWorkspaceGetCall<'a, C> {
4247 AccountContainerWorkspaceGetCall {
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 /// Finds conflicting and modified entities in the workspace.
4259 ///
4260 /// # Arguments
4261 ///
4262 /// * `path` - GTM Workspace's API relative path.
4263 pub fn containers_workspaces_get_status(
4264 &self,
4265 path: &str,
4266 ) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
4267 AccountContainerWorkspaceGetStatuCall {
4268 hub: self.hub,
4269 _path: path.to_string(),
4270 _delegate: Default::default(),
4271 _additional_params: Default::default(),
4272 _scopes: Default::default(),
4273 }
4274 }
4275
4276 /// Create a builder to help you perform the following task:
4277 ///
4278 /// Lists all Workspaces that belong to a GTM Container.
4279 ///
4280 /// # Arguments
4281 ///
4282 /// * `parent` - GTM parent Container's API relative path.
4283 pub fn containers_workspaces_list(
4284 &self,
4285 parent: &str,
4286 ) -> AccountContainerWorkspaceListCall<'a, C> {
4287 AccountContainerWorkspaceListCall {
4288 hub: self.hub,
4289 _parent: parent.to_string(),
4290 _page_token: Default::default(),
4291 _delegate: Default::default(),
4292 _additional_params: Default::default(),
4293 _scopes: Default::default(),
4294 }
4295 }
4296
4297 /// Create a builder to help you perform the following task:
4298 ///
4299 /// Quick previews a workspace by creating a fake container version from all entities in the provided workspace.
4300 ///
4301 /// # Arguments
4302 ///
4303 /// * `path` - GTM Workspace's API relative path.
4304 pub fn containers_workspaces_quick_preview(
4305 &self,
4306 path: &str,
4307 ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
4308 AccountContainerWorkspaceQuickPreviewCall {
4309 hub: self.hub,
4310 _path: path.to_string(),
4311 _delegate: Default::default(),
4312 _additional_params: Default::default(),
4313 _scopes: Default::default(),
4314 }
4315 }
4316
4317 /// Create a builder to help you perform the following task:
4318 ///
4319 /// Resolves a merge conflict for a workspace entity by updating it to the resolved entity passed in the request.
4320 ///
4321 /// # Arguments
4322 ///
4323 /// * `request` - No description provided.
4324 /// * `path` - GTM Workspace's API relative path.
4325 pub fn containers_workspaces_resolve_conflict(
4326 &self,
4327 request: Entity,
4328 path: &str,
4329 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
4330 AccountContainerWorkspaceResolveConflictCall {
4331 hub: self.hub,
4332 _request: request,
4333 _path: path.to_string(),
4334 _fingerprint: Default::default(),
4335 _delegate: Default::default(),
4336 _additional_params: Default::default(),
4337 _scopes: Default::default(),
4338 }
4339 }
4340
4341 /// Create a builder to help you perform the following task:
4342 ///
4343 /// Syncs a workspace to the latest container version by updating all unmodified workspace entities and displaying conflicts for modified entities.
4344 ///
4345 /// # Arguments
4346 ///
4347 /// * `path` - GTM Workspace's API relative path.
4348 pub fn containers_workspaces_sync(
4349 &self,
4350 path: &str,
4351 ) -> AccountContainerWorkspaceSyncCall<'a, C> {
4352 AccountContainerWorkspaceSyncCall {
4353 hub: self.hub,
4354 _path: path.to_string(),
4355 _delegate: Default::default(),
4356 _additional_params: Default::default(),
4357 _scopes: Default::default(),
4358 }
4359 }
4360
4361 /// Create a builder to help you perform the following task:
4362 ///
4363 /// Updates a Workspace.
4364 ///
4365 /// # Arguments
4366 ///
4367 /// * `request` - No description provided.
4368 /// * `path` - GTM Workspace's API relative path.
4369 pub fn containers_workspaces_update(
4370 &self,
4371 request: Workspace,
4372 path: &str,
4373 ) -> AccountContainerWorkspaceUpdateCall<'a, C> {
4374 AccountContainerWorkspaceUpdateCall {
4375 hub: self.hub,
4376 _request: request,
4377 _path: path.to_string(),
4378 _fingerprint: Default::default(),
4379 _delegate: Default::default(),
4380 _additional_params: Default::default(),
4381 _scopes: Default::default(),
4382 }
4383 }
4384
4385 /// Create a builder to help you perform the following task:
4386 ///
4387 /// Combines Containers.
4388 ///
4389 /// # Arguments
4390 ///
4391 /// * `path` - GTM Container's API relative path.
4392 pub fn containers_combine(&self, path: &str) -> AccountContainerCombineCall<'a, C> {
4393 AccountContainerCombineCall {
4394 hub: self.hub,
4395 _path: path.to_string(),
4396 _setting_source: Default::default(),
4397 _container_id: Default::default(),
4398 _allow_user_permission_feature_update: Default::default(),
4399 _delegate: Default::default(),
4400 _additional_params: Default::default(),
4401 _scopes: Default::default(),
4402 }
4403 }
4404
4405 /// Create a builder to help you perform the following task:
4406 ///
4407 /// Creates a Container.
4408 ///
4409 /// # Arguments
4410 ///
4411 /// * `request` - No description provided.
4412 /// * `parent` - GTM Account's API relative path.
4413 pub fn containers_create(
4414 &self,
4415 request: Container,
4416 parent: &str,
4417 ) -> AccountContainerCreateCall<'a, C> {
4418 AccountContainerCreateCall {
4419 hub: self.hub,
4420 _request: request,
4421 _parent: parent.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 /// Deletes a Container.
4431 ///
4432 /// # Arguments
4433 ///
4434 /// * `path` - GTM Container's API relative path.
4435 pub fn containers_delete(&self, path: &str) -> AccountContainerDeleteCall<'a, C> {
4436 AccountContainerDeleteCall {
4437 hub: self.hub,
4438 _path: path.to_string(),
4439 _delegate: Default::default(),
4440 _additional_params: Default::default(),
4441 _scopes: Default::default(),
4442 }
4443 }
4444
4445 /// Create a builder to help you perform the following task:
4446 ///
4447 /// Gets a Container.
4448 ///
4449 /// # Arguments
4450 ///
4451 /// * `path` - GTM Container's API relative path.
4452 pub fn containers_get(&self, path: &str) -> AccountContainerGetCall<'a, C> {
4453 AccountContainerGetCall {
4454 hub: self.hub,
4455 _path: path.to_string(),
4456 _delegate: Default::default(),
4457 _additional_params: Default::default(),
4458 _scopes: Default::default(),
4459 }
4460 }
4461
4462 /// Create a builder to help you perform the following task:
4463 ///
4464 /// Lists all Containers that belongs to a GTM Account.
4465 ///
4466 /// # Arguments
4467 ///
4468 /// * `parent` - GTM Account's API relative path.
4469 pub fn containers_list(&self, parent: &str) -> AccountContainerListCall<'a, C> {
4470 AccountContainerListCall {
4471 hub: self.hub,
4472 _parent: parent.to_string(),
4473 _page_token: Default::default(),
4474 _delegate: Default::default(),
4475 _additional_params: Default::default(),
4476 _scopes: Default::default(),
4477 }
4478 }
4479
4480 /// Create a builder to help you perform the following task:
4481 ///
4482 /// Looks up a Container by destination ID or tag ID.
4483 pub fn containers_lookup(&self) -> AccountContainerLookupCall<'a, C> {
4484 AccountContainerLookupCall {
4485 hub: self.hub,
4486 _tag_id: Default::default(),
4487 _destination_id: Default::default(),
4488 _delegate: Default::default(),
4489 _additional_params: Default::default(),
4490 _scopes: Default::default(),
4491 }
4492 }
4493
4494 /// Create a builder to help you perform the following task:
4495 ///
4496 /// Move Tag ID out of a Container.
4497 ///
4498 /// # Arguments
4499 ///
4500 /// * `path` - GTM Container's API relative path.
4501 pub fn containers_move_tag_id(&self, path: &str) -> AccountContainerMoveTagIdCall<'a, C> {
4502 AccountContainerMoveTagIdCall {
4503 hub: self.hub,
4504 _path: path.to_string(),
4505 _tag_name: Default::default(),
4506 _tag_id: Default::default(),
4507 _copy_users: Default::default(),
4508 _copy_terms_of_service: Default::default(),
4509 _copy_settings: Default::default(),
4510 _allow_user_permission_feature_update: Default::default(),
4511 _delegate: Default::default(),
4512 _additional_params: Default::default(),
4513 _scopes: Default::default(),
4514 }
4515 }
4516
4517 /// Create a builder to help you perform the following task:
4518 ///
4519 /// Gets the tagging snippet for a Container.
4520 ///
4521 /// # Arguments
4522 ///
4523 /// * `path` - Container snippet's API relative path.
4524 pub fn containers_snippet(&self, path: &str) -> AccountContainerSnippetCall<'a, C> {
4525 AccountContainerSnippetCall {
4526 hub: self.hub,
4527 _path: path.to_string(),
4528 _delegate: Default::default(),
4529 _additional_params: Default::default(),
4530 _scopes: Default::default(),
4531 }
4532 }
4533
4534 /// Create a builder to help you perform the following task:
4535 ///
4536 /// Updates a Container.
4537 ///
4538 /// # Arguments
4539 ///
4540 /// * `request` - No description provided.
4541 /// * `path` - GTM Container's API relative path.
4542 pub fn containers_update(
4543 &self,
4544 request: Container,
4545 path: &str,
4546 ) -> AccountContainerUpdateCall<'a, C> {
4547 AccountContainerUpdateCall {
4548 hub: self.hub,
4549 _request: request,
4550 _path: path.to_string(),
4551 _fingerprint: Default::default(),
4552 _delegate: Default::default(),
4553 _additional_params: Default::default(),
4554 _scopes: Default::default(),
4555 }
4556 }
4557
4558 /// Create a builder to help you perform the following task:
4559 ///
4560 /// Creates a user's Account & Container access.
4561 ///
4562 /// # Arguments
4563 ///
4564 /// * `request` - No description provided.
4565 /// * `parent` - GTM Account's API relative path.
4566 pub fn user_permissions_create(
4567 &self,
4568 request: UserPermission,
4569 parent: &str,
4570 ) -> AccountUserPermissionCreateCall<'a, C> {
4571 AccountUserPermissionCreateCall {
4572 hub: self.hub,
4573 _request: request,
4574 _parent: parent.to_string(),
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 /// Removes a user from the account, revoking access to it and all of its containers.
4584 ///
4585 /// # Arguments
4586 ///
4587 /// * `path` - GTM UserPermission's API relative path.
4588 pub fn user_permissions_delete(&self, path: &str) -> AccountUserPermissionDeleteCall<'a, C> {
4589 AccountUserPermissionDeleteCall {
4590 hub: self.hub,
4591 _path: path.to_string(),
4592 _delegate: Default::default(),
4593 _additional_params: Default::default(),
4594 _scopes: Default::default(),
4595 }
4596 }
4597
4598 /// Create a builder to help you perform the following task:
4599 ///
4600 /// Gets a user's Account & Container access.
4601 ///
4602 /// # Arguments
4603 ///
4604 /// * `path` - GTM UserPermission's API relative path.
4605 pub fn user_permissions_get(&self, path: &str) -> AccountUserPermissionGetCall<'a, C> {
4606 AccountUserPermissionGetCall {
4607 hub: self.hub,
4608 _path: path.to_string(),
4609 _delegate: Default::default(),
4610 _additional_params: Default::default(),
4611 _scopes: Default::default(),
4612 }
4613 }
4614
4615 /// Create a builder to help you perform the following task:
4616 ///
4617 /// List all users that have access to the account along with Account and Container user access granted to each of them.
4618 ///
4619 /// # Arguments
4620 ///
4621 /// * `parent` - GTM Account's API relative path.
4622 pub fn user_permissions_list(&self, parent: &str) -> AccountUserPermissionListCall<'a, C> {
4623 AccountUserPermissionListCall {
4624 hub: self.hub,
4625 _parent: parent.to_string(),
4626 _page_token: Default::default(),
4627 _delegate: Default::default(),
4628 _additional_params: Default::default(),
4629 _scopes: Default::default(),
4630 }
4631 }
4632
4633 /// Create a builder to help you perform the following task:
4634 ///
4635 /// Updates a user's Account & Container access.
4636 ///
4637 /// # Arguments
4638 ///
4639 /// * `request` - No description provided.
4640 /// * `path` - GTM UserPermission's API relative path.
4641 pub fn user_permissions_update(
4642 &self,
4643 request: UserPermission,
4644 path: &str,
4645 ) -> AccountUserPermissionUpdateCall<'a, C> {
4646 AccountUserPermissionUpdateCall {
4647 hub: self.hub,
4648 _request: request,
4649 _path: path.to_string(),
4650 _delegate: Default::default(),
4651 _additional_params: Default::default(),
4652 _scopes: Default::default(),
4653 }
4654 }
4655
4656 /// Create a builder to help you perform the following task:
4657 ///
4658 /// Gets a GTM Account.
4659 ///
4660 /// # Arguments
4661 ///
4662 /// * `path` - GTM Account's API relative path.
4663 pub fn get(&self, path: &str) -> AccountGetCall<'a, C> {
4664 AccountGetCall {
4665 hub: self.hub,
4666 _path: path.to_string(),
4667 _delegate: Default::default(),
4668 _additional_params: Default::default(),
4669 _scopes: Default::default(),
4670 }
4671 }
4672
4673 /// Create a builder to help you perform the following task:
4674 ///
4675 /// Lists all GTM Accounts that a user has access to.
4676 pub fn list(&self) -> AccountListCall<'a, C> {
4677 AccountListCall {
4678 hub: self.hub,
4679 _page_token: Default::default(),
4680 _include_google_tags: Default::default(),
4681 _delegate: Default::default(),
4682 _additional_params: Default::default(),
4683 _scopes: Default::default(),
4684 }
4685 }
4686
4687 /// Create a builder to help you perform the following task:
4688 ///
4689 /// Updates a GTM Account.
4690 ///
4691 /// # Arguments
4692 ///
4693 /// * `request` - No description provided.
4694 /// * `path` - GTM Account's API relative path.
4695 pub fn update(&self, request: Account, path: &str) -> AccountUpdateCall<'a, C> {
4696 AccountUpdateCall {
4697 hub: self.hub,
4698 _request: request,
4699 _path: path.to_string(),
4700 _fingerprint: Default::default(),
4701 _delegate: Default::default(),
4702 _additional_params: Default::default(),
4703 _scopes: Default::default(),
4704 }
4705 }
4706}
4707
4708// ###################
4709// CallBuilders ###
4710// #################
4711
4712/// Gets a Destination.
4713///
4714/// A builder for the *containers.destinations.get* method supported by a *account* resource.
4715/// It is not used directly, but through a [`AccountMethods`] instance.
4716///
4717/// # Example
4718///
4719/// Instantiate a resource method builder
4720///
4721/// ```test_harness,no_run
4722/// # extern crate hyper;
4723/// # extern crate hyper_rustls;
4724/// # extern crate google_tagmanager2 as tagmanager2;
4725/// # async fn dox() {
4726/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4727///
4728/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4729/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4730/// # .with_native_roots()
4731/// # .unwrap()
4732/// # .https_only()
4733/// # .enable_http2()
4734/// # .build();
4735///
4736/// # let executor = hyper_util::rt::TokioExecutor::new();
4737/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4738/// # secret,
4739/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4740/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4741/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4742/// # ),
4743/// # ).build().await.unwrap();
4744///
4745/// # let client = hyper_util::client::legacy::Client::builder(
4746/// # hyper_util::rt::TokioExecutor::new()
4747/// # )
4748/// # .build(
4749/// # hyper_rustls::HttpsConnectorBuilder::new()
4750/// # .with_native_roots()
4751/// # .unwrap()
4752/// # .https_or_http()
4753/// # .enable_http2()
4754/// # .build()
4755/// # );
4756/// # let mut hub = TagManager::new(client, auth);
4757/// // You can configure optional parameters by calling the respective setters at will, and
4758/// // execute the final call using `doit()`.
4759/// // Values shown here are possibly random and not representative !
4760/// let result = hub.accounts().containers_destinations_get("path")
4761/// .doit().await;
4762/// # }
4763/// ```
4764pub struct AccountContainerDestinationGetCall<'a, C>
4765where
4766 C: 'a,
4767{
4768 hub: &'a TagManager<C>,
4769 _path: String,
4770 _delegate: Option<&'a mut dyn common::Delegate>,
4771 _additional_params: HashMap<String, String>,
4772 _scopes: BTreeSet<String>,
4773}
4774
4775impl<'a, C> common::CallBuilder for AccountContainerDestinationGetCall<'a, C> {}
4776
4777impl<'a, C> AccountContainerDestinationGetCall<'a, C>
4778where
4779 C: common::Connector,
4780{
4781 /// Perform the operation you have build so far.
4782 pub async fn doit(mut self) -> common::Result<(common::Response, Destination)> {
4783 use std::borrow::Cow;
4784 use std::io::{Read, Seek};
4785
4786 use common::{url::Params, ToParts};
4787 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4788
4789 let mut dd = common::DefaultDelegate;
4790 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4791 dlg.begin(common::MethodInfo {
4792 id: "tagmanager.accounts.containers.destinations.get",
4793 http_method: hyper::Method::GET,
4794 });
4795
4796 for &field in ["alt", "path"].iter() {
4797 if self._additional_params.contains_key(field) {
4798 dlg.finished(false);
4799 return Err(common::Error::FieldClash(field));
4800 }
4801 }
4802
4803 let mut params = Params::with_capacity(3 + self._additional_params.len());
4804 params.push("path", self._path);
4805
4806 params.extend(self._additional_params.iter());
4807
4808 params.push("alt", "json");
4809 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
4810 if self._scopes.is_empty() {
4811 self._scopes.insert(Scope::Readonly.as_ref().to_string());
4812 }
4813
4814 #[allow(clippy::single_element_loop)]
4815 for &(find_this, param_name) in [("{+path}", "path")].iter() {
4816 url = params.uri_replacement(url, param_name, find_this, true);
4817 }
4818 {
4819 let to_remove = ["path"];
4820 params.remove_params(&to_remove);
4821 }
4822
4823 let url = params.parse_with_url(&url);
4824
4825 loop {
4826 let token = match self
4827 .hub
4828 .auth
4829 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4830 .await
4831 {
4832 Ok(token) => token,
4833 Err(e) => match dlg.token(e) {
4834 Ok(token) => token,
4835 Err(e) => {
4836 dlg.finished(false);
4837 return Err(common::Error::MissingToken(e));
4838 }
4839 },
4840 };
4841 let mut req_result = {
4842 let client = &self.hub.client;
4843 dlg.pre_request();
4844 let mut req_builder = hyper::Request::builder()
4845 .method(hyper::Method::GET)
4846 .uri(url.as_str())
4847 .header(USER_AGENT, self.hub._user_agent.clone());
4848
4849 if let Some(token) = token.as_ref() {
4850 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4851 }
4852
4853 let request = req_builder
4854 .header(CONTENT_LENGTH, 0_u64)
4855 .body(common::to_body::<String>(None));
4856
4857 client.request(request.unwrap()).await
4858 };
4859
4860 match req_result {
4861 Err(err) => {
4862 if let common::Retry::After(d) = dlg.http_error(&err) {
4863 sleep(d).await;
4864 continue;
4865 }
4866 dlg.finished(false);
4867 return Err(common::Error::HttpError(err));
4868 }
4869 Ok(res) => {
4870 let (mut parts, body) = res.into_parts();
4871 let mut body = common::Body::new(body);
4872 if !parts.status.is_success() {
4873 let bytes = common::to_bytes(body).await.unwrap_or_default();
4874 let error = serde_json::from_str(&common::to_string(&bytes));
4875 let response = common::to_response(parts, bytes.into());
4876
4877 if let common::Retry::After(d) =
4878 dlg.http_failure(&response, error.as_ref().ok())
4879 {
4880 sleep(d).await;
4881 continue;
4882 }
4883
4884 dlg.finished(false);
4885
4886 return Err(match error {
4887 Ok(value) => common::Error::BadRequest(value),
4888 _ => common::Error::Failure(response),
4889 });
4890 }
4891 let response = {
4892 let bytes = common::to_bytes(body).await.unwrap_or_default();
4893 let encoded = common::to_string(&bytes);
4894 match serde_json::from_str(&encoded) {
4895 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4896 Err(error) => {
4897 dlg.response_json_decode_error(&encoded, &error);
4898 return Err(common::Error::JsonDecodeError(
4899 encoded.to_string(),
4900 error,
4901 ));
4902 }
4903 }
4904 };
4905
4906 dlg.finished(true);
4907 return Ok(response);
4908 }
4909 }
4910 }
4911 }
4912
4913 /// Google Tag Destination's API relative path.
4914 ///
4915 /// Sets the *path* path property to the given value.
4916 ///
4917 /// Even though the property as already been set when instantiating this call,
4918 /// we provide this method for API completeness.
4919 pub fn path(mut self, new_value: &str) -> AccountContainerDestinationGetCall<'a, C> {
4920 self._path = new_value.to_string();
4921 self
4922 }
4923 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4924 /// while executing the actual API request.
4925 ///
4926 /// ````text
4927 /// It should be used to handle progress information, and to implement a certain level of resilience.
4928 /// ````
4929 ///
4930 /// Sets the *delegate* property to the given value.
4931 pub fn delegate(
4932 mut self,
4933 new_value: &'a mut dyn common::Delegate,
4934 ) -> AccountContainerDestinationGetCall<'a, C> {
4935 self._delegate = Some(new_value);
4936 self
4937 }
4938
4939 /// Set any additional parameter of the query string used in the request.
4940 /// It should be used to set parameters which are not yet available through their own
4941 /// setters.
4942 ///
4943 /// Please note that this method must not be used to set any of the known parameters
4944 /// which have their own setter method. If done anyway, the request will fail.
4945 ///
4946 /// # Additional Parameters
4947 ///
4948 /// * *$.xgafv* (query-string) - V1 error format.
4949 /// * *access_token* (query-string) - OAuth access token.
4950 /// * *alt* (query-string) - Data format for response.
4951 /// * *callback* (query-string) - JSONP
4952 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4953 /// * *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.
4954 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4955 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4956 /// * *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.
4957 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4958 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4959 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationGetCall<'a, C>
4960 where
4961 T: AsRef<str>,
4962 {
4963 self._additional_params
4964 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4965 self
4966 }
4967
4968 /// Identifies the authorization scope for the method you are building.
4969 ///
4970 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4971 /// [`Scope::Readonly`].
4972 ///
4973 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4974 /// tokens for more than one scope.
4975 ///
4976 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4977 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4978 /// sufficient, a read-write scope will do as well.
4979 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationGetCall<'a, C>
4980 where
4981 St: AsRef<str>,
4982 {
4983 self._scopes.insert(String::from(scope.as_ref()));
4984 self
4985 }
4986 /// Identifies the authorization scope(s) for the method you are building.
4987 ///
4988 /// See [`Self::add_scope()`] for details.
4989 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationGetCall<'a, C>
4990 where
4991 I: IntoIterator<Item = St>,
4992 St: AsRef<str>,
4993 {
4994 self._scopes
4995 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4996 self
4997 }
4998
4999 /// Removes all scopes, and no default scope will be used either.
5000 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5001 /// for details).
5002 pub fn clear_scopes(mut self) -> AccountContainerDestinationGetCall<'a, C> {
5003 self._scopes.clear();
5004 self
5005 }
5006}
5007
5008/// Adds a Destination to this Container and removes it from the Container to which it is currently linked.
5009///
5010/// A builder for the *containers.destinations.link* method supported by a *account* resource.
5011/// It is not used directly, but through a [`AccountMethods`] instance.
5012///
5013/// # Example
5014///
5015/// Instantiate a resource method builder
5016///
5017/// ```test_harness,no_run
5018/// # extern crate hyper;
5019/// # extern crate hyper_rustls;
5020/// # extern crate google_tagmanager2 as tagmanager2;
5021/// # async fn dox() {
5022/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5023///
5024/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5025/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5026/// # .with_native_roots()
5027/// # .unwrap()
5028/// # .https_only()
5029/// # .enable_http2()
5030/// # .build();
5031///
5032/// # let executor = hyper_util::rt::TokioExecutor::new();
5033/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5034/// # secret,
5035/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5036/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5037/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5038/// # ),
5039/// # ).build().await.unwrap();
5040///
5041/// # let client = hyper_util::client::legacy::Client::builder(
5042/// # hyper_util::rt::TokioExecutor::new()
5043/// # )
5044/// # .build(
5045/// # hyper_rustls::HttpsConnectorBuilder::new()
5046/// # .with_native_roots()
5047/// # .unwrap()
5048/// # .https_or_http()
5049/// # .enable_http2()
5050/// # .build()
5051/// # );
5052/// # let mut hub = TagManager::new(client, auth);
5053/// // You can configure optional parameters by calling the respective setters at will, and
5054/// // execute the final call using `doit()`.
5055/// // Values shown here are possibly random and not representative !
5056/// let result = hub.accounts().containers_destinations_link("parent")
5057/// .destination_id("ea")
5058/// .allow_user_permission_feature_update(false)
5059/// .doit().await;
5060/// # }
5061/// ```
5062pub struct AccountContainerDestinationLinkCall<'a, C>
5063where
5064 C: 'a,
5065{
5066 hub: &'a TagManager<C>,
5067 _parent: String,
5068 _destination_id: Option<String>,
5069 _allow_user_permission_feature_update: Option<bool>,
5070 _delegate: Option<&'a mut dyn common::Delegate>,
5071 _additional_params: HashMap<String, String>,
5072 _scopes: BTreeSet<String>,
5073}
5074
5075impl<'a, C> common::CallBuilder for AccountContainerDestinationLinkCall<'a, C> {}
5076
5077impl<'a, C> AccountContainerDestinationLinkCall<'a, C>
5078where
5079 C: common::Connector,
5080{
5081 /// Perform the operation you have build so far.
5082 pub async fn doit(mut self) -> common::Result<(common::Response, Destination)> {
5083 use std::borrow::Cow;
5084 use std::io::{Read, Seek};
5085
5086 use common::{url::Params, ToParts};
5087 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5088
5089 let mut dd = common::DefaultDelegate;
5090 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5091 dlg.begin(common::MethodInfo {
5092 id: "tagmanager.accounts.containers.destinations.link",
5093 http_method: hyper::Method::POST,
5094 });
5095
5096 for &field in [
5097 "alt",
5098 "parent",
5099 "destinationId",
5100 "allowUserPermissionFeatureUpdate",
5101 ]
5102 .iter()
5103 {
5104 if self._additional_params.contains_key(field) {
5105 dlg.finished(false);
5106 return Err(common::Error::FieldClash(field));
5107 }
5108 }
5109
5110 let mut params = Params::with_capacity(5 + self._additional_params.len());
5111 params.push("parent", self._parent);
5112 if let Some(value) = self._destination_id.as_ref() {
5113 params.push("destinationId", value);
5114 }
5115 if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
5116 params.push("allowUserPermissionFeatureUpdate", value.to_string());
5117 }
5118
5119 params.extend(self._additional_params.iter());
5120
5121 params.push("alt", "json");
5122 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/destinations:link";
5123 if self._scopes.is_empty() {
5124 self._scopes
5125 .insert(Scope::EditContainer.as_ref().to_string());
5126 }
5127
5128 #[allow(clippy::single_element_loop)]
5129 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5130 url = params.uri_replacement(url, param_name, find_this, true);
5131 }
5132 {
5133 let to_remove = ["parent"];
5134 params.remove_params(&to_remove);
5135 }
5136
5137 let url = params.parse_with_url(&url);
5138
5139 loop {
5140 let token = match self
5141 .hub
5142 .auth
5143 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5144 .await
5145 {
5146 Ok(token) => token,
5147 Err(e) => match dlg.token(e) {
5148 Ok(token) => token,
5149 Err(e) => {
5150 dlg.finished(false);
5151 return Err(common::Error::MissingToken(e));
5152 }
5153 },
5154 };
5155 let mut req_result = {
5156 let client = &self.hub.client;
5157 dlg.pre_request();
5158 let mut req_builder = hyper::Request::builder()
5159 .method(hyper::Method::POST)
5160 .uri(url.as_str())
5161 .header(USER_AGENT, self.hub._user_agent.clone());
5162
5163 if let Some(token) = token.as_ref() {
5164 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5165 }
5166
5167 let request = req_builder
5168 .header(CONTENT_LENGTH, 0_u64)
5169 .body(common::to_body::<String>(None));
5170
5171 client.request(request.unwrap()).await
5172 };
5173
5174 match req_result {
5175 Err(err) => {
5176 if let common::Retry::After(d) = dlg.http_error(&err) {
5177 sleep(d).await;
5178 continue;
5179 }
5180 dlg.finished(false);
5181 return Err(common::Error::HttpError(err));
5182 }
5183 Ok(res) => {
5184 let (mut parts, body) = res.into_parts();
5185 let mut body = common::Body::new(body);
5186 if !parts.status.is_success() {
5187 let bytes = common::to_bytes(body).await.unwrap_or_default();
5188 let error = serde_json::from_str(&common::to_string(&bytes));
5189 let response = common::to_response(parts, bytes.into());
5190
5191 if let common::Retry::After(d) =
5192 dlg.http_failure(&response, error.as_ref().ok())
5193 {
5194 sleep(d).await;
5195 continue;
5196 }
5197
5198 dlg.finished(false);
5199
5200 return Err(match error {
5201 Ok(value) => common::Error::BadRequest(value),
5202 _ => common::Error::Failure(response),
5203 });
5204 }
5205 let response = {
5206 let bytes = common::to_bytes(body).await.unwrap_or_default();
5207 let encoded = common::to_string(&bytes);
5208 match serde_json::from_str(&encoded) {
5209 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5210 Err(error) => {
5211 dlg.response_json_decode_error(&encoded, &error);
5212 return Err(common::Error::JsonDecodeError(
5213 encoded.to_string(),
5214 error,
5215 ));
5216 }
5217 }
5218 };
5219
5220 dlg.finished(true);
5221 return Ok(response);
5222 }
5223 }
5224 }
5225 }
5226
5227 /// GTM parent Container's API relative path.
5228 ///
5229 /// Sets the *parent* path property to the given value.
5230 ///
5231 /// Even though the property as already been set when instantiating this call,
5232 /// we provide this method for API completeness.
5233 pub fn parent(mut self, new_value: &str) -> AccountContainerDestinationLinkCall<'a, C> {
5234 self._parent = new_value.to_string();
5235 self
5236 }
5237 /// Destination ID to be linked to the current container.
5238 ///
5239 /// Sets the *destination id* query property to the given value.
5240 pub fn destination_id(mut self, new_value: &str) -> AccountContainerDestinationLinkCall<'a, C> {
5241 self._destination_id = Some(new_value.to_string());
5242 self
5243 }
5244 /// 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.
5245 ///
5246 /// Sets the *allow user permission feature update* query property to the given value.
5247 pub fn allow_user_permission_feature_update(
5248 mut self,
5249 new_value: bool,
5250 ) -> AccountContainerDestinationLinkCall<'a, C> {
5251 self._allow_user_permission_feature_update = Some(new_value);
5252 self
5253 }
5254 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5255 /// while executing the actual API request.
5256 ///
5257 /// ````text
5258 /// It should be used to handle progress information, and to implement a certain level of resilience.
5259 /// ````
5260 ///
5261 /// Sets the *delegate* property to the given value.
5262 pub fn delegate(
5263 mut self,
5264 new_value: &'a mut dyn common::Delegate,
5265 ) -> AccountContainerDestinationLinkCall<'a, C> {
5266 self._delegate = Some(new_value);
5267 self
5268 }
5269
5270 /// Set any additional parameter of the query string used in the request.
5271 /// It should be used to set parameters which are not yet available through their own
5272 /// setters.
5273 ///
5274 /// Please note that this method must not be used to set any of the known parameters
5275 /// which have their own setter method. If done anyway, the request will fail.
5276 ///
5277 /// # Additional Parameters
5278 ///
5279 /// * *$.xgafv* (query-string) - V1 error format.
5280 /// * *access_token* (query-string) - OAuth access token.
5281 /// * *alt* (query-string) - Data format for response.
5282 /// * *callback* (query-string) - JSONP
5283 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5284 /// * *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.
5285 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5286 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5287 /// * *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.
5288 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5289 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5290 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationLinkCall<'a, C>
5291 where
5292 T: AsRef<str>,
5293 {
5294 self._additional_params
5295 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5296 self
5297 }
5298
5299 /// Identifies the authorization scope for the method you are building.
5300 ///
5301 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5302 /// [`Scope::EditContainer`].
5303 ///
5304 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5305 /// tokens for more than one scope.
5306 ///
5307 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5308 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5309 /// sufficient, a read-write scope will do as well.
5310 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationLinkCall<'a, C>
5311 where
5312 St: AsRef<str>,
5313 {
5314 self._scopes.insert(String::from(scope.as_ref()));
5315 self
5316 }
5317 /// Identifies the authorization scope(s) for the method you are building.
5318 ///
5319 /// See [`Self::add_scope()`] for details.
5320 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationLinkCall<'a, C>
5321 where
5322 I: IntoIterator<Item = St>,
5323 St: AsRef<str>,
5324 {
5325 self._scopes
5326 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5327 self
5328 }
5329
5330 /// Removes all scopes, and no default scope will be used either.
5331 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5332 /// for details).
5333 pub fn clear_scopes(mut self) -> AccountContainerDestinationLinkCall<'a, C> {
5334 self._scopes.clear();
5335 self
5336 }
5337}
5338
5339/// Lists all Destinations linked to a GTM Container.
5340///
5341/// A builder for the *containers.destinations.list* method supported by a *account* resource.
5342/// It is not used directly, but through a [`AccountMethods`] instance.
5343///
5344/// # Example
5345///
5346/// Instantiate a resource method builder
5347///
5348/// ```test_harness,no_run
5349/// # extern crate hyper;
5350/// # extern crate hyper_rustls;
5351/// # extern crate google_tagmanager2 as tagmanager2;
5352/// # async fn dox() {
5353/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5354///
5355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5356/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5357/// # .with_native_roots()
5358/// # .unwrap()
5359/// # .https_only()
5360/// # .enable_http2()
5361/// # .build();
5362///
5363/// # let executor = hyper_util::rt::TokioExecutor::new();
5364/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5365/// # secret,
5366/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5367/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5368/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5369/// # ),
5370/// # ).build().await.unwrap();
5371///
5372/// # let client = hyper_util::client::legacy::Client::builder(
5373/// # hyper_util::rt::TokioExecutor::new()
5374/// # )
5375/// # .build(
5376/// # hyper_rustls::HttpsConnectorBuilder::new()
5377/// # .with_native_roots()
5378/// # .unwrap()
5379/// # .https_or_http()
5380/// # .enable_http2()
5381/// # .build()
5382/// # );
5383/// # let mut hub = TagManager::new(client, auth);
5384/// // You can configure optional parameters by calling the respective setters at will, and
5385/// // execute the final call using `doit()`.
5386/// // Values shown here are possibly random and not representative !
5387/// let result = hub.accounts().containers_destinations_list("parent")
5388/// .doit().await;
5389/// # }
5390/// ```
5391pub struct AccountContainerDestinationListCall<'a, C>
5392where
5393 C: 'a,
5394{
5395 hub: &'a TagManager<C>,
5396 _parent: String,
5397 _delegate: Option<&'a mut dyn common::Delegate>,
5398 _additional_params: HashMap<String, String>,
5399 _scopes: BTreeSet<String>,
5400}
5401
5402impl<'a, C> common::CallBuilder for AccountContainerDestinationListCall<'a, C> {}
5403
5404impl<'a, C> AccountContainerDestinationListCall<'a, C>
5405where
5406 C: common::Connector,
5407{
5408 /// Perform the operation you have build so far.
5409 pub async fn doit(mut self) -> common::Result<(common::Response, ListDestinationsResponse)> {
5410 use std::borrow::Cow;
5411 use std::io::{Read, Seek};
5412
5413 use common::{url::Params, ToParts};
5414 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5415
5416 let mut dd = common::DefaultDelegate;
5417 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5418 dlg.begin(common::MethodInfo {
5419 id: "tagmanager.accounts.containers.destinations.list",
5420 http_method: hyper::Method::GET,
5421 });
5422
5423 for &field in ["alt", "parent"].iter() {
5424 if self._additional_params.contains_key(field) {
5425 dlg.finished(false);
5426 return Err(common::Error::FieldClash(field));
5427 }
5428 }
5429
5430 let mut params = Params::with_capacity(3 + self._additional_params.len());
5431 params.push("parent", self._parent);
5432
5433 params.extend(self._additional_params.iter());
5434
5435 params.push("alt", "json");
5436 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/destinations";
5437 if self._scopes.is_empty() {
5438 self._scopes.insert(Scope::Readonly.as_ref().to_string());
5439 }
5440
5441 #[allow(clippy::single_element_loop)]
5442 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5443 url = params.uri_replacement(url, param_name, find_this, true);
5444 }
5445 {
5446 let to_remove = ["parent"];
5447 params.remove_params(&to_remove);
5448 }
5449
5450 let url = params.parse_with_url(&url);
5451
5452 loop {
5453 let token = match self
5454 .hub
5455 .auth
5456 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5457 .await
5458 {
5459 Ok(token) => token,
5460 Err(e) => match dlg.token(e) {
5461 Ok(token) => token,
5462 Err(e) => {
5463 dlg.finished(false);
5464 return Err(common::Error::MissingToken(e));
5465 }
5466 },
5467 };
5468 let mut req_result = {
5469 let client = &self.hub.client;
5470 dlg.pre_request();
5471 let mut req_builder = hyper::Request::builder()
5472 .method(hyper::Method::GET)
5473 .uri(url.as_str())
5474 .header(USER_AGENT, self.hub._user_agent.clone());
5475
5476 if let Some(token) = token.as_ref() {
5477 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5478 }
5479
5480 let request = req_builder
5481 .header(CONTENT_LENGTH, 0_u64)
5482 .body(common::to_body::<String>(None));
5483
5484 client.request(request.unwrap()).await
5485 };
5486
5487 match req_result {
5488 Err(err) => {
5489 if let common::Retry::After(d) = dlg.http_error(&err) {
5490 sleep(d).await;
5491 continue;
5492 }
5493 dlg.finished(false);
5494 return Err(common::Error::HttpError(err));
5495 }
5496 Ok(res) => {
5497 let (mut parts, body) = res.into_parts();
5498 let mut body = common::Body::new(body);
5499 if !parts.status.is_success() {
5500 let bytes = common::to_bytes(body).await.unwrap_or_default();
5501 let error = serde_json::from_str(&common::to_string(&bytes));
5502 let response = common::to_response(parts, bytes.into());
5503
5504 if let common::Retry::After(d) =
5505 dlg.http_failure(&response, error.as_ref().ok())
5506 {
5507 sleep(d).await;
5508 continue;
5509 }
5510
5511 dlg.finished(false);
5512
5513 return Err(match error {
5514 Ok(value) => common::Error::BadRequest(value),
5515 _ => common::Error::Failure(response),
5516 });
5517 }
5518 let response = {
5519 let bytes = common::to_bytes(body).await.unwrap_or_default();
5520 let encoded = common::to_string(&bytes);
5521 match serde_json::from_str(&encoded) {
5522 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5523 Err(error) => {
5524 dlg.response_json_decode_error(&encoded, &error);
5525 return Err(common::Error::JsonDecodeError(
5526 encoded.to_string(),
5527 error,
5528 ));
5529 }
5530 }
5531 };
5532
5533 dlg.finished(true);
5534 return Ok(response);
5535 }
5536 }
5537 }
5538 }
5539
5540 /// GTM parent Container's API relative path.
5541 ///
5542 /// Sets the *parent* path property to the given value.
5543 ///
5544 /// Even though the property as already been set when instantiating this call,
5545 /// we provide this method for API completeness.
5546 pub fn parent(mut self, new_value: &str) -> AccountContainerDestinationListCall<'a, C> {
5547 self._parent = new_value.to_string();
5548 self
5549 }
5550 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5551 /// while executing the actual API request.
5552 ///
5553 /// ````text
5554 /// It should be used to handle progress information, and to implement a certain level of resilience.
5555 /// ````
5556 ///
5557 /// Sets the *delegate* property to the given value.
5558 pub fn delegate(
5559 mut self,
5560 new_value: &'a mut dyn common::Delegate,
5561 ) -> AccountContainerDestinationListCall<'a, C> {
5562 self._delegate = Some(new_value);
5563 self
5564 }
5565
5566 /// Set any additional parameter of the query string used in the request.
5567 /// It should be used to set parameters which are not yet available through their own
5568 /// setters.
5569 ///
5570 /// Please note that this method must not be used to set any of the known parameters
5571 /// which have their own setter method. If done anyway, the request will fail.
5572 ///
5573 /// # Additional Parameters
5574 ///
5575 /// * *$.xgafv* (query-string) - V1 error format.
5576 /// * *access_token* (query-string) - OAuth access token.
5577 /// * *alt* (query-string) - Data format for response.
5578 /// * *callback* (query-string) - JSONP
5579 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5580 /// * *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.
5581 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5582 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5583 /// * *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.
5584 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5585 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5586 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDestinationListCall<'a, C>
5587 where
5588 T: AsRef<str>,
5589 {
5590 self._additional_params
5591 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5592 self
5593 }
5594
5595 /// Identifies the authorization scope for the method you are building.
5596 ///
5597 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5598 /// [`Scope::Readonly`].
5599 ///
5600 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5601 /// tokens for more than one scope.
5602 ///
5603 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5604 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5605 /// sufficient, a read-write scope will do as well.
5606 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDestinationListCall<'a, C>
5607 where
5608 St: AsRef<str>,
5609 {
5610 self._scopes.insert(String::from(scope.as_ref()));
5611 self
5612 }
5613 /// Identifies the authorization scope(s) for the method you are building.
5614 ///
5615 /// See [`Self::add_scope()`] for details.
5616 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDestinationListCall<'a, C>
5617 where
5618 I: IntoIterator<Item = St>,
5619 St: AsRef<str>,
5620 {
5621 self._scopes
5622 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5623 self
5624 }
5625
5626 /// Removes all scopes, and no default scope will be used either.
5627 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5628 /// for details).
5629 pub fn clear_scopes(mut self) -> AccountContainerDestinationListCall<'a, C> {
5630 self._scopes.clear();
5631 self
5632 }
5633}
5634
5635/// Creates a GTM Environment.
5636///
5637/// A builder for the *containers.environments.create* method supported by a *account* resource.
5638/// It is not used directly, but through a [`AccountMethods`] instance.
5639///
5640/// # Example
5641///
5642/// Instantiate a resource method builder
5643///
5644/// ```test_harness,no_run
5645/// # extern crate hyper;
5646/// # extern crate hyper_rustls;
5647/// # extern crate google_tagmanager2 as tagmanager2;
5648/// use tagmanager2::api::Environment;
5649/// # async fn dox() {
5650/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5651///
5652/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5653/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5654/// # .with_native_roots()
5655/// # .unwrap()
5656/// # .https_only()
5657/// # .enable_http2()
5658/// # .build();
5659///
5660/// # let executor = hyper_util::rt::TokioExecutor::new();
5661/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5662/// # secret,
5663/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5664/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5665/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5666/// # ),
5667/// # ).build().await.unwrap();
5668///
5669/// # let client = hyper_util::client::legacy::Client::builder(
5670/// # hyper_util::rt::TokioExecutor::new()
5671/// # )
5672/// # .build(
5673/// # hyper_rustls::HttpsConnectorBuilder::new()
5674/// # .with_native_roots()
5675/// # .unwrap()
5676/// # .https_or_http()
5677/// # .enable_http2()
5678/// # .build()
5679/// # );
5680/// # let mut hub = TagManager::new(client, auth);
5681/// // As the method needs a request, you would usually fill it with the desired information
5682/// // into the respective structure. Some of the parts shown here might not be applicable !
5683/// // Values shown here are possibly random and not representative !
5684/// let mut req = Environment::default();
5685///
5686/// // You can configure optional parameters by calling the respective setters at will, and
5687/// // execute the final call using `doit()`.
5688/// // Values shown here are possibly random and not representative !
5689/// let result = hub.accounts().containers_environments_create(req, "parent")
5690/// .doit().await;
5691/// # }
5692/// ```
5693pub struct AccountContainerEnvironmentCreateCall<'a, C>
5694where
5695 C: 'a,
5696{
5697 hub: &'a TagManager<C>,
5698 _request: Environment,
5699 _parent: String,
5700 _delegate: Option<&'a mut dyn common::Delegate>,
5701 _additional_params: HashMap<String, String>,
5702 _scopes: BTreeSet<String>,
5703}
5704
5705impl<'a, C> common::CallBuilder for AccountContainerEnvironmentCreateCall<'a, C> {}
5706
5707impl<'a, C> AccountContainerEnvironmentCreateCall<'a, C>
5708where
5709 C: common::Connector,
5710{
5711 /// Perform the operation you have build so far.
5712 pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
5713 use std::borrow::Cow;
5714 use std::io::{Read, Seek};
5715
5716 use common::{url::Params, ToParts};
5717 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5718
5719 let mut dd = common::DefaultDelegate;
5720 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5721 dlg.begin(common::MethodInfo {
5722 id: "tagmanager.accounts.containers.environments.create",
5723 http_method: hyper::Method::POST,
5724 });
5725
5726 for &field in ["alt", "parent"].iter() {
5727 if self._additional_params.contains_key(field) {
5728 dlg.finished(false);
5729 return Err(common::Error::FieldClash(field));
5730 }
5731 }
5732
5733 let mut params = Params::with_capacity(4 + self._additional_params.len());
5734 params.push("parent", self._parent);
5735
5736 params.extend(self._additional_params.iter());
5737
5738 params.push("alt", "json");
5739 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/environments";
5740 if self._scopes.is_empty() {
5741 self._scopes
5742 .insert(Scope::EditContainer.as_ref().to_string());
5743 }
5744
5745 #[allow(clippy::single_element_loop)]
5746 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5747 url = params.uri_replacement(url, param_name, find_this, true);
5748 }
5749 {
5750 let to_remove = ["parent"];
5751 params.remove_params(&to_remove);
5752 }
5753
5754 let url = params.parse_with_url(&url);
5755
5756 let mut json_mime_type = mime::APPLICATION_JSON;
5757 let mut request_value_reader = {
5758 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5759 common::remove_json_null_values(&mut value);
5760 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5761 serde_json::to_writer(&mut dst, &value).unwrap();
5762 dst
5763 };
5764 let request_size = request_value_reader
5765 .seek(std::io::SeekFrom::End(0))
5766 .unwrap();
5767 request_value_reader
5768 .seek(std::io::SeekFrom::Start(0))
5769 .unwrap();
5770
5771 loop {
5772 let token = match self
5773 .hub
5774 .auth
5775 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5776 .await
5777 {
5778 Ok(token) => token,
5779 Err(e) => match dlg.token(e) {
5780 Ok(token) => token,
5781 Err(e) => {
5782 dlg.finished(false);
5783 return Err(common::Error::MissingToken(e));
5784 }
5785 },
5786 };
5787 request_value_reader
5788 .seek(std::io::SeekFrom::Start(0))
5789 .unwrap();
5790 let mut req_result = {
5791 let client = &self.hub.client;
5792 dlg.pre_request();
5793 let mut req_builder = hyper::Request::builder()
5794 .method(hyper::Method::POST)
5795 .uri(url.as_str())
5796 .header(USER_AGENT, self.hub._user_agent.clone());
5797
5798 if let Some(token) = token.as_ref() {
5799 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5800 }
5801
5802 let request = req_builder
5803 .header(CONTENT_TYPE, json_mime_type.to_string())
5804 .header(CONTENT_LENGTH, request_size as u64)
5805 .body(common::to_body(
5806 request_value_reader.get_ref().clone().into(),
5807 ));
5808
5809 client.request(request.unwrap()).await
5810 };
5811
5812 match req_result {
5813 Err(err) => {
5814 if let common::Retry::After(d) = dlg.http_error(&err) {
5815 sleep(d).await;
5816 continue;
5817 }
5818 dlg.finished(false);
5819 return Err(common::Error::HttpError(err));
5820 }
5821 Ok(res) => {
5822 let (mut parts, body) = res.into_parts();
5823 let mut body = common::Body::new(body);
5824 if !parts.status.is_success() {
5825 let bytes = common::to_bytes(body).await.unwrap_or_default();
5826 let error = serde_json::from_str(&common::to_string(&bytes));
5827 let response = common::to_response(parts, bytes.into());
5828
5829 if let common::Retry::After(d) =
5830 dlg.http_failure(&response, error.as_ref().ok())
5831 {
5832 sleep(d).await;
5833 continue;
5834 }
5835
5836 dlg.finished(false);
5837
5838 return Err(match error {
5839 Ok(value) => common::Error::BadRequest(value),
5840 _ => common::Error::Failure(response),
5841 });
5842 }
5843 let response = {
5844 let bytes = common::to_bytes(body).await.unwrap_or_default();
5845 let encoded = common::to_string(&bytes);
5846 match serde_json::from_str(&encoded) {
5847 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5848 Err(error) => {
5849 dlg.response_json_decode_error(&encoded, &error);
5850 return Err(common::Error::JsonDecodeError(
5851 encoded.to_string(),
5852 error,
5853 ));
5854 }
5855 }
5856 };
5857
5858 dlg.finished(true);
5859 return Ok(response);
5860 }
5861 }
5862 }
5863 }
5864
5865 ///
5866 /// Sets the *request* property to the given value.
5867 ///
5868 /// Even though the property as already been set when instantiating this call,
5869 /// we provide this method for API completeness.
5870 pub fn request(
5871 mut self,
5872 new_value: Environment,
5873 ) -> AccountContainerEnvironmentCreateCall<'a, C> {
5874 self._request = new_value;
5875 self
5876 }
5877 /// GTM Container's API relative path.
5878 ///
5879 /// Sets the *parent* path property to the given value.
5880 ///
5881 /// Even though the property as already been set when instantiating this call,
5882 /// we provide this method for API completeness.
5883 pub fn parent(mut self, new_value: &str) -> AccountContainerEnvironmentCreateCall<'a, C> {
5884 self._parent = new_value.to_string();
5885 self
5886 }
5887 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5888 /// while executing the actual API request.
5889 ///
5890 /// ````text
5891 /// It should be used to handle progress information, and to implement a certain level of resilience.
5892 /// ````
5893 ///
5894 /// Sets the *delegate* property to the given value.
5895 pub fn delegate(
5896 mut self,
5897 new_value: &'a mut dyn common::Delegate,
5898 ) -> AccountContainerEnvironmentCreateCall<'a, C> {
5899 self._delegate = Some(new_value);
5900 self
5901 }
5902
5903 /// Set any additional parameter of the query string used in the request.
5904 /// It should be used to set parameters which are not yet available through their own
5905 /// setters.
5906 ///
5907 /// Please note that this method must not be used to set any of the known parameters
5908 /// which have their own setter method. If done anyway, the request will fail.
5909 ///
5910 /// # Additional Parameters
5911 ///
5912 /// * *$.xgafv* (query-string) - V1 error format.
5913 /// * *access_token* (query-string) - OAuth access token.
5914 /// * *alt* (query-string) - Data format for response.
5915 /// * *callback* (query-string) - JSONP
5916 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5917 /// * *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.
5918 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5919 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5920 /// * *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.
5921 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5922 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5923 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentCreateCall<'a, C>
5924 where
5925 T: AsRef<str>,
5926 {
5927 self._additional_params
5928 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5929 self
5930 }
5931
5932 /// Identifies the authorization scope for the method you are building.
5933 ///
5934 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5935 /// [`Scope::EditContainer`].
5936 ///
5937 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5938 /// tokens for more than one scope.
5939 ///
5940 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5941 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5942 /// sufficient, a read-write scope will do as well.
5943 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentCreateCall<'a, C>
5944 where
5945 St: AsRef<str>,
5946 {
5947 self._scopes.insert(String::from(scope.as_ref()));
5948 self
5949 }
5950 /// Identifies the authorization scope(s) for the method you are building.
5951 ///
5952 /// See [`Self::add_scope()`] for details.
5953 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentCreateCall<'a, C>
5954 where
5955 I: IntoIterator<Item = St>,
5956 St: AsRef<str>,
5957 {
5958 self._scopes
5959 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5960 self
5961 }
5962
5963 /// Removes all scopes, and no default scope will be used either.
5964 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5965 /// for details).
5966 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentCreateCall<'a, C> {
5967 self._scopes.clear();
5968 self
5969 }
5970}
5971
5972/// Deletes a GTM Environment.
5973///
5974/// A builder for the *containers.environments.delete* method supported by a *account* resource.
5975/// It is not used directly, but through a [`AccountMethods`] instance.
5976///
5977/// # Example
5978///
5979/// Instantiate a resource method builder
5980///
5981/// ```test_harness,no_run
5982/// # extern crate hyper;
5983/// # extern crate hyper_rustls;
5984/// # extern crate google_tagmanager2 as tagmanager2;
5985/// # async fn dox() {
5986/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5987///
5988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5990/// # .with_native_roots()
5991/// # .unwrap()
5992/// # .https_only()
5993/// # .enable_http2()
5994/// # .build();
5995///
5996/// # let executor = hyper_util::rt::TokioExecutor::new();
5997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5998/// # secret,
5999/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6000/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6001/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6002/// # ),
6003/// # ).build().await.unwrap();
6004///
6005/// # let client = hyper_util::client::legacy::Client::builder(
6006/// # hyper_util::rt::TokioExecutor::new()
6007/// # )
6008/// # .build(
6009/// # hyper_rustls::HttpsConnectorBuilder::new()
6010/// # .with_native_roots()
6011/// # .unwrap()
6012/// # .https_or_http()
6013/// # .enable_http2()
6014/// # .build()
6015/// # );
6016/// # let mut hub = TagManager::new(client, auth);
6017/// // You can configure optional parameters by calling the respective setters at will, and
6018/// // execute the final call using `doit()`.
6019/// // Values shown here are possibly random and not representative !
6020/// let result = hub.accounts().containers_environments_delete("path")
6021/// .doit().await;
6022/// # }
6023/// ```
6024pub struct AccountContainerEnvironmentDeleteCall<'a, C>
6025where
6026 C: 'a,
6027{
6028 hub: &'a TagManager<C>,
6029 _path: String,
6030 _delegate: Option<&'a mut dyn common::Delegate>,
6031 _additional_params: HashMap<String, String>,
6032 _scopes: BTreeSet<String>,
6033}
6034
6035impl<'a, C> common::CallBuilder for AccountContainerEnvironmentDeleteCall<'a, C> {}
6036
6037impl<'a, C> AccountContainerEnvironmentDeleteCall<'a, C>
6038where
6039 C: common::Connector,
6040{
6041 /// Perform the operation you have build so far.
6042 pub async fn doit(mut self) -> common::Result<common::Response> {
6043 use std::borrow::Cow;
6044 use std::io::{Read, Seek};
6045
6046 use common::{url::Params, ToParts};
6047 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6048
6049 let mut dd = common::DefaultDelegate;
6050 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6051 dlg.begin(common::MethodInfo {
6052 id: "tagmanager.accounts.containers.environments.delete",
6053 http_method: hyper::Method::DELETE,
6054 });
6055
6056 for &field in ["path"].iter() {
6057 if self._additional_params.contains_key(field) {
6058 dlg.finished(false);
6059 return Err(common::Error::FieldClash(field));
6060 }
6061 }
6062
6063 let mut params = Params::with_capacity(2 + self._additional_params.len());
6064 params.push("path", self._path);
6065
6066 params.extend(self._additional_params.iter());
6067
6068 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
6069 if self._scopes.is_empty() {
6070 self._scopes
6071 .insert(Scope::EditContainer.as_ref().to_string());
6072 }
6073
6074 #[allow(clippy::single_element_loop)]
6075 for &(find_this, param_name) in [("{+path}", "path")].iter() {
6076 url = params.uri_replacement(url, param_name, find_this, true);
6077 }
6078 {
6079 let to_remove = ["path"];
6080 params.remove_params(&to_remove);
6081 }
6082
6083 let url = params.parse_with_url(&url);
6084
6085 loop {
6086 let token = match self
6087 .hub
6088 .auth
6089 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6090 .await
6091 {
6092 Ok(token) => token,
6093 Err(e) => match dlg.token(e) {
6094 Ok(token) => token,
6095 Err(e) => {
6096 dlg.finished(false);
6097 return Err(common::Error::MissingToken(e));
6098 }
6099 },
6100 };
6101 let mut req_result = {
6102 let client = &self.hub.client;
6103 dlg.pre_request();
6104 let mut req_builder = hyper::Request::builder()
6105 .method(hyper::Method::DELETE)
6106 .uri(url.as_str())
6107 .header(USER_AGENT, self.hub._user_agent.clone());
6108
6109 if let Some(token) = token.as_ref() {
6110 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6111 }
6112
6113 let request = req_builder
6114 .header(CONTENT_LENGTH, 0_u64)
6115 .body(common::to_body::<String>(None));
6116
6117 client.request(request.unwrap()).await
6118 };
6119
6120 match req_result {
6121 Err(err) => {
6122 if let common::Retry::After(d) = dlg.http_error(&err) {
6123 sleep(d).await;
6124 continue;
6125 }
6126 dlg.finished(false);
6127 return Err(common::Error::HttpError(err));
6128 }
6129 Ok(res) => {
6130 let (mut parts, body) = res.into_parts();
6131 let mut body = common::Body::new(body);
6132 if !parts.status.is_success() {
6133 let bytes = common::to_bytes(body).await.unwrap_or_default();
6134 let error = serde_json::from_str(&common::to_string(&bytes));
6135 let response = common::to_response(parts, bytes.into());
6136
6137 if let common::Retry::After(d) =
6138 dlg.http_failure(&response, error.as_ref().ok())
6139 {
6140 sleep(d).await;
6141 continue;
6142 }
6143
6144 dlg.finished(false);
6145
6146 return Err(match error {
6147 Ok(value) => common::Error::BadRequest(value),
6148 _ => common::Error::Failure(response),
6149 });
6150 }
6151 let response = common::Response::from_parts(parts, body);
6152
6153 dlg.finished(true);
6154 return Ok(response);
6155 }
6156 }
6157 }
6158 }
6159
6160 /// GTM Environment's API relative path.
6161 ///
6162 /// Sets the *path* path property to the given value.
6163 ///
6164 /// Even though the property as already been set when instantiating this call,
6165 /// we provide this method for API completeness.
6166 pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6167 self._path = new_value.to_string();
6168 self
6169 }
6170 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6171 /// while executing the actual API request.
6172 ///
6173 /// ````text
6174 /// It should be used to handle progress information, and to implement a certain level of resilience.
6175 /// ````
6176 ///
6177 /// Sets the *delegate* property to the given value.
6178 pub fn delegate(
6179 mut self,
6180 new_value: &'a mut dyn common::Delegate,
6181 ) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6182 self._delegate = Some(new_value);
6183 self
6184 }
6185
6186 /// Set any additional parameter of the query string used in the request.
6187 /// It should be used to set parameters which are not yet available through their own
6188 /// setters.
6189 ///
6190 /// Please note that this method must not be used to set any of the known parameters
6191 /// which have their own setter method. If done anyway, the request will fail.
6192 ///
6193 /// # Additional Parameters
6194 ///
6195 /// * *$.xgafv* (query-string) - V1 error format.
6196 /// * *access_token* (query-string) - OAuth access token.
6197 /// * *alt* (query-string) - Data format for response.
6198 /// * *callback* (query-string) - JSONP
6199 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6200 /// * *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.
6201 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6202 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6203 /// * *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.
6204 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6205 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6206 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentDeleteCall<'a, C>
6207 where
6208 T: AsRef<str>,
6209 {
6210 self._additional_params
6211 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6212 self
6213 }
6214
6215 /// Identifies the authorization scope for the method you are building.
6216 ///
6217 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6218 /// [`Scope::EditContainer`].
6219 ///
6220 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6221 /// tokens for more than one scope.
6222 ///
6223 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6224 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6225 /// sufficient, a read-write scope will do as well.
6226 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentDeleteCall<'a, C>
6227 where
6228 St: AsRef<str>,
6229 {
6230 self._scopes.insert(String::from(scope.as_ref()));
6231 self
6232 }
6233 /// Identifies the authorization scope(s) for the method you are building.
6234 ///
6235 /// See [`Self::add_scope()`] for details.
6236 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentDeleteCall<'a, C>
6237 where
6238 I: IntoIterator<Item = St>,
6239 St: AsRef<str>,
6240 {
6241 self._scopes
6242 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6243 self
6244 }
6245
6246 /// Removes all scopes, and no default scope will be used either.
6247 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6248 /// for details).
6249 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentDeleteCall<'a, C> {
6250 self._scopes.clear();
6251 self
6252 }
6253}
6254
6255/// Gets a GTM Environment.
6256///
6257/// A builder for the *containers.environments.get* method supported by a *account* resource.
6258/// It is not used directly, but through a [`AccountMethods`] instance.
6259///
6260/// # Example
6261///
6262/// Instantiate a resource method builder
6263///
6264/// ```test_harness,no_run
6265/// # extern crate hyper;
6266/// # extern crate hyper_rustls;
6267/// # extern crate google_tagmanager2 as tagmanager2;
6268/// # async fn dox() {
6269/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6270///
6271/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6272/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6273/// # .with_native_roots()
6274/// # .unwrap()
6275/// # .https_only()
6276/// # .enable_http2()
6277/// # .build();
6278///
6279/// # let executor = hyper_util::rt::TokioExecutor::new();
6280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6281/// # secret,
6282/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6283/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6284/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6285/// # ),
6286/// # ).build().await.unwrap();
6287///
6288/// # let client = hyper_util::client::legacy::Client::builder(
6289/// # hyper_util::rt::TokioExecutor::new()
6290/// # )
6291/// # .build(
6292/// # hyper_rustls::HttpsConnectorBuilder::new()
6293/// # .with_native_roots()
6294/// # .unwrap()
6295/// # .https_or_http()
6296/// # .enable_http2()
6297/// # .build()
6298/// # );
6299/// # let mut hub = TagManager::new(client, auth);
6300/// // You can configure optional parameters by calling the respective setters at will, and
6301/// // execute the final call using `doit()`.
6302/// // Values shown here are possibly random and not representative !
6303/// let result = hub.accounts().containers_environments_get("path")
6304/// .doit().await;
6305/// # }
6306/// ```
6307pub struct AccountContainerEnvironmentGetCall<'a, C>
6308where
6309 C: 'a,
6310{
6311 hub: &'a TagManager<C>,
6312 _path: String,
6313 _delegate: Option<&'a mut dyn common::Delegate>,
6314 _additional_params: HashMap<String, String>,
6315 _scopes: BTreeSet<String>,
6316}
6317
6318impl<'a, C> common::CallBuilder for AccountContainerEnvironmentGetCall<'a, C> {}
6319
6320impl<'a, C> AccountContainerEnvironmentGetCall<'a, C>
6321where
6322 C: common::Connector,
6323{
6324 /// Perform the operation you have build so far.
6325 pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
6326 use std::borrow::Cow;
6327 use std::io::{Read, Seek};
6328
6329 use common::{url::Params, ToParts};
6330 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6331
6332 let mut dd = common::DefaultDelegate;
6333 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6334 dlg.begin(common::MethodInfo {
6335 id: "tagmanager.accounts.containers.environments.get",
6336 http_method: hyper::Method::GET,
6337 });
6338
6339 for &field in ["alt", "path"].iter() {
6340 if self._additional_params.contains_key(field) {
6341 dlg.finished(false);
6342 return Err(common::Error::FieldClash(field));
6343 }
6344 }
6345
6346 let mut params = Params::with_capacity(3 + self._additional_params.len());
6347 params.push("path", self._path);
6348
6349 params.extend(self._additional_params.iter());
6350
6351 params.push("alt", "json");
6352 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
6353 if self._scopes.is_empty() {
6354 self._scopes.insert(Scope::Readonly.as_ref().to_string());
6355 }
6356
6357 #[allow(clippy::single_element_loop)]
6358 for &(find_this, param_name) in [("{+path}", "path")].iter() {
6359 url = params.uri_replacement(url, param_name, find_this, true);
6360 }
6361 {
6362 let to_remove = ["path"];
6363 params.remove_params(&to_remove);
6364 }
6365
6366 let url = params.parse_with_url(&url);
6367
6368 loop {
6369 let token = match self
6370 .hub
6371 .auth
6372 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6373 .await
6374 {
6375 Ok(token) => token,
6376 Err(e) => match dlg.token(e) {
6377 Ok(token) => token,
6378 Err(e) => {
6379 dlg.finished(false);
6380 return Err(common::Error::MissingToken(e));
6381 }
6382 },
6383 };
6384 let mut req_result = {
6385 let client = &self.hub.client;
6386 dlg.pre_request();
6387 let mut req_builder = hyper::Request::builder()
6388 .method(hyper::Method::GET)
6389 .uri(url.as_str())
6390 .header(USER_AGENT, self.hub._user_agent.clone());
6391
6392 if let Some(token) = token.as_ref() {
6393 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6394 }
6395
6396 let request = req_builder
6397 .header(CONTENT_LENGTH, 0_u64)
6398 .body(common::to_body::<String>(None));
6399
6400 client.request(request.unwrap()).await
6401 };
6402
6403 match req_result {
6404 Err(err) => {
6405 if let common::Retry::After(d) = dlg.http_error(&err) {
6406 sleep(d).await;
6407 continue;
6408 }
6409 dlg.finished(false);
6410 return Err(common::Error::HttpError(err));
6411 }
6412 Ok(res) => {
6413 let (mut parts, body) = res.into_parts();
6414 let mut body = common::Body::new(body);
6415 if !parts.status.is_success() {
6416 let bytes = common::to_bytes(body).await.unwrap_or_default();
6417 let error = serde_json::from_str(&common::to_string(&bytes));
6418 let response = common::to_response(parts, bytes.into());
6419
6420 if let common::Retry::After(d) =
6421 dlg.http_failure(&response, error.as_ref().ok())
6422 {
6423 sleep(d).await;
6424 continue;
6425 }
6426
6427 dlg.finished(false);
6428
6429 return Err(match error {
6430 Ok(value) => common::Error::BadRequest(value),
6431 _ => common::Error::Failure(response),
6432 });
6433 }
6434 let response = {
6435 let bytes = common::to_bytes(body).await.unwrap_or_default();
6436 let encoded = common::to_string(&bytes);
6437 match serde_json::from_str(&encoded) {
6438 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6439 Err(error) => {
6440 dlg.response_json_decode_error(&encoded, &error);
6441 return Err(common::Error::JsonDecodeError(
6442 encoded.to_string(),
6443 error,
6444 ));
6445 }
6446 }
6447 };
6448
6449 dlg.finished(true);
6450 return Ok(response);
6451 }
6452 }
6453 }
6454 }
6455
6456 /// GTM Environment's API relative path.
6457 ///
6458 /// Sets the *path* path property to the given value.
6459 ///
6460 /// Even though the property as already been set when instantiating this call,
6461 /// we provide this method for API completeness.
6462 pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C> {
6463 self._path = new_value.to_string();
6464 self
6465 }
6466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6467 /// while executing the actual API request.
6468 ///
6469 /// ````text
6470 /// It should be used to handle progress information, and to implement a certain level of resilience.
6471 /// ````
6472 ///
6473 /// Sets the *delegate* property to the given value.
6474 pub fn delegate(
6475 mut self,
6476 new_value: &'a mut dyn common::Delegate,
6477 ) -> AccountContainerEnvironmentGetCall<'a, C> {
6478 self._delegate = Some(new_value);
6479 self
6480 }
6481
6482 /// Set any additional parameter of the query string used in the request.
6483 /// It should be used to set parameters which are not yet available through their own
6484 /// setters.
6485 ///
6486 /// Please note that this method must not be used to set any of the known parameters
6487 /// which have their own setter method. If done anyway, the request will fail.
6488 ///
6489 /// # Additional Parameters
6490 ///
6491 /// * *$.xgafv* (query-string) - V1 error format.
6492 /// * *access_token* (query-string) - OAuth access token.
6493 /// * *alt* (query-string) - Data format for response.
6494 /// * *callback* (query-string) - JSONP
6495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6496 /// * *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.
6497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6499 /// * *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.
6500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6502 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentGetCall<'a, C>
6503 where
6504 T: AsRef<str>,
6505 {
6506 self._additional_params
6507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6508 self
6509 }
6510
6511 /// Identifies the authorization scope for the method you are building.
6512 ///
6513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6514 /// [`Scope::Readonly`].
6515 ///
6516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6517 /// tokens for more than one scope.
6518 ///
6519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6521 /// sufficient, a read-write scope will do as well.
6522 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentGetCall<'a, C>
6523 where
6524 St: AsRef<str>,
6525 {
6526 self._scopes.insert(String::from(scope.as_ref()));
6527 self
6528 }
6529 /// Identifies the authorization scope(s) for the method you are building.
6530 ///
6531 /// See [`Self::add_scope()`] for details.
6532 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentGetCall<'a, C>
6533 where
6534 I: IntoIterator<Item = St>,
6535 St: AsRef<str>,
6536 {
6537 self._scopes
6538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6539 self
6540 }
6541
6542 /// Removes all scopes, and no default scope will be used either.
6543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6544 /// for details).
6545 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentGetCall<'a, C> {
6546 self._scopes.clear();
6547 self
6548 }
6549}
6550
6551/// Lists all GTM Environments of a GTM Container.
6552///
6553/// A builder for the *containers.environments.list* method supported by a *account* resource.
6554/// It is not used directly, but through a [`AccountMethods`] instance.
6555///
6556/// # Example
6557///
6558/// Instantiate a resource method builder
6559///
6560/// ```test_harness,no_run
6561/// # extern crate hyper;
6562/// # extern crate hyper_rustls;
6563/// # extern crate google_tagmanager2 as tagmanager2;
6564/// # async fn dox() {
6565/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6566///
6567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6569/// # .with_native_roots()
6570/// # .unwrap()
6571/// # .https_only()
6572/// # .enable_http2()
6573/// # .build();
6574///
6575/// # let executor = hyper_util::rt::TokioExecutor::new();
6576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6577/// # secret,
6578/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6579/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6580/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6581/// # ),
6582/// # ).build().await.unwrap();
6583///
6584/// # let client = hyper_util::client::legacy::Client::builder(
6585/// # hyper_util::rt::TokioExecutor::new()
6586/// # )
6587/// # .build(
6588/// # hyper_rustls::HttpsConnectorBuilder::new()
6589/// # .with_native_roots()
6590/// # .unwrap()
6591/// # .https_or_http()
6592/// # .enable_http2()
6593/// # .build()
6594/// # );
6595/// # let mut hub = TagManager::new(client, auth);
6596/// // You can configure optional parameters by calling the respective setters at will, and
6597/// // execute the final call using `doit()`.
6598/// // Values shown here are possibly random and not representative !
6599/// let result = hub.accounts().containers_environments_list("parent")
6600/// .page_token("sed")
6601/// .doit().await;
6602/// # }
6603/// ```
6604pub struct AccountContainerEnvironmentListCall<'a, C>
6605where
6606 C: 'a,
6607{
6608 hub: &'a TagManager<C>,
6609 _parent: String,
6610 _page_token: Option<String>,
6611 _delegate: Option<&'a mut dyn common::Delegate>,
6612 _additional_params: HashMap<String, String>,
6613 _scopes: BTreeSet<String>,
6614}
6615
6616impl<'a, C> common::CallBuilder for AccountContainerEnvironmentListCall<'a, C> {}
6617
6618impl<'a, C> AccountContainerEnvironmentListCall<'a, C>
6619where
6620 C: common::Connector,
6621{
6622 /// Perform the operation you have build so far.
6623 pub async fn doit(mut self) -> common::Result<(common::Response, ListEnvironmentsResponse)> {
6624 use std::borrow::Cow;
6625 use std::io::{Read, Seek};
6626
6627 use common::{url::Params, ToParts};
6628 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6629
6630 let mut dd = common::DefaultDelegate;
6631 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6632 dlg.begin(common::MethodInfo {
6633 id: "tagmanager.accounts.containers.environments.list",
6634 http_method: hyper::Method::GET,
6635 });
6636
6637 for &field in ["alt", "parent", "pageToken"].iter() {
6638 if self._additional_params.contains_key(field) {
6639 dlg.finished(false);
6640 return Err(common::Error::FieldClash(field));
6641 }
6642 }
6643
6644 let mut params = Params::with_capacity(4 + self._additional_params.len());
6645 params.push("parent", self._parent);
6646 if let Some(value) = self._page_token.as_ref() {
6647 params.push("pageToken", value);
6648 }
6649
6650 params.extend(self._additional_params.iter());
6651
6652 params.push("alt", "json");
6653 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/environments";
6654 if self._scopes.is_empty() {
6655 self._scopes.insert(Scope::Readonly.as_ref().to_string());
6656 }
6657
6658 #[allow(clippy::single_element_loop)]
6659 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6660 url = params.uri_replacement(url, param_name, find_this, true);
6661 }
6662 {
6663 let to_remove = ["parent"];
6664 params.remove_params(&to_remove);
6665 }
6666
6667 let url = params.parse_with_url(&url);
6668
6669 loop {
6670 let token = match self
6671 .hub
6672 .auth
6673 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6674 .await
6675 {
6676 Ok(token) => token,
6677 Err(e) => match dlg.token(e) {
6678 Ok(token) => token,
6679 Err(e) => {
6680 dlg.finished(false);
6681 return Err(common::Error::MissingToken(e));
6682 }
6683 },
6684 };
6685 let mut req_result = {
6686 let client = &self.hub.client;
6687 dlg.pre_request();
6688 let mut req_builder = hyper::Request::builder()
6689 .method(hyper::Method::GET)
6690 .uri(url.as_str())
6691 .header(USER_AGENT, self.hub._user_agent.clone());
6692
6693 if let Some(token) = token.as_ref() {
6694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6695 }
6696
6697 let request = req_builder
6698 .header(CONTENT_LENGTH, 0_u64)
6699 .body(common::to_body::<String>(None));
6700
6701 client.request(request.unwrap()).await
6702 };
6703
6704 match req_result {
6705 Err(err) => {
6706 if let common::Retry::After(d) = dlg.http_error(&err) {
6707 sleep(d).await;
6708 continue;
6709 }
6710 dlg.finished(false);
6711 return Err(common::Error::HttpError(err));
6712 }
6713 Ok(res) => {
6714 let (mut parts, body) = res.into_parts();
6715 let mut body = common::Body::new(body);
6716 if !parts.status.is_success() {
6717 let bytes = common::to_bytes(body).await.unwrap_or_default();
6718 let error = serde_json::from_str(&common::to_string(&bytes));
6719 let response = common::to_response(parts, bytes.into());
6720
6721 if let common::Retry::After(d) =
6722 dlg.http_failure(&response, error.as_ref().ok())
6723 {
6724 sleep(d).await;
6725 continue;
6726 }
6727
6728 dlg.finished(false);
6729
6730 return Err(match error {
6731 Ok(value) => common::Error::BadRequest(value),
6732 _ => common::Error::Failure(response),
6733 });
6734 }
6735 let response = {
6736 let bytes = common::to_bytes(body).await.unwrap_or_default();
6737 let encoded = common::to_string(&bytes);
6738 match serde_json::from_str(&encoded) {
6739 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6740 Err(error) => {
6741 dlg.response_json_decode_error(&encoded, &error);
6742 return Err(common::Error::JsonDecodeError(
6743 encoded.to_string(),
6744 error,
6745 ));
6746 }
6747 }
6748 };
6749
6750 dlg.finished(true);
6751 return Ok(response);
6752 }
6753 }
6754 }
6755 }
6756
6757 /// GTM Container's API relative path.
6758 ///
6759 /// Sets the *parent* path property to the given value.
6760 ///
6761 /// Even though the property as already been set when instantiating this call,
6762 /// we provide this method for API completeness.
6763 pub fn parent(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
6764 self._parent = new_value.to_string();
6765 self
6766 }
6767 /// Continuation token for fetching the next page of results.
6768 ///
6769 /// Sets the *page token* query property to the given value.
6770 pub fn page_token(mut self, new_value: &str) -> AccountContainerEnvironmentListCall<'a, C> {
6771 self._page_token = Some(new_value.to_string());
6772 self
6773 }
6774 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6775 /// while executing the actual API request.
6776 ///
6777 /// ````text
6778 /// It should be used to handle progress information, and to implement a certain level of resilience.
6779 /// ````
6780 ///
6781 /// Sets the *delegate* property to the given value.
6782 pub fn delegate(
6783 mut self,
6784 new_value: &'a mut dyn common::Delegate,
6785 ) -> AccountContainerEnvironmentListCall<'a, C> {
6786 self._delegate = Some(new_value);
6787 self
6788 }
6789
6790 /// Set any additional parameter of the query string used in the request.
6791 /// It should be used to set parameters which are not yet available through their own
6792 /// setters.
6793 ///
6794 /// Please note that this method must not be used to set any of the known parameters
6795 /// which have their own setter method. If done anyway, the request will fail.
6796 ///
6797 /// # Additional Parameters
6798 ///
6799 /// * *$.xgafv* (query-string) - V1 error format.
6800 /// * *access_token* (query-string) - OAuth access token.
6801 /// * *alt* (query-string) - Data format for response.
6802 /// * *callback* (query-string) - JSONP
6803 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6804 /// * *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.
6805 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6806 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6807 /// * *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.
6808 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6809 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6810 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentListCall<'a, C>
6811 where
6812 T: AsRef<str>,
6813 {
6814 self._additional_params
6815 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6816 self
6817 }
6818
6819 /// Identifies the authorization scope for the method you are building.
6820 ///
6821 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6822 /// [`Scope::Readonly`].
6823 ///
6824 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6825 /// tokens for more than one scope.
6826 ///
6827 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6828 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6829 /// sufficient, a read-write scope will do as well.
6830 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentListCall<'a, C>
6831 where
6832 St: AsRef<str>,
6833 {
6834 self._scopes.insert(String::from(scope.as_ref()));
6835 self
6836 }
6837 /// Identifies the authorization scope(s) for the method you are building.
6838 ///
6839 /// See [`Self::add_scope()`] for details.
6840 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentListCall<'a, C>
6841 where
6842 I: IntoIterator<Item = St>,
6843 St: AsRef<str>,
6844 {
6845 self._scopes
6846 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6847 self
6848 }
6849
6850 /// Removes all scopes, and no default scope will be used either.
6851 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6852 /// for details).
6853 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentListCall<'a, C> {
6854 self._scopes.clear();
6855 self
6856 }
6857}
6858
6859/// Re-generates the authorization code for a GTM Environment.
6860///
6861/// A builder for the *containers.environments.reauthorize* method supported by a *account* resource.
6862/// It is not used directly, but through a [`AccountMethods`] instance.
6863///
6864/// # Example
6865///
6866/// Instantiate a resource method builder
6867///
6868/// ```test_harness,no_run
6869/// # extern crate hyper;
6870/// # extern crate hyper_rustls;
6871/// # extern crate google_tagmanager2 as tagmanager2;
6872/// use tagmanager2::api::Environment;
6873/// # async fn dox() {
6874/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6875///
6876/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6877/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6878/// # .with_native_roots()
6879/// # .unwrap()
6880/// # .https_only()
6881/// # .enable_http2()
6882/// # .build();
6883///
6884/// # let executor = hyper_util::rt::TokioExecutor::new();
6885/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6886/// # secret,
6887/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6888/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6889/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6890/// # ),
6891/// # ).build().await.unwrap();
6892///
6893/// # let client = hyper_util::client::legacy::Client::builder(
6894/// # hyper_util::rt::TokioExecutor::new()
6895/// # )
6896/// # .build(
6897/// # hyper_rustls::HttpsConnectorBuilder::new()
6898/// # .with_native_roots()
6899/// # .unwrap()
6900/// # .https_or_http()
6901/// # .enable_http2()
6902/// # .build()
6903/// # );
6904/// # let mut hub = TagManager::new(client, auth);
6905/// // As the method needs a request, you would usually fill it with the desired information
6906/// // into the respective structure. Some of the parts shown here might not be applicable !
6907/// // Values shown here are possibly random and not representative !
6908/// let mut req = Environment::default();
6909///
6910/// // You can configure optional parameters by calling the respective setters at will, and
6911/// // execute the final call using `doit()`.
6912/// // Values shown here are possibly random and not representative !
6913/// let result = hub.accounts().containers_environments_reauthorize(req, "path")
6914/// .doit().await;
6915/// # }
6916/// ```
6917pub struct AccountContainerEnvironmentReauthorizeCall<'a, C>
6918where
6919 C: 'a,
6920{
6921 hub: &'a TagManager<C>,
6922 _request: Environment,
6923 _path: String,
6924 _delegate: Option<&'a mut dyn common::Delegate>,
6925 _additional_params: HashMap<String, String>,
6926 _scopes: BTreeSet<String>,
6927}
6928
6929impl<'a, C> common::CallBuilder for AccountContainerEnvironmentReauthorizeCall<'a, C> {}
6930
6931impl<'a, C> AccountContainerEnvironmentReauthorizeCall<'a, C>
6932where
6933 C: common::Connector,
6934{
6935 /// Perform the operation you have build so far.
6936 pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
6937 use std::borrow::Cow;
6938 use std::io::{Read, Seek};
6939
6940 use common::{url::Params, ToParts};
6941 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6942
6943 let mut dd = common::DefaultDelegate;
6944 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6945 dlg.begin(common::MethodInfo {
6946 id: "tagmanager.accounts.containers.environments.reauthorize",
6947 http_method: hyper::Method::POST,
6948 });
6949
6950 for &field in ["alt", "path"].iter() {
6951 if self._additional_params.contains_key(field) {
6952 dlg.finished(false);
6953 return Err(common::Error::FieldClash(field));
6954 }
6955 }
6956
6957 let mut params = Params::with_capacity(4 + self._additional_params.len());
6958 params.push("path", self._path);
6959
6960 params.extend(self._additional_params.iter());
6961
6962 params.push("alt", "json");
6963 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:reauthorize";
6964 if self._scopes.is_empty() {
6965 self._scopes.insert(Scope::Publish.as_ref().to_string());
6966 }
6967
6968 #[allow(clippy::single_element_loop)]
6969 for &(find_this, param_name) in [("{+path}", "path")].iter() {
6970 url = params.uri_replacement(url, param_name, find_this, true);
6971 }
6972 {
6973 let to_remove = ["path"];
6974 params.remove_params(&to_remove);
6975 }
6976
6977 let url = params.parse_with_url(&url);
6978
6979 let mut json_mime_type = mime::APPLICATION_JSON;
6980 let mut request_value_reader = {
6981 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6982 common::remove_json_null_values(&mut value);
6983 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6984 serde_json::to_writer(&mut dst, &value).unwrap();
6985 dst
6986 };
6987 let request_size = request_value_reader
6988 .seek(std::io::SeekFrom::End(0))
6989 .unwrap();
6990 request_value_reader
6991 .seek(std::io::SeekFrom::Start(0))
6992 .unwrap();
6993
6994 loop {
6995 let token = match self
6996 .hub
6997 .auth
6998 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6999 .await
7000 {
7001 Ok(token) => token,
7002 Err(e) => match dlg.token(e) {
7003 Ok(token) => token,
7004 Err(e) => {
7005 dlg.finished(false);
7006 return Err(common::Error::MissingToken(e));
7007 }
7008 },
7009 };
7010 request_value_reader
7011 .seek(std::io::SeekFrom::Start(0))
7012 .unwrap();
7013 let mut req_result = {
7014 let client = &self.hub.client;
7015 dlg.pre_request();
7016 let mut req_builder = hyper::Request::builder()
7017 .method(hyper::Method::POST)
7018 .uri(url.as_str())
7019 .header(USER_AGENT, self.hub._user_agent.clone());
7020
7021 if let Some(token) = token.as_ref() {
7022 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7023 }
7024
7025 let request = req_builder
7026 .header(CONTENT_TYPE, json_mime_type.to_string())
7027 .header(CONTENT_LENGTH, request_size as u64)
7028 .body(common::to_body(
7029 request_value_reader.get_ref().clone().into(),
7030 ));
7031
7032 client.request(request.unwrap()).await
7033 };
7034
7035 match req_result {
7036 Err(err) => {
7037 if let common::Retry::After(d) = dlg.http_error(&err) {
7038 sleep(d).await;
7039 continue;
7040 }
7041 dlg.finished(false);
7042 return Err(common::Error::HttpError(err));
7043 }
7044 Ok(res) => {
7045 let (mut parts, body) = res.into_parts();
7046 let mut body = common::Body::new(body);
7047 if !parts.status.is_success() {
7048 let bytes = common::to_bytes(body).await.unwrap_or_default();
7049 let error = serde_json::from_str(&common::to_string(&bytes));
7050 let response = common::to_response(parts, bytes.into());
7051
7052 if let common::Retry::After(d) =
7053 dlg.http_failure(&response, error.as_ref().ok())
7054 {
7055 sleep(d).await;
7056 continue;
7057 }
7058
7059 dlg.finished(false);
7060
7061 return Err(match error {
7062 Ok(value) => common::Error::BadRequest(value),
7063 _ => common::Error::Failure(response),
7064 });
7065 }
7066 let response = {
7067 let bytes = common::to_bytes(body).await.unwrap_or_default();
7068 let encoded = common::to_string(&bytes);
7069 match serde_json::from_str(&encoded) {
7070 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7071 Err(error) => {
7072 dlg.response_json_decode_error(&encoded, &error);
7073 return Err(common::Error::JsonDecodeError(
7074 encoded.to_string(),
7075 error,
7076 ));
7077 }
7078 }
7079 };
7080
7081 dlg.finished(true);
7082 return Ok(response);
7083 }
7084 }
7085 }
7086 }
7087
7088 ///
7089 /// Sets the *request* property to the given value.
7090 ///
7091 /// Even though the property as already been set when instantiating this call,
7092 /// we provide this method for API completeness.
7093 pub fn request(
7094 mut self,
7095 new_value: Environment,
7096 ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
7097 self._request = new_value;
7098 self
7099 }
7100 /// GTM Environment's API relative path.
7101 ///
7102 /// Sets the *path* path property to the given value.
7103 ///
7104 /// Even though the property as already been set when instantiating this call,
7105 /// we provide this method for API completeness.
7106 pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
7107 self._path = new_value.to_string();
7108 self
7109 }
7110 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7111 /// while executing the actual API request.
7112 ///
7113 /// ````text
7114 /// It should be used to handle progress information, and to implement a certain level of resilience.
7115 /// ````
7116 ///
7117 /// Sets the *delegate* property to the given value.
7118 pub fn delegate(
7119 mut self,
7120 new_value: &'a mut dyn common::Delegate,
7121 ) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
7122 self._delegate = Some(new_value);
7123 self
7124 }
7125
7126 /// Set any additional parameter of the query string used in the request.
7127 /// It should be used to set parameters which are not yet available through their own
7128 /// setters.
7129 ///
7130 /// Please note that this method must not be used to set any of the known parameters
7131 /// which have their own setter method. If done anyway, the request will fail.
7132 ///
7133 /// # Additional Parameters
7134 ///
7135 /// * *$.xgafv* (query-string) - V1 error format.
7136 /// * *access_token* (query-string) - OAuth access token.
7137 /// * *alt* (query-string) - Data format for response.
7138 /// * *callback* (query-string) - JSONP
7139 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7140 /// * *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.
7141 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7142 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7143 /// * *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.
7144 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7145 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7146 pub fn param<T>(
7147 mut self,
7148 name: T,
7149 value: T,
7150 ) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
7151 where
7152 T: AsRef<str>,
7153 {
7154 self._additional_params
7155 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7156 self
7157 }
7158
7159 /// Identifies the authorization scope for the method you are building.
7160 ///
7161 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7162 /// [`Scope::Publish`].
7163 ///
7164 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7165 /// tokens for more than one scope.
7166 ///
7167 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7168 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7169 /// sufficient, a read-write scope will do as well.
7170 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
7171 where
7172 St: AsRef<str>,
7173 {
7174 self._scopes.insert(String::from(scope.as_ref()));
7175 self
7176 }
7177 /// Identifies the authorization scope(s) for the method you are building.
7178 ///
7179 /// See [`Self::add_scope()`] for details.
7180 pub fn add_scopes<I, St>(
7181 mut self,
7182 scopes: I,
7183 ) -> AccountContainerEnvironmentReauthorizeCall<'a, C>
7184 where
7185 I: IntoIterator<Item = St>,
7186 St: AsRef<str>,
7187 {
7188 self._scopes
7189 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7190 self
7191 }
7192
7193 /// Removes all scopes, and no default scope will be used either.
7194 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7195 /// for details).
7196 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentReauthorizeCall<'a, C> {
7197 self._scopes.clear();
7198 self
7199 }
7200}
7201
7202/// Updates a GTM Environment.
7203///
7204/// A builder for the *containers.environments.update* method supported by a *account* resource.
7205/// It is not used directly, but through a [`AccountMethods`] instance.
7206///
7207/// # Example
7208///
7209/// Instantiate a resource method builder
7210///
7211/// ```test_harness,no_run
7212/// # extern crate hyper;
7213/// # extern crate hyper_rustls;
7214/// # extern crate google_tagmanager2 as tagmanager2;
7215/// use tagmanager2::api::Environment;
7216/// # async fn dox() {
7217/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7218///
7219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7220/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7221/// # .with_native_roots()
7222/// # .unwrap()
7223/// # .https_only()
7224/// # .enable_http2()
7225/// # .build();
7226///
7227/// # let executor = hyper_util::rt::TokioExecutor::new();
7228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7229/// # secret,
7230/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7231/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7232/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7233/// # ),
7234/// # ).build().await.unwrap();
7235///
7236/// # let client = hyper_util::client::legacy::Client::builder(
7237/// # hyper_util::rt::TokioExecutor::new()
7238/// # )
7239/// # .build(
7240/// # hyper_rustls::HttpsConnectorBuilder::new()
7241/// # .with_native_roots()
7242/// # .unwrap()
7243/// # .https_or_http()
7244/// # .enable_http2()
7245/// # .build()
7246/// # );
7247/// # let mut hub = TagManager::new(client, auth);
7248/// // As the method needs a request, you would usually fill it with the desired information
7249/// // into the respective structure. Some of the parts shown here might not be applicable !
7250/// // Values shown here are possibly random and not representative !
7251/// let mut req = Environment::default();
7252///
7253/// // You can configure optional parameters by calling the respective setters at will, and
7254/// // execute the final call using `doit()`.
7255/// // Values shown here are possibly random and not representative !
7256/// let result = hub.accounts().containers_environments_update(req, "path")
7257/// .fingerprint("kasd")
7258/// .doit().await;
7259/// # }
7260/// ```
7261pub struct AccountContainerEnvironmentUpdateCall<'a, C>
7262where
7263 C: 'a,
7264{
7265 hub: &'a TagManager<C>,
7266 _request: Environment,
7267 _path: String,
7268 _fingerprint: Option<String>,
7269 _delegate: Option<&'a mut dyn common::Delegate>,
7270 _additional_params: HashMap<String, String>,
7271 _scopes: BTreeSet<String>,
7272}
7273
7274impl<'a, C> common::CallBuilder for AccountContainerEnvironmentUpdateCall<'a, C> {}
7275
7276impl<'a, C> AccountContainerEnvironmentUpdateCall<'a, C>
7277where
7278 C: common::Connector,
7279{
7280 /// Perform the operation you have build so far.
7281 pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
7282 use std::borrow::Cow;
7283 use std::io::{Read, Seek};
7284
7285 use common::{url::Params, ToParts};
7286 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7287
7288 let mut dd = common::DefaultDelegate;
7289 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7290 dlg.begin(common::MethodInfo {
7291 id: "tagmanager.accounts.containers.environments.update",
7292 http_method: hyper::Method::PUT,
7293 });
7294
7295 for &field in ["alt", "path", "fingerprint"].iter() {
7296 if self._additional_params.contains_key(field) {
7297 dlg.finished(false);
7298 return Err(common::Error::FieldClash(field));
7299 }
7300 }
7301
7302 let mut params = Params::with_capacity(5 + self._additional_params.len());
7303 params.push("path", self._path);
7304 if let Some(value) = self._fingerprint.as_ref() {
7305 params.push("fingerprint", value);
7306 }
7307
7308 params.extend(self._additional_params.iter());
7309
7310 params.push("alt", "json");
7311 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
7312 if self._scopes.is_empty() {
7313 self._scopes
7314 .insert(Scope::EditContainer.as_ref().to_string());
7315 }
7316
7317 #[allow(clippy::single_element_loop)]
7318 for &(find_this, param_name) in [("{+path}", "path")].iter() {
7319 url = params.uri_replacement(url, param_name, find_this, true);
7320 }
7321 {
7322 let to_remove = ["path"];
7323 params.remove_params(&to_remove);
7324 }
7325
7326 let url = params.parse_with_url(&url);
7327
7328 let mut json_mime_type = mime::APPLICATION_JSON;
7329 let mut request_value_reader = {
7330 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7331 common::remove_json_null_values(&mut value);
7332 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7333 serde_json::to_writer(&mut dst, &value).unwrap();
7334 dst
7335 };
7336 let request_size = request_value_reader
7337 .seek(std::io::SeekFrom::End(0))
7338 .unwrap();
7339 request_value_reader
7340 .seek(std::io::SeekFrom::Start(0))
7341 .unwrap();
7342
7343 loop {
7344 let token = match self
7345 .hub
7346 .auth
7347 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7348 .await
7349 {
7350 Ok(token) => token,
7351 Err(e) => match dlg.token(e) {
7352 Ok(token) => token,
7353 Err(e) => {
7354 dlg.finished(false);
7355 return Err(common::Error::MissingToken(e));
7356 }
7357 },
7358 };
7359 request_value_reader
7360 .seek(std::io::SeekFrom::Start(0))
7361 .unwrap();
7362 let mut req_result = {
7363 let client = &self.hub.client;
7364 dlg.pre_request();
7365 let mut req_builder = hyper::Request::builder()
7366 .method(hyper::Method::PUT)
7367 .uri(url.as_str())
7368 .header(USER_AGENT, self.hub._user_agent.clone());
7369
7370 if let Some(token) = token.as_ref() {
7371 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7372 }
7373
7374 let request = req_builder
7375 .header(CONTENT_TYPE, json_mime_type.to_string())
7376 .header(CONTENT_LENGTH, request_size as u64)
7377 .body(common::to_body(
7378 request_value_reader.get_ref().clone().into(),
7379 ));
7380
7381 client.request(request.unwrap()).await
7382 };
7383
7384 match req_result {
7385 Err(err) => {
7386 if let common::Retry::After(d) = dlg.http_error(&err) {
7387 sleep(d).await;
7388 continue;
7389 }
7390 dlg.finished(false);
7391 return Err(common::Error::HttpError(err));
7392 }
7393 Ok(res) => {
7394 let (mut parts, body) = res.into_parts();
7395 let mut body = common::Body::new(body);
7396 if !parts.status.is_success() {
7397 let bytes = common::to_bytes(body).await.unwrap_or_default();
7398 let error = serde_json::from_str(&common::to_string(&bytes));
7399 let response = common::to_response(parts, bytes.into());
7400
7401 if let common::Retry::After(d) =
7402 dlg.http_failure(&response, error.as_ref().ok())
7403 {
7404 sleep(d).await;
7405 continue;
7406 }
7407
7408 dlg.finished(false);
7409
7410 return Err(match error {
7411 Ok(value) => common::Error::BadRequest(value),
7412 _ => common::Error::Failure(response),
7413 });
7414 }
7415 let response = {
7416 let bytes = common::to_bytes(body).await.unwrap_or_default();
7417 let encoded = common::to_string(&bytes);
7418 match serde_json::from_str(&encoded) {
7419 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7420 Err(error) => {
7421 dlg.response_json_decode_error(&encoded, &error);
7422 return Err(common::Error::JsonDecodeError(
7423 encoded.to_string(),
7424 error,
7425 ));
7426 }
7427 }
7428 };
7429
7430 dlg.finished(true);
7431 return Ok(response);
7432 }
7433 }
7434 }
7435 }
7436
7437 ///
7438 /// Sets the *request* property to the given value.
7439 ///
7440 /// Even though the property as already been set when instantiating this call,
7441 /// we provide this method for API completeness.
7442 pub fn request(
7443 mut self,
7444 new_value: Environment,
7445 ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7446 self._request = new_value;
7447 self
7448 }
7449 /// GTM Environment's API relative path.
7450 ///
7451 /// Sets the *path* path property to the given value.
7452 ///
7453 /// Even though the property as already been set when instantiating this call,
7454 /// we provide this method for API completeness.
7455 pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7456 self._path = new_value.to_string();
7457 self
7458 }
7459 /// When provided, this fingerprint must match the fingerprint of the environment in storage.
7460 ///
7461 /// Sets the *fingerprint* query property to the given value.
7462 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7463 self._fingerprint = Some(new_value.to_string());
7464 self
7465 }
7466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7467 /// while executing the actual API request.
7468 ///
7469 /// ````text
7470 /// It should be used to handle progress information, and to implement a certain level of resilience.
7471 /// ````
7472 ///
7473 /// Sets the *delegate* property to the given value.
7474 pub fn delegate(
7475 mut self,
7476 new_value: &'a mut dyn common::Delegate,
7477 ) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7478 self._delegate = Some(new_value);
7479 self
7480 }
7481
7482 /// Set any additional parameter of the query string used in the request.
7483 /// It should be used to set parameters which are not yet available through their own
7484 /// setters.
7485 ///
7486 /// Please note that this method must not be used to set any of the known parameters
7487 /// which have their own setter method. If done anyway, the request will fail.
7488 ///
7489 /// # Additional Parameters
7490 ///
7491 /// * *$.xgafv* (query-string) - V1 error format.
7492 /// * *access_token* (query-string) - OAuth access token.
7493 /// * *alt* (query-string) - Data format for response.
7494 /// * *callback* (query-string) - JSONP
7495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7496 /// * *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.
7497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7499 /// * *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.
7500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7502 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerEnvironmentUpdateCall<'a, C>
7503 where
7504 T: AsRef<str>,
7505 {
7506 self._additional_params
7507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7508 self
7509 }
7510
7511 /// Identifies the authorization scope for the method you are building.
7512 ///
7513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7514 /// [`Scope::EditContainer`].
7515 ///
7516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7517 /// tokens for more than one scope.
7518 ///
7519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7521 /// sufficient, a read-write scope will do as well.
7522 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerEnvironmentUpdateCall<'a, C>
7523 where
7524 St: AsRef<str>,
7525 {
7526 self._scopes.insert(String::from(scope.as_ref()));
7527 self
7528 }
7529 /// Identifies the authorization scope(s) for the method you are building.
7530 ///
7531 /// See [`Self::add_scope()`] for details.
7532 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerEnvironmentUpdateCall<'a, C>
7533 where
7534 I: IntoIterator<Item = St>,
7535 St: AsRef<str>,
7536 {
7537 self._scopes
7538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7539 self
7540 }
7541
7542 /// Removes all scopes, and no default scope will be used either.
7543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7544 /// for details).
7545 pub fn clear_scopes(mut self) -> AccountContainerEnvironmentUpdateCall<'a, C> {
7546 self._scopes.clear();
7547 self
7548 }
7549}
7550
7551/// Gets the latest container version header
7552///
7553/// A builder for the *containers.version_headers.latest* method supported by a *account* resource.
7554/// It is not used directly, but through a [`AccountMethods`] instance.
7555///
7556/// # Example
7557///
7558/// Instantiate a resource method builder
7559///
7560/// ```test_harness,no_run
7561/// # extern crate hyper;
7562/// # extern crate hyper_rustls;
7563/// # extern crate google_tagmanager2 as tagmanager2;
7564/// # async fn dox() {
7565/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7566///
7567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7569/// # .with_native_roots()
7570/// # .unwrap()
7571/// # .https_only()
7572/// # .enable_http2()
7573/// # .build();
7574///
7575/// # let executor = hyper_util::rt::TokioExecutor::new();
7576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7577/// # secret,
7578/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7579/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7580/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7581/// # ),
7582/// # ).build().await.unwrap();
7583///
7584/// # let client = hyper_util::client::legacy::Client::builder(
7585/// # hyper_util::rt::TokioExecutor::new()
7586/// # )
7587/// # .build(
7588/// # hyper_rustls::HttpsConnectorBuilder::new()
7589/// # .with_native_roots()
7590/// # .unwrap()
7591/// # .https_or_http()
7592/// # .enable_http2()
7593/// # .build()
7594/// # );
7595/// # let mut hub = TagManager::new(client, auth);
7596/// // You can configure optional parameters by calling the respective setters at will, and
7597/// // execute the final call using `doit()`.
7598/// // Values shown here are possibly random and not representative !
7599/// let result = hub.accounts().containers_version_headers_latest("parent")
7600/// .doit().await;
7601/// # }
7602/// ```
7603pub struct AccountContainerVersionHeaderLatestCall<'a, C>
7604where
7605 C: 'a,
7606{
7607 hub: &'a TagManager<C>,
7608 _parent: String,
7609 _delegate: Option<&'a mut dyn common::Delegate>,
7610 _additional_params: HashMap<String, String>,
7611 _scopes: BTreeSet<String>,
7612}
7613
7614impl<'a, C> common::CallBuilder for AccountContainerVersionHeaderLatestCall<'a, C> {}
7615
7616impl<'a, C> AccountContainerVersionHeaderLatestCall<'a, C>
7617where
7618 C: common::Connector,
7619{
7620 /// Perform the operation you have build so far.
7621 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersionHeader)> {
7622 use std::borrow::Cow;
7623 use std::io::{Read, Seek};
7624
7625 use common::{url::Params, ToParts};
7626 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7627
7628 let mut dd = common::DefaultDelegate;
7629 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7630 dlg.begin(common::MethodInfo {
7631 id: "tagmanager.accounts.containers.version_headers.latest",
7632 http_method: hyper::Method::GET,
7633 });
7634
7635 for &field in ["alt", "parent"].iter() {
7636 if self._additional_params.contains_key(field) {
7637 dlg.finished(false);
7638 return Err(common::Error::FieldClash(field));
7639 }
7640 }
7641
7642 let mut params = Params::with_capacity(3 + self._additional_params.len());
7643 params.push("parent", self._parent);
7644
7645 params.extend(self._additional_params.iter());
7646
7647 params.push("alt", "json");
7648 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/version_headers:latest";
7649 if self._scopes.is_empty() {
7650 self._scopes.insert(Scope::Readonly.as_ref().to_string());
7651 }
7652
7653 #[allow(clippy::single_element_loop)]
7654 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7655 url = params.uri_replacement(url, param_name, find_this, true);
7656 }
7657 {
7658 let to_remove = ["parent"];
7659 params.remove_params(&to_remove);
7660 }
7661
7662 let url = params.parse_with_url(&url);
7663
7664 loop {
7665 let token = match self
7666 .hub
7667 .auth
7668 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7669 .await
7670 {
7671 Ok(token) => token,
7672 Err(e) => match dlg.token(e) {
7673 Ok(token) => token,
7674 Err(e) => {
7675 dlg.finished(false);
7676 return Err(common::Error::MissingToken(e));
7677 }
7678 },
7679 };
7680 let mut req_result = {
7681 let client = &self.hub.client;
7682 dlg.pre_request();
7683 let mut req_builder = hyper::Request::builder()
7684 .method(hyper::Method::GET)
7685 .uri(url.as_str())
7686 .header(USER_AGENT, self.hub._user_agent.clone());
7687
7688 if let Some(token) = token.as_ref() {
7689 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7690 }
7691
7692 let request = req_builder
7693 .header(CONTENT_LENGTH, 0_u64)
7694 .body(common::to_body::<String>(None));
7695
7696 client.request(request.unwrap()).await
7697 };
7698
7699 match req_result {
7700 Err(err) => {
7701 if let common::Retry::After(d) = dlg.http_error(&err) {
7702 sleep(d).await;
7703 continue;
7704 }
7705 dlg.finished(false);
7706 return Err(common::Error::HttpError(err));
7707 }
7708 Ok(res) => {
7709 let (mut parts, body) = res.into_parts();
7710 let mut body = common::Body::new(body);
7711 if !parts.status.is_success() {
7712 let bytes = common::to_bytes(body).await.unwrap_or_default();
7713 let error = serde_json::from_str(&common::to_string(&bytes));
7714 let response = common::to_response(parts, bytes.into());
7715
7716 if let common::Retry::After(d) =
7717 dlg.http_failure(&response, error.as_ref().ok())
7718 {
7719 sleep(d).await;
7720 continue;
7721 }
7722
7723 dlg.finished(false);
7724
7725 return Err(match error {
7726 Ok(value) => common::Error::BadRequest(value),
7727 _ => common::Error::Failure(response),
7728 });
7729 }
7730 let response = {
7731 let bytes = common::to_bytes(body).await.unwrap_or_default();
7732 let encoded = common::to_string(&bytes);
7733 match serde_json::from_str(&encoded) {
7734 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7735 Err(error) => {
7736 dlg.response_json_decode_error(&encoded, &error);
7737 return Err(common::Error::JsonDecodeError(
7738 encoded.to_string(),
7739 error,
7740 ));
7741 }
7742 }
7743 };
7744
7745 dlg.finished(true);
7746 return Ok(response);
7747 }
7748 }
7749 }
7750 }
7751
7752 /// GTM Container's API relative path.
7753 ///
7754 /// Sets the *parent* path property to the given value.
7755 ///
7756 /// Even though the property as already been set when instantiating this call,
7757 /// we provide this method for API completeness.
7758 pub fn parent(mut self, new_value: &str) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7759 self._parent = new_value.to_string();
7760 self
7761 }
7762 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7763 /// while executing the actual API request.
7764 ///
7765 /// ````text
7766 /// It should be used to handle progress information, and to implement a certain level of resilience.
7767 /// ````
7768 ///
7769 /// Sets the *delegate* property to the given value.
7770 pub fn delegate(
7771 mut self,
7772 new_value: &'a mut dyn common::Delegate,
7773 ) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7774 self._delegate = Some(new_value);
7775 self
7776 }
7777
7778 /// Set any additional parameter of the query string used in the request.
7779 /// It should be used to set parameters which are not yet available through their own
7780 /// setters.
7781 ///
7782 /// Please note that this method must not be used to set any of the known parameters
7783 /// which have their own setter method. If done anyway, the request will fail.
7784 ///
7785 /// # Additional Parameters
7786 ///
7787 /// * *$.xgafv* (query-string) - V1 error format.
7788 /// * *access_token* (query-string) - OAuth access token.
7789 /// * *alt* (query-string) - Data format for response.
7790 /// * *callback* (query-string) - JSONP
7791 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7792 /// * *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.
7793 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7794 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7795 /// * *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.
7796 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7797 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7798 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionHeaderLatestCall<'a, C>
7799 where
7800 T: AsRef<str>,
7801 {
7802 self._additional_params
7803 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7804 self
7805 }
7806
7807 /// Identifies the authorization scope for the method you are building.
7808 ///
7809 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7810 /// [`Scope::Readonly`].
7811 ///
7812 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7813 /// tokens for more than one scope.
7814 ///
7815 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7816 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7817 /// sufficient, a read-write scope will do as well.
7818 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionHeaderLatestCall<'a, C>
7819 where
7820 St: AsRef<str>,
7821 {
7822 self._scopes.insert(String::from(scope.as_ref()));
7823 self
7824 }
7825 /// Identifies the authorization scope(s) for the method you are building.
7826 ///
7827 /// See [`Self::add_scope()`] for details.
7828 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionHeaderLatestCall<'a, C>
7829 where
7830 I: IntoIterator<Item = St>,
7831 St: AsRef<str>,
7832 {
7833 self._scopes
7834 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7835 self
7836 }
7837
7838 /// Removes all scopes, and no default scope will be used either.
7839 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7840 /// for details).
7841 pub fn clear_scopes(mut self) -> AccountContainerVersionHeaderLatestCall<'a, C> {
7842 self._scopes.clear();
7843 self
7844 }
7845}
7846
7847/// Lists all Container Versions of a GTM Container.
7848///
7849/// A builder for the *containers.version_headers.list* method supported by a *account* resource.
7850/// It is not used directly, but through a [`AccountMethods`] instance.
7851///
7852/// # Example
7853///
7854/// Instantiate a resource method builder
7855///
7856/// ```test_harness,no_run
7857/// # extern crate hyper;
7858/// # extern crate hyper_rustls;
7859/// # extern crate google_tagmanager2 as tagmanager2;
7860/// # async fn dox() {
7861/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7862///
7863/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7864/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7865/// # .with_native_roots()
7866/// # .unwrap()
7867/// # .https_only()
7868/// # .enable_http2()
7869/// # .build();
7870///
7871/// # let executor = hyper_util::rt::TokioExecutor::new();
7872/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7873/// # secret,
7874/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7875/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7876/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7877/// # ),
7878/// # ).build().await.unwrap();
7879///
7880/// # let client = hyper_util::client::legacy::Client::builder(
7881/// # hyper_util::rt::TokioExecutor::new()
7882/// # )
7883/// # .build(
7884/// # hyper_rustls::HttpsConnectorBuilder::new()
7885/// # .with_native_roots()
7886/// # .unwrap()
7887/// # .https_or_http()
7888/// # .enable_http2()
7889/// # .build()
7890/// # );
7891/// # let mut hub = TagManager::new(client, auth);
7892/// // You can configure optional parameters by calling the respective setters at will, and
7893/// // execute the final call using `doit()`.
7894/// // Values shown here are possibly random and not representative !
7895/// let result = hub.accounts().containers_version_headers_list("parent")
7896/// .page_token("et")
7897/// .include_deleted(true)
7898/// .doit().await;
7899/// # }
7900/// ```
7901pub struct AccountContainerVersionHeaderListCall<'a, C>
7902where
7903 C: 'a,
7904{
7905 hub: &'a TagManager<C>,
7906 _parent: String,
7907 _page_token: Option<String>,
7908 _include_deleted: Option<bool>,
7909 _delegate: Option<&'a mut dyn common::Delegate>,
7910 _additional_params: HashMap<String, String>,
7911 _scopes: BTreeSet<String>,
7912}
7913
7914impl<'a, C> common::CallBuilder for AccountContainerVersionHeaderListCall<'a, C> {}
7915
7916impl<'a, C> AccountContainerVersionHeaderListCall<'a, C>
7917where
7918 C: common::Connector,
7919{
7920 /// Perform the operation you have build so far.
7921 pub async fn doit(
7922 mut self,
7923 ) -> common::Result<(common::Response, ListContainerVersionsResponse)> {
7924 use std::borrow::Cow;
7925 use std::io::{Read, Seek};
7926
7927 use common::{url::Params, ToParts};
7928 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7929
7930 let mut dd = common::DefaultDelegate;
7931 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7932 dlg.begin(common::MethodInfo {
7933 id: "tagmanager.accounts.containers.version_headers.list",
7934 http_method: hyper::Method::GET,
7935 });
7936
7937 for &field in ["alt", "parent", "pageToken", "includeDeleted"].iter() {
7938 if self._additional_params.contains_key(field) {
7939 dlg.finished(false);
7940 return Err(common::Error::FieldClash(field));
7941 }
7942 }
7943
7944 let mut params = Params::with_capacity(5 + self._additional_params.len());
7945 params.push("parent", self._parent);
7946 if let Some(value) = self._page_token.as_ref() {
7947 params.push("pageToken", value);
7948 }
7949 if let Some(value) = self._include_deleted.as_ref() {
7950 params.push("includeDeleted", value.to_string());
7951 }
7952
7953 params.extend(self._additional_params.iter());
7954
7955 params.push("alt", "json");
7956 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/version_headers";
7957 if self._scopes.is_empty() {
7958 self._scopes.insert(Scope::Readonly.as_ref().to_string());
7959 }
7960
7961 #[allow(clippy::single_element_loop)]
7962 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7963 url = params.uri_replacement(url, param_name, find_this, true);
7964 }
7965 {
7966 let to_remove = ["parent"];
7967 params.remove_params(&to_remove);
7968 }
7969
7970 let url = params.parse_with_url(&url);
7971
7972 loop {
7973 let token = match self
7974 .hub
7975 .auth
7976 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7977 .await
7978 {
7979 Ok(token) => token,
7980 Err(e) => match dlg.token(e) {
7981 Ok(token) => token,
7982 Err(e) => {
7983 dlg.finished(false);
7984 return Err(common::Error::MissingToken(e));
7985 }
7986 },
7987 };
7988 let mut req_result = {
7989 let client = &self.hub.client;
7990 dlg.pre_request();
7991 let mut req_builder = hyper::Request::builder()
7992 .method(hyper::Method::GET)
7993 .uri(url.as_str())
7994 .header(USER_AGENT, self.hub._user_agent.clone());
7995
7996 if let Some(token) = token.as_ref() {
7997 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7998 }
7999
8000 let request = req_builder
8001 .header(CONTENT_LENGTH, 0_u64)
8002 .body(common::to_body::<String>(None));
8003
8004 client.request(request.unwrap()).await
8005 };
8006
8007 match req_result {
8008 Err(err) => {
8009 if let common::Retry::After(d) = dlg.http_error(&err) {
8010 sleep(d).await;
8011 continue;
8012 }
8013 dlg.finished(false);
8014 return Err(common::Error::HttpError(err));
8015 }
8016 Ok(res) => {
8017 let (mut parts, body) = res.into_parts();
8018 let mut body = common::Body::new(body);
8019 if !parts.status.is_success() {
8020 let bytes = common::to_bytes(body).await.unwrap_or_default();
8021 let error = serde_json::from_str(&common::to_string(&bytes));
8022 let response = common::to_response(parts, bytes.into());
8023
8024 if let common::Retry::After(d) =
8025 dlg.http_failure(&response, error.as_ref().ok())
8026 {
8027 sleep(d).await;
8028 continue;
8029 }
8030
8031 dlg.finished(false);
8032
8033 return Err(match error {
8034 Ok(value) => common::Error::BadRequest(value),
8035 _ => common::Error::Failure(response),
8036 });
8037 }
8038 let response = {
8039 let bytes = common::to_bytes(body).await.unwrap_or_default();
8040 let encoded = common::to_string(&bytes);
8041 match serde_json::from_str(&encoded) {
8042 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8043 Err(error) => {
8044 dlg.response_json_decode_error(&encoded, &error);
8045 return Err(common::Error::JsonDecodeError(
8046 encoded.to_string(),
8047 error,
8048 ));
8049 }
8050 }
8051 };
8052
8053 dlg.finished(true);
8054 return Ok(response);
8055 }
8056 }
8057 }
8058 }
8059
8060 /// GTM Container's API relative path.
8061 ///
8062 /// Sets the *parent* path property to the given value.
8063 ///
8064 /// Even though the property as already been set when instantiating this call,
8065 /// we provide this method for API completeness.
8066 pub fn parent(mut self, new_value: &str) -> AccountContainerVersionHeaderListCall<'a, C> {
8067 self._parent = new_value.to_string();
8068 self
8069 }
8070 /// Continuation token for fetching the next page of results.
8071 ///
8072 /// Sets the *page token* query property to the given value.
8073 pub fn page_token(mut self, new_value: &str) -> AccountContainerVersionHeaderListCall<'a, C> {
8074 self._page_token = Some(new_value.to_string());
8075 self
8076 }
8077 /// Also retrieve deleted (archived) versions when true.
8078 ///
8079 /// Sets the *include deleted* query property to the given value.
8080 pub fn include_deleted(
8081 mut self,
8082 new_value: bool,
8083 ) -> AccountContainerVersionHeaderListCall<'a, C> {
8084 self._include_deleted = Some(new_value);
8085 self
8086 }
8087 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8088 /// while executing the actual API request.
8089 ///
8090 /// ````text
8091 /// It should be used to handle progress information, and to implement a certain level of resilience.
8092 /// ````
8093 ///
8094 /// Sets the *delegate* property to the given value.
8095 pub fn delegate(
8096 mut self,
8097 new_value: &'a mut dyn common::Delegate,
8098 ) -> AccountContainerVersionHeaderListCall<'a, C> {
8099 self._delegate = Some(new_value);
8100 self
8101 }
8102
8103 /// Set any additional parameter of the query string used in the request.
8104 /// It should be used to set parameters which are not yet available through their own
8105 /// setters.
8106 ///
8107 /// Please note that this method must not be used to set any of the known parameters
8108 /// which have their own setter method. If done anyway, the request will fail.
8109 ///
8110 /// # Additional Parameters
8111 ///
8112 /// * *$.xgafv* (query-string) - V1 error format.
8113 /// * *access_token* (query-string) - OAuth access token.
8114 /// * *alt* (query-string) - Data format for response.
8115 /// * *callback* (query-string) - JSONP
8116 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8117 /// * *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.
8118 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8119 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8120 /// * *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.
8121 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8122 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8123 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionHeaderListCall<'a, C>
8124 where
8125 T: AsRef<str>,
8126 {
8127 self._additional_params
8128 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8129 self
8130 }
8131
8132 /// Identifies the authorization scope for the method you are building.
8133 ///
8134 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8135 /// [`Scope::Readonly`].
8136 ///
8137 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8138 /// tokens for more than one scope.
8139 ///
8140 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8141 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8142 /// sufficient, a read-write scope will do as well.
8143 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionHeaderListCall<'a, C>
8144 where
8145 St: AsRef<str>,
8146 {
8147 self._scopes.insert(String::from(scope.as_ref()));
8148 self
8149 }
8150 /// Identifies the authorization scope(s) for the method you are building.
8151 ///
8152 /// See [`Self::add_scope()`] for details.
8153 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionHeaderListCall<'a, C>
8154 where
8155 I: IntoIterator<Item = St>,
8156 St: AsRef<str>,
8157 {
8158 self._scopes
8159 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8160 self
8161 }
8162
8163 /// Removes all scopes, and no default scope will be used either.
8164 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8165 /// for details).
8166 pub fn clear_scopes(mut self) -> AccountContainerVersionHeaderListCall<'a, C> {
8167 self._scopes.clear();
8168 self
8169 }
8170}
8171
8172/// Deletes a Container Version.
8173///
8174/// A builder for the *containers.versions.delete* method supported by a *account* resource.
8175/// It is not used directly, but through a [`AccountMethods`] instance.
8176///
8177/// # Example
8178///
8179/// Instantiate a resource method builder
8180///
8181/// ```test_harness,no_run
8182/// # extern crate hyper;
8183/// # extern crate hyper_rustls;
8184/// # extern crate google_tagmanager2 as tagmanager2;
8185/// # async fn dox() {
8186/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8187///
8188/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8189/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8190/// # .with_native_roots()
8191/// # .unwrap()
8192/// # .https_only()
8193/// # .enable_http2()
8194/// # .build();
8195///
8196/// # let executor = hyper_util::rt::TokioExecutor::new();
8197/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8198/// # secret,
8199/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8200/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8201/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8202/// # ),
8203/// # ).build().await.unwrap();
8204///
8205/// # let client = hyper_util::client::legacy::Client::builder(
8206/// # hyper_util::rt::TokioExecutor::new()
8207/// # )
8208/// # .build(
8209/// # hyper_rustls::HttpsConnectorBuilder::new()
8210/// # .with_native_roots()
8211/// # .unwrap()
8212/// # .https_or_http()
8213/// # .enable_http2()
8214/// # .build()
8215/// # );
8216/// # let mut hub = TagManager::new(client, auth);
8217/// // You can configure optional parameters by calling the respective setters at will, and
8218/// // execute the final call using `doit()`.
8219/// // Values shown here are possibly random and not representative !
8220/// let result = hub.accounts().containers_versions_delete("path")
8221/// .doit().await;
8222/// # }
8223/// ```
8224pub struct AccountContainerVersionDeleteCall<'a, C>
8225where
8226 C: 'a,
8227{
8228 hub: &'a TagManager<C>,
8229 _path: String,
8230 _delegate: Option<&'a mut dyn common::Delegate>,
8231 _additional_params: HashMap<String, String>,
8232 _scopes: BTreeSet<String>,
8233}
8234
8235impl<'a, C> common::CallBuilder for AccountContainerVersionDeleteCall<'a, C> {}
8236
8237impl<'a, C> AccountContainerVersionDeleteCall<'a, C>
8238where
8239 C: common::Connector,
8240{
8241 /// Perform the operation you have build so far.
8242 pub async fn doit(mut self) -> common::Result<common::Response> {
8243 use std::borrow::Cow;
8244 use std::io::{Read, Seek};
8245
8246 use common::{url::Params, ToParts};
8247 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8248
8249 let mut dd = common::DefaultDelegate;
8250 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8251 dlg.begin(common::MethodInfo {
8252 id: "tagmanager.accounts.containers.versions.delete",
8253 http_method: hyper::Method::DELETE,
8254 });
8255
8256 for &field in ["path"].iter() {
8257 if self._additional_params.contains_key(field) {
8258 dlg.finished(false);
8259 return Err(common::Error::FieldClash(field));
8260 }
8261 }
8262
8263 let mut params = Params::with_capacity(2 + self._additional_params.len());
8264 params.push("path", self._path);
8265
8266 params.extend(self._additional_params.iter());
8267
8268 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
8269 if self._scopes.is_empty() {
8270 self._scopes
8271 .insert(Scope::EditContainerversion.as_ref().to_string());
8272 }
8273
8274 #[allow(clippy::single_element_loop)]
8275 for &(find_this, param_name) in [("{+path}", "path")].iter() {
8276 url = params.uri_replacement(url, param_name, find_this, true);
8277 }
8278 {
8279 let to_remove = ["path"];
8280 params.remove_params(&to_remove);
8281 }
8282
8283 let url = params.parse_with_url(&url);
8284
8285 loop {
8286 let token = match self
8287 .hub
8288 .auth
8289 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8290 .await
8291 {
8292 Ok(token) => token,
8293 Err(e) => match dlg.token(e) {
8294 Ok(token) => token,
8295 Err(e) => {
8296 dlg.finished(false);
8297 return Err(common::Error::MissingToken(e));
8298 }
8299 },
8300 };
8301 let mut req_result = {
8302 let client = &self.hub.client;
8303 dlg.pre_request();
8304 let mut req_builder = hyper::Request::builder()
8305 .method(hyper::Method::DELETE)
8306 .uri(url.as_str())
8307 .header(USER_AGENT, self.hub._user_agent.clone());
8308
8309 if let Some(token) = token.as_ref() {
8310 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8311 }
8312
8313 let request = req_builder
8314 .header(CONTENT_LENGTH, 0_u64)
8315 .body(common::to_body::<String>(None));
8316
8317 client.request(request.unwrap()).await
8318 };
8319
8320 match req_result {
8321 Err(err) => {
8322 if let common::Retry::After(d) = dlg.http_error(&err) {
8323 sleep(d).await;
8324 continue;
8325 }
8326 dlg.finished(false);
8327 return Err(common::Error::HttpError(err));
8328 }
8329 Ok(res) => {
8330 let (mut parts, body) = res.into_parts();
8331 let mut body = common::Body::new(body);
8332 if !parts.status.is_success() {
8333 let bytes = common::to_bytes(body).await.unwrap_or_default();
8334 let error = serde_json::from_str(&common::to_string(&bytes));
8335 let response = common::to_response(parts, bytes.into());
8336
8337 if let common::Retry::After(d) =
8338 dlg.http_failure(&response, error.as_ref().ok())
8339 {
8340 sleep(d).await;
8341 continue;
8342 }
8343
8344 dlg.finished(false);
8345
8346 return Err(match error {
8347 Ok(value) => common::Error::BadRequest(value),
8348 _ => common::Error::Failure(response),
8349 });
8350 }
8351 let response = common::Response::from_parts(parts, body);
8352
8353 dlg.finished(true);
8354 return Ok(response);
8355 }
8356 }
8357 }
8358 }
8359
8360 /// GTM ContainerVersion's API relative path.
8361 ///
8362 /// Sets the *path* path property to the given value.
8363 ///
8364 /// Even though the property as already been set when instantiating this call,
8365 /// we provide this method for API completeness.
8366 pub fn path(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C> {
8367 self._path = new_value.to_string();
8368 self
8369 }
8370 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8371 /// while executing the actual API request.
8372 ///
8373 /// ````text
8374 /// It should be used to handle progress information, and to implement a certain level of resilience.
8375 /// ````
8376 ///
8377 /// Sets the *delegate* property to the given value.
8378 pub fn delegate(
8379 mut self,
8380 new_value: &'a mut dyn common::Delegate,
8381 ) -> AccountContainerVersionDeleteCall<'a, C> {
8382 self._delegate = Some(new_value);
8383 self
8384 }
8385
8386 /// Set any additional parameter of the query string used in the request.
8387 /// It should be used to set parameters which are not yet available through their own
8388 /// setters.
8389 ///
8390 /// Please note that this method must not be used to set any of the known parameters
8391 /// which have their own setter method. If done anyway, the request will fail.
8392 ///
8393 /// # Additional Parameters
8394 ///
8395 /// * *$.xgafv* (query-string) - V1 error format.
8396 /// * *access_token* (query-string) - OAuth access token.
8397 /// * *alt* (query-string) - Data format for response.
8398 /// * *callback* (query-string) - JSONP
8399 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8400 /// * *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.
8401 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8402 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8403 /// * *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.
8404 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8405 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8406 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionDeleteCall<'a, C>
8407 where
8408 T: AsRef<str>,
8409 {
8410 self._additional_params
8411 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8412 self
8413 }
8414
8415 /// Identifies the authorization scope for the method you are building.
8416 ///
8417 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8418 /// [`Scope::EditContainerversion`].
8419 ///
8420 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8421 /// tokens for more than one scope.
8422 ///
8423 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8424 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8425 /// sufficient, a read-write scope will do as well.
8426 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionDeleteCall<'a, C>
8427 where
8428 St: AsRef<str>,
8429 {
8430 self._scopes.insert(String::from(scope.as_ref()));
8431 self
8432 }
8433 /// Identifies the authorization scope(s) for the method you are building.
8434 ///
8435 /// See [`Self::add_scope()`] for details.
8436 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionDeleteCall<'a, C>
8437 where
8438 I: IntoIterator<Item = St>,
8439 St: AsRef<str>,
8440 {
8441 self._scopes
8442 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8443 self
8444 }
8445
8446 /// Removes all scopes, and no default scope will be used either.
8447 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8448 /// for details).
8449 pub fn clear_scopes(mut self) -> AccountContainerVersionDeleteCall<'a, C> {
8450 self._scopes.clear();
8451 self
8452 }
8453}
8454
8455/// Gets a Container Version.
8456///
8457/// A builder for the *containers.versions.get* method supported by a *account* resource.
8458/// It is not used directly, but through a [`AccountMethods`] instance.
8459///
8460/// # Example
8461///
8462/// Instantiate a resource method builder
8463///
8464/// ```test_harness,no_run
8465/// # extern crate hyper;
8466/// # extern crate hyper_rustls;
8467/// # extern crate google_tagmanager2 as tagmanager2;
8468/// # async fn dox() {
8469/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8470///
8471/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8472/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8473/// # .with_native_roots()
8474/// # .unwrap()
8475/// # .https_only()
8476/// # .enable_http2()
8477/// # .build();
8478///
8479/// # let executor = hyper_util::rt::TokioExecutor::new();
8480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8481/// # secret,
8482/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8483/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8484/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8485/// # ),
8486/// # ).build().await.unwrap();
8487///
8488/// # let client = hyper_util::client::legacy::Client::builder(
8489/// # hyper_util::rt::TokioExecutor::new()
8490/// # )
8491/// # .build(
8492/// # hyper_rustls::HttpsConnectorBuilder::new()
8493/// # .with_native_roots()
8494/// # .unwrap()
8495/// # .https_or_http()
8496/// # .enable_http2()
8497/// # .build()
8498/// # );
8499/// # let mut hub = TagManager::new(client, auth);
8500/// // You can configure optional parameters by calling the respective setters at will, and
8501/// // execute the final call using `doit()`.
8502/// // Values shown here are possibly random and not representative !
8503/// let result = hub.accounts().containers_versions_get("path")
8504/// .container_version_id("sed")
8505/// .doit().await;
8506/// # }
8507/// ```
8508pub struct AccountContainerVersionGetCall<'a, C>
8509where
8510 C: 'a,
8511{
8512 hub: &'a TagManager<C>,
8513 _path: String,
8514 _container_version_id: Option<String>,
8515 _delegate: Option<&'a mut dyn common::Delegate>,
8516 _additional_params: HashMap<String, String>,
8517 _scopes: BTreeSet<String>,
8518}
8519
8520impl<'a, C> common::CallBuilder for AccountContainerVersionGetCall<'a, C> {}
8521
8522impl<'a, C> AccountContainerVersionGetCall<'a, C>
8523where
8524 C: common::Connector,
8525{
8526 /// Perform the operation you have build so far.
8527 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
8528 use std::borrow::Cow;
8529 use std::io::{Read, Seek};
8530
8531 use common::{url::Params, ToParts};
8532 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8533
8534 let mut dd = common::DefaultDelegate;
8535 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8536 dlg.begin(common::MethodInfo {
8537 id: "tagmanager.accounts.containers.versions.get",
8538 http_method: hyper::Method::GET,
8539 });
8540
8541 for &field in ["alt", "path", "containerVersionId"].iter() {
8542 if self._additional_params.contains_key(field) {
8543 dlg.finished(false);
8544 return Err(common::Error::FieldClash(field));
8545 }
8546 }
8547
8548 let mut params = Params::with_capacity(4 + self._additional_params.len());
8549 params.push("path", self._path);
8550 if let Some(value) = self._container_version_id.as_ref() {
8551 params.push("containerVersionId", value);
8552 }
8553
8554 params.extend(self._additional_params.iter());
8555
8556 params.push("alt", "json");
8557 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
8558 if self._scopes.is_empty() {
8559 self._scopes.insert(Scope::Readonly.as_ref().to_string());
8560 }
8561
8562 #[allow(clippy::single_element_loop)]
8563 for &(find_this, param_name) in [("{+path}", "path")].iter() {
8564 url = params.uri_replacement(url, param_name, find_this, true);
8565 }
8566 {
8567 let to_remove = ["path"];
8568 params.remove_params(&to_remove);
8569 }
8570
8571 let url = params.parse_with_url(&url);
8572
8573 loop {
8574 let token = match self
8575 .hub
8576 .auth
8577 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8578 .await
8579 {
8580 Ok(token) => token,
8581 Err(e) => match dlg.token(e) {
8582 Ok(token) => token,
8583 Err(e) => {
8584 dlg.finished(false);
8585 return Err(common::Error::MissingToken(e));
8586 }
8587 },
8588 };
8589 let mut req_result = {
8590 let client = &self.hub.client;
8591 dlg.pre_request();
8592 let mut req_builder = hyper::Request::builder()
8593 .method(hyper::Method::GET)
8594 .uri(url.as_str())
8595 .header(USER_AGENT, self.hub._user_agent.clone());
8596
8597 if let Some(token) = token.as_ref() {
8598 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8599 }
8600
8601 let request = req_builder
8602 .header(CONTENT_LENGTH, 0_u64)
8603 .body(common::to_body::<String>(None));
8604
8605 client.request(request.unwrap()).await
8606 };
8607
8608 match req_result {
8609 Err(err) => {
8610 if let common::Retry::After(d) = dlg.http_error(&err) {
8611 sleep(d).await;
8612 continue;
8613 }
8614 dlg.finished(false);
8615 return Err(common::Error::HttpError(err));
8616 }
8617 Ok(res) => {
8618 let (mut parts, body) = res.into_parts();
8619 let mut body = common::Body::new(body);
8620 if !parts.status.is_success() {
8621 let bytes = common::to_bytes(body).await.unwrap_or_default();
8622 let error = serde_json::from_str(&common::to_string(&bytes));
8623 let response = common::to_response(parts, bytes.into());
8624
8625 if let common::Retry::After(d) =
8626 dlg.http_failure(&response, error.as_ref().ok())
8627 {
8628 sleep(d).await;
8629 continue;
8630 }
8631
8632 dlg.finished(false);
8633
8634 return Err(match error {
8635 Ok(value) => common::Error::BadRequest(value),
8636 _ => common::Error::Failure(response),
8637 });
8638 }
8639 let response = {
8640 let bytes = common::to_bytes(body).await.unwrap_or_default();
8641 let encoded = common::to_string(&bytes);
8642 match serde_json::from_str(&encoded) {
8643 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8644 Err(error) => {
8645 dlg.response_json_decode_error(&encoded, &error);
8646 return Err(common::Error::JsonDecodeError(
8647 encoded.to_string(),
8648 error,
8649 ));
8650 }
8651 }
8652 };
8653
8654 dlg.finished(true);
8655 return Ok(response);
8656 }
8657 }
8658 }
8659 }
8660
8661 /// GTM ContainerVersion's API relative path.
8662 ///
8663 /// Sets the *path* path property to the given value.
8664 ///
8665 /// Even though the property as already been set when instantiating this call,
8666 /// we provide this method for API completeness.
8667 pub fn path(mut self, new_value: &str) -> AccountContainerVersionGetCall<'a, C> {
8668 self._path = new_value.to_string();
8669 self
8670 }
8671 /// The GTM ContainerVersion ID. Specify published to retrieve the currently published version.
8672 ///
8673 /// Sets the *container version id* query property to the given value.
8674 pub fn container_version_id(
8675 mut self,
8676 new_value: &str,
8677 ) -> AccountContainerVersionGetCall<'a, C> {
8678 self._container_version_id = Some(new_value.to_string());
8679 self
8680 }
8681 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8682 /// while executing the actual API request.
8683 ///
8684 /// ````text
8685 /// It should be used to handle progress information, and to implement a certain level of resilience.
8686 /// ````
8687 ///
8688 /// Sets the *delegate* property to the given value.
8689 pub fn delegate(
8690 mut self,
8691 new_value: &'a mut dyn common::Delegate,
8692 ) -> AccountContainerVersionGetCall<'a, C> {
8693 self._delegate = Some(new_value);
8694 self
8695 }
8696
8697 /// Set any additional parameter of the query string used in the request.
8698 /// It should be used to set parameters which are not yet available through their own
8699 /// setters.
8700 ///
8701 /// Please note that this method must not be used to set any of the known parameters
8702 /// which have their own setter method. If done anyway, the request will fail.
8703 ///
8704 /// # Additional Parameters
8705 ///
8706 /// * *$.xgafv* (query-string) - V1 error format.
8707 /// * *access_token* (query-string) - OAuth access token.
8708 /// * *alt* (query-string) - Data format for response.
8709 /// * *callback* (query-string) - JSONP
8710 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8711 /// * *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.
8712 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8713 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8714 /// * *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.
8715 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8716 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8717 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionGetCall<'a, C>
8718 where
8719 T: AsRef<str>,
8720 {
8721 self._additional_params
8722 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8723 self
8724 }
8725
8726 /// Identifies the authorization scope for the method you are building.
8727 ///
8728 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8729 /// [`Scope::Readonly`].
8730 ///
8731 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8732 /// tokens for more than one scope.
8733 ///
8734 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8735 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8736 /// sufficient, a read-write scope will do as well.
8737 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionGetCall<'a, C>
8738 where
8739 St: AsRef<str>,
8740 {
8741 self._scopes.insert(String::from(scope.as_ref()));
8742 self
8743 }
8744 /// Identifies the authorization scope(s) for the method you are building.
8745 ///
8746 /// See [`Self::add_scope()`] for details.
8747 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionGetCall<'a, C>
8748 where
8749 I: IntoIterator<Item = St>,
8750 St: AsRef<str>,
8751 {
8752 self._scopes
8753 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8754 self
8755 }
8756
8757 /// Removes all scopes, and no default scope will be used either.
8758 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8759 /// for details).
8760 pub fn clear_scopes(mut self) -> AccountContainerVersionGetCall<'a, C> {
8761 self._scopes.clear();
8762 self
8763 }
8764}
8765
8766/// Gets the live (i.e. published) container version
8767///
8768/// A builder for the *containers.versions.live* method supported by a *account* resource.
8769/// It is not used directly, but through a [`AccountMethods`] instance.
8770///
8771/// # Example
8772///
8773/// Instantiate a resource method builder
8774///
8775/// ```test_harness,no_run
8776/// # extern crate hyper;
8777/// # extern crate hyper_rustls;
8778/// # extern crate google_tagmanager2 as tagmanager2;
8779/// # async fn dox() {
8780/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8781///
8782/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8783/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8784/// # .with_native_roots()
8785/// # .unwrap()
8786/// # .https_only()
8787/// # .enable_http2()
8788/// # .build();
8789///
8790/// # let executor = hyper_util::rt::TokioExecutor::new();
8791/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8792/// # secret,
8793/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8794/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8795/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8796/// # ),
8797/// # ).build().await.unwrap();
8798///
8799/// # let client = hyper_util::client::legacy::Client::builder(
8800/// # hyper_util::rt::TokioExecutor::new()
8801/// # )
8802/// # .build(
8803/// # hyper_rustls::HttpsConnectorBuilder::new()
8804/// # .with_native_roots()
8805/// # .unwrap()
8806/// # .https_or_http()
8807/// # .enable_http2()
8808/// # .build()
8809/// # );
8810/// # let mut hub = TagManager::new(client, auth);
8811/// // You can configure optional parameters by calling the respective setters at will, and
8812/// // execute the final call using `doit()`.
8813/// // Values shown here are possibly random and not representative !
8814/// let result = hub.accounts().containers_versions_live("parent")
8815/// .doit().await;
8816/// # }
8817/// ```
8818pub struct AccountContainerVersionLiveCall<'a, C>
8819where
8820 C: 'a,
8821{
8822 hub: &'a TagManager<C>,
8823 _parent: String,
8824 _delegate: Option<&'a mut dyn common::Delegate>,
8825 _additional_params: HashMap<String, String>,
8826 _scopes: BTreeSet<String>,
8827}
8828
8829impl<'a, C> common::CallBuilder for AccountContainerVersionLiveCall<'a, C> {}
8830
8831impl<'a, C> AccountContainerVersionLiveCall<'a, C>
8832where
8833 C: common::Connector,
8834{
8835 /// Perform the operation you have build so far.
8836 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
8837 use std::borrow::Cow;
8838 use std::io::{Read, Seek};
8839
8840 use common::{url::Params, ToParts};
8841 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8842
8843 let mut dd = common::DefaultDelegate;
8844 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8845 dlg.begin(common::MethodInfo {
8846 id: "tagmanager.accounts.containers.versions.live",
8847 http_method: hyper::Method::GET,
8848 });
8849
8850 for &field in ["alt", "parent"].iter() {
8851 if self._additional_params.contains_key(field) {
8852 dlg.finished(false);
8853 return Err(common::Error::FieldClash(field));
8854 }
8855 }
8856
8857 let mut params = Params::with_capacity(3 + self._additional_params.len());
8858 params.push("parent", self._parent);
8859
8860 params.extend(self._additional_params.iter());
8861
8862 params.push("alt", "json");
8863 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/versions:live";
8864 if self._scopes.is_empty() {
8865 self._scopes.insert(Scope::Readonly.as_ref().to_string());
8866 }
8867
8868 #[allow(clippy::single_element_loop)]
8869 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8870 url = params.uri_replacement(url, param_name, find_this, true);
8871 }
8872 {
8873 let to_remove = ["parent"];
8874 params.remove_params(&to_remove);
8875 }
8876
8877 let url = params.parse_with_url(&url);
8878
8879 loop {
8880 let token = match self
8881 .hub
8882 .auth
8883 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8884 .await
8885 {
8886 Ok(token) => token,
8887 Err(e) => match dlg.token(e) {
8888 Ok(token) => token,
8889 Err(e) => {
8890 dlg.finished(false);
8891 return Err(common::Error::MissingToken(e));
8892 }
8893 },
8894 };
8895 let mut req_result = {
8896 let client = &self.hub.client;
8897 dlg.pre_request();
8898 let mut req_builder = hyper::Request::builder()
8899 .method(hyper::Method::GET)
8900 .uri(url.as_str())
8901 .header(USER_AGENT, self.hub._user_agent.clone());
8902
8903 if let Some(token) = token.as_ref() {
8904 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8905 }
8906
8907 let request = req_builder
8908 .header(CONTENT_LENGTH, 0_u64)
8909 .body(common::to_body::<String>(None));
8910
8911 client.request(request.unwrap()).await
8912 };
8913
8914 match req_result {
8915 Err(err) => {
8916 if let common::Retry::After(d) = dlg.http_error(&err) {
8917 sleep(d).await;
8918 continue;
8919 }
8920 dlg.finished(false);
8921 return Err(common::Error::HttpError(err));
8922 }
8923 Ok(res) => {
8924 let (mut parts, body) = res.into_parts();
8925 let mut body = common::Body::new(body);
8926 if !parts.status.is_success() {
8927 let bytes = common::to_bytes(body).await.unwrap_or_default();
8928 let error = serde_json::from_str(&common::to_string(&bytes));
8929 let response = common::to_response(parts, bytes.into());
8930
8931 if let common::Retry::After(d) =
8932 dlg.http_failure(&response, error.as_ref().ok())
8933 {
8934 sleep(d).await;
8935 continue;
8936 }
8937
8938 dlg.finished(false);
8939
8940 return Err(match error {
8941 Ok(value) => common::Error::BadRequest(value),
8942 _ => common::Error::Failure(response),
8943 });
8944 }
8945 let response = {
8946 let bytes = common::to_bytes(body).await.unwrap_or_default();
8947 let encoded = common::to_string(&bytes);
8948 match serde_json::from_str(&encoded) {
8949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8950 Err(error) => {
8951 dlg.response_json_decode_error(&encoded, &error);
8952 return Err(common::Error::JsonDecodeError(
8953 encoded.to_string(),
8954 error,
8955 ));
8956 }
8957 }
8958 };
8959
8960 dlg.finished(true);
8961 return Ok(response);
8962 }
8963 }
8964 }
8965 }
8966
8967 /// GTM Container's API relative path.
8968 ///
8969 /// Sets the *parent* path property to the given value.
8970 ///
8971 /// Even though the property as already been set when instantiating this call,
8972 /// we provide this method for API completeness.
8973 pub fn parent(mut self, new_value: &str) -> AccountContainerVersionLiveCall<'a, C> {
8974 self._parent = new_value.to_string();
8975 self
8976 }
8977 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8978 /// while executing the actual API request.
8979 ///
8980 /// ````text
8981 /// It should be used to handle progress information, and to implement a certain level of resilience.
8982 /// ````
8983 ///
8984 /// Sets the *delegate* property to the given value.
8985 pub fn delegate(
8986 mut self,
8987 new_value: &'a mut dyn common::Delegate,
8988 ) -> AccountContainerVersionLiveCall<'a, C> {
8989 self._delegate = Some(new_value);
8990 self
8991 }
8992
8993 /// Set any additional parameter of the query string used in the request.
8994 /// It should be used to set parameters which are not yet available through their own
8995 /// setters.
8996 ///
8997 /// Please note that this method must not be used to set any of the known parameters
8998 /// which have their own setter method. If done anyway, the request will fail.
8999 ///
9000 /// # Additional Parameters
9001 ///
9002 /// * *$.xgafv* (query-string) - V1 error format.
9003 /// * *access_token* (query-string) - OAuth access token.
9004 /// * *alt* (query-string) - Data format for response.
9005 /// * *callback* (query-string) - JSONP
9006 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9007 /// * *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.
9008 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9009 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9010 /// * *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.
9011 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9012 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9013 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionLiveCall<'a, C>
9014 where
9015 T: AsRef<str>,
9016 {
9017 self._additional_params
9018 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9019 self
9020 }
9021
9022 /// Identifies the authorization scope for the method you are building.
9023 ///
9024 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9025 /// [`Scope::Readonly`].
9026 ///
9027 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9028 /// tokens for more than one scope.
9029 ///
9030 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9031 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9032 /// sufficient, a read-write scope will do as well.
9033 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionLiveCall<'a, C>
9034 where
9035 St: AsRef<str>,
9036 {
9037 self._scopes.insert(String::from(scope.as_ref()));
9038 self
9039 }
9040 /// Identifies the authorization scope(s) for the method you are building.
9041 ///
9042 /// See [`Self::add_scope()`] for details.
9043 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionLiveCall<'a, C>
9044 where
9045 I: IntoIterator<Item = St>,
9046 St: AsRef<str>,
9047 {
9048 self._scopes
9049 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9050 self
9051 }
9052
9053 /// Removes all scopes, and no default scope will be used either.
9054 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9055 /// for details).
9056 pub fn clear_scopes(mut self) -> AccountContainerVersionLiveCall<'a, C> {
9057 self._scopes.clear();
9058 self
9059 }
9060}
9061
9062/// Publishes a Container Version.
9063///
9064/// A builder for the *containers.versions.publish* method supported by a *account* resource.
9065/// It is not used directly, but through a [`AccountMethods`] instance.
9066///
9067/// # Example
9068///
9069/// Instantiate a resource method builder
9070///
9071/// ```test_harness,no_run
9072/// # extern crate hyper;
9073/// # extern crate hyper_rustls;
9074/// # extern crate google_tagmanager2 as tagmanager2;
9075/// # async fn dox() {
9076/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9077///
9078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9079/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9080/// # .with_native_roots()
9081/// # .unwrap()
9082/// # .https_only()
9083/// # .enable_http2()
9084/// # .build();
9085///
9086/// # let executor = hyper_util::rt::TokioExecutor::new();
9087/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9088/// # secret,
9089/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9090/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9091/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9092/// # ),
9093/// # ).build().await.unwrap();
9094///
9095/// # let client = hyper_util::client::legacy::Client::builder(
9096/// # hyper_util::rt::TokioExecutor::new()
9097/// # )
9098/// # .build(
9099/// # hyper_rustls::HttpsConnectorBuilder::new()
9100/// # .with_native_roots()
9101/// # .unwrap()
9102/// # .https_or_http()
9103/// # .enable_http2()
9104/// # .build()
9105/// # );
9106/// # let mut hub = TagManager::new(client, auth);
9107/// // You can configure optional parameters by calling the respective setters at will, and
9108/// // execute the final call using `doit()`.
9109/// // Values shown here are possibly random and not representative !
9110/// let result = hub.accounts().containers_versions_publish("path")
9111/// .fingerprint("et")
9112/// .doit().await;
9113/// # }
9114/// ```
9115pub struct AccountContainerVersionPublishCall<'a, C>
9116where
9117 C: 'a,
9118{
9119 hub: &'a TagManager<C>,
9120 _path: String,
9121 _fingerprint: Option<String>,
9122 _delegate: Option<&'a mut dyn common::Delegate>,
9123 _additional_params: HashMap<String, String>,
9124 _scopes: BTreeSet<String>,
9125}
9126
9127impl<'a, C> common::CallBuilder for AccountContainerVersionPublishCall<'a, C> {}
9128
9129impl<'a, C> AccountContainerVersionPublishCall<'a, C>
9130where
9131 C: common::Connector,
9132{
9133 /// Perform the operation you have build so far.
9134 pub async fn doit(
9135 mut self,
9136 ) -> common::Result<(common::Response, PublishContainerVersionResponse)> {
9137 use std::borrow::Cow;
9138 use std::io::{Read, Seek};
9139
9140 use common::{url::Params, ToParts};
9141 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9142
9143 let mut dd = common::DefaultDelegate;
9144 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9145 dlg.begin(common::MethodInfo {
9146 id: "tagmanager.accounts.containers.versions.publish",
9147 http_method: hyper::Method::POST,
9148 });
9149
9150 for &field in ["alt", "path", "fingerprint"].iter() {
9151 if self._additional_params.contains_key(field) {
9152 dlg.finished(false);
9153 return Err(common::Error::FieldClash(field));
9154 }
9155 }
9156
9157 let mut params = Params::with_capacity(4 + self._additional_params.len());
9158 params.push("path", self._path);
9159 if let Some(value) = self._fingerprint.as_ref() {
9160 params.push("fingerprint", value);
9161 }
9162
9163 params.extend(self._additional_params.iter());
9164
9165 params.push("alt", "json");
9166 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:publish";
9167 if self._scopes.is_empty() {
9168 self._scopes.insert(Scope::Publish.as_ref().to_string());
9169 }
9170
9171 #[allow(clippy::single_element_loop)]
9172 for &(find_this, param_name) in [("{+path}", "path")].iter() {
9173 url = params.uri_replacement(url, param_name, find_this, true);
9174 }
9175 {
9176 let to_remove = ["path"];
9177 params.remove_params(&to_remove);
9178 }
9179
9180 let url = params.parse_with_url(&url);
9181
9182 loop {
9183 let token = match self
9184 .hub
9185 .auth
9186 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9187 .await
9188 {
9189 Ok(token) => token,
9190 Err(e) => match dlg.token(e) {
9191 Ok(token) => token,
9192 Err(e) => {
9193 dlg.finished(false);
9194 return Err(common::Error::MissingToken(e));
9195 }
9196 },
9197 };
9198 let mut req_result = {
9199 let client = &self.hub.client;
9200 dlg.pre_request();
9201 let mut req_builder = hyper::Request::builder()
9202 .method(hyper::Method::POST)
9203 .uri(url.as_str())
9204 .header(USER_AGENT, self.hub._user_agent.clone());
9205
9206 if let Some(token) = token.as_ref() {
9207 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9208 }
9209
9210 let request = req_builder
9211 .header(CONTENT_LENGTH, 0_u64)
9212 .body(common::to_body::<String>(None));
9213
9214 client.request(request.unwrap()).await
9215 };
9216
9217 match req_result {
9218 Err(err) => {
9219 if let common::Retry::After(d) = dlg.http_error(&err) {
9220 sleep(d).await;
9221 continue;
9222 }
9223 dlg.finished(false);
9224 return Err(common::Error::HttpError(err));
9225 }
9226 Ok(res) => {
9227 let (mut parts, body) = res.into_parts();
9228 let mut body = common::Body::new(body);
9229 if !parts.status.is_success() {
9230 let bytes = common::to_bytes(body).await.unwrap_or_default();
9231 let error = serde_json::from_str(&common::to_string(&bytes));
9232 let response = common::to_response(parts, bytes.into());
9233
9234 if let common::Retry::After(d) =
9235 dlg.http_failure(&response, error.as_ref().ok())
9236 {
9237 sleep(d).await;
9238 continue;
9239 }
9240
9241 dlg.finished(false);
9242
9243 return Err(match error {
9244 Ok(value) => common::Error::BadRequest(value),
9245 _ => common::Error::Failure(response),
9246 });
9247 }
9248 let response = {
9249 let bytes = common::to_bytes(body).await.unwrap_or_default();
9250 let encoded = common::to_string(&bytes);
9251 match serde_json::from_str(&encoded) {
9252 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9253 Err(error) => {
9254 dlg.response_json_decode_error(&encoded, &error);
9255 return Err(common::Error::JsonDecodeError(
9256 encoded.to_string(),
9257 error,
9258 ));
9259 }
9260 }
9261 };
9262
9263 dlg.finished(true);
9264 return Ok(response);
9265 }
9266 }
9267 }
9268 }
9269
9270 /// GTM ContainerVersion's API relative path.
9271 ///
9272 /// Sets the *path* path property to the given value.
9273 ///
9274 /// Even though the property as already been set when instantiating this call,
9275 /// we provide this method for API completeness.
9276 pub fn path(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
9277 self._path = new_value.to_string();
9278 self
9279 }
9280 /// When provided, this fingerprint must match the fingerprint of the container version in storage.
9281 ///
9282 /// Sets the *fingerprint* query property to the given value.
9283 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionPublishCall<'a, C> {
9284 self._fingerprint = Some(new_value.to_string());
9285 self
9286 }
9287 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9288 /// while executing the actual API request.
9289 ///
9290 /// ````text
9291 /// It should be used to handle progress information, and to implement a certain level of resilience.
9292 /// ````
9293 ///
9294 /// Sets the *delegate* property to the given value.
9295 pub fn delegate(
9296 mut self,
9297 new_value: &'a mut dyn common::Delegate,
9298 ) -> AccountContainerVersionPublishCall<'a, C> {
9299 self._delegate = Some(new_value);
9300 self
9301 }
9302
9303 /// Set any additional parameter of the query string used in the request.
9304 /// It should be used to set parameters which are not yet available through their own
9305 /// setters.
9306 ///
9307 /// Please note that this method must not be used to set any of the known parameters
9308 /// which have their own setter method. If done anyway, the request will fail.
9309 ///
9310 /// # Additional Parameters
9311 ///
9312 /// * *$.xgafv* (query-string) - V1 error format.
9313 /// * *access_token* (query-string) - OAuth access token.
9314 /// * *alt* (query-string) - Data format for response.
9315 /// * *callback* (query-string) - JSONP
9316 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9317 /// * *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.
9318 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9319 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9320 /// * *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.
9321 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9322 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9323 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionPublishCall<'a, C>
9324 where
9325 T: AsRef<str>,
9326 {
9327 self._additional_params
9328 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9329 self
9330 }
9331
9332 /// Identifies the authorization scope for the method you are building.
9333 ///
9334 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9335 /// [`Scope::Publish`].
9336 ///
9337 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9338 /// tokens for more than one scope.
9339 ///
9340 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9341 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9342 /// sufficient, a read-write scope will do as well.
9343 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionPublishCall<'a, C>
9344 where
9345 St: AsRef<str>,
9346 {
9347 self._scopes.insert(String::from(scope.as_ref()));
9348 self
9349 }
9350 /// Identifies the authorization scope(s) for the method you are building.
9351 ///
9352 /// See [`Self::add_scope()`] for details.
9353 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionPublishCall<'a, C>
9354 where
9355 I: IntoIterator<Item = St>,
9356 St: AsRef<str>,
9357 {
9358 self._scopes
9359 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9360 self
9361 }
9362
9363 /// Removes all scopes, and no default scope will be used either.
9364 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9365 /// for details).
9366 pub fn clear_scopes(mut self) -> AccountContainerVersionPublishCall<'a, C> {
9367 self._scopes.clear();
9368 self
9369 }
9370}
9371
9372/// Sets the latest version used for synchronization of workspaces when detecting conflicts and errors.
9373///
9374/// A builder for the *containers.versions.set_latest* method supported by a *account* resource.
9375/// It is not used directly, but through a [`AccountMethods`] instance.
9376///
9377/// # Example
9378///
9379/// Instantiate a resource method builder
9380///
9381/// ```test_harness,no_run
9382/// # extern crate hyper;
9383/// # extern crate hyper_rustls;
9384/// # extern crate google_tagmanager2 as tagmanager2;
9385/// # async fn dox() {
9386/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9387///
9388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9389/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9390/// # .with_native_roots()
9391/// # .unwrap()
9392/// # .https_only()
9393/// # .enable_http2()
9394/// # .build();
9395///
9396/// # let executor = hyper_util::rt::TokioExecutor::new();
9397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9398/// # secret,
9399/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9400/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9401/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9402/// # ),
9403/// # ).build().await.unwrap();
9404///
9405/// # let client = hyper_util::client::legacy::Client::builder(
9406/// # hyper_util::rt::TokioExecutor::new()
9407/// # )
9408/// # .build(
9409/// # hyper_rustls::HttpsConnectorBuilder::new()
9410/// # .with_native_roots()
9411/// # .unwrap()
9412/// # .https_or_http()
9413/// # .enable_http2()
9414/// # .build()
9415/// # );
9416/// # let mut hub = TagManager::new(client, auth);
9417/// // You can configure optional parameters by calling the respective setters at will, and
9418/// // execute the final call using `doit()`.
9419/// // Values shown here are possibly random and not representative !
9420/// let result = hub.accounts().containers_versions_set_latest("path")
9421/// .doit().await;
9422/// # }
9423/// ```
9424pub struct AccountContainerVersionSetLatestCall<'a, C>
9425where
9426 C: 'a,
9427{
9428 hub: &'a TagManager<C>,
9429 _path: String,
9430 _delegate: Option<&'a mut dyn common::Delegate>,
9431 _additional_params: HashMap<String, String>,
9432 _scopes: BTreeSet<String>,
9433}
9434
9435impl<'a, C> common::CallBuilder for AccountContainerVersionSetLatestCall<'a, C> {}
9436
9437impl<'a, C> AccountContainerVersionSetLatestCall<'a, C>
9438where
9439 C: common::Connector,
9440{
9441 /// Perform the operation you have build so far.
9442 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
9443 use std::borrow::Cow;
9444 use std::io::{Read, Seek};
9445
9446 use common::{url::Params, ToParts};
9447 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9448
9449 let mut dd = common::DefaultDelegate;
9450 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9451 dlg.begin(common::MethodInfo {
9452 id: "tagmanager.accounts.containers.versions.set_latest",
9453 http_method: hyper::Method::POST,
9454 });
9455
9456 for &field in ["alt", "path"].iter() {
9457 if self._additional_params.contains_key(field) {
9458 dlg.finished(false);
9459 return Err(common::Error::FieldClash(field));
9460 }
9461 }
9462
9463 let mut params = Params::with_capacity(3 + self._additional_params.len());
9464 params.push("path", self._path);
9465
9466 params.extend(self._additional_params.iter());
9467
9468 params.push("alt", "json");
9469 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:set_latest";
9470 if self._scopes.is_empty() {
9471 self._scopes
9472 .insert(Scope::EditContainer.as_ref().to_string());
9473 }
9474
9475 #[allow(clippy::single_element_loop)]
9476 for &(find_this, param_name) in [("{+path}", "path")].iter() {
9477 url = params.uri_replacement(url, param_name, find_this, true);
9478 }
9479 {
9480 let to_remove = ["path"];
9481 params.remove_params(&to_remove);
9482 }
9483
9484 let url = params.parse_with_url(&url);
9485
9486 loop {
9487 let token = match self
9488 .hub
9489 .auth
9490 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9491 .await
9492 {
9493 Ok(token) => token,
9494 Err(e) => match dlg.token(e) {
9495 Ok(token) => token,
9496 Err(e) => {
9497 dlg.finished(false);
9498 return Err(common::Error::MissingToken(e));
9499 }
9500 },
9501 };
9502 let mut req_result = {
9503 let client = &self.hub.client;
9504 dlg.pre_request();
9505 let mut req_builder = hyper::Request::builder()
9506 .method(hyper::Method::POST)
9507 .uri(url.as_str())
9508 .header(USER_AGENT, self.hub._user_agent.clone());
9509
9510 if let Some(token) = token.as_ref() {
9511 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9512 }
9513
9514 let request = req_builder
9515 .header(CONTENT_LENGTH, 0_u64)
9516 .body(common::to_body::<String>(None));
9517
9518 client.request(request.unwrap()).await
9519 };
9520
9521 match req_result {
9522 Err(err) => {
9523 if let common::Retry::After(d) = dlg.http_error(&err) {
9524 sleep(d).await;
9525 continue;
9526 }
9527 dlg.finished(false);
9528 return Err(common::Error::HttpError(err));
9529 }
9530 Ok(res) => {
9531 let (mut parts, body) = res.into_parts();
9532 let mut body = common::Body::new(body);
9533 if !parts.status.is_success() {
9534 let bytes = common::to_bytes(body).await.unwrap_or_default();
9535 let error = serde_json::from_str(&common::to_string(&bytes));
9536 let response = common::to_response(parts, bytes.into());
9537
9538 if let common::Retry::After(d) =
9539 dlg.http_failure(&response, error.as_ref().ok())
9540 {
9541 sleep(d).await;
9542 continue;
9543 }
9544
9545 dlg.finished(false);
9546
9547 return Err(match error {
9548 Ok(value) => common::Error::BadRequest(value),
9549 _ => common::Error::Failure(response),
9550 });
9551 }
9552 let response = {
9553 let bytes = common::to_bytes(body).await.unwrap_or_default();
9554 let encoded = common::to_string(&bytes);
9555 match serde_json::from_str(&encoded) {
9556 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9557 Err(error) => {
9558 dlg.response_json_decode_error(&encoded, &error);
9559 return Err(common::Error::JsonDecodeError(
9560 encoded.to_string(),
9561 error,
9562 ));
9563 }
9564 }
9565 };
9566
9567 dlg.finished(true);
9568 return Ok(response);
9569 }
9570 }
9571 }
9572 }
9573
9574 /// GTM ContainerVersion's API relative path.
9575 ///
9576 /// Sets the *path* path property to the given value.
9577 ///
9578 /// Even though the property as already been set when instantiating this call,
9579 /// we provide this method for API completeness.
9580 pub fn path(mut self, new_value: &str) -> AccountContainerVersionSetLatestCall<'a, C> {
9581 self._path = new_value.to_string();
9582 self
9583 }
9584 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9585 /// while executing the actual API request.
9586 ///
9587 /// ````text
9588 /// It should be used to handle progress information, and to implement a certain level of resilience.
9589 /// ````
9590 ///
9591 /// Sets the *delegate* property to the given value.
9592 pub fn delegate(
9593 mut self,
9594 new_value: &'a mut dyn common::Delegate,
9595 ) -> AccountContainerVersionSetLatestCall<'a, C> {
9596 self._delegate = Some(new_value);
9597 self
9598 }
9599
9600 /// Set any additional parameter of the query string used in the request.
9601 /// It should be used to set parameters which are not yet available through their own
9602 /// setters.
9603 ///
9604 /// Please note that this method must not be used to set any of the known parameters
9605 /// which have their own setter method. If done anyway, the request will fail.
9606 ///
9607 /// # Additional Parameters
9608 ///
9609 /// * *$.xgafv* (query-string) - V1 error format.
9610 /// * *access_token* (query-string) - OAuth access token.
9611 /// * *alt* (query-string) - Data format for response.
9612 /// * *callback* (query-string) - JSONP
9613 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9614 /// * *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.
9615 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9616 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9617 /// * *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.
9618 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9619 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9620 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionSetLatestCall<'a, C>
9621 where
9622 T: AsRef<str>,
9623 {
9624 self._additional_params
9625 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9626 self
9627 }
9628
9629 /// Identifies the authorization scope for the method you are building.
9630 ///
9631 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9632 /// [`Scope::EditContainer`].
9633 ///
9634 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9635 /// tokens for more than one scope.
9636 ///
9637 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9638 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9639 /// sufficient, a read-write scope will do as well.
9640 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionSetLatestCall<'a, C>
9641 where
9642 St: AsRef<str>,
9643 {
9644 self._scopes.insert(String::from(scope.as_ref()));
9645 self
9646 }
9647 /// Identifies the authorization scope(s) for the method you are building.
9648 ///
9649 /// See [`Self::add_scope()`] for details.
9650 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionSetLatestCall<'a, C>
9651 where
9652 I: IntoIterator<Item = St>,
9653 St: AsRef<str>,
9654 {
9655 self._scopes
9656 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9657 self
9658 }
9659
9660 /// Removes all scopes, and no default scope will be used either.
9661 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9662 /// for details).
9663 pub fn clear_scopes(mut self) -> AccountContainerVersionSetLatestCall<'a, C> {
9664 self._scopes.clear();
9665 self
9666 }
9667}
9668
9669/// Undeletes a Container Version.
9670///
9671/// A builder for the *containers.versions.undelete* method supported by a *account* resource.
9672/// It is not used directly, but through a [`AccountMethods`] instance.
9673///
9674/// # Example
9675///
9676/// Instantiate a resource method builder
9677///
9678/// ```test_harness,no_run
9679/// # extern crate hyper;
9680/// # extern crate hyper_rustls;
9681/// # extern crate google_tagmanager2 as tagmanager2;
9682/// # async fn dox() {
9683/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9684///
9685/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9686/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9687/// # .with_native_roots()
9688/// # .unwrap()
9689/// # .https_only()
9690/// # .enable_http2()
9691/// # .build();
9692///
9693/// # let executor = hyper_util::rt::TokioExecutor::new();
9694/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9695/// # secret,
9696/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9697/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9698/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9699/// # ),
9700/// # ).build().await.unwrap();
9701///
9702/// # let client = hyper_util::client::legacy::Client::builder(
9703/// # hyper_util::rt::TokioExecutor::new()
9704/// # )
9705/// # .build(
9706/// # hyper_rustls::HttpsConnectorBuilder::new()
9707/// # .with_native_roots()
9708/// # .unwrap()
9709/// # .https_or_http()
9710/// # .enable_http2()
9711/// # .build()
9712/// # );
9713/// # let mut hub = TagManager::new(client, auth);
9714/// // You can configure optional parameters by calling the respective setters at will, and
9715/// // execute the final call using `doit()`.
9716/// // Values shown here are possibly random and not representative !
9717/// let result = hub.accounts().containers_versions_undelete("path")
9718/// .doit().await;
9719/// # }
9720/// ```
9721pub struct AccountContainerVersionUndeleteCall<'a, C>
9722where
9723 C: 'a,
9724{
9725 hub: &'a TagManager<C>,
9726 _path: String,
9727 _delegate: Option<&'a mut dyn common::Delegate>,
9728 _additional_params: HashMap<String, String>,
9729 _scopes: BTreeSet<String>,
9730}
9731
9732impl<'a, C> common::CallBuilder for AccountContainerVersionUndeleteCall<'a, C> {}
9733
9734impl<'a, C> AccountContainerVersionUndeleteCall<'a, C>
9735where
9736 C: common::Connector,
9737{
9738 /// Perform the operation you have build so far.
9739 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
9740 use std::borrow::Cow;
9741 use std::io::{Read, Seek};
9742
9743 use common::{url::Params, ToParts};
9744 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9745
9746 let mut dd = common::DefaultDelegate;
9747 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9748 dlg.begin(common::MethodInfo {
9749 id: "tagmanager.accounts.containers.versions.undelete",
9750 http_method: hyper::Method::POST,
9751 });
9752
9753 for &field in ["alt", "path"].iter() {
9754 if self._additional_params.contains_key(field) {
9755 dlg.finished(false);
9756 return Err(common::Error::FieldClash(field));
9757 }
9758 }
9759
9760 let mut params = Params::with_capacity(3 + self._additional_params.len());
9761 params.push("path", self._path);
9762
9763 params.extend(self._additional_params.iter());
9764
9765 params.push("alt", "json");
9766 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:undelete";
9767 if self._scopes.is_empty() {
9768 self._scopes
9769 .insert(Scope::EditContainerversion.as_ref().to_string());
9770 }
9771
9772 #[allow(clippy::single_element_loop)]
9773 for &(find_this, param_name) in [("{+path}", "path")].iter() {
9774 url = params.uri_replacement(url, param_name, find_this, true);
9775 }
9776 {
9777 let to_remove = ["path"];
9778 params.remove_params(&to_remove);
9779 }
9780
9781 let url = params.parse_with_url(&url);
9782
9783 loop {
9784 let token = match self
9785 .hub
9786 .auth
9787 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9788 .await
9789 {
9790 Ok(token) => token,
9791 Err(e) => match dlg.token(e) {
9792 Ok(token) => token,
9793 Err(e) => {
9794 dlg.finished(false);
9795 return Err(common::Error::MissingToken(e));
9796 }
9797 },
9798 };
9799 let mut req_result = {
9800 let client = &self.hub.client;
9801 dlg.pre_request();
9802 let mut req_builder = hyper::Request::builder()
9803 .method(hyper::Method::POST)
9804 .uri(url.as_str())
9805 .header(USER_AGENT, self.hub._user_agent.clone());
9806
9807 if let Some(token) = token.as_ref() {
9808 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9809 }
9810
9811 let request = req_builder
9812 .header(CONTENT_LENGTH, 0_u64)
9813 .body(common::to_body::<String>(None));
9814
9815 client.request(request.unwrap()).await
9816 };
9817
9818 match req_result {
9819 Err(err) => {
9820 if let common::Retry::After(d) = dlg.http_error(&err) {
9821 sleep(d).await;
9822 continue;
9823 }
9824 dlg.finished(false);
9825 return Err(common::Error::HttpError(err));
9826 }
9827 Ok(res) => {
9828 let (mut parts, body) = res.into_parts();
9829 let mut body = common::Body::new(body);
9830 if !parts.status.is_success() {
9831 let bytes = common::to_bytes(body).await.unwrap_or_default();
9832 let error = serde_json::from_str(&common::to_string(&bytes));
9833 let response = common::to_response(parts, bytes.into());
9834
9835 if let common::Retry::After(d) =
9836 dlg.http_failure(&response, error.as_ref().ok())
9837 {
9838 sleep(d).await;
9839 continue;
9840 }
9841
9842 dlg.finished(false);
9843
9844 return Err(match error {
9845 Ok(value) => common::Error::BadRequest(value),
9846 _ => common::Error::Failure(response),
9847 });
9848 }
9849 let response = {
9850 let bytes = common::to_bytes(body).await.unwrap_or_default();
9851 let encoded = common::to_string(&bytes);
9852 match serde_json::from_str(&encoded) {
9853 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9854 Err(error) => {
9855 dlg.response_json_decode_error(&encoded, &error);
9856 return Err(common::Error::JsonDecodeError(
9857 encoded.to_string(),
9858 error,
9859 ));
9860 }
9861 }
9862 };
9863
9864 dlg.finished(true);
9865 return Ok(response);
9866 }
9867 }
9868 }
9869 }
9870
9871 /// GTM ContainerVersion's API relative path.
9872 ///
9873 /// Sets the *path* path property to the given value.
9874 ///
9875 /// Even though the property as already been set when instantiating this call,
9876 /// we provide this method for API completeness.
9877 pub fn path(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C> {
9878 self._path = new_value.to_string();
9879 self
9880 }
9881 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9882 /// while executing the actual API request.
9883 ///
9884 /// ````text
9885 /// It should be used to handle progress information, and to implement a certain level of resilience.
9886 /// ````
9887 ///
9888 /// Sets the *delegate* property to the given value.
9889 pub fn delegate(
9890 mut self,
9891 new_value: &'a mut dyn common::Delegate,
9892 ) -> AccountContainerVersionUndeleteCall<'a, C> {
9893 self._delegate = Some(new_value);
9894 self
9895 }
9896
9897 /// Set any additional parameter of the query string used in the request.
9898 /// It should be used to set parameters which are not yet available through their own
9899 /// setters.
9900 ///
9901 /// Please note that this method must not be used to set any of the known parameters
9902 /// which have their own setter method. If done anyway, the request will fail.
9903 ///
9904 /// # Additional Parameters
9905 ///
9906 /// * *$.xgafv* (query-string) - V1 error format.
9907 /// * *access_token* (query-string) - OAuth access token.
9908 /// * *alt* (query-string) - Data format for response.
9909 /// * *callback* (query-string) - JSONP
9910 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9911 /// * *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.
9912 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9913 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9914 /// * *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.
9915 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9916 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9917 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUndeleteCall<'a, C>
9918 where
9919 T: AsRef<str>,
9920 {
9921 self._additional_params
9922 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9923 self
9924 }
9925
9926 /// Identifies the authorization scope for the method you are building.
9927 ///
9928 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9929 /// [`Scope::EditContainerversion`].
9930 ///
9931 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9932 /// tokens for more than one scope.
9933 ///
9934 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9935 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9936 /// sufficient, a read-write scope will do as well.
9937 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUndeleteCall<'a, C>
9938 where
9939 St: AsRef<str>,
9940 {
9941 self._scopes.insert(String::from(scope.as_ref()));
9942 self
9943 }
9944 /// Identifies the authorization scope(s) for the method you are building.
9945 ///
9946 /// See [`Self::add_scope()`] for details.
9947 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUndeleteCall<'a, C>
9948 where
9949 I: IntoIterator<Item = St>,
9950 St: AsRef<str>,
9951 {
9952 self._scopes
9953 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9954 self
9955 }
9956
9957 /// Removes all scopes, and no default scope will be used either.
9958 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9959 /// for details).
9960 pub fn clear_scopes(mut self) -> AccountContainerVersionUndeleteCall<'a, C> {
9961 self._scopes.clear();
9962 self
9963 }
9964}
9965
9966/// Updates a Container Version.
9967///
9968/// A builder for the *containers.versions.update* method supported by a *account* resource.
9969/// It is not used directly, but through a [`AccountMethods`] instance.
9970///
9971/// # Example
9972///
9973/// Instantiate a resource method builder
9974///
9975/// ```test_harness,no_run
9976/// # extern crate hyper;
9977/// # extern crate hyper_rustls;
9978/// # extern crate google_tagmanager2 as tagmanager2;
9979/// use tagmanager2::api::ContainerVersion;
9980/// # async fn dox() {
9981/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9982///
9983/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9984/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9985/// # .with_native_roots()
9986/// # .unwrap()
9987/// # .https_only()
9988/// # .enable_http2()
9989/// # .build();
9990///
9991/// # let executor = hyper_util::rt::TokioExecutor::new();
9992/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9993/// # secret,
9994/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9995/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9996/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9997/// # ),
9998/// # ).build().await.unwrap();
9999///
10000/// # let client = hyper_util::client::legacy::Client::builder(
10001/// # hyper_util::rt::TokioExecutor::new()
10002/// # )
10003/// # .build(
10004/// # hyper_rustls::HttpsConnectorBuilder::new()
10005/// # .with_native_roots()
10006/// # .unwrap()
10007/// # .https_or_http()
10008/// # .enable_http2()
10009/// # .build()
10010/// # );
10011/// # let mut hub = TagManager::new(client, auth);
10012/// // As the method needs a request, you would usually fill it with the desired information
10013/// // into the respective structure. Some of the parts shown here might not be applicable !
10014/// // Values shown here are possibly random and not representative !
10015/// let mut req = ContainerVersion::default();
10016///
10017/// // You can configure optional parameters by calling the respective setters at will, and
10018/// // execute the final call using `doit()`.
10019/// // Values shown here are possibly random and not representative !
10020/// let result = hub.accounts().containers_versions_update(req, "path")
10021/// .fingerprint("diam")
10022/// .doit().await;
10023/// # }
10024/// ```
10025pub struct AccountContainerVersionUpdateCall<'a, C>
10026where
10027 C: 'a,
10028{
10029 hub: &'a TagManager<C>,
10030 _request: ContainerVersion,
10031 _path: String,
10032 _fingerprint: Option<String>,
10033 _delegate: Option<&'a mut dyn common::Delegate>,
10034 _additional_params: HashMap<String, String>,
10035 _scopes: BTreeSet<String>,
10036}
10037
10038impl<'a, C> common::CallBuilder for AccountContainerVersionUpdateCall<'a, C> {}
10039
10040impl<'a, C> AccountContainerVersionUpdateCall<'a, C>
10041where
10042 C: common::Connector,
10043{
10044 /// Perform the operation you have build so far.
10045 pub async fn doit(mut self) -> common::Result<(common::Response, ContainerVersion)> {
10046 use std::borrow::Cow;
10047 use std::io::{Read, Seek};
10048
10049 use common::{url::Params, ToParts};
10050 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10051
10052 let mut dd = common::DefaultDelegate;
10053 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10054 dlg.begin(common::MethodInfo {
10055 id: "tagmanager.accounts.containers.versions.update",
10056 http_method: hyper::Method::PUT,
10057 });
10058
10059 for &field in ["alt", "path", "fingerprint"].iter() {
10060 if self._additional_params.contains_key(field) {
10061 dlg.finished(false);
10062 return Err(common::Error::FieldClash(field));
10063 }
10064 }
10065
10066 let mut params = Params::with_capacity(5 + self._additional_params.len());
10067 params.push("path", self._path);
10068 if let Some(value) = self._fingerprint.as_ref() {
10069 params.push("fingerprint", value);
10070 }
10071
10072 params.extend(self._additional_params.iter());
10073
10074 params.push("alt", "json");
10075 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
10076 if self._scopes.is_empty() {
10077 self._scopes
10078 .insert(Scope::EditContainerversion.as_ref().to_string());
10079 }
10080
10081 #[allow(clippy::single_element_loop)]
10082 for &(find_this, param_name) in [("{+path}", "path")].iter() {
10083 url = params.uri_replacement(url, param_name, find_this, true);
10084 }
10085 {
10086 let to_remove = ["path"];
10087 params.remove_params(&to_remove);
10088 }
10089
10090 let url = params.parse_with_url(&url);
10091
10092 let mut json_mime_type = mime::APPLICATION_JSON;
10093 let mut request_value_reader = {
10094 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10095 common::remove_json_null_values(&mut value);
10096 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10097 serde_json::to_writer(&mut dst, &value).unwrap();
10098 dst
10099 };
10100 let request_size = request_value_reader
10101 .seek(std::io::SeekFrom::End(0))
10102 .unwrap();
10103 request_value_reader
10104 .seek(std::io::SeekFrom::Start(0))
10105 .unwrap();
10106
10107 loop {
10108 let token = match self
10109 .hub
10110 .auth
10111 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10112 .await
10113 {
10114 Ok(token) => token,
10115 Err(e) => match dlg.token(e) {
10116 Ok(token) => token,
10117 Err(e) => {
10118 dlg.finished(false);
10119 return Err(common::Error::MissingToken(e));
10120 }
10121 },
10122 };
10123 request_value_reader
10124 .seek(std::io::SeekFrom::Start(0))
10125 .unwrap();
10126 let mut req_result = {
10127 let client = &self.hub.client;
10128 dlg.pre_request();
10129 let mut req_builder = hyper::Request::builder()
10130 .method(hyper::Method::PUT)
10131 .uri(url.as_str())
10132 .header(USER_AGENT, self.hub._user_agent.clone());
10133
10134 if let Some(token) = token.as_ref() {
10135 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10136 }
10137
10138 let request = req_builder
10139 .header(CONTENT_TYPE, json_mime_type.to_string())
10140 .header(CONTENT_LENGTH, request_size as u64)
10141 .body(common::to_body(
10142 request_value_reader.get_ref().clone().into(),
10143 ));
10144
10145 client.request(request.unwrap()).await
10146 };
10147
10148 match req_result {
10149 Err(err) => {
10150 if let common::Retry::After(d) = dlg.http_error(&err) {
10151 sleep(d).await;
10152 continue;
10153 }
10154 dlg.finished(false);
10155 return Err(common::Error::HttpError(err));
10156 }
10157 Ok(res) => {
10158 let (mut parts, body) = res.into_parts();
10159 let mut body = common::Body::new(body);
10160 if !parts.status.is_success() {
10161 let bytes = common::to_bytes(body).await.unwrap_or_default();
10162 let error = serde_json::from_str(&common::to_string(&bytes));
10163 let response = common::to_response(parts, bytes.into());
10164
10165 if let common::Retry::After(d) =
10166 dlg.http_failure(&response, error.as_ref().ok())
10167 {
10168 sleep(d).await;
10169 continue;
10170 }
10171
10172 dlg.finished(false);
10173
10174 return Err(match error {
10175 Ok(value) => common::Error::BadRequest(value),
10176 _ => common::Error::Failure(response),
10177 });
10178 }
10179 let response = {
10180 let bytes = common::to_bytes(body).await.unwrap_or_default();
10181 let encoded = common::to_string(&bytes);
10182 match serde_json::from_str(&encoded) {
10183 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10184 Err(error) => {
10185 dlg.response_json_decode_error(&encoded, &error);
10186 return Err(common::Error::JsonDecodeError(
10187 encoded.to_string(),
10188 error,
10189 ));
10190 }
10191 }
10192 };
10193
10194 dlg.finished(true);
10195 return Ok(response);
10196 }
10197 }
10198 }
10199 }
10200
10201 ///
10202 /// Sets the *request* property to the given value.
10203 ///
10204 /// Even though the property as already been set when instantiating this call,
10205 /// we provide this method for API completeness.
10206 pub fn request(
10207 mut self,
10208 new_value: ContainerVersion,
10209 ) -> AccountContainerVersionUpdateCall<'a, C> {
10210 self._request = new_value;
10211 self
10212 }
10213 /// GTM ContainerVersion's API relative path.
10214 ///
10215 /// Sets the *path* path property to the given value.
10216 ///
10217 /// Even though the property as already been set when instantiating this call,
10218 /// we provide this method for API completeness.
10219 pub fn path(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
10220 self._path = new_value.to_string();
10221 self
10222 }
10223 /// When provided, this fingerprint must match the fingerprint of the container version in storage.
10224 ///
10225 /// Sets the *fingerprint* query property to the given value.
10226 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerVersionUpdateCall<'a, C> {
10227 self._fingerprint = Some(new_value.to_string());
10228 self
10229 }
10230 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10231 /// while executing the actual API request.
10232 ///
10233 /// ````text
10234 /// It should be used to handle progress information, and to implement a certain level of resilience.
10235 /// ````
10236 ///
10237 /// Sets the *delegate* property to the given value.
10238 pub fn delegate(
10239 mut self,
10240 new_value: &'a mut dyn common::Delegate,
10241 ) -> AccountContainerVersionUpdateCall<'a, C> {
10242 self._delegate = Some(new_value);
10243 self
10244 }
10245
10246 /// Set any additional parameter of the query string used in the request.
10247 /// It should be used to set parameters which are not yet available through their own
10248 /// setters.
10249 ///
10250 /// Please note that this method must not be used to set any of the known parameters
10251 /// which have their own setter method. If done anyway, the request will fail.
10252 ///
10253 /// # Additional Parameters
10254 ///
10255 /// * *$.xgafv* (query-string) - V1 error format.
10256 /// * *access_token* (query-string) - OAuth access token.
10257 /// * *alt* (query-string) - Data format for response.
10258 /// * *callback* (query-string) - JSONP
10259 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10260 /// * *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.
10261 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10262 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10263 /// * *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.
10264 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10265 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10266 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerVersionUpdateCall<'a, C>
10267 where
10268 T: AsRef<str>,
10269 {
10270 self._additional_params
10271 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10272 self
10273 }
10274
10275 /// Identifies the authorization scope for the method you are building.
10276 ///
10277 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10278 /// [`Scope::EditContainerversion`].
10279 ///
10280 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10281 /// tokens for more than one scope.
10282 ///
10283 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10284 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10285 /// sufficient, a read-write scope will do as well.
10286 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerVersionUpdateCall<'a, C>
10287 where
10288 St: AsRef<str>,
10289 {
10290 self._scopes.insert(String::from(scope.as_ref()));
10291 self
10292 }
10293 /// Identifies the authorization scope(s) for the method you are building.
10294 ///
10295 /// See [`Self::add_scope()`] for details.
10296 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerVersionUpdateCall<'a, C>
10297 where
10298 I: IntoIterator<Item = St>,
10299 St: AsRef<str>,
10300 {
10301 self._scopes
10302 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10303 self
10304 }
10305
10306 /// Removes all scopes, and no default scope will be used either.
10307 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10308 /// for details).
10309 pub fn clear_scopes(mut self) -> AccountContainerVersionUpdateCall<'a, C> {
10310 self._scopes.clear();
10311 self
10312 }
10313}
10314
10315/// Creates one or more GTM Built-In Variables.
10316///
10317/// A builder for the *containers.workspaces.built_in_variables.create* method supported by a *account* resource.
10318/// It is not used directly, but through a [`AccountMethods`] instance.
10319///
10320/// # Example
10321///
10322/// Instantiate a resource method builder
10323///
10324/// ```test_harness,no_run
10325/// # extern crate hyper;
10326/// # extern crate hyper_rustls;
10327/// # extern crate google_tagmanager2 as tagmanager2;
10328/// # async fn dox() {
10329/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10330///
10331/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10332/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10333/// # .with_native_roots()
10334/// # .unwrap()
10335/// # .https_only()
10336/// # .enable_http2()
10337/// # .build();
10338///
10339/// # let executor = hyper_util::rt::TokioExecutor::new();
10340/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10341/// # secret,
10342/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10343/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10344/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10345/// # ),
10346/// # ).build().await.unwrap();
10347///
10348/// # let client = hyper_util::client::legacy::Client::builder(
10349/// # hyper_util::rt::TokioExecutor::new()
10350/// # )
10351/// # .build(
10352/// # hyper_rustls::HttpsConnectorBuilder::new()
10353/// # .with_native_roots()
10354/// # .unwrap()
10355/// # .https_or_http()
10356/// # .enable_http2()
10357/// # .build()
10358/// # );
10359/// # let mut hub = TagManager::new(client, auth);
10360/// // You can configure optional parameters by calling the respective setters at will, and
10361/// // execute the final call using `doit()`.
10362/// // Values shown here are possibly random and not representative !
10363/// let result = hub.accounts().containers_workspaces_built_in_variables_create("parent")
10364/// .add_type("et")
10365/// .doit().await;
10366/// # }
10367/// ```
10368pub struct AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10369where
10370 C: 'a,
10371{
10372 hub: &'a TagManager<C>,
10373 _parent: String,
10374 _type_: Vec<String>,
10375 _delegate: Option<&'a mut dyn common::Delegate>,
10376 _additional_params: HashMap<String, String>,
10377 _scopes: BTreeSet<String>,
10378}
10379
10380impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {}
10381
10382impl<'a, C> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10383where
10384 C: common::Connector,
10385{
10386 /// Perform the operation you have build so far.
10387 pub async fn doit(
10388 mut self,
10389 ) -> common::Result<(common::Response, CreateBuiltInVariableResponse)> {
10390 use std::borrow::Cow;
10391 use std::io::{Read, Seek};
10392
10393 use common::{url::Params, ToParts};
10394 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10395
10396 let mut dd = common::DefaultDelegate;
10397 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10398 dlg.begin(common::MethodInfo {
10399 id: "tagmanager.accounts.containers.workspaces.built_in_variables.create",
10400 http_method: hyper::Method::POST,
10401 });
10402
10403 for &field in ["alt", "parent", "type"].iter() {
10404 if self._additional_params.contains_key(field) {
10405 dlg.finished(false);
10406 return Err(common::Error::FieldClash(field));
10407 }
10408 }
10409
10410 let mut params = Params::with_capacity(4 + self._additional_params.len());
10411 params.push("parent", self._parent);
10412 if !self._type_.is_empty() {
10413 for f in self._type_.iter() {
10414 params.push("type", f);
10415 }
10416 }
10417
10418 params.extend(self._additional_params.iter());
10419
10420 params.push("alt", "json");
10421 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/built_in_variables";
10422 if self._scopes.is_empty() {
10423 self._scopes
10424 .insert(Scope::EditContainer.as_ref().to_string());
10425 }
10426
10427 #[allow(clippy::single_element_loop)]
10428 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10429 url = params.uri_replacement(url, param_name, find_this, true);
10430 }
10431 {
10432 let to_remove = ["parent"];
10433 params.remove_params(&to_remove);
10434 }
10435
10436 let url = params.parse_with_url(&url);
10437
10438 loop {
10439 let token = match self
10440 .hub
10441 .auth
10442 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10443 .await
10444 {
10445 Ok(token) => token,
10446 Err(e) => match dlg.token(e) {
10447 Ok(token) => token,
10448 Err(e) => {
10449 dlg.finished(false);
10450 return Err(common::Error::MissingToken(e));
10451 }
10452 },
10453 };
10454 let mut req_result = {
10455 let client = &self.hub.client;
10456 dlg.pre_request();
10457 let mut req_builder = hyper::Request::builder()
10458 .method(hyper::Method::POST)
10459 .uri(url.as_str())
10460 .header(USER_AGENT, self.hub._user_agent.clone());
10461
10462 if let Some(token) = token.as_ref() {
10463 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10464 }
10465
10466 let request = req_builder
10467 .header(CONTENT_LENGTH, 0_u64)
10468 .body(common::to_body::<String>(None));
10469
10470 client.request(request.unwrap()).await
10471 };
10472
10473 match req_result {
10474 Err(err) => {
10475 if let common::Retry::After(d) = dlg.http_error(&err) {
10476 sleep(d).await;
10477 continue;
10478 }
10479 dlg.finished(false);
10480 return Err(common::Error::HttpError(err));
10481 }
10482 Ok(res) => {
10483 let (mut parts, body) = res.into_parts();
10484 let mut body = common::Body::new(body);
10485 if !parts.status.is_success() {
10486 let bytes = common::to_bytes(body).await.unwrap_or_default();
10487 let error = serde_json::from_str(&common::to_string(&bytes));
10488 let response = common::to_response(parts, bytes.into());
10489
10490 if let common::Retry::After(d) =
10491 dlg.http_failure(&response, error.as_ref().ok())
10492 {
10493 sleep(d).await;
10494 continue;
10495 }
10496
10497 dlg.finished(false);
10498
10499 return Err(match error {
10500 Ok(value) => common::Error::BadRequest(value),
10501 _ => common::Error::Failure(response),
10502 });
10503 }
10504 let response = {
10505 let bytes = common::to_bytes(body).await.unwrap_or_default();
10506 let encoded = common::to_string(&bytes);
10507 match serde_json::from_str(&encoded) {
10508 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10509 Err(error) => {
10510 dlg.response_json_decode_error(&encoded, &error);
10511 return Err(common::Error::JsonDecodeError(
10512 encoded.to_string(),
10513 error,
10514 ));
10515 }
10516 }
10517 };
10518
10519 dlg.finished(true);
10520 return Ok(response);
10521 }
10522 }
10523 }
10524 }
10525
10526 /// GTM Workspace's API relative path.
10527 ///
10528 /// Sets the *parent* path property to the given value.
10529 ///
10530 /// Even though the property as already been set when instantiating this call,
10531 /// we provide this method for API completeness.
10532 pub fn parent(
10533 mut self,
10534 new_value: &str,
10535 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10536 self._parent = new_value.to_string();
10537 self
10538 }
10539 /// The types of built-in variables to enable.
10540 ///
10541 /// Append the given value to the *type* query property.
10542 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10543 pub fn add_type(
10544 mut self,
10545 new_value: &str,
10546 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10547 self._type_.push(new_value.to_string());
10548 self
10549 }
10550 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10551 /// while executing the actual API request.
10552 ///
10553 /// ````text
10554 /// It should be used to handle progress information, and to implement a certain level of resilience.
10555 /// ````
10556 ///
10557 /// Sets the *delegate* property to the given value.
10558 pub fn delegate(
10559 mut self,
10560 new_value: &'a mut dyn common::Delegate,
10561 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10562 self._delegate = Some(new_value);
10563 self
10564 }
10565
10566 /// Set any additional parameter of the query string used in the request.
10567 /// It should be used to set parameters which are not yet available through their own
10568 /// setters.
10569 ///
10570 /// Please note that this method must not be used to set any of the known parameters
10571 /// which have their own setter method. If done anyway, the request will fail.
10572 ///
10573 /// # Additional Parameters
10574 ///
10575 /// * *$.xgafv* (query-string) - V1 error format.
10576 /// * *access_token* (query-string) - OAuth access token.
10577 /// * *alt* (query-string) - Data format for response.
10578 /// * *callback* (query-string) - JSONP
10579 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10580 /// * *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.
10581 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10582 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10583 /// * *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.
10584 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10585 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10586 pub fn param<T>(
10587 mut self,
10588 name: T,
10589 value: T,
10590 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10591 where
10592 T: AsRef<str>,
10593 {
10594 self._additional_params
10595 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10596 self
10597 }
10598
10599 /// Identifies the authorization scope for the method you are building.
10600 ///
10601 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10602 /// [`Scope::EditContainer`].
10603 ///
10604 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10605 /// tokens for more than one scope.
10606 ///
10607 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10608 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10609 /// sufficient, a read-write scope will do as well.
10610 pub fn add_scope<St>(
10611 mut self,
10612 scope: St,
10613 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10614 where
10615 St: AsRef<str>,
10616 {
10617 self._scopes.insert(String::from(scope.as_ref()));
10618 self
10619 }
10620 /// Identifies the authorization scope(s) for the method you are building.
10621 ///
10622 /// See [`Self::add_scope()`] for details.
10623 pub fn add_scopes<I, St>(
10624 mut self,
10625 scopes: I,
10626 ) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C>
10627 where
10628 I: IntoIterator<Item = St>,
10629 St: AsRef<str>,
10630 {
10631 self._scopes
10632 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10633 self
10634 }
10635
10636 /// Removes all scopes, and no default scope will be used either.
10637 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10638 /// for details).
10639 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C> {
10640 self._scopes.clear();
10641 self
10642 }
10643}
10644
10645/// Deletes one or more GTM Built-In Variables.
10646///
10647/// A builder for the *containers.workspaces.built_in_variables.delete* method supported by a *account* resource.
10648/// It is not used directly, but through a [`AccountMethods`] instance.
10649///
10650/// # Example
10651///
10652/// Instantiate a resource method builder
10653///
10654/// ```test_harness,no_run
10655/// # extern crate hyper;
10656/// # extern crate hyper_rustls;
10657/// # extern crate google_tagmanager2 as tagmanager2;
10658/// # async fn dox() {
10659/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10660///
10661/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10662/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10663/// # .with_native_roots()
10664/// # .unwrap()
10665/// # .https_only()
10666/// # .enable_http2()
10667/// # .build();
10668///
10669/// # let executor = hyper_util::rt::TokioExecutor::new();
10670/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10671/// # secret,
10672/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10673/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10674/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10675/// # ),
10676/// # ).build().await.unwrap();
10677///
10678/// # let client = hyper_util::client::legacy::Client::builder(
10679/// # hyper_util::rt::TokioExecutor::new()
10680/// # )
10681/// # .build(
10682/// # hyper_rustls::HttpsConnectorBuilder::new()
10683/// # .with_native_roots()
10684/// # .unwrap()
10685/// # .https_or_http()
10686/// # .enable_http2()
10687/// # .build()
10688/// # );
10689/// # let mut hub = TagManager::new(client, auth);
10690/// // You can configure optional parameters by calling the respective setters at will, and
10691/// // execute the final call using `doit()`.
10692/// // Values shown here are possibly random and not representative !
10693/// let result = hub.accounts().containers_workspaces_built_in_variables_delete("path")
10694/// .add_type("sadipscing")
10695/// .doit().await;
10696/// # }
10697/// ```
10698pub struct AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10699where
10700 C: 'a,
10701{
10702 hub: &'a TagManager<C>,
10703 _path: String,
10704 _type_: Vec<String>,
10705 _delegate: Option<&'a mut dyn common::Delegate>,
10706 _additional_params: HashMap<String, String>,
10707 _scopes: BTreeSet<String>,
10708}
10709
10710impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {}
10711
10712impl<'a, C> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10713where
10714 C: common::Connector,
10715{
10716 /// Perform the operation you have build so far.
10717 pub async fn doit(mut self) -> common::Result<common::Response> {
10718 use std::borrow::Cow;
10719 use std::io::{Read, Seek};
10720
10721 use common::{url::Params, ToParts};
10722 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10723
10724 let mut dd = common::DefaultDelegate;
10725 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10726 dlg.begin(common::MethodInfo {
10727 id: "tagmanager.accounts.containers.workspaces.built_in_variables.delete",
10728 http_method: hyper::Method::DELETE,
10729 });
10730
10731 for &field in ["path", "type"].iter() {
10732 if self._additional_params.contains_key(field) {
10733 dlg.finished(false);
10734 return Err(common::Error::FieldClash(field));
10735 }
10736 }
10737
10738 let mut params = Params::with_capacity(3 + self._additional_params.len());
10739 params.push("path", self._path);
10740 if !self._type_.is_empty() {
10741 for f in self._type_.iter() {
10742 params.push("type", f);
10743 }
10744 }
10745
10746 params.extend(self._additional_params.iter());
10747
10748 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
10749 if self._scopes.is_empty() {
10750 self._scopes
10751 .insert(Scope::EditContainer.as_ref().to_string());
10752 }
10753
10754 #[allow(clippy::single_element_loop)]
10755 for &(find_this, param_name) in [("{+path}", "path")].iter() {
10756 url = params.uri_replacement(url, param_name, find_this, true);
10757 }
10758 {
10759 let to_remove = ["path"];
10760 params.remove_params(&to_remove);
10761 }
10762
10763 let url = params.parse_with_url(&url);
10764
10765 loop {
10766 let token = match self
10767 .hub
10768 .auth
10769 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10770 .await
10771 {
10772 Ok(token) => token,
10773 Err(e) => match dlg.token(e) {
10774 Ok(token) => token,
10775 Err(e) => {
10776 dlg.finished(false);
10777 return Err(common::Error::MissingToken(e));
10778 }
10779 },
10780 };
10781 let mut req_result = {
10782 let client = &self.hub.client;
10783 dlg.pre_request();
10784 let mut req_builder = hyper::Request::builder()
10785 .method(hyper::Method::DELETE)
10786 .uri(url.as_str())
10787 .header(USER_AGENT, self.hub._user_agent.clone());
10788
10789 if let Some(token) = token.as_ref() {
10790 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10791 }
10792
10793 let request = req_builder
10794 .header(CONTENT_LENGTH, 0_u64)
10795 .body(common::to_body::<String>(None));
10796
10797 client.request(request.unwrap()).await
10798 };
10799
10800 match req_result {
10801 Err(err) => {
10802 if let common::Retry::After(d) = dlg.http_error(&err) {
10803 sleep(d).await;
10804 continue;
10805 }
10806 dlg.finished(false);
10807 return Err(common::Error::HttpError(err));
10808 }
10809 Ok(res) => {
10810 let (mut parts, body) = res.into_parts();
10811 let mut body = common::Body::new(body);
10812 if !parts.status.is_success() {
10813 let bytes = common::to_bytes(body).await.unwrap_or_default();
10814 let error = serde_json::from_str(&common::to_string(&bytes));
10815 let response = common::to_response(parts, bytes.into());
10816
10817 if let common::Retry::After(d) =
10818 dlg.http_failure(&response, error.as_ref().ok())
10819 {
10820 sleep(d).await;
10821 continue;
10822 }
10823
10824 dlg.finished(false);
10825
10826 return Err(match error {
10827 Ok(value) => common::Error::BadRequest(value),
10828 _ => common::Error::Failure(response),
10829 });
10830 }
10831 let response = common::Response::from_parts(parts, body);
10832
10833 dlg.finished(true);
10834 return Ok(response);
10835 }
10836 }
10837 }
10838 }
10839
10840 /// GTM BuiltInVariable's API relative path.
10841 ///
10842 /// Sets the *path* path property to the given value.
10843 ///
10844 /// Even though the property as already been set when instantiating this call,
10845 /// we provide this method for API completeness.
10846 pub fn path(
10847 mut self,
10848 new_value: &str,
10849 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10850 self._path = new_value.to_string();
10851 self
10852 }
10853 /// The types of built-in variables to delete.
10854 ///
10855 /// Append the given value to the *type* query property.
10856 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10857 pub fn add_type(
10858 mut self,
10859 new_value: &str,
10860 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10861 self._type_.push(new_value.to_string());
10862 self
10863 }
10864 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10865 /// while executing the actual API request.
10866 ///
10867 /// ````text
10868 /// It should be used to handle progress information, and to implement a certain level of resilience.
10869 /// ````
10870 ///
10871 /// Sets the *delegate* property to the given value.
10872 pub fn delegate(
10873 mut self,
10874 new_value: &'a mut dyn common::Delegate,
10875 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10876 self._delegate = Some(new_value);
10877 self
10878 }
10879
10880 /// Set any additional parameter of the query string used in the request.
10881 /// It should be used to set parameters which are not yet available through their own
10882 /// setters.
10883 ///
10884 /// Please note that this method must not be used to set any of the known parameters
10885 /// which have their own setter method. If done anyway, the request will fail.
10886 ///
10887 /// # Additional Parameters
10888 ///
10889 /// * *$.xgafv* (query-string) - V1 error format.
10890 /// * *access_token* (query-string) - OAuth access token.
10891 /// * *alt* (query-string) - Data format for response.
10892 /// * *callback* (query-string) - JSONP
10893 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10894 /// * *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.
10895 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10896 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10897 /// * *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.
10898 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10899 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10900 pub fn param<T>(
10901 mut self,
10902 name: T,
10903 value: T,
10904 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10905 where
10906 T: AsRef<str>,
10907 {
10908 self._additional_params
10909 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10910 self
10911 }
10912
10913 /// Identifies the authorization scope for the method you are building.
10914 ///
10915 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10916 /// [`Scope::EditContainer`].
10917 ///
10918 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10919 /// tokens for more than one scope.
10920 ///
10921 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10922 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10923 /// sufficient, a read-write scope will do as well.
10924 pub fn add_scope<St>(
10925 mut self,
10926 scope: St,
10927 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10928 where
10929 St: AsRef<str>,
10930 {
10931 self._scopes.insert(String::from(scope.as_ref()));
10932 self
10933 }
10934 /// Identifies the authorization scope(s) for the method you are building.
10935 ///
10936 /// See [`Self::add_scope()`] for details.
10937 pub fn add_scopes<I, St>(
10938 mut self,
10939 scopes: I,
10940 ) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C>
10941 where
10942 I: IntoIterator<Item = St>,
10943 St: AsRef<str>,
10944 {
10945 self._scopes
10946 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10947 self
10948 }
10949
10950 /// Removes all scopes, and no default scope will be used either.
10951 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10952 /// for details).
10953 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C> {
10954 self._scopes.clear();
10955 self
10956 }
10957}
10958
10959/// Lists all the enabled Built-In Variables of a GTM Container.
10960///
10961/// A builder for the *containers.workspaces.built_in_variables.list* method supported by a *account* resource.
10962/// It is not used directly, but through a [`AccountMethods`] instance.
10963///
10964/// # Example
10965///
10966/// Instantiate a resource method builder
10967///
10968/// ```test_harness,no_run
10969/// # extern crate hyper;
10970/// # extern crate hyper_rustls;
10971/// # extern crate google_tagmanager2 as tagmanager2;
10972/// # async fn dox() {
10973/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10974///
10975/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10976/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10977/// # .with_native_roots()
10978/// # .unwrap()
10979/// # .https_only()
10980/// # .enable_http2()
10981/// # .build();
10982///
10983/// # let executor = hyper_util::rt::TokioExecutor::new();
10984/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10985/// # secret,
10986/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10987/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10988/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10989/// # ),
10990/// # ).build().await.unwrap();
10991///
10992/// # let client = hyper_util::client::legacy::Client::builder(
10993/// # hyper_util::rt::TokioExecutor::new()
10994/// # )
10995/// # .build(
10996/// # hyper_rustls::HttpsConnectorBuilder::new()
10997/// # .with_native_roots()
10998/// # .unwrap()
10999/// # .https_or_http()
11000/// # .enable_http2()
11001/// # .build()
11002/// # );
11003/// # let mut hub = TagManager::new(client, auth);
11004/// // You can configure optional parameters by calling the respective setters at will, and
11005/// // execute the final call using `doit()`.
11006/// // Values shown here are possibly random and not representative !
11007/// let result = hub.accounts().containers_workspaces_built_in_variables_list("parent")
11008/// .page_token("dolor")
11009/// .doit().await;
11010/// # }
11011/// ```
11012pub struct AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
11013where
11014 C: 'a,
11015{
11016 hub: &'a TagManager<C>,
11017 _parent: String,
11018 _page_token: Option<String>,
11019 _delegate: Option<&'a mut dyn common::Delegate>,
11020 _additional_params: HashMap<String, String>,
11021 _scopes: BTreeSet<String>,
11022}
11023
11024impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {}
11025
11026impl<'a, C> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
11027where
11028 C: common::Connector,
11029{
11030 /// Perform the operation you have build so far.
11031 pub async fn doit(
11032 mut self,
11033 ) -> common::Result<(common::Response, ListEnabledBuiltInVariablesResponse)> {
11034 use std::borrow::Cow;
11035 use std::io::{Read, Seek};
11036
11037 use common::{url::Params, ToParts};
11038 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11039
11040 let mut dd = common::DefaultDelegate;
11041 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11042 dlg.begin(common::MethodInfo {
11043 id: "tagmanager.accounts.containers.workspaces.built_in_variables.list",
11044 http_method: hyper::Method::GET,
11045 });
11046
11047 for &field in ["alt", "parent", "pageToken"].iter() {
11048 if self._additional_params.contains_key(field) {
11049 dlg.finished(false);
11050 return Err(common::Error::FieldClash(field));
11051 }
11052 }
11053
11054 let mut params = Params::with_capacity(4 + self._additional_params.len());
11055 params.push("parent", self._parent);
11056 if let Some(value) = self._page_token.as_ref() {
11057 params.push("pageToken", value);
11058 }
11059
11060 params.extend(self._additional_params.iter());
11061
11062 params.push("alt", "json");
11063 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/built_in_variables";
11064 if self._scopes.is_empty() {
11065 self._scopes.insert(Scope::Readonly.as_ref().to_string());
11066 }
11067
11068 #[allow(clippy::single_element_loop)]
11069 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11070 url = params.uri_replacement(url, param_name, find_this, true);
11071 }
11072 {
11073 let to_remove = ["parent"];
11074 params.remove_params(&to_remove);
11075 }
11076
11077 let url = params.parse_with_url(&url);
11078
11079 loop {
11080 let token = match self
11081 .hub
11082 .auth
11083 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11084 .await
11085 {
11086 Ok(token) => token,
11087 Err(e) => match dlg.token(e) {
11088 Ok(token) => token,
11089 Err(e) => {
11090 dlg.finished(false);
11091 return Err(common::Error::MissingToken(e));
11092 }
11093 },
11094 };
11095 let mut req_result = {
11096 let client = &self.hub.client;
11097 dlg.pre_request();
11098 let mut req_builder = hyper::Request::builder()
11099 .method(hyper::Method::GET)
11100 .uri(url.as_str())
11101 .header(USER_AGENT, self.hub._user_agent.clone());
11102
11103 if let Some(token) = token.as_ref() {
11104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11105 }
11106
11107 let request = req_builder
11108 .header(CONTENT_LENGTH, 0_u64)
11109 .body(common::to_body::<String>(None));
11110
11111 client.request(request.unwrap()).await
11112 };
11113
11114 match req_result {
11115 Err(err) => {
11116 if let common::Retry::After(d) = dlg.http_error(&err) {
11117 sleep(d).await;
11118 continue;
11119 }
11120 dlg.finished(false);
11121 return Err(common::Error::HttpError(err));
11122 }
11123 Ok(res) => {
11124 let (mut parts, body) = res.into_parts();
11125 let mut body = common::Body::new(body);
11126 if !parts.status.is_success() {
11127 let bytes = common::to_bytes(body).await.unwrap_or_default();
11128 let error = serde_json::from_str(&common::to_string(&bytes));
11129 let response = common::to_response(parts, bytes.into());
11130
11131 if let common::Retry::After(d) =
11132 dlg.http_failure(&response, error.as_ref().ok())
11133 {
11134 sleep(d).await;
11135 continue;
11136 }
11137
11138 dlg.finished(false);
11139
11140 return Err(match error {
11141 Ok(value) => common::Error::BadRequest(value),
11142 _ => common::Error::Failure(response),
11143 });
11144 }
11145 let response = {
11146 let bytes = common::to_bytes(body).await.unwrap_or_default();
11147 let encoded = common::to_string(&bytes);
11148 match serde_json::from_str(&encoded) {
11149 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11150 Err(error) => {
11151 dlg.response_json_decode_error(&encoded, &error);
11152 return Err(common::Error::JsonDecodeError(
11153 encoded.to_string(),
11154 error,
11155 ));
11156 }
11157 }
11158 };
11159
11160 dlg.finished(true);
11161 return Ok(response);
11162 }
11163 }
11164 }
11165 }
11166
11167 /// GTM Workspace's API relative path.
11168 ///
11169 /// Sets the *parent* path property to the given value.
11170 ///
11171 /// Even though the property as already been set when instantiating this call,
11172 /// we provide this method for API completeness.
11173 pub fn parent(
11174 mut self,
11175 new_value: &str,
11176 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
11177 self._parent = new_value.to_string();
11178 self
11179 }
11180 /// Continuation token for fetching the next page of results.
11181 ///
11182 /// Sets the *page token* query property to the given value.
11183 pub fn page_token(
11184 mut self,
11185 new_value: &str,
11186 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
11187 self._page_token = Some(new_value.to_string());
11188 self
11189 }
11190 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11191 /// while executing the actual API request.
11192 ///
11193 /// ````text
11194 /// It should be used to handle progress information, and to implement a certain level of resilience.
11195 /// ````
11196 ///
11197 /// Sets the *delegate* property to the given value.
11198 pub fn delegate(
11199 mut self,
11200 new_value: &'a mut dyn common::Delegate,
11201 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
11202 self._delegate = Some(new_value);
11203 self
11204 }
11205
11206 /// Set any additional parameter of the query string used in the request.
11207 /// It should be used to set parameters which are not yet available through their own
11208 /// setters.
11209 ///
11210 /// Please note that this method must not be used to set any of the known parameters
11211 /// which have their own setter method. If done anyway, the request will fail.
11212 ///
11213 /// # Additional Parameters
11214 ///
11215 /// * *$.xgafv* (query-string) - V1 error format.
11216 /// * *access_token* (query-string) - OAuth access token.
11217 /// * *alt* (query-string) - Data format for response.
11218 /// * *callback* (query-string) - JSONP
11219 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11220 /// * *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.
11221 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11222 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11223 /// * *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.
11224 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11225 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11226 pub fn param<T>(
11227 mut self,
11228 name: T,
11229 value: T,
11230 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
11231 where
11232 T: AsRef<str>,
11233 {
11234 self._additional_params
11235 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11236 self
11237 }
11238
11239 /// Identifies the authorization scope for the method you are building.
11240 ///
11241 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11242 /// [`Scope::Readonly`].
11243 ///
11244 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11245 /// tokens for more than one scope.
11246 ///
11247 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11248 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11249 /// sufficient, a read-write scope will do as well.
11250 pub fn add_scope<St>(
11251 mut self,
11252 scope: St,
11253 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
11254 where
11255 St: AsRef<str>,
11256 {
11257 self._scopes.insert(String::from(scope.as_ref()));
11258 self
11259 }
11260 /// Identifies the authorization scope(s) for the method you are building.
11261 ///
11262 /// See [`Self::add_scope()`] for details.
11263 pub fn add_scopes<I, St>(
11264 mut self,
11265 scopes: I,
11266 ) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C>
11267 where
11268 I: IntoIterator<Item = St>,
11269 St: AsRef<str>,
11270 {
11271 self._scopes
11272 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11273 self
11274 }
11275
11276 /// Removes all scopes, and no default scope will be used either.
11277 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11278 /// for details).
11279 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableListCall<'a, C> {
11280 self._scopes.clear();
11281 self
11282 }
11283}
11284
11285/// Reverts changes to a GTM Built-In Variables in a GTM Workspace.
11286///
11287/// A builder for the *containers.workspaces.built_in_variables.revert* method supported by a *account* resource.
11288/// It is not used directly, but through a [`AccountMethods`] instance.
11289///
11290/// # Example
11291///
11292/// Instantiate a resource method builder
11293///
11294/// ```test_harness,no_run
11295/// # extern crate hyper;
11296/// # extern crate hyper_rustls;
11297/// # extern crate google_tagmanager2 as tagmanager2;
11298/// # async fn dox() {
11299/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11300///
11301/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11302/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11303/// # .with_native_roots()
11304/// # .unwrap()
11305/// # .https_only()
11306/// # .enable_http2()
11307/// # .build();
11308///
11309/// # let executor = hyper_util::rt::TokioExecutor::new();
11310/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11311/// # secret,
11312/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11313/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11314/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11315/// # ),
11316/// # ).build().await.unwrap();
11317///
11318/// # let client = hyper_util::client::legacy::Client::builder(
11319/// # hyper_util::rt::TokioExecutor::new()
11320/// # )
11321/// # .build(
11322/// # hyper_rustls::HttpsConnectorBuilder::new()
11323/// # .with_native_roots()
11324/// # .unwrap()
11325/// # .https_or_http()
11326/// # .enable_http2()
11327/// # .build()
11328/// # );
11329/// # let mut hub = TagManager::new(client, auth);
11330/// // You can configure optional parameters by calling the respective setters at will, and
11331/// // execute the final call using `doit()`.
11332/// // Values shown here are possibly random and not representative !
11333/// let result = hub.accounts().containers_workspaces_built_in_variables_revert("path")
11334/// .type_("vero")
11335/// .doit().await;
11336/// # }
11337/// ```
11338pub struct AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11339where
11340 C: 'a,
11341{
11342 hub: &'a TagManager<C>,
11343 _path: String,
11344 _type_: Option<String>,
11345 _delegate: Option<&'a mut dyn common::Delegate>,
11346 _additional_params: HashMap<String, String>,
11347 _scopes: BTreeSet<String>,
11348}
11349
11350impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {}
11351
11352impl<'a, C> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11353where
11354 C: common::Connector,
11355{
11356 /// Perform the operation you have build so far.
11357 pub async fn doit(
11358 mut self,
11359 ) -> common::Result<(common::Response, RevertBuiltInVariableResponse)> {
11360 use std::borrow::Cow;
11361 use std::io::{Read, Seek};
11362
11363 use common::{url::Params, ToParts};
11364 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11365
11366 let mut dd = common::DefaultDelegate;
11367 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11368 dlg.begin(common::MethodInfo {
11369 id: "tagmanager.accounts.containers.workspaces.built_in_variables.revert",
11370 http_method: hyper::Method::POST,
11371 });
11372
11373 for &field in ["alt", "path", "type"].iter() {
11374 if self._additional_params.contains_key(field) {
11375 dlg.finished(false);
11376 return Err(common::Error::FieldClash(field));
11377 }
11378 }
11379
11380 let mut params = Params::with_capacity(4 + self._additional_params.len());
11381 params.push("path", self._path);
11382 if let Some(value) = self._type_.as_ref() {
11383 params.push("type", value);
11384 }
11385
11386 params.extend(self._additional_params.iter());
11387
11388 params.push("alt", "json");
11389 let mut url =
11390 self.hub._base_url.clone() + "tagmanager/v2/{+path}/built_in_variables:revert";
11391 if self._scopes.is_empty() {
11392 self._scopes
11393 .insert(Scope::EditContainer.as_ref().to_string());
11394 }
11395
11396 #[allow(clippy::single_element_loop)]
11397 for &(find_this, param_name) in [("{+path}", "path")].iter() {
11398 url = params.uri_replacement(url, param_name, find_this, true);
11399 }
11400 {
11401 let to_remove = ["path"];
11402 params.remove_params(&to_remove);
11403 }
11404
11405 let url = params.parse_with_url(&url);
11406
11407 loop {
11408 let token = match self
11409 .hub
11410 .auth
11411 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11412 .await
11413 {
11414 Ok(token) => token,
11415 Err(e) => match dlg.token(e) {
11416 Ok(token) => token,
11417 Err(e) => {
11418 dlg.finished(false);
11419 return Err(common::Error::MissingToken(e));
11420 }
11421 },
11422 };
11423 let mut req_result = {
11424 let client = &self.hub.client;
11425 dlg.pre_request();
11426 let mut req_builder = hyper::Request::builder()
11427 .method(hyper::Method::POST)
11428 .uri(url.as_str())
11429 .header(USER_AGENT, self.hub._user_agent.clone());
11430
11431 if let Some(token) = token.as_ref() {
11432 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11433 }
11434
11435 let request = req_builder
11436 .header(CONTENT_LENGTH, 0_u64)
11437 .body(common::to_body::<String>(None));
11438
11439 client.request(request.unwrap()).await
11440 };
11441
11442 match req_result {
11443 Err(err) => {
11444 if let common::Retry::After(d) = dlg.http_error(&err) {
11445 sleep(d).await;
11446 continue;
11447 }
11448 dlg.finished(false);
11449 return Err(common::Error::HttpError(err));
11450 }
11451 Ok(res) => {
11452 let (mut parts, body) = res.into_parts();
11453 let mut body = common::Body::new(body);
11454 if !parts.status.is_success() {
11455 let bytes = common::to_bytes(body).await.unwrap_or_default();
11456 let error = serde_json::from_str(&common::to_string(&bytes));
11457 let response = common::to_response(parts, bytes.into());
11458
11459 if let common::Retry::After(d) =
11460 dlg.http_failure(&response, error.as_ref().ok())
11461 {
11462 sleep(d).await;
11463 continue;
11464 }
11465
11466 dlg.finished(false);
11467
11468 return Err(match error {
11469 Ok(value) => common::Error::BadRequest(value),
11470 _ => common::Error::Failure(response),
11471 });
11472 }
11473 let response = {
11474 let bytes = common::to_bytes(body).await.unwrap_or_default();
11475 let encoded = common::to_string(&bytes);
11476 match serde_json::from_str(&encoded) {
11477 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11478 Err(error) => {
11479 dlg.response_json_decode_error(&encoded, &error);
11480 return Err(common::Error::JsonDecodeError(
11481 encoded.to_string(),
11482 error,
11483 ));
11484 }
11485 }
11486 };
11487
11488 dlg.finished(true);
11489 return Ok(response);
11490 }
11491 }
11492 }
11493 }
11494
11495 /// GTM BuiltInVariable's API relative path.
11496 ///
11497 /// Sets the *path* path property to the given value.
11498 ///
11499 /// Even though the property as already been set when instantiating this call,
11500 /// we provide this method for API completeness.
11501 pub fn path(
11502 mut self,
11503 new_value: &str,
11504 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11505 self._path = new_value.to_string();
11506 self
11507 }
11508 /// The type of built-in variable to revert.
11509 ///
11510 /// Sets the *type* query property to the given value.
11511 pub fn type_(
11512 mut self,
11513 new_value: &str,
11514 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11515 self._type_ = Some(new_value.to_string());
11516 self
11517 }
11518 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11519 /// while executing the actual API request.
11520 ///
11521 /// ````text
11522 /// It should be used to handle progress information, and to implement a certain level of resilience.
11523 /// ````
11524 ///
11525 /// Sets the *delegate* property to the given value.
11526 pub fn delegate(
11527 mut self,
11528 new_value: &'a mut dyn common::Delegate,
11529 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11530 self._delegate = Some(new_value);
11531 self
11532 }
11533
11534 /// Set any additional parameter of the query string used in the request.
11535 /// It should be used to set parameters which are not yet available through their own
11536 /// setters.
11537 ///
11538 /// Please note that this method must not be used to set any of the known parameters
11539 /// which have their own setter method. If done anyway, the request will fail.
11540 ///
11541 /// # Additional Parameters
11542 ///
11543 /// * *$.xgafv* (query-string) - V1 error format.
11544 /// * *access_token* (query-string) - OAuth access token.
11545 /// * *alt* (query-string) - Data format for response.
11546 /// * *callback* (query-string) - JSONP
11547 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11548 /// * *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.
11549 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11550 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11551 /// * *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.
11552 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11553 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11554 pub fn param<T>(
11555 mut self,
11556 name: T,
11557 value: T,
11558 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11559 where
11560 T: AsRef<str>,
11561 {
11562 self._additional_params
11563 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11564 self
11565 }
11566
11567 /// Identifies the authorization scope for the method you are building.
11568 ///
11569 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11570 /// [`Scope::EditContainer`].
11571 ///
11572 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11573 /// tokens for more than one scope.
11574 ///
11575 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11576 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11577 /// sufficient, a read-write scope will do as well.
11578 pub fn add_scope<St>(
11579 mut self,
11580 scope: St,
11581 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11582 where
11583 St: AsRef<str>,
11584 {
11585 self._scopes.insert(String::from(scope.as_ref()));
11586 self
11587 }
11588 /// Identifies the authorization scope(s) for the method you are building.
11589 ///
11590 /// See [`Self::add_scope()`] for details.
11591 pub fn add_scopes<I, St>(
11592 mut self,
11593 scopes: I,
11594 ) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C>
11595 where
11596 I: IntoIterator<Item = St>,
11597 St: AsRef<str>,
11598 {
11599 self._scopes
11600 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11601 self
11602 }
11603
11604 /// Removes all scopes, and no default scope will be used either.
11605 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11606 /// for details).
11607 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C> {
11608 self._scopes.clear();
11609 self
11610 }
11611}
11612
11613/// Creates a GTM Client.
11614///
11615/// A builder for the *containers.workspaces.clients.create* method supported by a *account* resource.
11616/// It is not used directly, but through a [`AccountMethods`] instance.
11617///
11618/// # Example
11619///
11620/// Instantiate a resource method builder
11621///
11622/// ```test_harness,no_run
11623/// # extern crate hyper;
11624/// # extern crate hyper_rustls;
11625/// # extern crate google_tagmanager2 as tagmanager2;
11626/// use tagmanager2::api::Client;
11627/// # async fn dox() {
11628/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11629///
11630/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11631/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11632/// # .with_native_roots()
11633/// # .unwrap()
11634/// # .https_only()
11635/// # .enable_http2()
11636/// # .build();
11637///
11638/// # let executor = hyper_util::rt::TokioExecutor::new();
11639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11640/// # secret,
11641/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11642/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11643/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11644/// # ),
11645/// # ).build().await.unwrap();
11646///
11647/// # let client = hyper_util::client::legacy::Client::builder(
11648/// # hyper_util::rt::TokioExecutor::new()
11649/// # )
11650/// # .build(
11651/// # hyper_rustls::HttpsConnectorBuilder::new()
11652/// # .with_native_roots()
11653/// # .unwrap()
11654/// # .https_or_http()
11655/// # .enable_http2()
11656/// # .build()
11657/// # );
11658/// # let mut hub = TagManager::new(client, auth);
11659/// // As the method needs a request, you would usually fill it with the desired information
11660/// // into the respective structure. Some of the parts shown here might not be applicable !
11661/// // Values shown here are possibly random and not representative !
11662/// let mut req = Client::default();
11663///
11664/// // You can configure optional parameters by calling the respective setters at will, and
11665/// // execute the final call using `doit()`.
11666/// // Values shown here are possibly random and not representative !
11667/// let result = hub.accounts().containers_workspaces_clients_create(req, "parent")
11668/// .doit().await;
11669/// # }
11670/// ```
11671pub struct AccountContainerWorkspaceClientCreateCall<'a, C>
11672where
11673 C: 'a,
11674{
11675 hub: &'a TagManager<C>,
11676 _request: Client,
11677 _parent: String,
11678 _delegate: Option<&'a mut dyn common::Delegate>,
11679 _additional_params: HashMap<String, String>,
11680 _scopes: BTreeSet<String>,
11681}
11682
11683impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientCreateCall<'a, C> {}
11684
11685impl<'a, C> AccountContainerWorkspaceClientCreateCall<'a, C>
11686where
11687 C: common::Connector,
11688{
11689 /// Perform the operation you have build so far.
11690 pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
11691 use std::borrow::Cow;
11692 use std::io::{Read, Seek};
11693
11694 use common::{url::Params, ToParts};
11695 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11696
11697 let mut dd = common::DefaultDelegate;
11698 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11699 dlg.begin(common::MethodInfo {
11700 id: "tagmanager.accounts.containers.workspaces.clients.create",
11701 http_method: hyper::Method::POST,
11702 });
11703
11704 for &field in ["alt", "parent"].iter() {
11705 if self._additional_params.contains_key(field) {
11706 dlg.finished(false);
11707 return Err(common::Error::FieldClash(field));
11708 }
11709 }
11710
11711 let mut params = Params::with_capacity(4 + self._additional_params.len());
11712 params.push("parent", self._parent);
11713
11714 params.extend(self._additional_params.iter());
11715
11716 params.push("alt", "json");
11717 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/clients";
11718 if self._scopes.is_empty() {
11719 self._scopes
11720 .insert(Scope::EditContainer.as_ref().to_string());
11721 }
11722
11723 #[allow(clippy::single_element_loop)]
11724 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11725 url = params.uri_replacement(url, param_name, find_this, true);
11726 }
11727 {
11728 let to_remove = ["parent"];
11729 params.remove_params(&to_remove);
11730 }
11731
11732 let url = params.parse_with_url(&url);
11733
11734 let mut json_mime_type = mime::APPLICATION_JSON;
11735 let mut request_value_reader = {
11736 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11737 common::remove_json_null_values(&mut value);
11738 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11739 serde_json::to_writer(&mut dst, &value).unwrap();
11740 dst
11741 };
11742 let request_size = request_value_reader
11743 .seek(std::io::SeekFrom::End(0))
11744 .unwrap();
11745 request_value_reader
11746 .seek(std::io::SeekFrom::Start(0))
11747 .unwrap();
11748
11749 loop {
11750 let token = match self
11751 .hub
11752 .auth
11753 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11754 .await
11755 {
11756 Ok(token) => token,
11757 Err(e) => match dlg.token(e) {
11758 Ok(token) => token,
11759 Err(e) => {
11760 dlg.finished(false);
11761 return Err(common::Error::MissingToken(e));
11762 }
11763 },
11764 };
11765 request_value_reader
11766 .seek(std::io::SeekFrom::Start(0))
11767 .unwrap();
11768 let mut req_result = {
11769 let client = &self.hub.client;
11770 dlg.pre_request();
11771 let mut req_builder = hyper::Request::builder()
11772 .method(hyper::Method::POST)
11773 .uri(url.as_str())
11774 .header(USER_AGENT, self.hub._user_agent.clone());
11775
11776 if let Some(token) = token.as_ref() {
11777 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11778 }
11779
11780 let request = req_builder
11781 .header(CONTENT_TYPE, json_mime_type.to_string())
11782 .header(CONTENT_LENGTH, request_size as u64)
11783 .body(common::to_body(
11784 request_value_reader.get_ref().clone().into(),
11785 ));
11786
11787 client.request(request.unwrap()).await
11788 };
11789
11790 match req_result {
11791 Err(err) => {
11792 if let common::Retry::After(d) = dlg.http_error(&err) {
11793 sleep(d).await;
11794 continue;
11795 }
11796 dlg.finished(false);
11797 return Err(common::Error::HttpError(err));
11798 }
11799 Ok(res) => {
11800 let (mut parts, body) = res.into_parts();
11801 let mut body = common::Body::new(body);
11802 if !parts.status.is_success() {
11803 let bytes = common::to_bytes(body).await.unwrap_or_default();
11804 let error = serde_json::from_str(&common::to_string(&bytes));
11805 let response = common::to_response(parts, bytes.into());
11806
11807 if let common::Retry::After(d) =
11808 dlg.http_failure(&response, error.as_ref().ok())
11809 {
11810 sleep(d).await;
11811 continue;
11812 }
11813
11814 dlg.finished(false);
11815
11816 return Err(match error {
11817 Ok(value) => common::Error::BadRequest(value),
11818 _ => common::Error::Failure(response),
11819 });
11820 }
11821 let response = {
11822 let bytes = common::to_bytes(body).await.unwrap_or_default();
11823 let encoded = common::to_string(&bytes);
11824 match serde_json::from_str(&encoded) {
11825 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11826 Err(error) => {
11827 dlg.response_json_decode_error(&encoded, &error);
11828 return Err(common::Error::JsonDecodeError(
11829 encoded.to_string(),
11830 error,
11831 ));
11832 }
11833 }
11834 };
11835
11836 dlg.finished(true);
11837 return Ok(response);
11838 }
11839 }
11840 }
11841 }
11842
11843 ///
11844 /// Sets the *request* property to the given value.
11845 ///
11846 /// Even though the property as already been set when instantiating this call,
11847 /// we provide this method for API completeness.
11848 pub fn request(
11849 mut self,
11850 new_value: Client,
11851 ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11852 self._request = new_value;
11853 self
11854 }
11855 /// GTM Workspace's API relative path.
11856 ///
11857 /// Sets the *parent* path property to the given value.
11858 ///
11859 /// Even though the property as already been set when instantiating this call,
11860 /// we provide this method for API completeness.
11861 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11862 self._parent = new_value.to_string();
11863 self
11864 }
11865 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11866 /// while executing the actual API request.
11867 ///
11868 /// ````text
11869 /// It should be used to handle progress information, and to implement a certain level of resilience.
11870 /// ````
11871 ///
11872 /// Sets the *delegate* property to the given value.
11873 pub fn delegate(
11874 mut self,
11875 new_value: &'a mut dyn common::Delegate,
11876 ) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11877 self._delegate = Some(new_value);
11878 self
11879 }
11880
11881 /// Set any additional parameter of the query string used in the request.
11882 /// It should be used to set parameters which are not yet available through their own
11883 /// setters.
11884 ///
11885 /// Please note that this method must not be used to set any of the known parameters
11886 /// which have their own setter method. If done anyway, the request will fail.
11887 ///
11888 /// # Additional Parameters
11889 ///
11890 /// * *$.xgafv* (query-string) - V1 error format.
11891 /// * *access_token* (query-string) - OAuth access token.
11892 /// * *alt* (query-string) - Data format for response.
11893 /// * *callback* (query-string) - JSONP
11894 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11895 /// * *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.
11896 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11897 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11898 /// * *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.
11899 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11900 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11901 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11902 where
11903 T: AsRef<str>,
11904 {
11905 self._additional_params
11906 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11907 self
11908 }
11909
11910 /// Identifies the authorization scope for the method you are building.
11911 ///
11912 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11913 /// [`Scope::EditContainer`].
11914 ///
11915 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11916 /// tokens for more than one scope.
11917 ///
11918 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11919 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11920 /// sufficient, a read-write scope will do as well.
11921 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11922 where
11923 St: AsRef<str>,
11924 {
11925 self._scopes.insert(String::from(scope.as_ref()));
11926 self
11927 }
11928 /// Identifies the authorization scope(s) for the method you are building.
11929 ///
11930 /// See [`Self::add_scope()`] for details.
11931 pub fn add_scopes<I, St>(
11932 mut self,
11933 scopes: I,
11934 ) -> AccountContainerWorkspaceClientCreateCall<'a, C>
11935 where
11936 I: IntoIterator<Item = St>,
11937 St: AsRef<str>,
11938 {
11939 self._scopes
11940 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11941 self
11942 }
11943
11944 /// Removes all scopes, and no default scope will be used either.
11945 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11946 /// for details).
11947 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientCreateCall<'a, C> {
11948 self._scopes.clear();
11949 self
11950 }
11951}
11952
11953/// Deletes a GTM Client.
11954///
11955/// A builder for the *containers.workspaces.clients.delete* method supported by a *account* resource.
11956/// It is not used directly, but through a [`AccountMethods`] instance.
11957///
11958/// # Example
11959///
11960/// Instantiate a resource method builder
11961///
11962/// ```test_harness,no_run
11963/// # extern crate hyper;
11964/// # extern crate hyper_rustls;
11965/// # extern crate google_tagmanager2 as tagmanager2;
11966/// # async fn dox() {
11967/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11968///
11969/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11970/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11971/// # .with_native_roots()
11972/// # .unwrap()
11973/// # .https_only()
11974/// # .enable_http2()
11975/// # .build();
11976///
11977/// # let executor = hyper_util::rt::TokioExecutor::new();
11978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11979/// # secret,
11980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11981/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11982/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11983/// # ),
11984/// # ).build().await.unwrap();
11985///
11986/// # let client = hyper_util::client::legacy::Client::builder(
11987/// # hyper_util::rt::TokioExecutor::new()
11988/// # )
11989/// # .build(
11990/// # hyper_rustls::HttpsConnectorBuilder::new()
11991/// # .with_native_roots()
11992/// # .unwrap()
11993/// # .https_or_http()
11994/// # .enable_http2()
11995/// # .build()
11996/// # );
11997/// # let mut hub = TagManager::new(client, auth);
11998/// // You can configure optional parameters by calling the respective setters at will, and
11999/// // execute the final call using `doit()`.
12000/// // Values shown here are possibly random and not representative !
12001/// let result = hub.accounts().containers_workspaces_clients_delete("path")
12002/// .doit().await;
12003/// # }
12004/// ```
12005pub struct AccountContainerWorkspaceClientDeleteCall<'a, C>
12006where
12007 C: 'a,
12008{
12009 hub: &'a TagManager<C>,
12010 _path: String,
12011 _delegate: Option<&'a mut dyn common::Delegate>,
12012 _additional_params: HashMap<String, String>,
12013 _scopes: BTreeSet<String>,
12014}
12015
12016impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientDeleteCall<'a, C> {}
12017
12018impl<'a, C> AccountContainerWorkspaceClientDeleteCall<'a, C>
12019where
12020 C: common::Connector,
12021{
12022 /// Perform the operation you have build so far.
12023 pub async fn doit(mut self) -> common::Result<common::Response> {
12024 use std::borrow::Cow;
12025 use std::io::{Read, Seek};
12026
12027 use common::{url::Params, ToParts};
12028 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12029
12030 let mut dd = common::DefaultDelegate;
12031 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12032 dlg.begin(common::MethodInfo {
12033 id: "tagmanager.accounts.containers.workspaces.clients.delete",
12034 http_method: hyper::Method::DELETE,
12035 });
12036
12037 for &field in ["path"].iter() {
12038 if self._additional_params.contains_key(field) {
12039 dlg.finished(false);
12040 return Err(common::Error::FieldClash(field));
12041 }
12042 }
12043
12044 let mut params = Params::with_capacity(2 + self._additional_params.len());
12045 params.push("path", self._path);
12046
12047 params.extend(self._additional_params.iter());
12048
12049 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
12050 if self._scopes.is_empty() {
12051 self._scopes
12052 .insert(Scope::EditContainer.as_ref().to_string());
12053 }
12054
12055 #[allow(clippy::single_element_loop)]
12056 for &(find_this, param_name) in [("{+path}", "path")].iter() {
12057 url = params.uri_replacement(url, param_name, find_this, true);
12058 }
12059 {
12060 let to_remove = ["path"];
12061 params.remove_params(&to_remove);
12062 }
12063
12064 let url = params.parse_with_url(&url);
12065
12066 loop {
12067 let token = match self
12068 .hub
12069 .auth
12070 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12071 .await
12072 {
12073 Ok(token) => token,
12074 Err(e) => match dlg.token(e) {
12075 Ok(token) => token,
12076 Err(e) => {
12077 dlg.finished(false);
12078 return Err(common::Error::MissingToken(e));
12079 }
12080 },
12081 };
12082 let mut req_result = {
12083 let client = &self.hub.client;
12084 dlg.pre_request();
12085 let mut req_builder = hyper::Request::builder()
12086 .method(hyper::Method::DELETE)
12087 .uri(url.as_str())
12088 .header(USER_AGENT, self.hub._user_agent.clone());
12089
12090 if let Some(token) = token.as_ref() {
12091 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12092 }
12093
12094 let request = req_builder
12095 .header(CONTENT_LENGTH, 0_u64)
12096 .body(common::to_body::<String>(None));
12097
12098 client.request(request.unwrap()).await
12099 };
12100
12101 match req_result {
12102 Err(err) => {
12103 if let common::Retry::After(d) = dlg.http_error(&err) {
12104 sleep(d).await;
12105 continue;
12106 }
12107 dlg.finished(false);
12108 return Err(common::Error::HttpError(err));
12109 }
12110 Ok(res) => {
12111 let (mut parts, body) = res.into_parts();
12112 let mut body = common::Body::new(body);
12113 if !parts.status.is_success() {
12114 let bytes = common::to_bytes(body).await.unwrap_or_default();
12115 let error = serde_json::from_str(&common::to_string(&bytes));
12116 let response = common::to_response(parts, bytes.into());
12117
12118 if let common::Retry::After(d) =
12119 dlg.http_failure(&response, error.as_ref().ok())
12120 {
12121 sleep(d).await;
12122 continue;
12123 }
12124
12125 dlg.finished(false);
12126
12127 return Err(match error {
12128 Ok(value) => common::Error::BadRequest(value),
12129 _ => common::Error::Failure(response),
12130 });
12131 }
12132 let response = common::Response::from_parts(parts, body);
12133
12134 dlg.finished(true);
12135 return Ok(response);
12136 }
12137 }
12138 }
12139 }
12140
12141 /// GTM Client's API relative path.
12142 ///
12143 /// Sets the *path* path property to the given value.
12144 ///
12145 /// Even though the property as already been set when instantiating this call,
12146 /// we provide this method for API completeness.
12147 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
12148 self._path = new_value.to_string();
12149 self
12150 }
12151 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12152 /// while executing the actual API request.
12153 ///
12154 /// ````text
12155 /// It should be used to handle progress information, and to implement a certain level of resilience.
12156 /// ````
12157 ///
12158 /// Sets the *delegate* property to the given value.
12159 pub fn delegate(
12160 mut self,
12161 new_value: &'a mut dyn common::Delegate,
12162 ) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
12163 self._delegate = Some(new_value);
12164 self
12165 }
12166
12167 /// Set any additional parameter of the query string used in the request.
12168 /// It should be used to set parameters which are not yet available through their own
12169 /// setters.
12170 ///
12171 /// Please note that this method must not be used to set any of the known parameters
12172 /// which have their own setter method. If done anyway, the request will fail.
12173 ///
12174 /// # Additional Parameters
12175 ///
12176 /// * *$.xgafv* (query-string) - V1 error format.
12177 /// * *access_token* (query-string) - OAuth access token.
12178 /// * *alt* (query-string) - Data format for response.
12179 /// * *callback* (query-string) - JSONP
12180 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12181 /// * *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.
12182 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12183 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12184 /// * *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.
12185 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12186 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12187 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
12188 where
12189 T: AsRef<str>,
12190 {
12191 self._additional_params
12192 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12193 self
12194 }
12195
12196 /// Identifies the authorization scope for the method you are building.
12197 ///
12198 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12199 /// [`Scope::EditContainer`].
12200 ///
12201 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12202 /// tokens for more than one scope.
12203 ///
12204 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12205 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12206 /// sufficient, a read-write scope will do as well.
12207 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
12208 where
12209 St: AsRef<str>,
12210 {
12211 self._scopes.insert(String::from(scope.as_ref()));
12212 self
12213 }
12214 /// Identifies the authorization scope(s) for the method you are building.
12215 ///
12216 /// See [`Self::add_scope()`] for details.
12217 pub fn add_scopes<I, St>(
12218 mut self,
12219 scopes: I,
12220 ) -> AccountContainerWorkspaceClientDeleteCall<'a, C>
12221 where
12222 I: IntoIterator<Item = St>,
12223 St: AsRef<str>,
12224 {
12225 self._scopes
12226 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12227 self
12228 }
12229
12230 /// Removes all scopes, and no default scope will be used either.
12231 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12232 /// for details).
12233 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientDeleteCall<'a, C> {
12234 self._scopes.clear();
12235 self
12236 }
12237}
12238
12239/// Gets a GTM Client.
12240///
12241/// A builder for the *containers.workspaces.clients.get* method supported by a *account* resource.
12242/// It is not used directly, but through a [`AccountMethods`] instance.
12243///
12244/// # Example
12245///
12246/// Instantiate a resource method builder
12247///
12248/// ```test_harness,no_run
12249/// # extern crate hyper;
12250/// # extern crate hyper_rustls;
12251/// # extern crate google_tagmanager2 as tagmanager2;
12252/// # async fn dox() {
12253/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12254///
12255/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12256/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12257/// # .with_native_roots()
12258/// # .unwrap()
12259/// # .https_only()
12260/// # .enable_http2()
12261/// # .build();
12262///
12263/// # let executor = hyper_util::rt::TokioExecutor::new();
12264/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12265/// # secret,
12266/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12267/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12268/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12269/// # ),
12270/// # ).build().await.unwrap();
12271///
12272/// # let client = hyper_util::client::legacy::Client::builder(
12273/// # hyper_util::rt::TokioExecutor::new()
12274/// # )
12275/// # .build(
12276/// # hyper_rustls::HttpsConnectorBuilder::new()
12277/// # .with_native_roots()
12278/// # .unwrap()
12279/// # .https_or_http()
12280/// # .enable_http2()
12281/// # .build()
12282/// # );
12283/// # let mut hub = TagManager::new(client, auth);
12284/// // You can configure optional parameters by calling the respective setters at will, and
12285/// // execute the final call using `doit()`.
12286/// // Values shown here are possibly random and not representative !
12287/// let result = hub.accounts().containers_workspaces_clients_get("path")
12288/// .doit().await;
12289/// # }
12290/// ```
12291pub struct AccountContainerWorkspaceClientGetCall<'a, C>
12292where
12293 C: 'a,
12294{
12295 hub: &'a TagManager<C>,
12296 _path: String,
12297 _delegate: Option<&'a mut dyn common::Delegate>,
12298 _additional_params: HashMap<String, String>,
12299 _scopes: BTreeSet<String>,
12300}
12301
12302impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientGetCall<'a, C> {}
12303
12304impl<'a, C> AccountContainerWorkspaceClientGetCall<'a, C>
12305where
12306 C: common::Connector,
12307{
12308 /// Perform the operation you have build so far.
12309 pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
12310 use std::borrow::Cow;
12311 use std::io::{Read, Seek};
12312
12313 use common::{url::Params, ToParts};
12314 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12315
12316 let mut dd = common::DefaultDelegate;
12317 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12318 dlg.begin(common::MethodInfo {
12319 id: "tagmanager.accounts.containers.workspaces.clients.get",
12320 http_method: hyper::Method::GET,
12321 });
12322
12323 for &field in ["alt", "path"].iter() {
12324 if self._additional_params.contains_key(field) {
12325 dlg.finished(false);
12326 return Err(common::Error::FieldClash(field));
12327 }
12328 }
12329
12330 let mut params = Params::with_capacity(3 + self._additional_params.len());
12331 params.push("path", self._path);
12332
12333 params.extend(self._additional_params.iter());
12334
12335 params.push("alt", "json");
12336 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
12337 if self._scopes.is_empty() {
12338 self._scopes.insert(Scope::Readonly.as_ref().to_string());
12339 }
12340
12341 #[allow(clippy::single_element_loop)]
12342 for &(find_this, param_name) in [("{+path}", "path")].iter() {
12343 url = params.uri_replacement(url, param_name, find_this, true);
12344 }
12345 {
12346 let to_remove = ["path"];
12347 params.remove_params(&to_remove);
12348 }
12349
12350 let url = params.parse_with_url(&url);
12351
12352 loop {
12353 let token = match self
12354 .hub
12355 .auth
12356 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12357 .await
12358 {
12359 Ok(token) => token,
12360 Err(e) => match dlg.token(e) {
12361 Ok(token) => token,
12362 Err(e) => {
12363 dlg.finished(false);
12364 return Err(common::Error::MissingToken(e));
12365 }
12366 },
12367 };
12368 let mut req_result = {
12369 let client = &self.hub.client;
12370 dlg.pre_request();
12371 let mut req_builder = hyper::Request::builder()
12372 .method(hyper::Method::GET)
12373 .uri(url.as_str())
12374 .header(USER_AGENT, self.hub._user_agent.clone());
12375
12376 if let Some(token) = token.as_ref() {
12377 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12378 }
12379
12380 let request = req_builder
12381 .header(CONTENT_LENGTH, 0_u64)
12382 .body(common::to_body::<String>(None));
12383
12384 client.request(request.unwrap()).await
12385 };
12386
12387 match req_result {
12388 Err(err) => {
12389 if let common::Retry::After(d) = dlg.http_error(&err) {
12390 sleep(d).await;
12391 continue;
12392 }
12393 dlg.finished(false);
12394 return Err(common::Error::HttpError(err));
12395 }
12396 Ok(res) => {
12397 let (mut parts, body) = res.into_parts();
12398 let mut body = common::Body::new(body);
12399 if !parts.status.is_success() {
12400 let bytes = common::to_bytes(body).await.unwrap_or_default();
12401 let error = serde_json::from_str(&common::to_string(&bytes));
12402 let response = common::to_response(parts, bytes.into());
12403
12404 if let common::Retry::After(d) =
12405 dlg.http_failure(&response, error.as_ref().ok())
12406 {
12407 sleep(d).await;
12408 continue;
12409 }
12410
12411 dlg.finished(false);
12412
12413 return Err(match error {
12414 Ok(value) => common::Error::BadRequest(value),
12415 _ => common::Error::Failure(response),
12416 });
12417 }
12418 let response = {
12419 let bytes = common::to_bytes(body).await.unwrap_or_default();
12420 let encoded = common::to_string(&bytes);
12421 match serde_json::from_str(&encoded) {
12422 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12423 Err(error) => {
12424 dlg.response_json_decode_error(&encoded, &error);
12425 return Err(common::Error::JsonDecodeError(
12426 encoded.to_string(),
12427 error,
12428 ));
12429 }
12430 }
12431 };
12432
12433 dlg.finished(true);
12434 return Ok(response);
12435 }
12436 }
12437 }
12438 }
12439
12440 /// GTM Client's API relative path.
12441 ///
12442 /// Sets the *path* path property to the given value.
12443 ///
12444 /// Even though the property as already been set when instantiating this call,
12445 /// we provide this method for API completeness.
12446 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12447 self._path = new_value.to_string();
12448 self
12449 }
12450 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12451 /// while executing the actual API request.
12452 ///
12453 /// ````text
12454 /// It should be used to handle progress information, and to implement a certain level of resilience.
12455 /// ````
12456 ///
12457 /// Sets the *delegate* property to the given value.
12458 pub fn delegate(
12459 mut self,
12460 new_value: &'a mut dyn common::Delegate,
12461 ) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12462 self._delegate = Some(new_value);
12463 self
12464 }
12465
12466 /// Set any additional parameter of the query string used in the request.
12467 /// It should be used to set parameters which are not yet available through their own
12468 /// setters.
12469 ///
12470 /// Please note that this method must not be used to set any of the known parameters
12471 /// which have their own setter method. If done anyway, the request will fail.
12472 ///
12473 /// # Additional Parameters
12474 ///
12475 /// * *$.xgafv* (query-string) - V1 error format.
12476 /// * *access_token* (query-string) - OAuth access token.
12477 /// * *alt* (query-string) - Data format for response.
12478 /// * *callback* (query-string) - JSONP
12479 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12480 /// * *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.
12481 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12482 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12483 /// * *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.
12484 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12485 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12486 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientGetCall<'a, C>
12487 where
12488 T: AsRef<str>,
12489 {
12490 self._additional_params
12491 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12492 self
12493 }
12494
12495 /// Identifies the authorization scope for the method you are building.
12496 ///
12497 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12498 /// [`Scope::Readonly`].
12499 ///
12500 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12501 /// tokens for more than one scope.
12502 ///
12503 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12504 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12505 /// sufficient, a read-write scope will do as well.
12506 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientGetCall<'a, C>
12507 where
12508 St: AsRef<str>,
12509 {
12510 self._scopes.insert(String::from(scope.as_ref()));
12511 self
12512 }
12513 /// Identifies the authorization scope(s) for the method you are building.
12514 ///
12515 /// See [`Self::add_scope()`] for details.
12516 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceClientGetCall<'a, C>
12517 where
12518 I: IntoIterator<Item = St>,
12519 St: AsRef<str>,
12520 {
12521 self._scopes
12522 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12523 self
12524 }
12525
12526 /// Removes all scopes, and no default scope will be used either.
12527 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12528 /// for details).
12529 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientGetCall<'a, C> {
12530 self._scopes.clear();
12531 self
12532 }
12533}
12534
12535/// Lists all GTM Clients of a GTM container workspace.
12536///
12537/// A builder for the *containers.workspaces.clients.list* method supported by a *account* resource.
12538/// It is not used directly, but through a [`AccountMethods`] instance.
12539///
12540/// # Example
12541///
12542/// Instantiate a resource method builder
12543///
12544/// ```test_harness,no_run
12545/// # extern crate hyper;
12546/// # extern crate hyper_rustls;
12547/// # extern crate google_tagmanager2 as tagmanager2;
12548/// # async fn dox() {
12549/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12550///
12551/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12552/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12553/// # .with_native_roots()
12554/// # .unwrap()
12555/// # .https_only()
12556/// # .enable_http2()
12557/// # .build();
12558///
12559/// # let executor = hyper_util::rt::TokioExecutor::new();
12560/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12561/// # secret,
12562/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12563/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12564/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12565/// # ),
12566/// # ).build().await.unwrap();
12567///
12568/// # let client = hyper_util::client::legacy::Client::builder(
12569/// # hyper_util::rt::TokioExecutor::new()
12570/// # )
12571/// # .build(
12572/// # hyper_rustls::HttpsConnectorBuilder::new()
12573/// # .with_native_roots()
12574/// # .unwrap()
12575/// # .https_or_http()
12576/// # .enable_http2()
12577/// # .build()
12578/// # );
12579/// # let mut hub = TagManager::new(client, auth);
12580/// // You can configure optional parameters by calling the respective setters at will, and
12581/// // execute the final call using `doit()`.
12582/// // Values shown here are possibly random and not representative !
12583/// let result = hub.accounts().containers_workspaces_clients_list("parent")
12584/// .page_token("elitr")
12585/// .doit().await;
12586/// # }
12587/// ```
12588pub struct AccountContainerWorkspaceClientListCall<'a, C>
12589where
12590 C: 'a,
12591{
12592 hub: &'a TagManager<C>,
12593 _parent: String,
12594 _page_token: Option<String>,
12595 _delegate: Option<&'a mut dyn common::Delegate>,
12596 _additional_params: HashMap<String, String>,
12597 _scopes: BTreeSet<String>,
12598}
12599
12600impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientListCall<'a, C> {}
12601
12602impl<'a, C> AccountContainerWorkspaceClientListCall<'a, C>
12603where
12604 C: common::Connector,
12605{
12606 /// Perform the operation you have build so far.
12607 pub async fn doit(mut self) -> common::Result<(common::Response, ListClientsResponse)> {
12608 use std::borrow::Cow;
12609 use std::io::{Read, Seek};
12610
12611 use common::{url::Params, ToParts};
12612 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12613
12614 let mut dd = common::DefaultDelegate;
12615 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12616 dlg.begin(common::MethodInfo {
12617 id: "tagmanager.accounts.containers.workspaces.clients.list",
12618 http_method: hyper::Method::GET,
12619 });
12620
12621 for &field in ["alt", "parent", "pageToken"].iter() {
12622 if self._additional_params.contains_key(field) {
12623 dlg.finished(false);
12624 return Err(common::Error::FieldClash(field));
12625 }
12626 }
12627
12628 let mut params = Params::with_capacity(4 + self._additional_params.len());
12629 params.push("parent", self._parent);
12630 if let Some(value) = self._page_token.as_ref() {
12631 params.push("pageToken", value);
12632 }
12633
12634 params.extend(self._additional_params.iter());
12635
12636 params.push("alt", "json");
12637 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/clients";
12638 if self._scopes.is_empty() {
12639 self._scopes.insert(Scope::Readonly.as_ref().to_string());
12640 }
12641
12642 #[allow(clippy::single_element_loop)]
12643 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12644 url = params.uri_replacement(url, param_name, find_this, true);
12645 }
12646 {
12647 let to_remove = ["parent"];
12648 params.remove_params(&to_remove);
12649 }
12650
12651 let url = params.parse_with_url(&url);
12652
12653 loop {
12654 let token = match self
12655 .hub
12656 .auth
12657 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12658 .await
12659 {
12660 Ok(token) => token,
12661 Err(e) => match dlg.token(e) {
12662 Ok(token) => token,
12663 Err(e) => {
12664 dlg.finished(false);
12665 return Err(common::Error::MissingToken(e));
12666 }
12667 },
12668 };
12669 let mut req_result = {
12670 let client = &self.hub.client;
12671 dlg.pre_request();
12672 let mut req_builder = hyper::Request::builder()
12673 .method(hyper::Method::GET)
12674 .uri(url.as_str())
12675 .header(USER_AGENT, self.hub._user_agent.clone());
12676
12677 if let Some(token) = token.as_ref() {
12678 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12679 }
12680
12681 let request = req_builder
12682 .header(CONTENT_LENGTH, 0_u64)
12683 .body(common::to_body::<String>(None));
12684
12685 client.request(request.unwrap()).await
12686 };
12687
12688 match req_result {
12689 Err(err) => {
12690 if let common::Retry::After(d) = dlg.http_error(&err) {
12691 sleep(d).await;
12692 continue;
12693 }
12694 dlg.finished(false);
12695 return Err(common::Error::HttpError(err));
12696 }
12697 Ok(res) => {
12698 let (mut parts, body) = res.into_parts();
12699 let mut body = common::Body::new(body);
12700 if !parts.status.is_success() {
12701 let bytes = common::to_bytes(body).await.unwrap_or_default();
12702 let error = serde_json::from_str(&common::to_string(&bytes));
12703 let response = common::to_response(parts, bytes.into());
12704
12705 if let common::Retry::After(d) =
12706 dlg.http_failure(&response, error.as_ref().ok())
12707 {
12708 sleep(d).await;
12709 continue;
12710 }
12711
12712 dlg.finished(false);
12713
12714 return Err(match error {
12715 Ok(value) => common::Error::BadRequest(value),
12716 _ => common::Error::Failure(response),
12717 });
12718 }
12719 let response = {
12720 let bytes = common::to_bytes(body).await.unwrap_or_default();
12721 let encoded = common::to_string(&bytes);
12722 match serde_json::from_str(&encoded) {
12723 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12724 Err(error) => {
12725 dlg.response_json_decode_error(&encoded, &error);
12726 return Err(common::Error::JsonDecodeError(
12727 encoded.to_string(),
12728 error,
12729 ));
12730 }
12731 }
12732 };
12733
12734 dlg.finished(true);
12735 return Ok(response);
12736 }
12737 }
12738 }
12739 }
12740
12741 /// GTM Workspace's API relative path.
12742 ///
12743 /// Sets the *parent* path property to the given value.
12744 ///
12745 /// Even though the property as already been set when instantiating this call,
12746 /// we provide this method for API completeness.
12747 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceClientListCall<'a, C> {
12748 self._parent = new_value.to_string();
12749 self
12750 }
12751 /// Continuation token for fetching the next page of results.
12752 ///
12753 /// Sets the *page token* query property to the given value.
12754 pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceClientListCall<'a, C> {
12755 self._page_token = Some(new_value.to_string());
12756 self
12757 }
12758 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12759 /// while executing the actual API request.
12760 ///
12761 /// ````text
12762 /// It should be used to handle progress information, and to implement a certain level of resilience.
12763 /// ````
12764 ///
12765 /// Sets the *delegate* property to the given value.
12766 pub fn delegate(
12767 mut self,
12768 new_value: &'a mut dyn common::Delegate,
12769 ) -> AccountContainerWorkspaceClientListCall<'a, C> {
12770 self._delegate = Some(new_value);
12771 self
12772 }
12773
12774 /// Set any additional parameter of the query string used in the request.
12775 /// It should be used to set parameters which are not yet available through their own
12776 /// setters.
12777 ///
12778 /// Please note that this method must not be used to set any of the known parameters
12779 /// which have their own setter method. If done anyway, the request will fail.
12780 ///
12781 /// # Additional Parameters
12782 ///
12783 /// * *$.xgafv* (query-string) - V1 error format.
12784 /// * *access_token* (query-string) - OAuth access token.
12785 /// * *alt* (query-string) - Data format for response.
12786 /// * *callback* (query-string) - JSONP
12787 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12788 /// * *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.
12789 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12790 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12791 /// * *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.
12792 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12793 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12794 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientListCall<'a, C>
12795 where
12796 T: AsRef<str>,
12797 {
12798 self._additional_params
12799 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12800 self
12801 }
12802
12803 /// Identifies the authorization scope for the method you are building.
12804 ///
12805 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12806 /// [`Scope::Readonly`].
12807 ///
12808 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12809 /// tokens for more than one scope.
12810 ///
12811 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12812 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12813 /// sufficient, a read-write scope will do as well.
12814 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientListCall<'a, C>
12815 where
12816 St: AsRef<str>,
12817 {
12818 self._scopes.insert(String::from(scope.as_ref()));
12819 self
12820 }
12821 /// Identifies the authorization scope(s) for the method you are building.
12822 ///
12823 /// See [`Self::add_scope()`] for details.
12824 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceClientListCall<'a, C>
12825 where
12826 I: IntoIterator<Item = St>,
12827 St: AsRef<str>,
12828 {
12829 self._scopes
12830 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12831 self
12832 }
12833
12834 /// Removes all scopes, and no default scope will be used either.
12835 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12836 /// for details).
12837 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientListCall<'a, C> {
12838 self._scopes.clear();
12839 self
12840 }
12841}
12842
12843/// Reverts changes to a GTM Client in a GTM Workspace.
12844///
12845/// A builder for the *containers.workspaces.clients.revert* method supported by a *account* resource.
12846/// It is not used directly, but through a [`AccountMethods`] instance.
12847///
12848/// # Example
12849///
12850/// Instantiate a resource method builder
12851///
12852/// ```test_harness,no_run
12853/// # extern crate hyper;
12854/// # extern crate hyper_rustls;
12855/// # extern crate google_tagmanager2 as tagmanager2;
12856/// # async fn dox() {
12857/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12858///
12859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12860/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12861/// # .with_native_roots()
12862/// # .unwrap()
12863/// # .https_only()
12864/// # .enable_http2()
12865/// # .build();
12866///
12867/// # let executor = hyper_util::rt::TokioExecutor::new();
12868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12869/// # secret,
12870/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12871/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12872/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12873/// # ),
12874/// # ).build().await.unwrap();
12875///
12876/// # let client = hyper_util::client::legacy::Client::builder(
12877/// # hyper_util::rt::TokioExecutor::new()
12878/// # )
12879/// # .build(
12880/// # hyper_rustls::HttpsConnectorBuilder::new()
12881/// # .with_native_roots()
12882/// # .unwrap()
12883/// # .https_or_http()
12884/// # .enable_http2()
12885/// # .build()
12886/// # );
12887/// # let mut hub = TagManager::new(client, auth);
12888/// // You can configure optional parameters by calling the respective setters at will, and
12889/// // execute the final call using `doit()`.
12890/// // Values shown here are possibly random and not representative !
12891/// let result = hub.accounts().containers_workspaces_clients_revert("path")
12892/// .fingerprint("diam")
12893/// .doit().await;
12894/// # }
12895/// ```
12896pub struct AccountContainerWorkspaceClientRevertCall<'a, C>
12897where
12898 C: 'a,
12899{
12900 hub: &'a TagManager<C>,
12901 _path: String,
12902 _fingerprint: Option<String>,
12903 _delegate: Option<&'a mut dyn common::Delegate>,
12904 _additional_params: HashMap<String, String>,
12905 _scopes: BTreeSet<String>,
12906}
12907
12908impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientRevertCall<'a, C> {}
12909
12910impl<'a, C> AccountContainerWorkspaceClientRevertCall<'a, C>
12911where
12912 C: common::Connector,
12913{
12914 /// Perform the operation you have build so far.
12915 pub async fn doit(mut self) -> common::Result<(common::Response, RevertClientResponse)> {
12916 use std::borrow::Cow;
12917 use std::io::{Read, Seek};
12918
12919 use common::{url::Params, ToParts};
12920 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12921
12922 let mut dd = common::DefaultDelegate;
12923 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12924 dlg.begin(common::MethodInfo {
12925 id: "tagmanager.accounts.containers.workspaces.clients.revert",
12926 http_method: hyper::Method::POST,
12927 });
12928
12929 for &field in ["alt", "path", "fingerprint"].iter() {
12930 if self._additional_params.contains_key(field) {
12931 dlg.finished(false);
12932 return Err(common::Error::FieldClash(field));
12933 }
12934 }
12935
12936 let mut params = Params::with_capacity(4 + self._additional_params.len());
12937 params.push("path", self._path);
12938 if let Some(value) = self._fingerprint.as_ref() {
12939 params.push("fingerprint", value);
12940 }
12941
12942 params.extend(self._additional_params.iter());
12943
12944 params.push("alt", "json");
12945 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
12946 if self._scopes.is_empty() {
12947 self._scopes
12948 .insert(Scope::EditContainer.as_ref().to_string());
12949 }
12950
12951 #[allow(clippy::single_element_loop)]
12952 for &(find_this, param_name) in [("{+path}", "path")].iter() {
12953 url = params.uri_replacement(url, param_name, find_this, true);
12954 }
12955 {
12956 let to_remove = ["path"];
12957 params.remove_params(&to_remove);
12958 }
12959
12960 let url = params.parse_with_url(&url);
12961
12962 loop {
12963 let token = match self
12964 .hub
12965 .auth
12966 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12967 .await
12968 {
12969 Ok(token) => token,
12970 Err(e) => match dlg.token(e) {
12971 Ok(token) => token,
12972 Err(e) => {
12973 dlg.finished(false);
12974 return Err(common::Error::MissingToken(e));
12975 }
12976 },
12977 };
12978 let mut req_result = {
12979 let client = &self.hub.client;
12980 dlg.pre_request();
12981 let mut req_builder = hyper::Request::builder()
12982 .method(hyper::Method::POST)
12983 .uri(url.as_str())
12984 .header(USER_AGENT, self.hub._user_agent.clone());
12985
12986 if let Some(token) = token.as_ref() {
12987 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12988 }
12989
12990 let request = req_builder
12991 .header(CONTENT_LENGTH, 0_u64)
12992 .body(common::to_body::<String>(None));
12993
12994 client.request(request.unwrap()).await
12995 };
12996
12997 match req_result {
12998 Err(err) => {
12999 if let common::Retry::After(d) = dlg.http_error(&err) {
13000 sleep(d).await;
13001 continue;
13002 }
13003 dlg.finished(false);
13004 return Err(common::Error::HttpError(err));
13005 }
13006 Ok(res) => {
13007 let (mut parts, body) = res.into_parts();
13008 let mut body = common::Body::new(body);
13009 if !parts.status.is_success() {
13010 let bytes = common::to_bytes(body).await.unwrap_or_default();
13011 let error = serde_json::from_str(&common::to_string(&bytes));
13012 let response = common::to_response(parts, bytes.into());
13013
13014 if let common::Retry::After(d) =
13015 dlg.http_failure(&response, error.as_ref().ok())
13016 {
13017 sleep(d).await;
13018 continue;
13019 }
13020
13021 dlg.finished(false);
13022
13023 return Err(match error {
13024 Ok(value) => common::Error::BadRequest(value),
13025 _ => common::Error::Failure(response),
13026 });
13027 }
13028 let response = {
13029 let bytes = common::to_bytes(body).await.unwrap_or_default();
13030 let encoded = common::to_string(&bytes);
13031 match serde_json::from_str(&encoded) {
13032 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13033 Err(error) => {
13034 dlg.response_json_decode_error(&encoded, &error);
13035 return Err(common::Error::JsonDecodeError(
13036 encoded.to_string(),
13037 error,
13038 ));
13039 }
13040 }
13041 };
13042
13043 dlg.finished(true);
13044 return Ok(response);
13045 }
13046 }
13047 }
13048 }
13049
13050 /// GTM Client's API relative path.
13051 ///
13052 /// Sets the *path* path property to the given value.
13053 ///
13054 /// Even though the property as already been set when instantiating this call,
13055 /// we provide this method for API completeness.
13056 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
13057 self._path = new_value.to_string();
13058 self
13059 }
13060 /// When provided, this fingerprint must match the fingerprint of the client in storage.
13061 ///
13062 /// Sets the *fingerprint* query property to the given value.
13063 pub fn fingerprint(
13064 mut self,
13065 new_value: &str,
13066 ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
13067 self._fingerprint = Some(new_value.to_string());
13068 self
13069 }
13070 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13071 /// while executing the actual API request.
13072 ///
13073 /// ````text
13074 /// It should be used to handle progress information, and to implement a certain level of resilience.
13075 /// ````
13076 ///
13077 /// Sets the *delegate* property to the given value.
13078 pub fn delegate(
13079 mut self,
13080 new_value: &'a mut dyn common::Delegate,
13081 ) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
13082 self._delegate = Some(new_value);
13083 self
13084 }
13085
13086 /// Set any additional parameter of the query string used in the request.
13087 /// It should be used to set parameters which are not yet available through their own
13088 /// setters.
13089 ///
13090 /// Please note that this method must not be used to set any of the known parameters
13091 /// which have their own setter method. If done anyway, the request will fail.
13092 ///
13093 /// # Additional Parameters
13094 ///
13095 /// * *$.xgafv* (query-string) - V1 error format.
13096 /// * *access_token* (query-string) - OAuth access token.
13097 /// * *alt* (query-string) - Data format for response.
13098 /// * *callback* (query-string) - JSONP
13099 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13100 /// * *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.
13101 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13102 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13103 /// * *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.
13104 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13105 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13106 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientRevertCall<'a, C>
13107 where
13108 T: AsRef<str>,
13109 {
13110 self._additional_params
13111 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13112 self
13113 }
13114
13115 /// Identifies the authorization scope for the method you are building.
13116 ///
13117 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13118 /// [`Scope::EditContainer`].
13119 ///
13120 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13121 /// tokens for more than one scope.
13122 ///
13123 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13124 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13125 /// sufficient, a read-write scope will do as well.
13126 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientRevertCall<'a, C>
13127 where
13128 St: AsRef<str>,
13129 {
13130 self._scopes.insert(String::from(scope.as_ref()));
13131 self
13132 }
13133 /// Identifies the authorization scope(s) for the method you are building.
13134 ///
13135 /// See [`Self::add_scope()`] for details.
13136 pub fn add_scopes<I, St>(
13137 mut self,
13138 scopes: I,
13139 ) -> AccountContainerWorkspaceClientRevertCall<'a, C>
13140 where
13141 I: IntoIterator<Item = St>,
13142 St: AsRef<str>,
13143 {
13144 self._scopes
13145 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13146 self
13147 }
13148
13149 /// Removes all scopes, and no default scope will be used either.
13150 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13151 /// for details).
13152 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientRevertCall<'a, C> {
13153 self._scopes.clear();
13154 self
13155 }
13156}
13157
13158/// Updates a GTM Client.
13159///
13160/// A builder for the *containers.workspaces.clients.update* method supported by a *account* resource.
13161/// It is not used directly, but through a [`AccountMethods`] instance.
13162///
13163/// # Example
13164///
13165/// Instantiate a resource method builder
13166///
13167/// ```test_harness,no_run
13168/// # extern crate hyper;
13169/// # extern crate hyper_rustls;
13170/// # extern crate google_tagmanager2 as tagmanager2;
13171/// use tagmanager2::api::Client;
13172/// # async fn dox() {
13173/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13174///
13175/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13176/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13177/// # .with_native_roots()
13178/// # .unwrap()
13179/// # .https_only()
13180/// # .enable_http2()
13181/// # .build();
13182///
13183/// # let executor = hyper_util::rt::TokioExecutor::new();
13184/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13185/// # secret,
13186/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13187/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13188/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13189/// # ),
13190/// # ).build().await.unwrap();
13191///
13192/// # let client = hyper_util::client::legacy::Client::builder(
13193/// # hyper_util::rt::TokioExecutor::new()
13194/// # )
13195/// # .build(
13196/// # hyper_rustls::HttpsConnectorBuilder::new()
13197/// # .with_native_roots()
13198/// # .unwrap()
13199/// # .https_or_http()
13200/// # .enable_http2()
13201/// # .build()
13202/// # );
13203/// # let mut hub = TagManager::new(client, auth);
13204/// // As the method needs a request, you would usually fill it with the desired information
13205/// // into the respective structure. Some of the parts shown here might not be applicable !
13206/// // Values shown here are possibly random and not representative !
13207/// let mut req = Client::default();
13208///
13209/// // You can configure optional parameters by calling the respective setters at will, and
13210/// // execute the final call using `doit()`.
13211/// // Values shown here are possibly random and not representative !
13212/// let result = hub.accounts().containers_workspaces_clients_update(req, "path")
13213/// .fingerprint("ipsum")
13214/// .doit().await;
13215/// # }
13216/// ```
13217pub struct AccountContainerWorkspaceClientUpdateCall<'a, C>
13218where
13219 C: 'a,
13220{
13221 hub: &'a TagManager<C>,
13222 _request: Client,
13223 _path: String,
13224 _fingerprint: Option<String>,
13225 _delegate: Option<&'a mut dyn common::Delegate>,
13226 _additional_params: HashMap<String, String>,
13227 _scopes: BTreeSet<String>,
13228}
13229
13230impl<'a, C> common::CallBuilder for AccountContainerWorkspaceClientUpdateCall<'a, C> {}
13231
13232impl<'a, C> AccountContainerWorkspaceClientUpdateCall<'a, C>
13233where
13234 C: common::Connector,
13235{
13236 /// Perform the operation you have build so far.
13237 pub async fn doit(mut self) -> common::Result<(common::Response, Client)> {
13238 use std::borrow::Cow;
13239 use std::io::{Read, Seek};
13240
13241 use common::{url::Params, ToParts};
13242 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13243
13244 let mut dd = common::DefaultDelegate;
13245 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13246 dlg.begin(common::MethodInfo {
13247 id: "tagmanager.accounts.containers.workspaces.clients.update",
13248 http_method: hyper::Method::PUT,
13249 });
13250
13251 for &field in ["alt", "path", "fingerprint"].iter() {
13252 if self._additional_params.contains_key(field) {
13253 dlg.finished(false);
13254 return Err(common::Error::FieldClash(field));
13255 }
13256 }
13257
13258 let mut params = Params::with_capacity(5 + self._additional_params.len());
13259 params.push("path", self._path);
13260 if let Some(value) = self._fingerprint.as_ref() {
13261 params.push("fingerprint", value);
13262 }
13263
13264 params.extend(self._additional_params.iter());
13265
13266 params.push("alt", "json");
13267 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
13268 if self._scopes.is_empty() {
13269 self._scopes
13270 .insert(Scope::EditContainer.as_ref().to_string());
13271 }
13272
13273 #[allow(clippy::single_element_loop)]
13274 for &(find_this, param_name) in [("{+path}", "path")].iter() {
13275 url = params.uri_replacement(url, param_name, find_this, true);
13276 }
13277 {
13278 let to_remove = ["path"];
13279 params.remove_params(&to_remove);
13280 }
13281
13282 let url = params.parse_with_url(&url);
13283
13284 let mut json_mime_type = mime::APPLICATION_JSON;
13285 let mut request_value_reader = {
13286 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13287 common::remove_json_null_values(&mut value);
13288 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13289 serde_json::to_writer(&mut dst, &value).unwrap();
13290 dst
13291 };
13292 let request_size = request_value_reader
13293 .seek(std::io::SeekFrom::End(0))
13294 .unwrap();
13295 request_value_reader
13296 .seek(std::io::SeekFrom::Start(0))
13297 .unwrap();
13298
13299 loop {
13300 let token = match self
13301 .hub
13302 .auth
13303 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13304 .await
13305 {
13306 Ok(token) => token,
13307 Err(e) => match dlg.token(e) {
13308 Ok(token) => token,
13309 Err(e) => {
13310 dlg.finished(false);
13311 return Err(common::Error::MissingToken(e));
13312 }
13313 },
13314 };
13315 request_value_reader
13316 .seek(std::io::SeekFrom::Start(0))
13317 .unwrap();
13318 let mut req_result = {
13319 let client = &self.hub.client;
13320 dlg.pre_request();
13321 let mut req_builder = hyper::Request::builder()
13322 .method(hyper::Method::PUT)
13323 .uri(url.as_str())
13324 .header(USER_AGENT, self.hub._user_agent.clone());
13325
13326 if let Some(token) = token.as_ref() {
13327 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13328 }
13329
13330 let request = req_builder
13331 .header(CONTENT_TYPE, json_mime_type.to_string())
13332 .header(CONTENT_LENGTH, request_size as u64)
13333 .body(common::to_body(
13334 request_value_reader.get_ref().clone().into(),
13335 ));
13336
13337 client.request(request.unwrap()).await
13338 };
13339
13340 match req_result {
13341 Err(err) => {
13342 if let common::Retry::After(d) = dlg.http_error(&err) {
13343 sleep(d).await;
13344 continue;
13345 }
13346 dlg.finished(false);
13347 return Err(common::Error::HttpError(err));
13348 }
13349 Ok(res) => {
13350 let (mut parts, body) = res.into_parts();
13351 let mut body = common::Body::new(body);
13352 if !parts.status.is_success() {
13353 let bytes = common::to_bytes(body).await.unwrap_or_default();
13354 let error = serde_json::from_str(&common::to_string(&bytes));
13355 let response = common::to_response(parts, bytes.into());
13356
13357 if let common::Retry::After(d) =
13358 dlg.http_failure(&response, error.as_ref().ok())
13359 {
13360 sleep(d).await;
13361 continue;
13362 }
13363
13364 dlg.finished(false);
13365
13366 return Err(match error {
13367 Ok(value) => common::Error::BadRequest(value),
13368 _ => common::Error::Failure(response),
13369 });
13370 }
13371 let response = {
13372 let bytes = common::to_bytes(body).await.unwrap_or_default();
13373 let encoded = common::to_string(&bytes);
13374 match serde_json::from_str(&encoded) {
13375 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13376 Err(error) => {
13377 dlg.response_json_decode_error(&encoded, &error);
13378 return Err(common::Error::JsonDecodeError(
13379 encoded.to_string(),
13380 error,
13381 ));
13382 }
13383 }
13384 };
13385
13386 dlg.finished(true);
13387 return Ok(response);
13388 }
13389 }
13390 }
13391 }
13392
13393 ///
13394 /// Sets the *request* property to the given value.
13395 ///
13396 /// Even though the property as already been set when instantiating this call,
13397 /// we provide this method for API completeness.
13398 pub fn request(
13399 mut self,
13400 new_value: Client,
13401 ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13402 self._request = new_value;
13403 self
13404 }
13405 /// GTM Client's API relative path.
13406 ///
13407 /// Sets the *path* path property to the given value.
13408 ///
13409 /// Even though the property as already been set when instantiating this call,
13410 /// we provide this method for API completeness.
13411 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13412 self._path = new_value.to_string();
13413 self
13414 }
13415 /// When provided, this fingerprint must match the fingerprint of the client in storage.
13416 ///
13417 /// Sets the *fingerprint* query property to the given value.
13418 pub fn fingerprint(
13419 mut self,
13420 new_value: &str,
13421 ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13422 self._fingerprint = Some(new_value.to_string());
13423 self
13424 }
13425 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13426 /// while executing the actual API request.
13427 ///
13428 /// ````text
13429 /// It should be used to handle progress information, and to implement a certain level of resilience.
13430 /// ````
13431 ///
13432 /// Sets the *delegate* property to the given value.
13433 pub fn delegate(
13434 mut self,
13435 new_value: &'a mut dyn common::Delegate,
13436 ) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13437 self._delegate = Some(new_value);
13438 self
13439 }
13440
13441 /// Set any additional parameter of the query string used in the request.
13442 /// It should be used to set parameters which are not yet available through their own
13443 /// setters.
13444 ///
13445 /// Please note that this method must not be used to set any of the known parameters
13446 /// which have their own setter method. If done anyway, the request will fail.
13447 ///
13448 /// # Additional Parameters
13449 ///
13450 /// * *$.xgafv* (query-string) - V1 error format.
13451 /// * *access_token* (query-string) - OAuth access token.
13452 /// * *alt* (query-string) - Data format for response.
13453 /// * *callback* (query-string) - JSONP
13454 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13455 /// * *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.
13456 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13457 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13458 /// * *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.
13459 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13460 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13461 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13462 where
13463 T: AsRef<str>,
13464 {
13465 self._additional_params
13466 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13467 self
13468 }
13469
13470 /// Identifies the authorization scope for the method you are building.
13471 ///
13472 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13473 /// [`Scope::EditContainer`].
13474 ///
13475 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13476 /// tokens for more than one scope.
13477 ///
13478 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13479 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13480 /// sufficient, a read-write scope will do as well.
13481 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13482 where
13483 St: AsRef<str>,
13484 {
13485 self._scopes.insert(String::from(scope.as_ref()));
13486 self
13487 }
13488 /// Identifies the authorization scope(s) for the method you are building.
13489 ///
13490 /// See [`Self::add_scope()`] for details.
13491 pub fn add_scopes<I, St>(
13492 mut self,
13493 scopes: I,
13494 ) -> AccountContainerWorkspaceClientUpdateCall<'a, C>
13495 where
13496 I: IntoIterator<Item = St>,
13497 St: AsRef<str>,
13498 {
13499 self._scopes
13500 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13501 self
13502 }
13503
13504 /// Removes all scopes, and no default scope will be used either.
13505 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13506 /// for details).
13507 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceClientUpdateCall<'a, C> {
13508 self._scopes.clear();
13509 self
13510 }
13511}
13512
13513/// Creates a GTM Folder.
13514///
13515/// A builder for the *containers.workspaces.folders.create* method supported by a *account* resource.
13516/// It is not used directly, but through a [`AccountMethods`] instance.
13517///
13518/// # Example
13519///
13520/// Instantiate a resource method builder
13521///
13522/// ```test_harness,no_run
13523/// # extern crate hyper;
13524/// # extern crate hyper_rustls;
13525/// # extern crate google_tagmanager2 as tagmanager2;
13526/// use tagmanager2::api::Folder;
13527/// # async fn dox() {
13528/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13529///
13530/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13531/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13532/// # .with_native_roots()
13533/// # .unwrap()
13534/// # .https_only()
13535/// # .enable_http2()
13536/// # .build();
13537///
13538/// # let executor = hyper_util::rt::TokioExecutor::new();
13539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13540/// # secret,
13541/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13542/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13543/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13544/// # ),
13545/// # ).build().await.unwrap();
13546///
13547/// # let client = hyper_util::client::legacy::Client::builder(
13548/// # hyper_util::rt::TokioExecutor::new()
13549/// # )
13550/// # .build(
13551/// # hyper_rustls::HttpsConnectorBuilder::new()
13552/// # .with_native_roots()
13553/// # .unwrap()
13554/// # .https_or_http()
13555/// # .enable_http2()
13556/// # .build()
13557/// # );
13558/// # let mut hub = TagManager::new(client, auth);
13559/// // As the method needs a request, you would usually fill it with the desired information
13560/// // into the respective structure. Some of the parts shown here might not be applicable !
13561/// // Values shown here are possibly random and not representative !
13562/// let mut req = Folder::default();
13563///
13564/// // You can configure optional parameters by calling the respective setters at will, and
13565/// // execute the final call using `doit()`.
13566/// // Values shown here are possibly random and not representative !
13567/// let result = hub.accounts().containers_workspaces_folders_create(req, "parent")
13568/// .doit().await;
13569/// # }
13570/// ```
13571pub struct AccountContainerWorkspaceFolderCreateCall<'a, C>
13572where
13573 C: 'a,
13574{
13575 hub: &'a TagManager<C>,
13576 _request: Folder,
13577 _parent: String,
13578 _delegate: Option<&'a mut dyn common::Delegate>,
13579 _additional_params: HashMap<String, String>,
13580 _scopes: BTreeSet<String>,
13581}
13582
13583impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderCreateCall<'a, C> {}
13584
13585impl<'a, C> AccountContainerWorkspaceFolderCreateCall<'a, C>
13586where
13587 C: common::Connector,
13588{
13589 /// Perform the operation you have build so far.
13590 pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
13591 use std::borrow::Cow;
13592 use std::io::{Read, Seek};
13593
13594 use common::{url::Params, ToParts};
13595 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13596
13597 let mut dd = common::DefaultDelegate;
13598 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13599 dlg.begin(common::MethodInfo {
13600 id: "tagmanager.accounts.containers.workspaces.folders.create",
13601 http_method: hyper::Method::POST,
13602 });
13603
13604 for &field in ["alt", "parent"].iter() {
13605 if self._additional_params.contains_key(field) {
13606 dlg.finished(false);
13607 return Err(common::Error::FieldClash(field));
13608 }
13609 }
13610
13611 let mut params = Params::with_capacity(4 + self._additional_params.len());
13612 params.push("parent", self._parent);
13613
13614 params.extend(self._additional_params.iter());
13615
13616 params.push("alt", "json");
13617 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/folders";
13618 if self._scopes.is_empty() {
13619 self._scopes
13620 .insert(Scope::EditContainer.as_ref().to_string());
13621 }
13622
13623 #[allow(clippy::single_element_loop)]
13624 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13625 url = params.uri_replacement(url, param_name, find_this, true);
13626 }
13627 {
13628 let to_remove = ["parent"];
13629 params.remove_params(&to_remove);
13630 }
13631
13632 let url = params.parse_with_url(&url);
13633
13634 let mut json_mime_type = mime::APPLICATION_JSON;
13635 let mut request_value_reader = {
13636 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13637 common::remove_json_null_values(&mut value);
13638 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13639 serde_json::to_writer(&mut dst, &value).unwrap();
13640 dst
13641 };
13642 let request_size = request_value_reader
13643 .seek(std::io::SeekFrom::End(0))
13644 .unwrap();
13645 request_value_reader
13646 .seek(std::io::SeekFrom::Start(0))
13647 .unwrap();
13648
13649 loop {
13650 let token = match self
13651 .hub
13652 .auth
13653 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13654 .await
13655 {
13656 Ok(token) => token,
13657 Err(e) => match dlg.token(e) {
13658 Ok(token) => token,
13659 Err(e) => {
13660 dlg.finished(false);
13661 return Err(common::Error::MissingToken(e));
13662 }
13663 },
13664 };
13665 request_value_reader
13666 .seek(std::io::SeekFrom::Start(0))
13667 .unwrap();
13668 let mut req_result = {
13669 let client = &self.hub.client;
13670 dlg.pre_request();
13671 let mut req_builder = hyper::Request::builder()
13672 .method(hyper::Method::POST)
13673 .uri(url.as_str())
13674 .header(USER_AGENT, self.hub._user_agent.clone());
13675
13676 if let Some(token) = token.as_ref() {
13677 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13678 }
13679
13680 let request = req_builder
13681 .header(CONTENT_TYPE, json_mime_type.to_string())
13682 .header(CONTENT_LENGTH, request_size as u64)
13683 .body(common::to_body(
13684 request_value_reader.get_ref().clone().into(),
13685 ));
13686
13687 client.request(request.unwrap()).await
13688 };
13689
13690 match req_result {
13691 Err(err) => {
13692 if let common::Retry::After(d) = dlg.http_error(&err) {
13693 sleep(d).await;
13694 continue;
13695 }
13696 dlg.finished(false);
13697 return Err(common::Error::HttpError(err));
13698 }
13699 Ok(res) => {
13700 let (mut parts, body) = res.into_parts();
13701 let mut body = common::Body::new(body);
13702 if !parts.status.is_success() {
13703 let bytes = common::to_bytes(body).await.unwrap_or_default();
13704 let error = serde_json::from_str(&common::to_string(&bytes));
13705 let response = common::to_response(parts, bytes.into());
13706
13707 if let common::Retry::After(d) =
13708 dlg.http_failure(&response, error.as_ref().ok())
13709 {
13710 sleep(d).await;
13711 continue;
13712 }
13713
13714 dlg.finished(false);
13715
13716 return Err(match error {
13717 Ok(value) => common::Error::BadRequest(value),
13718 _ => common::Error::Failure(response),
13719 });
13720 }
13721 let response = {
13722 let bytes = common::to_bytes(body).await.unwrap_or_default();
13723 let encoded = common::to_string(&bytes);
13724 match serde_json::from_str(&encoded) {
13725 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13726 Err(error) => {
13727 dlg.response_json_decode_error(&encoded, &error);
13728 return Err(common::Error::JsonDecodeError(
13729 encoded.to_string(),
13730 error,
13731 ));
13732 }
13733 }
13734 };
13735
13736 dlg.finished(true);
13737 return Ok(response);
13738 }
13739 }
13740 }
13741 }
13742
13743 ///
13744 /// Sets the *request* property to the given value.
13745 ///
13746 /// Even though the property as already been set when instantiating this call,
13747 /// we provide this method for API completeness.
13748 pub fn request(
13749 mut self,
13750 new_value: Folder,
13751 ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13752 self._request = new_value;
13753 self
13754 }
13755 /// GTM Workspace's API relative path.
13756 ///
13757 /// Sets the *parent* path property to the given value.
13758 ///
13759 /// Even though the property as already been set when instantiating this call,
13760 /// we provide this method for API completeness.
13761 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13762 self._parent = new_value.to_string();
13763 self
13764 }
13765 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13766 /// while executing the actual API request.
13767 ///
13768 /// ````text
13769 /// It should be used to handle progress information, and to implement a certain level of resilience.
13770 /// ````
13771 ///
13772 /// Sets the *delegate* property to the given value.
13773 pub fn delegate(
13774 mut self,
13775 new_value: &'a mut dyn common::Delegate,
13776 ) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13777 self._delegate = Some(new_value);
13778 self
13779 }
13780
13781 /// Set any additional parameter of the query string used in the request.
13782 /// It should be used to set parameters which are not yet available through their own
13783 /// setters.
13784 ///
13785 /// Please note that this method must not be used to set any of the known parameters
13786 /// which have their own setter method. If done anyway, the request will fail.
13787 ///
13788 /// # Additional Parameters
13789 ///
13790 /// * *$.xgafv* (query-string) - V1 error format.
13791 /// * *access_token* (query-string) - OAuth access token.
13792 /// * *alt* (query-string) - Data format for response.
13793 /// * *callback* (query-string) - JSONP
13794 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13795 /// * *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.
13796 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13797 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13798 /// * *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.
13799 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13800 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13801 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13802 where
13803 T: AsRef<str>,
13804 {
13805 self._additional_params
13806 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13807 self
13808 }
13809
13810 /// Identifies the authorization scope for the method you are building.
13811 ///
13812 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13813 /// [`Scope::EditContainer`].
13814 ///
13815 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13816 /// tokens for more than one scope.
13817 ///
13818 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13819 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13820 /// sufficient, a read-write scope will do as well.
13821 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13822 where
13823 St: AsRef<str>,
13824 {
13825 self._scopes.insert(String::from(scope.as_ref()));
13826 self
13827 }
13828 /// Identifies the authorization scope(s) for the method you are building.
13829 ///
13830 /// See [`Self::add_scope()`] for details.
13831 pub fn add_scopes<I, St>(
13832 mut self,
13833 scopes: I,
13834 ) -> AccountContainerWorkspaceFolderCreateCall<'a, C>
13835 where
13836 I: IntoIterator<Item = St>,
13837 St: AsRef<str>,
13838 {
13839 self._scopes
13840 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13841 self
13842 }
13843
13844 /// Removes all scopes, and no default scope will be used either.
13845 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13846 /// for details).
13847 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderCreateCall<'a, C> {
13848 self._scopes.clear();
13849 self
13850 }
13851}
13852
13853/// Deletes a GTM Folder.
13854///
13855/// A builder for the *containers.workspaces.folders.delete* method supported by a *account* resource.
13856/// It is not used directly, but through a [`AccountMethods`] instance.
13857///
13858/// # Example
13859///
13860/// Instantiate a resource method builder
13861///
13862/// ```test_harness,no_run
13863/// # extern crate hyper;
13864/// # extern crate hyper_rustls;
13865/// # extern crate google_tagmanager2 as tagmanager2;
13866/// # async fn dox() {
13867/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13868///
13869/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13870/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13871/// # .with_native_roots()
13872/// # .unwrap()
13873/// # .https_only()
13874/// # .enable_http2()
13875/// # .build();
13876///
13877/// # let executor = hyper_util::rt::TokioExecutor::new();
13878/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13879/// # secret,
13880/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13881/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13882/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13883/// # ),
13884/// # ).build().await.unwrap();
13885///
13886/// # let client = hyper_util::client::legacy::Client::builder(
13887/// # hyper_util::rt::TokioExecutor::new()
13888/// # )
13889/// # .build(
13890/// # hyper_rustls::HttpsConnectorBuilder::new()
13891/// # .with_native_roots()
13892/// # .unwrap()
13893/// # .https_or_http()
13894/// # .enable_http2()
13895/// # .build()
13896/// # );
13897/// # let mut hub = TagManager::new(client, auth);
13898/// // You can configure optional parameters by calling the respective setters at will, and
13899/// // execute the final call using `doit()`.
13900/// // Values shown here are possibly random and not representative !
13901/// let result = hub.accounts().containers_workspaces_folders_delete("path")
13902/// .doit().await;
13903/// # }
13904/// ```
13905pub struct AccountContainerWorkspaceFolderDeleteCall<'a, C>
13906where
13907 C: 'a,
13908{
13909 hub: &'a TagManager<C>,
13910 _path: String,
13911 _delegate: Option<&'a mut dyn common::Delegate>,
13912 _additional_params: HashMap<String, String>,
13913 _scopes: BTreeSet<String>,
13914}
13915
13916impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderDeleteCall<'a, C> {}
13917
13918impl<'a, C> AccountContainerWorkspaceFolderDeleteCall<'a, C>
13919where
13920 C: common::Connector,
13921{
13922 /// Perform the operation you have build so far.
13923 pub async fn doit(mut self) -> common::Result<common::Response> {
13924 use std::borrow::Cow;
13925 use std::io::{Read, Seek};
13926
13927 use common::{url::Params, ToParts};
13928 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13929
13930 let mut dd = common::DefaultDelegate;
13931 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13932 dlg.begin(common::MethodInfo {
13933 id: "tagmanager.accounts.containers.workspaces.folders.delete",
13934 http_method: hyper::Method::DELETE,
13935 });
13936
13937 for &field in ["path"].iter() {
13938 if self._additional_params.contains_key(field) {
13939 dlg.finished(false);
13940 return Err(common::Error::FieldClash(field));
13941 }
13942 }
13943
13944 let mut params = Params::with_capacity(2 + self._additional_params.len());
13945 params.push("path", self._path);
13946
13947 params.extend(self._additional_params.iter());
13948
13949 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
13950 if self._scopes.is_empty() {
13951 self._scopes
13952 .insert(Scope::EditContainer.as_ref().to_string());
13953 }
13954
13955 #[allow(clippy::single_element_loop)]
13956 for &(find_this, param_name) in [("{+path}", "path")].iter() {
13957 url = params.uri_replacement(url, param_name, find_this, true);
13958 }
13959 {
13960 let to_remove = ["path"];
13961 params.remove_params(&to_remove);
13962 }
13963
13964 let url = params.parse_with_url(&url);
13965
13966 loop {
13967 let token = match self
13968 .hub
13969 .auth
13970 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13971 .await
13972 {
13973 Ok(token) => token,
13974 Err(e) => match dlg.token(e) {
13975 Ok(token) => token,
13976 Err(e) => {
13977 dlg.finished(false);
13978 return Err(common::Error::MissingToken(e));
13979 }
13980 },
13981 };
13982 let mut req_result = {
13983 let client = &self.hub.client;
13984 dlg.pre_request();
13985 let mut req_builder = hyper::Request::builder()
13986 .method(hyper::Method::DELETE)
13987 .uri(url.as_str())
13988 .header(USER_AGENT, self.hub._user_agent.clone());
13989
13990 if let Some(token) = token.as_ref() {
13991 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13992 }
13993
13994 let request = req_builder
13995 .header(CONTENT_LENGTH, 0_u64)
13996 .body(common::to_body::<String>(None));
13997
13998 client.request(request.unwrap()).await
13999 };
14000
14001 match req_result {
14002 Err(err) => {
14003 if let common::Retry::After(d) = dlg.http_error(&err) {
14004 sleep(d).await;
14005 continue;
14006 }
14007 dlg.finished(false);
14008 return Err(common::Error::HttpError(err));
14009 }
14010 Ok(res) => {
14011 let (mut parts, body) = res.into_parts();
14012 let mut body = common::Body::new(body);
14013 if !parts.status.is_success() {
14014 let bytes = common::to_bytes(body).await.unwrap_or_default();
14015 let error = serde_json::from_str(&common::to_string(&bytes));
14016 let response = common::to_response(parts, bytes.into());
14017
14018 if let common::Retry::After(d) =
14019 dlg.http_failure(&response, error.as_ref().ok())
14020 {
14021 sleep(d).await;
14022 continue;
14023 }
14024
14025 dlg.finished(false);
14026
14027 return Err(match error {
14028 Ok(value) => common::Error::BadRequest(value),
14029 _ => common::Error::Failure(response),
14030 });
14031 }
14032 let response = common::Response::from_parts(parts, body);
14033
14034 dlg.finished(true);
14035 return Ok(response);
14036 }
14037 }
14038 }
14039 }
14040
14041 /// GTM Folder's API relative path.
14042 ///
14043 /// Sets the *path* path property to the given value.
14044 ///
14045 /// Even though the property as already been set when instantiating this call,
14046 /// we provide this method for API completeness.
14047 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
14048 self._path = new_value.to_string();
14049 self
14050 }
14051 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14052 /// while executing the actual API request.
14053 ///
14054 /// ````text
14055 /// It should be used to handle progress information, and to implement a certain level of resilience.
14056 /// ````
14057 ///
14058 /// Sets the *delegate* property to the given value.
14059 pub fn delegate(
14060 mut self,
14061 new_value: &'a mut dyn common::Delegate,
14062 ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
14063 self._delegate = Some(new_value);
14064 self
14065 }
14066
14067 /// Set any additional parameter of the query string used in the request.
14068 /// It should be used to set parameters which are not yet available through their own
14069 /// setters.
14070 ///
14071 /// Please note that this method must not be used to set any of the known parameters
14072 /// which have their own setter method. If done anyway, the request will fail.
14073 ///
14074 /// # Additional Parameters
14075 ///
14076 /// * *$.xgafv* (query-string) - V1 error format.
14077 /// * *access_token* (query-string) - OAuth access token.
14078 /// * *alt* (query-string) - Data format for response.
14079 /// * *callback* (query-string) - JSONP
14080 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14081 /// * *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.
14082 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14083 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14084 /// * *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.
14085 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14086 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14087 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
14088 where
14089 T: AsRef<str>,
14090 {
14091 self._additional_params
14092 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14093 self
14094 }
14095
14096 /// Identifies the authorization scope for the method you are building.
14097 ///
14098 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14099 /// [`Scope::EditContainer`].
14100 ///
14101 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14102 /// tokens for more than one scope.
14103 ///
14104 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14105 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14106 /// sufficient, a read-write scope will do as well.
14107 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
14108 where
14109 St: AsRef<str>,
14110 {
14111 self._scopes.insert(String::from(scope.as_ref()));
14112 self
14113 }
14114 /// Identifies the authorization scope(s) for the method you are building.
14115 ///
14116 /// See [`Self::add_scope()`] for details.
14117 pub fn add_scopes<I, St>(
14118 mut self,
14119 scopes: I,
14120 ) -> AccountContainerWorkspaceFolderDeleteCall<'a, C>
14121 where
14122 I: IntoIterator<Item = St>,
14123 St: AsRef<str>,
14124 {
14125 self._scopes
14126 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14127 self
14128 }
14129
14130 /// Removes all scopes, and no default scope will be used either.
14131 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14132 /// for details).
14133 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderDeleteCall<'a, C> {
14134 self._scopes.clear();
14135 self
14136 }
14137}
14138
14139/// List all entities in a GTM Folder.
14140///
14141/// A builder for the *containers.workspaces.folders.entities* method supported by a *account* resource.
14142/// It is not used directly, but through a [`AccountMethods`] instance.
14143///
14144/// # Example
14145///
14146/// Instantiate a resource method builder
14147///
14148/// ```test_harness,no_run
14149/// # extern crate hyper;
14150/// # extern crate hyper_rustls;
14151/// # extern crate google_tagmanager2 as tagmanager2;
14152/// # async fn dox() {
14153/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14154///
14155/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14156/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14157/// # .with_native_roots()
14158/// # .unwrap()
14159/// # .https_only()
14160/// # .enable_http2()
14161/// # .build();
14162///
14163/// # let executor = hyper_util::rt::TokioExecutor::new();
14164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14165/// # secret,
14166/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14167/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14168/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14169/// # ),
14170/// # ).build().await.unwrap();
14171///
14172/// # let client = hyper_util::client::legacy::Client::builder(
14173/// # hyper_util::rt::TokioExecutor::new()
14174/// # )
14175/// # .build(
14176/// # hyper_rustls::HttpsConnectorBuilder::new()
14177/// # .with_native_roots()
14178/// # .unwrap()
14179/// # .https_or_http()
14180/// # .enable_http2()
14181/// # .build()
14182/// # );
14183/// # let mut hub = TagManager::new(client, auth);
14184/// // You can configure optional parameters by calling the respective setters at will, and
14185/// // execute the final call using `doit()`.
14186/// // Values shown here are possibly random and not representative !
14187/// let result = hub.accounts().containers_workspaces_folders_entities("path")
14188/// .page_token("voluptua.")
14189/// .doit().await;
14190/// # }
14191/// ```
14192pub struct AccountContainerWorkspaceFolderEntityCall<'a, C>
14193where
14194 C: 'a,
14195{
14196 hub: &'a TagManager<C>,
14197 _path: String,
14198 _page_token: Option<String>,
14199 _delegate: Option<&'a mut dyn common::Delegate>,
14200 _additional_params: HashMap<String, String>,
14201 _scopes: BTreeSet<String>,
14202}
14203
14204impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderEntityCall<'a, C> {}
14205
14206impl<'a, C> AccountContainerWorkspaceFolderEntityCall<'a, C>
14207where
14208 C: common::Connector,
14209{
14210 /// Perform the operation you have build so far.
14211 pub async fn doit(mut self) -> common::Result<(common::Response, FolderEntities)> {
14212 use std::borrow::Cow;
14213 use std::io::{Read, Seek};
14214
14215 use common::{url::Params, ToParts};
14216 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14217
14218 let mut dd = common::DefaultDelegate;
14219 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14220 dlg.begin(common::MethodInfo {
14221 id: "tagmanager.accounts.containers.workspaces.folders.entities",
14222 http_method: hyper::Method::POST,
14223 });
14224
14225 for &field in ["alt", "path", "pageToken"].iter() {
14226 if self._additional_params.contains_key(field) {
14227 dlg.finished(false);
14228 return Err(common::Error::FieldClash(field));
14229 }
14230 }
14231
14232 let mut params = Params::with_capacity(4 + self._additional_params.len());
14233 params.push("path", self._path);
14234 if let Some(value) = self._page_token.as_ref() {
14235 params.push("pageToken", value);
14236 }
14237
14238 params.extend(self._additional_params.iter());
14239
14240 params.push("alt", "json");
14241 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:entities";
14242 if self._scopes.is_empty() {
14243 self._scopes.insert(Scope::Readonly.as_ref().to_string());
14244 }
14245
14246 #[allow(clippy::single_element_loop)]
14247 for &(find_this, param_name) in [("{+path}", "path")].iter() {
14248 url = params.uri_replacement(url, param_name, find_this, true);
14249 }
14250 {
14251 let to_remove = ["path"];
14252 params.remove_params(&to_remove);
14253 }
14254
14255 let url = params.parse_with_url(&url);
14256
14257 loop {
14258 let token = match self
14259 .hub
14260 .auth
14261 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14262 .await
14263 {
14264 Ok(token) => token,
14265 Err(e) => match dlg.token(e) {
14266 Ok(token) => token,
14267 Err(e) => {
14268 dlg.finished(false);
14269 return Err(common::Error::MissingToken(e));
14270 }
14271 },
14272 };
14273 let mut req_result = {
14274 let client = &self.hub.client;
14275 dlg.pre_request();
14276 let mut req_builder = hyper::Request::builder()
14277 .method(hyper::Method::POST)
14278 .uri(url.as_str())
14279 .header(USER_AGENT, self.hub._user_agent.clone());
14280
14281 if let Some(token) = token.as_ref() {
14282 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14283 }
14284
14285 let request = req_builder
14286 .header(CONTENT_LENGTH, 0_u64)
14287 .body(common::to_body::<String>(None));
14288
14289 client.request(request.unwrap()).await
14290 };
14291
14292 match req_result {
14293 Err(err) => {
14294 if let common::Retry::After(d) = dlg.http_error(&err) {
14295 sleep(d).await;
14296 continue;
14297 }
14298 dlg.finished(false);
14299 return Err(common::Error::HttpError(err));
14300 }
14301 Ok(res) => {
14302 let (mut parts, body) = res.into_parts();
14303 let mut body = common::Body::new(body);
14304 if !parts.status.is_success() {
14305 let bytes = common::to_bytes(body).await.unwrap_or_default();
14306 let error = serde_json::from_str(&common::to_string(&bytes));
14307 let response = common::to_response(parts, bytes.into());
14308
14309 if let common::Retry::After(d) =
14310 dlg.http_failure(&response, error.as_ref().ok())
14311 {
14312 sleep(d).await;
14313 continue;
14314 }
14315
14316 dlg.finished(false);
14317
14318 return Err(match error {
14319 Ok(value) => common::Error::BadRequest(value),
14320 _ => common::Error::Failure(response),
14321 });
14322 }
14323 let response = {
14324 let bytes = common::to_bytes(body).await.unwrap_or_default();
14325 let encoded = common::to_string(&bytes);
14326 match serde_json::from_str(&encoded) {
14327 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14328 Err(error) => {
14329 dlg.response_json_decode_error(&encoded, &error);
14330 return Err(common::Error::JsonDecodeError(
14331 encoded.to_string(),
14332 error,
14333 ));
14334 }
14335 }
14336 };
14337
14338 dlg.finished(true);
14339 return Ok(response);
14340 }
14341 }
14342 }
14343 }
14344
14345 /// GTM Folder's API relative path.
14346 ///
14347 /// Sets the *path* path property to the given value.
14348 ///
14349 /// Even though the property as already been set when instantiating this call,
14350 /// we provide this method for API completeness.
14351 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
14352 self._path = new_value.to_string();
14353 self
14354 }
14355 /// Continuation token for fetching the next page of results.
14356 ///
14357 /// Sets the *page token* query property to the given value.
14358 pub fn page_token(
14359 mut self,
14360 new_value: &str,
14361 ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
14362 self._page_token = Some(new_value.to_string());
14363 self
14364 }
14365 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14366 /// while executing the actual API request.
14367 ///
14368 /// ````text
14369 /// It should be used to handle progress information, and to implement a certain level of resilience.
14370 /// ````
14371 ///
14372 /// Sets the *delegate* property to the given value.
14373 pub fn delegate(
14374 mut self,
14375 new_value: &'a mut dyn common::Delegate,
14376 ) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
14377 self._delegate = Some(new_value);
14378 self
14379 }
14380
14381 /// Set any additional parameter of the query string used in the request.
14382 /// It should be used to set parameters which are not yet available through their own
14383 /// setters.
14384 ///
14385 /// Please note that this method must not be used to set any of the known parameters
14386 /// which have their own setter method. If done anyway, the request will fail.
14387 ///
14388 /// # Additional Parameters
14389 ///
14390 /// * *$.xgafv* (query-string) - V1 error format.
14391 /// * *access_token* (query-string) - OAuth access token.
14392 /// * *alt* (query-string) - Data format for response.
14393 /// * *callback* (query-string) - JSONP
14394 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14395 /// * *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.
14396 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14397 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14398 /// * *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.
14399 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14400 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14401 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
14402 where
14403 T: AsRef<str>,
14404 {
14405 self._additional_params
14406 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14407 self
14408 }
14409
14410 /// Identifies the authorization scope for the method you are building.
14411 ///
14412 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14413 /// [`Scope::Readonly`].
14414 ///
14415 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14416 /// tokens for more than one scope.
14417 ///
14418 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14419 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14420 /// sufficient, a read-write scope will do as well.
14421 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
14422 where
14423 St: AsRef<str>,
14424 {
14425 self._scopes.insert(String::from(scope.as_ref()));
14426 self
14427 }
14428 /// Identifies the authorization scope(s) for the method you are building.
14429 ///
14430 /// See [`Self::add_scope()`] for details.
14431 pub fn add_scopes<I, St>(
14432 mut self,
14433 scopes: I,
14434 ) -> AccountContainerWorkspaceFolderEntityCall<'a, C>
14435 where
14436 I: IntoIterator<Item = St>,
14437 St: AsRef<str>,
14438 {
14439 self._scopes
14440 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14441 self
14442 }
14443
14444 /// Removes all scopes, and no default scope will be used either.
14445 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14446 /// for details).
14447 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderEntityCall<'a, C> {
14448 self._scopes.clear();
14449 self
14450 }
14451}
14452
14453/// Gets a GTM Folder.
14454///
14455/// A builder for the *containers.workspaces.folders.get* method supported by a *account* resource.
14456/// It is not used directly, but through a [`AccountMethods`] instance.
14457///
14458/// # Example
14459///
14460/// Instantiate a resource method builder
14461///
14462/// ```test_harness,no_run
14463/// # extern crate hyper;
14464/// # extern crate hyper_rustls;
14465/// # extern crate google_tagmanager2 as tagmanager2;
14466/// # async fn dox() {
14467/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14468///
14469/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14470/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14471/// # .with_native_roots()
14472/// # .unwrap()
14473/// # .https_only()
14474/// # .enable_http2()
14475/// # .build();
14476///
14477/// # let executor = hyper_util::rt::TokioExecutor::new();
14478/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14479/// # secret,
14480/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14481/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14482/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14483/// # ),
14484/// # ).build().await.unwrap();
14485///
14486/// # let client = hyper_util::client::legacy::Client::builder(
14487/// # hyper_util::rt::TokioExecutor::new()
14488/// # )
14489/// # .build(
14490/// # hyper_rustls::HttpsConnectorBuilder::new()
14491/// # .with_native_roots()
14492/// # .unwrap()
14493/// # .https_or_http()
14494/// # .enable_http2()
14495/// # .build()
14496/// # );
14497/// # let mut hub = TagManager::new(client, auth);
14498/// // You can configure optional parameters by calling the respective setters at will, and
14499/// // execute the final call using `doit()`.
14500/// // Values shown here are possibly random and not representative !
14501/// let result = hub.accounts().containers_workspaces_folders_get("path")
14502/// .doit().await;
14503/// # }
14504/// ```
14505pub struct AccountContainerWorkspaceFolderGetCall<'a, C>
14506where
14507 C: 'a,
14508{
14509 hub: &'a TagManager<C>,
14510 _path: String,
14511 _delegate: Option<&'a mut dyn common::Delegate>,
14512 _additional_params: HashMap<String, String>,
14513 _scopes: BTreeSet<String>,
14514}
14515
14516impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderGetCall<'a, C> {}
14517
14518impl<'a, C> AccountContainerWorkspaceFolderGetCall<'a, C>
14519where
14520 C: common::Connector,
14521{
14522 /// Perform the operation you have build so far.
14523 pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
14524 use std::borrow::Cow;
14525 use std::io::{Read, Seek};
14526
14527 use common::{url::Params, ToParts};
14528 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14529
14530 let mut dd = common::DefaultDelegate;
14531 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14532 dlg.begin(common::MethodInfo {
14533 id: "tagmanager.accounts.containers.workspaces.folders.get",
14534 http_method: hyper::Method::GET,
14535 });
14536
14537 for &field in ["alt", "path"].iter() {
14538 if self._additional_params.contains_key(field) {
14539 dlg.finished(false);
14540 return Err(common::Error::FieldClash(field));
14541 }
14542 }
14543
14544 let mut params = Params::with_capacity(3 + self._additional_params.len());
14545 params.push("path", self._path);
14546
14547 params.extend(self._additional_params.iter());
14548
14549 params.push("alt", "json");
14550 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
14551 if self._scopes.is_empty() {
14552 self._scopes.insert(Scope::Readonly.as_ref().to_string());
14553 }
14554
14555 #[allow(clippy::single_element_loop)]
14556 for &(find_this, param_name) in [("{+path}", "path")].iter() {
14557 url = params.uri_replacement(url, param_name, find_this, true);
14558 }
14559 {
14560 let to_remove = ["path"];
14561 params.remove_params(&to_remove);
14562 }
14563
14564 let url = params.parse_with_url(&url);
14565
14566 loop {
14567 let token = match self
14568 .hub
14569 .auth
14570 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14571 .await
14572 {
14573 Ok(token) => token,
14574 Err(e) => match dlg.token(e) {
14575 Ok(token) => token,
14576 Err(e) => {
14577 dlg.finished(false);
14578 return Err(common::Error::MissingToken(e));
14579 }
14580 },
14581 };
14582 let mut req_result = {
14583 let client = &self.hub.client;
14584 dlg.pre_request();
14585 let mut req_builder = hyper::Request::builder()
14586 .method(hyper::Method::GET)
14587 .uri(url.as_str())
14588 .header(USER_AGENT, self.hub._user_agent.clone());
14589
14590 if let Some(token) = token.as_ref() {
14591 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14592 }
14593
14594 let request = req_builder
14595 .header(CONTENT_LENGTH, 0_u64)
14596 .body(common::to_body::<String>(None));
14597
14598 client.request(request.unwrap()).await
14599 };
14600
14601 match req_result {
14602 Err(err) => {
14603 if let common::Retry::After(d) = dlg.http_error(&err) {
14604 sleep(d).await;
14605 continue;
14606 }
14607 dlg.finished(false);
14608 return Err(common::Error::HttpError(err));
14609 }
14610 Ok(res) => {
14611 let (mut parts, body) = res.into_parts();
14612 let mut body = common::Body::new(body);
14613 if !parts.status.is_success() {
14614 let bytes = common::to_bytes(body).await.unwrap_or_default();
14615 let error = serde_json::from_str(&common::to_string(&bytes));
14616 let response = common::to_response(parts, bytes.into());
14617
14618 if let common::Retry::After(d) =
14619 dlg.http_failure(&response, error.as_ref().ok())
14620 {
14621 sleep(d).await;
14622 continue;
14623 }
14624
14625 dlg.finished(false);
14626
14627 return Err(match error {
14628 Ok(value) => common::Error::BadRequest(value),
14629 _ => common::Error::Failure(response),
14630 });
14631 }
14632 let response = {
14633 let bytes = common::to_bytes(body).await.unwrap_or_default();
14634 let encoded = common::to_string(&bytes);
14635 match serde_json::from_str(&encoded) {
14636 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14637 Err(error) => {
14638 dlg.response_json_decode_error(&encoded, &error);
14639 return Err(common::Error::JsonDecodeError(
14640 encoded.to_string(),
14641 error,
14642 ));
14643 }
14644 }
14645 };
14646
14647 dlg.finished(true);
14648 return Ok(response);
14649 }
14650 }
14651 }
14652 }
14653
14654 /// GTM Folder's API relative path.
14655 ///
14656 /// Sets the *path* path property to the given value.
14657 ///
14658 /// Even though the property as already been set when instantiating this call,
14659 /// we provide this method for API completeness.
14660 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14661 self._path = new_value.to_string();
14662 self
14663 }
14664 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14665 /// while executing the actual API request.
14666 ///
14667 /// ````text
14668 /// It should be used to handle progress information, and to implement a certain level of resilience.
14669 /// ````
14670 ///
14671 /// Sets the *delegate* property to the given value.
14672 pub fn delegate(
14673 mut self,
14674 new_value: &'a mut dyn common::Delegate,
14675 ) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14676 self._delegate = Some(new_value);
14677 self
14678 }
14679
14680 /// Set any additional parameter of the query string used in the request.
14681 /// It should be used to set parameters which are not yet available through their own
14682 /// setters.
14683 ///
14684 /// Please note that this method must not be used to set any of the known parameters
14685 /// which have their own setter method. If done anyway, the request will fail.
14686 ///
14687 /// # Additional Parameters
14688 ///
14689 /// * *$.xgafv* (query-string) - V1 error format.
14690 /// * *access_token* (query-string) - OAuth access token.
14691 /// * *alt* (query-string) - Data format for response.
14692 /// * *callback* (query-string) - JSONP
14693 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14694 /// * *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.
14695 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14696 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14697 /// * *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.
14698 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14699 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14700 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14701 where
14702 T: AsRef<str>,
14703 {
14704 self._additional_params
14705 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14706 self
14707 }
14708
14709 /// Identifies the authorization scope for the method you are building.
14710 ///
14711 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14712 /// [`Scope::Readonly`].
14713 ///
14714 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14715 /// tokens for more than one scope.
14716 ///
14717 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14718 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14719 /// sufficient, a read-write scope will do as well.
14720 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14721 where
14722 St: AsRef<str>,
14723 {
14724 self._scopes.insert(String::from(scope.as_ref()));
14725 self
14726 }
14727 /// Identifies the authorization scope(s) for the method you are building.
14728 ///
14729 /// See [`Self::add_scope()`] for details.
14730 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceFolderGetCall<'a, C>
14731 where
14732 I: IntoIterator<Item = St>,
14733 St: AsRef<str>,
14734 {
14735 self._scopes
14736 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14737 self
14738 }
14739
14740 /// Removes all scopes, and no default scope will be used either.
14741 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14742 /// for details).
14743 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderGetCall<'a, C> {
14744 self._scopes.clear();
14745 self
14746 }
14747}
14748
14749/// Lists all GTM Folders of a Container.
14750///
14751/// A builder for the *containers.workspaces.folders.list* method supported by a *account* resource.
14752/// It is not used directly, but through a [`AccountMethods`] instance.
14753///
14754/// # Example
14755///
14756/// Instantiate a resource method builder
14757///
14758/// ```test_harness,no_run
14759/// # extern crate hyper;
14760/// # extern crate hyper_rustls;
14761/// # extern crate google_tagmanager2 as tagmanager2;
14762/// # async fn dox() {
14763/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14764///
14765/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14766/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14767/// # .with_native_roots()
14768/// # .unwrap()
14769/// # .https_only()
14770/// # .enable_http2()
14771/// # .build();
14772///
14773/// # let executor = hyper_util::rt::TokioExecutor::new();
14774/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14775/// # secret,
14776/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14777/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14778/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14779/// # ),
14780/// # ).build().await.unwrap();
14781///
14782/// # let client = hyper_util::client::legacy::Client::builder(
14783/// # hyper_util::rt::TokioExecutor::new()
14784/// # )
14785/// # .build(
14786/// # hyper_rustls::HttpsConnectorBuilder::new()
14787/// # .with_native_roots()
14788/// # .unwrap()
14789/// # .https_or_http()
14790/// # .enable_http2()
14791/// # .build()
14792/// # );
14793/// # let mut hub = TagManager::new(client, auth);
14794/// // You can configure optional parameters by calling the respective setters at will, and
14795/// // execute the final call using `doit()`.
14796/// // Values shown here are possibly random and not representative !
14797/// let result = hub.accounts().containers_workspaces_folders_list("parent")
14798/// .page_token("consetetur")
14799/// .doit().await;
14800/// # }
14801/// ```
14802pub struct AccountContainerWorkspaceFolderListCall<'a, C>
14803where
14804 C: 'a,
14805{
14806 hub: &'a TagManager<C>,
14807 _parent: String,
14808 _page_token: Option<String>,
14809 _delegate: Option<&'a mut dyn common::Delegate>,
14810 _additional_params: HashMap<String, String>,
14811 _scopes: BTreeSet<String>,
14812}
14813
14814impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderListCall<'a, C> {}
14815
14816impl<'a, C> AccountContainerWorkspaceFolderListCall<'a, C>
14817where
14818 C: common::Connector,
14819{
14820 /// Perform the operation you have build so far.
14821 pub async fn doit(mut self) -> common::Result<(common::Response, ListFoldersResponse)> {
14822 use std::borrow::Cow;
14823 use std::io::{Read, Seek};
14824
14825 use common::{url::Params, ToParts};
14826 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14827
14828 let mut dd = common::DefaultDelegate;
14829 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14830 dlg.begin(common::MethodInfo {
14831 id: "tagmanager.accounts.containers.workspaces.folders.list",
14832 http_method: hyper::Method::GET,
14833 });
14834
14835 for &field in ["alt", "parent", "pageToken"].iter() {
14836 if self._additional_params.contains_key(field) {
14837 dlg.finished(false);
14838 return Err(common::Error::FieldClash(field));
14839 }
14840 }
14841
14842 let mut params = Params::with_capacity(4 + self._additional_params.len());
14843 params.push("parent", self._parent);
14844 if let Some(value) = self._page_token.as_ref() {
14845 params.push("pageToken", value);
14846 }
14847
14848 params.extend(self._additional_params.iter());
14849
14850 params.push("alt", "json");
14851 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/folders";
14852 if self._scopes.is_empty() {
14853 self._scopes.insert(Scope::Readonly.as_ref().to_string());
14854 }
14855
14856 #[allow(clippy::single_element_loop)]
14857 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14858 url = params.uri_replacement(url, param_name, find_this, true);
14859 }
14860 {
14861 let to_remove = ["parent"];
14862 params.remove_params(&to_remove);
14863 }
14864
14865 let url = params.parse_with_url(&url);
14866
14867 loop {
14868 let token = match self
14869 .hub
14870 .auth
14871 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14872 .await
14873 {
14874 Ok(token) => token,
14875 Err(e) => match dlg.token(e) {
14876 Ok(token) => token,
14877 Err(e) => {
14878 dlg.finished(false);
14879 return Err(common::Error::MissingToken(e));
14880 }
14881 },
14882 };
14883 let mut req_result = {
14884 let client = &self.hub.client;
14885 dlg.pre_request();
14886 let mut req_builder = hyper::Request::builder()
14887 .method(hyper::Method::GET)
14888 .uri(url.as_str())
14889 .header(USER_AGENT, self.hub._user_agent.clone());
14890
14891 if let Some(token) = token.as_ref() {
14892 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14893 }
14894
14895 let request = req_builder
14896 .header(CONTENT_LENGTH, 0_u64)
14897 .body(common::to_body::<String>(None));
14898
14899 client.request(request.unwrap()).await
14900 };
14901
14902 match req_result {
14903 Err(err) => {
14904 if let common::Retry::After(d) = dlg.http_error(&err) {
14905 sleep(d).await;
14906 continue;
14907 }
14908 dlg.finished(false);
14909 return Err(common::Error::HttpError(err));
14910 }
14911 Ok(res) => {
14912 let (mut parts, body) = res.into_parts();
14913 let mut body = common::Body::new(body);
14914 if !parts.status.is_success() {
14915 let bytes = common::to_bytes(body).await.unwrap_or_default();
14916 let error = serde_json::from_str(&common::to_string(&bytes));
14917 let response = common::to_response(parts, bytes.into());
14918
14919 if let common::Retry::After(d) =
14920 dlg.http_failure(&response, error.as_ref().ok())
14921 {
14922 sleep(d).await;
14923 continue;
14924 }
14925
14926 dlg.finished(false);
14927
14928 return Err(match error {
14929 Ok(value) => common::Error::BadRequest(value),
14930 _ => common::Error::Failure(response),
14931 });
14932 }
14933 let response = {
14934 let bytes = common::to_bytes(body).await.unwrap_or_default();
14935 let encoded = common::to_string(&bytes);
14936 match serde_json::from_str(&encoded) {
14937 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14938 Err(error) => {
14939 dlg.response_json_decode_error(&encoded, &error);
14940 return Err(common::Error::JsonDecodeError(
14941 encoded.to_string(),
14942 error,
14943 ));
14944 }
14945 }
14946 };
14947
14948 dlg.finished(true);
14949 return Ok(response);
14950 }
14951 }
14952 }
14953 }
14954
14955 /// GTM Workspace's API relative path.
14956 ///
14957 /// Sets the *parent* path property to the given value.
14958 ///
14959 /// Even though the property as already been set when instantiating this call,
14960 /// we provide this method for API completeness.
14961 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14962 self._parent = new_value.to_string();
14963 self
14964 }
14965 /// Continuation token for fetching the next page of results.
14966 ///
14967 /// Sets the *page token* query property to the given value.
14968 pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14969 self._page_token = Some(new_value.to_string());
14970 self
14971 }
14972 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14973 /// while executing the actual API request.
14974 ///
14975 /// ````text
14976 /// It should be used to handle progress information, and to implement a certain level of resilience.
14977 /// ````
14978 ///
14979 /// Sets the *delegate* property to the given value.
14980 pub fn delegate(
14981 mut self,
14982 new_value: &'a mut dyn common::Delegate,
14983 ) -> AccountContainerWorkspaceFolderListCall<'a, C> {
14984 self._delegate = Some(new_value);
14985 self
14986 }
14987
14988 /// Set any additional parameter of the query string used in the request.
14989 /// It should be used to set parameters which are not yet available through their own
14990 /// setters.
14991 ///
14992 /// Please note that this method must not be used to set any of the known parameters
14993 /// which have their own setter method. If done anyway, the request will fail.
14994 ///
14995 /// # Additional Parameters
14996 ///
14997 /// * *$.xgafv* (query-string) - V1 error format.
14998 /// * *access_token* (query-string) - OAuth access token.
14999 /// * *alt* (query-string) - Data format for response.
15000 /// * *callback* (query-string) - JSONP
15001 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15002 /// * *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.
15003 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15004 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15005 /// * *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.
15006 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15007 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15008 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderListCall<'a, C>
15009 where
15010 T: AsRef<str>,
15011 {
15012 self._additional_params
15013 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15014 self
15015 }
15016
15017 /// Identifies the authorization scope for the method you are building.
15018 ///
15019 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15020 /// [`Scope::Readonly`].
15021 ///
15022 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15023 /// tokens for more than one scope.
15024 ///
15025 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15026 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15027 /// sufficient, a read-write scope will do as well.
15028 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderListCall<'a, C>
15029 where
15030 St: AsRef<str>,
15031 {
15032 self._scopes.insert(String::from(scope.as_ref()));
15033 self
15034 }
15035 /// Identifies the authorization scope(s) for the method you are building.
15036 ///
15037 /// See [`Self::add_scope()`] for details.
15038 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceFolderListCall<'a, C>
15039 where
15040 I: IntoIterator<Item = St>,
15041 St: AsRef<str>,
15042 {
15043 self._scopes
15044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15045 self
15046 }
15047
15048 /// Removes all scopes, and no default scope will be used either.
15049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15050 /// for details).
15051 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderListCall<'a, C> {
15052 self._scopes.clear();
15053 self
15054 }
15055}
15056
15057/// 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.
15058///
15059/// A builder for the *containers.workspaces.folders.move_entities_to_folder* method supported by a *account* resource.
15060/// It is not used directly, but through a [`AccountMethods`] instance.
15061///
15062/// # Example
15063///
15064/// Instantiate a resource method builder
15065///
15066/// ```test_harness,no_run
15067/// # extern crate hyper;
15068/// # extern crate hyper_rustls;
15069/// # extern crate google_tagmanager2 as tagmanager2;
15070/// use tagmanager2::api::Folder;
15071/// # async fn dox() {
15072/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15073///
15074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15075/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15076/// # .with_native_roots()
15077/// # .unwrap()
15078/// # .https_only()
15079/// # .enable_http2()
15080/// # .build();
15081///
15082/// # let executor = hyper_util::rt::TokioExecutor::new();
15083/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15084/// # secret,
15085/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15086/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15087/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15088/// # ),
15089/// # ).build().await.unwrap();
15090///
15091/// # let client = hyper_util::client::legacy::Client::builder(
15092/// # hyper_util::rt::TokioExecutor::new()
15093/// # )
15094/// # .build(
15095/// # hyper_rustls::HttpsConnectorBuilder::new()
15096/// # .with_native_roots()
15097/// # .unwrap()
15098/// # .https_or_http()
15099/// # .enable_http2()
15100/// # .build()
15101/// # );
15102/// # let mut hub = TagManager::new(client, auth);
15103/// // As the method needs a request, you would usually fill it with the desired information
15104/// // into the respective structure. Some of the parts shown here might not be applicable !
15105/// // Values shown here are possibly random and not representative !
15106/// let mut req = Folder::default();
15107///
15108/// // You can configure optional parameters by calling the respective setters at will, and
15109/// // execute the final call using `doit()`.
15110/// // Values shown here are possibly random and not representative !
15111/// let result = hub.accounts().containers_workspaces_folders_move_entities_to_folder(req, "path")
15112/// .add_variable_id("sed")
15113/// .add_trigger_id("takimata")
15114/// .add_tag_id("dolores")
15115/// .doit().await;
15116/// # }
15117/// ```
15118pub struct AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
15119where
15120 C: 'a,
15121{
15122 hub: &'a TagManager<C>,
15123 _request: Folder,
15124 _path: String,
15125 _variable_id: Vec<String>,
15126 _trigger_id: Vec<String>,
15127 _tag_id: Vec<String>,
15128 _delegate: Option<&'a mut dyn common::Delegate>,
15129 _additional_params: HashMap<String, String>,
15130 _scopes: BTreeSet<String>,
15131}
15132
15133impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {}
15134
15135impl<'a, C> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
15136where
15137 C: common::Connector,
15138{
15139 /// Perform the operation you have build so far.
15140 pub async fn doit(mut self) -> common::Result<common::Response> {
15141 use std::borrow::Cow;
15142 use std::io::{Read, Seek};
15143
15144 use common::{url::Params, ToParts};
15145 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15146
15147 let mut dd = common::DefaultDelegate;
15148 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15149 dlg.begin(common::MethodInfo {
15150 id: "tagmanager.accounts.containers.workspaces.folders.move_entities_to_folder",
15151 http_method: hyper::Method::POST,
15152 });
15153
15154 for &field in ["path", "variableId", "triggerId", "tagId"].iter() {
15155 if self._additional_params.contains_key(field) {
15156 dlg.finished(false);
15157 return Err(common::Error::FieldClash(field));
15158 }
15159 }
15160
15161 let mut params = Params::with_capacity(6 + self._additional_params.len());
15162 params.push("path", self._path);
15163 if !self._variable_id.is_empty() {
15164 for f in self._variable_id.iter() {
15165 params.push("variableId", f);
15166 }
15167 }
15168 if !self._trigger_id.is_empty() {
15169 for f in self._trigger_id.iter() {
15170 params.push("triggerId", f);
15171 }
15172 }
15173 if !self._tag_id.is_empty() {
15174 for f in self._tag_id.iter() {
15175 params.push("tagId", f);
15176 }
15177 }
15178
15179 params.extend(self._additional_params.iter());
15180
15181 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:move_entities_to_folder";
15182 if self._scopes.is_empty() {
15183 self._scopes
15184 .insert(Scope::EditContainer.as_ref().to_string());
15185 }
15186
15187 #[allow(clippy::single_element_loop)]
15188 for &(find_this, param_name) in [("{+path}", "path")].iter() {
15189 url = params.uri_replacement(url, param_name, find_this, true);
15190 }
15191 {
15192 let to_remove = ["path"];
15193 params.remove_params(&to_remove);
15194 }
15195
15196 let url = params.parse_with_url(&url);
15197
15198 let mut json_mime_type = mime::APPLICATION_JSON;
15199 let mut request_value_reader = {
15200 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15201 common::remove_json_null_values(&mut value);
15202 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15203 serde_json::to_writer(&mut dst, &value).unwrap();
15204 dst
15205 };
15206 let request_size = request_value_reader
15207 .seek(std::io::SeekFrom::End(0))
15208 .unwrap();
15209 request_value_reader
15210 .seek(std::io::SeekFrom::Start(0))
15211 .unwrap();
15212
15213 loop {
15214 let token = match self
15215 .hub
15216 .auth
15217 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15218 .await
15219 {
15220 Ok(token) => token,
15221 Err(e) => match dlg.token(e) {
15222 Ok(token) => token,
15223 Err(e) => {
15224 dlg.finished(false);
15225 return Err(common::Error::MissingToken(e));
15226 }
15227 },
15228 };
15229 request_value_reader
15230 .seek(std::io::SeekFrom::Start(0))
15231 .unwrap();
15232 let mut req_result = {
15233 let client = &self.hub.client;
15234 dlg.pre_request();
15235 let mut req_builder = hyper::Request::builder()
15236 .method(hyper::Method::POST)
15237 .uri(url.as_str())
15238 .header(USER_AGENT, self.hub._user_agent.clone());
15239
15240 if let Some(token) = token.as_ref() {
15241 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15242 }
15243
15244 let request = req_builder
15245 .header(CONTENT_TYPE, json_mime_type.to_string())
15246 .header(CONTENT_LENGTH, request_size as u64)
15247 .body(common::to_body(
15248 request_value_reader.get_ref().clone().into(),
15249 ));
15250
15251 client.request(request.unwrap()).await
15252 };
15253
15254 match req_result {
15255 Err(err) => {
15256 if let common::Retry::After(d) = dlg.http_error(&err) {
15257 sleep(d).await;
15258 continue;
15259 }
15260 dlg.finished(false);
15261 return Err(common::Error::HttpError(err));
15262 }
15263 Ok(res) => {
15264 let (mut parts, body) = res.into_parts();
15265 let mut body = common::Body::new(body);
15266 if !parts.status.is_success() {
15267 let bytes = common::to_bytes(body).await.unwrap_or_default();
15268 let error = serde_json::from_str(&common::to_string(&bytes));
15269 let response = common::to_response(parts, bytes.into());
15270
15271 if let common::Retry::After(d) =
15272 dlg.http_failure(&response, error.as_ref().ok())
15273 {
15274 sleep(d).await;
15275 continue;
15276 }
15277
15278 dlg.finished(false);
15279
15280 return Err(match error {
15281 Ok(value) => common::Error::BadRequest(value),
15282 _ => common::Error::Failure(response),
15283 });
15284 }
15285 let response = common::Response::from_parts(parts, body);
15286
15287 dlg.finished(true);
15288 return Ok(response);
15289 }
15290 }
15291 }
15292 }
15293
15294 ///
15295 /// Sets the *request* property to the given value.
15296 ///
15297 /// Even though the property as already been set when instantiating this call,
15298 /// we provide this method for API completeness.
15299 pub fn request(
15300 mut self,
15301 new_value: Folder,
15302 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15303 self._request = new_value;
15304 self
15305 }
15306 /// GTM Folder's API relative path.
15307 ///
15308 /// Sets the *path* path property to the given value.
15309 ///
15310 /// Even though the property as already been set when instantiating this call,
15311 /// we provide this method for API completeness.
15312 pub fn path(
15313 mut self,
15314 new_value: &str,
15315 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15316 self._path = new_value.to_string();
15317 self
15318 }
15319 /// The variables to be moved to the folder.
15320 ///
15321 /// Append the given value to the *variable id* query property.
15322 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
15323 pub fn add_variable_id(
15324 mut self,
15325 new_value: &str,
15326 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15327 self._variable_id.push(new_value.to_string());
15328 self
15329 }
15330 /// The triggers to be moved to the folder.
15331 ///
15332 /// Append the given value to the *trigger id* query property.
15333 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
15334 pub fn add_trigger_id(
15335 mut self,
15336 new_value: &str,
15337 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15338 self._trigger_id.push(new_value.to_string());
15339 self
15340 }
15341 /// The tags to be moved to the folder.
15342 ///
15343 /// Append the given value to the *tag id* query property.
15344 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
15345 pub fn add_tag_id(
15346 mut self,
15347 new_value: &str,
15348 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15349 self._tag_id.push(new_value.to_string());
15350 self
15351 }
15352 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15353 /// while executing the actual API request.
15354 ///
15355 /// ````text
15356 /// It should be used to handle progress information, and to implement a certain level of resilience.
15357 /// ````
15358 ///
15359 /// Sets the *delegate* property to the given value.
15360 pub fn delegate(
15361 mut self,
15362 new_value: &'a mut dyn common::Delegate,
15363 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15364 self._delegate = Some(new_value);
15365 self
15366 }
15367
15368 /// Set any additional parameter of the query string used in the request.
15369 /// It should be used to set parameters which are not yet available through their own
15370 /// setters.
15371 ///
15372 /// Please note that this method must not be used to set any of the known parameters
15373 /// which have their own setter method. If done anyway, the request will fail.
15374 ///
15375 /// # Additional Parameters
15376 ///
15377 /// * *$.xgafv* (query-string) - V1 error format.
15378 /// * *access_token* (query-string) - OAuth access token.
15379 /// * *alt* (query-string) - Data format for response.
15380 /// * *callback* (query-string) - JSONP
15381 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15382 /// * *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.
15383 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15384 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15385 /// * *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.
15386 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15387 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15388 pub fn param<T>(
15389 mut self,
15390 name: T,
15391 value: T,
15392 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
15393 where
15394 T: AsRef<str>,
15395 {
15396 self._additional_params
15397 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15398 self
15399 }
15400
15401 /// Identifies the authorization scope for the method you are building.
15402 ///
15403 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15404 /// [`Scope::EditContainer`].
15405 ///
15406 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15407 /// tokens for more than one scope.
15408 ///
15409 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15410 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15411 /// sufficient, a read-write scope will do as well.
15412 pub fn add_scope<St>(
15413 mut self,
15414 scope: St,
15415 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
15416 where
15417 St: AsRef<str>,
15418 {
15419 self._scopes.insert(String::from(scope.as_ref()));
15420 self
15421 }
15422 /// Identifies the authorization scope(s) for the method you are building.
15423 ///
15424 /// See [`Self::add_scope()`] for details.
15425 pub fn add_scopes<I, St>(
15426 mut self,
15427 scopes: I,
15428 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C>
15429 where
15430 I: IntoIterator<Item = St>,
15431 St: AsRef<str>,
15432 {
15433 self._scopes
15434 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15435 self
15436 }
15437
15438 /// Removes all scopes, and no default scope will be used either.
15439 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15440 /// for details).
15441 pub fn clear_scopes(
15442 mut self,
15443 ) -> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C> {
15444 self._scopes.clear();
15445 self
15446 }
15447}
15448
15449/// Reverts changes to a GTM Folder in a GTM Workspace.
15450///
15451/// A builder for the *containers.workspaces.folders.revert* method supported by a *account* resource.
15452/// It is not used directly, but through a [`AccountMethods`] instance.
15453///
15454/// # Example
15455///
15456/// Instantiate a resource method builder
15457///
15458/// ```test_harness,no_run
15459/// # extern crate hyper;
15460/// # extern crate hyper_rustls;
15461/// # extern crate google_tagmanager2 as tagmanager2;
15462/// # async fn dox() {
15463/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15464///
15465/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15466/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15467/// # .with_native_roots()
15468/// # .unwrap()
15469/// # .https_only()
15470/// # .enable_http2()
15471/// # .build();
15472///
15473/// # let executor = hyper_util::rt::TokioExecutor::new();
15474/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15475/// # secret,
15476/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15477/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15478/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15479/// # ),
15480/// # ).build().await.unwrap();
15481///
15482/// # let client = hyper_util::client::legacy::Client::builder(
15483/// # hyper_util::rt::TokioExecutor::new()
15484/// # )
15485/// # .build(
15486/// # hyper_rustls::HttpsConnectorBuilder::new()
15487/// # .with_native_roots()
15488/// # .unwrap()
15489/// # .https_or_http()
15490/// # .enable_http2()
15491/// # .build()
15492/// # );
15493/// # let mut hub = TagManager::new(client, auth);
15494/// // You can configure optional parameters by calling the respective setters at will, and
15495/// // execute the final call using `doit()`.
15496/// // Values shown here are possibly random and not representative !
15497/// let result = hub.accounts().containers_workspaces_folders_revert("path")
15498/// .fingerprint("et")
15499/// .doit().await;
15500/// # }
15501/// ```
15502pub struct AccountContainerWorkspaceFolderRevertCall<'a, C>
15503where
15504 C: 'a,
15505{
15506 hub: &'a TagManager<C>,
15507 _path: String,
15508 _fingerprint: Option<String>,
15509 _delegate: Option<&'a mut dyn common::Delegate>,
15510 _additional_params: HashMap<String, String>,
15511 _scopes: BTreeSet<String>,
15512}
15513
15514impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderRevertCall<'a, C> {}
15515
15516impl<'a, C> AccountContainerWorkspaceFolderRevertCall<'a, C>
15517where
15518 C: common::Connector,
15519{
15520 /// Perform the operation you have build so far.
15521 pub async fn doit(mut self) -> common::Result<(common::Response, RevertFolderResponse)> {
15522 use std::borrow::Cow;
15523 use std::io::{Read, Seek};
15524
15525 use common::{url::Params, ToParts};
15526 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15527
15528 let mut dd = common::DefaultDelegate;
15529 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15530 dlg.begin(common::MethodInfo {
15531 id: "tagmanager.accounts.containers.workspaces.folders.revert",
15532 http_method: hyper::Method::POST,
15533 });
15534
15535 for &field in ["alt", "path", "fingerprint"].iter() {
15536 if self._additional_params.contains_key(field) {
15537 dlg.finished(false);
15538 return Err(common::Error::FieldClash(field));
15539 }
15540 }
15541
15542 let mut params = Params::with_capacity(4 + self._additional_params.len());
15543 params.push("path", self._path);
15544 if let Some(value) = self._fingerprint.as_ref() {
15545 params.push("fingerprint", value);
15546 }
15547
15548 params.extend(self._additional_params.iter());
15549
15550 params.push("alt", "json");
15551 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
15552 if self._scopes.is_empty() {
15553 self._scopes
15554 .insert(Scope::EditContainer.as_ref().to_string());
15555 }
15556
15557 #[allow(clippy::single_element_loop)]
15558 for &(find_this, param_name) in [("{+path}", "path")].iter() {
15559 url = params.uri_replacement(url, param_name, find_this, true);
15560 }
15561 {
15562 let to_remove = ["path"];
15563 params.remove_params(&to_remove);
15564 }
15565
15566 let url = params.parse_with_url(&url);
15567
15568 loop {
15569 let token = match self
15570 .hub
15571 .auth
15572 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15573 .await
15574 {
15575 Ok(token) => token,
15576 Err(e) => match dlg.token(e) {
15577 Ok(token) => token,
15578 Err(e) => {
15579 dlg.finished(false);
15580 return Err(common::Error::MissingToken(e));
15581 }
15582 },
15583 };
15584 let mut req_result = {
15585 let client = &self.hub.client;
15586 dlg.pre_request();
15587 let mut req_builder = hyper::Request::builder()
15588 .method(hyper::Method::POST)
15589 .uri(url.as_str())
15590 .header(USER_AGENT, self.hub._user_agent.clone());
15591
15592 if let Some(token) = token.as_ref() {
15593 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15594 }
15595
15596 let request = req_builder
15597 .header(CONTENT_LENGTH, 0_u64)
15598 .body(common::to_body::<String>(None));
15599
15600 client.request(request.unwrap()).await
15601 };
15602
15603 match req_result {
15604 Err(err) => {
15605 if let common::Retry::After(d) = dlg.http_error(&err) {
15606 sleep(d).await;
15607 continue;
15608 }
15609 dlg.finished(false);
15610 return Err(common::Error::HttpError(err));
15611 }
15612 Ok(res) => {
15613 let (mut parts, body) = res.into_parts();
15614 let mut body = common::Body::new(body);
15615 if !parts.status.is_success() {
15616 let bytes = common::to_bytes(body).await.unwrap_or_default();
15617 let error = serde_json::from_str(&common::to_string(&bytes));
15618 let response = common::to_response(parts, bytes.into());
15619
15620 if let common::Retry::After(d) =
15621 dlg.http_failure(&response, error.as_ref().ok())
15622 {
15623 sleep(d).await;
15624 continue;
15625 }
15626
15627 dlg.finished(false);
15628
15629 return Err(match error {
15630 Ok(value) => common::Error::BadRequest(value),
15631 _ => common::Error::Failure(response),
15632 });
15633 }
15634 let response = {
15635 let bytes = common::to_bytes(body).await.unwrap_or_default();
15636 let encoded = common::to_string(&bytes);
15637 match serde_json::from_str(&encoded) {
15638 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15639 Err(error) => {
15640 dlg.response_json_decode_error(&encoded, &error);
15641 return Err(common::Error::JsonDecodeError(
15642 encoded.to_string(),
15643 error,
15644 ));
15645 }
15646 }
15647 };
15648
15649 dlg.finished(true);
15650 return Ok(response);
15651 }
15652 }
15653 }
15654 }
15655
15656 /// GTM Folder's API relative path.
15657 ///
15658 /// Sets the *path* path property to the given value.
15659 ///
15660 /// Even though the property as already been set when instantiating this call,
15661 /// we provide this method for API completeness.
15662 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15663 self._path = new_value.to_string();
15664 self
15665 }
15666 /// When provided, this fingerprint must match the fingerprint of the tag in storage.
15667 ///
15668 /// Sets the *fingerprint* query property to the given value.
15669 pub fn fingerprint(
15670 mut self,
15671 new_value: &str,
15672 ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15673 self._fingerprint = Some(new_value.to_string());
15674 self
15675 }
15676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15677 /// while executing the actual API request.
15678 ///
15679 /// ````text
15680 /// It should be used to handle progress information, and to implement a certain level of resilience.
15681 /// ````
15682 ///
15683 /// Sets the *delegate* property to the given value.
15684 pub fn delegate(
15685 mut self,
15686 new_value: &'a mut dyn common::Delegate,
15687 ) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15688 self._delegate = Some(new_value);
15689 self
15690 }
15691
15692 /// Set any additional parameter of the query string used in the request.
15693 /// It should be used to set parameters which are not yet available through their own
15694 /// setters.
15695 ///
15696 /// Please note that this method must not be used to set any of the known parameters
15697 /// which have their own setter method. If done anyway, the request will fail.
15698 ///
15699 /// # Additional Parameters
15700 ///
15701 /// * *$.xgafv* (query-string) - V1 error format.
15702 /// * *access_token* (query-string) - OAuth access token.
15703 /// * *alt* (query-string) - Data format for response.
15704 /// * *callback* (query-string) - JSONP
15705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15706 /// * *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.
15707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15709 /// * *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.
15710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15712 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15713 where
15714 T: AsRef<str>,
15715 {
15716 self._additional_params
15717 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15718 self
15719 }
15720
15721 /// Identifies the authorization scope for the method you are building.
15722 ///
15723 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15724 /// [`Scope::EditContainer`].
15725 ///
15726 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15727 /// tokens for more than one scope.
15728 ///
15729 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15730 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15731 /// sufficient, a read-write scope will do as well.
15732 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15733 where
15734 St: AsRef<str>,
15735 {
15736 self._scopes.insert(String::from(scope.as_ref()));
15737 self
15738 }
15739 /// Identifies the authorization scope(s) for the method you are building.
15740 ///
15741 /// See [`Self::add_scope()`] for details.
15742 pub fn add_scopes<I, St>(
15743 mut self,
15744 scopes: I,
15745 ) -> AccountContainerWorkspaceFolderRevertCall<'a, C>
15746 where
15747 I: IntoIterator<Item = St>,
15748 St: AsRef<str>,
15749 {
15750 self._scopes
15751 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15752 self
15753 }
15754
15755 /// Removes all scopes, and no default scope will be used either.
15756 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15757 /// for details).
15758 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderRevertCall<'a, C> {
15759 self._scopes.clear();
15760 self
15761 }
15762}
15763
15764/// Updates a GTM Folder.
15765///
15766/// A builder for the *containers.workspaces.folders.update* method supported by a *account* resource.
15767/// It is not used directly, but through a [`AccountMethods`] instance.
15768///
15769/// # Example
15770///
15771/// Instantiate a resource method builder
15772///
15773/// ```test_harness,no_run
15774/// # extern crate hyper;
15775/// # extern crate hyper_rustls;
15776/// # extern crate google_tagmanager2 as tagmanager2;
15777/// use tagmanager2::api::Folder;
15778/// # async fn dox() {
15779/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15780///
15781/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15782/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15783/// # .with_native_roots()
15784/// # .unwrap()
15785/// # .https_only()
15786/// # .enable_http2()
15787/// # .build();
15788///
15789/// # let executor = hyper_util::rt::TokioExecutor::new();
15790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15791/// # secret,
15792/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15793/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15794/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15795/// # ),
15796/// # ).build().await.unwrap();
15797///
15798/// # let client = hyper_util::client::legacy::Client::builder(
15799/// # hyper_util::rt::TokioExecutor::new()
15800/// # )
15801/// # .build(
15802/// # hyper_rustls::HttpsConnectorBuilder::new()
15803/// # .with_native_roots()
15804/// # .unwrap()
15805/// # .https_or_http()
15806/// # .enable_http2()
15807/// # .build()
15808/// # );
15809/// # let mut hub = TagManager::new(client, auth);
15810/// // As the method needs a request, you would usually fill it with the desired information
15811/// // into the respective structure. Some of the parts shown here might not be applicable !
15812/// // Values shown here are possibly random and not representative !
15813/// let mut req = Folder::default();
15814///
15815/// // You can configure optional parameters by calling the respective setters at will, and
15816/// // execute the final call using `doit()`.
15817/// // Values shown here are possibly random and not representative !
15818/// let result = hub.accounts().containers_workspaces_folders_update(req, "path")
15819/// .fingerprint("voluptua.")
15820/// .doit().await;
15821/// # }
15822/// ```
15823pub struct AccountContainerWorkspaceFolderUpdateCall<'a, C>
15824where
15825 C: 'a,
15826{
15827 hub: &'a TagManager<C>,
15828 _request: Folder,
15829 _path: String,
15830 _fingerprint: Option<String>,
15831 _delegate: Option<&'a mut dyn common::Delegate>,
15832 _additional_params: HashMap<String, String>,
15833 _scopes: BTreeSet<String>,
15834}
15835
15836impl<'a, C> common::CallBuilder for AccountContainerWorkspaceFolderUpdateCall<'a, C> {}
15837
15838impl<'a, C> AccountContainerWorkspaceFolderUpdateCall<'a, C>
15839where
15840 C: common::Connector,
15841{
15842 /// Perform the operation you have build so far.
15843 pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
15844 use std::borrow::Cow;
15845 use std::io::{Read, Seek};
15846
15847 use common::{url::Params, ToParts};
15848 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15849
15850 let mut dd = common::DefaultDelegate;
15851 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15852 dlg.begin(common::MethodInfo {
15853 id: "tagmanager.accounts.containers.workspaces.folders.update",
15854 http_method: hyper::Method::PUT,
15855 });
15856
15857 for &field in ["alt", "path", "fingerprint"].iter() {
15858 if self._additional_params.contains_key(field) {
15859 dlg.finished(false);
15860 return Err(common::Error::FieldClash(field));
15861 }
15862 }
15863
15864 let mut params = Params::with_capacity(5 + self._additional_params.len());
15865 params.push("path", self._path);
15866 if let Some(value) = self._fingerprint.as_ref() {
15867 params.push("fingerprint", value);
15868 }
15869
15870 params.extend(self._additional_params.iter());
15871
15872 params.push("alt", "json");
15873 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
15874 if self._scopes.is_empty() {
15875 self._scopes
15876 .insert(Scope::EditContainer.as_ref().to_string());
15877 }
15878
15879 #[allow(clippy::single_element_loop)]
15880 for &(find_this, param_name) in [("{+path}", "path")].iter() {
15881 url = params.uri_replacement(url, param_name, find_this, true);
15882 }
15883 {
15884 let to_remove = ["path"];
15885 params.remove_params(&to_remove);
15886 }
15887
15888 let url = params.parse_with_url(&url);
15889
15890 let mut json_mime_type = mime::APPLICATION_JSON;
15891 let mut request_value_reader = {
15892 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15893 common::remove_json_null_values(&mut value);
15894 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15895 serde_json::to_writer(&mut dst, &value).unwrap();
15896 dst
15897 };
15898 let request_size = request_value_reader
15899 .seek(std::io::SeekFrom::End(0))
15900 .unwrap();
15901 request_value_reader
15902 .seek(std::io::SeekFrom::Start(0))
15903 .unwrap();
15904
15905 loop {
15906 let token = match self
15907 .hub
15908 .auth
15909 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15910 .await
15911 {
15912 Ok(token) => token,
15913 Err(e) => match dlg.token(e) {
15914 Ok(token) => token,
15915 Err(e) => {
15916 dlg.finished(false);
15917 return Err(common::Error::MissingToken(e));
15918 }
15919 },
15920 };
15921 request_value_reader
15922 .seek(std::io::SeekFrom::Start(0))
15923 .unwrap();
15924 let mut req_result = {
15925 let client = &self.hub.client;
15926 dlg.pre_request();
15927 let mut req_builder = hyper::Request::builder()
15928 .method(hyper::Method::PUT)
15929 .uri(url.as_str())
15930 .header(USER_AGENT, self.hub._user_agent.clone());
15931
15932 if let Some(token) = token.as_ref() {
15933 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15934 }
15935
15936 let request = req_builder
15937 .header(CONTENT_TYPE, json_mime_type.to_string())
15938 .header(CONTENT_LENGTH, request_size as u64)
15939 .body(common::to_body(
15940 request_value_reader.get_ref().clone().into(),
15941 ));
15942
15943 client.request(request.unwrap()).await
15944 };
15945
15946 match req_result {
15947 Err(err) => {
15948 if let common::Retry::After(d) = dlg.http_error(&err) {
15949 sleep(d).await;
15950 continue;
15951 }
15952 dlg.finished(false);
15953 return Err(common::Error::HttpError(err));
15954 }
15955 Ok(res) => {
15956 let (mut parts, body) = res.into_parts();
15957 let mut body = common::Body::new(body);
15958 if !parts.status.is_success() {
15959 let bytes = common::to_bytes(body).await.unwrap_or_default();
15960 let error = serde_json::from_str(&common::to_string(&bytes));
15961 let response = common::to_response(parts, bytes.into());
15962
15963 if let common::Retry::After(d) =
15964 dlg.http_failure(&response, error.as_ref().ok())
15965 {
15966 sleep(d).await;
15967 continue;
15968 }
15969
15970 dlg.finished(false);
15971
15972 return Err(match error {
15973 Ok(value) => common::Error::BadRequest(value),
15974 _ => common::Error::Failure(response),
15975 });
15976 }
15977 let response = {
15978 let bytes = common::to_bytes(body).await.unwrap_or_default();
15979 let encoded = common::to_string(&bytes);
15980 match serde_json::from_str(&encoded) {
15981 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15982 Err(error) => {
15983 dlg.response_json_decode_error(&encoded, &error);
15984 return Err(common::Error::JsonDecodeError(
15985 encoded.to_string(),
15986 error,
15987 ));
15988 }
15989 }
15990 };
15991
15992 dlg.finished(true);
15993 return Ok(response);
15994 }
15995 }
15996 }
15997 }
15998
15999 ///
16000 /// Sets the *request* property to the given value.
16001 ///
16002 /// Even though the property as already been set when instantiating this call,
16003 /// we provide this method for API completeness.
16004 pub fn request(
16005 mut self,
16006 new_value: Folder,
16007 ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
16008 self._request = new_value;
16009 self
16010 }
16011 /// GTM Folder's API relative path.
16012 ///
16013 /// Sets the *path* path property to the given value.
16014 ///
16015 /// Even though the property as already been set when instantiating this call,
16016 /// we provide this method for API completeness.
16017 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
16018 self._path = new_value.to_string();
16019 self
16020 }
16021 /// When provided, this fingerprint must match the fingerprint of the folder in storage.
16022 ///
16023 /// Sets the *fingerprint* query property to the given value.
16024 pub fn fingerprint(
16025 mut self,
16026 new_value: &str,
16027 ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
16028 self._fingerprint = Some(new_value.to_string());
16029 self
16030 }
16031 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16032 /// while executing the actual API request.
16033 ///
16034 /// ````text
16035 /// It should be used to handle progress information, and to implement a certain level of resilience.
16036 /// ````
16037 ///
16038 /// Sets the *delegate* property to the given value.
16039 pub fn delegate(
16040 mut self,
16041 new_value: &'a mut dyn common::Delegate,
16042 ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
16043 self._delegate = Some(new_value);
16044 self
16045 }
16046
16047 /// Set any additional parameter of the query string used in the request.
16048 /// It should be used to set parameters which are not yet available through their own
16049 /// setters.
16050 ///
16051 /// Please note that this method must not be used to set any of the known parameters
16052 /// which have their own setter method. If done anyway, the request will fail.
16053 ///
16054 /// # Additional Parameters
16055 ///
16056 /// * *$.xgafv* (query-string) - V1 error format.
16057 /// * *access_token* (query-string) - OAuth access token.
16058 /// * *alt* (query-string) - Data format for response.
16059 /// * *callback* (query-string) - JSONP
16060 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16061 /// * *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.
16062 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16063 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16064 /// * *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.
16065 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16066 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16067 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
16068 where
16069 T: AsRef<str>,
16070 {
16071 self._additional_params
16072 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16073 self
16074 }
16075
16076 /// Identifies the authorization scope for the method you are building.
16077 ///
16078 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16079 /// [`Scope::EditContainer`].
16080 ///
16081 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16082 /// tokens for more than one scope.
16083 ///
16084 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16085 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16086 /// sufficient, a read-write scope will do as well.
16087 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
16088 where
16089 St: AsRef<str>,
16090 {
16091 self._scopes.insert(String::from(scope.as_ref()));
16092 self
16093 }
16094 /// Identifies the authorization scope(s) for the method you are building.
16095 ///
16096 /// See [`Self::add_scope()`] for details.
16097 pub fn add_scopes<I, St>(
16098 mut self,
16099 scopes: I,
16100 ) -> AccountContainerWorkspaceFolderUpdateCall<'a, C>
16101 where
16102 I: IntoIterator<Item = St>,
16103 St: AsRef<str>,
16104 {
16105 self._scopes
16106 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16107 self
16108 }
16109
16110 /// Removes all scopes, and no default scope will be used either.
16111 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16112 /// for details).
16113 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceFolderUpdateCall<'a, C> {
16114 self._scopes.clear();
16115 self
16116 }
16117}
16118
16119/// Creates a Google tag config.
16120///
16121/// A builder for the *containers.workspaces.gtag_config.create* method supported by a *account* resource.
16122/// It is not used directly, but through a [`AccountMethods`] instance.
16123///
16124/// # Example
16125///
16126/// Instantiate a resource method builder
16127///
16128/// ```test_harness,no_run
16129/// # extern crate hyper;
16130/// # extern crate hyper_rustls;
16131/// # extern crate google_tagmanager2 as tagmanager2;
16132/// use tagmanager2::api::GtagConfig;
16133/// # async fn dox() {
16134/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16135///
16136/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16137/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16138/// # .with_native_roots()
16139/// # .unwrap()
16140/// # .https_only()
16141/// # .enable_http2()
16142/// # .build();
16143///
16144/// # let executor = hyper_util::rt::TokioExecutor::new();
16145/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16146/// # secret,
16147/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16148/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16149/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16150/// # ),
16151/// # ).build().await.unwrap();
16152///
16153/// # let client = hyper_util::client::legacy::Client::builder(
16154/// # hyper_util::rt::TokioExecutor::new()
16155/// # )
16156/// # .build(
16157/// # hyper_rustls::HttpsConnectorBuilder::new()
16158/// # .with_native_roots()
16159/// # .unwrap()
16160/// # .https_or_http()
16161/// # .enable_http2()
16162/// # .build()
16163/// # );
16164/// # let mut hub = TagManager::new(client, auth);
16165/// // As the method needs a request, you would usually fill it with the desired information
16166/// // into the respective structure. Some of the parts shown here might not be applicable !
16167/// // Values shown here are possibly random and not representative !
16168/// let mut req = GtagConfig::default();
16169///
16170/// // You can configure optional parameters by calling the respective setters at will, and
16171/// // execute the final call using `doit()`.
16172/// // Values shown here are possibly random and not representative !
16173/// let result = hub.accounts().containers_workspaces_gtag_config_create(req, "parent")
16174/// .doit().await;
16175/// # }
16176/// ```
16177pub struct AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
16178where
16179 C: 'a,
16180{
16181 hub: &'a TagManager<C>,
16182 _request: GtagConfig,
16183 _parent: String,
16184 _delegate: Option<&'a mut dyn common::Delegate>,
16185 _additional_params: HashMap<String, String>,
16186 _scopes: BTreeSet<String>,
16187}
16188
16189impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {}
16190
16191impl<'a, C> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
16192where
16193 C: common::Connector,
16194{
16195 /// Perform the operation you have build so far.
16196 pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
16197 use std::borrow::Cow;
16198 use std::io::{Read, Seek};
16199
16200 use common::{url::Params, ToParts};
16201 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16202
16203 let mut dd = common::DefaultDelegate;
16204 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16205 dlg.begin(common::MethodInfo {
16206 id: "tagmanager.accounts.containers.workspaces.gtag_config.create",
16207 http_method: hyper::Method::POST,
16208 });
16209
16210 for &field in ["alt", "parent"].iter() {
16211 if self._additional_params.contains_key(field) {
16212 dlg.finished(false);
16213 return Err(common::Error::FieldClash(field));
16214 }
16215 }
16216
16217 let mut params = Params::with_capacity(4 + self._additional_params.len());
16218 params.push("parent", self._parent);
16219
16220 params.extend(self._additional_params.iter());
16221
16222 params.push("alt", "json");
16223 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/gtag_config";
16224 if self._scopes.is_empty() {
16225 self._scopes
16226 .insert(Scope::EditContainer.as_ref().to_string());
16227 }
16228
16229 #[allow(clippy::single_element_loop)]
16230 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16231 url = params.uri_replacement(url, param_name, find_this, true);
16232 }
16233 {
16234 let to_remove = ["parent"];
16235 params.remove_params(&to_remove);
16236 }
16237
16238 let url = params.parse_with_url(&url);
16239
16240 let mut json_mime_type = mime::APPLICATION_JSON;
16241 let mut request_value_reader = {
16242 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16243 common::remove_json_null_values(&mut value);
16244 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16245 serde_json::to_writer(&mut dst, &value).unwrap();
16246 dst
16247 };
16248 let request_size = request_value_reader
16249 .seek(std::io::SeekFrom::End(0))
16250 .unwrap();
16251 request_value_reader
16252 .seek(std::io::SeekFrom::Start(0))
16253 .unwrap();
16254
16255 loop {
16256 let token = match self
16257 .hub
16258 .auth
16259 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16260 .await
16261 {
16262 Ok(token) => token,
16263 Err(e) => match dlg.token(e) {
16264 Ok(token) => token,
16265 Err(e) => {
16266 dlg.finished(false);
16267 return Err(common::Error::MissingToken(e));
16268 }
16269 },
16270 };
16271 request_value_reader
16272 .seek(std::io::SeekFrom::Start(0))
16273 .unwrap();
16274 let mut req_result = {
16275 let client = &self.hub.client;
16276 dlg.pre_request();
16277 let mut req_builder = hyper::Request::builder()
16278 .method(hyper::Method::POST)
16279 .uri(url.as_str())
16280 .header(USER_AGENT, self.hub._user_agent.clone());
16281
16282 if let Some(token) = token.as_ref() {
16283 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16284 }
16285
16286 let request = req_builder
16287 .header(CONTENT_TYPE, json_mime_type.to_string())
16288 .header(CONTENT_LENGTH, request_size as u64)
16289 .body(common::to_body(
16290 request_value_reader.get_ref().clone().into(),
16291 ));
16292
16293 client.request(request.unwrap()).await
16294 };
16295
16296 match req_result {
16297 Err(err) => {
16298 if let common::Retry::After(d) = dlg.http_error(&err) {
16299 sleep(d).await;
16300 continue;
16301 }
16302 dlg.finished(false);
16303 return Err(common::Error::HttpError(err));
16304 }
16305 Ok(res) => {
16306 let (mut parts, body) = res.into_parts();
16307 let mut body = common::Body::new(body);
16308 if !parts.status.is_success() {
16309 let bytes = common::to_bytes(body).await.unwrap_or_default();
16310 let error = serde_json::from_str(&common::to_string(&bytes));
16311 let response = common::to_response(parts, bytes.into());
16312
16313 if let common::Retry::After(d) =
16314 dlg.http_failure(&response, error.as_ref().ok())
16315 {
16316 sleep(d).await;
16317 continue;
16318 }
16319
16320 dlg.finished(false);
16321
16322 return Err(match error {
16323 Ok(value) => common::Error::BadRequest(value),
16324 _ => common::Error::Failure(response),
16325 });
16326 }
16327 let response = {
16328 let bytes = common::to_bytes(body).await.unwrap_or_default();
16329 let encoded = common::to_string(&bytes);
16330 match serde_json::from_str(&encoded) {
16331 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16332 Err(error) => {
16333 dlg.response_json_decode_error(&encoded, &error);
16334 return Err(common::Error::JsonDecodeError(
16335 encoded.to_string(),
16336 error,
16337 ));
16338 }
16339 }
16340 };
16341
16342 dlg.finished(true);
16343 return Ok(response);
16344 }
16345 }
16346 }
16347 }
16348
16349 ///
16350 /// Sets the *request* property to the given value.
16351 ///
16352 /// Even though the property as already been set when instantiating this call,
16353 /// we provide this method for API completeness.
16354 pub fn request(
16355 mut self,
16356 new_value: GtagConfig,
16357 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
16358 self._request = new_value;
16359 self
16360 }
16361 /// Workspace's API relative path.
16362 ///
16363 /// Sets the *parent* path property to the given value.
16364 ///
16365 /// Even though the property as already been set when instantiating this call,
16366 /// we provide this method for API completeness.
16367 pub fn parent(
16368 mut self,
16369 new_value: &str,
16370 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
16371 self._parent = new_value.to_string();
16372 self
16373 }
16374 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16375 /// while executing the actual API request.
16376 ///
16377 /// ````text
16378 /// It should be used to handle progress information, and to implement a certain level of resilience.
16379 /// ````
16380 ///
16381 /// Sets the *delegate* property to the given value.
16382 pub fn delegate(
16383 mut self,
16384 new_value: &'a mut dyn common::Delegate,
16385 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
16386 self._delegate = Some(new_value);
16387 self
16388 }
16389
16390 /// Set any additional parameter of the query string used in the request.
16391 /// It should be used to set parameters which are not yet available through their own
16392 /// setters.
16393 ///
16394 /// Please note that this method must not be used to set any of the known parameters
16395 /// which have their own setter method. If done anyway, the request will fail.
16396 ///
16397 /// # Additional Parameters
16398 ///
16399 /// * *$.xgafv* (query-string) - V1 error format.
16400 /// * *access_token* (query-string) - OAuth access token.
16401 /// * *alt* (query-string) - Data format for response.
16402 /// * *callback* (query-string) - JSONP
16403 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16404 /// * *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.
16405 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16406 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16407 /// * *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.
16408 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16409 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16410 pub fn param<T>(
16411 mut self,
16412 name: T,
16413 value: T,
16414 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
16415 where
16416 T: AsRef<str>,
16417 {
16418 self._additional_params
16419 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16420 self
16421 }
16422
16423 /// Identifies the authorization scope for the method you are building.
16424 ///
16425 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16426 /// [`Scope::EditContainer`].
16427 ///
16428 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16429 /// tokens for more than one scope.
16430 ///
16431 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16432 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16433 /// sufficient, a read-write scope will do as well.
16434 pub fn add_scope<St>(
16435 mut self,
16436 scope: St,
16437 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
16438 where
16439 St: AsRef<str>,
16440 {
16441 self._scopes.insert(String::from(scope.as_ref()));
16442 self
16443 }
16444 /// Identifies the authorization scope(s) for the method you are building.
16445 ///
16446 /// See [`Self::add_scope()`] for details.
16447 pub fn add_scopes<I, St>(
16448 mut self,
16449 scopes: I,
16450 ) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C>
16451 where
16452 I: IntoIterator<Item = St>,
16453 St: AsRef<str>,
16454 {
16455 self._scopes
16456 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16457 self
16458 }
16459
16460 /// Removes all scopes, and no default scope will be used either.
16461 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16462 /// for details).
16463 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigCreateCall<'a, C> {
16464 self._scopes.clear();
16465 self
16466 }
16467}
16468
16469/// Deletes a Google tag config.
16470///
16471/// A builder for the *containers.workspaces.gtag_config.delete* method supported by a *account* resource.
16472/// It is not used directly, but through a [`AccountMethods`] instance.
16473///
16474/// # Example
16475///
16476/// Instantiate a resource method builder
16477///
16478/// ```test_harness,no_run
16479/// # extern crate hyper;
16480/// # extern crate hyper_rustls;
16481/// # extern crate google_tagmanager2 as tagmanager2;
16482/// # async fn dox() {
16483/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16484///
16485/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16486/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16487/// # .with_native_roots()
16488/// # .unwrap()
16489/// # .https_only()
16490/// # .enable_http2()
16491/// # .build();
16492///
16493/// # let executor = hyper_util::rt::TokioExecutor::new();
16494/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16495/// # secret,
16496/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16497/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16498/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16499/// # ),
16500/// # ).build().await.unwrap();
16501///
16502/// # let client = hyper_util::client::legacy::Client::builder(
16503/// # hyper_util::rt::TokioExecutor::new()
16504/// # )
16505/// # .build(
16506/// # hyper_rustls::HttpsConnectorBuilder::new()
16507/// # .with_native_roots()
16508/// # .unwrap()
16509/// # .https_or_http()
16510/// # .enable_http2()
16511/// # .build()
16512/// # );
16513/// # let mut hub = TagManager::new(client, auth);
16514/// // You can configure optional parameters by calling the respective setters at will, and
16515/// // execute the final call using `doit()`.
16516/// // Values shown here are possibly random and not representative !
16517/// let result = hub.accounts().containers_workspaces_gtag_config_delete("path")
16518/// .doit().await;
16519/// # }
16520/// ```
16521pub struct AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16522where
16523 C: 'a,
16524{
16525 hub: &'a TagManager<C>,
16526 _path: String,
16527 _delegate: Option<&'a mut dyn common::Delegate>,
16528 _additional_params: HashMap<String, String>,
16529 _scopes: BTreeSet<String>,
16530}
16531
16532impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {}
16533
16534impl<'a, C> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16535where
16536 C: common::Connector,
16537{
16538 /// Perform the operation you have build so far.
16539 pub async fn doit(mut self) -> common::Result<common::Response> {
16540 use std::borrow::Cow;
16541 use std::io::{Read, Seek};
16542
16543 use common::{url::Params, ToParts};
16544 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16545
16546 let mut dd = common::DefaultDelegate;
16547 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16548 dlg.begin(common::MethodInfo {
16549 id: "tagmanager.accounts.containers.workspaces.gtag_config.delete",
16550 http_method: hyper::Method::DELETE,
16551 });
16552
16553 for &field in ["path"].iter() {
16554 if self._additional_params.contains_key(field) {
16555 dlg.finished(false);
16556 return Err(common::Error::FieldClash(field));
16557 }
16558 }
16559
16560 let mut params = Params::with_capacity(2 + self._additional_params.len());
16561 params.push("path", self._path);
16562
16563 params.extend(self._additional_params.iter());
16564
16565 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
16566 if self._scopes.is_empty() {
16567 self._scopes
16568 .insert(Scope::EditContainer.as_ref().to_string());
16569 }
16570
16571 #[allow(clippy::single_element_loop)]
16572 for &(find_this, param_name) in [("{+path}", "path")].iter() {
16573 url = params.uri_replacement(url, param_name, find_this, true);
16574 }
16575 {
16576 let to_remove = ["path"];
16577 params.remove_params(&to_remove);
16578 }
16579
16580 let url = params.parse_with_url(&url);
16581
16582 loop {
16583 let token = match self
16584 .hub
16585 .auth
16586 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16587 .await
16588 {
16589 Ok(token) => token,
16590 Err(e) => match dlg.token(e) {
16591 Ok(token) => token,
16592 Err(e) => {
16593 dlg.finished(false);
16594 return Err(common::Error::MissingToken(e));
16595 }
16596 },
16597 };
16598 let mut req_result = {
16599 let client = &self.hub.client;
16600 dlg.pre_request();
16601 let mut req_builder = hyper::Request::builder()
16602 .method(hyper::Method::DELETE)
16603 .uri(url.as_str())
16604 .header(USER_AGENT, self.hub._user_agent.clone());
16605
16606 if let Some(token) = token.as_ref() {
16607 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16608 }
16609
16610 let request = req_builder
16611 .header(CONTENT_LENGTH, 0_u64)
16612 .body(common::to_body::<String>(None));
16613
16614 client.request(request.unwrap()).await
16615 };
16616
16617 match req_result {
16618 Err(err) => {
16619 if let common::Retry::After(d) = dlg.http_error(&err) {
16620 sleep(d).await;
16621 continue;
16622 }
16623 dlg.finished(false);
16624 return Err(common::Error::HttpError(err));
16625 }
16626 Ok(res) => {
16627 let (mut parts, body) = res.into_parts();
16628 let mut body = common::Body::new(body);
16629 if !parts.status.is_success() {
16630 let bytes = common::to_bytes(body).await.unwrap_or_default();
16631 let error = serde_json::from_str(&common::to_string(&bytes));
16632 let response = common::to_response(parts, bytes.into());
16633
16634 if let common::Retry::After(d) =
16635 dlg.http_failure(&response, error.as_ref().ok())
16636 {
16637 sleep(d).await;
16638 continue;
16639 }
16640
16641 dlg.finished(false);
16642
16643 return Err(match error {
16644 Ok(value) => common::Error::BadRequest(value),
16645 _ => common::Error::Failure(response),
16646 });
16647 }
16648 let response = common::Response::from_parts(parts, body);
16649
16650 dlg.finished(true);
16651 return Ok(response);
16652 }
16653 }
16654 }
16655 }
16656
16657 /// Google tag config's API relative path.
16658 ///
16659 /// Sets the *path* path property to the given value.
16660 ///
16661 /// Even though the property as already been set when instantiating this call,
16662 /// we provide this method for API completeness.
16663 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16664 self._path = new_value.to_string();
16665 self
16666 }
16667 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16668 /// while executing the actual API request.
16669 ///
16670 /// ````text
16671 /// It should be used to handle progress information, and to implement a certain level of resilience.
16672 /// ````
16673 ///
16674 /// Sets the *delegate* property to the given value.
16675 pub fn delegate(
16676 mut self,
16677 new_value: &'a mut dyn common::Delegate,
16678 ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16679 self._delegate = Some(new_value);
16680 self
16681 }
16682
16683 /// Set any additional parameter of the query string used in the request.
16684 /// It should be used to set parameters which are not yet available through their own
16685 /// setters.
16686 ///
16687 /// Please note that this method must not be used to set any of the known parameters
16688 /// which have their own setter method. If done anyway, the request will fail.
16689 ///
16690 /// # Additional Parameters
16691 ///
16692 /// * *$.xgafv* (query-string) - V1 error format.
16693 /// * *access_token* (query-string) - OAuth access token.
16694 /// * *alt* (query-string) - Data format for response.
16695 /// * *callback* (query-string) - JSONP
16696 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16697 /// * *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.
16698 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16699 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16700 /// * *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.
16701 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16702 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16703 pub fn param<T>(
16704 mut self,
16705 name: T,
16706 value: T,
16707 ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16708 where
16709 T: AsRef<str>,
16710 {
16711 self._additional_params
16712 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16713 self
16714 }
16715
16716 /// Identifies the authorization scope for the method you are building.
16717 ///
16718 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16719 /// [`Scope::EditContainer`].
16720 ///
16721 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16722 /// tokens for more than one scope.
16723 ///
16724 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16725 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16726 /// sufficient, a read-write scope will do as well.
16727 pub fn add_scope<St>(
16728 mut self,
16729 scope: St,
16730 ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16731 where
16732 St: AsRef<str>,
16733 {
16734 self._scopes.insert(String::from(scope.as_ref()));
16735 self
16736 }
16737 /// Identifies the authorization scope(s) for the method you are building.
16738 ///
16739 /// See [`Self::add_scope()`] for details.
16740 pub fn add_scopes<I, St>(
16741 mut self,
16742 scopes: I,
16743 ) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C>
16744 where
16745 I: IntoIterator<Item = St>,
16746 St: AsRef<str>,
16747 {
16748 self._scopes
16749 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16750 self
16751 }
16752
16753 /// Removes all scopes, and no default scope will be used either.
16754 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16755 /// for details).
16756 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigDeleteCall<'a, C> {
16757 self._scopes.clear();
16758 self
16759 }
16760}
16761
16762/// Gets a Google tag config.
16763///
16764/// A builder for the *containers.workspaces.gtag_config.get* method supported by a *account* resource.
16765/// It is not used directly, but through a [`AccountMethods`] instance.
16766///
16767/// # Example
16768///
16769/// Instantiate a resource method builder
16770///
16771/// ```test_harness,no_run
16772/// # extern crate hyper;
16773/// # extern crate hyper_rustls;
16774/// # extern crate google_tagmanager2 as tagmanager2;
16775/// # async fn dox() {
16776/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16777///
16778/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16779/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16780/// # .with_native_roots()
16781/// # .unwrap()
16782/// # .https_only()
16783/// # .enable_http2()
16784/// # .build();
16785///
16786/// # let executor = hyper_util::rt::TokioExecutor::new();
16787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16788/// # secret,
16789/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16790/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16791/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16792/// # ),
16793/// # ).build().await.unwrap();
16794///
16795/// # let client = hyper_util::client::legacy::Client::builder(
16796/// # hyper_util::rt::TokioExecutor::new()
16797/// # )
16798/// # .build(
16799/// # hyper_rustls::HttpsConnectorBuilder::new()
16800/// # .with_native_roots()
16801/// # .unwrap()
16802/// # .https_or_http()
16803/// # .enable_http2()
16804/// # .build()
16805/// # );
16806/// # let mut hub = TagManager::new(client, auth);
16807/// // You can configure optional parameters by calling the respective setters at will, and
16808/// // execute the final call using `doit()`.
16809/// // Values shown here are possibly random and not representative !
16810/// let result = hub.accounts().containers_workspaces_gtag_config_get("path")
16811/// .doit().await;
16812/// # }
16813/// ```
16814pub struct AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16815where
16816 C: 'a,
16817{
16818 hub: &'a TagManager<C>,
16819 _path: String,
16820 _delegate: Option<&'a mut dyn common::Delegate>,
16821 _additional_params: HashMap<String, String>,
16822 _scopes: BTreeSet<String>,
16823}
16824
16825impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigGetCall<'a, C> {}
16826
16827impl<'a, C> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
16828where
16829 C: common::Connector,
16830{
16831 /// Perform the operation you have build so far.
16832 pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
16833 use std::borrow::Cow;
16834 use std::io::{Read, Seek};
16835
16836 use common::{url::Params, ToParts};
16837 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16838
16839 let mut dd = common::DefaultDelegate;
16840 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16841 dlg.begin(common::MethodInfo {
16842 id: "tagmanager.accounts.containers.workspaces.gtag_config.get",
16843 http_method: hyper::Method::GET,
16844 });
16845
16846 for &field in ["alt", "path"].iter() {
16847 if self._additional_params.contains_key(field) {
16848 dlg.finished(false);
16849 return Err(common::Error::FieldClash(field));
16850 }
16851 }
16852
16853 let mut params = Params::with_capacity(3 + self._additional_params.len());
16854 params.push("path", self._path);
16855
16856 params.extend(self._additional_params.iter());
16857
16858 params.push("alt", "json");
16859 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
16860 if self._scopes.is_empty() {
16861 self._scopes.insert(Scope::Readonly.as_ref().to_string());
16862 }
16863
16864 #[allow(clippy::single_element_loop)]
16865 for &(find_this, param_name) in [("{+path}", "path")].iter() {
16866 url = params.uri_replacement(url, param_name, find_this, true);
16867 }
16868 {
16869 let to_remove = ["path"];
16870 params.remove_params(&to_remove);
16871 }
16872
16873 let url = params.parse_with_url(&url);
16874
16875 loop {
16876 let token = match self
16877 .hub
16878 .auth
16879 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16880 .await
16881 {
16882 Ok(token) => token,
16883 Err(e) => match dlg.token(e) {
16884 Ok(token) => token,
16885 Err(e) => {
16886 dlg.finished(false);
16887 return Err(common::Error::MissingToken(e));
16888 }
16889 },
16890 };
16891 let mut req_result = {
16892 let client = &self.hub.client;
16893 dlg.pre_request();
16894 let mut req_builder = hyper::Request::builder()
16895 .method(hyper::Method::GET)
16896 .uri(url.as_str())
16897 .header(USER_AGENT, self.hub._user_agent.clone());
16898
16899 if let Some(token) = token.as_ref() {
16900 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16901 }
16902
16903 let request = req_builder
16904 .header(CONTENT_LENGTH, 0_u64)
16905 .body(common::to_body::<String>(None));
16906
16907 client.request(request.unwrap()).await
16908 };
16909
16910 match req_result {
16911 Err(err) => {
16912 if let common::Retry::After(d) = dlg.http_error(&err) {
16913 sleep(d).await;
16914 continue;
16915 }
16916 dlg.finished(false);
16917 return Err(common::Error::HttpError(err));
16918 }
16919 Ok(res) => {
16920 let (mut parts, body) = res.into_parts();
16921 let mut body = common::Body::new(body);
16922 if !parts.status.is_success() {
16923 let bytes = common::to_bytes(body).await.unwrap_or_default();
16924 let error = serde_json::from_str(&common::to_string(&bytes));
16925 let response = common::to_response(parts, bytes.into());
16926
16927 if let common::Retry::After(d) =
16928 dlg.http_failure(&response, error.as_ref().ok())
16929 {
16930 sleep(d).await;
16931 continue;
16932 }
16933
16934 dlg.finished(false);
16935
16936 return Err(match error {
16937 Ok(value) => common::Error::BadRequest(value),
16938 _ => common::Error::Failure(response),
16939 });
16940 }
16941 let response = {
16942 let bytes = common::to_bytes(body).await.unwrap_or_default();
16943 let encoded = common::to_string(&bytes);
16944 match serde_json::from_str(&encoded) {
16945 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16946 Err(error) => {
16947 dlg.response_json_decode_error(&encoded, &error);
16948 return Err(common::Error::JsonDecodeError(
16949 encoded.to_string(),
16950 error,
16951 ));
16952 }
16953 }
16954 };
16955
16956 dlg.finished(true);
16957 return Ok(response);
16958 }
16959 }
16960 }
16961 }
16962
16963 /// Google tag config's API relative path.
16964 ///
16965 /// Sets the *path* path property to the given value.
16966 ///
16967 /// Even though the property as already been set when instantiating this call,
16968 /// we provide this method for API completeness.
16969 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
16970 self._path = new_value.to_string();
16971 self
16972 }
16973 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16974 /// while executing the actual API request.
16975 ///
16976 /// ````text
16977 /// It should be used to handle progress information, and to implement a certain level of resilience.
16978 /// ````
16979 ///
16980 /// Sets the *delegate* property to the given value.
16981 pub fn delegate(
16982 mut self,
16983 new_value: &'a mut dyn common::Delegate,
16984 ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
16985 self._delegate = Some(new_value);
16986 self
16987 }
16988
16989 /// Set any additional parameter of the query string used in the request.
16990 /// It should be used to set parameters which are not yet available through their own
16991 /// setters.
16992 ///
16993 /// Please note that this method must not be used to set any of the known parameters
16994 /// which have their own setter method. If done anyway, the request will fail.
16995 ///
16996 /// # Additional Parameters
16997 ///
16998 /// * *$.xgafv* (query-string) - V1 error format.
16999 /// * *access_token* (query-string) - OAuth access token.
17000 /// * *alt* (query-string) - Data format for response.
17001 /// * *callback* (query-string) - JSONP
17002 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17003 /// * *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.
17004 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17005 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17006 /// * *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.
17007 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17008 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17009 pub fn param<T>(
17010 mut self,
17011 name: T,
17012 value: T,
17013 ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
17014 where
17015 T: AsRef<str>,
17016 {
17017 self._additional_params
17018 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17019 self
17020 }
17021
17022 /// Identifies the authorization scope for the method you are building.
17023 ///
17024 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17025 /// [`Scope::Readonly`].
17026 ///
17027 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17028 /// tokens for more than one scope.
17029 ///
17030 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17031 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17032 /// sufficient, a read-write scope will do as well.
17033 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
17034 where
17035 St: AsRef<str>,
17036 {
17037 self._scopes.insert(String::from(scope.as_ref()));
17038 self
17039 }
17040 /// Identifies the authorization scope(s) for the method you are building.
17041 ///
17042 /// See [`Self::add_scope()`] for details.
17043 pub fn add_scopes<I, St>(
17044 mut self,
17045 scopes: I,
17046 ) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C>
17047 where
17048 I: IntoIterator<Item = St>,
17049 St: AsRef<str>,
17050 {
17051 self._scopes
17052 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17053 self
17054 }
17055
17056 /// Removes all scopes, and no default scope will be used either.
17057 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17058 /// for details).
17059 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigGetCall<'a, C> {
17060 self._scopes.clear();
17061 self
17062 }
17063}
17064
17065/// Lists all Google tag configs in a Container.
17066///
17067/// A builder for the *containers.workspaces.gtag_config.list* method supported by a *account* resource.
17068/// It is not used directly, but through a [`AccountMethods`] instance.
17069///
17070/// # Example
17071///
17072/// Instantiate a resource method builder
17073///
17074/// ```test_harness,no_run
17075/// # extern crate hyper;
17076/// # extern crate hyper_rustls;
17077/// # extern crate google_tagmanager2 as tagmanager2;
17078/// # async fn dox() {
17079/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17080///
17081/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17082/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17083/// # .with_native_roots()
17084/// # .unwrap()
17085/// # .https_only()
17086/// # .enable_http2()
17087/// # .build();
17088///
17089/// # let executor = hyper_util::rt::TokioExecutor::new();
17090/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17091/// # secret,
17092/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17093/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17094/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17095/// # ),
17096/// # ).build().await.unwrap();
17097///
17098/// # let client = hyper_util::client::legacy::Client::builder(
17099/// # hyper_util::rt::TokioExecutor::new()
17100/// # )
17101/// # .build(
17102/// # hyper_rustls::HttpsConnectorBuilder::new()
17103/// # .with_native_roots()
17104/// # .unwrap()
17105/// # .https_or_http()
17106/// # .enable_http2()
17107/// # .build()
17108/// # );
17109/// # let mut hub = TagManager::new(client, auth);
17110/// // You can configure optional parameters by calling the respective setters at will, and
17111/// // execute the final call using `doit()`.
17112/// // Values shown here are possibly random and not representative !
17113/// let result = hub.accounts().containers_workspaces_gtag_config_list("parent")
17114/// .page_token("amet.")
17115/// .doit().await;
17116/// # }
17117/// ```
17118pub struct AccountContainerWorkspaceGtagConfigListCall<'a, C>
17119where
17120 C: 'a,
17121{
17122 hub: &'a TagManager<C>,
17123 _parent: String,
17124 _page_token: Option<String>,
17125 _delegate: Option<&'a mut dyn common::Delegate>,
17126 _additional_params: HashMap<String, String>,
17127 _scopes: BTreeSet<String>,
17128}
17129
17130impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigListCall<'a, C> {}
17131
17132impl<'a, C> AccountContainerWorkspaceGtagConfigListCall<'a, C>
17133where
17134 C: common::Connector,
17135{
17136 /// Perform the operation you have build so far.
17137 pub async fn doit(mut self) -> common::Result<(common::Response, ListGtagConfigResponse)> {
17138 use std::borrow::Cow;
17139 use std::io::{Read, Seek};
17140
17141 use common::{url::Params, ToParts};
17142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17143
17144 let mut dd = common::DefaultDelegate;
17145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17146 dlg.begin(common::MethodInfo {
17147 id: "tagmanager.accounts.containers.workspaces.gtag_config.list",
17148 http_method: hyper::Method::GET,
17149 });
17150
17151 for &field in ["alt", "parent", "pageToken"].iter() {
17152 if self._additional_params.contains_key(field) {
17153 dlg.finished(false);
17154 return Err(common::Error::FieldClash(field));
17155 }
17156 }
17157
17158 let mut params = Params::with_capacity(4 + self._additional_params.len());
17159 params.push("parent", self._parent);
17160 if let Some(value) = self._page_token.as_ref() {
17161 params.push("pageToken", value);
17162 }
17163
17164 params.extend(self._additional_params.iter());
17165
17166 params.push("alt", "json");
17167 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/gtag_config";
17168 if self._scopes.is_empty() {
17169 self._scopes.insert(Scope::Readonly.as_ref().to_string());
17170 }
17171
17172 #[allow(clippy::single_element_loop)]
17173 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17174 url = params.uri_replacement(url, param_name, find_this, true);
17175 }
17176 {
17177 let to_remove = ["parent"];
17178 params.remove_params(&to_remove);
17179 }
17180
17181 let url = params.parse_with_url(&url);
17182
17183 loop {
17184 let token = match self
17185 .hub
17186 .auth
17187 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17188 .await
17189 {
17190 Ok(token) => token,
17191 Err(e) => match dlg.token(e) {
17192 Ok(token) => token,
17193 Err(e) => {
17194 dlg.finished(false);
17195 return Err(common::Error::MissingToken(e));
17196 }
17197 },
17198 };
17199 let mut req_result = {
17200 let client = &self.hub.client;
17201 dlg.pre_request();
17202 let mut req_builder = hyper::Request::builder()
17203 .method(hyper::Method::GET)
17204 .uri(url.as_str())
17205 .header(USER_AGENT, self.hub._user_agent.clone());
17206
17207 if let Some(token) = token.as_ref() {
17208 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17209 }
17210
17211 let request = req_builder
17212 .header(CONTENT_LENGTH, 0_u64)
17213 .body(common::to_body::<String>(None));
17214
17215 client.request(request.unwrap()).await
17216 };
17217
17218 match req_result {
17219 Err(err) => {
17220 if let common::Retry::After(d) = dlg.http_error(&err) {
17221 sleep(d).await;
17222 continue;
17223 }
17224 dlg.finished(false);
17225 return Err(common::Error::HttpError(err));
17226 }
17227 Ok(res) => {
17228 let (mut parts, body) = res.into_parts();
17229 let mut body = common::Body::new(body);
17230 if !parts.status.is_success() {
17231 let bytes = common::to_bytes(body).await.unwrap_or_default();
17232 let error = serde_json::from_str(&common::to_string(&bytes));
17233 let response = common::to_response(parts, bytes.into());
17234
17235 if let common::Retry::After(d) =
17236 dlg.http_failure(&response, error.as_ref().ok())
17237 {
17238 sleep(d).await;
17239 continue;
17240 }
17241
17242 dlg.finished(false);
17243
17244 return Err(match error {
17245 Ok(value) => common::Error::BadRequest(value),
17246 _ => common::Error::Failure(response),
17247 });
17248 }
17249 let response = {
17250 let bytes = common::to_bytes(body).await.unwrap_or_default();
17251 let encoded = common::to_string(&bytes);
17252 match serde_json::from_str(&encoded) {
17253 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17254 Err(error) => {
17255 dlg.response_json_decode_error(&encoded, &error);
17256 return Err(common::Error::JsonDecodeError(
17257 encoded.to_string(),
17258 error,
17259 ));
17260 }
17261 }
17262 };
17263
17264 dlg.finished(true);
17265 return Ok(response);
17266 }
17267 }
17268 }
17269 }
17270
17271 /// Workspace's API relative path.
17272 ///
17273 /// Sets the *parent* path property to the given value.
17274 ///
17275 /// Even though the property as already been set when instantiating this call,
17276 /// we provide this method for API completeness.
17277 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
17278 self._parent = new_value.to_string();
17279 self
17280 }
17281 /// Continuation token for fetching the next page of results.
17282 ///
17283 /// Sets the *page token* query property to the given value.
17284 pub fn page_token(
17285 mut self,
17286 new_value: &str,
17287 ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
17288 self._page_token = Some(new_value.to_string());
17289 self
17290 }
17291 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17292 /// while executing the actual API request.
17293 ///
17294 /// ````text
17295 /// It should be used to handle progress information, and to implement a certain level of resilience.
17296 /// ````
17297 ///
17298 /// Sets the *delegate* property to the given value.
17299 pub fn delegate(
17300 mut self,
17301 new_value: &'a mut dyn common::Delegate,
17302 ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
17303 self._delegate = Some(new_value);
17304 self
17305 }
17306
17307 /// Set any additional parameter of the query string used in the request.
17308 /// It should be used to set parameters which are not yet available through their own
17309 /// setters.
17310 ///
17311 /// Please note that this method must not be used to set any of the known parameters
17312 /// which have their own setter method. If done anyway, the request will fail.
17313 ///
17314 /// # Additional Parameters
17315 ///
17316 /// * *$.xgafv* (query-string) - V1 error format.
17317 /// * *access_token* (query-string) - OAuth access token.
17318 /// * *alt* (query-string) - Data format for response.
17319 /// * *callback* (query-string) - JSONP
17320 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17321 /// * *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.
17322 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17323 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17324 /// * *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.
17325 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17326 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17327 pub fn param<T>(
17328 mut self,
17329 name: T,
17330 value: T,
17331 ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
17332 where
17333 T: AsRef<str>,
17334 {
17335 self._additional_params
17336 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17337 self
17338 }
17339
17340 /// Identifies the authorization scope for the method you are building.
17341 ///
17342 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17343 /// [`Scope::Readonly`].
17344 ///
17345 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17346 /// tokens for more than one scope.
17347 ///
17348 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17349 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17350 /// sufficient, a read-write scope will do as well.
17351 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
17352 where
17353 St: AsRef<str>,
17354 {
17355 self._scopes.insert(String::from(scope.as_ref()));
17356 self
17357 }
17358 /// Identifies the authorization scope(s) for the method you are building.
17359 ///
17360 /// See [`Self::add_scope()`] for details.
17361 pub fn add_scopes<I, St>(
17362 mut self,
17363 scopes: I,
17364 ) -> AccountContainerWorkspaceGtagConfigListCall<'a, C>
17365 where
17366 I: IntoIterator<Item = St>,
17367 St: AsRef<str>,
17368 {
17369 self._scopes
17370 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17371 self
17372 }
17373
17374 /// Removes all scopes, and no default scope will be used either.
17375 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17376 /// for details).
17377 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigListCall<'a, C> {
17378 self._scopes.clear();
17379 self
17380 }
17381}
17382
17383/// Updates a Google tag config.
17384///
17385/// A builder for the *containers.workspaces.gtag_config.update* method supported by a *account* resource.
17386/// It is not used directly, but through a [`AccountMethods`] instance.
17387///
17388/// # Example
17389///
17390/// Instantiate a resource method builder
17391///
17392/// ```test_harness,no_run
17393/// # extern crate hyper;
17394/// # extern crate hyper_rustls;
17395/// # extern crate google_tagmanager2 as tagmanager2;
17396/// use tagmanager2::api::GtagConfig;
17397/// # async fn dox() {
17398/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17399///
17400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17401/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17402/// # .with_native_roots()
17403/// # .unwrap()
17404/// # .https_only()
17405/// # .enable_http2()
17406/// # .build();
17407///
17408/// # let executor = hyper_util::rt::TokioExecutor::new();
17409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17410/// # secret,
17411/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17412/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17413/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17414/// # ),
17415/// # ).build().await.unwrap();
17416///
17417/// # let client = hyper_util::client::legacy::Client::builder(
17418/// # hyper_util::rt::TokioExecutor::new()
17419/// # )
17420/// # .build(
17421/// # hyper_rustls::HttpsConnectorBuilder::new()
17422/// # .with_native_roots()
17423/// # .unwrap()
17424/// # .https_or_http()
17425/// # .enable_http2()
17426/// # .build()
17427/// # );
17428/// # let mut hub = TagManager::new(client, auth);
17429/// // As the method needs a request, you would usually fill it with the desired information
17430/// // into the respective structure. Some of the parts shown here might not be applicable !
17431/// // Values shown here are possibly random and not representative !
17432/// let mut req = GtagConfig::default();
17433///
17434/// // You can configure optional parameters by calling the respective setters at will, and
17435/// // execute the final call using `doit()`.
17436/// // Values shown here are possibly random and not representative !
17437/// let result = hub.accounts().containers_workspaces_gtag_config_update(req, "path")
17438/// .fingerprint("sadipscing")
17439/// .doit().await;
17440/// # }
17441/// ```
17442pub struct AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17443where
17444 C: 'a,
17445{
17446 hub: &'a TagManager<C>,
17447 _request: GtagConfig,
17448 _path: String,
17449 _fingerprint: Option<String>,
17450 _delegate: Option<&'a mut dyn common::Delegate>,
17451 _additional_params: HashMap<String, String>,
17452 _scopes: BTreeSet<String>,
17453}
17454
17455impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {}
17456
17457impl<'a, C> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17458where
17459 C: common::Connector,
17460{
17461 /// Perform the operation you have build so far.
17462 pub async fn doit(mut self) -> common::Result<(common::Response, GtagConfig)> {
17463 use std::borrow::Cow;
17464 use std::io::{Read, Seek};
17465
17466 use common::{url::Params, ToParts};
17467 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17468
17469 let mut dd = common::DefaultDelegate;
17470 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17471 dlg.begin(common::MethodInfo {
17472 id: "tagmanager.accounts.containers.workspaces.gtag_config.update",
17473 http_method: hyper::Method::PUT,
17474 });
17475
17476 for &field in ["alt", "path", "fingerprint"].iter() {
17477 if self._additional_params.contains_key(field) {
17478 dlg.finished(false);
17479 return Err(common::Error::FieldClash(field));
17480 }
17481 }
17482
17483 let mut params = Params::with_capacity(5 + self._additional_params.len());
17484 params.push("path", self._path);
17485 if let Some(value) = self._fingerprint.as_ref() {
17486 params.push("fingerprint", value);
17487 }
17488
17489 params.extend(self._additional_params.iter());
17490
17491 params.push("alt", "json");
17492 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
17493 if self._scopes.is_empty() {
17494 self._scopes
17495 .insert(Scope::EditContainer.as_ref().to_string());
17496 }
17497
17498 #[allow(clippy::single_element_loop)]
17499 for &(find_this, param_name) in [("{+path}", "path")].iter() {
17500 url = params.uri_replacement(url, param_name, find_this, true);
17501 }
17502 {
17503 let to_remove = ["path"];
17504 params.remove_params(&to_remove);
17505 }
17506
17507 let url = params.parse_with_url(&url);
17508
17509 let mut json_mime_type = mime::APPLICATION_JSON;
17510 let mut request_value_reader = {
17511 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17512 common::remove_json_null_values(&mut value);
17513 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17514 serde_json::to_writer(&mut dst, &value).unwrap();
17515 dst
17516 };
17517 let request_size = request_value_reader
17518 .seek(std::io::SeekFrom::End(0))
17519 .unwrap();
17520 request_value_reader
17521 .seek(std::io::SeekFrom::Start(0))
17522 .unwrap();
17523
17524 loop {
17525 let token = match self
17526 .hub
17527 .auth
17528 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17529 .await
17530 {
17531 Ok(token) => token,
17532 Err(e) => match dlg.token(e) {
17533 Ok(token) => token,
17534 Err(e) => {
17535 dlg.finished(false);
17536 return Err(common::Error::MissingToken(e));
17537 }
17538 },
17539 };
17540 request_value_reader
17541 .seek(std::io::SeekFrom::Start(0))
17542 .unwrap();
17543 let mut req_result = {
17544 let client = &self.hub.client;
17545 dlg.pre_request();
17546 let mut req_builder = hyper::Request::builder()
17547 .method(hyper::Method::PUT)
17548 .uri(url.as_str())
17549 .header(USER_AGENT, self.hub._user_agent.clone());
17550
17551 if let Some(token) = token.as_ref() {
17552 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17553 }
17554
17555 let request = req_builder
17556 .header(CONTENT_TYPE, json_mime_type.to_string())
17557 .header(CONTENT_LENGTH, request_size as u64)
17558 .body(common::to_body(
17559 request_value_reader.get_ref().clone().into(),
17560 ));
17561
17562 client.request(request.unwrap()).await
17563 };
17564
17565 match req_result {
17566 Err(err) => {
17567 if let common::Retry::After(d) = dlg.http_error(&err) {
17568 sleep(d).await;
17569 continue;
17570 }
17571 dlg.finished(false);
17572 return Err(common::Error::HttpError(err));
17573 }
17574 Ok(res) => {
17575 let (mut parts, body) = res.into_parts();
17576 let mut body = common::Body::new(body);
17577 if !parts.status.is_success() {
17578 let bytes = common::to_bytes(body).await.unwrap_or_default();
17579 let error = serde_json::from_str(&common::to_string(&bytes));
17580 let response = common::to_response(parts, bytes.into());
17581
17582 if let common::Retry::After(d) =
17583 dlg.http_failure(&response, error.as_ref().ok())
17584 {
17585 sleep(d).await;
17586 continue;
17587 }
17588
17589 dlg.finished(false);
17590
17591 return Err(match error {
17592 Ok(value) => common::Error::BadRequest(value),
17593 _ => common::Error::Failure(response),
17594 });
17595 }
17596 let response = {
17597 let bytes = common::to_bytes(body).await.unwrap_or_default();
17598 let encoded = common::to_string(&bytes);
17599 match serde_json::from_str(&encoded) {
17600 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17601 Err(error) => {
17602 dlg.response_json_decode_error(&encoded, &error);
17603 return Err(common::Error::JsonDecodeError(
17604 encoded.to_string(),
17605 error,
17606 ));
17607 }
17608 }
17609 };
17610
17611 dlg.finished(true);
17612 return Ok(response);
17613 }
17614 }
17615 }
17616 }
17617
17618 ///
17619 /// Sets the *request* property to the given value.
17620 ///
17621 /// Even though the property as already been set when instantiating this call,
17622 /// we provide this method for API completeness.
17623 pub fn request(
17624 mut self,
17625 new_value: GtagConfig,
17626 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17627 self._request = new_value;
17628 self
17629 }
17630 /// Google tag config's API relative path.
17631 ///
17632 /// Sets the *path* path property to the given value.
17633 ///
17634 /// Even though the property as already been set when instantiating this call,
17635 /// we provide this method for API completeness.
17636 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17637 self._path = new_value.to_string();
17638 self
17639 }
17640 /// When provided, this fingerprint must match the fingerprint of the config in storage.
17641 ///
17642 /// Sets the *fingerprint* query property to the given value.
17643 pub fn fingerprint(
17644 mut self,
17645 new_value: &str,
17646 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17647 self._fingerprint = Some(new_value.to_string());
17648 self
17649 }
17650 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17651 /// while executing the actual API request.
17652 ///
17653 /// ````text
17654 /// It should be used to handle progress information, and to implement a certain level of resilience.
17655 /// ````
17656 ///
17657 /// Sets the *delegate* property to the given value.
17658 pub fn delegate(
17659 mut self,
17660 new_value: &'a mut dyn common::Delegate,
17661 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17662 self._delegate = Some(new_value);
17663 self
17664 }
17665
17666 /// Set any additional parameter of the query string used in the request.
17667 /// It should be used to set parameters which are not yet available through their own
17668 /// setters.
17669 ///
17670 /// Please note that this method must not be used to set any of the known parameters
17671 /// which have their own setter method. If done anyway, the request will fail.
17672 ///
17673 /// # Additional Parameters
17674 ///
17675 /// * *$.xgafv* (query-string) - V1 error format.
17676 /// * *access_token* (query-string) - OAuth access token.
17677 /// * *alt* (query-string) - Data format for response.
17678 /// * *callback* (query-string) - JSONP
17679 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17680 /// * *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.
17681 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17682 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17683 /// * *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.
17684 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17685 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17686 pub fn param<T>(
17687 mut self,
17688 name: T,
17689 value: T,
17690 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17691 where
17692 T: AsRef<str>,
17693 {
17694 self._additional_params
17695 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17696 self
17697 }
17698
17699 /// Identifies the authorization scope for the method you are building.
17700 ///
17701 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17702 /// [`Scope::EditContainer`].
17703 ///
17704 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17705 /// tokens for more than one scope.
17706 ///
17707 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17708 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17709 /// sufficient, a read-write scope will do as well.
17710 pub fn add_scope<St>(
17711 mut self,
17712 scope: St,
17713 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17714 where
17715 St: AsRef<str>,
17716 {
17717 self._scopes.insert(String::from(scope.as_ref()));
17718 self
17719 }
17720 /// Identifies the authorization scope(s) for the method you are building.
17721 ///
17722 /// See [`Self::add_scope()`] for details.
17723 pub fn add_scopes<I, St>(
17724 mut self,
17725 scopes: I,
17726 ) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C>
17727 where
17728 I: IntoIterator<Item = St>,
17729 St: AsRef<str>,
17730 {
17731 self._scopes
17732 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17733 self
17734 }
17735
17736 /// Removes all scopes, and no default scope will be used either.
17737 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17738 /// for details).
17739 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGtagConfigUpdateCall<'a, C> {
17740 self._scopes.clear();
17741 self
17742 }
17743}
17744
17745/// Creates a GTM Tag.
17746///
17747/// A builder for the *containers.workspaces.tags.create* method supported by a *account* resource.
17748/// It is not used directly, but through a [`AccountMethods`] instance.
17749///
17750/// # Example
17751///
17752/// Instantiate a resource method builder
17753///
17754/// ```test_harness,no_run
17755/// # extern crate hyper;
17756/// # extern crate hyper_rustls;
17757/// # extern crate google_tagmanager2 as tagmanager2;
17758/// use tagmanager2::api::Tag;
17759/// # async fn dox() {
17760/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17761///
17762/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17763/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17764/// # .with_native_roots()
17765/// # .unwrap()
17766/// # .https_only()
17767/// # .enable_http2()
17768/// # .build();
17769///
17770/// # let executor = hyper_util::rt::TokioExecutor::new();
17771/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17772/// # secret,
17773/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17774/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17775/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17776/// # ),
17777/// # ).build().await.unwrap();
17778///
17779/// # let client = hyper_util::client::legacy::Client::builder(
17780/// # hyper_util::rt::TokioExecutor::new()
17781/// # )
17782/// # .build(
17783/// # hyper_rustls::HttpsConnectorBuilder::new()
17784/// # .with_native_roots()
17785/// # .unwrap()
17786/// # .https_or_http()
17787/// # .enable_http2()
17788/// # .build()
17789/// # );
17790/// # let mut hub = TagManager::new(client, auth);
17791/// // As the method needs a request, you would usually fill it with the desired information
17792/// // into the respective structure. Some of the parts shown here might not be applicable !
17793/// // Values shown here are possibly random and not representative !
17794/// let mut req = Tag::default();
17795///
17796/// // You can configure optional parameters by calling the respective setters at will, and
17797/// // execute the final call using `doit()`.
17798/// // Values shown here are possibly random and not representative !
17799/// let result = hub.accounts().containers_workspaces_tags_create(req, "parent")
17800/// .doit().await;
17801/// # }
17802/// ```
17803pub struct AccountContainerWorkspaceTagCreateCall<'a, C>
17804where
17805 C: 'a,
17806{
17807 hub: &'a TagManager<C>,
17808 _request: Tag,
17809 _parent: String,
17810 _delegate: Option<&'a mut dyn common::Delegate>,
17811 _additional_params: HashMap<String, String>,
17812 _scopes: BTreeSet<String>,
17813}
17814
17815impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagCreateCall<'a, C> {}
17816
17817impl<'a, C> AccountContainerWorkspaceTagCreateCall<'a, C>
17818where
17819 C: common::Connector,
17820{
17821 /// Perform the operation you have build so far.
17822 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
17823 use std::borrow::Cow;
17824 use std::io::{Read, Seek};
17825
17826 use common::{url::Params, ToParts};
17827 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17828
17829 let mut dd = common::DefaultDelegate;
17830 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17831 dlg.begin(common::MethodInfo {
17832 id: "tagmanager.accounts.containers.workspaces.tags.create",
17833 http_method: hyper::Method::POST,
17834 });
17835
17836 for &field in ["alt", "parent"].iter() {
17837 if self._additional_params.contains_key(field) {
17838 dlg.finished(false);
17839 return Err(common::Error::FieldClash(field));
17840 }
17841 }
17842
17843 let mut params = Params::with_capacity(4 + self._additional_params.len());
17844 params.push("parent", self._parent);
17845
17846 params.extend(self._additional_params.iter());
17847
17848 params.push("alt", "json");
17849 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/tags";
17850 if self._scopes.is_empty() {
17851 self._scopes
17852 .insert(Scope::EditContainer.as_ref().to_string());
17853 }
17854
17855 #[allow(clippy::single_element_loop)]
17856 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17857 url = params.uri_replacement(url, param_name, find_this, true);
17858 }
17859 {
17860 let to_remove = ["parent"];
17861 params.remove_params(&to_remove);
17862 }
17863
17864 let url = params.parse_with_url(&url);
17865
17866 let mut json_mime_type = mime::APPLICATION_JSON;
17867 let mut request_value_reader = {
17868 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17869 common::remove_json_null_values(&mut value);
17870 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17871 serde_json::to_writer(&mut dst, &value).unwrap();
17872 dst
17873 };
17874 let request_size = request_value_reader
17875 .seek(std::io::SeekFrom::End(0))
17876 .unwrap();
17877 request_value_reader
17878 .seek(std::io::SeekFrom::Start(0))
17879 .unwrap();
17880
17881 loop {
17882 let token = match self
17883 .hub
17884 .auth
17885 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17886 .await
17887 {
17888 Ok(token) => token,
17889 Err(e) => match dlg.token(e) {
17890 Ok(token) => token,
17891 Err(e) => {
17892 dlg.finished(false);
17893 return Err(common::Error::MissingToken(e));
17894 }
17895 },
17896 };
17897 request_value_reader
17898 .seek(std::io::SeekFrom::Start(0))
17899 .unwrap();
17900 let mut req_result = {
17901 let client = &self.hub.client;
17902 dlg.pre_request();
17903 let mut req_builder = hyper::Request::builder()
17904 .method(hyper::Method::POST)
17905 .uri(url.as_str())
17906 .header(USER_AGENT, self.hub._user_agent.clone());
17907
17908 if let Some(token) = token.as_ref() {
17909 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17910 }
17911
17912 let request = req_builder
17913 .header(CONTENT_TYPE, json_mime_type.to_string())
17914 .header(CONTENT_LENGTH, request_size as u64)
17915 .body(common::to_body(
17916 request_value_reader.get_ref().clone().into(),
17917 ));
17918
17919 client.request(request.unwrap()).await
17920 };
17921
17922 match req_result {
17923 Err(err) => {
17924 if let common::Retry::After(d) = dlg.http_error(&err) {
17925 sleep(d).await;
17926 continue;
17927 }
17928 dlg.finished(false);
17929 return Err(common::Error::HttpError(err));
17930 }
17931 Ok(res) => {
17932 let (mut parts, body) = res.into_parts();
17933 let mut body = common::Body::new(body);
17934 if !parts.status.is_success() {
17935 let bytes = common::to_bytes(body).await.unwrap_or_default();
17936 let error = serde_json::from_str(&common::to_string(&bytes));
17937 let response = common::to_response(parts, bytes.into());
17938
17939 if let common::Retry::After(d) =
17940 dlg.http_failure(&response, error.as_ref().ok())
17941 {
17942 sleep(d).await;
17943 continue;
17944 }
17945
17946 dlg.finished(false);
17947
17948 return Err(match error {
17949 Ok(value) => common::Error::BadRequest(value),
17950 _ => common::Error::Failure(response),
17951 });
17952 }
17953 let response = {
17954 let bytes = common::to_bytes(body).await.unwrap_or_default();
17955 let encoded = common::to_string(&bytes);
17956 match serde_json::from_str(&encoded) {
17957 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17958 Err(error) => {
17959 dlg.response_json_decode_error(&encoded, &error);
17960 return Err(common::Error::JsonDecodeError(
17961 encoded.to_string(),
17962 error,
17963 ));
17964 }
17965 }
17966 };
17967
17968 dlg.finished(true);
17969 return Ok(response);
17970 }
17971 }
17972 }
17973 }
17974
17975 ///
17976 /// Sets the *request* 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 request(mut self, new_value: Tag) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17981 self._request = new_value;
17982 self
17983 }
17984 /// GTM Workspace's API relative path.
17985 ///
17986 /// Sets the *parent* path property to the given value.
17987 ///
17988 /// Even though the property as already been set when instantiating this call,
17989 /// we provide this method for API completeness.
17990 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
17991 self._parent = new_value.to_string();
17992 self
17993 }
17994 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17995 /// while executing the actual API request.
17996 ///
17997 /// ````text
17998 /// It should be used to handle progress information, and to implement a certain level of resilience.
17999 /// ````
18000 ///
18001 /// Sets the *delegate* property to the given value.
18002 pub fn delegate(
18003 mut self,
18004 new_value: &'a mut dyn common::Delegate,
18005 ) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
18006 self._delegate = Some(new_value);
18007 self
18008 }
18009
18010 /// Set any additional parameter of the query string used in the request.
18011 /// It should be used to set parameters which are not yet available through their own
18012 /// setters.
18013 ///
18014 /// Please note that this method must not be used to set any of the known parameters
18015 /// which have their own setter method. If done anyway, the request will fail.
18016 ///
18017 /// # Additional Parameters
18018 ///
18019 /// * *$.xgafv* (query-string) - V1 error format.
18020 /// * *access_token* (query-string) - OAuth access token.
18021 /// * *alt* (query-string) - Data format for response.
18022 /// * *callback* (query-string) - JSONP
18023 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18024 /// * *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.
18025 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18026 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18027 /// * *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.
18028 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18029 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18030 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagCreateCall<'a, C>
18031 where
18032 T: AsRef<str>,
18033 {
18034 self._additional_params
18035 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18036 self
18037 }
18038
18039 /// Identifies the authorization scope for the method you are building.
18040 ///
18041 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18042 /// [`Scope::EditContainer`].
18043 ///
18044 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18045 /// tokens for more than one scope.
18046 ///
18047 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18048 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18049 /// sufficient, a read-write scope will do as well.
18050 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagCreateCall<'a, C>
18051 where
18052 St: AsRef<str>,
18053 {
18054 self._scopes.insert(String::from(scope.as_ref()));
18055 self
18056 }
18057 /// Identifies the authorization scope(s) for the method you are building.
18058 ///
18059 /// See [`Self::add_scope()`] for details.
18060 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagCreateCall<'a, C>
18061 where
18062 I: IntoIterator<Item = St>,
18063 St: AsRef<str>,
18064 {
18065 self._scopes
18066 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18067 self
18068 }
18069
18070 /// Removes all scopes, and no default scope will be used either.
18071 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18072 /// for details).
18073 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagCreateCall<'a, C> {
18074 self._scopes.clear();
18075 self
18076 }
18077}
18078
18079/// Deletes a GTM Tag.
18080///
18081/// A builder for the *containers.workspaces.tags.delete* method supported by a *account* resource.
18082/// It is not used directly, but through a [`AccountMethods`] instance.
18083///
18084/// # Example
18085///
18086/// Instantiate a resource method builder
18087///
18088/// ```test_harness,no_run
18089/// # extern crate hyper;
18090/// # extern crate hyper_rustls;
18091/// # extern crate google_tagmanager2 as tagmanager2;
18092/// # async fn dox() {
18093/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18094///
18095/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18096/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18097/// # .with_native_roots()
18098/// # .unwrap()
18099/// # .https_only()
18100/// # .enable_http2()
18101/// # .build();
18102///
18103/// # let executor = hyper_util::rt::TokioExecutor::new();
18104/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18105/// # secret,
18106/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18107/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18108/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18109/// # ),
18110/// # ).build().await.unwrap();
18111///
18112/// # let client = hyper_util::client::legacy::Client::builder(
18113/// # hyper_util::rt::TokioExecutor::new()
18114/// # )
18115/// # .build(
18116/// # hyper_rustls::HttpsConnectorBuilder::new()
18117/// # .with_native_roots()
18118/// # .unwrap()
18119/// # .https_or_http()
18120/// # .enable_http2()
18121/// # .build()
18122/// # );
18123/// # let mut hub = TagManager::new(client, auth);
18124/// // You can configure optional parameters by calling the respective setters at will, and
18125/// // execute the final call using `doit()`.
18126/// // Values shown here are possibly random and not representative !
18127/// let result = hub.accounts().containers_workspaces_tags_delete("path")
18128/// .doit().await;
18129/// # }
18130/// ```
18131pub struct AccountContainerWorkspaceTagDeleteCall<'a, C>
18132where
18133 C: 'a,
18134{
18135 hub: &'a TagManager<C>,
18136 _path: String,
18137 _delegate: Option<&'a mut dyn common::Delegate>,
18138 _additional_params: HashMap<String, String>,
18139 _scopes: BTreeSet<String>,
18140}
18141
18142impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagDeleteCall<'a, C> {}
18143
18144impl<'a, C> AccountContainerWorkspaceTagDeleteCall<'a, C>
18145where
18146 C: common::Connector,
18147{
18148 /// Perform the operation you have build so far.
18149 pub async fn doit(mut self) -> common::Result<common::Response> {
18150 use std::borrow::Cow;
18151 use std::io::{Read, Seek};
18152
18153 use common::{url::Params, ToParts};
18154 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18155
18156 let mut dd = common::DefaultDelegate;
18157 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18158 dlg.begin(common::MethodInfo {
18159 id: "tagmanager.accounts.containers.workspaces.tags.delete",
18160 http_method: hyper::Method::DELETE,
18161 });
18162
18163 for &field in ["path"].iter() {
18164 if self._additional_params.contains_key(field) {
18165 dlg.finished(false);
18166 return Err(common::Error::FieldClash(field));
18167 }
18168 }
18169
18170 let mut params = Params::with_capacity(2 + self._additional_params.len());
18171 params.push("path", self._path);
18172
18173 params.extend(self._additional_params.iter());
18174
18175 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
18176 if self._scopes.is_empty() {
18177 self._scopes
18178 .insert(Scope::EditContainer.as_ref().to_string());
18179 }
18180
18181 #[allow(clippy::single_element_loop)]
18182 for &(find_this, param_name) in [("{+path}", "path")].iter() {
18183 url = params.uri_replacement(url, param_name, find_this, true);
18184 }
18185 {
18186 let to_remove = ["path"];
18187 params.remove_params(&to_remove);
18188 }
18189
18190 let url = params.parse_with_url(&url);
18191
18192 loop {
18193 let token = match self
18194 .hub
18195 .auth
18196 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18197 .await
18198 {
18199 Ok(token) => token,
18200 Err(e) => match dlg.token(e) {
18201 Ok(token) => token,
18202 Err(e) => {
18203 dlg.finished(false);
18204 return Err(common::Error::MissingToken(e));
18205 }
18206 },
18207 };
18208 let mut req_result = {
18209 let client = &self.hub.client;
18210 dlg.pre_request();
18211 let mut req_builder = hyper::Request::builder()
18212 .method(hyper::Method::DELETE)
18213 .uri(url.as_str())
18214 .header(USER_AGENT, self.hub._user_agent.clone());
18215
18216 if let Some(token) = token.as_ref() {
18217 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18218 }
18219
18220 let request = req_builder
18221 .header(CONTENT_LENGTH, 0_u64)
18222 .body(common::to_body::<String>(None));
18223
18224 client.request(request.unwrap()).await
18225 };
18226
18227 match req_result {
18228 Err(err) => {
18229 if let common::Retry::After(d) = dlg.http_error(&err) {
18230 sleep(d).await;
18231 continue;
18232 }
18233 dlg.finished(false);
18234 return Err(common::Error::HttpError(err));
18235 }
18236 Ok(res) => {
18237 let (mut parts, body) = res.into_parts();
18238 let mut body = common::Body::new(body);
18239 if !parts.status.is_success() {
18240 let bytes = common::to_bytes(body).await.unwrap_or_default();
18241 let error = serde_json::from_str(&common::to_string(&bytes));
18242 let response = common::to_response(parts, bytes.into());
18243
18244 if let common::Retry::After(d) =
18245 dlg.http_failure(&response, error.as_ref().ok())
18246 {
18247 sleep(d).await;
18248 continue;
18249 }
18250
18251 dlg.finished(false);
18252
18253 return Err(match error {
18254 Ok(value) => common::Error::BadRequest(value),
18255 _ => common::Error::Failure(response),
18256 });
18257 }
18258 let response = common::Response::from_parts(parts, body);
18259
18260 dlg.finished(true);
18261 return Ok(response);
18262 }
18263 }
18264 }
18265 }
18266
18267 /// GTM Tag's API relative path.
18268 ///
18269 /// Sets the *path* path property to the given value.
18270 ///
18271 /// Even though the property as already been set when instantiating this call,
18272 /// we provide this method for API completeness.
18273 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
18274 self._path = new_value.to_string();
18275 self
18276 }
18277 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18278 /// while executing the actual API request.
18279 ///
18280 /// ````text
18281 /// It should be used to handle progress information, and to implement a certain level of resilience.
18282 /// ````
18283 ///
18284 /// Sets the *delegate* property to the given value.
18285 pub fn delegate(
18286 mut self,
18287 new_value: &'a mut dyn common::Delegate,
18288 ) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
18289 self._delegate = Some(new_value);
18290 self
18291 }
18292
18293 /// Set any additional parameter of the query string used in the request.
18294 /// It should be used to set parameters which are not yet available through their own
18295 /// setters.
18296 ///
18297 /// Please note that this method must not be used to set any of the known parameters
18298 /// which have their own setter method. If done anyway, the request will fail.
18299 ///
18300 /// # Additional Parameters
18301 ///
18302 /// * *$.xgafv* (query-string) - V1 error format.
18303 /// * *access_token* (query-string) - OAuth access token.
18304 /// * *alt* (query-string) - Data format for response.
18305 /// * *callback* (query-string) - JSONP
18306 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18307 /// * *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.
18308 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18309 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18310 /// * *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.
18311 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18312 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18313 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
18314 where
18315 T: AsRef<str>,
18316 {
18317 self._additional_params
18318 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18319 self
18320 }
18321
18322 /// Identifies the authorization scope for the method you are building.
18323 ///
18324 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18325 /// [`Scope::EditContainer`].
18326 ///
18327 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18328 /// tokens for more than one scope.
18329 ///
18330 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18331 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18332 /// sufficient, a read-write scope will do as well.
18333 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
18334 where
18335 St: AsRef<str>,
18336 {
18337 self._scopes.insert(String::from(scope.as_ref()));
18338 self
18339 }
18340 /// Identifies the authorization scope(s) for the method you are building.
18341 ///
18342 /// See [`Self::add_scope()`] for details.
18343 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagDeleteCall<'a, C>
18344 where
18345 I: IntoIterator<Item = St>,
18346 St: AsRef<str>,
18347 {
18348 self._scopes
18349 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18350 self
18351 }
18352
18353 /// Removes all scopes, and no default scope will be used either.
18354 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18355 /// for details).
18356 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagDeleteCall<'a, C> {
18357 self._scopes.clear();
18358 self
18359 }
18360}
18361
18362/// Gets a GTM Tag.
18363///
18364/// A builder for the *containers.workspaces.tags.get* method supported by a *account* resource.
18365/// It is not used directly, but through a [`AccountMethods`] instance.
18366///
18367/// # Example
18368///
18369/// Instantiate a resource method builder
18370///
18371/// ```test_harness,no_run
18372/// # extern crate hyper;
18373/// # extern crate hyper_rustls;
18374/// # extern crate google_tagmanager2 as tagmanager2;
18375/// # async fn dox() {
18376/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18377///
18378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18379/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18380/// # .with_native_roots()
18381/// # .unwrap()
18382/// # .https_only()
18383/// # .enable_http2()
18384/// # .build();
18385///
18386/// # let executor = hyper_util::rt::TokioExecutor::new();
18387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18388/// # secret,
18389/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18390/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18391/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18392/// # ),
18393/// # ).build().await.unwrap();
18394///
18395/// # let client = hyper_util::client::legacy::Client::builder(
18396/// # hyper_util::rt::TokioExecutor::new()
18397/// # )
18398/// # .build(
18399/// # hyper_rustls::HttpsConnectorBuilder::new()
18400/// # .with_native_roots()
18401/// # .unwrap()
18402/// # .https_or_http()
18403/// # .enable_http2()
18404/// # .build()
18405/// # );
18406/// # let mut hub = TagManager::new(client, auth);
18407/// // You can configure optional parameters by calling the respective setters at will, and
18408/// // execute the final call using `doit()`.
18409/// // Values shown here are possibly random and not representative !
18410/// let result = hub.accounts().containers_workspaces_tags_get("path")
18411/// .doit().await;
18412/// # }
18413/// ```
18414pub struct AccountContainerWorkspaceTagGetCall<'a, C>
18415where
18416 C: 'a,
18417{
18418 hub: &'a TagManager<C>,
18419 _path: String,
18420 _delegate: Option<&'a mut dyn common::Delegate>,
18421 _additional_params: HashMap<String, String>,
18422 _scopes: BTreeSet<String>,
18423}
18424
18425impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagGetCall<'a, C> {}
18426
18427impl<'a, C> AccountContainerWorkspaceTagGetCall<'a, C>
18428where
18429 C: common::Connector,
18430{
18431 /// Perform the operation you have build so far.
18432 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
18433 use std::borrow::Cow;
18434 use std::io::{Read, Seek};
18435
18436 use common::{url::Params, ToParts};
18437 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18438
18439 let mut dd = common::DefaultDelegate;
18440 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18441 dlg.begin(common::MethodInfo {
18442 id: "tagmanager.accounts.containers.workspaces.tags.get",
18443 http_method: hyper::Method::GET,
18444 });
18445
18446 for &field in ["alt", "path"].iter() {
18447 if self._additional_params.contains_key(field) {
18448 dlg.finished(false);
18449 return Err(common::Error::FieldClash(field));
18450 }
18451 }
18452
18453 let mut params = Params::with_capacity(3 + self._additional_params.len());
18454 params.push("path", self._path);
18455
18456 params.extend(self._additional_params.iter());
18457
18458 params.push("alt", "json");
18459 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
18460 if self._scopes.is_empty() {
18461 self._scopes.insert(Scope::Readonly.as_ref().to_string());
18462 }
18463
18464 #[allow(clippy::single_element_loop)]
18465 for &(find_this, param_name) in [("{+path}", "path")].iter() {
18466 url = params.uri_replacement(url, param_name, find_this, true);
18467 }
18468 {
18469 let to_remove = ["path"];
18470 params.remove_params(&to_remove);
18471 }
18472
18473 let url = params.parse_with_url(&url);
18474
18475 loop {
18476 let token = match self
18477 .hub
18478 .auth
18479 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18480 .await
18481 {
18482 Ok(token) => token,
18483 Err(e) => match dlg.token(e) {
18484 Ok(token) => token,
18485 Err(e) => {
18486 dlg.finished(false);
18487 return Err(common::Error::MissingToken(e));
18488 }
18489 },
18490 };
18491 let mut req_result = {
18492 let client = &self.hub.client;
18493 dlg.pre_request();
18494 let mut req_builder = hyper::Request::builder()
18495 .method(hyper::Method::GET)
18496 .uri(url.as_str())
18497 .header(USER_AGENT, self.hub._user_agent.clone());
18498
18499 if let Some(token) = token.as_ref() {
18500 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18501 }
18502
18503 let request = req_builder
18504 .header(CONTENT_LENGTH, 0_u64)
18505 .body(common::to_body::<String>(None));
18506
18507 client.request(request.unwrap()).await
18508 };
18509
18510 match req_result {
18511 Err(err) => {
18512 if let common::Retry::After(d) = dlg.http_error(&err) {
18513 sleep(d).await;
18514 continue;
18515 }
18516 dlg.finished(false);
18517 return Err(common::Error::HttpError(err));
18518 }
18519 Ok(res) => {
18520 let (mut parts, body) = res.into_parts();
18521 let mut body = common::Body::new(body);
18522 if !parts.status.is_success() {
18523 let bytes = common::to_bytes(body).await.unwrap_or_default();
18524 let error = serde_json::from_str(&common::to_string(&bytes));
18525 let response = common::to_response(parts, bytes.into());
18526
18527 if let common::Retry::After(d) =
18528 dlg.http_failure(&response, error.as_ref().ok())
18529 {
18530 sleep(d).await;
18531 continue;
18532 }
18533
18534 dlg.finished(false);
18535
18536 return Err(match error {
18537 Ok(value) => common::Error::BadRequest(value),
18538 _ => common::Error::Failure(response),
18539 });
18540 }
18541 let response = {
18542 let bytes = common::to_bytes(body).await.unwrap_or_default();
18543 let encoded = common::to_string(&bytes);
18544 match serde_json::from_str(&encoded) {
18545 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18546 Err(error) => {
18547 dlg.response_json_decode_error(&encoded, &error);
18548 return Err(common::Error::JsonDecodeError(
18549 encoded.to_string(),
18550 error,
18551 ));
18552 }
18553 }
18554 };
18555
18556 dlg.finished(true);
18557 return Ok(response);
18558 }
18559 }
18560 }
18561 }
18562
18563 /// GTM Tag's API relative path.
18564 ///
18565 /// Sets the *path* path property to the given value.
18566 ///
18567 /// Even though the property as already been set when instantiating this call,
18568 /// we provide this method for API completeness.
18569 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagGetCall<'a, C> {
18570 self._path = new_value.to_string();
18571 self
18572 }
18573 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18574 /// while executing the actual API request.
18575 ///
18576 /// ````text
18577 /// It should be used to handle progress information, and to implement a certain level of resilience.
18578 /// ````
18579 ///
18580 /// Sets the *delegate* property to the given value.
18581 pub fn delegate(
18582 mut self,
18583 new_value: &'a mut dyn common::Delegate,
18584 ) -> AccountContainerWorkspaceTagGetCall<'a, C> {
18585 self._delegate = Some(new_value);
18586 self
18587 }
18588
18589 /// Set any additional parameter of the query string used in the request.
18590 /// It should be used to set parameters which are not yet available through their own
18591 /// setters.
18592 ///
18593 /// Please note that this method must not be used to set any of the known parameters
18594 /// which have their own setter method. If done anyway, the request will fail.
18595 ///
18596 /// # Additional Parameters
18597 ///
18598 /// * *$.xgafv* (query-string) - V1 error format.
18599 /// * *access_token* (query-string) - OAuth access token.
18600 /// * *alt* (query-string) - Data format for response.
18601 /// * *callback* (query-string) - JSONP
18602 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18603 /// * *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.
18604 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18605 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18606 /// * *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.
18607 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18608 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18609 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagGetCall<'a, C>
18610 where
18611 T: AsRef<str>,
18612 {
18613 self._additional_params
18614 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18615 self
18616 }
18617
18618 /// Identifies the authorization scope for the method you are building.
18619 ///
18620 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18621 /// [`Scope::Readonly`].
18622 ///
18623 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18624 /// tokens for more than one scope.
18625 ///
18626 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18627 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18628 /// sufficient, a read-write scope will do as well.
18629 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagGetCall<'a, C>
18630 where
18631 St: AsRef<str>,
18632 {
18633 self._scopes.insert(String::from(scope.as_ref()));
18634 self
18635 }
18636 /// Identifies the authorization scope(s) for the method you are building.
18637 ///
18638 /// See [`Self::add_scope()`] for details.
18639 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagGetCall<'a, C>
18640 where
18641 I: IntoIterator<Item = St>,
18642 St: AsRef<str>,
18643 {
18644 self._scopes
18645 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18646 self
18647 }
18648
18649 /// Removes all scopes, and no default scope will be used either.
18650 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18651 /// for details).
18652 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagGetCall<'a, C> {
18653 self._scopes.clear();
18654 self
18655 }
18656}
18657
18658/// Lists all GTM Tags of a Container.
18659///
18660/// A builder for the *containers.workspaces.tags.list* method supported by a *account* resource.
18661/// It is not used directly, but through a [`AccountMethods`] instance.
18662///
18663/// # Example
18664///
18665/// Instantiate a resource method builder
18666///
18667/// ```test_harness,no_run
18668/// # extern crate hyper;
18669/// # extern crate hyper_rustls;
18670/// # extern crate google_tagmanager2 as tagmanager2;
18671/// # async fn dox() {
18672/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18673///
18674/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18675/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18676/// # .with_native_roots()
18677/// # .unwrap()
18678/// # .https_only()
18679/// # .enable_http2()
18680/// # .build();
18681///
18682/// # let executor = hyper_util::rt::TokioExecutor::new();
18683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18684/// # secret,
18685/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18686/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18687/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18688/// # ),
18689/// # ).build().await.unwrap();
18690///
18691/// # let client = hyper_util::client::legacy::Client::builder(
18692/// # hyper_util::rt::TokioExecutor::new()
18693/// # )
18694/// # .build(
18695/// # hyper_rustls::HttpsConnectorBuilder::new()
18696/// # .with_native_roots()
18697/// # .unwrap()
18698/// # .https_or_http()
18699/// # .enable_http2()
18700/// # .build()
18701/// # );
18702/// # let mut hub = TagManager::new(client, auth);
18703/// // You can configure optional parameters by calling the respective setters at will, and
18704/// // execute the final call using `doit()`.
18705/// // Values shown here are possibly random and not representative !
18706/// let result = hub.accounts().containers_workspaces_tags_list("parent")
18707/// .page_token("At")
18708/// .doit().await;
18709/// # }
18710/// ```
18711pub struct AccountContainerWorkspaceTagListCall<'a, C>
18712where
18713 C: 'a,
18714{
18715 hub: &'a TagManager<C>,
18716 _parent: String,
18717 _page_token: Option<String>,
18718 _delegate: Option<&'a mut dyn common::Delegate>,
18719 _additional_params: HashMap<String, String>,
18720 _scopes: BTreeSet<String>,
18721}
18722
18723impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagListCall<'a, C> {}
18724
18725impl<'a, C> AccountContainerWorkspaceTagListCall<'a, C>
18726where
18727 C: common::Connector,
18728{
18729 /// Perform the operation you have build so far.
18730 pub async fn doit(mut self) -> common::Result<(common::Response, ListTagsResponse)> {
18731 use std::borrow::Cow;
18732 use std::io::{Read, Seek};
18733
18734 use common::{url::Params, ToParts};
18735 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18736
18737 let mut dd = common::DefaultDelegate;
18738 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18739 dlg.begin(common::MethodInfo {
18740 id: "tagmanager.accounts.containers.workspaces.tags.list",
18741 http_method: hyper::Method::GET,
18742 });
18743
18744 for &field in ["alt", "parent", "pageToken"].iter() {
18745 if self._additional_params.contains_key(field) {
18746 dlg.finished(false);
18747 return Err(common::Error::FieldClash(field));
18748 }
18749 }
18750
18751 let mut params = Params::with_capacity(4 + self._additional_params.len());
18752 params.push("parent", self._parent);
18753 if let Some(value) = self._page_token.as_ref() {
18754 params.push("pageToken", value);
18755 }
18756
18757 params.extend(self._additional_params.iter());
18758
18759 params.push("alt", "json");
18760 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/tags";
18761 if self._scopes.is_empty() {
18762 self._scopes.insert(Scope::Readonly.as_ref().to_string());
18763 }
18764
18765 #[allow(clippy::single_element_loop)]
18766 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18767 url = params.uri_replacement(url, param_name, find_this, true);
18768 }
18769 {
18770 let to_remove = ["parent"];
18771 params.remove_params(&to_remove);
18772 }
18773
18774 let url = params.parse_with_url(&url);
18775
18776 loop {
18777 let token = match self
18778 .hub
18779 .auth
18780 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18781 .await
18782 {
18783 Ok(token) => token,
18784 Err(e) => match dlg.token(e) {
18785 Ok(token) => token,
18786 Err(e) => {
18787 dlg.finished(false);
18788 return Err(common::Error::MissingToken(e));
18789 }
18790 },
18791 };
18792 let mut req_result = {
18793 let client = &self.hub.client;
18794 dlg.pre_request();
18795 let mut req_builder = hyper::Request::builder()
18796 .method(hyper::Method::GET)
18797 .uri(url.as_str())
18798 .header(USER_AGENT, self.hub._user_agent.clone());
18799
18800 if let Some(token) = token.as_ref() {
18801 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18802 }
18803
18804 let request = req_builder
18805 .header(CONTENT_LENGTH, 0_u64)
18806 .body(common::to_body::<String>(None));
18807
18808 client.request(request.unwrap()).await
18809 };
18810
18811 match req_result {
18812 Err(err) => {
18813 if let common::Retry::After(d) = dlg.http_error(&err) {
18814 sleep(d).await;
18815 continue;
18816 }
18817 dlg.finished(false);
18818 return Err(common::Error::HttpError(err));
18819 }
18820 Ok(res) => {
18821 let (mut parts, body) = res.into_parts();
18822 let mut body = common::Body::new(body);
18823 if !parts.status.is_success() {
18824 let bytes = common::to_bytes(body).await.unwrap_or_default();
18825 let error = serde_json::from_str(&common::to_string(&bytes));
18826 let response = common::to_response(parts, bytes.into());
18827
18828 if let common::Retry::After(d) =
18829 dlg.http_failure(&response, error.as_ref().ok())
18830 {
18831 sleep(d).await;
18832 continue;
18833 }
18834
18835 dlg.finished(false);
18836
18837 return Err(match error {
18838 Ok(value) => common::Error::BadRequest(value),
18839 _ => common::Error::Failure(response),
18840 });
18841 }
18842 let response = {
18843 let bytes = common::to_bytes(body).await.unwrap_or_default();
18844 let encoded = common::to_string(&bytes);
18845 match serde_json::from_str(&encoded) {
18846 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18847 Err(error) => {
18848 dlg.response_json_decode_error(&encoded, &error);
18849 return Err(common::Error::JsonDecodeError(
18850 encoded.to_string(),
18851 error,
18852 ));
18853 }
18854 }
18855 };
18856
18857 dlg.finished(true);
18858 return Ok(response);
18859 }
18860 }
18861 }
18862 }
18863
18864 /// GTM Workspace's API relative path.
18865 ///
18866 /// Sets the *parent* path property to the given value.
18867 ///
18868 /// Even though the property as already been set when instantiating this call,
18869 /// we provide this method for API completeness.
18870 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTagListCall<'a, C> {
18871 self._parent = new_value.to_string();
18872 self
18873 }
18874 /// Continuation token for fetching the next page of results.
18875 ///
18876 /// Sets the *page token* query property to the given value.
18877 pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceTagListCall<'a, C> {
18878 self._page_token = Some(new_value.to_string());
18879 self
18880 }
18881 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18882 /// while executing the actual API request.
18883 ///
18884 /// ````text
18885 /// It should be used to handle progress information, and to implement a certain level of resilience.
18886 /// ````
18887 ///
18888 /// Sets the *delegate* property to the given value.
18889 pub fn delegate(
18890 mut self,
18891 new_value: &'a mut dyn common::Delegate,
18892 ) -> AccountContainerWorkspaceTagListCall<'a, C> {
18893 self._delegate = Some(new_value);
18894 self
18895 }
18896
18897 /// Set any additional parameter of the query string used in the request.
18898 /// It should be used to set parameters which are not yet available through their own
18899 /// setters.
18900 ///
18901 /// Please note that this method must not be used to set any of the known parameters
18902 /// which have their own setter method. If done anyway, the request will fail.
18903 ///
18904 /// # Additional Parameters
18905 ///
18906 /// * *$.xgafv* (query-string) - V1 error format.
18907 /// * *access_token* (query-string) - OAuth access token.
18908 /// * *alt* (query-string) - Data format for response.
18909 /// * *callback* (query-string) - JSONP
18910 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18911 /// * *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.
18912 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18913 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18914 /// * *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.
18915 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18916 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18917 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagListCall<'a, C>
18918 where
18919 T: AsRef<str>,
18920 {
18921 self._additional_params
18922 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18923 self
18924 }
18925
18926 /// Identifies the authorization scope for the method you are building.
18927 ///
18928 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18929 /// [`Scope::Readonly`].
18930 ///
18931 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18932 /// tokens for more than one scope.
18933 ///
18934 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18935 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18936 /// sufficient, a read-write scope will do as well.
18937 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagListCall<'a, C>
18938 where
18939 St: AsRef<str>,
18940 {
18941 self._scopes.insert(String::from(scope.as_ref()));
18942 self
18943 }
18944 /// Identifies the authorization scope(s) for the method you are building.
18945 ///
18946 /// See [`Self::add_scope()`] for details.
18947 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagListCall<'a, C>
18948 where
18949 I: IntoIterator<Item = St>,
18950 St: AsRef<str>,
18951 {
18952 self._scopes
18953 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18954 self
18955 }
18956
18957 /// Removes all scopes, and no default scope will be used either.
18958 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18959 /// for details).
18960 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagListCall<'a, C> {
18961 self._scopes.clear();
18962 self
18963 }
18964}
18965
18966/// Reverts changes to a GTM Tag in a GTM Workspace.
18967///
18968/// A builder for the *containers.workspaces.tags.revert* method supported by a *account* resource.
18969/// It is not used directly, but through a [`AccountMethods`] instance.
18970///
18971/// # Example
18972///
18973/// Instantiate a resource method builder
18974///
18975/// ```test_harness,no_run
18976/// # extern crate hyper;
18977/// # extern crate hyper_rustls;
18978/// # extern crate google_tagmanager2 as tagmanager2;
18979/// # async fn dox() {
18980/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18981///
18982/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18983/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18984/// # .with_native_roots()
18985/// # .unwrap()
18986/// # .https_only()
18987/// # .enable_http2()
18988/// # .build();
18989///
18990/// # let executor = hyper_util::rt::TokioExecutor::new();
18991/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18992/// # secret,
18993/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18994/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18995/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18996/// # ),
18997/// # ).build().await.unwrap();
18998///
18999/// # let client = hyper_util::client::legacy::Client::builder(
19000/// # hyper_util::rt::TokioExecutor::new()
19001/// # )
19002/// # .build(
19003/// # hyper_rustls::HttpsConnectorBuilder::new()
19004/// # .with_native_roots()
19005/// # .unwrap()
19006/// # .https_or_http()
19007/// # .enable_http2()
19008/// # .build()
19009/// # );
19010/// # let mut hub = TagManager::new(client, auth);
19011/// // You can configure optional parameters by calling the respective setters at will, and
19012/// // execute the final call using `doit()`.
19013/// // Values shown here are possibly random and not representative !
19014/// let result = hub.accounts().containers_workspaces_tags_revert("path")
19015/// .fingerprint("sit")
19016/// .doit().await;
19017/// # }
19018/// ```
19019pub struct AccountContainerWorkspaceTagRevertCall<'a, C>
19020where
19021 C: 'a,
19022{
19023 hub: &'a TagManager<C>,
19024 _path: String,
19025 _fingerprint: Option<String>,
19026 _delegate: Option<&'a mut dyn common::Delegate>,
19027 _additional_params: HashMap<String, String>,
19028 _scopes: BTreeSet<String>,
19029}
19030
19031impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagRevertCall<'a, C> {}
19032
19033impl<'a, C> AccountContainerWorkspaceTagRevertCall<'a, C>
19034where
19035 C: common::Connector,
19036{
19037 /// Perform the operation you have build so far.
19038 pub async fn doit(mut self) -> common::Result<(common::Response, RevertTagResponse)> {
19039 use std::borrow::Cow;
19040 use std::io::{Read, Seek};
19041
19042 use common::{url::Params, ToParts};
19043 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19044
19045 let mut dd = common::DefaultDelegate;
19046 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19047 dlg.begin(common::MethodInfo {
19048 id: "tagmanager.accounts.containers.workspaces.tags.revert",
19049 http_method: hyper::Method::POST,
19050 });
19051
19052 for &field in ["alt", "path", "fingerprint"].iter() {
19053 if self._additional_params.contains_key(field) {
19054 dlg.finished(false);
19055 return Err(common::Error::FieldClash(field));
19056 }
19057 }
19058
19059 let mut params = Params::with_capacity(4 + self._additional_params.len());
19060 params.push("path", self._path);
19061 if let Some(value) = self._fingerprint.as_ref() {
19062 params.push("fingerprint", value);
19063 }
19064
19065 params.extend(self._additional_params.iter());
19066
19067 params.push("alt", "json");
19068 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
19069 if self._scopes.is_empty() {
19070 self._scopes
19071 .insert(Scope::EditContainer.as_ref().to_string());
19072 }
19073
19074 #[allow(clippy::single_element_loop)]
19075 for &(find_this, param_name) in [("{+path}", "path")].iter() {
19076 url = params.uri_replacement(url, param_name, find_this, true);
19077 }
19078 {
19079 let to_remove = ["path"];
19080 params.remove_params(&to_remove);
19081 }
19082
19083 let url = params.parse_with_url(&url);
19084
19085 loop {
19086 let token = match self
19087 .hub
19088 .auth
19089 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19090 .await
19091 {
19092 Ok(token) => token,
19093 Err(e) => match dlg.token(e) {
19094 Ok(token) => token,
19095 Err(e) => {
19096 dlg.finished(false);
19097 return Err(common::Error::MissingToken(e));
19098 }
19099 },
19100 };
19101 let mut req_result = {
19102 let client = &self.hub.client;
19103 dlg.pre_request();
19104 let mut req_builder = hyper::Request::builder()
19105 .method(hyper::Method::POST)
19106 .uri(url.as_str())
19107 .header(USER_AGENT, self.hub._user_agent.clone());
19108
19109 if let Some(token) = token.as_ref() {
19110 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19111 }
19112
19113 let request = req_builder
19114 .header(CONTENT_LENGTH, 0_u64)
19115 .body(common::to_body::<String>(None));
19116
19117 client.request(request.unwrap()).await
19118 };
19119
19120 match req_result {
19121 Err(err) => {
19122 if let common::Retry::After(d) = dlg.http_error(&err) {
19123 sleep(d).await;
19124 continue;
19125 }
19126 dlg.finished(false);
19127 return Err(common::Error::HttpError(err));
19128 }
19129 Ok(res) => {
19130 let (mut parts, body) = res.into_parts();
19131 let mut body = common::Body::new(body);
19132 if !parts.status.is_success() {
19133 let bytes = common::to_bytes(body).await.unwrap_or_default();
19134 let error = serde_json::from_str(&common::to_string(&bytes));
19135 let response = common::to_response(parts, bytes.into());
19136
19137 if let common::Retry::After(d) =
19138 dlg.http_failure(&response, error.as_ref().ok())
19139 {
19140 sleep(d).await;
19141 continue;
19142 }
19143
19144 dlg.finished(false);
19145
19146 return Err(match error {
19147 Ok(value) => common::Error::BadRequest(value),
19148 _ => common::Error::Failure(response),
19149 });
19150 }
19151 let response = {
19152 let bytes = common::to_bytes(body).await.unwrap_or_default();
19153 let encoded = common::to_string(&bytes);
19154 match serde_json::from_str(&encoded) {
19155 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19156 Err(error) => {
19157 dlg.response_json_decode_error(&encoded, &error);
19158 return Err(common::Error::JsonDecodeError(
19159 encoded.to_string(),
19160 error,
19161 ));
19162 }
19163 }
19164 };
19165
19166 dlg.finished(true);
19167 return Ok(response);
19168 }
19169 }
19170 }
19171 }
19172
19173 /// GTM Tag's API relative path.
19174 ///
19175 /// Sets the *path* path property to the given value.
19176 ///
19177 /// Even though the property as already been set when instantiating this call,
19178 /// we provide this method for API completeness.
19179 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
19180 self._path = new_value.to_string();
19181 self
19182 }
19183 /// When provided, this fingerprint must match the fingerprint of thetag in storage.
19184 ///
19185 /// Sets the *fingerprint* query property to the given value.
19186 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
19187 self._fingerprint = Some(new_value.to_string());
19188 self
19189 }
19190 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19191 /// while executing the actual API request.
19192 ///
19193 /// ````text
19194 /// It should be used to handle progress information, and to implement a certain level of resilience.
19195 /// ````
19196 ///
19197 /// Sets the *delegate* property to the given value.
19198 pub fn delegate(
19199 mut self,
19200 new_value: &'a mut dyn common::Delegate,
19201 ) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
19202 self._delegate = Some(new_value);
19203 self
19204 }
19205
19206 /// Set any additional parameter of the query string used in the request.
19207 /// It should be used to set parameters which are not yet available through their own
19208 /// setters.
19209 ///
19210 /// Please note that this method must not be used to set any of the known parameters
19211 /// which have their own setter method. If done anyway, the request will fail.
19212 ///
19213 /// # Additional Parameters
19214 ///
19215 /// * *$.xgafv* (query-string) - V1 error format.
19216 /// * *access_token* (query-string) - OAuth access token.
19217 /// * *alt* (query-string) - Data format for response.
19218 /// * *callback* (query-string) - JSONP
19219 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19220 /// * *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.
19221 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19222 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19223 /// * *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.
19224 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19225 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19226 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagRevertCall<'a, C>
19227 where
19228 T: AsRef<str>,
19229 {
19230 self._additional_params
19231 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19232 self
19233 }
19234
19235 /// Identifies the authorization scope for the method you are building.
19236 ///
19237 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19238 /// [`Scope::EditContainer`].
19239 ///
19240 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19241 /// tokens for more than one scope.
19242 ///
19243 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19244 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19245 /// sufficient, a read-write scope will do as well.
19246 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagRevertCall<'a, C>
19247 where
19248 St: AsRef<str>,
19249 {
19250 self._scopes.insert(String::from(scope.as_ref()));
19251 self
19252 }
19253 /// Identifies the authorization scope(s) for the method you are building.
19254 ///
19255 /// See [`Self::add_scope()`] for details.
19256 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagRevertCall<'a, C>
19257 where
19258 I: IntoIterator<Item = St>,
19259 St: AsRef<str>,
19260 {
19261 self._scopes
19262 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19263 self
19264 }
19265
19266 /// Removes all scopes, and no default scope will be used either.
19267 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19268 /// for details).
19269 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagRevertCall<'a, C> {
19270 self._scopes.clear();
19271 self
19272 }
19273}
19274
19275/// Updates a GTM Tag.
19276///
19277/// A builder for the *containers.workspaces.tags.update* method supported by a *account* resource.
19278/// It is not used directly, but through a [`AccountMethods`] instance.
19279///
19280/// # Example
19281///
19282/// Instantiate a resource method builder
19283///
19284/// ```test_harness,no_run
19285/// # extern crate hyper;
19286/// # extern crate hyper_rustls;
19287/// # extern crate google_tagmanager2 as tagmanager2;
19288/// use tagmanager2::api::Tag;
19289/// # async fn dox() {
19290/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19291///
19292/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19293/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19294/// # .with_native_roots()
19295/// # .unwrap()
19296/// # .https_only()
19297/// # .enable_http2()
19298/// # .build();
19299///
19300/// # let executor = hyper_util::rt::TokioExecutor::new();
19301/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19302/// # secret,
19303/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19304/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19305/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19306/// # ),
19307/// # ).build().await.unwrap();
19308///
19309/// # let client = hyper_util::client::legacy::Client::builder(
19310/// # hyper_util::rt::TokioExecutor::new()
19311/// # )
19312/// # .build(
19313/// # hyper_rustls::HttpsConnectorBuilder::new()
19314/// # .with_native_roots()
19315/// # .unwrap()
19316/// # .https_or_http()
19317/// # .enable_http2()
19318/// # .build()
19319/// # );
19320/// # let mut hub = TagManager::new(client, auth);
19321/// // As the method needs a request, you would usually fill it with the desired information
19322/// // into the respective structure. Some of the parts shown here might not be applicable !
19323/// // Values shown here are possibly random and not representative !
19324/// let mut req = Tag::default();
19325///
19326/// // You can configure optional parameters by calling the respective setters at will, and
19327/// // execute the final call using `doit()`.
19328/// // Values shown here are possibly random and not representative !
19329/// let result = hub.accounts().containers_workspaces_tags_update(req, "path")
19330/// .fingerprint("tempor")
19331/// .doit().await;
19332/// # }
19333/// ```
19334pub struct AccountContainerWorkspaceTagUpdateCall<'a, C>
19335where
19336 C: 'a,
19337{
19338 hub: &'a TagManager<C>,
19339 _request: Tag,
19340 _path: String,
19341 _fingerprint: Option<String>,
19342 _delegate: Option<&'a mut dyn common::Delegate>,
19343 _additional_params: HashMap<String, String>,
19344 _scopes: BTreeSet<String>,
19345}
19346
19347impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTagUpdateCall<'a, C> {}
19348
19349impl<'a, C> AccountContainerWorkspaceTagUpdateCall<'a, C>
19350where
19351 C: common::Connector,
19352{
19353 /// Perform the operation you have build so far.
19354 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
19355 use std::borrow::Cow;
19356 use std::io::{Read, Seek};
19357
19358 use common::{url::Params, ToParts};
19359 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19360
19361 let mut dd = common::DefaultDelegate;
19362 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19363 dlg.begin(common::MethodInfo {
19364 id: "tagmanager.accounts.containers.workspaces.tags.update",
19365 http_method: hyper::Method::PUT,
19366 });
19367
19368 for &field in ["alt", "path", "fingerprint"].iter() {
19369 if self._additional_params.contains_key(field) {
19370 dlg.finished(false);
19371 return Err(common::Error::FieldClash(field));
19372 }
19373 }
19374
19375 let mut params = Params::with_capacity(5 + self._additional_params.len());
19376 params.push("path", self._path);
19377 if let Some(value) = self._fingerprint.as_ref() {
19378 params.push("fingerprint", value);
19379 }
19380
19381 params.extend(self._additional_params.iter());
19382
19383 params.push("alt", "json");
19384 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
19385 if self._scopes.is_empty() {
19386 self._scopes
19387 .insert(Scope::EditContainer.as_ref().to_string());
19388 }
19389
19390 #[allow(clippy::single_element_loop)]
19391 for &(find_this, param_name) in [("{+path}", "path")].iter() {
19392 url = params.uri_replacement(url, param_name, find_this, true);
19393 }
19394 {
19395 let to_remove = ["path"];
19396 params.remove_params(&to_remove);
19397 }
19398
19399 let url = params.parse_with_url(&url);
19400
19401 let mut json_mime_type = mime::APPLICATION_JSON;
19402 let mut request_value_reader = {
19403 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19404 common::remove_json_null_values(&mut value);
19405 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19406 serde_json::to_writer(&mut dst, &value).unwrap();
19407 dst
19408 };
19409 let request_size = request_value_reader
19410 .seek(std::io::SeekFrom::End(0))
19411 .unwrap();
19412 request_value_reader
19413 .seek(std::io::SeekFrom::Start(0))
19414 .unwrap();
19415
19416 loop {
19417 let token = match self
19418 .hub
19419 .auth
19420 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19421 .await
19422 {
19423 Ok(token) => token,
19424 Err(e) => match dlg.token(e) {
19425 Ok(token) => token,
19426 Err(e) => {
19427 dlg.finished(false);
19428 return Err(common::Error::MissingToken(e));
19429 }
19430 },
19431 };
19432 request_value_reader
19433 .seek(std::io::SeekFrom::Start(0))
19434 .unwrap();
19435 let mut req_result = {
19436 let client = &self.hub.client;
19437 dlg.pre_request();
19438 let mut req_builder = hyper::Request::builder()
19439 .method(hyper::Method::PUT)
19440 .uri(url.as_str())
19441 .header(USER_AGENT, self.hub._user_agent.clone());
19442
19443 if let Some(token) = token.as_ref() {
19444 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19445 }
19446
19447 let request = req_builder
19448 .header(CONTENT_TYPE, json_mime_type.to_string())
19449 .header(CONTENT_LENGTH, request_size as u64)
19450 .body(common::to_body(
19451 request_value_reader.get_ref().clone().into(),
19452 ));
19453
19454 client.request(request.unwrap()).await
19455 };
19456
19457 match req_result {
19458 Err(err) => {
19459 if let common::Retry::After(d) = dlg.http_error(&err) {
19460 sleep(d).await;
19461 continue;
19462 }
19463 dlg.finished(false);
19464 return Err(common::Error::HttpError(err));
19465 }
19466 Ok(res) => {
19467 let (mut parts, body) = res.into_parts();
19468 let mut body = common::Body::new(body);
19469 if !parts.status.is_success() {
19470 let bytes = common::to_bytes(body).await.unwrap_or_default();
19471 let error = serde_json::from_str(&common::to_string(&bytes));
19472 let response = common::to_response(parts, bytes.into());
19473
19474 if let common::Retry::After(d) =
19475 dlg.http_failure(&response, error.as_ref().ok())
19476 {
19477 sleep(d).await;
19478 continue;
19479 }
19480
19481 dlg.finished(false);
19482
19483 return Err(match error {
19484 Ok(value) => common::Error::BadRequest(value),
19485 _ => common::Error::Failure(response),
19486 });
19487 }
19488 let response = {
19489 let bytes = common::to_bytes(body).await.unwrap_or_default();
19490 let encoded = common::to_string(&bytes);
19491 match serde_json::from_str(&encoded) {
19492 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19493 Err(error) => {
19494 dlg.response_json_decode_error(&encoded, &error);
19495 return Err(common::Error::JsonDecodeError(
19496 encoded.to_string(),
19497 error,
19498 ));
19499 }
19500 }
19501 };
19502
19503 dlg.finished(true);
19504 return Ok(response);
19505 }
19506 }
19507 }
19508 }
19509
19510 ///
19511 /// Sets the *request* 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 request(mut self, new_value: Tag) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
19516 self._request = new_value;
19517 self
19518 }
19519 /// GTM Tag's API relative path.
19520 ///
19521 /// Sets the *path* path property to the given value.
19522 ///
19523 /// Even though the property as already been set when instantiating this call,
19524 /// we provide this method for API completeness.
19525 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
19526 self._path = new_value.to_string();
19527 self
19528 }
19529 /// When provided, this fingerprint must match the fingerprint of the tag in storage.
19530 ///
19531 /// Sets the *fingerprint* query property to the given value.
19532 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
19533 self._fingerprint = Some(new_value.to_string());
19534 self
19535 }
19536 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19537 /// while executing the actual API request.
19538 ///
19539 /// ````text
19540 /// It should be used to handle progress information, and to implement a certain level of resilience.
19541 /// ````
19542 ///
19543 /// Sets the *delegate* property to the given value.
19544 pub fn delegate(
19545 mut self,
19546 new_value: &'a mut dyn common::Delegate,
19547 ) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
19548 self._delegate = Some(new_value);
19549 self
19550 }
19551
19552 /// Set any additional parameter of the query string used in the request.
19553 /// It should be used to set parameters which are not yet available through their own
19554 /// setters.
19555 ///
19556 /// Please note that this method must not be used to set any of the known parameters
19557 /// which have their own setter method. If done anyway, the request will fail.
19558 ///
19559 /// # Additional Parameters
19560 ///
19561 /// * *$.xgafv* (query-string) - V1 error format.
19562 /// * *access_token* (query-string) - OAuth access token.
19563 /// * *alt* (query-string) - Data format for response.
19564 /// * *callback* (query-string) - JSONP
19565 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19566 /// * *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.
19567 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19568 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19569 /// * *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.
19570 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19571 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19572 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
19573 where
19574 T: AsRef<str>,
19575 {
19576 self._additional_params
19577 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19578 self
19579 }
19580
19581 /// Identifies the authorization scope for the method you are building.
19582 ///
19583 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19584 /// [`Scope::EditContainer`].
19585 ///
19586 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19587 /// tokens for more than one scope.
19588 ///
19589 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19590 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19591 /// sufficient, a read-write scope will do as well.
19592 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
19593 where
19594 St: AsRef<str>,
19595 {
19596 self._scopes.insert(String::from(scope.as_ref()));
19597 self
19598 }
19599 /// Identifies the authorization scope(s) for the method you are building.
19600 ///
19601 /// See [`Self::add_scope()`] for details.
19602 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTagUpdateCall<'a, C>
19603 where
19604 I: IntoIterator<Item = St>,
19605 St: AsRef<str>,
19606 {
19607 self._scopes
19608 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19609 self
19610 }
19611
19612 /// Removes all scopes, and no default scope will be used either.
19613 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19614 /// for details).
19615 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTagUpdateCall<'a, C> {
19616 self._scopes.clear();
19617 self
19618 }
19619}
19620
19621/// Creates a GTM Custom Template.
19622///
19623/// A builder for the *containers.workspaces.templates.create* method supported by a *account* resource.
19624/// It is not used directly, but through a [`AccountMethods`] instance.
19625///
19626/// # Example
19627///
19628/// Instantiate a resource method builder
19629///
19630/// ```test_harness,no_run
19631/// # extern crate hyper;
19632/// # extern crate hyper_rustls;
19633/// # extern crate google_tagmanager2 as tagmanager2;
19634/// use tagmanager2::api::CustomTemplate;
19635/// # async fn dox() {
19636/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19637///
19638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19639/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19640/// # .with_native_roots()
19641/// # .unwrap()
19642/// # .https_only()
19643/// # .enable_http2()
19644/// # .build();
19645///
19646/// # let executor = hyper_util::rt::TokioExecutor::new();
19647/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19648/// # secret,
19649/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19650/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19651/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19652/// # ),
19653/// # ).build().await.unwrap();
19654///
19655/// # let client = hyper_util::client::legacy::Client::builder(
19656/// # hyper_util::rt::TokioExecutor::new()
19657/// # )
19658/// # .build(
19659/// # hyper_rustls::HttpsConnectorBuilder::new()
19660/// # .with_native_roots()
19661/// # .unwrap()
19662/// # .https_or_http()
19663/// # .enable_http2()
19664/// # .build()
19665/// # );
19666/// # let mut hub = TagManager::new(client, auth);
19667/// // As the method needs a request, you would usually fill it with the desired information
19668/// // into the respective structure. Some of the parts shown here might not be applicable !
19669/// // Values shown here are possibly random and not representative !
19670/// let mut req = CustomTemplate::default();
19671///
19672/// // You can configure optional parameters by calling the respective setters at will, and
19673/// // execute the final call using `doit()`.
19674/// // Values shown here are possibly random and not representative !
19675/// let result = hub.accounts().containers_workspaces_templates_create(req, "parent")
19676/// .doit().await;
19677/// # }
19678/// ```
19679pub struct AccountContainerWorkspaceTemplateCreateCall<'a, C>
19680where
19681 C: 'a,
19682{
19683 hub: &'a TagManager<C>,
19684 _request: CustomTemplate,
19685 _parent: String,
19686 _delegate: Option<&'a mut dyn common::Delegate>,
19687 _additional_params: HashMap<String, String>,
19688 _scopes: BTreeSet<String>,
19689}
19690
19691impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateCreateCall<'a, C> {}
19692
19693impl<'a, C> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19694where
19695 C: common::Connector,
19696{
19697 /// Perform the operation you have build so far.
19698 pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
19699 use std::borrow::Cow;
19700 use std::io::{Read, Seek};
19701
19702 use common::{url::Params, ToParts};
19703 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19704
19705 let mut dd = common::DefaultDelegate;
19706 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19707 dlg.begin(common::MethodInfo {
19708 id: "tagmanager.accounts.containers.workspaces.templates.create",
19709 http_method: hyper::Method::POST,
19710 });
19711
19712 for &field in ["alt", "parent"].iter() {
19713 if self._additional_params.contains_key(field) {
19714 dlg.finished(false);
19715 return Err(common::Error::FieldClash(field));
19716 }
19717 }
19718
19719 let mut params = Params::with_capacity(4 + self._additional_params.len());
19720 params.push("parent", self._parent);
19721
19722 params.extend(self._additional_params.iter());
19723
19724 params.push("alt", "json");
19725 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/templates";
19726 if self._scopes.is_empty() {
19727 self._scopes
19728 .insert(Scope::EditContainer.as_ref().to_string());
19729 }
19730
19731 #[allow(clippy::single_element_loop)]
19732 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19733 url = params.uri_replacement(url, param_name, find_this, true);
19734 }
19735 {
19736 let to_remove = ["parent"];
19737 params.remove_params(&to_remove);
19738 }
19739
19740 let url = params.parse_with_url(&url);
19741
19742 let mut json_mime_type = mime::APPLICATION_JSON;
19743 let mut request_value_reader = {
19744 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19745 common::remove_json_null_values(&mut value);
19746 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19747 serde_json::to_writer(&mut dst, &value).unwrap();
19748 dst
19749 };
19750 let request_size = request_value_reader
19751 .seek(std::io::SeekFrom::End(0))
19752 .unwrap();
19753 request_value_reader
19754 .seek(std::io::SeekFrom::Start(0))
19755 .unwrap();
19756
19757 loop {
19758 let token = match self
19759 .hub
19760 .auth
19761 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19762 .await
19763 {
19764 Ok(token) => token,
19765 Err(e) => match dlg.token(e) {
19766 Ok(token) => token,
19767 Err(e) => {
19768 dlg.finished(false);
19769 return Err(common::Error::MissingToken(e));
19770 }
19771 },
19772 };
19773 request_value_reader
19774 .seek(std::io::SeekFrom::Start(0))
19775 .unwrap();
19776 let mut req_result = {
19777 let client = &self.hub.client;
19778 dlg.pre_request();
19779 let mut req_builder = hyper::Request::builder()
19780 .method(hyper::Method::POST)
19781 .uri(url.as_str())
19782 .header(USER_AGENT, self.hub._user_agent.clone());
19783
19784 if let Some(token) = token.as_ref() {
19785 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19786 }
19787
19788 let request = req_builder
19789 .header(CONTENT_TYPE, json_mime_type.to_string())
19790 .header(CONTENT_LENGTH, request_size as u64)
19791 .body(common::to_body(
19792 request_value_reader.get_ref().clone().into(),
19793 ));
19794
19795 client.request(request.unwrap()).await
19796 };
19797
19798 match req_result {
19799 Err(err) => {
19800 if let common::Retry::After(d) = dlg.http_error(&err) {
19801 sleep(d).await;
19802 continue;
19803 }
19804 dlg.finished(false);
19805 return Err(common::Error::HttpError(err));
19806 }
19807 Ok(res) => {
19808 let (mut parts, body) = res.into_parts();
19809 let mut body = common::Body::new(body);
19810 if !parts.status.is_success() {
19811 let bytes = common::to_bytes(body).await.unwrap_or_default();
19812 let error = serde_json::from_str(&common::to_string(&bytes));
19813 let response = common::to_response(parts, bytes.into());
19814
19815 if let common::Retry::After(d) =
19816 dlg.http_failure(&response, error.as_ref().ok())
19817 {
19818 sleep(d).await;
19819 continue;
19820 }
19821
19822 dlg.finished(false);
19823
19824 return Err(match error {
19825 Ok(value) => common::Error::BadRequest(value),
19826 _ => common::Error::Failure(response),
19827 });
19828 }
19829 let response = {
19830 let bytes = common::to_bytes(body).await.unwrap_or_default();
19831 let encoded = common::to_string(&bytes);
19832 match serde_json::from_str(&encoded) {
19833 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19834 Err(error) => {
19835 dlg.response_json_decode_error(&encoded, &error);
19836 return Err(common::Error::JsonDecodeError(
19837 encoded.to_string(),
19838 error,
19839 ));
19840 }
19841 }
19842 };
19843
19844 dlg.finished(true);
19845 return Ok(response);
19846 }
19847 }
19848 }
19849 }
19850
19851 ///
19852 /// Sets the *request* property to the given value.
19853 ///
19854 /// Even though the property as already been set when instantiating this call,
19855 /// we provide this method for API completeness.
19856 pub fn request(
19857 mut self,
19858 new_value: CustomTemplate,
19859 ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19860 self._request = new_value;
19861 self
19862 }
19863 /// GTM Workspace's API relative path.
19864 ///
19865 /// Sets the *parent* path property to the given value.
19866 ///
19867 /// Even though the property as already been set when instantiating this call,
19868 /// we provide this method for API completeness.
19869 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19870 self._parent = new_value.to_string();
19871 self
19872 }
19873 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19874 /// while executing the actual API request.
19875 ///
19876 /// ````text
19877 /// It should be used to handle progress information, and to implement a certain level of resilience.
19878 /// ````
19879 ///
19880 /// Sets the *delegate* property to the given value.
19881 pub fn delegate(
19882 mut self,
19883 new_value: &'a mut dyn common::Delegate,
19884 ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19885 self._delegate = Some(new_value);
19886 self
19887 }
19888
19889 /// Set any additional parameter of the query string used in the request.
19890 /// It should be used to set parameters which are not yet available through their own
19891 /// setters.
19892 ///
19893 /// Please note that this method must not be used to set any of the known parameters
19894 /// which have their own setter method. If done anyway, the request will fail.
19895 ///
19896 /// # Additional Parameters
19897 ///
19898 /// * *$.xgafv* (query-string) - V1 error format.
19899 /// * *access_token* (query-string) - OAuth access token.
19900 /// * *alt* (query-string) - Data format for response.
19901 /// * *callback* (query-string) - JSONP
19902 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19903 /// * *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.
19904 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19905 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19906 /// * *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.
19907 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19908 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19909 pub fn param<T>(
19910 mut self,
19911 name: T,
19912 value: T,
19913 ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19914 where
19915 T: AsRef<str>,
19916 {
19917 self._additional_params
19918 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19919 self
19920 }
19921
19922 /// Identifies the authorization scope for the method you are building.
19923 ///
19924 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19925 /// [`Scope::EditContainer`].
19926 ///
19927 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19928 /// tokens for more than one scope.
19929 ///
19930 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19931 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19932 /// sufficient, a read-write scope will do as well.
19933 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19934 where
19935 St: AsRef<str>,
19936 {
19937 self._scopes.insert(String::from(scope.as_ref()));
19938 self
19939 }
19940 /// Identifies the authorization scope(s) for the method you are building.
19941 ///
19942 /// See [`Self::add_scope()`] for details.
19943 pub fn add_scopes<I, St>(
19944 mut self,
19945 scopes: I,
19946 ) -> AccountContainerWorkspaceTemplateCreateCall<'a, C>
19947 where
19948 I: IntoIterator<Item = St>,
19949 St: AsRef<str>,
19950 {
19951 self._scopes
19952 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19953 self
19954 }
19955
19956 /// Removes all scopes, and no default scope will be used either.
19957 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19958 /// for details).
19959 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateCreateCall<'a, C> {
19960 self._scopes.clear();
19961 self
19962 }
19963}
19964
19965/// Deletes a GTM Template.
19966///
19967/// A builder for the *containers.workspaces.templates.delete* method supported by a *account* resource.
19968/// It is not used directly, but through a [`AccountMethods`] instance.
19969///
19970/// # Example
19971///
19972/// Instantiate a resource method builder
19973///
19974/// ```test_harness,no_run
19975/// # extern crate hyper;
19976/// # extern crate hyper_rustls;
19977/// # extern crate google_tagmanager2 as tagmanager2;
19978/// # async fn dox() {
19979/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19980///
19981/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19982/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19983/// # .with_native_roots()
19984/// # .unwrap()
19985/// # .https_only()
19986/// # .enable_http2()
19987/// # .build();
19988///
19989/// # let executor = hyper_util::rt::TokioExecutor::new();
19990/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19991/// # secret,
19992/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19993/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19994/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19995/// # ),
19996/// # ).build().await.unwrap();
19997///
19998/// # let client = hyper_util::client::legacy::Client::builder(
19999/// # hyper_util::rt::TokioExecutor::new()
20000/// # )
20001/// # .build(
20002/// # hyper_rustls::HttpsConnectorBuilder::new()
20003/// # .with_native_roots()
20004/// # .unwrap()
20005/// # .https_or_http()
20006/// # .enable_http2()
20007/// # .build()
20008/// # );
20009/// # let mut hub = TagManager::new(client, auth);
20010/// // You can configure optional parameters by calling the respective setters at will, and
20011/// // execute the final call using `doit()`.
20012/// // Values shown here are possibly random and not representative !
20013/// let result = hub.accounts().containers_workspaces_templates_delete("path")
20014/// .doit().await;
20015/// # }
20016/// ```
20017pub struct AccountContainerWorkspaceTemplateDeleteCall<'a, C>
20018where
20019 C: 'a,
20020{
20021 hub: &'a TagManager<C>,
20022 _path: String,
20023 _delegate: Option<&'a mut dyn common::Delegate>,
20024 _additional_params: HashMap<String, String>,
20025 _scopes: BTreeSet<String>,
20026}
20027
20028impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateDeleteCall<'a, C> {}
20029
20030impl<'a, C> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
20031where
20032 C: common::Connector,
20033{
20034 /// Perform the operation you have build so far.
20035 pub async fn doit(mut self) -> common::Result<common::Response> {
20036 use std::borrow::Cow;
20037 use std::io::{Read, Seek};
20038
20039 use common::{url::Params, ToParts};
20040 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20041
20042 let mut dd = common::DefaultDelegate;
20043 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20044 dlg.begin(common::MethodInfo {
20045 id: "tagmanager.accounts.containers.workspaces.templates.delete",
20046 http_method: hyper::Method::DELETE,
20047 });
20048
20049 for &field in ["path"].iter() {
20050 if self._additional_params.contains_key(field) {
20051 dlg.finished(false);
20052 return Err(common::Error::FieldClash(field));
20053 }
20054 }
20055
20056 let mut params = Params::with_capacity(2 + self._additional_params.len());
20057 params.push("path", self._path);
20058
20059 params.extend(self._additional_params.iter());
20060
20061 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
20062 if self._scopes.is_empty() {
20063 self._scopes
20064 .insert(Scope::EditContainer.as_ref().to_string());
20065 }
20066
20067 #[allow(clippy::single_element_loop)]
20068 for &(find_this, param_name) in [("{+path}", "path")].iter() {
20069 url = params.uri_replacement(url, param_name, find_this, true);
20070 }
20071 {
20072 let to_remove = ["path"];
20073 params.remove_params(&to_remove);
20074 }
20075
20076 let url = params.parse_with_url(&url);
20077
20078 loop {
20079 let token = match self
20080 .hub
20081 .auth
20082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20083 .await
20084 {
20085 Ok(token) => token,
20086 Err(e) => match dlg.token(e) {
20087 Ok(token) => token,
20088 Err(e) => {
20089 dlg.finished(false);
20090 return Err(common::Error::MissingToken(e));
20091 }
20092 },
20093 };
20094 let mut req_result = {
20095 let client = &self.hub.client;
20096 dlg.pre_request();
20097 let mut req_builder = hyper::Request::builder()
20098 .method(hyper::Method::DELETE)
20099 .uri(url.as_str())
20100 .header(USER_AGENT, self.hub._user_agent.clone());
20101
20102 if let Some(token) = token.as_ref() {
20103 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20104 }
20105
20106 let request = req_builder
20107 .header(CONTENT_LENGTH, 0_u64)
20108 .body(common::to_body::<String>(None));
20109
20110 client.request(request.unwrap()).await
20111 };
20112
20113 match req_result {
20114 Err(err) => {
20115 if let common::Retry::After(d) = dlg.http_error(&err) {
20116 sleep(d).await;
20117 continue;
20118 }
20119 dlg.finished(false);
20120 return Err(common::Error::HttpError(err));
20121 }
20122 Ok(res) => {
20123 let (mut parts, body) = res.into_parts();
20124 let mut body = common::Body::new(body);
20125 if !parts.status.is_success() {
20126 let bytes = common::to_bytes(body).await.unwrap_or_default();
20127 let error = serde_json::from_str(&common::to_string(&bytes));
20128 let response = common::to_response(parts, bytes.into());
20129
20130 if let common::Retry::After(d) =
20131 dlg.http_failure(&response, error.as_ref().ok())
20132 {
20133 sleep(d).await;
20134 continue;
20135 }
20136
20137 dlg.finished(false);
20138
20139 return Err(match error {
20140 Ok(value) => common::Error::BadRequest(value),
20141 _ => common::Error::Failure(response),
20142 });
20143 }
20144 let response = common::Response::from_parts(parts, body);
20145
20146 dlg.finished(true);
20147 return Ok(response);
20148 }
20149 }
20150 }
20151 }
20152
20153 /// GTM Custom Template's API relative path.
20154 ///
20155 /// Sets the *path* path property to the given value.
20156 ///
20157 /// Even though the property as already been set when instantiating this call,
20158 /// we provide this method for API completeness.
20159 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
20160 self._path = new_value.to_string();
20161 self
20162 }
20163 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20164 /// while executing the actual API request.
20165 ///
20166 /// ````text
20167 /// It should be used to handle progress information, and to implement a certain level of resilience.
20168 /// ````
20169 ///
20170 /// Sets the *delegate* property to the given value.
20171 pub fn delegate(
20172 mut self,
20173 new_value: &'a mut dyn common::Delegate,
20174 ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
20175 self._delegate = Some(new_value);
20176 self
20177 }
20178
20179 /// Set any additional parameter of the query string used in the request.
20180 /// It should be used to set parameters which are not yet available through their own
20181 /// setters.
20182 ///
20183 /// Please note that this method must not be used to set any of the known parameters
20184 /// which have their own setter method. If done anyway, the request will fail.
20185 ///
20186 /// # Additional Parameters
20187 ///
20188 /// * *$.xgafv* (query-string) - V1 error format.
20189 /// * *access_token* (query-string) - OAuth access token.
20190 /// * *alt* (query-string) - Data format for response.
20191 /// * *callback* (query-string) - JSONP
20192 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20193 /// * *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.
20194 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20195 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20196 /// * *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.
20197 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20198 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20199 pub fn param<T>(
20200 mut self,
20201 name: T,
20202 value: T,
20203 ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
20204 where
20205 T: AsRef<str>,
20206 {
20207 self._additional_params
20208 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20209 self
20210 }
20211
20212 /// Identifies the authorization scope for the method you are building.
20213 ///
20214 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20215 /// [`Scope::EditContainer`].
20216 ///
20217 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20218 /// tokens for more than one scope.
20219 ///
20220 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20221 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20222 /// sufficient, a read-write scope will do as well.
20223 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
20224 where
20225 St: AsRef<str>,
20226 {
20227 self._scopes.insert(String::from(scope.as_ref()));
20228 self
20229 }
20230 /// Identifies the authorization scope(s) for the method you are building.
20231 ///
20232 /// See [`Self::add_scope()`] for details.
20233 pub fn add_scopes<I, St>(
20234 mut self,
20235 scopes: I,
20236 ) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C>
20237 where
20238 I: IntoIterator<Item = St>,
20239 St: AsRef<str>,
20240 {
20241 self._scopes
20242 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20243 self
20244 }
20245
20246 /// Removes all scopes, and no default scope will be used either.
20247 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20248 /// for details).
20249 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateDeleteCall<'a, C> {
20250 self._scopes.clear();
20251 self
20252 }
20253}
20254
20255/// Gets a GTM Template.
20256///
20257/// A builder for the *containers.workspaces.templates.get* method supported by a *account* resource.
20258/// It is not used directly, but through a [`AccountMethods`] instance.
20259///
20260/// # Example
20261///
20262/// Instantiate a resource method builder
20263///
20264/// ```test_harness,no_run
20265/// # extern crate hyper;
20266/// # extern crate hyper_rustls;
20267/// # extern crate google_tagmanager2 as tagmanager2;
20268/// # async fn dox() {
20269/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20270///
20271/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20272/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20273/// # .with_native_roots()
20274/// # .unwrap()
20275/// # .https_only()
20276/// # .enable_http2()
20277/// # .build();
20278///
20279/// # let executor = hyper_util::rt::TokioExecutor::new();
20280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20281/// # secret,
20282/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20283/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20284/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20285/// # ),
20286/// # ).build().await.unwrap();
20287///
20288/// # let client = hyper_util::client::legacy::Client::builder(
20289/// # hyper_util::rt::TokioExecutor::new()
20290/// # )
20291/// # .build(
20292/// # hyper_rustls::HttpsConnectorBuilder::new()
20293/// # .with_native_roots()
20294/// # .unwrap()
20295/// # .https_or_http()
20296/// # .enable_http2()
20297/// # .build()
20298/// # );
20299/// # let mut hub = TagManager::new(client, auth);
20300/// // You can configure optional parameters by calling the respective setters at will, and
20301/// // execute the final call using `doit()`.
20302/// // Values shown here are possibly random and not representative !
20303/// let result = hub.accounts().containers_workspaces_templates_get("path")
20304/// .doit().await;
20305/// # }
20306/// ```
20307pub struct AccountContainerWorkspaceTemplateGetCall<'a, C>
20308where
20309 C: 'a,
20310{
20311 hub: &'a TagManager<C>,
20312 _path: String,
20313 _delegate: Option<&'a mut dyn common::Delegate>,
20314 _additional_params: HashMap<String, String>,
20315 _scopes: BTreeSet<String>,
20316}
20317
20318impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateGetCall<'a, C> {}
20319
20320impl<'a, C> AccountContainerWorkspaceTemplateGetCall<'a, C>
20321where
20322 C: common::Connector,
20323{
20324 /// Perform the operation you have build so far.
20325 pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
20326 use std::borrow::Cow;
20327 use std::io::{Read, Seek};
20328
20329 use common::{url::Params, ToParts};
20330 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20331
20332 let mut dd = common::DefaultDelegate;
20333 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20334 dlg.begin(common::MethodInfo {
20335 id: "tagmanager.accounts.containers.workspaces.templates.get",
20336 http_method: hyper::Method::GET,
20337 });
20338
20339 for &field in ["alt", "path"].iter() {
20340 if self._additional_params.contains_key(field) {
20341 dlg.finished(false);
20342 return Err(common::Error::FieldClash(field));
20343 }
20344 }
20345
20346 let mut params = Params::with_capacity(3 + self._additional_params.len());
20347 params.push("path", self._path);
20348
20349 params.extend(self._additional_params.iter());
20350
20351 params.push("alt", "json");
20352 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
20353 if self._scopes.is_empty() {
20354 self._scopes.insert(Scope::Readonly.as_ref().to_string());
20355 }
20356
20357 #[allow(clippy::single_element_loop)]
20358 for &(find_this, param_name) in [("{+path}", "path")].iter() {
20359 url = params.uri_replacement(url, param_name, find_this, true);
20360 }
20361 {
20362 let to_remove = ["path"];
20363 params.remove_params(&to_remove);
20364 }
20365
20366 let url = params.parse_with_url(&url);
20367
20368 loop {
20369 let token = match self
20370 .hub
20371 .auth
20372 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20373 .await
20374 {
20375 Ok(token) => token,
20376 Err(e) => match dlg.token(e) {
20377 Ok(token) => token,
20378 Err(e) => {
20379 dlg.finished(false);
20380 return Err(common::Error::MissingToken(e));
20381 }
20382 },
20383 };
20384 let mut req_result = {
20385 let client = &self.hub.client;
20386 dlg.pre_request();
20387 let mut req_builder = hyper::Request::builder()
20388 .method(hyper::Method::GET)
20389 .uri(url.as_str())
20390 .header(USER_AGENT, self.hub._user_agent.clone());
20391
20392 if let Some(token) = token.as_ref() {
20393 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20394 }
20395
20396 let request = req_builder
20397 .header(CONTENT_LENGTH, 0_u64)
20398 .body(common::to_body::<String>(None));
20399
20400 client.request(request.unwrap()).await
20401 };
20402
20403 match req_result {
20404 Err(err) => {
20405 if let common::Retry::After(d) = dlg.http_error(&err) {
20406 sleep(d).await;
20407 continue;
20408 }
20409 dlg.finished(false);
20410 return Err(common::Error::HttpError(err));
20411 }
20412 Ok(res) => {
20413 let (mut parts, body) = res.into_parts();
20414 let mut body = common::Body::new(body);
20415 if !parts.status.is_success() {
20416 let bytes = common::to_bytes(body).await.unwrap_or_default();
20417 let error = serde_json::from_str(&common::to_string(&bytes));
20418 let response = common::to_response(parts, bytes.into());
20419
20420 if let common::Retry::After(d) =
20421 dlg.http_failure(&response, error.as_ref().ok())
20422 {
20423 sleep(d).await;
20424 continue;
20425 }
20426
20427 dlg.finished(false);
20428
20429 return Err(match error {
20430 Ok(value) => common::Error::BadRequest(value),
20431 _ => common::Error::Failure(response),
20432 });
20433 }
20434 let response = {
20435 let bytes = common::to_bytes(body).await.unwrap_or_default();
20436 let encoded = common::to_string(&bytes);
20437 match serde_json::from_str(&encoded) {
20438 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20439 Err(error) => {
20440 dlg.response_json_decode_error(&encoded, &error);
20441 return Err(common::Error::JsonDecodeError(
20442 encoded.to_string(),
20443 error,
20444 ));
20445 }
20446 }
20447 };
20448
20449 dlg.finished(true);
20450 return Ok(response);
20451 }
20452 }
20453 }
20454 }
20455
20456 /// GTM Custom Template's API relative path.
20457 ///
20458 /// Sets the *path* path property to the given value.
20459 ///
20460 /// Even though the property as already been set when instantiating this call,
20461 /// we provide this method for API completeness.
20462 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
20463 self._path = new_value.to_string();
20464 self
20465 }
20466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20467 /// while executing the actual API request.
20468 ///
20469 /// ````text
20470 /// It should be used to handle progress information, and to implement a certain level of resilience.
20471 /// ````
20472 ///
20473 /// Sets the *delegate* property to the given value.
20474 pub fn delegate(
20475 mut self,
20476 new_value: &'a mut dyn common::Delegate,
20477 ) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
20478 self._delegate = Some(new_value);
20479 self
20480 }
20481
20482 /// Set any additional parameter of the query string used in the request.
20483 /// It should be used to set parameters which are not yet available through their own
20484 /// setters.
20485 ///
20486 /// Please note that this method must not be used to set any of the known parameters
20487 /// which have their own setter method. If done anyway, the request will fail.
20488 ///
20489 /// # Additional Parameters
20490 ///
20491 /// * *$.xgafv* (query-string) - V1 error format.
20492 /// * *access_token* (query-string) - OAuth access token.
20493 /// * *alt* (query-string) - Data format for response.
20494 /// * *callback* (query-string) - JSONP
20495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20496 /// * *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.
20497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20499 /// * *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.
20500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20502 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
20503 where
20504 T: AsRef<str>,
20505 {
20506 self._additional_params
20507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20508 self
20509 }
20510
20511 /// Identifies the authorization scope for the method you are building.
20512 ///
20513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20514 /// [`Scope::Readonly`].
20515 ///
20516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20517 /// tokens for more than one scope.
20518 ///
20519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20521 /// sufficient, a read-write scope will do as well.
20522 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
20523 where
20524 St: AsRef<str>,
20525 {
20526 self._scopes.insert(String::from(scope.as_ref()));
20527 self
20528 }
20529 /// Identifies the authorization scope(s) for the method you are building.
20530 ///
20531 /// See [`Self::add_scope()`] for details.
20532 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTemplateGetCall<'a, C>
20533 where
20534 I: IntoIterator<Item = St>,
20535 St: AsRef<str>,
20536 {
20537 self._scopes
20538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20539 self
20540 }
20541
20542 /// Removes all scopes, and no default scope will be used either.
20543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20544 /// for details).
20545 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateGetCall<'a, C> {
20546 self._scopes.clear();
20547 self
20548 }
20549}
20550
20551/// Imports a GTM Custom Template from Gallery.
20552///
20553/// A builder for the *containers.workspaces.templates.import_from_gallery* method supported by a *account* resource.
20554/// It is not used directly, but through a [`AccountMethods`] instance.
20555///
20556/// # Example
20557///
20558/// Instantiate a resource method builder
20559///
20560/// ```test_harness,no_run
20561/// # extern crate hyper;
20562/// # extern crate hyper_rustls;
20563/// # extern crate google_tagmanager2 as tagmanager2;
20564/// # async fn dox() {
20565/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20566///
20567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20569/// # .with_native_roots()
20570/// # .unwrap()
20571/// # .https_only()
20572/// # .enable_http2()
20573/// # .build();
20574///
20575/// # let executor = hyper_util::rt::TokioExecutor::new();
20576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20577/// # secret,
20578/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20579/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20580/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20581/// # ),
20582/// # ).build().await.unwrap();
20583///
20584/// # let client = hyper_util::client::legacy::Client::builder(
20585/// # hyper_util::rt::TokioExecutor::new()
20586/// # )
20587/// # .build(
20588/// # hyper_rustls::HttpsConnectorBuilder::new()
20589/// # .with_native_roots()
20590/// # .unwrap()
20591/// # .https_or_http()
20592/// # .enable_http2()
20593/// # .build()
20594/// # );
20595/// # let mut hub = TagManager::new(client, auth);
20596/// // You can configure optional parameters by calling the respective setters at will, and
20597/// // execute the final call using `doit()`.
20598/// // Values shown here are possibly random and not representative !
20599/// let result = hub.accounts().containers_workspaces_templates_import_from_gallery("parent")
20600/// .gallery_sha("Lorem")
20601/// .gallery_repository("est")
20602/// .gallery_owner("sed")
20603/// .acknowledge_permissions(true)
20604/// .doit().await;
20605/// # }
20606/// ```
20607pub struct AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C>
20608where
20609 C: 'a,
20610{
20611 hub: &'a TagManager<C>,
20612 _parent: String,
20613 _gallery_sha: Option<String>,
20614 _gallery_repository: Option<String>,
20615 _gallery_owner: Option<String>,
20616 _acknowledge_permissions: Option<bool>,
20617 _delegate: Option<&'a mut dyn common::Delegate>,
20618 _additional_params: HashMap<String, String>,
20619 _scopes: BTreeSet<String>,
20620}
20621
20622impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {}
20623
20624impl<'a, C> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C>
20625where
20626 C: common::Connector,
20627{
20628 /// Perform the operation you have build so far.
20629 pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
20630 use std::borrow::Cow;
20631 use std::io::{Read, Seek};
20632
20633 use common::{url::Params, ToParts};
20634 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20635
20636 let mut dd = common::DefaultDelegate;
20637 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20638 dlg.begin(common::MethodInfo {
20639 id: "tagmanager.accounts.containers.workspaces.templates.import_from_gallery",
20640 http_method: hyper::Method::POST,
20641 });
20642
20643 for &field in [
20644 "alt",
20645 "parent",
20646 "gallerySha",
20647 "galleryRepository",
20648 "galleryOwner",
20649 "acknowledgePermissions",
20650 ]
20651 .iter()
20652 {
20653 if self._additional_params.contains_key(field) {
20654 dlg.finished(false);
20655 return Err(common::Error::FieldClash(field));
20656 }
20657 }
20658
20659 let mut params = Params::with_capacity(7 + self._additional_params.len());
20660 params.push("parent", self._parent);
20661 if let Some(value) = self._gallery_sha.as_ref() {
20662 params.push("gallerySha", value);
20663 }
20664 if let Some(value) = self._gallery_repository.as_ref() {
20665 params.push("galleryRepository", value);
20666 }
20667 if let Some(value) = self._gallery_owner.as_ref() {
20668 params.push("galleryOwner", value);
20669 }
20670 if let Some(value) = self._acknowledge_permissions.as_ref() {
20671 params.push("acknowledgePermissions", value.to_string());
20672 }
20673
20674 params.extend(self._additional_params.iter());
20675
20676 params.push("alt", "json");
20677 let mut url =
20678 self.hub._base_url.clone() + "tagmanager/v2/{+parent}/templates:import_from_gallery";
20679 if self._scopes.is_empty() {
20680 self._scopes
20681 .insert(Scope::EditContainer.as_ref().to_string());
20682 }
20683
20684 #[allow(clippy::single_element_loop)]
20685 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20686 url = params.uri_replacement(url, param_name, find_this, true);
20687 }
20688 {
20689 let to_remove = ["parent"];
20690 params.remove_params(&to_remove);
20691 }
20692
20693 let url = params.parse_with_url(&url);
20694
20695 loop {
20696 let token = match self
20697 .hub
20698 .auth
20699 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20700 .await
20701 {
20702 Ok(token) => token,
20703 Err(e) => match dlg.token(e) {
20704 Ok(token) => token,
20705 Err(e) => {
20706 dlg.finished(false);
20707 return Err(common::Error::MissingToken(e));
20708 }
20709 },
20710 };
20711 let mut req_result = {
20712 let client = &self.hub.client;
20713 dlg.pre_request();
20714 let mut req_builder = hyper::Request::builder()
20715 .method(hyper::Method::POST)
20716 .uri(url.as_str())
20717 .header(USER_AGENT, self.hub._user_agent.clone());
20718
20719 if let Some(token) = token.as_ref() {
20720 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20721 }
20722
20723 let request = req_builder
20724 .header(CONTENT_LENGTH, 0_u64)
20725 .body(common::to_body::<String>(None));
20726
20727 client.request(request.unwrap()).await
20728 };
20729
20730 match req_result {
20731 Err(err) => {
20732 if let common::Retry::After(d) = dlg.http_error(&err) {
20733 sleep(d).await;
20734 continue;
20735 }
20736 dlg.finished(false);
20737 return Err(common::Error::HttpError(err));
20738 }
20739 Ok(res) => {
20740 let (mut parts, body) = res.into_parts();
20741 let mut body = common::Body::new(body);
20742 if !parts.status.is_success() {
20743 let bytes = common::to_bytes(body).await.unwrap_or_default();
20744 let error = serde_json::from_str(&common::to_string(&bytes));
20745 let response = common::to_response(parts, bytes.into());
20746
20747 if let common::Retry::After(d) =
20748 dlg.http_failure(&response, error.as_ref().ok())
20749 {
20750 sleep(d).await;
20751 continue;
20752 }
20753
20754 dlg.finished(false);
20755
20756 return Err(match error {
20757 Ok(value) => common::Error::BadRequest(value),
20758 _ => common::Error::Failure(response),
20759 });
20760 }
20761 let response = {
20762 let bytes = common::to_bytes(body).await.unwrap_or_default();
20763 let encoded = common::to_string(&bytes);
20764 match serde_json::from_str(&encoded) {
20765 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20766 Err(error) => {
20767 dlg.response_json_decode_error(&encoded, &error);
20768 return Err(common::Error::JsonDecodeError(
20769 encoded.to_string(),
20770 error,
20771 ));
20772 }
20773 }
20774 };
20775
20776 dlg.finished(true);
20777 return Ok(response);
20778 }
20779 }
20780 }
20781 }
20782
20783 /// GTM Workspace's API relative path.
20784 ///
20785 /// Sets the *parent* path property to the given value.
20786 ///
20787 /// Even though the property as already been set when instantiating this call,
20788 /// we provide this method for API completeness.
20789 pub fn parent(
20790 mut self,
20791 new_value: &str,
20792 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20793 self._parent = new_value.to_string();
20794 self
20795 }
20796 /// SHA version of the Gallery template to import. Defaulted to the latest SHA version if not provided.
20797 ///
20798 /// Sets the *gallery sha* query property to the given value.
20799 pub fn gallery_sha(
20800 mut self,
20801 new_value: &str,
20802 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20803 self._gallery_sha = Some(new_value.to_string());
20804 self
20805 }
20806 /// Repository of the Gallery template to import
20807 ///
20808 /// Sets the *gallery repository* query property to the given value.
20809 pub fn gallery_repository(
20810 mut self,
20811 new_value: &str,
20812 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20813 self._gallery_repository = Some(new_value.to_string());
20814 self
20815 }
20816 /// Owner of the Gallery template to import
20817 ///
20818 /// Sets the *gallery owner* query property to the given value.
20819 pub fn gallery_owner(
20820 mut self,
20821 new_value: &str,
20822 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20823 self._gallery_owner = Some(new_value.to_string());
20824 self
20825 }
20826 /// Must be set to true to allow Gallery template to be imported into the workspace. If this bit is false, the import operation will fail.
20827 ///
20828 /// Sets the *acknowledge permissions* query property to the given value.
20829 pub fn acknowledge_permissions(
20830 mut self,
20831 new_value: bool,
20832 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20833 self._acknowledge_permissions = Some(new_value);
20834 self
20835 }
20836 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20837 /// while executing the actual API request.
20838 ///
20839 /// ````text
20840 /// It should be used to handle progress information, and to implement a certain level of resilience.
20841 /// ````
20842 ///
20843 /// Sets the *delegate* property to the given value.
20844 pub fn delegate(
20845 mut self,
20846 new_value: &'a mut dyn common::Delegate,
20847 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20848 self._delegate = Some(new_value);
20849 self
20850 }
20851
20852 /// Set any additional parameter of the query string used in the request.
20853 /// It should be used to set parameters which are not yet available through their own
20854 /// setters.
20855 ///
20856 /// Please note that this method must not be used to set any of the known parameters
20857 /// which have their own setter method. If done anyway, the request will fail.
20858 ///
20859 /// # Additional Parameters
20860 ///
20861 /// * *$.xgafv* (query-string) - V1 error format.
20862 /// * *access_token* (query-string) - OAuth access token.
20863 /// * *alt* (query-string) - Data format for response.
20864 /// * *callback* (query-string) - JSONP
20865 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20866 /// * *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.
20867 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20868 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20869 /// * *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.
20870 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20871 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20872 pub fn param<T>(
20873 mut self,
20874 name: T,
20875 value: T,
20876 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C>
20877 where
20878 T: AsRef<str>,
20879 {
20880 self._additional_params
20881 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20882 self
20883 }
20884
20885 /// Identifies the authorization scope for the method you are building.
20886 ///
20887 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20888 /// [`Scope::EditContainer`].
20889 ///
20890 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20891 /// tokens for more than one scope.
20892 ///
20893 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20894 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20895 /// sufficient, a read-write scope will do as well.
20896 pub fn add_scope<St>(
20897 mut self,
20898 scope: St,
20899 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C>
20900 where
20901 St: AsRef<str>,
20902 {
20903 self._scopes.insert(String::from(scope.as_ref()));
20904 self
20905 }
20906 /// Identifies the authorization scope(s) for the method you are building.
20907 ///
20908 /// See [`Self::add_scope()`] for details.
20909 pub fn add_scopes<I, St>(
20910 mut self,
20911 scopes: I,
20912 ) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C>
20913 where
20914 I: IntoIterator<Item = St>,
20915 St: AsRef<str>,
20916 {
20917 self._scopes
20918 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20919 self
20920 }
20921
20922 /// Removes all scopes, and no default scope will be used either.
20923 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20924 /// for details).
20925 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateImportFromGalleryCall<'a, C> {
20926 self._scopes.clear();
20927 self
20928 }
20929}
20930
20931/// Lists all GTM Templates of a GTM container workspace.
20932///
20933/// A builder for the *containers.workspaces.templates.list* method supported by a *account* resource.
20934/// It is not used directly, but through a [`AccountMethods`] instance.
20935///
20936/// # Example
20937///
20938/// Instantiate a resource method builder
20939///
20940/// ```test_harness,no_run
20941/// # extern crate hyper;
20942/// # extern crate hyper_rustls;
20943/// # extern crate google_tagmanager2 as tagmanager2;
20944/// # async fn dox() {
20945/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20946///
20947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20948/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20949/// # .with_native_roots()
20950/// # .unwrap()
20951/// # .https_only()
20952/// # .enable_http2()
20953/// # .build();
20954///
20955/// # let executor = hyper_util::rt::TokioExecutor::new();
20956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20957/// # secret,
20958/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20959/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20960/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20961/// # ),
20962/// # ).build().await.unwrap();
20963///
20964/// # let client = hyper_util::client::legacy::Client::builder(
20965/// # hyper_util::rt::TokioExecutor::new()
20966/// # )
20967/// # .build(
20968/// # hyper_rustls::HttpsConnectorBuilder::new()
20969/// # .with_native_roots()
20970/// # .unwrap()
20971/// # .https_or_http()
20972/// # .enable_http2()
20973/// # .build()
20974/// # );
20975/// # let mut hub = TagManager::new(client, auth);
20976/// // You can configure optional parameters by calling the respective setters at will, and
20977/// // execute the final call using `doit()`.
20978/// // Values shown here are possibly random and not representative !
20979/// let result = hub.accounts().containers_workspaces_templates_list("parent")
20980/// .page_token("sed")
20981/// .doit().await;
20982/// # }
20983/// ```
20984pub struct AccountContainerWorkspaceTemplateListCall<'a, C>
20985where
20986 C: 'a,
20987{
20988 hub: &'a TagManager<C>,
20989 _parent: String,
20990 _page_token: Option<String>,
20991 _delegate: Option<&'a mut dyn common::Delegate>,
20992 _additional_params: HashMap<String, String>,
20993 _scopes: BTreeSet<String>,
20994}
20995
20996impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateListCall<'a, C> {}
20997
20998impl<'a, C> AccountContainerWorkspaceTemplateListCall<'a, C>
20999where
21000 C: common::Connector,
21001{
21002 /// Perform the operation you have build so far.
21003 pub async fn doit(mut self) -> common::Result<(common::Response, ListTemplatesResponse)> {
21004 use std::borrow::Cow;
21005 use std::io::{Read, Seek};
21006
21007 use common::{url::Params, ToParts};
21008 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21009
21010 let mut dd = common::DefaultDelegate;
21011 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21012 dlg.begin(common::MethodInfo {
21013 id: "tagmanager.accounts.containers.workspaces.templates.list",
21014 http_method: hyper::Method::GET,
21015 });
21016
21017 for &field in ["alt", "parent", "pageToken"].iter() {
21018 if self._additional_params.contains_key(field) {
21019 dlg.finished(false);
21020 return Err(common::Error::FieldClash(field));
21021 }
21022 }
21023
21024 let mut params = Params::with_capacity(4 + self._additional_params.len());
21025 params.push("parent", self._parent);
21026 if let Some(value) = self._page_token.as_ref() {
21027 params.push("pageToken", value);
21028 }
21029
21030 params.extend(self._additional_params.iter());
21031
21032 params.push("alt", "json");
21033 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/templates";
21034 if self._scopes.is_empty() {
21035 self._scopes.insert(Scope::Readonly.as_ref().to_string());
21036 }
21037
21038 #[allow(clippy::single_element_loop)]
21039 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21040 url = params.uri_replacement(url, param_name, find_this, true);
21041 }
21042 {
21043 let to_remove = ["parent"];
21044 params.remove_params(&to_remove);
21045 }
21046
21047 let url = params.parse_with_url(&url);
21048
21049 loop {
21050 let token = match self
21051 .hub
21052 .auth
21053 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21054 .await
21055 {
21056 Ok(token) => token,
21057 Err(e) => match dlg.token(e) {
21058 Ok(token) => token,
21059 Err(e) => {
21060 dlg.finished(false);
21061 return Err(common::Error::MissingToken(e));
21062 }
21063 },
21064 };
21065 let mut req_result = {
21066 let client = &self.hub.client;
21067 dlg.pre_request();
21068 let mut req_builder = hyper::Request::builder()
21069 .method(hyper::Method::GET)
21070 .uri(url.as_str())
21071 .header(USER_AGENT, self.hub._user_agent.clone());
21072
21073 if let Some(token) = token.as_ref() {
21074 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21075 }
21076
21077 let request = req_builder
21078 .header(CONTENT_LENGTH, 0_u64)
21079 .body(common::to_body::<String>(None));
21080
21081 client.request(request.unwrap()).await
21082 };
21083
21084 match req_result {
21085 Err(err) => {
21086 if let common::Retry::After(d) = dlg.http_error(&err) {
21087 sleep(d).await;
21088 continue;
21089 }
21090 dlg.finished(false);
21091 return Err(common::Error::HttpError(err));
21092 }
21093 Ok(res) => {
21094 let (mut parts, body) = res.into_parts();
21095 let mut body = common::Body::new(body);
21096 if !parts.status.is_success() {
21097 let bytes = common::to_bytes(body).await.unwrap_or_default();
21098 let error = serde_json::from_str(&common::to_string(&bytes));
21099 let response = common::to_response(parts, bytes.into());
21100
21101 if let common::Retry::After(d) =
21102 dlg.http_failure(&response, error.as_ref().ok())
21103 {
21104 sleep(d).await;
21105 continue;
21106 }
21107
21108 dlg.finished(false);
21109
21110 return Err(match error {
21111 Ok(value) => common::Error::BadRequest(value),
21112 _ => common::Error::Failure(response),
21113 });
21114 }
21115 let response = {
21116 let bytes = common::to_bytes(body).await.unwrap_or_default();
21117 let encoded = common::to_string(&bytes);
21118 match serde_json::from_str(&encoded) {
21119 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21120 Err(error) => {
21121 dlg.response_json_decode_error(&encoded, &error);
21122 return Err(common::Error::JsonDecodeError(
21123 encoded.to_string(),
21124 error,
21125 ));
21126 }
21127 }
21128 };
21129
21130 dlg.finished(true);
21131 return Ok(response);
21132 }
21133 }
21134 }
21135 }
21136
21137 /// GTM Workspace's API relative path.
21138 ///
21139 /// Sets the *parent* path property to the given value.
21140 ///
21141 /// Even though the property as already been set when instantiating this call,
21142 /// we provide this method for API completeness.
21143 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
21144 self._parent = new_value.to_string();
21145 self
21146 }
21147 /// Continuation token for fetching the next page of results.
21148 ///
21149 /// Sets the *page token* query property to the given value.
21150 pub fn page_token(
21151 mut self,
21152 new_value: &str,
21153 ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
21154 self._page_token = Some(new_value.to_string());
21155 self
21156 }
21157 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21158 /// while executing the actual API request.
21159 ///
21160 /// ````text
21161 /// It should be used to handle progress information, and to implement a certain level of resilience.
21162 /// ````
21163 ///
21164 /// Sets the *delegate* property to the given value.
21165 pub fn delegate(
21166 mut self,
21167 new_value: &'a mut dyn common::Delegate,
21168 ) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
21169 self._delegate = Some(new_value);
21170 self
21171 }
21172
21173 /// Set any additional parameter of the query string used in the request.
21174 /// It should be used to set parameters which are not yet available through their own
21175 /// setters.
21176 ///
21177 /// Please note that this method must not be used to set any of the known parameters
21178 /// which have their own setter method. If done anyway, the request will fail.
21179 ///
21180 /// # Additional Parameters
21181 ///
21182 /// * *$.xgafv* (query-string) - V1 error format.
21183 /// * *access_token* (query-string) - OAuth access token.
21184 /// * *alt* (query-string) - Data format for response.
21185 /// * *callback* (query-string) - JSONP
21186 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21187 /// * *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.
21188 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21189 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21190 /// * *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.
21191 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21192 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21193 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTemplateListCall<'a, C>
21194 where
21195 T: AsRef<str>,
21196 {
21197 self._additional_params
21198 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21199 self
21200 }
21201
21202 /// Identifies the authorization scope for the method you are building.
21203 ///
21204 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21205 /// [`Scope::Readonly`].
21206 ///
21207 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21208 /// tokens for more than one scope.
21209 ///
21210 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21211 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21212 /// sufficient, a read-write scope will do as well.
21213 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateListCall<'a, C>
21214 where
21215 St: AsRef<str>,
21216 {
21217 self._scopes.insert(String::from(scope.as_ref()));
21218 self
21219 }
21220 /// Identifies the authorization scope(s) for the method you are building.
21221 ///
21222 /// See [`Self::add_scope()`] for details.
21223 pub fn add_scopes<I, St>(
21224 mut self,
21225 scopes: I,
21226 ) -> AccountContainerWorkspaceTemplateListCall<'a, C>
21227 where
21228 I: IntoIterator<Item = St>,
21229 St: AsRef<str>,
21230 {
21231 self._scopes
21232 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21233 self
21234 }
21235
21236 /// Removes all scopes, and no default scope will be used either.
21237 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21238 /// for details).
21239 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateListCall<'a, C> {
21240 self._scopes.clear();
21241 self
21242 }
21243}
21244
21245/// Reverts changes to a GTM Template in a GTM Workspace.
21246///
21247/// A builder for the *containers.workspaces.templates.revert* method supported by a *account* resource.
21248/// It is not used directly, but through a [`AccountMethods`] instance.
21249///
21250/// # Example
21251///
21252/// Instantiate a resource method builder
21253///
21254/// ```test_harness,no_run
21255/// # extern crate hyper;
21256/// # extern crate hyper_rustls;
21257/// # extern crate google_tagmanager2 as tagmanager2;
21258/// # async fn dox() {
21259/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21260///
21261/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21262/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21263/// # .with_native_roots()
21264/// # .unwrap()
21265/// # .https_only()
21266/// # .enable_http2()
21267/// # .build();
21268///
21269/// # let executor = hyper_util::rt::TokioExecutor::new();
21270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21271/// # secret,
21272/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21273/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21274/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21275/// # ),
21276/// # ).build().await.unwrap();
21277///
21278/// # let client = hyper_util::client::legacy::Client::builder(
21279/// # hyper_util::rt::TokioExecutor::new()
21280/// # )
21281/// # .build(
21282/// # hyper_rustls::HttpsConnectorBuilder::new()
21283/// # .with_native_roots()
21284/// # .unwrap()
21285/// # .https_or_http()
21286/// # .enable_http2()
21287/// # .build()
21288/// # );
21289/// # let mut hub = TagManager::new(client, auth);
21290/// // You can configure optional parameters by calling the respective setters at will, and
21291/// // execute the final call using `doit()`.
21292/// // Values shown here are possibly random and not representative !
21293/// let result = hub.accounts().containers_workspaces_templates_revert("path")
21294/// .fingerprint("et")
21295/// .doit().await;
21296/// # }
21297/// ```
21298pub struct AccountContainerWorkspaceTemplateRevertCall<'a, C>
21299where
21300 C: 'a,
21301{
21302 hub: &'a TagManager<C>,
21303 _path: String,
21304 _fingerprint: Option<String>,
21305 _delegate: Option<&'a mut dyn common::Delegate>,
21306 _additional_params: HashMap<String, String>,
21307 _scopes: BTreeSet<String>,
21308}
21309
21310impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateRevertCall<'a, C> {}
21311
21312impl<'a, C> AccountContainerWorkspaceTemplateRevertCall<'a, C>
21313where
21314 C: common::Connector,
21315{
21316 /// Perform the operation you have build so far.
21317 pub async fn doit(mut self) -> common::Result<(common::Response, RevertTemplateResponse)> {
21318 use std::borrow::Cow;
21319 use std::io::{Read, Seek};
21320
21321 use common::{url::Params, ToParts};
21322 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21323
21324 let mut dd = common::DefaultDelegate;
21325 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21326 dlg.begin(common::MethodInfo {
21327 id: "tagmanager.accounts.containers.workspaces.templates.revert",
21328 http_method: hyper::Method::POST,
21329 });
21330
21331 for &field in ["alt", "path", "fingerprint"].iter() {
21332 if self._additional_params.contains_key(field) {
21333 dlg.finished(false);
21334 return Err(common::Error::FieldClash(field));
21335 }
21336 }
21337
21338 let mut params = Params::with_capacity(4 + self._additional_params.len());
21339 params.push("path", self._path);
21340 if let Some(value) = self._fingerprint.as_ref() {
21341 params.push("fingerprint", value);
21342 }
21343
21344 params.extend(self._additional_params.iter());
21345
21346 params.push("alt", "json");
21347 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
21348 if self._scopes.is_empty() {
21349 self._scopes
21350 .insert(Scope::EditContainer.as_ref().to_string());
21351 }
21352
21353 #[allow(clippy::single_element_loop)]
21354 for &(find_this, param_name) in [("{+path}", "path")].iter() {
21355 url = params.uri_replacement(url, param_name, find_this, true);
21356 }
21357 {
21358 let to_remove = ["path"];
21359 params.remove_params(&to_remove);
21360 }
21361
21362 let url = params.parse_with_url(&url);
21363
21364 loop {
21365 let token = match self
21366 .hub
21367 .auth
21368 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21369 .await
21370 {
21371 Ok(token) => token,
21372 Err(e) => match dlg.token(e) {
21373 Ok(token) => token,
21374 Err(e) => {
21375 dlg.finished(false);
21376 return Err(common::Error::MissingToken(e));
21377 }
21378 },
21379 };
21380 let mut req_result = {
21381 let client = &self.hub.client;
21382 dlg.pre_request();
21383 let mut req_builder = hyper::Request::builder()
21384 .method(hyper::Method::POST)
21385 .uri(url.as_str())
21386 .header(USER_AGENT, self.hub._user_agent.clone());
21387
21388 if let Some(token) = token.as_ref() {
21389 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21390 }
21391
21392 let request = req_builder
21393 .header(CONTENT_LENGTH, 0_u64)
21394 .body(common::to_body::<String>(None));
21395
21396 client.request(request.unwrap()).await
21397 };
21398
21399 match req_result {
21400 Err(err) => {
21401 if let common::Retry::After(d) = dlg.http_error(&err) {
21402 sleep(d).await;
21403 continue;
21404 }
21405 dlg.finished(false);
21406 return Err(common::Error::HttpError(err));
21407 }
21408 Ok(res) => {
21409 let (mut parts, body) = res.into_parts();
21410 let mut body = common::Body::new(body);
21411 if !parts.status.is_success() {
21412 let bytes = common::to_bytes(body).await.unwrap_or_default();
21413 let error = serde_json::from_str(&common::to_string(&bytes));
21414 let response = common::to_response(parts, bytes.into());
21415
21416 if let common::Retry::After(d) =
21417 dlg.http_failure(&response, error.as_ref().ok())
21418 {
21419 sleep(d).await;
21420 continue;
21421 }
21422
21423 dlg.finished(false);
21424
21425 return Err(match error {
21426 Ok(value) => common::Error::BadRequest(value),
21427 _ => common::Error::Failure(response),
21428 });
21429 }
21430 let response = {
21431 let bytes = common::to_bytes(body).await.unwrap_or_default();
21432 let encoded = common::to_string(&bytes);
21433 match serde_json::from_str(&encoded) {
21434 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21435 Err(error) => {
21436 dlg.response_json_decode_error(&encoded, &error);
21437 return Err(common::Error::JsonDecodeError(
21438 encoded.to_string(),
21439 error,
21440 ));
21441 }
21442 }
21443 };
21444
21445 dlg.finished(true);
21446 return Ok(response);
21447 }
21448 }
21449 }
21450 }
21451
21452 /// GTM Custom Template's API relative path.
21453 ///
21454 /// Sets the *path* path property to the given value.
21455 ///
21456 /// Even though the property as already been set when instantiating this call,
21457 /// we provide this method for API completeness.
21458 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
21459 self._path = new_value.to_string();
21460 self
21461 }
21462 /// When provided, this fingerprint must match the fingerprint of the template in storage.
21463 ///
21464 /// Sets the *fingerprint* query property to the given value.
21465 pub fn fingerprint(
21466 mut self,
21467 new_value: &str,
21468 ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
21469 self._fingerprint = Some(new_value.to_string());
21470 self
21471 }
21472 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21473 /// while executing the actual API request.
21474 ///
21475 /// ````text
21476 /// It should be used to handle progress information, and to implement a certain level of resilience.
21477 /// ````
21478 ///
21479 /// Sets the *delegate* property to the given value.
21480 pub fn delegate(
21481 mut self,
21482 new_value: &'a mut dyn common::Delegate,
21483 ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
21484 self._delegate = Some(new_value);
21485 self
21486 }
21487
21488 /// Set any additional parameter of the query string used in the request.
21489 /// It should be used to set parameters which are not yet available through their own
21490 /// setters.
21491 ///
21492 /// Please note that this method must not be used to set any of the known parameters
21493 /// which have their own setter method. If done anyway, the request will fail.
21494 ///
21495 /// # Additional Parameters
21496 ///
21497 /// * *$.xgafv* (query-string) - V1 error format.
21498 /// * *access_token* (query-string) - OAuth access token.
21499 /// * *alt* (query-string) - Data format for response.
21500 /// * *callback* (query-string) - JSONP
21501 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21502 /// * *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.
21503 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21504 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21505 /// * *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.
21506 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21507 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21508 pub fn param<T>(
21509 mut self,
21510 name: T,
21511 value: T,
21512 ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
21513 where
21514 T: AsRef<str>,
21515 {
21516 self._additional_params
21517 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21518 self
21519 }
21520
21521 /// Identifies the authorization scope for the method you are building.
21522 ///
21523 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21524 /// [`Scope::EditContainer`].
21525 ///
21526 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21527 /// tokens for more than one scope.
21528 ///
21529 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21530 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21531 /// sufficient, a read-write scope will do as well.
21532 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
21533 where
21534 St: AsRef<str>,
21535 {
21536 self._scopes.insert(String::from(scope.as_ref()));
21537 self
21538 }
21539 /// Identifies the authorization scope(s) for the method you are building.
21540 ///
21541 /// See [`Self::add_scope()`] for details.
21542 pub fn add_scopes<I, St>(
21543 mut self,
21544 scopes: I,
21545 ) -> AccountContainerWorkspaceTemplateRevertCall<'a, C>
21546 where
21547 I: IntoIterator<Item = St>,
21548 St: AsRef<str>,
21549 {
21550 self._scopes
21551 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21552 self
21553 }
21554
21555 /// Removes all scopes, and no default scope will be used either.
21556 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21557 /// for details).
21558 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateRevertCall<'a, C> {
21559 self._scopes.clear();
21560 self
21561 }
21562}
21563
21564/// Updates a GTM Template.
21565///
21566/// A builder for the *containers.workspaces.templates.update* method supported by a *account* resource.
21567/// It is not used directly, but through a [`AccountMethods`] instance.
21568///
21569/// # Example
21570///
21571/// Instantiate a resource method builder
21572///
21573/// ```test_harness,no_run
21574/// # extern crate hyper;
21575/// # extern crate hyper_rustls;
21576/// # extern crate google_tagmanager2 as tagmanager2;
21577/// use tagmanager2::api::CustomTemplate;
21578/// # async fn dox() {
21579/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21580///
21581/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21582/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21583/// # .with_native_roots()
21584/// # .unwrap()
21585/// # .https_only()
21586/// # .enable_http2()
21587/// # .build();
21588///
21589/// # let executor = hyper_util::rt::TokioExecutor::new();
21590/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21591/// # secret,
21592/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21593/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21594/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21595/// # ),
21596/// # ).build().await.unwrap();
21597///
21598/// # let client = hyper_util::client::legacy::Client::builder(
21599/// # hyper_util::rt::TokioExecutor::new()
21600/// # )
21601/// # .build(
21602/// # hyper_rustls::HttpsConnectorBuilder::new()
21603/// # .with_native_roots()
21604/// # .unwrap()
21605/// # .https_or_http()
21606/// # .enable_http2()
21607/// # .build()
21608/// # );
21609/// # let mut hub = TagManager::new(client, auth);
21610/// // As the method needs a request, you would usually fill it with the desired information
21611/// // into the respective structure. Some of the parts shown here might not be applicable !
21612/// // Values shown here are possibly random and not representative !
21613/// let mut req = CustomTemplate::default();
21614///
21615/// // You can configure optional parameters by calling the respective setters at will, and
21616/// // execute the final call using `doit()`.
21617/// // Values shown here are possibly random and not representative !
21618/// let result = hub.accounts().containers_workspaces_templates_update(req, "path")
21619/// .fingerprint("sed")
21620/// .doit().await;
21621/// # }
21622/// ```
21623pub struct AccountContainerWorkspaceTemplateUpdateCall<'a, C>
21624where
21625 C: 'a,
21626{
21627 hub: &'a TagManager<C>,
21628 _request: CustomTemplate,
21629 _path: String,
21630 _fingerprint: Option<String>,
21631 _delegate: Option<&'a mut dyn common::Delegate>,
21632 _additional_params: HashMap<String, String>,
21633 _scopes: BTreeSet<String>,
21634}
21635
21636impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTemplateUpdateCall<'a, C> {}
21637
21638impl<'a, C> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
21639where
21640 C: common::Connector,
21641{
21642 /// Perform the operation you have build so far.
21643 pub async fn doit(mut self) -> common::Result<(common::Response, CustomTemplate)> {
21644 use std::borrow::Cow;
21645 use std::io::{Read, Seek};
21646
21647 use common::{url::Params, ToParts};
21648 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21649
21650 let mut dd = common::DefaultDelegate;
21651 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21652 dlg.begin(common::MethodInfo {
21653 id: "tagmanager.accounts.containers.workspaces.templates.update",
21654 http_method: hyper::Method::PUT,
21655 });
21656
21657 for &field in ["alt", "path", "fingerprint"].iter() {
21658 if self._additional_params.contains_key(field) {
21659 dlg.finished(false);
21660 return Err(common::Error::FieldClash(field));
21661 }
21662 }
21663
21664 let mut params = Params::with_capacity(5 + self._additional_params.len());
21665 params.push("path", self._path);
21666 if let Some(value) = self._fingerprint.as_ref() {
21667 params.push("fingerprint", value);
21668 }
21669
21670 params.extend(self._additional_params.iter());
21671
21672 params.push("alt", "json");
21673 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
21674 if self._scopes.is_empty() {
21675 self._scopes
21676 .insert(Scope::EditContainer.as_ref().to_string());
21677 }
21678
21679 #[allow(clippy::single_element_loop)]
21680 for &(find_this, param_name) in [("{+path}", "path")].iter() {
21681 url = params.uri_replacement(url, param_name, find_this, true);
21682 }
21683 {
21684 let to_remove = ["path"];
21685 params.remove_params(&to_remove);
21686 }
21687
21688 let url = params.parse_with_url(&url);
21689
21690 let mut json_mime_type = mime::APPLICATION_JSON;
21691 let mut request_value_reader = {
21692 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21693 common::remove_json_null_values(&mut value);
21694 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21695 serde_json::to_writer(&mut dst, &value).unwrap();
21696 dst
21697 };
21698 let request_size = request_value_reader
21699 .seek(std::io::SeekFrom::End(0))
21700 .unwrap();
21701 request_value_reader
21702 .seek(std::io::SeekFrom::Start(0))
21703 .unwrap();
21704
21705 loop {
21706 let token = match self
21707 .hub
21708 .auth
21709 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21710 .await
21711 {
21712 Ok(token) => token,
21713 Err(e) => match dlg.token(e) {
21714 Ok(token) => token,
21715 Err(e) => {
21716 dlg.finished(false);
21717 return Err(common::Error::MissingToken(e));
21718 }
21719 },
21720 };
21721 request_value_reader
21722 .seek(std::io::SeekFrom::Start(0))
21723 .unwrap();
21724 let mut req_result = {
21725 let client = &self.hub.client;
21726 dlg.pre_request();
21727 let mut req_builder = hyper::Request::builder()
21728 .method(hyper::Method::PUT)
21729 .uri(url.as_str())
21730 .header(USER_AGENT, self.hub._user_agent.clone());
21731
21732 if let Some(token) = token.as_ref() {
21733 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21734 }
21735
21736 let request = req_builder
21737 .header(CONTENT_TYPE, json_mime_type.to_string())
21738 .header(CONTENT_LENGTH, request_size as u64)
21739 .body(common::to_body(
21740 request_value_reader.get_ref().clone().into(),
21741 ));
21742
21743 client.request(request.unwrap()).await
21744 };
21745
21746 match req_result {
21747 Err(err) => {
21748 if let common::Retry::After(d) = dlg.http_error(&err) {
21749 sleep(d).await;
21750 continue;
21751 }
21752 dlg.finished(false);
21753 return Err(common::Error::HttpError(err));
21754 }
21755 Ok(res) => {
21756 let (mut parts, body) = res.into_parts();
21757 let mut body = common::Body::new(body);
21758 if !parts.status.is_success() {
21759 let bytes = common::to_bytes(body).await.unwrap_or_default();
21760 let error = serde_json::from_str(&common::to_string(&bytes));
21761 let response = common::to_response(parts, bytes.into());
21762
21763 if let common::Retry::After(d) =
21764 dlg.http_failure(&response, error.as_ref().ok())
21765 {
21766 sleep(d).await;
21767 continue;
21768 }
21769
21770 dlg.finished(false);
21771
21772 return Err(match error {
21773 Ok(value) => common::Error::BadRequest(value),
21774 _ => common::Error::Failure(response),
21775 });
21776 }
21777 let response = {
21778 let bytes = common::to_bytes(body).await.unwrap_or_default();
21779 let encoded = common::to_string(&bytes);
21780 match serde_json::from_str(&encoded) {
21781 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21782 Err(error) => {
21783 dlg.response_json_decode_error(&encoded, &error);
21784 return Err(common::Error::JsonDecodeError(
21785 encoded.to_string(),
21786 error,
21787 ));
21788 }
21789 }
21790 };
21791
21792 dlg.finished(true);
21793 return Ok(response);
21794 }
21795 }
21796 }
21797 }
21798
21799 ///
21800 /// Sets the *request* property to the given value.
21801 ///
21802 /// Even though the property as already been set when instantiating this call,
21803 /// we provide this method for API completeness.
21804 pub fn request(
21805 mut self,
21806 new_value: CustomTemplate,
21807 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
21808 self._request = new_value;
21809 self
21810 }
21811 /// GTM Custom Template's API relative path.
21812 ///
21813 /// Sets the *path* path property to the given value.
21814 ///
21815 /// Even though the property as already been set when instantiating this call,
21816 /// we provide this method for API completeness.
21817 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
21818 self._path = new_value.to_string();
21819 self
21820 }
21821 /// When provided, this fingerprint must match the fingerprint of the templates in storage.
21822 ///
21823 /// Sets the *fingerprint* query property to the given value.
21824 pub fn fingerprint(
21825 mut self,
21826 new_value: &str,
21827 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
21828 self._fingerprint = Some(new_value.to_string());
21829 self
21830 }
21831 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21832 /// while executing the actual API request.
21833 ///
21834 /// ````text
21835 /// It should be used to handle progress information, and to implement a certain level of resilience.
21836 /// ````
21837 ///
21838 /// Sets the *delegate* property to the given value.
21839 pub fn delegate(
21840 mut self,
21841 new_value: &'a mut dyn common::Delegate,
21842 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
21843 self._delegate = Some(new_value);
21844 self
21845 }
21846
21847 /// Set any additional parameter of the query string used in the request.
21848 /// It should be used to set parameters which are not yet available through their own
21849 /// setters.
21850 ///
21851 /// Please note that this method must not be used to set any of the known parameters
21852 /// which have their own setter method. If done anyway, the request will fail.
21853 ///
21854 /// # Additional Parameters
21855 ///
21856 /// * *$.xgafv* (query-string) - V1 error format.
21857 /// * *access_token* (query-string) - OAuth access token.
21858 /// * *alt* (query-string) - Data format for response.
21859 /// * *callback* (query-string) - JSONP
21860 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21861 /// * *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.
21862 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21863 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21864 /// * *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.
21865 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21866 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21867 pub fn param<T>(
21868 mut self,
21869 name: T,
21870 value: T,
21871 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
21872 where
21873 T: AsRef<str>,
21874 {
21875 self._additional_params
21876 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21877 self
21878 }
21879
21880 /// Identifies the authorization scope for the method you are building.
21881 ///
21882 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21883 /// [`Scope::EditContainer`].
21884 ///
21885 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21886 /// tokens for more than one scope.
21887 ///
21888 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21889 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21890 /// sufficient, a read-write scope will do as well.
21891 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
21892 where
21893 St: AsRef<str>,
21894 {
21895 self._scopes.insert(String::from(scope.as_ref()));
21896 self
21897 }
21898 /// Identifies the authorization scope(s) for the method you are building.
21899 ///
21900 /// See [`Self::add_scope()`] for details.
21901 pub fn add_scopes<I, St>(
21902 mut self,
21903 scopes: I,
21904 ) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C>
21905 where
21906 I: IntoIterator<Item = St>,
21907 St: AsRef<str>,
21908 {
21909 self._scopes
21910 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21911 self
21912 }
21913
21914 /// Removes all scopes, and no default scope will be used either.
21915 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21916 /// for details).
21917 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTemplateUpdateCall<'a, C> {
21918 self._scopes.clear();
21919 self
21920 }
21921}
21922
21923/// Creates a GTM Transformation.
21924///
21925/// A builder for the *containers.workspaces.transformations.create* method supported by a *account* resource.
21926/// It is not used directly, but through a [`AccountMethods`] instance.
21927///
21928/// # Example
21929///
21930/// Instantiate a resource method builder
21931///
21932/// ```test_harness,no_run
21933/// # extern crate hyper;
21934/// # extern crate hyper_rustls;
21935/// # extern crate google_tagmanager2 as tagmanager2;
21936/// use tagmanager2::api::Transformation;
21937/// # async fn dox() {
21938/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21939///
21940/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21941/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21942/// # .with_native_roots()
21943/// # .unwrap()
21944/// # .https_only()
21945/// # .enable_http2()
21946/// # .build();
21947///
21948/// # let executor = hyper_util::rt::TokioExecutor::new();
21949/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21950/// # secret,
21951/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21952/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21953/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21954/// # ),
21955/// # ).build().await.unwrap();
21956///
21957/// # let client = hyper_util::client::legacy::Client::builder(
21958/// # hyper_util::rt::TokioExecutor::new()
21959/// # )
21960/// # .build(
21961/// # hyper_rustls::HttpsConnectorBuilder::new()
21962/// # .with_native_roots()
21963/// # .unwrap()
21964/// # .https_or_http()
21965/// # .enable_http2()
21966/// # .build()
21967/// # );
21968/// # let mut hub = TagManager::new(client, auth);
21969/// // As the method needs a request, you would usually fill it with the desired information
21970/// // into the respective structure. Some of the parts shown here might not be applicable !
21971/// // Values shown here are possibly random and not representative !
21972/// let mut req = Transformation::default();
21973///
21974/// // You can configure optional parameters by calling the respective setters at will, and
21975/// // execute the final call using `doit()`.
21976/// // Values shown here are possibly random and not representative !
21977/// let result = hub.accounts().containers_workspaces_transformations_create(req, "parent")
21978/// .doit().await;
21979/// # }
21980/// ```
21981pub struct AccountContainerWorkspaceTransformationCreateCall<'a, C>
21982where
21983 C: 'a,
21984{
21985 hub: &'a TagManager<C>,
21986 _request: Transformation,
21987 _parent: String,
21988 _delegate: Option<&'a mut dyn common::Delegate>,
21989 _additional_params: HashMap<String, String>,
21990 _scopes: BTreeSet<String>,
21991}
21992
21993impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationCreateCall<'a, C> {}
21994
21995impl<'a, C> AccountContainerWorkspaceTransformationCreateCall<'a, C>
21996where
21997 C: common::Connector,
21998{
21999 /// Perform the operation you have build so far.
22000 pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
22001 use std::borrow::Cow;
22002 use std::io::{Read, Seek};
22003
22004 use common::{url::Params, ToParts};
22005 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22006
22007 let mut dd = common::DefaultDelegate;
22008 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22009 dlg.begin(common::MethodInfo {
22010 id: "tagmanager.accounts.containers.workspaces.transformations.create",
22011 http_method: hyper::Method::POST,
22012 });
22013
22014 for &field in ["alt", "parent"].iter() {
22015 if self._additional_params.contains_key(field) {
22016 dlg.finished(false);
22017 return Err(common::Error::FieldClash(field));
22018 }
22019 }
22020
22021 let mut params = Params::with_capacity(4 + self._additional_params.len());
22022 params.push("parent", self._parent);
22023
22024 params.extend(self._additional_params.iter());
22025
22026 params.push("alt", "json");
22027 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/transformations";
22028 if self._scopes.is_empty() {
22029 self._scopes
22030 .insert(Scope::EditContainer.as_ref().to_string());
22031 }
22032
22033 #[allow(clippy::single_element_loop)]
22034 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22035 url = params.uri_replacement(url, param_name, find_this, true);
22036 }
22037 {
22038 let to_remove = ["parent"];
22039 params.remove_params(&to_remove);
22040 }
22041
22042 let url = params.parse_with_url(&url);
22043
22044 let mut json_mime_type = mime::APPLICATION_JSON;
22045 let mut request_value_reader = {
22046 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22047 common::remove_json_null_values(&mut value);
22048 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22049 serde_json::to_writer(&mut dst, &value).unwrap();
22050 dst
22051 };
22052 let request_size = request_value_reader
22053 .seek(std::io::SeekFrom::End(0))
22054 .unwrap();
22055 request_value_reader
22056 .seek(std::io::SeekFrom::Start(0))
22057 .unwrap();
22058
22059 loop {
22060 let token = match self
22061 .hub
22062 .auth
22063 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22064 .await
22065 {
22066 Ok(token) => token,
22067 Err(e) => match dlg.token(e) {
22068 Ok(token) => token,
22069 Err(e) => {
22070 dlg.finished(false);
22071 return Err(common::Error::MissingToken(e));
22072 }
22073 },
22074 };
22075 request_value_reader
22076 .seek(std::io::SeekFrom::Start(0))
22077 .unwrap();
22078 let mut req_result = {
22079 let client = &self.hub.client;
22080 dlg.pre_request();
22081 let mut req_builder = hyper::Request::builder()
22082 .method(hyper::Method::POST)
22083 .uri(url.as_str())
22084 .header(USER_AGENT, self.hub._user_agent.clone());
22085
22086 if let Some(token) = token.as_ref() {
22087 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22088 }
22089
22090 let request = req_builder
22091 .header(CONTENT_TYPE, json_mime_type.to_string())
22092 .header(CONTENT_LENGTH, request_size as u64)
22093 .body(common::to_body(
22094 request_value_reader.get_ref().clone().into(),
22095 ));
22096
22097 client.request(request.unwrap()).await
22098 };
22099
22100 match req_result {
22101 Err(err) => {
22102 if let common::Retry::After(d) = dlg.http_error(&err) {
22103 sleep(d).await;
22104 continue;
22105 }
22106 dlg.finished(false);
22107 return Err(common::Error::HttpError(err));
22108 }
22109 Ok(res) => {
22110 let (mut parts, body) = res.into_parts();
22111 let mut body = common::Body::new(body);
22112 if !parts.status.is_success() {
22113 let bytes = common::to_bytes(body).await.unwrap_or_default();
22114 let error = serde_json::from_str(&common::to_string(&bytes));
22115 let response = common::to_response(parts, bytes.into());
22116
22117 if let common::Retry::After(d) =
22118 dlg.http_failure(&response, error.as_ref().ok())
22119 {
22120 sleep(d).await;
22121 continue;
22122 }
22123
22124 dlg.finished(false);
22125
22126 return Err(match error {
22127 Ok(value) => common::Error::BadRequest(value),
22128 _ => common::Error::Failure(response),
22129 });
22130 }
22131 let response = {
22132 let bytes = common::to_bytes(body).await.unwrap_or_default();
22133 let encoded = common::to_string(&bytes);
22134 match serde_json::from_str(&encoded) {
22135 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22136 Err(error) => {
22137 dlg.response_json_decode_error(&encoded, &error);
22138 return Err(common::Error::JsonDecodeError(
22139 encoded.to_string(),
22140 error,
22141 ));
22142 }
22143 }
22144 };
22145
22146 dlg.finished(true);
22147 return Ok(response);
22148 }
22149 }
22150 }
22151 }
22152
22153 ///
22154 /// Sets the *request* property to the given value.
22155 ///
22156 /// Even though the property as already been set when instantiating this call,
22157 /// we provide this method for API completeness.
22158 pub fn request(
22159 mut self,
22160 new_value: Transformation,
22161 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
22162 self._request = new_value;
22163 self
22164 }
22165 /// GTM Workspace's API relative path.
22166 ///
22167 /// Sets the *parent* path property to the given value.
22168 ///
22169 /// Even though the property as already been set when instantiating this call,
22170 /// we provide this method for API completeness.
22171 pub fn parent(
22172 mut self,
22173 new_value: &str,
22174 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
22175 self._parent = new_value.to_string();
22176 self
22177 }
22178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22179 /// while executing the actual API request.
22180 ///
22181 /// ````text
22182 /// It should be used to handle progress information, and to implement a certain level of resilience.
22183 /// ````
22184 ///
22185 /// Sets the *delegate* property to the given value.
22186 pub fn delegate(
22187 mut self,
22188 new_value: &'a mut dyn common::Delegate,
22189 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
22190 self._delegate = Some(new_value);
22191 self
22192 }
22193
22194 /// Set any additional parameter of the query string used in the request.
22195 /// It should be used to set parameters which are not yet available through their own
22196 /// setters.
22197 ///
22198 /// Please note that this method must not be used to set any of the known parameters
22199 /// which have their own setter method. If done anyway, the request will fail.
22200 ///
22201 /// # Additional Parameters
22202 ///
22203 /// * *$.xgafv* (query-string) - V1 error format.
22204 /// * *access_token* (query-string) - OAuth access token.
22205 /// * *alt* (query-string) - Data format for response.
22206 /// * *callback* (query-string) - JSONP
22207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22208 /// * *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.
22209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22211 /// * *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.
22212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22214 pub fn param<T>(
22215 mut self,
22216 name: T,
22217 value: T,
22218 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
22219 where
22220 T: AsRef<str>,
22221 {
22222 self._additional_params
22223 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22224 self
22225 }
22226
22227 /// Identifies the authorization scope for the method you are building.
22228 ///
22229 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22230 /// [`Scope::EditContainer`].
22231 ///
22232 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22233 /// tokens for more than one scope.
22234 ///
22235 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22236 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22237 /// sufficient, a read-write scope will do as well.
22238 pub fn add_scope<St>(
22239 mut self,
22240 scope: St,
22241 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
22242 where
22243 St: AsRef<str>,
22244 {
22245 self._scopes.insert(String::from(scope.as_ref()));
22246 self
22247 }
22248 /// Identifies the authorization scope(s) for the method you are building.
22249 ///
22250 /// See [`Self::add_scope()`] for details.
22251 pub fn add_scopes<I, St>(
22252 mut self,
22253 scopes: I,
22254 ) -> AccountContainerWorkspaceTransformationCreateCall<'a, C>
22255 where
22256 I: IntoIterator<Item = St>,
22257 St: AsRef<str>,
22258 {
22259 self._scopes
22260 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22261 self
22262 }
22263
22264 /// Removes all scopes, and no default scope will be used either.
22265 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22266 /// for details).
22267 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationCreateCall<'a, C> {
22268 self._scopes.clear();
22269 self
22270 }
22271}
22272
22273/// Deletes a GTM Transformation.
22274///
22275/// A builder for the *containers.workspaces.transformations.delete* method supported by a *account* resource.
22276/// It is not used directly, but through a [`AccountMethods`] instance.
22277///
22278/// # Example
22279///
22280/// Instantiate a resource method builder
22281///
22282/// ```test_harness,no_run
22283/// # extern crate hyper;
22284/// # extern crate hyper_rustls;
22285/// # extern crate google_tagmanager2 as tagmanager2;
22286/// # async fn dox() {
22287/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22288///
22289/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22290/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22291/// # .with_native_roots()
22292/// # .unwrap()
22293/// # .https_only()
22294/// # .enable_http2()
22295/// # .build();
22296///
22297/// # let executor = hyper_util::rt::TokioExecutor::new();
22298/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22299/// # secret,
22300/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22301/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22302/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22303/// # ),
22304/// # ).build().await.unwrap();
22305///
22306/// # let client = hyper_util::client::legacy::Client::builder(
22307/// # hyper_util::rt::TokioExecutor::new()
22308/// # )
22309/// # .build(
22310/// # hyper_rustls::HttpsConnectorBuilder::new()
22311/// # .with_native_roots()
22312/// # .unwrap()
22313/// # .https_or_http()
22314/// # .enable_http2()
22315/// # .build()
22316/// # );
22317/// # let mut hub = TagManager::new(client, auth);
22318/// // You can configure optional parameters by calling the respective setters at will, and
22319/// // execute the final call using `doit()`.
22320/// // Values shown here are possibly random and not representative !
22321/// let result = hub.accounts().containers_workspaces_transformations_delete("path")
22322/// .doit().await;
22323/// # }
22324/// ```
22325pub struct AccountContainerWorkspaceTransformationDeleteCall<'a, C>
22326where
22327 C: 'a,
22328{
22329 hub: &'a TagManager<C>,
22330 _path: String,
22331 _delegate: Option<&'a mut dyn common::Delegate>,
22332 _additional_params: HashMap<String, String>,
22333 _scopes: BTreeSet<String>,
22334}
22335
22336impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationDeleteCall<'a, C> {}
22337
22338impl<'a, C> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
22339where
22340 C: common::Connector,
22341{
22342 /// Perform the operation you have build so far.
22343 pub async fn doit(mut self) -> common::Result<common::Response> {
22344 use std::borrow::Cow;
22345 use std::io::{Read, Seek};
22346
22347 use common::{url::Params, ToParts};
22348 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22349
22350 let mut dd = common::DefaultDelegate;
22351 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22352 dlg.begin(common::MethodInfo {
22353 id: "tagmanager.accounts.containers.workspaces.transformations.delete",
22354 http_method: hyper::Method::DELETE,
22355 });
22356
22357 for &field in ["path"].iter() {
22358 if self._additional_params.contains_key(field) {
22359 dlg.finished(false);
22360 return Err(common::Error::FieldClash(field));
22361 }
22362 }
22363
22364 let mut params = Params::with_capacity(2 + self._additional_params.len());
22365 params.push("path", self._path);
22366
22367 params.extend(self._additional_params.iter());
22368
22369 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
22370 if self._scopes.is_empty() {
22371 self._scopes
22372 .insert(Scope::EditContainer.as_ref().to_string());
22373 }
22374
22375 #[allow(clippy::single_element_loop)]
22376 for &(find_this, param_name) in [("{+path}", "path")].iter() {
22377 url = params.uri_replacement(url, param_name, find_this, true);
22378 }
22379 {
22380 let to_remove = ["path"];
22381 params.remove_params(&to_remove);
22382 }
22383
22384 let url = params.parse_with_url(&url);
22385
22386 loop {
22387 let token = match self
22388 .hub
22389 .auth
22390 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22391 .await
22392 {
22393 Ok(token) => token,
22394 Err(e) => match dlg.token(e) {
22395 Ok(token) => token,
22396 Err(e) => {
22397 dlg.finished(false);
22398 return Err(common::Error::MissingToken(e));
22399 }
22400 },
22401 };
22402 let mut req_result = {
22403 let client = &self.hub.client;
22404 dlg.pre_request();
22405 let mut req_builder = hyper::Request::builder()
22406 .method(hyper::Method::DELETE)
22407 .uri(url.as_str())
22408 .header(USER_AGENT, self.hub._user_agent.clone());
22409
22410 if let Some(token) = token.as_ref() {
22411 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22412 }
22413
22414 let request = req_builder
22415 .header(CONTENT_LENGTH, 0_u64)
22416 .body(common::to_body::<String>(None));
22417
22418 client.request(request.unwrap()).await
22419 };
22420
22421 match req_result {
22422 Err(err) => {
22423 if let common::Retry::After(d) = dlg.http_error(&err) {
22424 sleep(d).await;
22425 continue;
22426 }
22427 dlg.finished(false);
22428 return Err(common::Error::HttpError(err));
22429 }
22430 Ok(res) => {
22431 let (mut parts, body) = res.into_parts();
22432 let mut body = common::Body::new(body);
22433 if !parts.status.is_success() {
22434 let bytes = common::to_bytes(body).await.unwrap_or_default();
22435 let error = serde_json::from_str(&common::to_string(&bytes));
22436 let response = common::to_response(parts, bytes.into());
22437
22438 if let common::Retry::After(d) =
22439 dlg.http_failure(&response, error.as_ref().ok())
22440 {
22441 sleep(d).await;
22442 continue;
22443 }
22444
22445 dlg.finished(false);
22446
22447 return Err(match error {
22448 Ok(value) => common::Error::BadRequest(value),
22449 _ => common::Error::Failure(response),
22450 });
22451 }
22452 let response = common::Response::from_parts(parts, body);
22453
22454 dlg.finished(true);
22455 return Ok(response);
22456 }
22457 }
22458 }
22459 }
22460
22461 /// GTM Transformation's API relative path.
22462 ///
22463 /// Sets the *path* path property to the given value.
22464 ///
22465 /// Even though the property as already been set when instantiating this call,
22466 /// we provide this method for API completeness.
22467 pub fn path(
22468 mut self,
22469 new_value: &str,
22470 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
22471 self._path = new_value.to_string();
22472 self
22473 }
22474 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22475 /// while executing the actual API request.
22476 ///
22477 /// ````text
22478 /// It should be used to handle progress information, and to implement a certain level of resilience.
22479 /// ````
22480 ///
22481 /// Sets the *delegate* property to the given value.
22482 pub fn delegate(
22483 mut self,
22484 new_value: &'a mut dyn common::Delegate,
22485 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
22486 self._delegate = Some(new_value);
22487 self
22488 }
22489
22490 /// Set any additional parameter of the query string used in the request.
22491 /// It should be used to set parameters which are not yet available through their own
22492 /// setters.
22493 ///
22494 /// Please note that this method must not be used to set any of the known parameters
22495 /// which have their own setter method. If done anyway, the request will fail.
22496 ///
22497 /// # Additional Parameters
22498 ///
22499 /// * *$.xgafv* (query-string) - V1 error format.
22500 /// * *access_token* (query-string) - OAuth access token.
22501 /// * *alt* (query-string) - Data format for response.
22502 /// * *callback* (query-string) - JSONP
22503 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22504 /// * *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.
22505 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22506 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22507 /// * *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.
22508 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22509 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22510 pub fn param<T>(
22511 mut self,
22512 name: T,
22513 value: T,
22514 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
22515 where
22516 T: AsRef<str>,
22517 {
22518 self._additional_params
22519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22520 self
22521 }
22522
22523 /// Identifies the authorization scope for the method you are building.
22524 ///
22525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22526 /// [`Scope::EditContainer`].
22527 ///
22528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22529 /// tokens for more than one scope.
22530 ///
22531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22533 /// sufficient, a read-write scope will do as well.
22534 pub fn add_scope<St>(
22535 mut self,
22536 scope: St,
22537 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
22538 where
22539 St: AsRef<str>,
22540 {
22541 self._scopes.insert(String::from(scope.as_ref()));
22542 self
22543 }
22544 /// Identifies the authorization scope(s) for the method you are building.
22545 ///
22546 /// See [`Self::add_scope()`] for details.
22547 pub fn add_scopes<I, St>(
22548 mut self,
22549 scopes: I,
22550 ) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C>
22551 where
22552 I: IntoIterator<Item = St>,
22553 St: AsRef<str>,
22554 {
22555 self._scopes
22556 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22557 self
22558 }
22559
22560 /// Removes all scopes, and no default scope will be used either.
22561 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22562 /// for details).
22563 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationDeleteCall<'a, C> {
22564 self._scopes.clear();
22565 self
22566 }
22567}
22568
22569/// Gets a GTM Transformation.
22570///
22571/// A builder for the *containers.workspaces.transformations.get* method supported by a *account* resource.
22572/// It is not used directly, but through a [`AccountMethods`] instance.
22573///
22574/// # Example
22575///
22576/// Instantiate a resource method builder
22577///
22578/// ```test_harness,no_run
22579/// # extern crate hyper;
22580/// # extern crate hyper_rustls;
22581/// # extern crate google_tagmanager2 as tagmanager2;
22582/// # async fn dox() {
22583/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22584///
22585/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22586/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22587/// # .with_native_roots()
22588/// # .unwrap()
22589/// # .https_only()
22590/// # .enable_http2()
22591/// # .build();
22592///
22593/// # let executor = hyper_util::rt::TokioExecutor::new();
22594/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22595/// # secret,
22596/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22597/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22598/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22599/// # ),
22600/// # ).build().await.unwrap();
22601///
22602/// # let client = hyper_util::client::legacy::Client::builder(
22603/// # hyper_util::rt::TokioExecutor::new()
22604/// # )
22605/// # .build(
22606/// # hyper_rustls::HttpsConnectorBuilder::new()
22607/// # .with_native_roots()
22608/// # .unwrap()
22609/// # .https_or_http()
22610/// # .enable_http2()
22611/// # .build()
22612/// # );
22613/// # let mut hub = TagManager::new(client, auth);
22614/// // You can configure optional parameters by calling the respective setters at will, and
22615/// // execute the final call using `doit()`.
22616/// // Values shown here are possibly random and not representative !
22617/// let result = hub.accounts().containers_workspaces_transformations_get("path")
22618/// .doit().await;
22619/// # }
22620/// ```
22621pub struct AccountContainerWorkspaceTransformationGetCall<'a, C>
22622where
22623 C: 'a,
22624{
22625 hub: &'a TagManager<C>,
22626 _path: String,
22627 _delegate: Option<&'a mut dyn common::Delegate>,
22628 _additional_params: HashMap<String, String>,
22629 _scopes: BTreeSet<String>,
22630}
22631
22632impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationGetCall<'a, C> {}
22633
22634impl<'a, C> AccountContainerWorkspaceTransformationGetCall<'a, C>
22635where
22636 C: common::Connector,
22637{
22638 /// Perform the operation you have build so far.
22639 pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
22640 use std::borrow::Cow;
22641 use std::io::{Read, Seek};
22642
22643 use common::{url::Params, ToParts};
22644 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22645
22646 let mut dd = common::DefaultDelegate;
22647 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22648 dlg.begin(common::MethodInfo {
22649 id: "tagmanager.accounts.containers.workspaces.transformations.get",
22650 http_method: hyper::Method::GET,
22651 });
22652
22653 for &field in ["alt", "path"].iter() {
22654 if self._additional_params.contains_key(field) {
22655 dlg.finished(false);
22656 return Err(common::Error::FieldClash(field));
22657 }
22658 }
22659
22660 let mut params = Params::with_capacity(3 + self._additional_params.len());
22661 params.push("path", self._path);
22662
22663 params.extend(self._additional_params.iter());
22664
22665 params.push("alt", "json");
22666 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
22667 if self._scopes.is_empty() {
22668 self._scopes.insert(Scope::Readonly.as_ref().to_string());
22669 }
22670
22671 #[allow(clippy::single_element_loop)]
22672 for &(find_this, param_name) in [("{+path}", "path")].iter() {
22673 url = params.uri_replacement(url, param_name, find_this, true);
22674 }
22675 {
22676 let to_remove = ["path"];
22677 params.remove_params(&to_remove);
22678 }
22679
22680 let url = params.parse_with_url(&url);
22681
22682 loop {
22683 let token = match self
22684 .hub
22685 .auth
22686 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22687 .await
22688 {
22689 Ok(token) => token,
22690 Err(e) => match dlg.token(e) {
22691 Ok(token) => token,
22692 Err(e) => {
22693 dlg.finished(false);
22694 return Err(common::Error::MissingToken(e));
22695 }
22696 },
22697 };
22698 let mut req_result = {
22699 let client = &self.hub.client;
22700 dlg.pre_request();
22701 let mut req_builder = hyper::Request::builder()
22702 .method(hyper::Method::GET)
22703 .uri(url.as_str())
22704 .header(USER_AGENT, self.hub._user_agent.clone());
22705
22706 if let Some(token) = token.as_ref() {
22707 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22708 }
22709
22710 let request = req_builder
22711 .header(CONTENT_LENGTH, 0_u64)
22712 .body(common::to_body::<String>(None));
22713
22714 client.request(request.unwrap()).await
22715 };
22716
22717 match req_result {
22718 Err(err) => {
22719 if let common::Retry::After(d) = dlg.http_error(&err) {
22720 sleep(d).await;
22721 continue;
22722 }
22723 dlg.finished(false);
22724 return Err(common::Error::HttpError(err));
22725 }
22726 Ok(res) => {
22727 let (mut parts, body) = res.into_parts();
22728 let mut body = common::Body::new(body);
22729 if !parts.status.is_success() {
22730 let bytes = common::to_bytes(body).await.unwrap_or_default();
22731 let error = serde_json::from_str(&common::to_string(&bytes));
22732 let response = common::to_response(parts, bytes.into());
22733
22734 if let common::Retry::After(d) =
22735 dlg.http_failure(&response, error.as_ref().ok())
22736 {
22737 sleep(d).await;
22738 continue;
22739 }
22740
22741 dlg.finished(false);
22742
22743 return Err(match error {
22744 Ok(value) => common::Error::BadRequest(value),
22745 _ => common::Error::Failure(response),
22746 });
22747 }
22748 let response = {
22749 let bytes = common::to_bytes(body).await.unwrap_or_default();
22750 let encoded = common::to_string(&bytes);
22751 match serde_json::from_str(&encoded) {
22752 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22753 Err(error) => {
22754 dlg.response_json_decode_error(&encoded, &error);
22755 return Err(common::Error::JsonDecodeError(
22756 encoded.to_string(),
22757 error,
22758 ));
22759 }
22760 }
22761 };
22762
22763 dlg.finished(true);
22764 return Ok(response);
22765 }
22766 }
22767 }
22768 }
22769
22770 /// GTM Transformation's API relative path.
22771 ///
22772 /// Sets the *path* path property to the given value.
22773 ///
22774 /// Even though the property as already been set when instantiating this call,
22775 /// we provide this method for API completeness.
22776 pub fn path(
22777 mut self,
22778 new_value: &str,
22779 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
22780 self._path = new_value.to_string();
22781 self
22782 }
22783 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22784 /// while executing the actual API request.
22785 ///
22786 /// ````text
22787 /// It should be used to handle progress information, and to implement a certain level of resilience.
22788 /// ````
22789 ///
22790 /// Sets the *delegate* property to the given value.
22791 pub fn delegate(
22792 mut self,
22793 new_value: &'a mut dyn common::Delegate,
22794 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
22795 self._delegate = Some(new_value);
22796 self
22797 }
22798
22799 /// Set any additional parameter of the query string used in the request.
22800 /// It should be used to set parameters which are not yet available through their own
22801 /// setters.
22802 ///
22803 /// Please note that this method must not be used to set any of the known parameters
22804 /// which have their own setter method. If done anyway, the request will fail.
22805 ///
22806 /// # Additional Parameters
22807 ///
22808 /// * *$.xgafv* (query-string) - V1 error format.
22809 /// * *access_token* (query-string) - OAuth access token.
22810 /// * *alt* (query-string) - Data format for response.
22811 /// * *callback* (query-string) - JSONP
22812 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22813 /// * *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.
22814 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22815 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22816 /// * *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.
22817 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22818 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22819 pub fn param<T>(
22820 mut self,
22821 name: T,
22822 value: T,
22823 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
22824 where
22825 T: AsRef<str>,
22826 {
22827 self._additional_params
22828 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22829 self
22830 }
22831
22832 /// Identifies the authorization scope for the method you are building.
22833 ///
22834 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22835 /// [`Scope::Readonly`].
22836 ///
22837 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22838 /// tokens for more than one scope.
22839 ///
22840 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22841 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22842 /// sufficient, a read-write scope will do as well.
22843 pub fn add_scope<St>(
22844 mut self,
22845 scope: St,
22846 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
22847 where
22848 St: AsRef<str>,
22849 {
22850 self._scopes.insert(String::from(scope.as_ref()));
22851 self
22852 }
22853 /// Identifies the authorization scope(s) for the method you are building.
22854 ///
22855 /// See [`Self::add_scope()`] for details.
22856 pub fn add_scopes<I, St>(
22857 mut self,
22858 scopes: I,
22859 ) -> AccountContainerWorkspaceTransformationGetCall<'a, C>
22860 where
22861 I: IntoIterator<Item = St>,
22862 St: AsRef<str>,
22863 {
22864 self._scopes
22865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22866 self
22867 }
22868
22869 /// Removes all scopes, and no default scope will be used either.
22870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22871 /// for details).
22872 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationGetCall<'a, C> {
22873 self._scopes.clear();
22874 self
22875 }
22876}
22877
22878/// Lists all GTM Transformations of a GTM container workspace.
22879///
22880/// A builder for the *containers.workspaces.transformations.list* method supported by a *account* resource.
22881/// It is not used directly, but through a [`AccountMethods`] instance.
22882///
22883/// # Example
22884///
22885/// Instantiate a resource method builder
22886///
22887/// ```test_harness,no_run
22888/// # extern crate hyper;
22889/// # extern crate hyper_rustls;
22890/// # extern crate google_tagmanager2 as tagmanager2;
22891/// # async fn dox() {
22892/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22893///
22894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22895/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22896/// # .with_native_roots()
22897/// # .unwrap()
22898/// # .https_only()
22899/// # .enable_http2()
22900/// # .build();
22901///
22902/// # let executor = hyper_util::rt::TokioExecutor::new();
22903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22904/// # secret,
22905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22906/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22907/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22908/// # ),
22909/// # ).build().await.unwrap();
22910///
22911/// # let client = hyper_util::client::legacy::Client::builder(
22912/// # hyper_util::rt::TokioExecutor::new()
22913/// # )
22914/// # .build(
22915/// # hyper_rustls::HttpsConnectorBuilder::new()
22916/// # .with_native_roots()
22917/// # .unwrap()
22918/// # .https_or_http()
22919/// # .enable_http2()
22920/// # .build()
22921/// # );
22922/// # let mut hub = TagManager::new(client, auth);
22923/// // You can configure optional parameters by calling the respective setters at will, and
22924/// // execute the final call using `doit()`.
22925/// // Values shown here are possibly random and not representative !
22926/// let result = hub.accounts().containers_workspaces_transformations_list("parent")
22927/// .page_token("aliquyam")
22928/// .doit().await;
22929/// # }
22930/// ```
22931pub struct AccountContainerWorkspaceTransformationListCall<'a, C>
22932where
22933 C: 'a,
22934{
22935 hub: &'a TagManager<C>,
22936 _parent: String,
22937 _page_token: Option<String>,
22938 _delegate: Option<&'a mut dyn common::Delegate>,
22939 _additional_params: HashMap<String, String>,
22940 _scopes: BTreeSet<String>,
22941}
22942
22943impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationListCall<'a, C> {}
22944
22945impl<'a, C> AccountContainerWorkspaceTransformationListCall<'a, C>
22946where
22947 C: common::Connector,
22948{
22949 /// Perform the operation you have build so far.
22950 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransformationsResponse)> {
22951 use std::borrow::Cow;
22952 use std::io::{Read, Seek};
22953
22954 use common::{url::Params, ToParts};
22955 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22956
22957 let mut dd = common::DefaultDelegate;
22958 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22959 dlg.begin(common::MethodInfo {
22960 id: "tagmanager.accounts.containers.workspaces.transformations.list",
22961 http_method: hyper::Method::GET,
22962 });
22963
22964 for &field in ["alt", "parent", "pageToken"].iter() {
22965 if self._additional_params.contains_key(field) {
22966 dlg.finished(false);
22967 return Err(common::Error::FieldClash(field));
22968 }
22969 }
22970
22971 let mut params = Params::with_capacity(4 + self._additional_params.len());
22972 params.push("parent", self._parent);
22973 if let Some(value) = self._page_token.as_ref() {
22974 params.push("pageToken", value);
22975 }
22976
22977 params.extend(self._additional_params.iter());
22978
22979 params.push("alt", "json");
22980 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/transformations";
22981 if self._scopes.is_empty() {
22982 self._scopes.insert(Scope::Readonly.as_ref().to_string());
22983 }
22984
22985 #[allow(clippy::single_element_loop)]
22986 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22987 url = params.uri_replacement(url, param_name, find_this, true);
22988 }
22989 {
22990 let to_remove = ["parent"];
22991 params.remove_params(&to_remove);
22992 }
22993
22994 let url = params.parse_with_url(&url);
22995
22996 loop {
22997 let token = match self
22998 .hub
22999 .auth
23000 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23001 .await
23002 {
23003 Ok(token) => token,
23004 Err(e) => match dlg.token(e) {
23005 Ok(token) => token,
23006 Err(e) => {
23007 dlg.finished(false);
23008 return Err(common::Error::MissingToken(e));
23009 }
23010 },
23011 };
23012 let mut req_result = {
23013 let client = &self.hub.client;
23014 dlg.pre_request();
23015 let mut req_builder = hyper::Request::builder()
23016 .method(hyper::Method::GET)
23017 .uri(url.as_str())
23018 .header(USER_AGENT, self.hub._user_agent.clone());
23019
23020 if let Some(token) = token.as_ref() {
23021 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23022 }
23023
23024 let request = req_builder
23025 .header(CONTENT_LENGTH, 0_u64)
23026 .body(common::to_body::<String>(None));
23027
23028 client.request(request.unwrap()).await
23029 };
23030
23031 match req_result {
23032 Err(err) => {
23033 if let common::Retry::After(d) = dlg.http_error(&err) {
23034 sleep(d).await;
23035 continue;
23036 }
23037 dlg.finished(false);
23038 return Err(common::Error::HttpError(err));
23039 }
23040 Ok(res) => {
23041 let (mut parts, body) = res.into_parts();
23042 let mut body = common::Body::new(body);
23043 if !parts.status.is_success() {
23044 let bytes = common::to_bytes(body).await.unwrap_or_default();
23045 let error = serde_json::from_str(&common::to_string(&bytes));
23046 let response = common::to_response(parts, bytes.into());
23047
23048 if let common::Retry::After(d) =
23049 dlg.http_failure(&response, error.as_ref().ok())
23050 {
23051 sleep(d).await;
23052 continue;
23053 }
23054
23055 dlg.finished(false);
23056
23057 return Err(match error {
23058 Ok(value) => common::Error::BadRequest(value),
23059 _ => common::Error::Failure(response),
23060 });
23061 }
23062 let response = {
23063 let bytes = common::to_bytes(body).await.unwrap_or_default();
23064 let encoded = common::to_string(&bytes);
23065 match serde_json::from_str(&encoded) {
23066 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23067 Err(error) => {
23068 dlg.response_json_decode_error(&encoded, &error);
23069 return Err(common::Error::JsonDecodeError(
23070 encoded.to_string(),
23071 error,
23072 ));
23073 }
23074 }
23075 };
23076
23077 dlg.finished(true);
23078 return Ok(response);
23079 }
23080 }
23081 }
23082 }
23083
23084 /// GTM Workspace's API relative path.
23085 ///
23086 /// Sets the *parent* path property to the given value.
23087 ///
23088 /// Even though the property as already been set when instantiating this call,
23089 /// we provide this method for API completeness.
23090 pub fn parent(
23091 mut self,
23092 new_value: &str,
23093 ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
23094 self._parent = new_value.to_string();
23095 self
23096 }
23097 /// Continuation token for fetching the next page of results.
23098 ///
23099 /// Sets the *page token* query property to the given value.
23100 pub fn page_token(
23101 mut self,
23102 new_value: &str,
23103 ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
23104 self._page_token = Some(new_value.to_string());
23105 self
23106 }
23107 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23108 /// while executing the actual API request.
23109 ///
23110 /// ````text
23111 /// It should be used to handle progress information, and to implement a certain level of resilience.
23112 /// ````
23113 ///
23114 /// Sets the *delegate* property to the given value.
23115 pub fn delegate(
23116 mut self,
23117 new_value: &'a mut dyn common::Delegate,
23118 ) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
23119 self._delegate = Some(new_value);
23120 self
23121 }
23122
23123 /// Set any additional parameter of the query string used in the request.
23124 /// It should be used to set parameters which are not yet available through their own
23125 /// setters.
23126 ///
23127 /// Please note that this method must not be used to set any of the known parameters
23128 /// which have their own setter method. If done anyway, the request will fail.
23129 ///
23130 /// # Additional Parameters
23131 ///
23132 /// * *$.xgafv* (query-string) - V1 error format.
23133 /// * *access_token* (query-string) - OAuth access token.
23134 /// * *alt* (query-string) - Data format for response.
23135 /// * *callback* (query-string) - JSONP
23136 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23137 /// * *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.
23138 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23139 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23140 /// * *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.
23141 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23142 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23143 pub fn param<T>(
23144 mut self,
23145 name: T,
23146 value: T,
23147 ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
23148 where
23149 T: AsRef<str>,
23150 {
23151 self._additional_params
23152 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23153 self
23154 }
23155
23156 /// Identifies the authorization scope for the method you are building.
23157 ///
23158 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23159 /// [`Scope::Readonly`].
23160 ///
23161 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23162 /// tokens for more than one scope.
23163 ///
23164 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23165 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23166 /// sufficient, a read-write scope will do as well.
23167 pub fn add_scope<St>(
23168 mut self,
23169 scope: St,
23170 ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
23171 where
23172 St: AsRef<str>,
23173 {
23174 self._scopes.insert(String::from(scope.as_ref()));
23175 self
23176 }
23177 /// Identifies the authorization scope(s) for the method you are building.
23178 ///
23179 /// See [`Self::add_scope()`] for details.
23180 pub fn add_scopes<I, St>(
23181 mut self,
23182 scopes: I,
23183 ) -> AccountContainerWorkspaceTransformationListCall<'a, C>
23184 where
23185 I: IntoIterator<Item = St>,
23186 St: AsRef<str>,
23187 {
23188 self._scopes
23189 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23190 self
23191 }
23192
23193 /// Removes all scopes, and no default scope will be used either.
23194 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23195 /// for details).
23196 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationListCall<'a, C> {
23197 self._scopes.clear();
23198 self
23199 }
23200}
23201
23202/// Reverts changes to a GTM Transformation in a GTM Workspace.
23203///
23204/// A builder for the *containers.workspaces.transformations.revert* method supported by a *account* resource.
23205/// It is not used directly, but through a [`AccountMethods`] instance.
23206///
23207/// # Example
23208///
23209/// Instantiate a resource method builder
23210///
23211/// ```test_harness,no_run
23212/// # extern crate hyper;
23213/// # extern crate hyper_rustls;
23214/// # extern crate google_tagmanager2 as tagmanager2;
23215/// # async fn dox() {
23216/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23217///
23218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23219/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23220/// # .with_native_roots()
23221/// # .unwrap()
23222/// # .https_only()
23223/// # .enable_http2()
23224/// # .build();
23225///
23226/// # let executor = hyper_util::rt::TokioExecutor::new();
23227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23228/// # secret,
23229/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23230/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23231/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23232/// # ),
23233/// # ).build().await.unwrap();
23234///
23235/// # let client = hyper_util::client::legacy::Client::builder(
23236/// # hyper_util::rt::TokioExecutor::new()
23237/// # )
23238/// # .build(
23239/// # hyper_rustls::HttpsConnectorBuilder::new()
23240/// # .with_native_roots()
23241/// # .unwrap()
23242/// # .https_or_http()
23243/// # .enable_http2()
23244/// # .build()
23245/// # );
23246/// # let mut hub = TagManager::new(client, auth);
23247/// // You can configure optional parameters by calling the respective setters at will, and
23248/// // execute the final call using `doit()`.
23249/// // Values shown here are possibly random and not representative !
23250/// let result = hub.accounts().containers_workspaces_transformations_revert("path")
23251/// .fingerprint("sadipscing")
23252/// .doit().await;
23253/// # }
23254/// ```
23255pub struct AccountContainerWorkspaceTransformationRevertCall<'a, C>
23256where
23257 C: 'a,
23258{
23259 hub: &'a TagManager<C>,
23260 _path: String,
23261 _fingerprint: Option<String>,
23262 _delegate: Option<&'a mut dyn common::Delegate>,
23263 _additional_params: HashMap<String, String>,
23264 _scopes: BTreeSet<String>,
23265}
23266
23267impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationRevertCall<'a, C> {}
23268
23269impl<'a, C> AccountContainerWorkspaceTransformationRevertCall<'a, C>
23270where
23271 C: common::Connector,
23272{
23273 /// Perform the operation you have build so far.
23274 pub async fn doit(
23275 mut self,
23276 ) -> common::Result<(common::Response, RevertTransformationResponse)> {
23277 use std::borrow::Cow;
23278 use std::io::{Read, Seek};
23279
23280 use common::{url::Params, ToParts};
23281 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23282
23283 let mut dd = common::DefaultDelegate;
23284 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23285 dlg.begin(common::MethodInfo {
23286 id: "tagmanager.accounts.containers.workspaces.transformations.revert",
23287 http_method: hyper::Method::POST,
23288 });
23289
23290 for &field in ["alt", "path", "fingerprint"].iter() {
23291 if self._additional_params.contains_key(field) {
23292 dlg.finished(false);
23293 return Err(common::Error::FieldClash(field));
23294 }
23295 }
23296
23297 let mut params = Params::with_capacity(4 + self._additional_params.len());
23298 params.push("path", self._path);
23299 if let Some(value) = self._fingerprint.as_ref() {
23300 params.push("fingerprint", value);
23301 }
23302
23303 params.extend(self._additional_params.iter());
23304
23305 params.push("alt", "json");
23306 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
23307 if self._scopes.is_empty() {
23308 self._scopes
23309 .insert(Scope::EditContainer.as_ref().to_string());
23310 }
23311
23312 #[allow(clippy::single_element_loop)]
23313 for &(find_this, param_name) in [("{+path}", "path")].iter() {
23314 url = params.uri_replacement(url, param_name, find_this, true);
23315 }
23316 {
23317 let to_remove = ["path"];
23318 params.remove_params(&to_remove);
23319 }
23320
23321 let url = params.parse_with_url(&url);
23322
23323 loop {
23324 let token = match self
23325 .hub
23326 .auth
23327 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23328 .await
23329 {
23330 Ok(token) => token,
23331 Err(e) => match dlg.token(e) {
23332 Ok(token) => token,
23333 Err(e) => {
23334 dlg.finished(false);
23335 return Err(common::Error::MissingToken(e));
23336 }
23337 },
23338 };
23339 let mut req_result = {
23340 let client = &self.hub.client;
23341 dlg.pre_request();
23342 let mut req_builder = hyper::Request::builder()
23343 .method(hyper::Method::POST)
23344 .uri(url.as_str())
23345 .header(USER_AGENT, self.hub._user_agent.clone());
23346
23347 if let Some(token) = token.as_ref() {
23348 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23349 }
23350
23351 let request = req_builder
23352 .header(CONTENT_LENGTH, 0_u64)
23353 .body(common::to_body::<String>(None));
23354
23355 client.request(request.unwrap()).await
23356 };
23357
23358 match req_result {
23359 Err(err) => {
23360 if let common::Retry::After(d) = dlg.http_error(&err) {
23361 sleep(d).await;
23362 continue;
23363 }
23364 dlg.finished(false);
23365 return Err(common::Error::HttpError(err));
23366 }
23367 Ok(res) => {
23368 let (mut parts, body) = res.into_parts();
23369 let mut body = common::Body::new(body);
23370 if !parts.status.is_success() {
23371 let bytes = common::to_bytes(body).await.unwrap_or_default();
23372 let error = serde_json::from_str(&common::to_string(&bytes));
23373 let response = common::to_response(parts, bytes.into());
23374
23375 if let common::Retry::After(d) =
23376 dlg.http_failure(&response, error.as_ref().ok())
23377 {
23378 sleep(d).await;
23379 continue;
23380 }
23381
23382 dlg.finished(false);
23383
23384 return Err(match error {
23385 Ok(value) => common::Error::BadRequest(value),
23386 _ => common::Error::Failure(response),
23387 });
23388 }
23389 let response = {
23390 let bytes = common::to_bytes(body).await.unwrap_or_default();
23391 let encoded = common::to_string(&bytes);
23392 match serde_json::from_str(&encoded) {
23393 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23394 Err(error) => {
23395 dlg.response_json_decode_error(&encoded, &error);
23396 return Err(common::Error::JsonDecodeError(
23397 encoded.to_string(),
23398 error,
23399 ));
23400 }
23401 }
23402 };
23403
23404 dlg.finished(true);
23405 return Ok(response);
23406 }
23407 }
23408 }
23409 }
23410
23411 /// GTM Transformation's API relative path.
23412 ///
23413 /// Sets the *path* path property to the given value.
23414 ///
23415 /// Even though the property as already been set when instantiating this call,
23416 /// we provide this method for API completeness.
23417 pub fn path(
23418 mut self,
23419 new_value: &str,
23420 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
23421 self._path = new_value.to_string();
23422 self
23423 }
23424 /// When provided, this fingerprint must match the fingerprint of the transformation in storage.
23425 ///
23426 /// Sets the *fingerprint* query property to the given value.
23427 pub fn fingerprint(
23428 mut self,
23429 new_value: &str,
23430 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
23431 self._fingerprint = Some(new_value.to_string());
23432 self
23433 }
23434 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23435 /// while executing the actual API request.
23436 ///
23437 /// ````text
23438 /// It should be used to handle progress information, and to implement a certain level of resilience.
23439 /// ````
23440 ///
23441 /// Sets the *delegate* property to the given value.
23442 pub fn delegate(
23443 mut self,
23444 new_value: &'a mut dyn common::Delegate,
23445 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
23446 self._delegate = Some(new_value);
23447 self
23448 }
23449
23450 /// Set any additional parameter of the query string used in the request.
23451 /// It should be used to set parameters which are not yet available through their own
23452 /// setters.
23453 ///
23454 /// Please note that this method must not be used to set any of the known parameters
23455 /// which have their own setter method. If done anyway, the request will fail.
23456 ///
23457 /// # Additional Parameters
23458 ///
23459 /// * *$.xgafv* (query-string) - V1 error format.
23460 /// * *access_token* (query-string) - OAuth access token.
23461 /// * *alt* (query-string) - Data format for response.
23462 /// * *callback* (query-string) - JSONP
23463 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23464 /// * *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.
23465 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23466 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23467 /// * *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.
23468 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23469 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23470 pub fn param<T>(
23471 mut self,
23472 name: T,
23473 value: T,
23474 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
23475 where
23476 T: AsRef<str>,
23477 {
23478 self._additional_params
23479 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23480 self
23481 }
23482
23483 /// Identifies the authorization scope for the method you are building.
23484 ///
23485 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23486 /// [`Scope::EditContainer`].
23487 ///
23488 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23489 /// tokens for more than one scope.
23490 ///
23491 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23492 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23493 /// sufficient, a read-write scope will do as well.
23494 pub fn add_scope<St>(
23495 mut self,
23496 scope: St,
23497 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
23498 where
23499 St: AsRef<str>,
23500 {
23501 self._scopes.insert(String::from(scope.as_ref()));
23502 self
23503 }
23504 /// Identifies the authorization scope(s) for the method you are building.
23505 ///
23506 /// See [`Self::add_scope()`] for details.
23507 pub fn add_scopes<I, St>(
23508 mut self,
23509 scopes: I,
23510 ) -> AccountContainerWorkspaceTransformationRevertCall<'a, C>
23511 where
23512 I: IntoIterator<Item = St>,
23513 St: AsRef<str>,
23514 {
23515 self._scopes
23516 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23517 self
23518 }
23519
23520 /// Removes all scopes, and no default scope will be used either.
23521 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23522 /// for details).
23523 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationRevertCall<'a, C> {
23524 self._scopes.clear();
23525 self
23526 }
23527}
23528
23529/// Updates a GTM Transformation.
23530///
23531/// A builder for the *containers.workspaces.transformations.update* method supported by a *account* resource.
23532/// It is not used directly, but through a [`AccountMethods`] instance.
23533///
23534/// # Example
23535///
23536/// Instantiate a resource method builder
23537///
23538/// ```test_harness,no_run
23539/// # extern crate hyper;
23540/// # extern crate hyper_rustls;
23541/// # extern crate google_tagmanager2 as tagmanager2;
23542/// use tagmanager2::api::Transformation;
23543/// # async fn dox() {
23544/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23545///
23546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23547/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23548/// # .with_native_roots()
23549/// # .unwrap()
23550/// # .https_only()
23551/// # .enable_http2()
23552/// # .build();
23553///
23554/// # let executor = hyper_util::rt::TokioExecutor::new();
23555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23556/// # secret,
23557/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23558/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23559/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23560/// # ),
23561/// # ).build().await.unwrap();
23562///
23563/// # let client = hyper_util::client::legacy::Client::builder(
23564/// # hyper_util::rt::TokioExecutor::new()
23565/// # )
23566/// # .build(
23567/// # hyper_rustls::HttpsConnectorBuilder::new()
23568/// # .with_native_roots()
23569/// # .unwrap()
23570/// # .https_or_http()
23571/// # .enable_http2()
23572/// # .build()
23573/// # );
23574/// # let mut hub = TagManager::new(client, auth);
23575/// // As the method needs a request, you would usually fill it with the desired information
23576/// // into the respective structure. Some of the parts shown here might not be applicable !
23577/// // Values shown here are possibly random and not representative !
23578/// let mut req = Transformation::default();
23579///
23580/// // You can configure optional parameters by calling the respective setters at will, and
23581/// // execute the final call using `doit()`.
23582/// // Values shown here are possibly random and not representative !
23583/// let result = hub.accounts().containers_workspaces_transformations_update(req, "path")
23584/// .fingerprint("aliquyam")
23585/// .doit().await;
23586/// # }
23587/// ```
23588pub struct AccountContainerWorkspaceTransformationUpdateCall<'a, C>
23589where
23590 C: 'a,
23591{
23592 hub: &'a TagManager<C>,
23593 _request: Transformation,
23594 _path: String,
23595 _fingerprint: Option<String>,
23596 _delegate: Option<&'a mut dyn common::Delegate>,
23597 _additional_params: HashMap<String, String>,
23598 _scopes: BTreeSet<String>,
23599}
23600
23601impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTransformationUpdateCall<'a, C> {}
23602
23603impl<'a, C> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
23604where
23605 C: common::Connector,
23606{
23607 /// Perform the operation you have build so far.
23608 pub async fn doit(mut self) -> common::Result<(common::Response, Transformation)> {
23609 use std::borrow::Cow;
23610 use std::io::{Read, Seek};
23611
23612 use common::{url::Params, ToParts};
23613 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23614
23615 let mut dd = common::DefaultDelegate;
23616 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23617 dlg.begin(common::MethodInfo {
23618 id: "tagmanager.accounts.containers.workspaces.transformations.update",
23619 http_method: hyper::Method::PUT,
23620 });
23621
23622 for &field in ["alt", "path", "fingerprint"].iter() {
23623 if self._additional_params.contains_key(field) {
23624 dlg.finished(false);
23625 return Err(common::Error::FieldClash(field));
23626 }
23627 }
23628
23629 let mut params = Params::with_capacity(5 + self._additional_params.len());
23630 params.push("path", self._path);
23631 if let Some(value) = self._fingerprint.as_ref() {
23632 params.push("fingerprint", value);
23633 }
23634
23635 params.extend(self._additional_params.iter());
23636
23637 params.push("alt", "json");
23638 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
23639 if self._scopes.is_empty() {
23640 self._scopes
23641 .insert(Scope::EditContainer.as_ref().to_string());
23642 }
23643
23644 #[allow(clippy::single_element_loop)]
23645 for &(find_this, param_name) in [("{+path}", "path")].iter() {
23646 url = params.uri_replacement(url, param_name, find_this, true);
23647 }
23648 {
23649 let to_remove = ["path"];
23650 params.remove_params(&to_remove);
23651 }
23652
23653 let url = params.parse_with_url(&url);
23654
23655 let mut json_mime_type = mime::APPLICATION_JSON;
23656 let mut request_value_reader = {
23657 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23658 common::remove_json_null_values(&mut value);
23659 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23660 serde_json::to_writer(&mut dst, &value).unwrap();
23661 dst
23662 };
23663 let request_size = request_value_reader
23664 .seek(std::io::SeekFrom::End(0))
23665 .unwrap();
23666 request_value_reader
23667 .seek(std::io::SeekFrom::Start(0))
23668 .unwrap();
23669
23670 loop {
23671 let token = match self
23672 .hub
23673 .auth
23674 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23675 .await
23676 {
23677 Ok(token) => token,
23678 Err(e) => match dlg.token(e) {
23679 Ok(token) => token,
23680 Err(e) => {
23681 dlg.finished(false);
23682 return Err(common::Error::MissingToken(e));
23683 }
23684 },
23685 };
23686 request_value_reader
23687 .seek(std::io::SeekFrom::Start(0))
23688 .unwrap();
23689 let mut req_result = {
23690 let client = &self.hub.client;
23691 dlg.pre_request();
23692 let mut req_builder = hyper::Request::builder()
23693 .method(hyper::Method::PUT)
23694 .uri(url.as_str())
23695 .header(USER_AGENT, self.hub._user_agent.clone());
23696
23697 if let Some(token) = token.as_ref() {
23698 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23699 }
23700
23701 let request = req_builder
23702 .header(CONTENT_TYPE, json_mime_type.to_string())
23703 .header(CONTENT_LENGTH, request_size as u64)
23704 .body(common::to_body(
23705 request_value_reader.get_ref().clone().into(),
23706 ));
23707
23708 client.request(request.unwrap()).await
23709 };
23710
23711 match req_result {
23712 Err(err) => {
23713 if let common::Retry::After(d) = dlg.http_error(&err) {
23714 sleep(d).await;
23715 continue;
23716 }
23717 dlg.finished(false);
23718 return Err(common::Error::HttpError(err));
23719 }
23720 Ok(res) => {
23721 let (mut parts, body) = res.into_parts();
23722 let mut body = common::Body::new(body);
23723 if !parts.status.is_success() {
23724 let bytes = common::to_bytes(body).await.unwrap_or_default();
23725 let error = serde_json::from_str(&common::to_string(&bytes));
23726 let response = common::to_response(parts, bytes.into());
23727
23728 if let common::Retry::After(d) =
23729 dlg.http_failure(&response, error.as_ref().ok())
23730 {
23731 sleep(d).await;
23732 continue;
23733 }
23734
23735 dlg.finished(false);
23736
23737 return Err(match error {
23738 Ok(value) => common::Error::BadRequest(value),
23739 _ => common::Error::Failure(response),
23740 });
23741 }
23742 let response = {
23743 let bytes = common::to_bytes(body).await.unwrap_or_default();
23744 let encoded = common::to_string(&bytes);
23745 match serde_json::from_str(&encoded) {
23746 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23747 Err(error) => {
23748 dlg.response_json_decode_error(&encoded, &error);
23749 return Err(common::Error::JsonDecodeError(
23750 encoded.to_string(),
23751 error,
23752 ));
23753 }
23754 }
23755 };
23756
23757 dlg.finished(true);
23758 return Ok(response);
23759 }
23760 }
23761 }
23762 }
23763
23764 ///
23765 /// Sets the *request* property to the given value.
23766 ///
23767 /// Even though the property as already been set when instantiating this call,
23768 /// we provide this method for API completeness.
23769 pub fn request(
23770 mut self,
23771 new_value: Transformation,
23772 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
23773 self._request = new_value;
23774 self
23775 }
23776 /// GTM Transformation's API relative path.
23777 ///
23778 /// Sets the *path* path property to the given value.
23779 ///
23780 /// Even though the property as already been set when instantiating this call,
23781 /// we provide this method for API completeness.
23782 pub fn path(
23783 mut self,
23784 new_value: &str,
23785 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
23786 self._path = new_value.to_string();
23787 self
23788 }
23789 /// When provided, this fingerprint must match the fingerprint of the transformation in storage.
23790 ///
23791 /// Sets the *fingerprint* query property to the given value.
23792 pub fn fingerprint(
23793 mut self,
23794 new_value: &str,
23795 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
23796 self._fingerprint = Some(new_value.to_string());
23797 self
23798 }
23799 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23800 /// while executing the actual API request.
23801 ///
23802 /// ````text
23803 /// It should be used to handle progress information, and to implement a certain level of resilience.
23804 /// ````
23805 ///
23806 /// Sets the *delegate* property to the given value.
23807 pub fn delegate(
23808 mut self,
23809 new_value: &'a mut dyn common::Delegate,
23810 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
23811 self._delegate = Some(new_value);
23812 self
23813 }
23814
23815 /// Set any additional parameter of the query string used in the request.
23816 /// It should be used to set parameters which are not yet available through their own
23817 /// setters.
23818 ///
23819 /// Please note that this method must not be used to set any of the known parameters
23820 /// which have their own setter method. If done anyway, the request will fail.
23821 ///
23822 /// # Additional Parameters
23823 ///
23824 /// * *$.xgafv* (query-string) - V1 error format.
23825 /// * *access_token* (query-string) - OAuth access token.
23826 /// * *alt* (query-string) - Data format for response.
23827 /// * *callback* (query-string) - JSONP
23828 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23829 /// * *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.
23830 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23831 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23832 /// * *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.
23833 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23834 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23835 pub fn param<T>(
23836 mut self,
23837 name: T,
23838 value: T,
23839 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
23840 where
23841 T: AsRef<str>,
23842 {
23843 self._additional_params
23844 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23845 self
23846 }
23847
23848 /// Identifies the authorization scope for the method you are building.
23849 ///
23850 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23851 /// [`Scope::EditContainer`].
23852 ///
23853 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23854 /// tokens for more than one scope.
23855 ///
23856 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23857 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23858 /// sufficient, a read-write scope will do as well.
23859 pub fn add_scope<St>(
23860 mut self,
23861 scope: St,
23862 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
23863 where
23864 St: AsRef<str>,
23865 {
23866 self._scopes.insert(String::from(scope.as_ref()));
23867 self
23868 }
23869 /// Identifies the authorization scope(s) for the method you are building.
23870 ///
23871 /// See [`Self::add_scope()`] for details.
23872 pub fn add_scopes<I, St>(
23873 mut self,
23874 scopes: I,
23875 ) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C>
23876 where
23877 I: IntoIterator<Item = St>,
23878 St: AsRef<str>,
23879 {
23880 self._scopes
23881 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23882 self
23883 }
23884
23885 /// Removes all scopes, and no default scope will be used either.
23886 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23887 /// for details).
23888 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTransformationUpdateCall<'a, C> {
23889 self._scopes.clear();
23890 self
23891 }
23892}
23893
23894/// Creates a GTM Trigger.
23895///
23896/// A builder for the *containers.workspaces.triggers.create* method supported by a *account* resource.
23897/// It is not used directly, but through a [`AccountMethods`] instance.
23898///
23899/// # Example
23900///
23901/// Instantiate a resource method builder
23902///
23903/// ```test_harness,no_run
23904/// # extern crate hyper;
23905/// # extern crate hyper_rustls;
23906/// # extern crate google_tagmanager2 as tagmanager2;
23907/// use tagmanager2::api::Trigger;
23908/// # async fn dox() {
23909/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23910///
23911/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23912/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23913/// # .with_native_roots()
23914/// # .unwrap()
23915/// # .https_only()
23916/// # .enable_http2()
23917/// # .build();
23918///
23919/// # let executor = hyper_util::rt::TokioExecutor::new();
23920/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23921/// # secret,
23922/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23923/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23924/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23925/// # ),
23926/// # ).build().await.unwrap();
23927///
23928/// # let client = hyper_util::client::legacy::Client::builder(
23929/// # hyper_util::rt::TokioExecutor::new()
23930/// # )
23931/// # .build(
23932/// # hyper_rustls::HttpsConnectorBuilder::new()
23933/// # .with_native_roots()
23934/// # .unwrap()
23935/// # .https_or_http()
23936/// # .enable_http2()
23937/// # .build()
23938/// # );
23939/// # let mut hub = TagManager::new(client, auth);
23940/// // As the method needs a request, you would usually fill it with the desired information
23941/// // into the respective structure. Some of the parts shown here might not be applicable !
23942/// // Values shown here are possibly random and not representative !
23943/// let mut req = Trigger::default();
23944///
23945/// // You can configure optional parameters by calling the respective setters at will, and
23946/// // execute the final call using `doit()`.
23947/// // Values shown here are possibly random and not representative !
23948/// let result = hub.accounts().containers_workspaces_triggers_create(req, "parent")
23949/// .doit().await;
23950/// # }
23951/// ```
23952pub struct AccountContainerWorkspaceTriggerCreateCall<'a, C>
23953where
23954 C: 'a,
23955{
23956 hub: &'a TagManager<C>,
23957 _request: Trigger,
23958 _parent: String,
23959 _delegate: Option<&'a mut dyn common::Delegate>,
23960 _additional_params: HashMap<String, String>,
23961 _scopes: BTreeSet<String>,
23962}
23963
23964impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerCreateCall<'a, C> {}
23965
23966impl<'a, C> AccountContainerWorkspaceTriggerCreateCall<'a, C>
23967where
23968 C: common::Connector,
23969{
23970 /// Perform the operation you have build so far.
23971 pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
23972 use std::borrow::Cow;
23973 use std::io::{Read, Seek};
23974
23975 use common::{url::Params, ToParts};
23976 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23977
23978 let mut dd = common::DefaultDelegate;
23979 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23980 dlg.begin(common::MethodInfo {
23981 id: "tagmanager.accounts.containers.workspaces.triggers.create",
23982 http_method: hyper::Method::POST,
23983 });
23984
23985 for &field in ["alt", "parent"].iter() {
23986 if self._additional_params.contains_key(field) {
23987 dlg.finished(false);
23988 return Err(common::Error::FieldClash(field));
23989 }
23990 }
23991
23992 let mut params = Params::with_capacity(4 + self._additional_params.len());
23993 params.push("parent", self._parent);
23994
23995 params.extend(self._additional_params.iter());
23996
23997 params.push("alt", "json");
23998 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/triggers";
23999 if self._scopes.is_empty() {
24000 self._scopes
24001 .insert(Scope::EditContainer.as_ref().to_string());
24002 }
24003
24004 #[allow(clippy::single_element_loop)]
24005 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24006 url = params.uri_replacement(url, param_name, find_this, true);
24007 }
24008 {
24009 let to_remove = ["parent"];
24010 params.remove_params(&to_remove);
24011 }
24012
24013 let url = params.parse_with_url(&url);
24014
24015 let mut json_mime_type = mime::APPLICATION_JSON;
24016 let mut request_value_reader = {
24017 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24018 common::remove_json_null_values(&mut value);
24019 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24020 serde_json::to_writer(&mut dst, &value).unwrap();
24021 dst
24022 };
24023 let request_size = request_value_reader
24024 .seek(std::io::SeekFrom::End(0))
24025 .unwrap();
24026 request_value_reader
24027 .seek(std::io::SeekFrom::Start(0))
24028 .unwrap();
24029
24030 loop {
24031 let token = match self
24032 .hub
24033 .auth
24034 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24035 .await
24036 {
24037 Ok(token) => token,
24038 Err(e) => match dlg.token(e) {
24039 Ok(token) => token,
24040 Err(e) => {
24041 dlg.finished(false);
24042 return Err(common::Error::MissingToken(e));
24043 }
24044 },
24045 };
24046 request_value_reader
24047 .seek(std::io::SeekFrom::Start(0))
24048 .unwrap();
24049 let mut req_result = {
24050 let client = &self.hub.client;
24051 dlg.pre_request();
24052 let mut req_builder = hyper::Request::builder()
24053 .method(hyper::Method::POST)
24054 .uri(url.as_str())
24055 .header(USER_AGENT, self.hub._user_agent.clone());
24056
24057 if let Some(token) = token.as_ref() {
24058 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24059 }
24060
24061 let request = req_builder
24062 .header(CONTENT_TYPE, json_mime_type.to_string())
24063 .header(CONTENT_LENGTH, request_size as u64)
24064 .body(common::to_body(
24065 request_value_reader.get_ref().clone().into(),
24066 ));
24067
24068 client.request(request.unwrap()).await
24069 };
24070
24071 match req_result {
24072 Err(err) => {
24073 if let common::Retry::After(d) = dlg.http_error(&err) {
24074 sleep(d).await;
24075 continue;
24076 }
24077 dlg.finished(false);
24078 return Err(common::Error::HttpError(err));
24079 }
24080 Ok(res) => {
24081 let (mut parts, body) = res.into_parts();
24082 let mut body = common::Body::new(body);
24083 if !parts.status.is_success() {
24084 let bytes = common::to_bytes(body).await.unwrap_or_default();
24085 let error = serde_json::from_str(&common::to_string(&bytes));
24086 let response = common::to_response(parts, bytes.into());
24087
24088 if let common::Retry::After(d) =
24089 dlg.http_failure(&response, error.as_ref().ok())
24090 {
24091 sleep(d).await;
24092 continue;
24093 }
24094
24095 dlg.finished(false);
24096
24097 return Err(match error {
24098 Ok(value) => common::Error::BadRequest(value),
24099 _ => common::Error::Failure(response),
24100 });
24101 }
24102 let response = {
24103 let bytes = common::to_bytes(body).await.unwrap_or_default();
24104 let encoded = common::to_string(&bytes);
24105 match serde_json::from_str(&encoded) {
24106 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24107 Err(error) => {
24108 dlg.response_json_decode_error(&encoded, &error);
24109 return Err(common::Error::JsonDecodeError(
24110 encoded.to_string(),
24111 error,
24112 ));
24113 }
24114 }
24115 };
24116
24117 dlg.finished(true);
24118 return Ok(response);
24119 }
24120 }
24121 }
24122 }
24123
24124 ///
24125 /// Sets the *request* property to the given value.
24126 ///
24127 /// Even though the property as already been set when instantiating this call,
24128 /// we provide this method for API completeness.
24129 pub fn request(
24130 mut self,
24131 new_value: Trigger,
24132 ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
24133 self._request = new_value;
24134 self
24135 }
24136 /// GTM Workspace's API relative path.
24137 ///
24138 /// Sets the *parent* path property to the given value.
24139 ///
24140 /// Even though the property as already been set when instantiating this call,
24141 /// we provide this method for API completeness.
24142 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
24143 self._parent = new_value.to_string();
24144 self
24145 }
24146 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24147 /// while executing the actual API request.
24148 ///
24149 /// ````text
24150 /// It should be used to handle progress information, and to implement a certain level of resilience.
24151 /// ````
24152 ///
24153 /// Sets the *delegate* property to the given value.
24154 pub fn delegate(
24155 mut self,
24156 new_value: &'a mut dyn common::Delegate,
24157 ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
24158 self._delegate = Some(new_value);
24159 self
24160 }
24161
24162 /// Set any additional parameter of the query string used in the request.
24163 /// It should be used to set parameters which are not yet available through their own
24164 /// setters.
24165 ///
24166 /// Please note that this method must not be used to set any of the known parameters
24167 /// which have their own setter method. If done anyway, the request will fail.
24168 ///
24169 /// # Additional Parameters
24170 ///
24171 /// * *$.xgafv* (query-string) - V1 error format.
24172 /// * *access_token* (query-string) - OAuth access token.
24173 /// * *alt* (query-string) - Data format for response.
24174 /// * *callback* (query-string) - JSONP
24175 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24176 /// * *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.
24177 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24178 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24179 /// * *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.
24180 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24181 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24182 pub fn param<T>(
24183 mut self,
24184 name: T,
24185 value: T,
24186 ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
24187 where
24188 T: AsRef<str>,
24189 {
24190 self._additional_params
24191 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24192 self
24193 }
24194
24195 /// Identifies the authorization scope for the method you are building.
24196 ///
24197 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24198 /// [`Scope::EditContainer`].
24199 ///
24200 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24201 /// tokens for more than one scope.
24202 ///
24203 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24204 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24205 /// sufficient, a read-write scope will do as well.
24206 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
24207 where
24208 St: AsRef<str>,
24209 {
24210 self._scopes.insert(String::from(scope.as_ref()));
24211 self
24212 }
24213 /// Identifies the authorization scope(s) for the method you are building.
24214 ///
24215 /// See [`Self::add_scope()`] for details.
24216 pub fn add_scopes<I, St>(
24217 mut self,
24218 scopes: I,
24219 ) -> AccountContainerWorkspaceTriggerCreateCall<'a, C>
24220 where
24221 I: IntoIterator<Item = St>,
24222 St: AsRef<str>,
24223 {
24224 self._scopes
24225 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24226 self
24227 }
24228
24229 /// Removes all scopes, and no default scope will be used either.
24230 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24231 /// for details).
24232 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerCreateCall<'a, C> {
24233 self._scopes.clear();
24234 self
24235 }
24236}
24237
24238/// Deletes a GTM Trigger.
24239///
24240/// A builder for the *containers.workspaces.triggers.delete* method supported by a *account* resource.
24241/// It is not used directly, but through a [`AccountMethods`] instance.
24242///
24243/// # Example
24244///
24245/// Instantiate a resource method builder
24246///
24247/// ```test_harness,no_run
24248/// # extern crate hyper;
24249/// # extern crate hyper_rustls;
24250/// # extern crate google_tagmanager2 as tagmanager2;
24251/// # async fn dox() {
24252/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24253///
24254/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24255/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24256/// # .with_native_roots()
24257/// # .unwrap()
24258/// # .https_only()
24259/// # .enable_http2()
24260/// # .build();
24261///
24262/// # let executor = hyper_util::rt::TokioExecutor::new();
24263/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24264/// # secret,
24265/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24266/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24267/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24268/// # ),
24269/// # ).build().await.unwrap();
24270///
24271/// # let client = hyper_util::client::legacy::Client::builder(
24272/// # hyper_util::rt::TokioExecutor::new()
24273/// # )
24274/// # .build(
24275/// # hyper_rustls::HttpsConnectorBuilder::new()
24276/// # .with_native_roots()
24277/// # .unwrap()
24278/// # .https_or_http()
24279/// # .enable_http2()
24280/// # .build()
24281/// # );
24282/// # let mut hub = TagManager::new(client, auth);
24283/// // You can configure optional parameters by calling the respective setters at will, and
24284/// // execute the final call using `doit()`.
24285/// // Values shown here are possibly random and not representative !
24286/// let result = hub.accounts().containers_workspaces_triggers_delete("path")
24287/// .doit().await;
24288/// # }
24289/// ```
24290pub struct AccountContainerWorkspaceTriggerDeleteCall<'a, C>
24291where
24292 C: 'a,
24293{
24294 hub: &'a TagManager<C>,
24295 _path: String,
24296 _delegate: Option<&'a mut dyn common::Delegate>,
24297 _additional_params: HashMap<String, String>,
24298 _scopes: BTreeSet<String>,
24299}
24300
24301impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerDeleteCall<'a, C> {}
24302
24303impl<'a, C> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
24304where
24305 C: common::Connector,
24306{
24307 /// Perform the operation you have build so far.
24308 pub async fn doit(mut self) -> common::Result<common::Response> {
24309 use std::borrow::Cow;
24310 use std::io::{Read, Seek};
24311
24312 use common::{url::Params, ToParts};
24313 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24314
24315 let mut dd = common::DefaultDelegate;
24316 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24317 dlg.begin(common::MethodInfo {
24318 id: "tagmanager.accounts.containers.workspaces.triggers.delete",
24319 http_method: hyper::Method::DELETE,
24320 });
24321
24322 for &field in ["path"].iter() {
24323 if self._additional_params.contains_key(field) {
24324 dlg.finished(false);
24325 return Err(common::Error::FieldClash(field));
24326 }
24327 }
24328
24329 let mut params = Params::with_capacity(2 + self._additional_params.len());
24330 params.push("path", self._path);
24331
24332 params.extend(self._additional_params.iter());
24333
24334 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
24335 if self._scopes.is_empty() {
24336 self._scopes
24337 .insert(Scope::EditContainer.as_ref().to_string());
24338 }
24339
24340 #[allow(clippy::single_element_loop)]
24341 for &(find_this, param_name) in [("{+path}", "path")].iter() {
24342 url = params.uri_replacement(url, param_name, find_this, true);
24343 }
24344 {
24345 let to_remove = ["path"];
24346 params.remove_params(&to_remove);
24347 }
24348
24349 let url = params.parse_with_url(&url);
24350
24351 loop {
24352 let token = match self
24353 .hub
24354 .auth
24355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24356 .await
24357 {
24358 Ok(token) => token,
24359 Err(e) => match dlg.token(e) {
24360 Ok(token) => token,
24361 Err(e) => {
24362 dlg.finished(false);
24363 return Err(common::Error::MissingToken(e));
24364 }
24365 },
24366 };
24367 let mut req_result = {
24368 let client = &self.hub.client;
24369 dlg.pre_request();
24370 let mut req_builder = hyper::Request::builder()
24371 .method(hyper::Method::DELETE)
24372 .uri(url.as_str())
24373 .header(USER_AGENT, self.hub._user_agent.clone());
24374
24375 if let Some(token) = token.as_ref() {
24376 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24377 }
24378
24379 let request = req_builder
24380 .header(CONTENT_LENGTH, 0_u64)
24381 .body(common::to_body::<String>(None));
24382
24383 client.request(request.unwrap()).await
24384 };
24385
24386 match req_result {
24387 Err(err) => {
24388 if let common::Retry::After(d) = dlg.http_error(&err) {
24389 sleep(d).await;
24390 continue;
24391 }
24392 dlg.finished(false);
24393 return Err(common::Error::HttpError(err));
24394 }
24395 Ok(res) => {
24396 let (mut parts, body) = res.into_parts();
24397 let mut body = common::Body::new(body);
24398 if !parts.status.is_success() {
24399 let bytes = common::to_bytes(body).await.unwrap_or_default();
24400 let error = serde_json::from_str(&common::to_string(&bytes));
24401 let response = common::to_response(parts, bytes.into());
24402
24403 if let common::Retry::After(d) =
24404 dlg.http_failure(&response, error.as_ref().ok())
24405 {
24406 sleep(d).await;
24407 continue;
24408 }
24409
24410 dlg.finished(false);
24411
24412 return Err(match error {
24413 Ok(value) => common::Error::BadRequest(value),
24414 _ => common::Error::Failure(response),
24415 });
24416 }
24417 let response = common::Response::from_parts(parts, body);
24418
24419 dlg.finished(true);
24420 return Ok(response);
24421 }
24422 }
24423 }
24424 }
24425
24426 /// GTM Trigger's API relative path.
24427 ///
24428 /// Sets the *path* path property to the given value.
24429 ///
24430 /// Even though the property as already been set when instantiating this call,
24431 /// we provide this method for API completeness.
24432 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
24433 self._path = new_value.to_string();
24434 self
24435 }
24436 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24437 /// while executing the actual API request.
24438 ///
24439 /// ````text
24440 /// It should be used to handle progress information, and to implement a certain level of resilience.
24441 /// ````
24442 ///
24443 /// Sets the *delegate* property to the given value.
24444 pub fn delegate(
24445 mut self,
24446 new_value: &'a mut dyn common::Delegate,
24447 ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
24448 self._delegate = Some(new_value);
24449 self
24450 }
24451
24452 /// Set any additional parameter of the query string used in the request.
24453 /// It should be used to set parameters which are not yet available through their own
24454 /// setters.
24455 ///
24456 /// Please note that this method must not be used to set any of the known parameters
24457 /// which have their own setter method. If done anyway, the request will fail.
24458 ///
24459 /// # Additional Parameters
24460 ///
24461 /// * *$.xgafv* (query-string) - V1 error format.
24462 /// * *access_token* (query-string) - OAuth access token.
24463 /// * *alt* (query-string) - Data format for response.
24464 /// * *callback* (query-string) - JSONP
24465 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24466 /// * *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.
24467 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24468 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24469 /// * *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.
24470 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24471 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24472 pub fn param<T>(
24473 mut self,
24474 name: T,
24475 value: T,
24476 ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
24477 where
24478 T: AsRef<str>,
24479 {
24480 self._additional_params
24481 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24482 self
24483 }
24484
24485 /// Identifies the authorization scope for the method you are building.
24486 ///
24487 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24488 /// [`Scope::EditContainer`].
24489 ///
24490 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24491 /// tokens for more than one scope.
24492 ///
24493 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24494 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24495 /// sufficient, a read-write scope will do as well.
24496 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
24497 where
24498 St: AsRef<str>,
24499 {
24500 self._scopes.insert(String::from(scope.as_ref()));
24501 self
24502 }
24503 /// Identifies the authorization scope(s) for the method you are building.
24504 ///
24505 /// See [`Self::add_scope()`] for details.
24506 pub fn add_scopes<I, St>(
24507 mut self,
24508 scopes: I,
24509 ) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C>
24510 where
24511 I: IntoIterator<Item = St>,
24512 St: AsRef<str>,
24513 {
24514 self._scopes
24515 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24516 self
24517 }
24518
24519 /// Removes all scopes, and no default scope will be used either.
24520 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24521 /// for details).
24522 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerDeleteCall<'a, C> {
24523 self._scopes.clear();
24524 self
24525 }
24526}
24527
24528/// Gets a GTM Trigger.
24529///
24530/// A builder for the *containers.workspaces.triggers.get* method supported by a *account* resource.
24531/// It is not used directly, but through a [`AccountMethods`] instance.
24532///
24533/// # Example
24534///
24535/// Instantiate a resource method builder
24536///
24537/// ```test_harness,no_run
24538/// # extern crate hyper;
24539/// # extern crate hyper_rustls;
24540/// # extern crate google_tagmanager2 as tagmanager2;
24541/// # async fn dox() {
24542/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24543///
24544/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24545/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24546/// # .with_native_roots()
24547/// # .unwrap()
24548/// # .https_only()
24549/// # .enable_http2()
24550/// # .build();
24551///
24552/// # let executor = hyper_util::rt::TokioExecutor::new();
24553/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24554/// # secret,
24555/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24556/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24557/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24558/// # ),
24559/// # ).build().await.unwrap();
24560///
24561/// # let client = hyper_util::client::legacy::Client::builder(
24562/// # hyper_util::rt::TokioExecutor::new()
24563/// # )
24564/// # .build(
24565/// # hyper_rustls::HttpsConnectorBuilder::new()
24566/// # .with_native_roots()
24567/// # .unwrap()
24568/// # .https_or_http()
24569/// # .enable_http2()
24570/// # .build()
24571/// # );
24572/// # let mut hub = TagManager::new(client, auth);
24573/// // You can configure optional parameters by calling the respective setters at will, and
24574/// // execute the final call using `doit()`.
24575/// // Values shown here are possibly random and not representative !
24576/// let result = hub.accounts().containers_workspaces_triggers_get("path")
24577/// .doit().await;
24578/// # }
24579/// ```
24580pub struct AccountContainerWorkspaceTriggerGetCall<'a, C>
24581where
24582 C: 'a,
24583{
24584 hub: &'a TagManager<C>,
24585 _path: String,
24586 _delegate: Option<&'a mut dyn common::Delegate>,
24587 _additional_params: HashMap<String, String>,
24588 _scopes: BTreeSet<String>,
24589}
24590
24591impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerGetCall<'a, C> {}
24592
24593impl<'a, C> AccountContainerWorkspaceTriggerGetCall<'a, C>
24594where
24595 C: common::Connector,
24596{
24597 /// Perform the operation you have build so far.
24598 pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
24599 use std::borrow::Cow;
24600 use std::io::{Read, Seek};
24601
24602 use common::{url::Params, ToParts};
24603 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24604
24605 let mut dd = common::DefaultDelegate;
24606 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24607 dlg.begin(common::MethodInfo {
24608 id: "tagmanager.accounts.containers.workspaces.triggers.get",
24609 http_method: hyper::Method::GET,
24610 });
24611
24612 for &field in ["alt", "path"].iter() {
24613 if self._additional_params.contains_key(field) {
24614 dlg.finished(false);
24615 return Err(common::Error::FieldClash(field));
24616 }
24617 }
24618
24619 let mut params = Params::with_capacity(3 + self._additional_params.len());
24620 params.push("path", self._path);
24621
24622 params.extend(self._additional_params.iter());
24623
24624 params.push("alt", "json");
24625 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
24626 if self._scopes.is_empty() {
24627 self._scopes.insert(Scope::Readonly.as_ref().to_string());
24628 }
24629
24630 #[allow(clippy::single_element_loop)]
24631 for &(find_this, param_name) in [("{+path}", "path")].iter() {
24632 url = params.uri_replacement(url, param_name, find_this, true);
24633 }
24634 {
24635 let to_remove = ["path"];
24636 params.remove_params(&to_remove);
24637 }
24638
24639 let url = params.parse_with_url(&url);
24640
24641 loop {
24642 let token = match self
24643 .hub
24644 .auth
24645 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24646 .await
24647 {
24648 Ok(token) => token,
24649 Err(e) => match dlg.token(e) {
24650 Ok(token) => token,
24651 Err(e) => {
24652 dlg.finished(false);
24653 return Err(common::Error::MissingToken(e));
24654 }
24655 },
24656 };
24657 let mut req_result = {
24658 let client = &self.hub.client;
24659 dlg.pre_request();
24660 let mut req_builder = hyper::Request::builder()
24661 .method(hyper::Method::GET)
24662 .uri(url.as_str())
24663 .header(USER_AGENT, self.hub._user_agent.clone());
24664
24665 if let Some(token) = token.as_ref() {
24666 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24667 }
24668
24669 let request = req_builder
24670 .header(CONTENT_LENGTH, 0_u64)
24671 .body(common::to_body::<String>(None));
24672
24673 client.request(request.unwrap()).await
24674 };
24675
24676 match req_result {
24677 Err(err) => {
24678 if let common::Retry::After(d) = dlg.http_error(&err) {
24679 sleep(d).await;
24680 continue;
24681 }
24682 dlg.finished(false);
24683 return Err(common::Error::HttpError(err));
24684 }
24685 Ok(res) => {
24686 let (mut parts, body) = res.into_parts();
24687 let mut body = common::Body::new(body);
24688 if !parts.status.is_success() {
24689 let bytes = common::to_bytes(body).await.unwrap_or_default();
24690 let error = serde_json::from_str(&common::to_string(&bytes));
24691 let response = common::to_response(parts, bytes.into());
24692
24693 if let common::Retry::After(d) =
24694 dlg.http_failure(&response, error.as_ref().ok())
24695 {
24696 sleep(d).await;
24697 continue;
24698 }
24699
24700 dlg.finished(false);
24701
24702 return Err(match error {
24703 Ok(value) => common::Error::BadRequest(value),
24704 _ => common::Error::Failure(response),
24705 });
24706 }
24707 let response = {
24708 let bytes = common::to_bytes(body).await.unwrap_or_default();
24709 let encoded = common::to_string(&bytes);
24710 match serde_json::from_str(&encoded) {
24711 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24712 Err(error) => {
24713 dlg.response_json_decode_error(&encoded, &error);
24714 return Err(common::Error::JsonDecodeError(
24715 encoded.to_string(),
24716 error,
24717 ));
24718 }
24719 }
24720 };
24721
24722 dlg.finished(true);
24723 return Ok(response);
24724 }
24725 }
24726 }
24727 }
24728
24729 /// GTM Trigger's API relative path.
24730 ///
24731 /// Sets the *path* path property to the given value.
24732 ///
24733 /// Even though the property as already been set when instantiating this call,
24734 /// we provide this method for API completeness.
24735 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
24736 self._path = new_value.to_string();
24737 self
24738 }
24739 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24740 /// while executing the actual API request.
24741 ///
24742 /// ````text
24743 /// It should be used to handle progress information, and to implement a certain level of resilience.
24744 /// ````
24745 ///
24746 /// Sets the *delegate* property to the given value.
24747 pub fn delegate(
24748 mut self,
24749 new_value: &'a mut dyn common::Delegate,
24750 ) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
24751 self._delegate = Some(new_value);
24752 self
24753 }
24754
24755 /// Set any additional parameter of the query string used in the request.
24756 /// It should be used to set parameters which are not yet available through their own
24757 /// setters.
24758 ///
24759 /// Please note that this method must not be used to set any of the known parameters
24760 /// which have their own setter method. If done anyway, the request will fail.
24761 ///
24762 /// # Additional Parameters
24763 ///
24764 /// * *$.xgafv* (query-string) - V1 error format.
24765 /// * *access_token* (query-string) - OAuth access token.
24766 /// * *alt* (query-string) - Data format for response.
24767 /// * *callback* (query-string) - JSONP
24768 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24769 /// * *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.
24770 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24771 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24772 /// * *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.
24773 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24774 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24775 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
24776 where
24777 T: AsRef<str>,
24778 {
24779 self._additional_params
24780 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24781 self
24782 }
24783
24784 /// Identifies the authorization scope for the method you are building.
24785 ///
24786 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24787 /// [`Scope::Readonly`].
24788 ///
24789 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24790 /// tokens for more than one scope.
24791 ///
24792 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24793 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24794 /// sufficient, a read-write scope will do as well.
24795 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
24796 where
24797 St: AsRef<str>,
24798 {
24799 self._scopes.insert(String::from(scope.as_ref()));
24800 self
24801 }
24802 /// Identifies the authorization scope(s) for the method you are building.
24803 ///
24804 /// See [`Self::add_scope()`] for details.
24805 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTriggerGetCall<'a, C>
24806 where
24807 I: IntoIterator<Item = St>,
24808 St: AsRef<str>,
24809 {
24810 self._scopes
24811 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24812 self
24813 }
24814
24815 /// Removes all scopes, and no default scope will be used either.
24816 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24817 /// for details).
24818 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerGetCall<'a, C> {
24819 self._scopes.clear();
24820 self
24821 }
24822}
24823
24824/// Lists all GTM Triggers of a Container.
24825///
24826/// A builder for the *containers.workspaces.triggers.list* method supported by a *account* resource.
24827/// It is not used directly, but through a [`AccountMethods`] instance.
24828///
24829/// # Example
24830///
24831/// Instantiate a resource method builder
24832///
24833/// ```test_harness,no_run
24834/// # extern crate hyper;
24835/// # extern crate hyper_rustls;
24836/// # extern crate google_tagmanager2 as tagmanager2;
24837/// # async fn dox() {
24838/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24839///
24840/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24841/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24842/// # .with_native_roots()
24843/// # .unwrap()
24844/// # .https_only()
24845/// # .enable_http2()
24846/// # .build();
24847///
24848/// # let executor = hyper_util::rt::TokioExecutor::new();
24849/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24850/// # secret,
24851/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24852/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24853/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24854/// # ),
24855/// # ).build().await.unwrap();
24856///
24857/// # let client = hyper_util::client::legacy::Client::builder(
24858/// # hyper_util::rt::TokioExecutor::new()
24859/// # )
24860/// # .build(
24861/// # hyper_rustls::HttpsConnectorBuilder::new()
24862/// # .with_native_roots()
24863/// # .unwrap()
24864/// # .https_or_http()
24865/// # .enable_http2()
24866/// # .build()
24867/// # );
24868/// # let mut hub = TagManager::new(client, auth);
24869/// // You can configure optional parameters by calling the respective setters at will, and
24870/// // execute the final call using `doit()`.
24871/// // Values shown here are possibly random and not representative !
24872/// let result = hub.accounts().containers_workspaces_triggers_list("parent")
24873/// .page_token("consetetur")
24874/// .doit().await;
24875/// # }
24876/// ```
24877pub struct AccountContainerWorkspaceTriggerListCall<'a, C>
24878where
24879 C: 'a,
24880{
24881 hub: &'a TagManager<C>,
24882 _parent: String,
24883 _page_token: Option<String>,
24884 _delegate: Option<&'a mut dyn common::Delegate>,
24885 _additional_params: HashMap<String, String>,
24886 _scopes: BTreeSet<String>,
24887}
24888
24889impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerListCall<'a, C> {}
24890
24891impl<'a, C> AccountContainerWorkspaceTriggerListCall<'a, C>
24892where
24893 C: common::Connector,
24894{
24895 /// Perform the operation you have build so far.
24896 pub async fn doit(mut self) -> common::Result<(common::Response, ListTriggersResponse)> {
24897 use std::borrow::Cow;
24898 use std::io::{Read, Seek};
24899
24900 use common::{url::Params, ToParts};
24901 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24902
24903 let mut dd = common::DefaultDelegate;
24904 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24905 dlg.begin(common::MethodInfo {
24906 id: "tagmanager.accounts.containers.workspaces.triggers.list",
24907 http_method: hyper::Method::GET,
24908 });
24909
24910 for &field in ["alt", "parent", "pageToken"].iter() {
24911 if self._additional_params.contains_key(field) {
24912 dlg.finished(false);
24913 return Err(common::Error::FieldClash(field));
24914 }
24915 }
24916
24917 let mut params = Params::with_capacity(4 + self._additional_params.len());
24918 params.push("parent", self._parent);
24919 if let Some(value) = self._page_token.as_ref() {
24920 params.push("pageToken", value);
24921 }
24922
24923 params.extend(self._additional_params.iter());
24924
24925 params.push("alt", "json");
24926 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/triggers";
24927 if self._scopes.is_empty() {
24928 self._scopes.insert(Scope::Readonly.as_ref().to_string());
24929 }
24930
24931 #[allow(clippy::single_element_loop)]
24932 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24933 url = params.uri_replacement(url, param_name, find_this, true);
24934 }
24935 {
24936 let to_remove = ["parent"];
24937 params.remove_params(&to_remove);
24938 }
24939
24940 let url = params.parse_with_url(&url);
24941
24942 loop {
24943 let token = match self
24944 .hub
24945 .auth
24946 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24947 .await
24948 {
24949 Ok(token) => token,
24950 Err(e) => match dlg.token(e) {
24951 Ok(token) => token,
24952 Err(e) => {
24953 dlg.finished(false);
24954 return Err(common::Error::MissingToken(e));
24955 }
24956 },
24957 };
24958 let mut req_result = {
24959 let client = &self.hub.client;
24960 dlg.pre_request();
24961 let mut req_builder = hyper::Request::builder()
24962 .method(hyper::Method::GET)
24963 .uri(url.as_str())
24964 .header(USER_AGENT, self.hub._user_agent.clone());
24965
24966 if let Some(token) = token.as_ref() {
24967 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24968 }
24969
24970 let request = req_builder
24971 .header(CONTENT_LENGTH, 0_u64)
24972 .body(common::to_body::<String>(None));
24973
24974 client.request(request.unwrap()).await
24975 };
24976
24977 match req_result {
24978 Err(err) => {
24979 if let common::Retry::After(d) = dlg.http_error(&err) {
24980 sleep(d).await;
24981 continue;
24982 }
24983 dlg.finished(false);
24984 return Err(common::Error::HttpError(err));
24985 }
24986 Ok(res) => {
24987 let (mut parts, body) = res.into_parts();
24988 let mut body = common::Body::new(body);
24989 if !parts.status.is_success() {
24990 let bytes = common::to_bytes(body).await.unwrap_or_default();
24991 let error = serde_json::from_str(&common::to_string(&bytes));
24992 let response = common::to_response(parts, bytes.into());
24993
24994 if let common::Retry::After(d) =
24995 dlg.http_failure(&response, error.as_ref().ok())
24996 {
24997 sleep(d).await;
24998 continue;
24999 }
25000
25001 dlg.finished(false);
25002
25003 return Err(match error {
25004 Ok(value) => common::Error::BadRequest(value),
25005 _ => common::Error::Failure(response),
25006 });
25007 }
25008 let response = {
25009 let bytes = common::to_bytes(body).await.unwrap_or_default();
25010 let encoded = common::to_string(&bytes);
25011 match serde_json::from_str(&encoded) {
25012 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25013 Err(error) => {
25014 dlg.response_json_decode_error(&encoded, &error);
25015 return Err(common::Error::JsonDecodeError(
25016 encoded.to_string(),
25017 error,
25018 ));
25019 }
25020 }
25021 };
25022
25023 dlg.finished(true);
25024 return Ok(response);
25025 }
25026 }
25027 }
25028 }
25029
25030 /// GTM Workspace's API relative path.
25031 ///
25032 /// Sets the *parent* path property to the given value.
25033 ///
25034 /// Even though the property as already been set when instantiating this call,
25035 /// we provide this method for API completeness.
25036 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
25037 self._parent = new_value.to_string();
25038 self
25039 }
25040 /// Continuation token for fetching the next page of results.
25041 ///
25042 /// Sets the *page token* query property to the given value.
25043 pub fn page_token(
25044 mut self,
25045 new_value: &str,
25046 ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
25047 self._page_token = Some(new_value.to_string());
25048 self
25049 }
25050 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25051 /// while executing the actual API request.
25052 ///
25053 /// ````text
25054 /// It should be used to handle progress information, and to implement a certain level of resilience.
25055 /// ````
25056 ///
25057 /// Sets the *delegate* property to the given value.
25058 pub fn delegate(
25059 mut self,
25060 new_value: &'a mut dyn common::Delegate,
25061 ) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
25062 self._delegate = Some(new_value);
25063 self
25064 }
25065
25066 /// Set any additional parameter of the query string used in the request.
25067 /// It should be used to set parameters which are not yet available through their own
25068 /// setters.
25069 ///
25070 /// Please note that this method must not be used to set any of the known parameters
25071 /// which have their own setter method. If done anyway, the request will fail.
25072 ///
25073 /// # Additional Parameters
25074 ///
25075 /// * *$.xgafv* (query-string) - V1 error format.
25076 /// * *access_token* (query-string) - OAuth access token.
25077 /// * *alt* (query-string) - Data format for response.
25078 /// * *callback* (query-string) - JSONP
25079 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25080 /// * *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.
25081 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25082 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25083 /// * *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.
25084 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25085 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25086 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerListCall<'a, C>
25087 where
25088 T: AsRef<str>,
25089 {
25090 self._additional_params
25091 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25092 self
25093 }
25094
25095 /// Identifies the authorization scope for the method you are building.
25096 ///
25097 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25098 /// [`Scope::Readonly`].
25099 ///
25100 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25101 /// tokens for more than one scope.
25102 ///
25103 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25104 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25105 /// sufficient, a read-write scope will do as well.
25106 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerListCall<'a, C>
25107 where
25108 St: AsRef<str>,
25109 {
25110 self._scopes.insert(String::from(scope.as_ref()));
25111 self
25112 }
25113 /// Identifies the authorization scope(s) for the method you are building.
25114 ///
25115 /// See [`Self::add_scope()`] for details.
25116 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceTriggerListCall<'a, C>
25117 where
25118 I: IntoIterator<Item = St>,
25119 St: AsRef<str>,
25120 {
25121 self._scopes
25122 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25123 self
25124 }
25125
25126 /// Removes all scopes, and no default scope will be used either.
25127 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25128 /// for details).
25129 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerListCall<'a, C> {
25130 self._scopes.clear();
25131 self
25132 }
25133}
25134
25135/// Reverts changes to a GTM Trigger in a GTM Workspace.
25136///
25137/// A builder for the *containers.workspaces.triggers.revert* method supported by a *account* resource.
25138/// It is not used directly, but through a [`AccountMethods`] instance.
25139///
25140/// # Example
25141///
25142/// Instantiate a resource method builder
25143///
25144/// ```test_harness,no_run
25145/// # extern crate hyper;
25146/// # extern crate hyper_rustls;
25147/// # extern crate google_tagmanager2 as tagmanager2;
25148/// # async fn dox() {
25149/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25150///
25151/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25152/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25153/// # .with_native_roots()
25154/// # .unwrap()
25155/// # .https_only()
25156/// # .enable_http2()
25157/// # .build();
25158///
25159/// # let executor = hyper_util::rt::TokioExecutor::new();
25160/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25161/// # secret,
25162/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25163/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25164/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25165/// # ),
25166/// # ).build().await.unwrap();
25167///
25168/// # let client = hyper_util::client::legacy::Client::builder(
25169/// # hyper_util::rt::TokioExecutor::new()
25170/// # )
25171/// # .build(
25172/// # hyper_rustls::HttpsConnectorBuilder::new()
25173/// # .with_native_roots()
25174/// # .unwrap()
25175/// # .https_or_http()
25176/// # .enable_http2()
25177/// # .build()
25178/// # );
25179/// # let mut hub = TagManager::new(client, auth);
25180/// // You can configure optional parameters by calling the respective setters at will, and
25181/// // execute the final call using `doit()`.
25182/// // Values shown here are possibly random and not representative !
25183/// let result = hub.accounts().containers_workspaces_triggers_revert("path")
25184/// .fingerprint("Stet")
25185/// .doit().await;
25186/// # }
25187/// ```
25188pub struct AccountContainerWorkspaceTriggerRevertCall<'a, C>
25189where
25190 C: 'a,
25191{
25192 hub: &'a TagManager<C>,
25193 _path: String,
25194 _fingerprint: Option<String>,
25195 _delegate: Option<&'a mut dyn common::Delegate>,
25196 _additional_params: HashMap<String, String>,
25197 _scopes: BTreeSet<String>,
25198}
25199
25200impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerRevertCall<'a, C> {}
25201
25202impl<'a, C> AccountContainerWorkspaceTriggerRevertCall<'a, C>
25203where
25204 C: common::Connector,
25205{
25206 /// Perform the operation you have build so far.
25207 pub async fn doit(mut self) -> common::Result<(common::Response, RevertTriggerResponse)> {
25208 use std::borrow::Cow;
25209 use std::io::{Read, Seek};
25210
25211 use common::{url::Params, ToParts};
25212 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25213
25214 let mut dd = common::DefaultDelegate;
25215 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25216 dlg.begin(common::MethodInfo {
25217 id: "tagmanager.accounts.containers.workspaces.triggers.revert",
25218 http_method: hyper::Method::POST,
25219 });
25220
25221 for &field in ["alt", "path", "fingerprint"].iter() {
25222 if self._additional_params.contains_key(field) {
25223 dlg.finished(false);
25224 return Err(common::Error::FieldClash(field));
25225 }
25226 }
25227
25228 let mut params = Params::with_capacity(4 + self._additional_params.len());
25229 params.push("path", self._path);
25230 if let Some(value) = self._fingerprint.as_ref() {
25231 params.push("fingerprint", value);
25232 }
25233
25234 params.extend(self._additional_params.iter());
25235
25236 params.push("alt", "json");
25237 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
25238 if self._scopes.is_empty() {
25239 self._scopes
25240 .insert(Scope::EditContainer.as_ref().to_string());
25241 }
25242
25243 #[allow(clippy::single_element_loop)]
25244 for &(find_this, param_name) in [("{+path}", "path")].iter() {
25245 url = params.uri_replacement(url, param_name, find_this, true);
25246 }
25247 {
25248 let to_remove = ["path"];
25249 params.remove_params(&to_remove);
25250 }
25251
25252 let url = params.parse_with_url(&url);
25253
25254 loop {
25255 let token = match self
25256 .hub
25257 .auth
25258 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25259 .await
25260 {
25261 Ok(token) => token,
25262 Err(e) => match dlg.token(e) {
25263 Ok(token) => token,
25264 Err(e) => {
25265 dlg.finished(false);
25266 return Err(common::Error::MissingToken(e));
25267 }
25268 },
25269 };
25270 let mut req_result = {
25271 let client = &self.hub.client;
25272 dlg.pre_request();
25273 let mut req_builder = hyper::Request::builder()
25274 .method(hyper::Method::POST)
25275 .uri(url.as_str())
25276 .header(USER_AGENT, self.hub._user_agent.clone());
25277
25278 if let Some(token) = token.as_ref() {
25279 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25280 }
25281
25282 let request = req_builder
25283 .header(CONTENT_LENGTH, 0_u64)
25284 .body(common::to_body::<String>(None));
25285
25286 client.request(request.unwrap()).await
25287 };
25288
25289 match req_result {
25290 Err(err) => {
25291 if let common::Retry::After(d) = dlg.http_error(&err) {
25292 sleep(d).await;
25293 continue;
25294 }
25295 dlg.finished(false);
25296 return Err(common::Error::HttpError(err));
25297 }
25298 Ok(res) => {
25299 let (mut parts, body) = res.into_parts();
25300 let mut body = common::Body::new(body);
25301 if !parts.status.is_success() {
25302 let bytes = common::to_bytes(body).await.unwrap_or_default();
25303 let error = serde_json::from_str(&common::to_string(&bytes));
25304 let response = common::to_response(parts, bytes.into());
25305
25306 if let common::Retry::After(d) =
25307 dlg.http_failure(&response, error.as_ref().ok())
25308 {
25309 sleep(d).await;
25310 continue;
25311 }
25312
25313 dlg.finished(false);
25314
25315 return Err(match error {
25316 Ok(value) => common::Error::BadRequest(value),
25317 _ => common::Error::Failure(response),
25318 });
25319 }
25320 let response = {
25321 let bytes = common::to_bytes(body).await.unwrap_or_default();
25322 let encoded = common::to_string(&bytes);
25323 match serde_json::from_str(&encoded) {
25324 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25325 Err(error) => {
25326 dlg.response_json_decode_error(&encoded, &error);
25327 return Err(common::Error::JsonDecodeError(
25328 encoded.to_string(),
25329 error,
25330 ));
25331 }
25332 }
25333 };
25334
25335 dlg.finished(true);
25336 return Ok(response);
25337 }
25338 }
25339 }
25340 }
25341
25342 /// GTM Trigger's API relative path.
25343 ///
25344 /// Sets the *path* path property to the given value.
25345 ///
25346 /// Even though the property as already been set when instantiating this call,
25347 /// we provide this method for API completeness.
25348 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
25349 self._path = new_value.to_string();
25350 self
25351 }
25352 /// When provided, this fingerprint must match the fingerprint of the trigger in storage.
25353 ///
25354 /// Sets the *fingerprint* query property to the given value.
25355 pub fn fingerprint(
25356 mut self,
25357 new_value: &str,
25358 ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
25359 self._fingerprint = Some(new_value.to_string());
25360 self
25361 }
25362 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25363 /// while executing the actual API request.
25364 ///
25365 /// ````text
25366 /// It should be used to handle progress information, and to implement a certain level of resilience.
25367 /// ````
25368 ///
25369 /// Sets the *delegate* property to the given value.
25370 pub fn delegate(
25371 mut self,
25372 new_value: &'a mut dyn common::Delegate,
25373 ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
25374 self._delegate = Some(new_value);
25375 self
25376 }
25377
25378 /// Set any additional parameter of the query string used in the request.
25379 /// It should be used to set parameters which are not yet available through their own
25380 /// setters.
25381 ///
25382 /// Please note that this method must not be used to set any of the known parameters
25383 /// which have their own setter method. If done anyway, the request will fail.
25384 ///
25385 /// # Additional Parameters
25386 ///
25387 /// * *$.xgafv* (query-string) - V1 error format.
25388 /// * *access_token* (query-string) - OAuth access token.
25389 /// * *alt* (query-string) - Data format for response.
25390 /// * *callback* (query-string) - JSONP
25391 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25392 /// * *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.
25393 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25394 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25395 /// * *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.
25396 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25397 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25398 pub fn param<T>(
25399 mut self,
25400 name: T,
25401 value: T,
25402 ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
25403 where
25404 T: AsRef<str>,
25405 {
25406 self._additional_params
25407 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25408 self
25409 }
25410
25411 /// Identifies the authorization scope for the method you are building.
25412 ///
25413 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25414 /// [`Scope::EditContainer`].
25415 ///
25416 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25417 /// tokens for more than one scope.
25418 ///
25419 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25420 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25421 /// sufficient, a read-write scope will do as well.
25422 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
25423 where
25424 St: AsRef<str>,
25425 {
25426 self._scopes.insert(String::from(scope.as_ref()));
25427 self
25428 }
25429 /// Identifies the authorization scope(s) for the method you are building.
25430 ///
25431 /// See [`Self::add_scope()`] for details.
25432 pub fn add_scopes<I, St>(
25433 mut self,
25434 scopes: I,
25435 ) -> AccountContainerWorkspaceTriggerRevertCall<'a, C>
25436 where
25437 I: IntoIterator<Item = St>,
25438 St: AsRef<str>,
25439 {
25440 self._scopes
25441 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25442 self
25443 }
25444
25445 /// Removes all scopes, and no default scope will be used either.
25446 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25447 /// for details).
25448 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceTriggerRevertCall<'a, C> {
25449 self._scopes.clear();
25450 self
25451 }
25452}
25453
25454/// Updates a GTM Trigger.
25455///
25456/// A builder for the *containers.workspaces.triggers.update* method supported by a *account* resource.
25457/// It is not used directly, but through a [`AccountMethods`] instance.
25458///
25459/// # Example
25460///
25461/// Instantiate a resource method builder
25462///
25463/// ```test_harness,no_run
25464/// # extern crate hyper;
25465/// # extern crate hyper_rustls;
25466/// # extern crate google_tagmanager2 as tagmanager2;
25467/// use tagmanager2::api::Trigger;
25468/// # async fn dox() {
25469/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25470///
25471/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25472/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25473/// # .with_native_roots()
25474/// # .unwrap()
25475/// # .https_only()
25476/// # .enable_http2()
25477/// # .build();
25478///
25479/// # let executor = hyper_util::rt::TokioExecutor::new();
25480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25481/// # secret,
25482/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25483/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25484/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25485/// # ),
25486/// # ).build().await.unwrap();
25487///
25488/// # let client = hyper_util::client::legacy::Client::builder(
25489/// # hyper_util::rt::TokioExecutor::new()
25490/// # )
25491/// # .build(
25492/// # hyper_rustls::HttpsConnectorBuilder::new()
25493/// # .with_native_roots()
25494/// # .unwrap()
25495/// # .https_or_http()
25496/// # .enable_http2()
25497/// # .build()
25498/// # );
25499/// # let mut hub = TagManager::new(client, auth);
25500/// // As the method needs a request, you would usually fill it with the desired information
25501/// // into the respective structure. Some of the parts shown here might not be applicable !
25502/// // Values shown here are possibly random and not representative !
25503/// let mut req = Trigger::default();
25504///
25505/// // You can configure optional parameters by calling the respective setters at will, and
25506/// // execute the final call using `doit()`.
25507/// // Values shown here are possibly random and not representative !
25508/// let result = hub.accounts().containers_workspaces_triggers_update(req, "path")
25509/// .fingerprint("aliquyam")
25510/// .doit().await;
25511/// # }
25512/// ```
25513pub struct AccountContainerWorkspaceTriggerUpdateCall<'a, C>
25514where
25515 C: 'a,
25516{
25517 hub: &'a TagManager<C>,
25518 _request: Trigger,
25519 _path: String,
25520 _fingerprint: Option<String>,
25521 _delegate: Option<&'a mut dyn common::Delegate>,
25522 _additional_params: HashMap<String, String>,
25523 _scopes: BTreeSet<String>,
25524}
25525
25526impl<'a, C> common::CallBuilder for AccountContainerWorkspaceTriggerUpdateCall<'a, C> {}
25527
25528impl<'a, C> AccountContainerWorkspaceTriggerUpdateCall<'a, C>
25529where
25530 C: common::Connector,
25531{
25532 /// Perform the operation you have build so far.
25533 pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
25534 use std::borrow::Cow;
25535 use std::io::{Read, Seek};
25536
25537 use common::{url::Params, ToParts};
25538 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25539
25540 let mut dd = common::DefaultDelegate;
25541 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25542 dlg.begin(common::MethodInfo {
25543 id: "tagmanager.accounts.containers.workspaces.triggers.update",
25544 http_method: hyper::Method::PUT,
25545 });
25546
25547 for &field in ["alt", "path", "fingerprint"].iter() {
25548 if self._additional_params.contains_key(field) {
25549 dlg.finished(false);
25550 return Err(common::Error::FieldClash(field));
25551 }
25552 }
25553
25554 let mut params = Params::with_capacity(5 + self._additional_params.len());
25555 params.push("path", self._path);
25556 if let Some(value) = self._fingerprint.as_ref() {
25557 params.push("fingerprint", value);
25558 }
25559
25560 params.extend(self._additional_params.iter());
25561
25562 params.push("alt", "json");
25563 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
25564 if self._scopes.is_empty() {
25565 self._scopes
25566 .insert(Scope::EditContainer.as_ref().to_string());
25567 }
25568
25569 #[allow(clippy::single_element_loop)]
25570 for &(find_this, param_name) in [("{+path}", "path")].iter() {
25571 url = params.uri_replacement(url, param_name, find_this, true);
25572 }
25573 {
25574 let to_remove = ["path"];
25575 params.remove_params(&to_remove);
25576 }
25577
25578 let url = params.parse_with_url(&url);
25579
25580 let mut json_mime_type = mime::APPLICATION_JSON;
25581 let mut request_value_reader = {
25582 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25583 common::remove_json_null_values(&mut value);
25584 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25585 serde_json::to_writer(&mut dst, &value).unwrap();
25586 dst
25587 };
25588 let request_size = request_value_reader
25589 .seek(std::io::SeekFrom::End(0))
25590 .unwrap();
25591 request_value_reader
25592 .seek(std::io::SeekFrom::Start(0))
25593 .unwrap();
25594
25595 loop {
25596 let token = match self
25597 .hub
25598 .auth
25599 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25600 .await
25601 {
25602 Ok(token) => token,
25603 Err(e) => match dlg.token(e) {
25604 Ok(token) => token,
25605 Err(e) => {
25606 dlg.finished(false);
25607 return Err(common::Error::MissingToken(e));
25608 }
25609 },
25610 };
25611 request_value_reader
25612 .seek(std::io::SeekFrom::Start(0))
25613 .unwrap();
25614 let mut req_result = {
25615 let client = &self.hub.client;
25616 dlg.pre_request();
25617 let mut req_builder = hyper::Request::builder()
25618 .method(hyper::Method::PUT)
25619 .uri(url.as_str())
25620 .header(USER_AGENT, self.hub._user_agent.clone());
25621
25622 if let Some(token) = token.as_ref() {
25623 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25624 }
25625
25626 let request = req_builder
25627 .header(CONTENT_TYPE, json_mime_type.to_string())
25628 .header(CONTENT_LENGTH, request_size as u64)
25629 .body(common::to_body(
25630 request_value_reader.get_ref().clone().into(),
25631 ));
25632
25633 client.request(request.unwrap()).await
25634 };
25635
25636 match req_result {
25637 Err(err) => {
25638 if let common::Retry::After(d) = dlg.http_error(&err) {
25639 sleep(d).await;
25640 continue;
25641 }
25642 dlg.finished(false);
25643 return Err(common::Error::HttpError(err));
25644 }
25645 Ok(res) => {
25646 let (mut parts, body) = res.into_parts();
25647 let mut body = common::Body::new(body);
25648 if !parts.status.is_success() {
25649 let bytes = common::to_bytes(body).await.unwrap_or_default();
25650 let error = serde_json::from_str(&common::to_string(&bytes));
25651 let response = common::to_response(parts, bytes.into());
25652
25653 if let common::Retry::After(d) =
25654 dlg.http_failure(&response, error.as_ref().ok())
25655 {
25656 sleep(d).await;
25657 continue;
25658 }
25659
25660 dlg.finished(false);
25661
25662 return Err(match error {
25663 Ok(value) => common::Error::BadRequest(value),
25664 _ => common::Error::Failure(response),
25665 });
25666 }
25667 let response = {
25668 let bytes = common::to_bytes(body).await.unwrap_or_default();
25669 let encoded = common::to_string(&bytes);
25670 match serde_json::from_str(&encoded) {
25671 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25672 Err(error) => {
25673 dlg.response_json_decode_error(&encoded, &error);
25674 return Err(common::Error::JsonDecodeError(
25675 encoded.to_string(),
25676 error,
25677 ));
25678 }
25679 }
25680 };
25681
25682 dlg.finished(true);
25683 return Ok(response);
25684 }
25685 }
25686 }
25687 }
25688
25689 ///
25690 /// Sets the *request* property to the given value.
25691 ///
25692 /// Even though the property as already been set when instantiating this call,
25693 /// we provide this method for API completeness.
25694 pub fn request(
25695 mut self,
25696 new_value: Trigger,
25697 ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
25698 self._request = new_value;
25699 self
25700 }
25701 /// GTM Trigger's API relative path.
25702 ///
25703 /// Sets the *path* path property to the given value.
25704 ///
25705 /// Even though the property as already been set when instantiating this call,
25706 /// we provide this method for API completeness.
25707 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
25708 self._path = new_value.to_string();
25709 self
25710 }
25711 /// When provided, this fingerprint must match the fingerprint of the trigger in storage.
25712 ///
25713 /// Sets the *fingerprint* query property to the given value.
25714 pub fn fingerprint(
25715 mut self,
25716 new_value: &str,
25717 ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
25718 self._fingerprint = Some(new_value.to_string());
25719 self
25720 }
25721 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25722 /// while executing the actual API request.
25723 ///
25724 /// ````text
25725 /// It should be used to handle progress information, and to implement a certain level of resilience.
25726 /// ````
25727 ///
25728 /// Sets the *delegate* property to the given value.
25729 pub fn delegate(
25730 mut self,
25731 new_value: &'a mut dyn common::Delegate,
25732 ) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
25733 self._delegate = Some(new_value);
25734 self
25735 }
25736
25737 /// Set any additional parameter of the query string used in the request.
25738 /// It should be used to set parameters which are not yet available through their own
25739 /// setters.
25740 ///
25741 /// Please note that this method must not be used to set any of the known parameters
25742 /// which have their own setter method. If done anyway, the request will fail.
25743 ///
25744 /// # Additional Parameters
25745 ///
25746 /// * *$.xgafv* (query-string) - V1 error format.
25747 /// * *access_token* (query-string) - OAuth access token.
25748 /// * *alt* (query-string) - Data format for response.
25749 /// * *callback* (query-string) - JSONP
25750 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25751 /// * *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.
25752 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25753 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25754 /// * *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.
25755 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25756 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25757 pub fn param<T>(
25758 mut self,
25759 name: T,
25760 value: T,
25761 ) -> AccountContainerWorkspaceTriggerUpdateCall<'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::EditContainer`].
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) -> AccountContainerWorkspaceTriggerUpdateCall<'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 ) -> AccountContainerWorkspaceTriggerUpdateCall<'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) -> AccountContainerWorkspaceTriggerUpdateCall<'a, C> {
25808 self._scopes.clear();
25809 self
25810 }
25811}
25812
25813/// Creates a GTM Variable.
25814///
25815/// A builder for the *containers.workspaces.variables.create* 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/// use tagmanager2::api::Variable;
25827/// # async fn dox() {
25828/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25829///
25830/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25831/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25832/// # .with_native_roots()
25833/// # .unwrap()
25834/// # .https_only()
25835/// # .enable_http2()
25836/// # .build();
25837///
25838/// # let executor = hyper_util::rt::TokioExecutor::new();
25839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25840/// # secret,
25841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25842/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25843/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25844/// # ),
25845/// # ).build().await.unwrap();
25846///
25847/// # let client = hyper_util::client::legacy::Client::builder(
25848/// # hyper_util::rt::TokioExecutor::new()
25849/// # )
25850/// # .build(
25851/// # hyper_rustls::HttpsConnectorBuilder::new()
25852/// # .with_native_roots()
25853/// # .unwrap()
25854/// # .https_or_http()
25855/// # .enable_http2()
25856/// # .build()
25857/// # );
25858/// # let mut hub = TagManager::new(client, auth);
25859/// // As the method needs a request, you would usually fill it with the desired information
25860/// // into the respective structure. Some of the parts shown here might not be applicable !
25861/// // Values shown here are possibly random and not representative !
25862/// let mut req = Variable::default();
25863///
25864/// // You can configure optional parameters by calling the respective setters at will, and
25865/// // execute the final call using `doit()`.
25866/// // Values shown here are possibly random and not representative !
25867/// let result = hub.accounts().containers_workspaces_variables_create(req, "parent")
25868/// .doit().await;
25869/// # }
25870/// ```
25871pub struct AccountContainerWorkspaceVariableCreateCall<'a, C>
25872where
25873 C: 'a,
25874{
25875 hub: &'a TagManager<C>,
25876 _request: Variable,
25877 _parent: String,
25878 _delegate: Option<&'a mut dyn common::Delegate>,
25879 _additional_params: HashMap<String, String>,
25880 _scopes: BTreeSet<String>,
25881}
25882
25883impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableCreateCall<'a, C> {}
25884
25885impl<'a, C> AccountContainerWorkspaceVariableCreateCall<'a, C>
25886where
25887 C: common::Connector,
25888{
25889 /// Perform the operation you have build so far.
25890 pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
25891 use std::borrow::Cow;
25892 use std::io::{Read, Seek};
25893
25894 use common::{url::Params, ToParts};
25895 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25896
25897 let mut dd = common::DefaultDelegate;
25898 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25899 dlg.begin(common::MethodInfo {
25900 id: "tagmanager.accounts.containers.workspaces.variables.create",
25901 http_method: hyper::Method::POST,
25902 });
25903
25904 for &field in ["alt", "parent"].iter() {
25905 if self._additional_params.contains_key(field) {
25906 dlg.finished(false);
25907 return Err(common::Error::FieldClash(field));
25908 }
25909 }
25910
25911 let mut params = Params::with_capacity(4 + self._additional_params.len());
25912 params.push("parent", self._parent);
25913
25914 params.extend(self._additional_params.iter());
25915
25916 params.push("alt", "json");
25917 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/variables";
25918 if self._scopes.is_empty() {
25919 self._scopes
25920 .insert(Scope::EditContainer.as_ref().to_string());
25921 }
25922
25923 #[allow(clippy::single_element_loop)]
25924 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25925 url = params.uri_replacement(url, param_name, find_this, true);
25926 }
25927 {
25928 let to_remove = ["parent"];
25929 params.remove_params(&to_remove);
25930 }
25931
25932 let url = params.parse_with_url(&url);
25933
25934 let mut json_mime_type = mime::APPLICATION_JSON;
25935 let mut request_value_reader = {
25936 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25937 common::remove_json_null_values(&mut value);
25938 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25939 serde_json::to_writer(&mut dst, &value).unwrap();
25940 dst
25941 };
25942 let request_size = request_value_reader
25943 .seek(std::io::SeekFrom::End(0))
25944 .unwrap();
25945 request_value_reader
25946 .seek(std::io::SeekFrom::Start(0))
25947 .unwrap();
25948
25949 loop {
25950 let token = match self
25951 .hub
25952 .auth
25953 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25954 .await
25955 {
25956 Ok(token) => token,
25957 Err(e) => match dlg.token(e) {
25958 Ok(token) => token,
25959 Err(e) => {
25960 dlg.finished(false);
25961 return Err(common::Error::MissingToken(e));
25962 }
25963 },
25964 };
25965 request_value_reader
25966 .seek(std::io::SeekFrom::Start(0))
25967 .unwrap();
25968 let mut req_result = {
25969 let client = &self.hub.client;
25970 dlg.pre_request();
25971 let mut req_builder = hyper::Request::builder()
25972 .method(hyper::Method::POST)
25973 .uri(url.as_str())
25974 .header(USER_AGENT, self.hub._user_agent.clone());
25975
25976 if let Some(token) = token.as_ref() {
25977 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25978 }
25979
25980 let request = req_builder
25981 .header(CONTENT_TYPE, json_mime_type.to_string())
25982 .header(CONTENT_LENGTH, request_size as u64)
25983 .body(common::to_body(
25984 request_value_reader.get_ref().clone().into(),
25985 ));
25986
25987 client.request(request.unwrap()).await
25988 };
25989
25990 match req_result {
25991 Err(err) => {
25992 if let common::Retry::After(d) = dlg.http_error(&err) {
25993 sleep(d).await;
25994 continue;
25995 }
25996 dlg.finished(false);
25997 return Err(common::Error::HttpError(err));
25998 }
25999 Ok(res) => {
26000 let (mut parts, body) = res.into_parts();
26001 let mut body = common::Body::new(body);
26002 if !parts.status.is_success() {
26003 let bytes = common::to_bytes(body).await.unwrap_or_default();
26004 let error = serde_json::from_str(&common::to_string(&bytes));
26005 let response = common::to_response(parts, bytes.into());
26006
26007 if let common::Retry::After(d) =
26008 dlg.http_failure(&response, error.as_ref().ok())
26009 {
26010 sleep(d).await;
26011 continue;
26012 }
26013
26014 dlg.finished(false);
26015
26016 return Err(match error {
26017 Ok(value) => common::Error::BadRequest(value),
26018 _ => common::Error::Failure(response),
26019 });
26020 }
26021 let response = {
26022 let bytes = common::to_bytes(body).await.unwrap_or_default();
26023 let encoded = common::to_string(&bytes);
26024 match serde_json::from_str(&encoded) {
26025 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26026 Err(error) => {
26027 dlg.response_json_decode_error(&encoded, &error);
26028 return Err(common::Error::JsonDecodeError(
26029 encoded.to_string(),
26030 error,
26031 ));
26032 }
26033 }
26034 };
26035
26036 dlg.finished(true);
26037 return Ok(response);
26038 }
26039 }
26040 }
26041 }
26042
26043 ///
26044 /// Sets the *request* property to the given value.
26045 ///
26046 /// Even though the property as already been set when instantiating this call,
26047 /// we provide this method for API completeness.
26048 pub fn request(
26049 mut self,
26050 new_value: Variable,
26051 ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
26052 self._request = new_value;
26053 self
26054 }
26055 /// GTM Workspace's API relative path.
26056 ///
26057 /// Sets the *parent* path property to the given value.
26058 ///
26059 /// Even though the property as already been set when instantiating this call,
26060 /// we provide this method for API completeness.
26061 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
26062 self._parent = new_value.to_string();
26063 self
26064 }
26065 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26066 /// while executing the actual API request.
26067 ///
26068 /// ````text
26069 /// It should be used to handle progress information, and to implement a certain level of resilience.
26070 /// ````
26071 ///
26072 /// Sets the *delegate* property to the given value.
26073 pub fn delegate(
26074 mut self,
26075 new_value: &'a mut dyn common::Delegate,
26076 ) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
26077 self._delegate = Some(new_value);
26078 self
26079 }
26080
26081 /// Set any additional parameter of the query string used in the request.
26082 /// It should be used to set parameters which are not yet available through their own
26083 /// setters.
26084 ///
26085 /// Please note that this method must not be used to set any of the known parameters
26086 /// which have their own setter method. If done anyway, the request will fail.
26087 ///
26088 /// # Additional Parameters
26089 ///
26090 /// * *$.xgafv* (query-string) - V1 error format.
26091 /// * *access_token* (query-string) - OAuth access token.
26092 /// * *alt* (query-string) - Data format for response.
26093 /// * *callback* (query-string) - JSONP
26094 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26095 /// * *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.
26096 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26097 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26098 /// * *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.
26099 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26100 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26101 pub fn param<T>(
26102 mut self,
26103 name: T,
26104 value: T,
26105 ) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
26106 where
26107 T: AsRef<str>,
26108 {
26109 self._additional_params
26110 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26111 self
26112 }
26113
26114 /// Identifies the authorization scope for the method you are building.
26115 ///
26116 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26117 /// [`Scope::EditContainer`].
26118 ///
26119 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26120 /// tokens for more than one scope.
26121 ///
26122 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26123 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26124 /// sufficient, a read-write scope will do as well.
26125 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
26126 where
26127 St: AsRef<str>,
26128 {
26129 self._scopes.insert(String::from(scope.as_ref()));
26130 self
26131 }
26132 /// Identifies the authorization scope(s) for the method you are building.
26133 ///
26134 /// See [`Self::add_scope()`] for details.
26135 pub fn add_scopes<I, St>(
26136 mut self,
26137 scopes: I,
26138 ) -> AccountContainerWorkspaceVariableCreateCall<'a, C>
26139 where
26140 I: IntoIterator<Item = St>,
26141 St: AsRef<str>,
26142 {
26143 self._scopes
26144 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26145 self
26146 }
26147
26148 /// Removes all scopes, and no default scope will be used either.
26149 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26150 /// for details).
26151 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableCreateCall<'a, C> {
26152 self._scopes.clear();
26153 self
26154 }
26155}
26156
26157/// Deletes a GTM Variable.
26158///
26159/// A builder for the *containers.workspaces.variables.delete* method supported by a *account* resource.
26160/// It is not used directly, but through a [`AccountMethods`] instance.
26161///
26162/// # Example
26163///
26164/// Instantiate a resource method builder
26165///
26166/// ```test_harness,no_run
26167/// # extern crate hyper;
26168/// # extern crate hyper_rustls;
26169/// # extern crate google_tagmanager2 as tagmanager2;
26170/// # async fn dox() {
26171/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26172///
26173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26175/// # .with_native_roots()
26176/// # .unwrap()
26177/// # .https_only()
26178/// # .enable_http2()
26179/// # .build();
26180///
26181/// # let executor = hyper_util::rt::TokioExecutor::new();
26182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26183/// # secret,
26184/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26185/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26186/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26187/// # ),
26188/// # ).build().await.unwrap();
26189///
26190/// # let client = hyper_util::client::legacy::Client::builder(
26191/// # hyper_util::rt::TokioExecutor::new()
26192/// # )
26193/// # .build(
26194/// # hyper_rustls::HttpsConnectorBuilder::new()
26195/// # .with_native_roots()
26196/// # .unwrap()
26197/// # .https_or_http()
26198/// # .enable_http2()
26199/// # .build()
26200/// # );
26201/// # let mut hub = TagManager::new(client, auth);
26202/// // You can configure optional parameters by calling the respective setters at will, and
26203/// // execute the final call using `doit()`.
26204/// // Values shown here are possibly random and not representative !
26205/// let result = hub.accounts().containers_workspaces_variables_delete("path")
26206/// .doit().await;
26207/// # }
26208/// ```
26209pub struct AccountContainerWorkspaceVariableDeleteCall<'a, C>
26210where
26211 C: 'a,
26212{
26213 hub: &'a TagManager<C>,
26214 _path: String,
26215 _delegate: Option<&'a mut dyn common::Delegate>,
26216 _additional_params: HashMap<String, String>,
26217 _scopes: BTreeSet<String>,
26218}
26219
26220impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableDeleteCall<'a, C> {}
26221
26222impl<'a, C> AccountContainerWorkspaceVariableDeleteCall<'a, C>
26223where
26224 C: common::Connector,
26225{
26226 /// Perform the operation you have build so far.
26227 pub async fn doit(mut self) -> common::Result<common::Response> {
26228 use std::borrow::Cow;
26229 use std::io::{Read, Seek};
26230
26231 use common::{url::Params, ToParts};
26232 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26233
26234 let mut dd = common::DefaultDelegate;
26235 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26236 dlg.begin(common::MethodInfo {
26237 id: "tagmanager.accounts.containers.workspaces.variables.delete",
26238 http_method: hyper::Method::DELETE,
26239 });
26240
26241 for &field in ["path"].iter() {
26242 if self._additional_params.contains_key(field) {
26243 dlg.finished(false);
26244 return Err(common::Error::FieldClash(field));
26245 }
26246 }
26247
26248 let mut params = Params::with_capacity(2 + self._additional_params.len());
26249 params.push("path", self._path);
26250
26251 params.extend(self._additional_params.iter());
26252
26253 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
26254 if self._scopes.is_empty() {
26255 self._scopes
26256 .insert(Scope::EditContainer.as_ref().to_string());
26257 }
26258
26259 #[allow(clippy::single_element_loop)]
26260 for &(find_this, param_name) in [("{+path}", "path")].iter() {
26261 url = params.uri_replacement(url, param_name, find_this, true);
26262 }
26263 {
26264 let to_remove = ["path"];
26265 params.remove_params(&to_remove);
26266 }
26267
26268 let url = params.parse_with_url(&url);
26269
26270 loop {
26271 let token = match self
26272 .hub
26273 .auth
26274 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26275 .await
26276 {
26277 Ok(token) => token,
26278 Err(e) => match dlg.token(e) {
26279 Ok(token) => token,
26280 Err(e) => {
26281 dlg.finished(false);
26282 return Err(common::Error::MissingToken(e));
26283 }
26284 },
26285 };
26286 let mut req_result = {
26287 let client = &self.hub.client;
26288 dlg.pre_request();
26289 let mut req_builder = hyper::Request::builder()
26290 .method(hyper::Method::DELETE)
26291 .uri(url.as_str())
26292 .header(USER_AGENT, self.hub._user_agent.clone());
26293
26294 if let Some(token) = token.as_ref() {
26295 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26296 }
26297
26298 let request = req_builder
26299 .header(CONTENT_LENGTH, 0_u64)
26300 .body(common::to_body::<String>(None));
26301
26302 client.request(request.unwrap()).await
26303 };
26304
26305 match req_result {
26306 Err(err) => {
26307 if let common::Retry::After(d) = dlg.http_error(&err) {
26308 sleep(d).await;
26309 continue;
26310 }
26311 dlg.finished(false);
26312 return Err(common::Error::HttpError(err));
26313 }
26314 Ok(res) => {
26315 let (mut parts, body) = res.into_parts();
26316 let mut body = common::Body::new(body);
26317 if !parts.status.is_success() {
26318 let bytes = common::to_bytes(body).await.unwrap_or_default();
26319 let error = serde_json::from_str(&common::to_string(&bytes));
26320 let response = common::to_response(parts, bytes.into());
26321
26322 if let common::Retry::After(d) =
26323 dlg.http_failure(&response, error.as_ref().ok())
26324 {
26325 sleep(d).await;
26326 continue;
26327 }
26328
26329 dlg.finished(false);
26330
26331 return Err(match error {
26332 Ok(value) => common::Error::BadRequest(value),
26333 _ => common::Error::Failure(response),
26334 });
26335 }
26336 let response = common::Response::from_parts(parts, body);
26337
26338 dlg.finished(true);
26339 return Ok(response);
26340 }
26341 }
26342 }
26343 }
26344
26345 /// GTM Variable's API relative path.
26346 ///
26347 /// Sets the *path* path property to the given value.
26348 ///
26349 /// Even though the property as already been set when instantiating this call,
26350 /// we provide this method for API completeness.
26351 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
26352 self._path = new_value.to_string();
26353 self
26354 }
26355 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26356 /// while executing the actual API request.
26357 ///
26358 /// ````text
26359 /// It should be used to handle progress information, and to implement a certain level of resilience.
26360 /// ````
26361 ///
26362 /// Sets the *delegate* property to the given value.
26363 pub fn delegate(
26364 mut self,
26365 new_value: &'a mut dyn common::Delegate,
26366 ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
26367 self._delegate = Some(new_value);
26368 self
26369 }
26370
26371 /// Set any additional parameter of the query string used in the request.
26372 /// It should be used to set parameters which are not yet available through their own
26373 /// setters.
26374 ///
26375 /// Please note that this method must not be used to set any of the known parameters
26376 /// which have their own setter method. If done anyway, the request will fail.
26377 ///
26378 /// # Additional Parameters
26379 ///
26380 /// * *$.xgafv* (query-string) - V1 error format.
26381 /// * *access_token* (query-string) - OAuth access token.
26382 /// * *alt* (query-string) - Data format for response.
26383 /// * *callback* (query-string) - JSONP
26384 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26385 /// * *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.
26386 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26387 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26388 /// * *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.
26389 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26390 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26391 pub fn param<T>(
26392 mut self,
26393 name: T,
26394 value: T,
26395 ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
26396 where
26397 T: AsRef<str>,
26398 {
26399 self._additional_params
26400 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26401 self
26402 }
26403
26404 /// Identifies the authorization scope for the method you are building.
26405 ///
26406 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26407 /// [`Scope::EditContainer`].
26408 ///
26409 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26410 /// tokens for more than one scope.
26411 ///
26412 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26413 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26414 /// sufficient, a read-write scope will do as well.
26415 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
26416 where
26417 St: AsRef<str>,
26418 {
26419 self._scopes.insert(String::from(scope.as_ref()));
26420 self
26421 }
26422 /// Identifies the authorization scope(s) for the method you are building.
26423 ///
26424 /// See [`Self::add_scope()`] for details.
26425 pub fn add_scopes<I, St>(
26426 mut self,
26427 scopes: I,
26428 ) -> AccountContainerWorkspaceVariableDeleteCall<'a, C>
26429 where
26430 I: IntoIterator<Item = St>,
26431 St: AsRef<str>,
26432 {
26433 self._scopes
26434 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26435 self
26436 }
26437
26438 /// Removes all scopes, and no default scope will be used either.
26439 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26440 /// for details).
26441 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableDeleteCall<'a, C> {
26442 self._scopes.clear();
26443 self
26444 }
26445}
26446
26447/// Gets a GTM Variable.
26448///
26449/// A builder for the *containers.workspaces.variables.get* method supported by a *account* resource.
26450/// It is not used directly, but through a [`AccountMethods`] instance.
26451///
26452/// # Example
26453///
26454/// Instantiate a resource method builder
26455///
26456/// ```test_harness,no_run
26457/// # extern crate hyper;
26458/// # extern crate hyper_rustls;
26459/// # extern crate google_tagmanager2 as tagmanager2;
26460/// # async fn dox() {
26461/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26462///
26463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26464/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26465/// # .with_native_roots()
26466/// # .unwrap()
26467/// # .https_only()
26468/// # .enable_http2()
26469/// # .build();
26470///
26471/// # let executor = hyper_util::rt::TokioExecutor::new();
26472/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26473/// # secret,
26474/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26475/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26476/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26477/// # ),
26478/// # ).build().await.unwrap();
26479///
26480/// # let client = hyper_util::client::legacy::Client::builder(
26481/// # hyper_util::rt::TokioExecutor::new()
26482/// # )
26483/// # .build(
26484/// # hyper_rustls::HttpsConnectorBuilder::new()
26485/// # .with_native_roots()
26486/// # .unwrap()
26487/// # .https_or_http()
26488/// # .enable_http2()
26489/// # .build()
26490/// # );
26491/// # let mut hub = TagManager::new(client, auth);
26492/// // You can configure optional parameters by calling the respective setters at will, and
26493/// // execute the final call using `doit()`.
26494/// // Values shown here are possibly random and not representative !
26495/// let result = hub.accounts().containers_workspaces_variables_get("path")
26496/// .doit().await;
26497/// # }
26498/// ```
26499pub struct AccountContainerWorkspaceVariableGetCall<'a, C>
26500where
26501 C: 'a,
26502{
26503 hub: &'a TagManager<C>,
26504 _path: String,
26505 _delegate: Option<&'a mut dyn common::Delegate>,
26506 _additional_params: HashMap<String, String>,
26507 _scopes: BTreeSet<String>,
26508}
26509
26510impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableGetCall<'a, C> {}
26511
26512impl<'a, C> AccountContainerWorkspaceVariableGetCall<'a, C>
26513where
26514 C: common::Connector,
26515{
26516 /// Perform the operation you have build so far.
26517 pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
26518 use std::borrow::Cow;
26519 use std::io::{Read, Seek};
26520
26521 use common::{url::Params, ToParts};
26522 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26523
26524 let mut dd = common::DefaultDelegate;
26525 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26526 dlg.begin(common::MethodInfo {
26527 id: "tagmanager.accounts.containers.workspaces.variables.get",
26528 http_method: hyper::Method::GET,
26529 });
26530
26531 for &field in ["alt", "path"].iter() {
26532 if self._additional_params.contains_key(field) {
26533 dlg.finished(false);
26534 return Err(common::Error::FieldClash(field));
26535 }
26536 }
26537
26538 let mut params = Params::with_capacity(3 + self._additional_params.len());
26539 params.push("path", self._path);
26540
26541 params.extend(self._additional_params.iter());
26542
26543 params.push("alt", "json");
26544 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
26545 if self._scopes.is_empty() {
26546 self._scopes.insert(Scope::Readonly.as_ref().to_string());
26547 }
26548
26549 #[allow(clippy::single_element_loop)]
26550 for &(find_this, param_name) in [("{+path}", "path")].iter() {
26551 url = params.uri_replacement(url, param_name, find_this, true);
26552 }
26553 {
26554 let to_remove = ["path"];
26555 params.remove_params(&to_remove);
26556 }
26557
26558 let url = params.parse_with_url(&url);
26559
26560 loop {
26561 let token = match self
26562 .hub
26563 .auth
26564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26565 .await
26566 {
26567 Ok(token) => token,
26568 Err(e) => match dlg.token(e) {
26569 Ok(token) => token,
26570 Err(e) => {
26571 dlg.finished(false);
26572 return Err(common::Error::MissingToken(e));
26573 }
26574 },
26575 };
26576 let mut req_result = {
26577 let client = &self.hub.client;
26578 dlg.pre_request();
26579 let mut req_builder = hyper::Request::builder()
26580 .method(hyper::Method::GET)
26581 .uri(url.as_str())
26582 .header(USER_AGENT, self.hub._user_agent.clone());
26583
26584 if let Some(token) = token.as_ref() {
26585 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26586 }
26587
26588 let request = req_builder
26589 .header(CONTENT_LENGTH, 0_u64)
26590 .body(common::to_body::<String>(None));
26591
26592 client.request(request.unwrap()).await
26593 };
26594
26595 match req_result {
26596 Err(err) => {
26597 if let common::Retry::After(d) = dlg.http_error(&err) {
26598 sleep(d).await;
26599 continue;
26600 }
26601 dlg.finished(false);
26602 return Err(common::Error::HttpError(err));
26603 }
26604 Ok(res) => {
26605 let (mut parts, body) = res.into_parts();
26606 let mut body = common::Body::new(body);
26607 if !parts.status.is_success() {
26608 let bytes = common::to_bytes(body).await.unwrap_or_default();
26609 let error = serde_json::from_str(&common::to_string(&bytes));
26610 let response = common::to_response(parts, bytes.into());
26611
26612 if let common::Retry::After(d) =
26613 dlg.http_failure(&response, error.as_ref().ok())
26614 {
26615 sleep(d).await;
26616 continue;
26617 }
26618
26619 dlg.finished(false);
26620
26621 return Err(match error {
26622 Ok(value) => common::Error::BadRequest(value),
26623 _ => common::Error::Failure(response),
26624 });
26625 }
26626 let response = {
26627 let bytes = common::to_bytes(body).await.unwrap_or_default();
26628 let encoded = common::to_string(&bytes);
26629 match serde_json::from_str(&encoded) {
26630 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26631 Err(error) => {
26632 dlg.response_json_decode_error(&encoded, &error);
26633 return Err(common::Error::JsonDecodeError(
26634 encoded.to_string(),
26635 error,
26636 ));
26637 }
26638 }
26639 };
26640
26641 dlg.finished(true);
26642 return Ok(response);
26643 }
26644 }
26645 }
26646 }
26647
26648 /// GTM Variable's API relative path.
26649 ///
26650 /// Sets the *path* path property to the given value.
26651 ///
26652 /// Even though the property as already been set when instantiating this call,
26653 /// we provide this method for API completeness.
26654 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
26655 self._path = new_value.to_string();
26656 self
26657 }
26658 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26659 /// while executing the actual API request.
26660 ///
26661 /// ````text
26662 /// It should be used to handle progress information, and to implement a certain level of resilience.
26663 /// ````
26664 ///
26665 /// Sets the *delegate* property to the given value.
26666 pub fn delegate(
26667 mut self,
26668 new_value: &'a mut dyn common::Delegate,
26669 ) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
26670 self._delegate = Some(new_value);
26671 self
26672 }
26673
26674 /// Set any additional parameter of the query string used in the request.
26675 /// It should be used to set parameters which are not yet available through their own
26676 /// setters.
26677 ///
26678 /// Please note that this method must not be used to set any of the known parameters
26679 /// which have their own setter method. If done anyway, the request will fail.
26680 ///
26681 /// # Additional Parameters
26682 ///
26683 /// * *$.xgafv* (query-string) - V1 error format.
26684 /// * *access_token* (query-string) - OAuth access token.
26685 /// * *alt* (query-string) - Data format for response.
26686 /// * *callback* (query-string) - JSONP
26687 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26688 /// * *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.
26689 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26690 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26691 /// * *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.
26692 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26693 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26694 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceVariableGetCall<'a, C>
26695 where
26696 T: AsRef<str>,
26697 {
26698 self._additional_params
26699 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26700 self
26701 }
26702
26703 /// Identifies the authorization scope for the method you are building.
26704 ///
26705 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26706 /// [`Scope::Readonly`].
26707 ///
26708 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26709 /// tokens for more than one scope.
26710 ///
26711 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26712 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26713 /// sufficient, a read-write scope will do as well.
26714 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableGetCall<'a, C>
26715 where
26716 St: AsRef<str>,
26717 {
26718 self._scopes.insert(String::from(scope.as_ref()));
26719 self
26720 }
26721 /// Identifies the authorization scope(s) for the method you are building.
26722 ///
26723 /// See [`Self::add_scope()`] for details.
26724 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceVariableGetCall<'a, C>
26725 where
26726 I: IntoIterator<Item = St>,
26727 St: AsRef<str>,
26728 {
26729 self._scopes
26730 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26731 self
26732 }
26733
26734 /// Removes all scopes, and no default scope will be used either.
26735 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26736 /// for details).
26737 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableGetCall<'a, C> {
26738 self._scopes.clear();
26739 self
26740 }
26741}
26742
26743/// Lists all GTM Variables of a Container.
26744///
26745/// A builder for the *containers.workspaces.variables.list* method supported by a *account* resource.
26746/// It is not used directly, but through a [`AccountMethods`] instance.
26747///
26748/// # Example
26749///
26750/// Instantiate a resource method builder
26751///
26752/// ```test_harness,no_run
26753/// # extern crate hyper;
26754/// # extern crate hyper_rustls;
26755/// # extern crate google_tagmanager2 as tagmanager2;
26756/// # async fn dox() {
26757/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26758///
26759/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26760/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26761/// # .with_native_roots()
26762/// # .unwrap()
26763/// # .https_only()
26764/// # .enable_http2()
26765/// # .build();
26766///
26767/// # let executor = hyper_util::rt::TokioExecutor::new();
26768/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26769/// # secret,
26770/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26771/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26772/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26773/// # ),
26774/// # ).build().await.unwrap();
26775///
26776/// # let client = hyper_util::client::legacy::Client::builder(
26777/// # hyper_util::rt::TokioExecutor::new()
26778/// # )
26779/// # .build(
26780/// # hyper_rustls::HttpsConnectorBuilder::new()
26781/// # .with_native_roots()
26782/// # .unwrap()
26783/// # .https_or_http()
26784/// # .enable_http2()
26785/// # .build()
26786/// # );
26787/// # let mut hub = TagManager::new(client, auth);
26788/// // You can configure optional parameters by calling the respective setters at will, and
26789/// // execute the final call using `doit()`.
26790/// // Values shown here are possibly random and not representative !
26791/// let result = hub.accounts().containers_workspaces_variables_list("parent")
26792/// .page_token("sit")
26793/// .doit().await;
26794/// # }
26795/// ```
26796pub struct AccountContainerWorkspaceVariableListCall<'a, C>
26797where
26798 C: 'a,
26799{
26800 hub: &'a TagManager<C>,
26801 _parent: String,
26802 _page_token: Option<String>,
26803 _delegate: Option<&'a mut dyn common::Delegate>,
26804 _additional_params: HashMap<String, String>,
26805 _scopes: BTreeSet<String>,
26806}
26807
26808impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableListCall<'a, C> {}
26809
26810impl<'a, C> AccountContainerWorkspaceVariableListCall<'a, C>
26811where
26812 C: common::Connector,
26813{
26814 /// Perform the operation you have build so far.
26815 pub async fn doit(mut self) -> common::Result<(common::Response, ListVariablesResponse)> {
26816 use std::borrow::Cow;
26817 use std::io::{Read, Seek};
26818
26819 use common::{url::Params, ToParts};
26820 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26821
26822 let mut dd = common::DefaultDelegate;
26823 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26824 dlg.begin(common::MethodInfo {
26825 id: "tagmanager.accounts.containers.workspaces.variables.list",
26826 http_method: hyper::Method::GET,
26827 });
26828
26829 for &field in ["alt", "parent", "pageToken"].iter() {
26830 if self._additional_params.contains_key(field) {
26831 dlg.finished(false);
26832 return Err(common::Error::FieldClash(field));
26833 }
26834 }
26835
26836 let mut params = Params::with_capacity(4 + self._additional_params.len());
26837 params.push("parent", self._parent);
26838 if let Some(value) = self._page_token.as_ref() {
26839 params.push("pageToken", value);
26840 }
26841
26842 params.extend(self._additional_params.iter());
26843
26844 params.push("alt", "json");
26845 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/variables";
26846 if self._scopes.is_empty() {
26847 self._scopes.insert(Scope::Readonly.as_ref().to_string());
26848 }
26849
26850 #[allow(clippy::single_element_loop)]
26851 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26852 url = params.uri_replacement(url, param_name, find_this, true);
26853 }
26854 {
26855 let to_remove = ["parent"];
26856 params.remove_params(&to_remove);
26857 }
26858
26859 let url = params.parse_with_url(&url);
26860
26861 loop {
26862 let token = match self
26863 .hub
26864 .auth
26865 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26866 .await
26867 {
26868 Ok(token) => token,
26869 Err(e) => match dlg.token(e) {
26870 Ok(token) => token,
26871 Err(e) => {
26872 dlg.finished(false);
26873 return Err(common::Error::MissingToken(e));
26874 }
26875 },
26876 };
26877 let mut req_result = {
26878 let client = &self.hub.client;
26879 dlg.pre_request();
26880 let mut req_builder = hyper::Request::builder()
26881 .method(hyper::Method::GET)
26882 .uri(url.as_str())
26883 .header(USER_AGENT, self.hub._user_agent.clone());
26884
26885 if let Some(token) = token.as_ref() {
26886 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26887 }
26888
26889 let request = req_builder
26890 .header(CONTENT_LENGTH, 0_u64)
26891 .body(common::to_body::<String>(None));
26892
26893 client.request(request.unwrap()).await
26894 };
26895
26896 match req_result {
26897 Err(err) => {
26898 if let common::Retry::After(d) = dlg.http_error(&err) {
26899 sleep(d).await;
26900 continue;
26901 }
26902 dlg.finished(false);
26903 return Err(common::Error::HttpError(err));
26904 }
26905 Ok(res) => {
26906 let (mut parts, body) = res.into_parts();
26907 let mut body = common::Body::new(body);
26908 if !parts.status.is_success() {
26909 let bytes = common::to_bytes(body).await.unwrap_or_default();
26910 let error = serde_json::from_str(&common::to_string(&bytes));
26911 let response = common::to_response(parts, bytes.into());
26912
26913 if let common::Retry::After(d) =
26914 dlg.http_failure(&response, error.as_ref().ok())
26915 {
26916 sleep(d).await;
26917 continue;
26918 }
26919
26920 dlg.finished(false);
26921
26922 return Err(match error {
26923 Ok(value) => common::Error::BadRequest(value),
26924 _ => common::Error::Failure(response),
26925 });
26926 }
26927 let response = {
26928 let bytes = common::to_bytes(body).await.unwrap_or_default();
26929 let encoded = common::to_string(&bytes);
26930 match serde_json::from_str(&encoded) {
26931 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26932 Err(error) => {
26933 dlg.response_json_decode_error(&encoded, &error);
26934 return Err(common::Error::JsonDecodeError(
26935 encoded.to_string(),
26936 error,
26937 ));
26938 }
26939 }
26940 };
26941
26942 dlg.finished(true);
26943 return Ok(response);
26944 }
26945 }
26946 }
26947 }
26948
26949 /// GTM Workspace's API relative path.
26950 ///
26951 /// Sets the *parent* path property to the given value.
26952 ///
26953 /// Even though the property as already been set when instantiating this call,
26954 /// we provide this method for API completeness.
26955 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceVariableListCall<'a, C> {
26956 self._parent = new_value.to_string();
26957 self
26958 }
26959 /// Continuation token for fetching the next page of results.
26960 ///
26961 /// Sets the *page token* query property to the given value.
26962 pub fn page_token(
26963 mut self,
26964 new_value: &str,
26965 ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
26966 self._page_token = Some(new_value.to_string());
26967 self
26968 }
26969 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26970 /// while executing the actual API request.
26971 ///
26972 /// ````text
26973 /// It should be used to handle progress information, and to implement a certain level of resilience.
26974 /// ````
26975 ///
26976 /// Sets the *delegate* property to the given value.
26977 pub fn delegate(
26978 mut self,
26979 new_value: &'a mut dyn common::Delegate,
26980 ) -> AccountContainerWorkspaceVariableListCall<'a, C> {
26981 self._delegate = Some(new_value);
26982 self
26983 }
26984
26985 /// Set any additional parameter of the query string used in the request.
26986 /// It should be used to set parameters which are not yet available through their own
26987 /// setters.
26988 ///
26989 /// Please note that this method must not be used to set any of the known parameters
26990 /// which have their own setter method. If done anyway, the request will fail.
26991 ///
26992 /// # Additional Parameters
26993 ///
26994 /// * *$.xgafv* (query-string) - V1 error format.
26995 /// * *access_token* (query-string) - OAuth access token.
26996 /// * *alt* (query-string) - Data format for response.
26997 /// * *callback* (query-string) - JSONP
26998 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26999 /// * *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.
27000 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27001 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27002 /// * *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.
27003 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27004 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27005 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceVariableListCall<'a, C>
27006 where
27007 T: AsRef<str>,
27008 {
27009 self._additional_params
27010 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27011 self
27012 }
27013
27014 /// Identifies the authorization scope for the method you are building.
27015 ///
27016 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27017 /// [`Scope::Readonly`].
27018 ///
27019 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27020 /// tokens for more than one scope.
27021 ///
27022 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27023 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27024 /// sufficient, a read-write scope will do as well.
27025 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableListCall<'a, C>
27026 where
27027 St: AsRef<str>,
27028 {
27029 self._scopes.insert(String::from(scope.as_ref()));
27030 self
27031 }
27032 /// Identifies the authorization scope(s) for the method you are building.
27033 ///
27034 /// See [`Self::add_scope()`] for details.
27035 pub fn add_scopes<I, St>(
27036 mut self,
27037 scopes: I,
27038 ) -> AccountContainerWorkspaceVariableListCall<'a, C>
27039 where
27040 I: IntoIterator<Item = St>,
27041 St: AsRef<str>,
27042 {
27043 self._scopes
27044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27045 self
27046 }
27047
27048 /// Removes all scopes, and no default scope will be used either.
27049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27050 /// for details).
27051 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableListCall<'a, C> {
27052 self._scopes.clear();
27053 self
27054 }
27055}
27056
27057/// Reverts changes to a GTM Variable in a GTM Workspace.
27058///
27059/// A builder for the *containers.workspaces.variables.revert* method supported by a *account* resource.
27060/// It is not used directly, but through a [`AccountMethods`] instance.
27061///
27062/// # Example
27063///
27064/// Instantiate a resource method builder
27065///
27066/// ```test_harness,no_run
27067/// # extern crate hyper;
27068/// # extern crate hyper_rustls;
27069/// # extern crate google_tagmanager2 as tagmanager2;
27070/// # async fn dox() {
27071/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27072///
27073/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27074/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27075/// # .with_native_roots()
27076/// # .unwrap()
27077/// # .https_only()
27078/// # .enable_http2()
27079/// # .build();
27080///
27081/// # let executor = hyper_util::rt::TokioExecutor::new();
27082/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27083/// # secret,
27084/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27085/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27086/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27087/// # ),
27088/// # ).build().await.unwrap();
27089///
27090/// # let client = hyper_util::client::legacy::Client::builder(
27091/// # hyper_util::rt::TokioExecutor::new()
27092/// # )
27093/// # .build(
27094/// # hyper_rustls::HttpsConnectorBuilder::new()
27095/// # .with_native_roots()
27096/// # .unwrap()
27097/// # .https_or_http()
27098/// # .enable_http2()
27099/// # .build()
27100/// # );
27101/// # let mut hub = TagManager::new(client, auth);
27102/// // You can configure optional parameters by calling the respective setters at will, and
27103/// // execute the final call using `doit()`.
27104/// // Values shown here are possibly random and not representative !
27105/// let result = hub.accounts().containers_workspaces_variables_revert("path")
27106/// .fingerprint("eos")
27107/// .doit().await;
27108/// # }
27109/// ```
27110pub struct AccountContainerWorkspaceVariableRevertCall<'a, C>
27111where
27112 C: 'a,
27113{
27114 hub: &'a TagManager<C>,
27115 _path: String,
27116 _fingerprint: Option<String>,
27117 _delegate: Option<&'a mut dyn common::Delegate>,
27118 _additional_params: HashMap<String, String>,
27119 _scopes: BTreeSet<String>,
27120}
27121
27122impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableRevertCall<'a, C> {}
27123
27124impl<'a, C> AccountContainerWorkspaceVariableRevertCall<'a, C>
27125where
27126 C: common::Connector,
27127{
27128 /// Perform the operation you have build so far.
27129 pub async fn doit(mut self) -> common::Result<(common::Response, RevertVariableResponse)> {
27130 use std::borrow::Cow;
27131 use std::io::{Read, Seek};
27132
27133 use common::{url::Params, ToParts};
27134 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27135
27136 let mut dd = common::DefaultDelegate;
27137 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27138 dlg.begin(common::MethodInfo {
27139 id: "tagmanager.accounts.containers.workspaces.variables.revert",
27140 http_method: hyper::Method::POST,
27141 });
27142
27143 for &field in ["alt", "path", "fingerprint"].iter() {
27144 if self._additional_params.contains_key(field) {
27145 dlg.finished(false);
27146 return Err(common::Error::FieldClash(field));
27147 }
27148 }
27149
27150 let mut params = Params::with_capacity(4 + self._additional_params.len());
27151 params.push("path", self._path);
27152 if let Some(value) = self._fingerprint.as_ref() {
27153 params.push("fingerprint", value);
27154 }
27155
27156 params.extend(self._additional_params.iter());
27157
27158 params.push("alt", "json");
27159 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
27160 if self._scopes.is_empty() {
27161 self._scopes
27162 .insert(Scope::EditContainer.as_ref().to_string());
27163 }
27164
27165 #[allow(clippy::single_element_loop)]
27166 for &(find_this, param_name) in [("{+path}", "path")].iter() {
27167 url = params.uri_replacement(url, param_name, find_this, true);
27168 }
27169 {
27170 let to_remove = ["path"];
27171 params.remove_params(&to_remove);
27172 }
27173
27174 let url = params.parse_with_url(&url);
27175
27176 loop {
27177 let token = match self
27178 .hub
27179 .auth
27180 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27181 .await
27182 {
27183 Ok(token) => token,
27184 Err(e) => match dlg.token(e) {
27185 Ok(token) => token,
27186 Err(e) => {
27187 dlg.finished(false);
27188 return Err(common::Error::MissingToken(e));
27189 }
27190 },
27191 };
27192 let mut req_result = {
27193 let client = &self.hub.client;
27194 dlg.pre_request();
27195 let mut req_builder = hyper::Request::builder()
27196 .method(hyper::Method::POST)
27197 .uri(url.as_str())
27198 .header(USER_AGENT, self.hub._user_agent.clone());
27199
27200 if let Some(token) = token.as_ref() {
27201 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27202 }
27203
27204 let request = req_builder
27205 .header(CONTENT_LENGTH, 0_u64)
27206 .body(common::to_body::<String>(None));
27207
27208 client.request(request.unwrap()).await
27209 };
27210
27211 match req_result {
27212 Err(err) => {
27213 if let common::Retry::After(d) = dlg.http_error(&err) {
27214 sleep(d).await;
27215 continue;
27216 }
27217 dlg.finished(false);
27218 return Err(common::Error::HttpError(err));
27219 }
27220 Ok(res) => {
27221 let (mut parts, body) = res.into_parts();
27222 let mut body = common::Body::new(body);
27223 if !parts.status.is_success() {
27224 let bytes = common::to_bytes(body).await.unwrap_or_default();
27225 let error = serde_json::from_str(&common::to_string(&bytes));
27226 let response = common::to_response(parts, bytes.into());
27227
27228 if let common::Retry::After(d) =
27229 dlg.http_failure(&response, error.as_ref().ok())
27230 {
27231 sleep(d).await;
27232 continue;
27233 }
27234
27235 dlg.finished(false);
27236
27237 return Err(match error {
27238 Ok(value) => common::Error::BadRequest(value),
27239 _ => common::Error::Failure(response),
27240 });
27241 }
27242 let response = {
27243 let bytes = common::to_bytes(body).await.unwrap_or_default();
27244 let encoded = common::to_string(&bytes);
27245 match serde_json::from_str(&encoded) {
27246 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27247 Err(error) => {
27248 dlg.response_json_decode_error(&encoded, &error);
27249 return Err(common::Error::JsonDecodeError(
27250 encoded.to_string(),
27251 error,
27252 ));
27253 }
27254 }
27255 };
27256
27257 dlg.finished(true);
27258 return Ok(response);
27259 }
27260 }
27261 }
27262 }
27263
27264 /// GTM Variable's API relative path.
27265 ///
27266 /// Sets the *path* path property to the given value.
27267 ///
27268 /// Even though the property as already been set when instantiating this call,
27269 /// we provide this method for API completeness.
27270 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
27271 self._path = new_value.to_string();
27272 self
27273 }
27274 /// When provided, this fingerprint must match the fingerprint of the variable in storage.
27275 ///
27276 /// Sets the *fingerprint* query property to the given value.
27277 pub fn fingerprint(
27278 mut self,
27279 new_value: &str,
27280 ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
27281 self._fingerprint = Some(new_value.to_string());
27282 self
27283 }
27284 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27285 /// while executing the actual API request.
27286 ///
27287 /// ````text
27288 /// It should be used to handle progress information, and to implement a certain level of resilience.
27289 /// ````
27290 ///
27291 /// Sets the *delegate* property to the given value.
27292 pub fn delegate(
27293 mut self,
27294 new_value: &'a mut dyn common::Delegate,
27295 ) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
27296 self._delegate = Some(new_value);
27297 self
27298 }
27299
27300 /// Set any additional parameter of the query string used in the request.
27301 /// It should be used to set parameters which are not yet available through their own
27302 /// setters.
27303 ///
27304 /// Please note that this method must not be used to set any of the known parameters
27305 /// which have their own setter method. If done anyway, the request will fail.
27306 ///
27307 /// # Additional Parameters
27308 ///
27309 /// * *$.xgafv* (query-string) - V1 error format.
27310 /// * *access_token* (query-string) - OAuth access token.
27311 /// * *alt* (query-string) - Data format for response.
27312 /// * *callback* (query-string) - JSONP
27313 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27314 /// * *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.
27315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27316 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27317 /// * *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.
27318 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27319 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27320 pub fn param<T>(
27321 mut self,
27322 name: T,
27323 value: T,
27324 ) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
27325 where
27326 T: AsRef<str>,
27327 {
27328 self._additional_params
27329 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27330 self
27331 }
27332
27333 /// Identifies the authorization scope for the method you are building.
27334 ///
27335 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27336 /// [`Scope::EditContainer`].
27337 ///
27338 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27339 /// tokens for more than one scope.
27340 ///
27341 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27342 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27343 /// sufficient, a read-write scope will do as well.
27344 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
27345 where
27346 St: AsRef<str>,
27347 {
27348 self._scopes.insert(String::from(scope.as_ref()));
27349 self
27350 }
27351 /// Identifies the authorization scope(s) for the method you are building.
27352 ///
27353 /// See [`Self::add_scope()`] for details.
27354 pub fn add_scopes<I, St>(
27355 mut self,
27356 scopes: I,
27357 ) -> AccountContainerWorkspaceVariableRevertCall<'a, C>
27358 where
27359 I: IntoIterator<Item = St>,
27360 St: AsRef<str>,
27361 {
27362 self._scopes
27363 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27364 self
27365 }
27366
27367 /// Removes all scopes, and no default scope will be used either.
27368 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27369 /// for details).
27370 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableRevertCall<'a, C> {
27371 self._scopes.clear();
27372 self
27373 }
27374}
27375
27376/// Updates a GTM Variable.
27377///
27378/// A builder for the *containers.workspaces.variables.update* method supported by a *account* resource.
27379/// It is not used directly, but through a [`AccountMethods`] instance.
27380///
27381/// # Example
27382///
27383/// Instantiate a resource method builder
27384///
27385/// ```test_harness,no_run
27386/// # extern crate hyper;
27387/// # extern crate hyper_rustls;
27388/// # extern crate google_tagmanager2 as tagmanager2;
27389/// use tagmanager2::api::Variable;
27390/// # async fn dox() {
27391/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27392///
27393/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27394/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27395/// # .with_native_roots()
27396/// # .unwrap()
27397/// # .https_only()
27398/// # .enable_http2()
27399/// # .build();
27400///
27401/// # let executor = hyper_util::rt::TokioExecutor::new();
27402/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27403/// # secret,
27404/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27405/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27406/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27407/// # ),
27408/// # ).build().await.unwrap();
27409///
27410/// # let client = hyper_util::client::legacy::Client::builder(
27411/// # hyper_util::rt::TokioExecutor::new()
27412/// # )
27413/// # .build(
27414/// # hyper_rustls::HttpsConnectorBuilder::new()
27415/// # .with_native_roots()
27416/// # .unwrap()
27417/// # .https_or_http()
27418/// # .enable_http2()
27419/// # .build()
27420/// # );
27421/// # let mut hub = TagManager::new(client, auth);
27422/// // As the method needs a request, you would usually fill it with the desired information
27423/// // into the respective structure. Some of the parts shown here might not be applicable !
27424/// // Values shown here are possibly random and not representative !
27425/// let mut req = Variable::default();
27426///
27427/// // You can configure optional parameters by calling the respective setters at will, and
27428/// // execute the final call using `doit()`.
27429/// // Values shown here are possibly random and not representative !
27430/// let result = hub.accounts().containers_workspaces_variables_update(req, "path")
27431/// .fingerprint("ea")
27432/// .doit().await;
27433/// # }
27434/// ```
27435pub struct AccountContainerWorkspaceVariableUpdateCall<'a, C>
27436where
27437 C: 'a,
27438{
27439 hub: &'a TagManager<C>,
27440 _request: Variable,
27441 _path: String,
27442 _fingerprint: Option<String>,
27443 _delegate: Option<&'a mut dyn common::Delegate>,
27444 _additional_params: HashMap<String, String>,
27445 _scopes: BTreeSet<String>,
27446}
27447
27448impl<'a, C> common::CallBuilder for AccountContainerWorkspaceVariableUpdateCall<'a, C> {}
27449
27450impl<'a, C> AccountContainerWorkspaceVariableUpdateCall<'a, C>
27451where
27452 C: common::Connector,
27453{
27454 /// Perform the operation you have build so far.
27455 pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
27456 use std::borrow::Cow;
27457 use std::io::{Read, Seek};
27458
27459 use common::{url::Params, ToParts};
27460 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27461
27462 let mut dd = common::DefaultDelegate;
27463 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27464 dlg.begin(common::MethodInfo {
27465 id: "tagmanager.accounts.containers.workspaces.variables.update",
27466 http_method: hyper::Method::PUT,
27467 });
27468
27469 for &field in ["alt", "path", "fingerprint"].iter() {
27470 if self._additional_params.contains_key(field) {
27471 dlg.finished(false);
27472 return Err(common::Error::FieldClash(field));
27473 }
27474 }
27475
27476 let mut params = Params::with_capacity(5 + self._additional_params.len());
27477 params.push("path", self._path);
27478 if let Some(value) = self._fingerprint.as_ref() {
27479 params.push("fingerprint", value);
27480 }
27481
27482 params.extend(self._additional_params.iter());
27483
27484 params.push("alt", "json");
27485 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
27486 if self._scopes.is_empty() {
27487 self._scopes
27488 .insert(Scope::EditContainer.as_ref().to_string());
27489 }
27490
27491 #[allow(clippy::single_element_loop)]
27492 for &(find_this, param_name) in [("{+path}", "path")].iter() {
27493 url = params.uri_replacement(url, param_name, find_this, true);
27494 }
27495 {
27496 let to_remove = ["path"];
27497 params.remove_params(&to_remove);
27498 }
27499
27500 let url = params.parse_with_url(&url);
27501
27502 let mut json_mime_type = mime::APPLICATION_JSON;
27503 let mut request_value_reader = {
27504 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27505 common::remove_json_null_values(&mut value);
27506 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27507 serde_json::to_writer(&mut dst, &value).unwrap();
27508 dst
27509 };
27510 let request_size = request_value_reader
27511 .seek(std::io::SeekFrom::End(0))
27512 .unwrap();
27513 request_value_reader
27514 .seek(std::io::SeekFrom::Start(0))
27515 .unwrap();
27516
27517 loop {
27518 let token = match self
27519 .hub
27520 .auth
27521 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27522 .await
27523 {
27524 Ok(token) => token,
27525 Err(e) => match dlg.token(e) {
27526 Ok(token) => token,
27527 Err(e) => {
27528 dlg.finished(false);
27529 return Err(common::Error::MissingToken(e));
27530 }
27531 },
27532 };
27533 request_value_reader
27534 .seek(std::io::SeekFrom::Start(0))
27535 .unwrap();
27536 let mut req_result = {
27537 let client = &self.hub.client;
27538 dlg.pre_request();
27539 let mut req_builder = hyper::Request::builder()
27540 .method(hyper::Method::PUT)
27541 .uri(url.as_str())
27542 .header(USER_AGENT, self.hub._user_agent.clone());
27543
27544 if let Some(token) = token.as_ref() {
27545 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27546 }
27547
27548 let request = req_builder
27549 .header(CONTENT_TYPE, json_mime_type.to_string())
27550 .header(CONTENT_LENGTH, request_size as u64)
27551 .body(common::to_body(
27552 request_value_reader.get_ref().clone().into(),
27553 ));
27554
27555 client.request(request.unwrap()).await
27556 };
27557
27558 match req_result {
27559 Err(err) => {
27560 if let common::Retry::After(d) = dlg.http_error(&err) {
27561 sleep(d).await;
27562 continue;
27563 }
27564 dlg.finished(false);
27565 return Err(common::Error::HttpError(err));
27566 }
27567 Ok(res) => {
27568 let (mut parts, body) = res.into_parts();
27569 let mut body = common::Body::new(body);
27570 if !parts.status.is_success() {
27571 let bytes = common::to_bytes(body).await.unwrap_or_default();
27572 let error = serde_json::from_str(&common::to_string(&bytes));
27573 let response = common::to_response(parts, bytes.into());
27574
27575 if let common::Retry::After(d) =
27576 dlg.http_failure(&response, error.as_ref().ok())
27577 {
27578 sleep(d).await;
27579 continue;
27580 }
27581
27582 dlg.finished(false);
27583
27584 return Err(match error {
27585 Ok(value) => common::Error::BadRequest(value),
27586 _ => common::Error::Failure(response),
27587 });
27588 }
27589 let response = {
27590 let bytes = common::to_bytes(body).await.unwrap_or_default();
27591 let encoded = common::to_string(&bytes);
27592 match serde_json::from_str(&encoded) {
27593 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27594 Err(error) => {
27595 dlg.response_json_decode_error(&encoded, &error);
27596 return Err(common::Error::JsonDecodeError(
27597 encoded.to_string(),
27598 error,
27599 ));
27600 }
27601 }
27602 };
27603
27604 dlg.finished(true);
27605 return Ok(response);
27606 }
27607 }
27608 }
27609 }
27610
27611 ///
27612 /// Sets the *request* property to the given value.
27613 ///
27614 /// Even though the property as already been set when instantiating this call,
27615 /// we provide this method for API completeness.
27616 pub fn request(
27617 mut self,
27618 new_value: Variable,
27619 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
27620 self._request = new_value;
27621 self
27622 }
27623 /// GTM Variable's API relative path.
27624 ///
27625 /// Sets the *path* path property to the given value.
27626 ///
27627 /// Even though the property as already been set when instantiating this call,
27628 /// we provide this method for API completeness.
27629 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
27630 self._path = new_value.to_string();
27631 self
27632 }
27633 /// When provided, this fingerprint must match the fingerprint of the variable in storage.
27634 ///
27635 /// Sets the *fingerprint* query property to the given value.
27636 pub fn fingerprint(
27637 mut self,
27638 new_value: &str,
27639 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
27640 self._fingerprint = Some(new_value.to_string());
27641 self
27642 }
27643 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27644 /// while executing the actual API request.
27645 ///
27646 /// ````text
27647 /// It should be used to handle progress information, and to implement a certain level of resilience.
27648 /// ````
27649 ///
27650 /// Sets the *delegate* property to the given value.
27651 pub fn delegate(
27652 mut self,
27653 new_value: &'a mut dyn common::Delegate,
27654 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
27655 self._delegate = Some(new_value);
27656 self
27657 }
27658
27659 /// Set any additional parameter of the query string used in the request.
27660 /// It should be used to set parameters which are not yet available through their own
27661 /// setters.
27662 ///
27663 /// Please note that this method must not be used to set any of the known parameters
27664 /// which have their own setter method. If done anyway, the request will fail.
27665 ///
27666 /// # Additional Parameters
27667 ///
27668 /// * *$.xgafv* (query-string) - V1 error format.
27669 /// * *access_token* (query-string) - OAuth access token.
27670 /// * *alt* (query-string) - Data format for response.
27671 /// * *callback* (query-string) - JSONP
27672 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27673 /// * *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.
27674 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27675 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27676 /// * *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.
27677 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27678 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27679 pub fn param<T>(
27680 mut self,
27681 name: T,
27682 value: T,
27683 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
27684 where
27685 T: AsRef<str>,
27686 {
27687 self._additional_params
27688 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27689 self
27690 }
27691
27692 /// Identifies the authorization scope for the method you are building.
27693 ///
27694 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27695 /// [`Scope::EditContainer`].
27696 ///
27697 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27698 /// tokens for more than one scope.
27699 ///
27700 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27701 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27702 /// sufficient, a read-write scope will do as well.
27703 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
27704 where
27705 St: AsRef<str>,
27706 {
27707 self._scopes.insert(String::from(scope.as_ref()));
27708 self
27709 }
27710 /// Identifies the authorization scope(s) for the method you are building.
27711 ///
27712 /// See [`Self::add_scope()`] for details.
27713 pub fn add_scopes<I, St>(
27714 mut self,
27715 scopes: I,
27716 ) -> AccountContainerWorkspaceVariableUpdateCall<'a, C>
27717 where
27718 I: IntoIterator<Item = St>,
27719 St: AsRef<str>,
27720 {
27721 self._scopes
27722 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27723 self
27724 }
27725
27726 /// Removes all scopes, and no default scope will be used either.
27727 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27728 /// for details).
27729 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceVariableUpdateCall<'a, C> {
27730 self._scopes.clear();
27731 self
27732 }
27733}
27734
27735/// Creates a GTM Zone.
27736///
27737/// A builder for the *containers.workspaces.zones.create* method supported by a *account* resource.
27738/// It is not used directly, but through a [`AccountMethods`] instance.
27739///
27740/// # Example
27741///
27742/// Instantiate a resource method builder
27743///
27744/// ```test_harness,no_run
27745/// # extern crate hyper;
27746/// # extern crate hyper_rustls;
27747/// # extern crate google_tagmanager2 as tagmanager2;
27748/// use tagmanager2::api::Zone;
27749/// # async fn dox() {
27750/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27751///
27752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27754/// # .with_native_roots()
27755/// # .unwrap()
27756/// # .https_only()
27757/// # .enable_http2()
27758/// # .build();
27759///
27760/// # let executor = hyper_util::rt::TokioExecutor::new();
27761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27762/// # secret,
27763/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27764/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27765/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27766/// # ),
27767/// # ).build().await.unwrap();
27768///
27769/// # let client = hyper_util::client::legacy::Client::builder(
27770/// # hyper_util::rt::TokioExecutor::new()
27771/// # )
27772/// # .build(
27773/// # hyper_rustls::HttpsConnectorBuilder::new()
27774/// # .with_native_roots()
27775/// # .unwrap()
27776/// # .https_or_http()
27777/// # .enable_http2()
27778/// # .build()
27779/// # );
27780/// # let mut hub = TagManager::new(client, auth);
27781/// // As the method needs a request, you would usually fill it with the desired information
27782/// // into the respective structure. Some of the parts shown here might not be applicable !
27783/// // Values shown here are possibly random and not representative !
27784/// let mut req = Zone::default();
27785///
27786/// // You can configure optional parameters by calling the respective setters at will, and
27787/// // execute the final call using `doit()`.
27788/// // Values shown here are possibly random and not representative !
27789/// let result = hub.accounts().containers_workspaces_zones_create(req, "parent")
27790/// .doit().await;
27791/// # }
27792/// ```
27793pub struct AccountContainerWorkspaceZoneCreateCall<'a, C>
27794where
27795 C: 'a,
27796{
27797 hub: &'a TagManager<C>,
27798 _request: Zone,
27799 _parent: String,
27800 _delegate: Option<&'a mut dyn common::Delegate>,
27801 _additional_params: HashMap<String, String>,
27802 _scopes: BTreeSet<String>,
27803}
27804
27805impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneCreateCall<'a, C> {}
27806
27807impl<'a, C> AccountContainerWorkspaceZoneCreateCall<'a, C>
27808where
27809 C: common::Connector,
27810{
27811 /// Perform the operation you have build so far.
27812 pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
27813 use std::borrow::Cow;
27814 use std::io::{Read, Seek};
27815
27816 use common::{url::Params, ToParts};
27817 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27818
27819 let mut dd = common::DefaultDelegate;
27820 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27821 dlg.begin(common::MethodInfo {
27822 id: "tagmanager.accounts.containers.workspaces.zones.create",
27823 http_method: hyper::Method::POST,
27824 });
27825
27826 for &field in ["alt", "parent"].iter() {
27827 if self._additional_params.contains_key(field) {
27828 dlg.finished(false);
27829 return Err(common::Error::FieldClash(field));
27830 }
27831 }
27832
27833 let mut params = Params::with_capacity(4 + self._additional_params.len());
27834 params.push("parent", self._parent);
27835
27836 params.extend(self._additional_params.iter());
27837
27838 params.push("alt", "json");
27839 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/zones";
27840 if self._scopes.is_empty() {
27841 self._scopes
27842 .insert(Scope::EditContainer.as_ref().to_string());
27843 }
27844
27845 #[allow(clippy::single_element_loop)]
27846 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27847 url = params.uri_replacement(url, param_name, find_this, true);
27848 }
27849 {
27850 let to_remove = ["parent"];
27851 params.remove_params(&to_remove);
27852 }
27853
27854 let url = params.parse_with_url(&url);
27855
27856 let mut json_mime_type = mime::APPLICATION_JSON;
27857 let mut request_value_reader = {
27858 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27859 common::remove_json_null_values(&mut value);
27860 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27861 serde_json::to_writer(&mut dst, &value).unwrap();
27862 dst
27863 };
27864 let request_size = request_value_reader
27865 .seek(std::io::SeekFrom::End(0))
27866 .unwrap();
27867 request_value_reader
27868 .seek(std::io::SeekFrom::Start(0))
27869 .unwrap();
27870
27871 loop {
27872 let token = match self
27873 .hub
27874 .auth
27875 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27876 .await
27877 {
27878 Ok(token) => token,
27879 Err(e) => match dlg.token(e) {
27880 Ok(token) => token,
27881 Err(e) => {
27882 dlg.finished(false);
27883 return Err(common::Error::MissingToken(e));
27884 }
27885 },
27886 };
27887 request_value_reader
27888 .seek(std::io::SeekFrom::Start(0))
27889 .unwrap();
27890 let mut req_result = {
27891 let client = &self.hub.client;
27892 dlg.pre_request();
27893 let mut req_builder = hyper::Request::builder()
27894 .method(hyper::Method::POST)
27895 .uri(url.as_str())
27896 .header(USER_AGENT, self.hub._user_agent.clone());
27897
27898 if let Some(token) = token.as_ref() {
27899 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27900 }
27901
27902 let request = req_builder
27903 .header(CONTENT_TYPE, json_mime_type.to_string())
27904 .header(CONTENT_LENGTH, request_size as u64)
27905 .body(common::to_body(
27906 request_value_reader.get_ref().clone().into(),
27907 ));
27908
27909 client.request(request.unwrap()).await
27910 };
27911
27912 match req_result {
27913 Err(err) => {
27914 if let common::Retry::After(d) = dlg.http_error(&err) {
27915 sleep(d).await;
27916 continue;
27917 }
27918 dlg.finished(false);
27919 return Err(common::Error::HttpError(err));
27920 }
27921 Ok(res) => {
27922 let (mut parts, body) = res.into_parts();
27923 let mut body = common::Body::new(body);
27924 if !parts.status.is_success() {
27925 let bytes = common::to_bytes(body).await.unwrap_or_default();
27926 let error = serde_json::from_str(&common::to_string(&bytes));
27927 let response = common::to_response(parts, bytes.into());
27928
27929 if let common::Retry::After(d) =
27930 dlg.http_failure(&response, error.as_ref().ok())
27931 {
27932 sleep(d).await;
27933 continue;
27934 }
27935
27936 dlg.finished(false);
27937
27938 return Err(match error {
27939 Ok(value) => common::Error::BadRequest(value),
27940 _ => common::Error::Failure(response),
27941 });
27942 }
27943 let response = {
27944 let bytes = common::to_bytes(body).await.unwrap_or_default();
27945 let encoded = common::to_string(&bytes);
27946 match serde_json::from_str(&encoded) {
27947 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27948 Err(error) => {
27949 dlg.response_json_decode_error(&encoded, &error);
27950 return Err(common::Error::JsonDecodeError(
27951 encoded.to_string(),
27952 error,
27953 ));
27954 }
27955 }
27956 };
27957
27958 dlg.finished(true);
27959 return Ok(response);
27960 }
27961 }
27962 }
27963 }
27964
27965 ///
27966 /// Sets the *request* property to the given value.
27967 ///
27968 /// Even though the property as already been set when instantiating this call,
27969 /// we provide this method for API completeness.
27970 pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
27971 self._request = new_value;
27972 self
27973 }
27974 /// GTM Workspace's API relative path.
27975 ///
27976 /// Sets the *parent* path property to the given value.
27977 ///
27978 /// Even though the property as already been set when instantiating this call,
27979 /// we provide this method for API completeness.
27980 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
27981 self._parent = new_value.to_string();
27982 self
27983 }
27984 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27985 /// while executing the actual API request.
27986 ///
27987 /// ````text
27988 /// It should be used to handle progress information, and to implement a certain level of resilience.
27989 /// ````
27990 ///
27991 /// Sets the *delegate* property to the given value.
27992 pub fn delegate(
27993 mut self,
27994 new_value: &'a mut dyn common::Delegate,
27995 ) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
27996 self._delegate = Some(new_value);
27997 self
27998 }
27999
28000 /// Set any additional parameter of the query string used in the request.
28001 /// It should be used to set parameters which are not yet available through their own
28002 /// setters.
28003 ///
28004 /// Please note that this method must not be used to set any of the known parameters
28005 /// which have their own setter method. If done anyway, the request will fail.
28006 ///
28007 /// # Additional Parameters
28008 ///
28009 /// * *$.xgafv* (query-string) - V1 error format.
28010 /// * *access_token* (query-string) - OAuth access token.
28011 /// * *alt* (query-string) - Data format for response.
28012 /// * *callback* (query-string) - JSONP
28013 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28014 /// * *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.
28015 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28016 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28017 /// * *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.
28018 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28019 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28020 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
28021 where
28022 T: AsRef<str>,
28023 {
28024 self._additional_params
28025 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28026 self
28027 }
28028
28029 /// Identifies the authorization scope for the method you are building.
28030 ///
28031 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28032 /// [`Scope::EditContainer`].
28033 ///
28034 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28035 /// tokens for more than one scope.
28036 ///
28037 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28038 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28039 /// sufficient, a read-write scope will do as well.
28040 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
28041 where
28042 St: AsRef<str>,
28043 {
28044 self._scopes.insert(String::from(scope.as_ref()));
28045 self
28046 }
28047 /// Identifies the authorization scope(s) for the method you are building.
28048 ///
28049 /// See [`Self::add_scope()`] for details.
28050 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneCreateCall<'a, C>
28051 where
28052 I: IntoIterator<Item = St>,
28053 St: AsRef<str>,
28054 {
28055 self._scopes
28056 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28057 self
28058 }
28059
28060 /// Removes all scopes, and no default scope will be used either.
28061 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28062 /// for details).
28063 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneCreateCall<'a, C> {
28064 self._scopes.clear();
28065 self
28066 }
28067}
28068
28069/// Deletes a GTM Zone.
28070///
28071/// A builder for the *containers.workspaces.zones.delete* method supported by a *account* resource.
28072/// It is not used directly, but through a [`AccountMethods`] instance.
28073///
28074/// # Example
28075///
28076/// Instantiate a resource method builder
28077///
28078/// ```test_harness,no_run
28079/// # extern crate hyper;
28080/// # extern crate hyper_rustls;
28081/// # extern crate google_tagmanager2 as tagmanager2;
28082/// # async fn dox() {
28083/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28084///
28085/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28086/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28087/// # .with_native_roots()
28088/// # .unwrap()
28089/// # .https_only()
28090/// # .enable_http2()
28091/// # .build();
28092///
28093/// # let executor = hyper_util::rt::TokioExecutor::new();
28094/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28095/// # secret,
28096/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28097/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28098/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28099/// # ),
28100/// # ).build().await.unwrap();
28101///
28102/// # let client = hyper_util::client::legacy::Client::builder(
28103/// # hyper_util::rt::TokioExecutor::new()
28104/// # )
28105/// # .build(
28106/// # hyper_rustls::HttpsConnectorBuilder::new()
28107/// # .with_native_roots()
28108/// # .unwrap()
28109/// # .https_or_http()
28110/// # .enable_http2()
28111/// # .build()
28112/// # );
28113/// # let mut hub = TagManager::new(client, auth);
28114/// // You can configure optional parameters by calling the respective setters at will, and
28115/// // execute the final call using `doit()`.
28116/// // Values shown here are possibly random and not representative !
28117/// let result = hub.accounts().containers_workspaces_zones_delete("path")
28118/// .doit().await;
28119/// # }
28120/// ```
28121pub struct AccountContainerWorkspaceZoneDeleteCall<'a, C>
28122where
28123 C: 'a,
28124{
28125 hub: &'a TagManager<C>,
28126 _path: String,
28127 _delegate: Option<&'a mut dyn common::Delegate>,
28128 _additional_params: HashMap<String, String>,
28129 _scopes: BTreeSet<String>,
28130}
28131
28132impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneDeleteCall<'a, C> {}
28133
28134impl<'a, C> AccountContainerWorkspaceZoneDeleteCall<'a, C>
28135where
28136 C: common::Connector,
28137{
28138 /// Perform the operation you have build so far.
28139 pub async fn doit(mut self) -> common::Result<common::Response> {
28140 use std::borrow::Cow;
28141 use std::io::{Read, Seek};
28142
28143 use common::{url::Params, ToParts};
28144 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28145
28146 let mut dd = common::DefaultDelegate;
28147 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28148 dlg.begin(common::MethodInfo {
28149 id: "tagmanager.accounts.containers.workspaces.zones.delete",
28150 http_method: hyper::Method::DELETE,
28151 });
28152
28153 for &field in ["path"].iter() {
28154 if self._additional_params.contains_key(field) {
28155 dlg.finished(false);
28156 return Err(common::Error::FieldClash(field));
28157 }
28158 }
28159
28160 let mut params = Params::with_capacity(2 + self._additional_params.len());
28161 params.push("path", self._path);
28162
28163 params.extend(self._additional_params.iter());
28164
28165 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
28166 if self._scopes.is_empty() {
28167 self._scopes
28168 .insert(Scope::EditContainer.as_ref().to_string());
28169 }
28170
28171 #[allow(clippy::single_element_loop)]
28172 for &(find_this, param_name) in [("{+path}", "path")].iter() {
28173 url = params.uri_replacement(url, param_name, find_this, true);
28174 }
28175 {
28176 let to_remove = ["path"];
28177 params.remove_params(&to_remove);
28178 }
28179
28180 let url = params.parse_with_url(&url);
28181
28182 loop {
28183 let token = match self
28184 .hub
28185 .auth
28186 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28187 .await
28188 {
28189 Ok(token) => token,
28190 Err(e) => match dlg.token(e) {
28191 Ok(token) => token,
28192 Err(e) => {
28193 dlg.finished(false);
28194 return Err(common::Error::MissingToken(e));
28195 }
28196 },
28197 };
28198 let mut req_result = {
28199 let client = &self.hub.client;
28200 dlg.pre_request();
28201 let mut req_builder = hyper::Request::builder()
28202 .method(hyper::Method::DELETE)
28203 .uri(url.as_str())
28204 .header(USER_AGENT, self.hub._user_agent.clone());
28205
28206 if let Some(token) = token.as_ref() {
28207 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28208 }
28209
28210 let request = req_builder
28211 .header(CONTENT_LENGTH, 0_u64)
28212 .body(common::to_body::<String>(None));
28213
28214 client.request(request.unwrap()).await
28215 };
28216
28217 match req_result {
28218 Err(err) => {
28219 if let common::Retry::After(d) = dlg.http_error(&err) {
28220 sleep(d).await;
28221 continue;
28222 }
28223 dlg.finished(false);
28224 return Err(common::Error::HttpError(err));
28225 }
28226 Ok(res) => {
28227 let (mut parts, body) = res.into_parts();
28228 let mut body = common::Body::new(body);
28229 if !parts.status.is_success() {
28230 let bytes = common::to_bytes(body).await.unwrap_or_default();
28231 let error = serde_json::from_str(&common::to_string(&bytes));
28232 let response = common::to_response(parts, bytes.into());
28233
28234 if let common::Retry::After(d) =
28235 dlg.http_failure(&response, error.as_ref().ok())
28236 {
28237 sleep(d).await;
28238 continue;
28239 }
28240
28241 dlg.finished(false);
28242
28243 return Err(match error {
28244 Ok(value) => common::Error::BadRequest(value),
28245 _ => common::Error::Failure(response),
28246 });
28247 }
28248 let response = common::Response::from_parts(parts, body);
28249
28250 dlg.finished(true);
28251 return Ok(response);
28252 }
28253 }
28254 }
28255 }
28256
28257 /// GTM Zone's API relative path.
28258 ///
28259 /// Sets the *path* path property to the given value.
28260 ///
28261 /// Even though the property as already been set when instantiating this call,
28262 /// we provide this method for API completeness.
28263 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
28264 self._path = new_value.to_string();
28265 self
28266 }
28267 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28268 /// while executing the actual API request.
28269 ///
28270 /// ````text
28271 /// It should be used to handle progress information, and to implement a certain level of resilience.
28272 /// ````
28273 ///
28274 /// Sets the *delegate* property to the given value.
28275 pub fn delegate(
28276 mut self,
28277 new_value: &'a mut dyn common::Delegate,
28278 ) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
28279 self._delegate = Some(new_value);
28280 self
28281 }
28282
28283 /// Set any additional parameter of the query string used in the request.
28284 /// It should be used to set parameters which are not yet available through their own
28285 /// setters.
28286 ///
28287 /// Please note that this method must not be used to set any of the known parameters
28288 /// which have their own setter method. If done anyway, the request will fail.
28289 ///
28290 /// # Additional Parameters
28291 ///
28292 /// * *$.xgafv* (query-string) - V1 error format.
28293 /// * *access_token* (query-string) - OAuth access token.
28294 /// * *alt* (query-string) - Data format for response.
28295 /// * *callback* (query-string) - JSONP
28296 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28297 /// * *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.
28298 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28299 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28300 /// * *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.
28301 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28302 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28303 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
28304 where
28305 T: AsRef<str>,
28306 {
28307 self._additional_params
28308 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28309 self
28310 }
28311
28312 /// Identifies the authorization scope for the method you are building.
28313 ///
28314 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28315 /// [`Scope::EditContainer`].
28316 ///
28317 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28318 /// tokens for more than one scope.
28319 ///
28320 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28321 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28322 /// sufficient, a read-write scope will do as well.
28323 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
28324 where
28325 St: AsRef<str>,
28326 {
28327 self._scopes.insert(String::from(scope.as_ref()));
28328 self
28329 }
28330 /// Identifies the authorization scope(s) for the method you are building.
28331 ///
28332 /// See [`Self::add_scope()`] for details.
28333 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneDeleteCall<'a, C>
28334 where
28335 I: IntoIterator<Item = St>,
28336 St: AsRef<str>,
28337 {
28338 self._scopes
28339 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28340 self
28341 }
28342
28343 /// Removes all scopes, and no default scope will be used either.
28344 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28345 /// for details).
28346 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneDeleteCall<'a, C> {
28347 self._scopes.clear();
28348 self
28349 }
28350}
28351
28352/// Gets a GTM Zone.
28353///
28354/// A builder for the *containers.workspaces.zones.get* method supported by a *account* resource.
28355/// It is not used directly, but through a [`AccountMethods`] instance.
28356///
28357/// # Example
28358///
28359/// Instantiate a resource method builder
28360///
28361/// ```test_harness,no_run
28362/// # extern crate hyper;
28363/// # extern crate hyper_rustls;
28364/// # extern crate google_tagmanager2 as tagmanager2;
28365/// # async fn dox() {
28366/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28367///
28368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28370/// # .with_native_roots()
28371/// # .unwrap()
28372/// # .https_only()
28373/// # .enable_http2()
28374/// # .build();
28375///
28376/// # let executor = hyper_util::rt::TokioExecutor::new();
28377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28378/// # secret,
28379/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28380/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28381/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28382/// # ),
28383/// # ).build().await.unwrap();
28384///
28385/// # let client = hyper_util::client::legacy::Client::builder(
28386/// # hyper_util::rt::TokioExecutor::new()
28387/// # )
28388/// # .build(
28389/// # hyper_rustls::HttpsConnectorBuilder::new()
28390/// # .with_native_roots()
28391/// # .unwrap()
28392/// # .https_or_http()
28393/// # .enable_http2()
28394/// # .build()
28395/// # );
28396/// # let mut hub = TagManager::new(client, auth);
28397/// // You can configure optional parameters by calling the respective setters at will, and
28398/// // execute the final call using `doit()`.
28399/// // Values shown here are possibly random and not representative !
28400/// let result = hub.accounts().containers_workspaces_zones_get("path")
28401/// .doit().await;
28402/// # }
28403/// ```
28404pub struct AccountContainerWorkspaceZoneGetCall<'a, C>
28405where
28406 C: 'a,
28407{
28408 hub: &'a TagManager<C>,
28409 _path: String,
28410 _delegate: Option<&'a mut dyn common::Delegate>,
28411 _additional_params: HashMap<String, String>,
28412 _scopes: BTreeSet<String>,
28413}
28414
28415impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneGetCall<'a, C> {}
28416
28417impl<'a, C> AccountContainerWorkspaceZoneGetCall<'a, C>
28418where
28419 C: common::Connector,
28420{
28421 /// Perform the operation you have build so far.
28422 pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
28423 use std::borrow::Cow;
28424 use std::io::{Read, Seek};
28425
28426 use common::{url::Params, ToParts};
28427 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28428
28429 let mut dd = common::DefaultDelegate;
28430 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28431 dlg.begin(common::MethodInfo {
28432 id: "tagmanager.accounts.containers.workspaces.zones.get",
28433 http_method: hyper::Method::GET,
28434 });
28435
28436 for &field in ["alt", "path"].iter() {
28437 if self._additional_params.contains_key(field) {
28438 dlg.finished(false);
28439 return Err(common::Error::FieldClash(field));
28440 }
28441 }
28442
28443 let mut params = Params::with_capacity(3 + self._additional_params.len());
28444 params.push("path", self._path);
28445
28446 params.extend(self._additional_params.iter());
28447
28448 params.push("alt", "json");
28449 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
28450 if self._scopes.is_empty() {
28451 self._scopes.insert(Scope::Readonly.as_ref().to_string());
28452 }
28453
28454 #[allow(clippy::single_element_loop)]
28455 for &(find_this, param_name) in [("{+path}", "path")].iter() {
28456 url = params.uri_replacement(url, param_name, find_this, true);
28457 }
28458 {
28459 let to_remove = ["path"];
28460 params.remove_params(&to_remove);
28461 }
28462
28463 let url = params.parse_with_url(&url);
28464
28465 loop {
28466 let token = match self
28467 .hub
28468 .auth
28469 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28470 .await
28471 {
28472 Ok(token) => token,
28473 Err(e) => match dlg.token(e) {
28474 Ok(token) => token,
28475 Err(e) => {
28476 dlg.finished(false);
28477 return Err(common::Error::MissingToken(e));
28478 }
28479 },
28480 };
28481 let mut req_result = {
28482 let client = &self.hub.client;
28483 dlg.pre_request();
28484 let mut req_builder = hyper::Request::builder()
28485 .method(hyper::Method::GET)
28486 .uri(url.as_str())
28487 .header(USER_AGENT, self.hub._user_agent.clone());
28488
28489 if let Some(token) = token.as_ref() {
28490 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28491 }
28492
28493 let request = req_builder
28494 .header(CONTENT_LENGTH, 0_u64)
28495 .body(common::to_body::<String>(None));
28496
28497 client.request(request.unwrap()).await
28498 };
28499
28500 match req_result {
28501 Err(err) => {
28502 if let common::Retry::After(d) = dlg.http_error(&err) {
28503 sleep(d).await;
28504 continue;
28505 }
28506 dlg.finished(false);
28507 return Err(common::Error::HttpError(err));
28508 }
28509 Ok(res) => {
28510 let (mut parts, body) = res.into_parts();
28511 let mut body = common::Body::new(body);
28512 if !parts.status.is_success() {
28513 let bytes = common::to_bytes(body).await.unwrap_or_default();
28514 let error = serde_json::from_str(&common::to_string(&bytes));
28515 let response = common::to_response(parts, bytes.into());
28516
28517 if let common::Retry::After(d) =
28518 dlg.http_failure(&response, error.as_ref().ok())
28519 {
28520 sleep(d).await;
28521 continue;
28522 }
28523
28524 dlg.finished(false);
28525
28526 return Err(match error {
28527 Ok(value) => common::Error::BadRequest(value),
28528 _ => common::Error::Failure(response),
28529 });
28530 }
28531 let response = {
28532 let bytes = common::to_bytes(body).await.unwrap_or_default();
28533 let encoded = common::to_string(&bytes);
28534 match serde_json::from_str(&encoded) {
28535 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28536 Err(error) => {
28537 dlg.response_json_decode_error(&encoded, &error);
28538 return Err(common::Error::JsonDecodeError(
28539 encoded.to_string(),
28540 error,
28541 ));
28542 }
28543 }
28544 };
28545
28546 dlg.finished(true);
28547 return Ok(response);
28548 }
28549 }
28550 }
28551 }
28552
28553 /// GTM Zone's API relative path.
28554 ///
28555 /// Sets the *path* path property to the given value.
28556 ///
28557 /// Even though the property as already been set when instantiating this call,
28558 /// we provide this method for API completeness.
28559 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
28560 self._path = new_value.to_string();
28561 self
28562 }
28563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28564 /// while executing the actual API request.
28565 ///
28566 /// ````text
28567 /// It should be used to handle progress information, and to implement a certain level of resilience.
28568 /// ````
28569 ///
28570 /// Sets the *delegate* property to the given value.
28571 pub fn delegate(
28572 mut self,
28573 new_value: &'a mut dyn common::Delegate,
28574 ) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
28575 self._delegate = Some(new_value);
28576 self
28577 }
28578
28579 /// Set any additional parameter of the query string used in the request.
28580 /// It should be used to set parameters which are not yet available through their own
28581 /// setters.
28582 ///
28583 /// Please note that this method must not be used to set any of the known parameters
28584 /// which have their own setter method. If done anyway, the request will fail.
28585 ///
28586 /// # Additional Parameters
28587 ///
28588 /// * *$.xgafv* (query-string) - V1 error format.
28589 /// * *access_token* (query-string) - OAuth access token.
28590 /// * *alt* (query-string) - Data format for response.
28591 /// * *callback* (query-string) - JSONP
28592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28593 /// * *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.
28594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28596 /// * *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.
28597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28599 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneGetCall<'a, C>
28600 where
28601 T: AsRef<str>,
28602 {
28603 self._additional_params
28604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28605 self
28606 }
28607
28608 /// Identifies the authorization scope for the method you are building.
28609 ///
28610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28611 /// [`Scope::Readonly`].
28612 ///
28613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28614 /// tokens for more than one scope.
28615 ///
28616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28618 /// sufficient, a read-write scope will do as well.
28619 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneGetCall<'a, C>
28620 where
28621 St: AsRef<str>,
28622 {
28623 self._scopes.insert(String::from(scope.as_ref()));
28624 self
28625 }
28626 /// Identifies the authorization scope(s) for the method you are building.
28627 ///
28628 /// See [`Self::add_scope()`] for details.
28629 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneGetCall<'a, C>
28630 where
28631 I: IntoIterator<Item = St>,
28632 St: AsRef<str>,
28633 {
28634 self._scopes
28635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28636 self
28637 }
28638
28639 /// Removes all scopes, and no default scope will be used either.
28640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28641 /// for details).
28642 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneGetCall<'a, C> {
28643 self._scopes.clear();
28644 self
28645 }
28646}
28647
28648/// Lists all GTM Zones of a GTM container workspace.
28649///
28650/// A builder for the *containers.workspaces.zones.list* method supported by a *account* resource.
28651/// It is not used directly, but through a [`AccountMethods`] instance.
28652///
28653/// # Example
28654///
28655/// Instantiate a resource method builder
28656///
28657/// ```test_harness,no_run
28658/// # extern crate hyper;
28659/// # extern crate hyper_rustls;
28660/// # extern crate google_tagmanager2 as tagmanager2;
28661/// # async fn dox() {
28662/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28663///
28664/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28665/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28666/// # .with_native_roots()
28667/// # .unwrap()
28668/// # .https_only()
28669/// # .enable_http2()
28670/// # .build();
28671///
28672/// # let executor = hyper_util::rt::TokioExecutor::new();
28673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28674/// # secret,
28675/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28676/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28677/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28678/// # ),
28679/// # ).build().await.unwrap();
28680///
28681/// # let client = hyper_util::client::legacy::Client::builder(
28682/// # hyper_util::rt::TokioExecutor::new()
28683/// # )
28684/// # .build(
28685/// # hyper_rustls::HttpsConnectorBuilder::new()
28686/// # .with_native_roots()
28687/// # .unwrap()
28688/// # .https_or_http()
28689/// # .enable_http2()
28690/// # .build()
28691/// # );
28692/// # let mut hub = TagManager::new(client, auth);
28693/// // You can configure optional parameters by calling the respective setters at will, and
28694/// // execute the final call using `doit()`.
28695/// // Values shown here are possibly random and not representative !
28696/// let result = hub.accounts().containers_workspaces_zones_list("parent")
28697/// .page_token("sea")
28698/// .doit().await;
28699/// # }
28700/// ```
28701pub struct AccountContainerWorkspaceZoneListCall<'a, C>
28702where
28703 C: 'a,
28704{
28705 hub: &'a TagManager<C>,
28706 _parent: String,
28707 _page_token: Option<String>,
28708 _delegate: Option<&'a mut dyn common::Delegate>,
28709 _additional_params: HashMap<String, String>,
28710 _scopes: BTreeSet<String>,
28711}
28712
28713impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneListCall<'a, C> {}
28714
28715impl<'a, C> AccountContainerWorkspaceZoneListCall<'a, C>
28716where
28717 C: common::Connector,
28718{
28719 /// Perform the operation you have build so far.
28720 pub async fn doit(mut self) -> common::Result<(common::Response, ListZonesResponse)> {
28721 use std::borrow::Cow;
28722 use std::io::{Read, Seek};
28723
28724 use common::{url::Params, ToParts};
28725 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28726
28727 let mut dd = common::DefaultDelegate;
28728 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28729 dlg.begin(common::MethodInfo {
28730 id: "tagmanager.accounts.containers.workspaces.zones.list",
28731 http_method: hyper::Method::GET,
28732 });
28733
28734 for &field in ["alt", "parent", "pageToken"].iter() {
28735 if self._additional_params.contains_key(field) {
28736 dlg.finished(false);
28737 return Err(common::Error::FieldClash(field));
28738 }
28739 }
28740
28741 let mut params = Params::with_capacity(4 + self._additional_params.len());
28742 params.push("parent", self._parent);
28743 if let Some(value) = self._page_token.as_ref() {
28744 params.push("pageToken", value);
28745 }
28746
28747 params.extend(self._additional_params.iter());
28748
28749 params.push("alt", "json");
28750 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/zones";
28751 if self._scopes.is_empty() {
28752 self._scopes.insert(Scope::Readonly.as_ref().to_string());
28753 }
28754
28755 #[allow(clippy::single_element_loop)]
28756 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
28757 url = params.uri_replacement(url, param_name, find_this, true);
28758 }
28759 {
28760 let to_remove = ["parent"];
28761 params.remove_params(&to_remove);
28762 }
28763
28764 let url = params.parse_with_url(&url);
28765
28766 loop {
28767 let token = match self
28768 .hub
28769 .auth
28770 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28771 .await
28772 {
28773 Ok(token) => token,
28774 Err(e) => match dlg.token(e) {
28775 Ok(token) => token,
28776 Err(e) => {
28777 dlg.finished(false);
28778 return Err(common::Error::MissingToken(e));
28779 }
28780 },
28781 };
28782 let mut req_result = {
28783 let client = &self.hub.client;
28784 dlg.pre_request();
28785 let mut req_builder = hyper::Request::builder()
28786 .method(hyper::Method::GET)
28787 .uri(url.as_str())
28788 .header(USER_AGENT, self.hub._user_agent.clone());
28789
28790 if let Some(token) = token.as_ref() {
28791 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28792 }
28793
28794 let request = req_builder
28795 .header(CONTENT_LENGTH, 0_u64)
28796 .body(common::to_body::<String>(None));
28797
28798 client.request(request.unwrap()).await
28799 };
28800
28801 match req_result {
28802 Err(err) => {
28803 if let common::Retry::After(d) = dlg.http_error(&err) {
28804 sleep(d).await;
28805 continue;
28806 }
28807 dlg.finished(false);
28808 return Err(common::Error::HttpError(err));
28809 }
28810 Ok(res) => {
28811 let (mut parts, body) = res.into_parts();
28812 let mut body = common::Body::new(body);
28813 if !parts.status.is_success() {
28814 let bytes = common::to_bytes(body).await.unwrap_or_default();
28815 let error = serde_json::from_str(&common::to_string(&bytes));
28816 let response = common::to_response(parts, bytes.into());
28817
28818 if let common::Retry::After(d) =
28819 dlg.http_failure(&response, error.as_ref().ok())
28820 {
28821 sleep(d).await;
28822 continue;
28823 }
28824
28825 dlg.finished(false);
28826
28827 return Err(match error {
28828 Ok(value) => common::Error::BadRequest(value),
28829 _ => common::Error::Failure(response),
28830 });
28831 }
28832 let response = {
28833 let bytes = common::to_bytes(body).await.unwrap_or_default();
28834 let encoded = common::to_string(&bytes);
28835 match serde_json::from_str(&encoded) {
28836 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28837 Err(error) => {
28838 dlg.response_json_decode_error(&encoded, &error);
28839 return Err(common::Error::JsonDecodeError(
28840 encoded.to_string(),
28841 error,
28842 ));
28843 }
28844 }
28845 };
28846
28847 dlg.finished(true);
28848 return Ok(response);
28849 }
28850 }
28851 }
28852 }
28853
28854 /// GTM Workspace's API relative path.
28855 ///
28856 /// Sets the *parent* path property to the given value.
28857 ///
28858 /// Even though the property as already been set when instantiating this call,
28859 /// we provide this method for API completeness.
28860 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C> {
28861 self._parent = new_value.to_string();
28862 self
28863 }
28864 /// Continuation token for fetching the next page of results.
28865 ///
28866 /// Sets the *page token* query property to the given value.
28867 pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C> {
28868 self._page_token = Some(new_value.to_string());
28869 self
28870 }
28871 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28872 /// while executing the actual API request.
28873 ///
28874 /// ````text
28875 /// It should be used to handle progress information, and to implement a certain level of resilience.
28876 /// ````
28877 ///
28878 /// Sets the *delegate* property to the given value.
28879 pub fn delegate(
28880 mut self,
28881 new_value: &'a mut dyn common::Delegate,
28882 ) -> AccountContainerWorkspaceZoneListCall<'a, C> {
28883 self._delegate = Some(new_value);
28884 self
28885 }
28886
28887 /// Set any additional parameter of the query string used in the request.
28888 /// It should be used to set parameters which are not yet available through their own
28889 /// setters.
28890 ///
28891 /// Please note that this method must not be used to set any of the known parameters
28892 /// which have their own setter method. If done anyway, the request will fail.
28893 ///
28894 /// # Additional Parameters
28895 ///
28896 /// * *$.xgafv* (query-string) - V1 error format.
28897 /// * *access_token* (query-string) - OAuth access token.
28898 /// * *alt* (query-string) - Data format for response.
28899 /// * *callback* (query-string) - JSONP
28900 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28901 /// * *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.
28902 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28903 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28904 /// * *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.
28905 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28906 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28907 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneListCall<'a, C>
28908 where
28909 T: AsRef<str>,
28910 {
28911 self._additional_params
28912 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28913 self
28914 }
28915
28916 /// Identifies the authorization scope for the method you are building.
28917 ///
28918 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28919 /// [`Scope::Readonly`].
28920 ///
28921 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28922 /// tokens for more than one scope.
28923 ///
28924 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28925 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28926 /// sufficient, a read-write scope will do as well.
28927 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneListCall<'a, C>
28928 where
28929 St: AsRef<str>,
28930 {
28931 self._scopes.insert(String::from(scope.as_ref()));
28932 self
28933 }
28934 /// Identifies the authorization scope(s) for the method you are building.
28935 ///
28936 /// See [`Self::add_scope()`] for details.
28937 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneListCall<'a, C>
28938 where
28939 I: IntoIterator<Item = St>,
28940 St: AsRef<str>,
28941 {
28942 self._scopes
28943 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28944 self
28945 }
28946
28947 /// Removes all scopes, and no default scope will be used either.
28948 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28949 /// for details).
28950 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneListCall<'a, C> {
28951 self._scopes.clear();
28952 self
28953 }
28954}
28955
28956/// Reverts changes to a GTM Zone in a GTM Workspace.
28957///
28958/// A builder for the *containers.workspaces.zones.revert* method supported by a *account* resource.
28959/// It is not used directly, but through a [`AccountMethods`] instance.
28960///
28961/// # Example
28962///
28963/// Instantiate a resource method builder
28964///
28965/// ```test_harness,no_run
28966/// # extern crate hyper;
28967/// # extern crate hyper_rustls;
28968/// # extern crate google_tagmanager2 as tagmanager2;
28969/// # async fn dox() {
28970/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28971///
28972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28973/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28974/// # .with_native_roots()
28975/// # .unwrap()
28976/// # .https_only()
28977/// # .enable_http2()
28978/// # .build();
28979///
28980/// # let executor = hyper_util::rt::TokioExecutor::new();
28981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28982/// # secret,
28983/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28984/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28985/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28986/// # ),
28987/// # ).build().await.unwrap();
28988///
28989/// # let client = hyper_util::client::legacy::Client::builder(
28990/// # hyper_util::rt::TokioExecutor::new()
28991/// # )
28992/// # .build(
28993/// # hyper_rustls::HttpsConnectorBuilder::new()
28994/// # .with_native_roots()
28995/// # .unwrap()
28996/// # .https_or_http()
28997/// # .enable_http2()
28998/// # .build()
28999/// # );
29000/// # let mut hub = TagManager::new(client, auth);
29001/// // You can configure optional parameters by calling the respective setters at will, and
29002/// // execute the final call using `doit()`.
29003/// // Values shown here are possibly random and not representative !
29004/// let result = hub.accounts().containers_workspaces_zones_revert("path")
29005/// .fingerprint("At")
29006/// .doit().await;
29007/// # }
29008/// ```
29009pub struct AccountContainerWorkspaceZoneRevertCall<'a, C>
29010where
29011 C: 'a,
29012{
29013 hub: &'a TagManager<C>,
29014 _path: String,
29015 _fingerprint: Option<String>,
29016 _delegate: Option<&'a mut dyn common::Delegate>,
29017 _additional_params: HashMap<String, String>,
29018 _scopes: BTreeSet<String>,
29019}
29020
29021impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneRevertCall<'a, C> {}
29022
29023impl<'a, C> AccountContainerWorkspaceZoneRevertCall<'a, C>
29024where
29025 C: common::Connector,
29026{
29027 /// Perform the operation you have build so far.
29028 pub async fn doit(mut self) -> common::Result<(common::Response, RevertZoneResponse)> {
29029 use std::borrow::Cow;
29030 use std::io::{Read, Seek};
29031
29032 use common::{url::Params, ToParts};
29033 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29034
29035 let mut dd = common::DefaultDelegate;
29036 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29037 dlg.begin(common::MethodInfo {
29038 id: "tagmanager.accounts.containers.workspaces.zones.revert",
29039 http_method: hyper::Method::POST,
29040 });
29041
29042 for &field in ["alt", "path", "fingerprint"].iter() {
29043 if self._additional_params.contains_key(field) {
29044 dlg.finished(false);
29045 return Err(common::Error::FieldClash(field));
29046 }
29047 }
29048
29049 let mut params = Params::with_capacity(4 + self._additional_params.len());
29050 params.push("path", self._path);
29051 if let Some(value) = self._fingerprint.as_ref() {
29052 params.push("fingerprint", value);
29053 }
29054
29055 params.extend(self._additional_params.iter());
29056
29057 params.push("alt", "json");
29058 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:revert";
29059 if self._scopes.is_empty() {
29060 self._scopes
29061 .insert(Scope::EditContainer.as_ref().to_string());
29062 }
29063
29064 #[allow(clippy::single_element_loop)]
29065 for &(find_this, param_name) in [("{+path}", "path")].iter() {
29066 url = params.uri_replacement(url, param_name, find_this, true);
29067 }
29068 {
29069 let to_remove = ["path"];
29070 params.remove_params(&to_remove);
29071 }
29072
29073 let url = params.parse_with_url(&url);
29074
29075 loop {
29076 let token = match self
29077 .hub
29078 .auth
29079 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29080 .await
29081 {
29082 Ok(token) => token,
29083 Err(e) => match dlg.token(e) {
29084 Ok(token) => token,
29085 Err(e) => {
29086 dlg.finished(false);
29087 return Err(common::Error::MissingToken(e));
29088 }
29089 },
29090 };
29091 let mut req_result = {
29092 let client = &self.hub.client;
29093 dlg.pre_request();
29094 let mut req_builder = hyper::Request::builder()
29095 .method(hyper::Method::POST)
29096 .uri(url.as_str())
29097 .header(USER_AGENT, self.hub._user_agent.clone());
29098
29099 if let Some(token) = token.as_ref() {
29100 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29101 }
29102
29103 let request = req_builder
29104 .header(CONTENT_LENGTH, 0_u64)
29105 .body(common::to_body::<String>(None));
29106
29107 client.request(request.unwrap()).await
29108 };
29109
29110 match req_result {
29111 Err(err) => {
29112 if let common::Retry::After(d) = dlg.http_error(&err) {
29113 sleep(d).await;
29114 continue;
29115 }
29116 dlg.finished(false);
29117 return Err(common::Error::HttpError(err));
29118 }
29119 Ok(res) => {
29120 let (mut parts, body) = res.into_parts();
29121 let mut body = common::Body::new(body);
29122 if !parts.status.is_success() {
29123 let bytes = common::to_bytes(body).await.unwrap_or_default();
29124 let error = serde_json::from_str(&common::to_string(&bytes));
29125 let response = common::to_response(parts, bytes.into());
29126
29127 if let common::Retry::After(d) =
29128 dlg.http_failure(&response, error.as_ref().ok())
29129 {
29130 sleep(d).await;
29131 continue;
29132 }
29133
29134 dlg.finished(false);
29135
29136 return Err(match error {
29137 Ok(value) => common::Error::BadRequest(value),
29138 _ => common::Error::Failure(response),
29139 });
29140 }
29141 let response = {
29142 let bytes = common::to_bytes(body).await.unwrap_or_default();
29143 let encoded = common::to_string(&bytes);
29144 match serde_json::from_str(&encoded) {
29145 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29146 Err(error) => {
29147 dlg.response_json_decode_error(&encoded, &error);
29148 return Err(common::Error::JsonDecodeError(
29149 encoded.to_string(),
29150 error,
29151 ));
29152 }
29153 }
29154 };
29155
29156 dlg.finished(true);
29157 return Ok(response);
29158 }
29159 }
29160 }
29161 }
29162
29163 /// GTM Zone's API relative path.
29164 ///
29165 /// Sets the *path* path property to the given value.
29166 ///
29167 /// Even though the property as already been set when instantiating this call,
29168 /// we provide this method for API completeness.
29169 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
29170 self._path = new_value.to_string();
29171 self
29172 }
29173 /// When provided, this fingerprint must match the fingerprint of the zone in storage.
29174 ///
29175 /// Sets the *fingerprint* query property to the given value.
29176 pub fn fingerprint(
29177 mut self,
29178 new_value: &str,
29179 ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
29180 self._fingerprint = Some(new_value.to_string());
29181 self
29182 }
29183 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29184 /// while executing the actual API request.
29185 ///
29186 /// ````text
29187 /// It should be used to handle progress information, and to implement a certain level of resilience.
29188 /// ````
29189 ///
29190 /// Sets the *delegate* property to the given value.
29191 pub fn delegate(
29192 mut self,
29193 new_value: &'a mut dyn common::Delegate,
29194 ) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
29195 self._delegate = Some(new_value);
29196 self
29197 }
29198
29199 /// Set any additional parameter of the query string used in the request.
29200 /// It should be used to set parameters which are not yet available through their own
29201 /// setters.
29202 ///
29203 /// Please note that this method must not be used to set any of the known parameters
29204 /// which have their own setter method. If done anyway, the request will fail.
29205 ///
29206 /// # Additional Parameters
29207 ///
29208 /// * *$.xgafv* (query-string) - V1 error format.
29209 /// * *access_token* (query-string) - OAuth access token.
29210 /// * *alt* (query-string) - Data format for response.
29211 /// * *callback* (query-string) - JSONP
29212 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29213 /// * *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.
29214 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29215 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29216 /// * *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.
29217 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29218 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29219 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
29220 where
29221 T: AsRef<str>,
29222 {
29223 self._additional_params
29224 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29225 self
29226 }
29227
29228 /// Identifies the authorization scope for the method you are building.
29229 ///
29230 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29231 /// [`Scope::EditContainer`].
29232 ///
29233 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29234 /// tokens for more than one scope.
29235 ///
29236 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29237 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29238 /// sufficient, a read-write scope will do as well.
29239 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
29240 where
29241 St: AsRef<str>,
29242 {
29243 self._scopes.insert(String::from(scope.as_ref()));
29244 self
29245 }
29246 /// Identifies the authorization scope(s) for the method you are building.
29247 ///
29248 /// See [`Self::add_scope()`] for details.
29249 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneRevertCall<'a, C>
29250 where
29251 I: IntoIterator<Item = St>,
29252 St: AsRef<str>,
29253 {
29254 self._scopes
29255 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29256 self
29257 }
29258
29259 /// Removes all scopes, and no default scope will be used either.
29260 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29261 /// for details).
29262 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneRevertCall<'a, C> {
29263 self._scopes.clear();
29264 self
29265 }
29266}
29267
29268/// Updates a GTM Zone.
29269///
29270/// A builder for the *containers.workspaces.zones.update* method supported by a *account* resource.
29271/// It is not used directly, but through a [`AccountMethods`] instance.
29272///
29273/// # Example
29274///
29275/// Instantiate a resource method builder
29276///
29277/// ```test_harness,no_run
29278/// # extern crate hyper;
29279/// # extern crate hyper_rustls;
29280/// # extern crate google_tagmanager2 as tagmanager2;
29281/// use tagmanager2::api::Zone;
29282/// # async fn dox() {
29283/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29284///
29285/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29286/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29287/// # .with_native_roots()
29288/// # .unwrap()
29289/// # .https_only()
29290/// # .enable_http2()
29291/// # .build();
29292///
29293/// # let executor = hyper_util::rt::TokioExecutor::new();
29294/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29295/// # secret,
29296/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29297/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29298/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29299/// # ),
29300/// # ).build().await.unwrap();
29301///
29302/// # let client = hyper_util::client::legacy::Client::builder(
29303/// # hyper_util::rt::TokioExecutor::new()
29304/// # )
29305/// # .build(
29306/// # hyper_rustls::HttpsConnectorBuilder::new()
29307/// # .with_native_roots()
29308/// # .unwrap()
29309/// # .https_or_http()
29310/// # .enable_http2()
29311/// # .build()
29312/// # );
29313/// # let mut hub = TagManager::new(client, auth);
29314/// // As the method needs a request, you would usually fill it with the desired information
29315/// // into the respective structure. Some of the parts shown here might not be applicable !
29316/// // Values shown here are possibly random and not representative !
29317/// let mut req = Zone::default();
29318///
29319/// // You can configure optional parameters by calling the respective setters at will, and
29320/// // execute the final call using `doit()`.
29321/// // Values shown here are possibly random and not representative !
29322/// let result = hub.accounts().containers_workspaces_zones_update(req, "path")
29323/// .fingerprint("eirmod")
29324/// .doit().await;
29325/// # }
29326/// ```
29327pub struct AccountContainerWorkspaceZoneUpdateCall<'a, C>
29328where
29329 C: 'a,
29330{
29331 hub: &'a TagManager<C>,
29332 _request: Zone,
29333 _path: String,
29334 _fingerprint: Option<String>,
29335 _delegate: Option<&'a mut dyn common::Delegate>,
29336 _additional_params: HashMap<String, String>,
29337 _scopes: BTreeSet<String>,
29338}
29339
29340impl<'a, C> common::CallBuilder for AccountContainerWorkspaceZoneUpdateCall<'a, C> {}
29341
29342impl<'a, C> AccountContainerWorkspaceZoneUpdateCall<'a, C>
29343where
29344 C: common::Connector,
29345{
29346 /// Perform the operation you have build so far.
29347 pub async fn doit(mut self) -> common::Result<(common::Response, Zone)> {
29348 use std::borrow::Cow;
29349 use std::io::{Read, Seek};
29350
29351 use common::{url::Params, ToParts};
29352 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29353
29354 let mut dd = common::DefaultDelegate;
29355 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29356 dlg.begin(common::MethodInfo {
29357 id: "tagmanager.accounts.containers.workspaces.zones.update",
29358 http_method: hyper::Method::PUT,
29359 });
29360
29361 for &field in ["alt", "path", "fingerprint"].iter() {
29362 if self._additional_params.contains_key(field) {
29363 dlg.finished(false);
29364 return Err(common::Error::FieldClash(field));
29365 }
29366 }
29367
29368 let mut params = Params::with_capacity(5 + self._additional_params.len());
29369 params.push("path", self._path);
29370 if let Some(value) = self._fingerprint.as_ref() {
29371 params.push("fingerprint", value);
29372 }
29373
29374 params.extend(self._additional_params.iter());
29375
29376 params.push("alt", "json");
29377 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
29378 if self._scopes.is_empty() {
29379 self._scopes
29380 .insert(Scope::EditContainer.as_ref().to_string());
29381 }
29382
29383 #[allow(clippy::single_element_loop)]
29384 for &(find_this, param_name) in [("{+path}", "path")].iter() {
29385 url = params.uri_replacement(url, param_name, find_this, true);
29386 }
29387 {
29388 let to_remove = ["path"];
29389 params.remove_params(&to_remove);
29390 }
29391
29392 let url = params.parse_with_url(&url);
29393
29394 let mut json_mime_type = mime::APPLICATION_JSON;
29395 let mut request_value_reader = {
29396 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29397 common::remove_json_null_values(&mut value);
29398 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29399 serde_json::to_writer(&mut dst, &value).unwrap();
29400 dst
29401 };
29402 let request_size = request_value_reader
29403 .seek(std::io::SeekFrom::End(0))
29404 .unwrap();
29405 request_value_reader
29406 .seek(std::io::SeekFrom::Start(0))
29407 .unwrap();
29408
29409 loop {
29410 let token = match self
29411 .hub
29412 .auth
29413 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29414 .await
29415 {
29416 Ok(token) => token,
29417 Err(e) => match dlg.token(e) {
29418 Ok(token) => token,
29419 Err(e) => {
29420 dlg.finished(false);
29421 return Err(common::Error::MissingToken(e));
29422 }
29423 },
29424 };
29425 request_value_reader
29426 .seek(std::io::SeekFrom::Start(0))
29427 .unwrap();
29428 let mut req_result = {
29429 let client = &self.hub.client;
29430 dlg.pre_request();
29431 let mut req_builder = hyper::Request::builder()
29432 .method(hyper::Method::PUT)
29433 .uri(url.as_str())
29434 .header(USER_AGENT, self.hub._user_agent.clone());
29435
29436 if let Some(token) = token.as_ref() {
29437 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29438 }
29439
29440 let request = req_builder
29441 .header(CONTENT_TYPE, json_mime_type.to_string())
29442 .header(CONTENT_LENGTH, request_size as u64)
29443 .body(common::to_body(
29444 request_value_reader.get_ref().clone().into(),
29445 ));
29446
29447 client.request(request.unwrap()).await
29448 };
29449
29450 match req_result {
29451 Err(err) => {
29452 if let common::Retry::After(d) = dlg.http_error(&err) {
29453 sleep(d).await;
29454 continue;
29455 }
29456 dlg.finished(false);
29457 return Err(common::Error::HttpError(err));
29458 }
29459 Ok(res) => {
29460 let (mut parts, body) = res.into_parts();
29461 let mut body = common::Body::new(body);
29462 if !parts.status.is_success() {
29463 let bytes = common::to_bytes(body).await.unwrap_or_default();
29464 let error = serde_json::from_str(&common::to_string(&bytes));
29465 let response = common::to_response(parts, bytes.into());
29466
29467 if let common::Retry::After(d) =
29468 dlg.http_failure(&response, error.as_ref().ok())
29469 {
29470 sleep(d).await;
29471 continue;
29472 }
29473
29474 dlg.finished(false);
29475
29476 return Err(match error {
29477 Ok(value) => common::Error::BadRequest(value),
29478 _ => common::Error::Failure(response),
29479 });
29480 }
29481 let response = {
29482 let bytes = common::to_bytes(body).await.unwrap_or_default();
29483 let encoded = common::to_string(&bytes);
29484 match serde_json::from_str(&encoded) {
29485 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29486 Err(error) => {
29487 dlg.response_json_decode_error(&encoded, &error);
29488 return Err(common::Error::JsonDecodeError(
29489 encoded.to_string(),
29490 error,
29491 ));
29492 }
29493 }
29494 };
29495
29496 dlg.finished(true);
29497 return Ok(response);
29498 }
29499 }
29500 }
29501 }
29502
29503 ///
29504 /// Sets the *request* property to the given value.
29505 ///
29506 /// Even though the property as already been set when instantiating this call,
29507 /// we provide this method for API completeness.
29508 pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
29509 self._request = new_value;
29510 self
29511 }
29512 /// GTM Zone's API relative path.
29513 ///
29514 /// Sets the *path* path property to the given value.
29515 ///
29516 /// Even though the property as already been set when instantiating this call,
29517 /// we provide this method for API completeness.
29518 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
29519 self._path = new_value.to_string();
29520 self
29521 }
29522 /// When provided, this fingerprint must match the fingerprint of the zone in storage.
29523 ///
29524 /// Sets the *fingerprint* query property to the given value.
29525 pub fn fingerprint(
29526 mut self,
29527 new_value: &str,
29528 ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
29529 self._fingerprint = Some(new_value.to_string());
29530 self
29531 }
29532 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29533 /// while executing the actual API request.
29534 ///
29535 /// ````text
29536 /// It should be used to handle progress information, and to implement a certain level of resilience.
29537 /// ````
29538 ///
29539 /// Sets the *delegate* property to the given value.
29540 pub fn delegate(
29541 mut self,
29542 new_value: &'a mut dyn common::Delegate,
29543 ) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
29544 self._delegate = Some(new_value);
29545 self
29546 }
29547
29548 /// Set any additional parameter of the query string used in the request.
29549 /// It should be used to set parameters which are not yet available through their own
29550 /// setters.
29551 ///
29552 /// Please note that this method must not be used to set any of the known parameters
29553 /// which have their own setter method. If done anyway, the request will fail.
29554 ///
29555 /// # Additional Parameters
29556 ///
29557 /// * *$.xgafv* (query-string) - V1 error format.
29558 /// * *access_token* (query-string) - OAuth access token.
29559 /// * *alt* (query-string) - Data format for response.
29560 /// * *callback* (query-string) - JSONP
29561 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29562 /// * *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.
29563 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29564 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29565 /// * *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.
29566 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29567 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29568 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
29569 where
29570 T: AsRef<str>,
29571 {
29572 self._additional_params
29573 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29574 self
29575 }
29576
29577 /// Identifies the authorization scope for the method you are building.
29578 ///
29579 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29580 /// [`Scope::EditContainer`].
29581 ///
29582 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29583 /// tokens for more than one scope.
29584 ///
29585 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29586 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29587 /// sufficient, a read-write scope will do as well.
29588 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
29589 where
29590 St: AsRef<str>,
29591 {
29592 self._scopes.insert(String::from(scope.as_ref()));
29593 self
29594 }
29595 /// Identifies the authorization scope(s) for the method you are building.
29596 ///
29597 /// See [`Self::add_scope()`] for details.
29598 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceZoneUpdateCall<'a, C>
29599 where
29600 I: IntoIterator<Item = St>,
29601 St: AsRef<str>,
29602 {
29603 self._scopes
29604 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29605 self
29606 }
29607
29608 /// Removes all scopes, and no default scope will be used either.
29609 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29610 /// for details).
29611 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceZoneUpdateCall<'a, C> {
29612 self._scopes.clear();
29613 self
29614 }
29615}
29616
29617/// Applies multiple entity changes to a workspace in one call. When creating new entities, their entity IDs must be unique and in correct format. That is, they must start with "new_" and followed by number, e.g. "new_1", "new_2". Example body snippet to create myNewTag under myNewFolder is: ``` "changes": [ { "folder": { "folderId": "new_1", "name": "myNewFolder", ... }, "changeStatus": "added" }, { "tag": { "tagId": "new_2", "name": "myNewTag", "parentFolderId": "new_1", ... }, "changeStatus": "added" } ] ```
29618///
29619/// A builder for the *containers.workspaces.bulk_update* method supported by a *account* resource.
29620/// It is not used directly, but through a [`AccountMethods`] instance.
29621///
29622/// # Example
29623///
29624/// Instantiate a resource method builder
29625///
29626/// ```test_harness,no_run
29627/// # extern crate hyper;
29628/// # extern crate hyper_rustls;
29629/// # extern crate google_tagmanager2 as tagmanager2;
29630/// use tagmanager2::api::ProposedChange;
29631/// # async fn dox() {
29632/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29633///
29634/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29635/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29636/// # .with_native_roots()
29637/// # .unwrap()
29638/// # .https_only()
29639/// # .enable_http2()
29640/// # .build();
29641///
29642/// # let executor = hyper_util::rt::TokioExecutor::new();
29643/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29644/// # secret,
29645/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29646/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29647/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29648/// # ),
29649/// # ).build().await.unwrap();
29650///
29651/// # let client = hyper_util::client::legacy::Client::builder(
29652/// # hyper_util::rt::TokioExecutor::new()
29653/// # )
29654/// # .build(
29655/// # hyper_rustls::HttpsConnectorBuilder::new()
29656/// # .with_native_roots()
29657/// # .unwrap()
29658/// # .https_or_http()
29659/// # .enable_http2()
29660/// # .build()
29661/// # );
29662/// # let mut hub = TagManager::new(client, auth);
29663/// // As the method needs a request, you would usually fill it with the desired information
29664/// // into the respective structure. Some of the parts shown here might not be applicable !
29665/// // Values shown here are possibly random and not representative !
29666/// let mut req = ProposedChange::default();
29667///
29668/// // You can configure optional parameters by calling the respective setters at will, and
29669/// // execute the final call using `doit()`.
29670/// // Values shown here are possibly random and not representative !
29671/// let result = hub.accounts().containers_workspaces_bulk_update(req, "path")
29672/// .doit().await;
29673/// # }
29674/// ```
29675pub struct AccountContainerWorkspaceBulkUpdateCall<'a, C>
29676where
29677 C: 'a,
29678{
29679 hub: &'a TagManager<C>,
29680 _request: ProposedChange,
29681 _path: String,
29682 _delegate: Option<&'a mut dyn common::Delegate>,
29683 _additional_params: HashMap<String, String>,
29684 _scopes: BTreeSet<String>,
29685}
29686
29687impl<'a, C> common::CallBuilder for AccountContainerWorkspaceBulkUpdateCall<'a, C> {}
29688
29689impl<'a, C> AccountContainerWorkspaceBulkUpdateCall<'a, C>
29690where
29691 C: common::Connector,
29692{
29693 /// Perform the operation you have build so far.
29694 pub async fn doit(mut self) -> common::Result<(common::Response, BulkUpdateWorkspaceResponse)> {
29695 use std::borrow::Cow;
29696 use std::io::{Read, Seek};
29697
29698 use common::{url::Params, ToParts};
29699 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29700
29701 let mut dd = common::DefaultDelegate;
29702 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29703 dlg.begin(common::MethodInfo {
29704 id: "tagmanager.accounts.containers.workspaces.bulk_update",
29705 http_method: hyper::Method::POST,
29706 });
29707
29708 for &field in ["alt", "path"].iter() {
29709 if self._additional_params.contains_key(field) {
29710 dlg.finished(false);
29711 return Err(common::Error::FieldClash(field));
29712 }
29713 }
29714
29715 let mut params = Params::with_capacity(4 + self._additional_params.len());
29716 params.push("path", self._path);
29717
29718 params.extend(self._additional_params.iter());
29719
29720 params.push("alt", "json");
29721 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}/bulk_update";
29722 if self._scopes.is_empty() {
29723 self._scopes
29724 .insert(Scope::EditContainer.as_ref().to_string());
29725 }
29726
29727 #[allow(clippy::single_element_loop)]
29728 for &(find_this, param_name) in [("{+path}", "path")].iter() {
29729 url = params.uri_replacement(url, param_name, find_this, true);
29730 }
29731 {
29732 let to_remove = ["path"];
29733 params.remove_params(&to_remove);
29734 }
29735
29736 let url = params.parse_with_url(&url);
29737
29738 let mut json_mime_type = mime::APPLICATION_JSON;
29739 let mut request_value_reader = {
29740 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29741 common::remove_json_null_values(&mut value);
29742 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29743 serde_json::to_writer(&mut dst, &value).unwrap();
29744 dst
29745 };
29746 let request_size = request_value_reader
29747 .seek(std::io::SeekFrom::End(0))
29748 .unwrap();
29749 request_value_reader
29750 .seek(std::io::SeekFrom::Start(0))
29751 .unwrap();
29752
29753 loop {
29754 let token = match self
29755 .hub
29756 .auth
29757 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29758 .await
29759 {
29760 Ok(token) => token,
29761 Err(e) => match dlg.token(e) {
29762 Ok(token) => token,
29763 Err(e) => {
29764 dlg.finished(false);
29765 return Err(common::Error::MissingToken(e));
29766 }
29767 },
29768 };
29769 request_value_reader
29770 .seek(std::io::SeekFrom::Start(0))
29771 .unwrap();
29772 let mut req_result = {
29773 let client = &self.hub.client;
29774 dlg.pre_request();
29775 let mut req_builder = hyper::Request::builder()
29776 .method(hyper::Method::POST)
29777 .uri(url.as_str())
29778 .header(USER_AGENT, self.hub._user_agent.clone());
29779
29780 if let Some(token) = token.as_ref() {
29781 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29782 }
29783
29784 let request = req_builder
29785 .header(CONTENT_TYPE, json_mime_type.to_string())
29786 .header(CONTENT_LENGTH, request_size as u64)
29787 .body(common::to_body(
29788 request_value_reader.get_ref().clone().into(),
29789 ));
29790
29791 client.request(request.unwrap()).await
29792 };
29793
29794 match req_result {
29795 Err(err) => {
29796 if let common::Retry::After(d) = dlg.http_error(&err) {
29797 sleep(d).await;
29798 continue;
29799 }
29800 dlg.finished(false);
29801 return Err(common::Error::HttpError(err));
29802 }
29803 Ok(res) => {
29804 let (mut parts, body) = res.into_parts();
29805 let mut body = common::Body::new(body);
29806 if !parts.status.is_success() {
29807 let bytes = common::to_bytes(body).await.unwrap_or_default();
29808 let error = serde_json::from_str(&common::to_string(&bytes));
29809 let response = common::to_response(parts, bytes.into());
29810
29811 if let common::Retry::After(d) =
29812 dlg.http_failure(&response, error.as_ref().ok())
29813 {
29814 sleep(d).await;
29815 continue;
29816 }
29817
29818 dlg.finished(false);
29819
29820 return Err(match error {
29821 Ok(value) => common::Error::BadRequest(value),
29822 _ => common::Error::Failure(response),
29823 });
29824 }
29825 let response = {
29826 let bytes = common::to_bytes(body).await.unwrap_or_default();
29827 let encoded = common::to_string(&bytes);
29828 match serde_json::from_str(&encoded) {
29829 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29830 Err(error) => {
29831 dlg.response_json_decode_error(&encoded, &error);
29832 return Err(common::Error::JsonDecodeError(
29833 encoded.to_string(),
29834 error,
29835 ));
29836 }
29837 }
29838 };
29839
29840 dlg.finished(true);
29841 return Ok(response);
29842 }
29843 }
29844 }
29845 }
29846
29847 ///
29848 /// Sets the *request* property to the given value.
29849 ///
29850 /// Even though the property as already been set when instantiating this call,
29851 /// we provide this method for API completeness.
29852 pub fn request(
29853 mut self,
29854 new_value: ProposedChange,
29855 ) -> AccountContainerWorkspaceBulkUpdateCall<'a, C> {
29856 self._request = new_value;
29857 self
29858 }
29859 /// GTM Workspace's API relative path.
29860 ///
29861 /// Sets the *path* path property to the given value.
29862 ///
29863 /// Even though the property as already been set when instantiating this call,
29864 /// we provide this method for API completeness.
29865 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceBulkUpdateCall<'a, C> {
29866 self._path = new_value.to_string();
29867 self
29868 }
29869 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29870 /// while executing the actual API request.
29871 ///
29872 /// ````text
29873 /// It should be used to handle progress information, and to implement a certain level of resilience.
29874 /// ````
29875 ///
29876 /// Sets the *delegate* property to the given value.
29877 pub fn delegate(
29878 mut self,
29879 new_value: &'a mut dyn common::Delegate,
29880 ) -> AccountContainerWorkspaceBulkUpdateCall<'a, C> {
29881 self._delegate = Some(new_value);
29882 self
29883 }
29884
29885 /// Set any additional parameter of the query string used in the request.
29886 /// It should be used to set parameters which are not yet available through their own
29887 /// setters.
29888 ///
29889 /// Please note that this method must not be used to set any of the known parameters
29890 /// which have their own setter method. If done anyway, the request will fail.
29891 ///
29892 /// # Additional Parameters
29893 ///
29894 /// * *$.xgafv* (query-string) - V1 error format.
29895 /// * *access_token* (query-string) - OAuth access token.
29896 /// * *alt* (query-string) - Data format for response.
29897 /// * *callback* (query-string) - JSONP
29898 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29899 /// * *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.
29900 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29901 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29902 /// * *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.
29903 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29904 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29905 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceBulkUpdateCall<'a, C>
29906 where
29907 T: AsRef<str>,
29908 {
29909 self._additional_params
29910 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29911 self
29912 }
29913
29914 /// Identifies the authorization scope for the method you are building.
29915 ///
29916 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29917 /// [`Scope::EditContainer`].
29918 ///
29919 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29920 /// tokens for more than one scope.
29921 ///
29922 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29923 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29924 /// sufficient, a read-write scope will do as well.
29925 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceBulkUpdateCall<'a, C>
29926 where
29927 St: AsRef<str>,
29928 {
29929 self._scopes.insert(String::from(scope.as_ref()));
29930 self
29931 }
29932 /// Identifies the authorization scope(s) for the method you are building.
29933 ///
29934 /// See [`Self::add_scope()`] for details.
29935 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceBulkUpdateCall<'a, C>
29936 where
29937 I: IntoIterator<Item = St>,
29938 St: AsRef<str>,
29939 {
29940 self._scopes
29941 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29942 self
29943 }
29944
29945 /// Removes all scopes, and no default scope will be used either.
29946 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29947 /// for details).
29948 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceBulkUpdateCall<'a, C> {
29949 self._scopes.clear();
29950 self
29951 }
29952}
29953
29954/// Creates a Workspace.
29955///
29956/// A builder for the *containers.workspaces.create* method supported by a *account* resource.
29957/// It is not used directly, but through a [`AccountMethods`] instance.
29958///
29959/// # Example
29960///
29961/// Instantiate a resource method builder
29962///
29963/// ```test_harness,no_run
29964/// # extern crate hyper;
29965/// # extern crate hyper_rustls;
29966/// # extern crate google_tagmanager2 as tagmanager2;
29967/// use tagmanager2::api::Workspace;
29968/// # async fn dox() {
29969/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29970///
29971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29973/// # .with_native_roots()
29974/// # .unwrap()
29975/// # .https_only()
29976/// # .enable_http2()
29977/// # .build();
29978///
29979/// # let executor = hyper_util::rt::TokioExecutor::new();
29980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29981/// # secret,
29982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29983/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29984/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29985/// # ),
29986/// # ).build().await.unwrap();
29987///
29988/// # let client = hyper_util::client::legacy::Client::builder(
29989/// # hyper_util::rt::TokioExecutor::new()
29990/// # )
29991/// # .build(
29992/// # hyper_rustls::HttpsConnectorBuilder::new()
29993/// # .with_native_roots()
29994/// # .unwrap()
29995/// # .https_or_http()
29996/// # .enable_http2()
29997/// # .build()
29998/// # );
29999/// # let mut hub = TagManager::new(client, auth);
30000/// // As the method needs a request, you would usually fill it with the desired information
30001/// // into the respective structure. Some of the parts shown here might not be applicable !
30002/// // Values shown here are possibly random and not representative !
30003/// let mut req = Workspace::default();
30004///
30005/// // You can configure optional parameters by calling the respective setters at will, and
30006/// // execute the final call using `doit()`.
30007/// // Values shown here are possibly random and not representative !
30008/// let result = hub.accounts().containers_workspaces_create(req, "parent")
30009/// .doit().await;
30010/// # }
30011/// ```
30012pub struct AccountContainerWorkspaceCreateCall<'a, C>
30013where
30014 C: 'a,
30015{
30016 hub: &'a TagManager<C>,
30017 _request: Workspace,
30018 _parent: String,
30019 _delegate: Option<&'a mut dyn common::Delegate>,
30020 _additional_params: HashMap<String, String>,
30021 _scopes: BTreeSet<String>,
30022}
30023
30024impl<'a, C> common::CallBuilder for AccountContainerWorkspaceCreateCall<'a, C> {}
30025
30026impl<'a, C> AccountContainerWorkspaceCreateCall<'a, C>
30027where
30028 C: common::Connector,
30029{
30030 /// Perform the operation you have build so far.
30031 pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
30032 use std::borrow::Cow;
30033 use std::io::{Read, Seek};
30034
30035 use common::{url::Params, ToParts};
30036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30037
30038 let mut dd = common::DefaultDelegate;
30039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30040 dlg.begin(common::MethodInfo {
30041 id: "tagmanager.accounts.containers.workspaces.create",
30042 http_method: hyper::Method::POST,
30043 });
30044
30045 for &field in ["alt", "parent"].iter() {
30046 if self._additional_params.contains_key(field) {
30047 dlg.finished(false);
30048 return Err(common::Error::FieldClash(field));
30049 }
30050 }
30051
30052 let mut params = Params::with_capacity(4 + self._additional_params.len());
30053 params.push("parent", self._parent);
30054
30055 params.extend(self._additional_params.iter());
30056
30057 params.push("alt", "json");
30058 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/workspaces";
30059 if self._scopes.is_empty() {
30060 self._scopes
30061 .insert(Scope::EditContainer.as_ref().to_string());
30062 }
30063
30064 #[allow(clippy::single_element_loop)]
30065 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
30066 url = params.uri_replacement(url, param_name, find_this, true);
30067 }
30068 {
30069 let to_remove = ["parent"];
30070 params.remove_params(&to_remove);
30071 }
30072
30073 let url = params.parse_with_url(&url);
30074
30075 let mut json_mime_type = mime::APPLICATION_JSON;
30076 let mut request_value_reader = {
30077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30078 common::remove_json_null_values(&mut value);
30079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30080 serde_json::to_writer(&mut dst, &value).unwrap();
30081 dst
30082 };
30083 let request_size = request_value_reader
30084 .seek(std::io::SeekFrom::End(0))
30085 .unwrap();
30086 request_value_reader
30087 .seek(std::io::SeekFrom::Start(0))
30088 .unwrap();
30089
30090 loop {
30091 let token = match self
30092 .hub
30093 .auth
30094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30095 .await
30096 {
30097 Ok(token) => token,
30098 Err(e) => match dlg.token(e) {
30099 Ok(token) => token,
30100 Err(e) => {
30101 dlg.finished(false);
30102 return Err(common::Error::MissingToken(e));
30103 }
30104 },
30105 };
30106 request_value_reader
30107 .seek(std::io::SeekFrom::Start(0))
30108 .unwrap();
30109 let mut req_result = {
30110 let client = &self.hub.client;
30111 dlg.pre_request();
30112 let mut req_builder = hyper::Request::builder()
30113 .method(hyper::Method::POST)
30114 .uri(url.as_str())
30115 .header(USER_AGENT, self.hub._user_agent.clone());
30116
30117 if let Some(token) = token.as_ref() {
30118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30119 }
30120
30121 let request = req_builder
30122 .header(CONTENT_TYPE, json_mime_type.to_string())
30123 .header(CONTENT_LENGTH, request_size as u64)
30124 .body(common::to_body(
30125 request_value_reader.get_ref().clone().into(),
30126 ));
30127
30128 client.request(request.unwrap()).await
30129 };
30130
30131 match req_result {
30132 Err(err) => {
30133 if let common::Retry::After(d) = dlg.http_error(&err) {
30134 sleep(d).await;
30135 continue;
30136 }
30137 dlg.finished(false);
30138 return Err(common::Error::HttpError(err));
30139 }
30140 Ok(res) => {
30141 let (mut parts, body) = res.into_parts();
30142 let mut body = common::Body::new(body);
30143 if !parts.status.is_success() {
30144 let bytes = common::to_bytes(body).await.unwrap_or_default();
30145 let error = serde_json::from_str(&common::to_string(&bytes));
30146 let response = common::to_response(parts, bytes.into());
30147
30148 if let common::Retry::After(d) =
30149 dlg.http_failure(&response, error.as_ref().ok())
30150 {
30151 sleep(d).await;
30152 continue;
30153 }
30154
30155 dlg.finished(false);
30156
30157 return Err(match error {
30158 Ok(value) => common::Error::BadRequest(value),
30159 _ => common::Error::Failure(response),
30160 });
30161 }
30162 let response = {
30163 let bytes = common::to_bytes(body).await.unwrap_or_default();
30164 let encoded = common::to_string(&bytes);
30165 match serde_json::from_str(&encoded) {
30166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30167 Err(error) => {
30168 dlg.response_json_decode_error(&encoded, &error);
30169 return Err(common::Error::JsonDecodeError(
30170 encoded.to_string(),
30171 error,
30172 ));
30173 }
30174 }
30175 };
30176
30177 dlg.finished(true);
30178 return Ok(response);
30179 }
30180 }
30181 }
30182 }
30183
30184 ///
30185 /// Sets the *request* property to the given value.
30186 ///
30187 /// Even though the property as already been set when instantiating this call,
30188 /// we provide this method for API completeness.
30189 pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceCreateCall<'a, C> {
30190 self._request = new_value;
30191 self
30192 }
30193 /// GTM parent Container's API relative path.
30194 ///
30195 /// Sets the *parent* path property to the given value.
30196 ///
30197 /// Even though the property as already been set when instantiating this call,
30198 /// we provide this method for API completeness.
30199 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceCreateCall<'a, C> {
30200 self._parent = new_value.to_string();
30201 self
30202 }
30203 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30204 /// while executing the actual API request.
30205 ///
30206 /// ````text
30207 /// It should be used to handle progress information, and to implement a certain level of resilience.
30208 /// ````
30209 ///
30210 /// Sets the *delegate* property to the given value.
30211 pub fn delegate(
30212 mut self,
30213 new_value: &'a mut dyn common::Delegate,
30214 ) -> AccountContainerWorkspaceCreateCall<'a, C> {
30215 self._delegate = Some(new_value);
30216 self
30217 }
30218
30219 /// Set any additional parameter of the query string used in the request.
30220 /// It should be used to set parameters which are not yet available through their own
30221 /// setters.
30222 ///
30223 /// Please note that this method must not be used to set any of the known parameters
30224 /// which have their own setter method. If done anyway, the request will fail.
30225 ///
30226 /// # Additional Parameters
30227 ///
30228 /// * *$.xgafv* (query-string) - V1 error format.
30229 /// * *access_token* (query-string) - OAuth access token.
30230 /// * *alt* (query-string) - Data format for response.
30231 /// * *callback* (query-string) - JSONP
30232 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30233 /// * *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.
30234 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30235 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30236 /// * *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.
30237 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30238 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30239 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceCreateCall<'a, C>
30240 where
30241 T: AsRef<str>,
30242 {
30243 self._additional_params
30244 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30245 self
30246 }
30247
30248 /// Identifies the authorization scope for the method you are building.
30249 ///
30250 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30251 /// [`Scope::EditContainer`].
30252 ///
30253 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30254 /// tokens for more than one scope.
30255 ///
30256 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30257 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30258 /// sufficient, a read-write scope will do as well.
30259 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceCreateCall<'a, C>
30260 where
30261 St: AsRef<str>,
30262 {
30263 self._scopes.insert(String::from(scope.as_ref()));
30264 self
30265 }
30266 /// Identifies the authorization scope(s) for the method you are building.
30267 ///
30268 /// See [`Self::add_scope()`] for details.
30269 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceCreateCall<'a, C>
30270 where
30271 I: IntoIterator<Item = St>,
30272 St: AsRef<str>,
30273 {
30274 self._scopes
30275 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30276 self
30277 }
30278
30279 /// Removes all scopes, and no default scope will be used either.
30280 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30281 /// for details).
30282 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceCreateCall<'a, C> {
30283 self._scopes.clear();
30284 self
30285 }
30286}
30287
30288/// 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.
30289///
30290/// A builder for the *containers.workspaces.create_version* method supported by a *account* resource.
30291/// It is not used directly, but through a [`AccountMethods`] instance.
30292///
30293/// # Example
30294///
30295/// Instantiate a resource method builder
30296///
30297/// ```test_harness,no_run
30298/// # extern crate hyper;
30299/// # extern crate hyper_rustls;
30300/// # extern crate google_tagmanager2 as tagmanager2;
30301/// use tagmanager2::api::CreateContainerVersionRequestVersionOptions;
30302/// # async fn dox() {
30303/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30304///
30305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30306/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30307/// # .with_native_roots()
30308/// # .unwrap()
30309/// # .https_only()
30310/// # .enable_http2()
30311/// # .build();
30312///
30313/// # let executor = hyper_util::rt::TokioExecutor::new();
30314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30315/// # secret,
30316/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30317/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30318/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30319/// # ),
30320/// # ).build().await.unwrap();
30321///
30322/// # let client = hyper_util::client::legacy::Client::builder(
30323/// # hyper_util::rt::TokioExecutor::new()
30324/// # )
30325/// # .build(
30326/// # hyper_rustls::HttpsConnectorBuilder::new()
30327/// # .with_native_roots()
30328/// # .unwrap()
30329/// # .https_or_http()
30330/// # .enable_http2()
30331/// # .build()
30332/// # );
30333/// # let mut hub = TagManager::new(client, auth);
30334/// // As the method needs a request, you would usually fill it with the desired information
30335/// // into the respective structure. Some of the parts shown here might not be applicable !
30336/// // Values shown here are possibly random and not representative !
30337/// let mut req = CreateContainerVersionRequestVersionOptions::default();
30338///
30339/// // You can configure optional parameters by calling the respective setters at will, and
30340/// // execute the final call using `doit()`.
30341/// // Values shown here are possibly random and not representative !
30342/// let result = hub.accounts().containers_workspaces_create_version(req, "path")
30343/// .doit().await;
30344/// # }
30345/// ```
30346pub struct AccountContainerWorkspaceCreateVersionCall<'a, C>
30347where
30348 C: 'a,
30349{
30350 hub: &'a TagManager<C>,
30351 _request: CreateContainerVersionRequestVersionOptions,
30352 _path: String,
30353 _delegate: Option<&'a mut dyn common::Delegate>,
30354 _additional_params: HashMap<String, String>,
30355 _scopes: BTreeSet<String>,
30356}
30357
30358impl<'a, C> common::CallBuilder for AccountContainerWorkspaceCreateVersionCall<'a, C> {}
30359
30360impl<'a, C> AccountContainerWorkspaceCreateVersionCall<'a, C>
30361where
30362 C: common::Connector,
30363{
30364 /// Perform the operation you have build so far.
30365 pub async fn doit(
30366 mut self,
30367 ) -> common::Result<(common::Response, CreateContainerVersionResponse)> {
30368 use std::borrow::Cow;
30369 use std::io::{Read, Seek};
30370
30371 use common::{url::Params, ToParts};
30372 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30373
30374 let mut dd = common::DefaultDelegate;
30375 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30376 dlg.begin(common::MethodInfo {
30377 id: "tagmanager.accounts.containers.workspaces.create_version",
30378 http_method: hyper::Method::POST,
30379 });
30380
30381 for &field in ["alt", "path"].iter() {
30382 if self._additional_params.contains_key(field) {
30383 dlg.finished(false);
30384 return Err(common::Error::FieldClash(field));
30385 }
30386 }
30387
30388 let mut params = Params::with_capacity(4 + self._additional_params.len());
30389 params.push("path", self._path);
30390
30391 params.extend(self._additional_params.iter());
30392
30393 params.push("alt", "json");
30394 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:create_version";
30395 if self._scopes.is_empty() {
30396 self._scopes
30397 .insert(Scope::EditContainerversion.as_ref().to_string());
30398 }
30399
30400 #[allow(clippy::single_element_loop)]
30401 for &(find_this, param_name) in [("{+path}", "path")].iter() {
30402 url = params.uri_replacement(url, param_name, find_this, true);
30403 }
30404 {
30405 let to_remove = ["path"];
30406 params.remove_params(&to_remove);
30407 }
30408
30409 let url = params.parse_with_url(&url);
30410
30411 let mut json_mime_type = mime::APPLICATION_JSON;
30412 let mut request_value_reader = {
30413 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30414 common::remove_json_null_values(&mut value);
30415 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30416 serde_json::to_writer(&mut dst, &value).unwrap();
30417 dst
30418 };
30419 let request_size = request_value_reader
30420 .seek(std::io::SeekFrom::End(0))
30421 .unwrap();
30422 request_value_reader
30423 .seek(std::io::SeekFrom::Start(0))
30424 .unwrap();
30425
30426 loop {
30427 let token = match self
30428 .hub
30429 .auth
30430 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30431 .await
30432 {
30433 Ok(token) => token,
30434 Err(e) => match dlg.token(e) {
30435 Ok(token) => token,
30436 Err(e) => {
30437 dlg.finished(false);
30438 return Err(common::Error::MissingToken(e));
30439 }
30440 },
30441 };
30442 request_value_reader
30443 .seek(std::io::SeekFrom::Start(0))
30444 .unwrap();
30445 let mut req_result = {
30446 let client = &self.hub.client;
30447 dlg.pre_request();
30448 let mut req_builder = hyper::Request::builder()
30449 .method(hyper::Method::POST)
30450 .uri(url.as_str())
30451 .header(USER_AGENT, self.hub._user_agent.clone());
30452
30453 if let Some(token) = token.as_ref() {
30454 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30455 }
30456
30457 let request = req_builder
30458 .header(CONTENT_TYPE, json_mime_type.to_string())
30459 .header(CONTENT_LENGTH, request_size as u64)
30460 .body(common::to_body(
30461 request_value_reader.get_ref().clone().into(),
30462 ));
30463
30464 client.request(request.unwrap()).await
30465 };
30466
30467 match req_result {
30468 Err(err) => {
30469 if let common::Retry::After(d) = dlg.http_error(&err) {
30470 sleep(d).await;
30471 continue;
30472 }
30473 dlg.finished(false);
30474 return Err(common::Error::HttpError(err));
30475 }
30476 Ok(res) => {
30477 let (mut parts, body) = res.into_parts();
30478 let mut body = common::Body::new(body);
30479 if !parts.status.is_success() {
30480 let bytes = common::to_bytes(body).await.unwrap_or_default();
30481 let error = serde_json::from_str(&common::to_string(&bytes));
30482 let response = common::to_response(parts, bytes.into());
30483
30484 if let common::Retry::After(d) =
30485 dlg.http_failure(&response, error.as_ref().ok())
30486 {
30487 sleep(d).await;
30488 continue;
30489 }
30490
30491 dlg.finished(false);
30492
30493 return Err(match error {
30494 Ok(value) => common::Error::BadRequest(value),
30495 _ => common::Error::Failure(response),
30496 });
30497 }
30498 let response = {
30499 let bytes = common::to_bytes(body).await.unwrap_or_default();
30500 let encoded = common::to_string(&bytes);
30501 match serde_json::from_str(&encoded) {
30502 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30503 Err(error) => {
30504 dlg.response_json_decode_error(&encoded, &error);
30505 return Err(common::Error::JsonDecodeError(
30506 encoded.to_string(),
30507 error,
30508 ));
30509 }
30510 }
30511 };
30512
30513 dlg.finished(true);
30514 return Ok(response);
30515 }
30516 }
30517 }
30518 }
30519
30520 ///
30521 /// Sets the *request* property to the given value.
30522 ///
30523 /// Even though the property as already been set when instantiating this call,
30524 /// we provide this method for API completeness.
30525 pub fn request(
30526 mut self,
30527 new_value: CreateContainerVersionRequestVersionOptions,
30528 ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
30529 self._request = new_value;
30530 self
30531 }
30532 /// GTM Workspace's API relative path.
30533 ///
30534 /// Sets the *path* path property to the given value.
30535 ///
30536 /// Even though the property as already been set when instantiating this call,
30537 /// we provide this method for API completeness.
30538 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
30539 self._path = new_value.to_string();
30540 self
30541 }
30542 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30543 /// while executing the actual API request.
30544 ///
30545 /// ````text
30546 /// It should be used to handle progress information, and to implement a certain level of resilience.
30547 /// ````
30548 ///
30549 /// Sets the *delegate* property to the given value.
30550 pub fn delegate(
30551 mut self,
30552 new_value: &'a mut dyn common::Delegate,
30553 ) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
30554 self._delegate = Some(new_value);
30555 self
30556 }
30557
30558 /// Set any additional parameter of the query string used in the request.
30559 /// It should be used to set parameters which are not yet available through their own
30560 /// setters.
30561 ///
30562 /// Please note that this method must not be used to set any of the known parameters
30563 /// which have their own setter method. If done anyway, the request will fail.
30564 ///
30565 /// # Additional Parameters
30566 ///
30567 /// * *$.xgafv* (query-string) - V1 error format.
30568 /// * *access_token* (query-string) - OAuth access token.
30569 /// * *alt* (query-string) - Data format for response.
30570 /// * *callback* (query-string) - JSONP
30571 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30572 /// * *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.
30573 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30574 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30575 /// * *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.
30576 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30577 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30578 pub fn param<T>(
30579 mut self,
30580 name: T,
30581 value: T,
30582 ) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
30583 where
30584 T: AsRef<str>,
30585 {
30586 self._additional_params
30587 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30588 self
30589 }
30590
30591 /// Identifies the authorization scope for the method you are building.
30592 ///
30593 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30594 /// [`Scope::EditContainerversion`].
30595 ///
30596 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30597 /// tokens for more than one scope.
30598 ///
30599 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30600 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30601 /// sufficient, a read-write scope will do as well.
30602 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
30603 where
30604 St: AsRef<str>,
30605 {
30606 self._scopes.insert(String::from(scope.as_ref()));
30607 self
30608 }
30609 /// Identifies the authorization scope(s) for the method you are building.
30610 ///
30611 /// See [`Self::add_scope()`] for details.
30612 pub fn add_scopes<I, St>(
30613 mut self,
30614 scopes: I,
30615 ) -> AccountContainerWorkspaceCreateVersionCall<'a, C>
30616 where
30617 I: IntoIterator<Item = St>,
30618 St: AsRef<str>,
30619 {
30620 self._scopes
30621 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30622 self
30623 }
30624
30625 /// Removes all scopes, and no default scope will be used either.
30626 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30627 /// for details).
30628 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceCreateVersionCall<'a, C> {
30629 self._scopes.clear();
30630 self
30631 }
30632}
30633
30634/// Deletes a Workspace.
30635///
30636/// A builder for the *containers.workspaces.delete* method supported by a *account* resource.
30637/// It is not used directly, but through a [`AccountMethods`] instance.
30638///
30639/// # Example
30640///
30641/// Instantiate a resource method builder
30642///
30643/// ```test_harness,no_run
30644/// # extern crate hyper;
30645/// # extern crate hyper_rustls;
30646/// # extern crate google_tagmanager2 as tagmanager2;
30647/// # async fn dox() {
30648/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30649///
30650/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30651/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30652/// # .with_native_roots()
30653/// # .unwrap()
30654/// # .https_only()
30655/// # .enable_http2()
30656/// # .build();
30657///
30658/// # let executor = hyper_util::rt::TokioExecutor::new();
30659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30660/// # secret,
30661/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30662/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30663/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30664/// # ),
30665/// # ).build().await.unwrap();
30666///
30667/// # let client = hyper_util::client::legacy::Client::builder(
30668/// # hyper_util::rt::TokioExecutor::new()
30669/// # )
30670/// # .build(
30671/// # hyper_rustls::HttpsConnectorBuilder::new()
30672/// # .with_native_roots()
30673/// # .unwrap()
30674/// # .https_or_http()
30675/// # .enable_http2()
30676/// # .build()
30677/// # );
30678/// # let mut hub = TagManager::new(client, auth);
30679/// // You can configure optional parameters by calling the respective setters at will, and
30680/// // execute the final call using `doit()`.
30681/// // Values shown here are possibly random and not representative !
30682/// let result = hub.accounts().containers_workspaces_delete("path")
30683/// .doit().await;
30684/// # }
30685/// ```
30686pub struct AccountContainerWorkspaceDeleteCall<'a, C>
30687where
30688 C: 'a,
30689{
30690 hub: &'a TagManager<C>,
30691 _path: String,
30692 _delegate: Option<&'a mut dyn common::Delegate>,
30693 _additional_params: HashMap<String, String>,
30694 _scopes: BTreeSet<String>,
30695}
30696
30697impl<'a, C> common::CallBuilder for AccountContainerWorkspaceDeleteCall<'a, C> {}
30698
30699impl<'a, C> AccountContainerWorkspaceDeleteCall<'a, C>
30700where
30701 C: common::Connector,
30702{
30703 /// Perform the operation you have build so far.
30704 pub async fn doit(mut self) -> common::Result<common::Response> {
30705 use std::borrow::Cow;
30706 use std::io::{Read, Seek};
30707
30708 use common::{url::Params, ToParts};
30709 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30710
30711 let mut dd = common::DefaultDelegate;
30712 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30713 dlg.begin(common::MethodInfo {
30714 id: "tagmanager.accounts.containers.workspaces.delete",
30715 http_method: hyper::Method::DELETE,
30716 });
30717
30718 for &field in ["path"].iter() {
30719 if self._additional_params.contains_key(field) {
30720 dlg.finished(false);
30721 return Err(common::Error::FieldClash(field));
30722 }
30723 }
30724
30725 let mut params = Params::with_capacity(2 + self._additional_params.len());
30726 params.push("path", self._path);
30727
30728 params.extend(self._additional_params.iter());
30729
30730 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
30731 if self._scopes.is_empty() {
30732 self._scopes
30733 .insert(Scope::DeleteContainer.as_ref().to_string());
30734 }
30735
30736 #[allow(clippy::single_element_loop)]
30737 for &(find_this, param_name) in [("{+path}", "path")].iter() {
30738 url = params.uri_replacement(url, param_name, find_this, true);
30739 }
30740 {
30741 let to_remove = ["path"];
30742 params.remove_params(&to_remove);
30743 }
30744
30745 let url = params.parse_with_url(&url);
30746
30747 loop {
30748 let token = match self
30749 .hub
30750 .auth
30751 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30752 .await
30753 {
30754 Ok(token) => token,
30755 Err(e) => match dlg.token(e) {
30756 Ok(token) => token,
30757 Err(e) => {
30758 dlg.finished(false);
30759 return Err(common::Error::MissingToken(e));
30760 }
30761 },
30762 };
30763 let mut req_result = {
30764 let client = &self.hub.client;
30765 dlg.pre_request();
30766 let mut req_builder = hyper::Request::builder()
30767 .method(hyper::Method::DELETE)
30768 .uri(url.as_str())
30769 .header(USER_AGENT, self.hub._user_agent.clone());
30770
30771 if let Some(token) = token.as_ref() {
30772 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30773 }
30774
30775 let request = req_builder
30776 .header(CONTENT_LENGTH, 0_u64)
30777 .body(common::to_body::<String>(None));
30778
30779 client.request(request.unwrap()).await
30780 };
30781
30782 match req_result {
30783 Err(err) => {
30784 if let common::Retry::After(d) = dlg.http_error(&err) {
30785 sleep(d).await;
30786 continue;
30787 }
30788 dlg.finished(false);
30789 return Err(common::Error::HttpError(err));
30790 }
30791 Ok(res) => {
30792 let (mut parts, body) = res.into_parts();
30793 let mut body = common::Body::new(body);
30794 if !parts.status.is_success() {
30795 let bytes = common::to_bytes(body).await.unwrap_or_default();
30796 let error = serde_json::from_str(&common::to_string(&bytes));
30797 let response = common::to_response(parts, bytes.into());
30798
30799 if let common::Retry::After(d) =
30800 dlg.http_failure(&response, error.as_ref().ok())
30801 {
30802 sleep(d).await;
30803 continue;
30804 }
30805
30806 dlg.finished(false);
30807
30808 return Err(match error {
30809 Ok(value) => common::Error::BadRequest(value),
30810 _ => common::Error::Failure(response),
30811 });
30812 }
30813 let response = common::Response::from_parts(parts, body);
30814
30815 dlg.finished(true);
30816 return Ok(response);
30817 }
30818 }
30819 }
30820 }
30821
30822 /// GTM Workspace's API relative path.
30823 ///
30824 /// Sets the *path* path property to the given value.
30825 ///
30826 /// Even though the property as already been set when instantiating this call,
30827 /// we provide this method for API completeness.
30828 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceDeleteCall<'a, C> {
30829 self._path = new_value.to_string();
30830 self
30831 }
30832 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30833 /// while executing the actual API request.
30834 ///
30835 /// ````text
30836 /// It should be used to handle progress information, and to implement a certain level of resilience.
30837 /// ````
30838 ///
30839 /// Sets the *delegate* property to the given value.
30840 pub fn delegate(
30841 mut self,
30842 new_value: &'a mut dyn common::Delegate,
30843 ) -> AccountContainerWorkspaceDeleteCall<'a, C> {
30844 self._delegate = Some(new_value);
30845 self
30846 }
30847
30848 /// Set any additional parameter of the query string used in the request.
30849 /// It should be used to set parameters which are not yet available through their own
30850 /// setters.
30851 ///
30852 /// Please note that this method must not be used to set any of the known parameters
30853 /// which have their own setter method. If done anyway, the request will fail.
30854 ///
30855 /// # Additional Parameters
30856 ///
30857 /// * *$.xgafv* (query-string) - V1 error format.
30858 /// * *access_token* (query-string) - OAuth access token.
30859 /// * *alt* (query-string) - Data format for response.
30860 /// * *callback* (query-string) - JSONP
30861 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30862 /// * *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.
30863 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30864 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30865 /// * *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.
30866 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30868 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceDeleteCall<'a, C>
30869 where
30870 T: AsRef<str>,
30871 {
30872 self._additional_params
30873 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30874 self
30875 }
30876
30877 /// Identifies the authorization scope for the method you are building.
30878 ///
30879 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30880 /// [`Scope::DeleteContainer`].
30881 ///
30882 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30883 /// tokens for more than one scope.
30884 ///
30885 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30886 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30887 /// sufficient, a read-write scope will do as well.
30888 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceDeleteCall<'a, C>
30889 where
30890 St: AsRef<str>,
30891 {
30892 self._scopes.insert(String::from(scope.as_ref()));
30893 self
30894 }
30895 /// Identifies the authorization scope(s) for the method you are building.
30896 ///
30897 /// See [`Self::add_scope()`] for details.
30898 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceDeleteCall<'a, C>
30899 where
30900 I: IntoIterator<Item = St>,
30901 St: AsRef<str>,
30902 {
30903 self._scopes
30904 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30905 self
30906 }
30907
30908 /// Removes all scopes, and no default scope will be used either.
30909 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30910 /// for details).
30911 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceDeleteCall<'a, C> {
30912 self._scopes.clear();
30913 self
30914 }
30915}
30916
30917/// Gets a Workspace.
30918///
30919/// A builder for the *containers.workspaces.get* method supported by a *account* resource.
30920/// It is not used directly, but through a [`AccountMethods`] instance.
30921///
30922/// # Example
30923///
30924/// Instantiate a resource method builder
30925///
30926/// ```test_harness,no_run
30927/// # extern crate hyper;
30928/// # extern crate hyper_rustls;
30929/// # extern crate google_tagmanager2 as tagmanager2;
30930/// # async fn dox() {
30931/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30932///
30933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30934/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30935/// # .with_native_roots()
30936/// # .unwrap()
30937/// # .https_only()
30938/// # .enable_http2()
30939/// # .build();
30940///
30941/// # let executor = hyper_util::rt::TokioExecutor::new();
30942/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30943/// # secret,
30944/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30945/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30946/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30947/// # ),
30948/// # ).build().await.unwrap();
30949///
30950/// # let client = hyper_util::client::legacy::Client::builder(
30951/// # hyper_util::rt::TokioExecutor::new()
30952/// # )
30953/// # .build(
30954/// # hyper_rustls::HttpsConnectorBuilder::new()
30955/// # .with_native_roots()
30956/// # .unwrap()
30957/// # .https_or_http()
30958/// # .enable_http2()
30959/// # .build()
30960/// # );
30961/// # let mut hub = TagManager::new(client, auth);
30962/// // You can configure optional parameters by calling the respective setters at will, and
30963/// // execute the final call using `doit()`.
30964/// // Values shown here are possibly random and not representative !
30965/// let result = hub.accounts().containers_workspaces_get("path")
30966/// .doit().await;
30967/// # }
30968/// ```
30969pub struct AccountContainerWorkspaceGetCall<'a, C>
30970where
30971 C: 'a,
30972{
30973 hub: &'a TagManager<C>,
30974 _path: String,
30975 _delegate: Option<&'a mut dyn common::Delegate>,
30976 _additional_params: HashMap<String, String>,
30977 _scopes: BTreeSet<String>,
30978}
30979
30980impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGetCall<'a, C> {}
30981
30982impl<'a, C> AccountContainerWorkspaceGetCall<'a, C>
30983where
30984 C: common::Connector,
30985{
30986 /// Perform the operation you have build so far.
30987 pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
30988 use std::borrow::Cow;
30989 use std::io::{Read, Seek};
30990
30991 use common::{url::Params, ToParts};
30992 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30993
30994 let mut dd = common::DefaultDelegate;
30995 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30996 dlg.begin(common::MethodInfo {
30997 id: "tagmanager.accounts.containers.workspaces.get",
30998 http_method: hyper::Method::GET,
30999 });
31000
31001 for &field in ["alt", "path"].iter() {
31002 if self._additional_params.contains_key(field) {
31003 dlg.finished(false);
31004 return Err(common::Error::FieldClash(field));
31005 }
31006 }
31007
31008 let mut params = Params::with_capacity(3 + self._additional_params.len());
31009 params.push("path", self._path);
31010
31011 params.extend(self._additional_params.iter());
31012
31013 params.push("alt", "json");
31014 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
31015 if self._scopes.is_empty() {
31016 self._scopes.insert(Scope::Readonly.as_ref().to_string());
31017 }
31018
31019 #[allow(clippy::single_element_loop)]
31020 for &(find_this, param_name) in [("{+path}", "path")].iter() {
31021 url = params.uri_replacement(url, param_name, find_this, true);
31022 }
31023 {
31024 let to_remove = ["path"];
31025 params.remove_params(&to_remove);
31026 }
31027
31028 let url = params.parse_with_url(&url);
31029
31030 loop {
31031 let token = match self
31032 .hub
31033 .auth
31034 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31035 .await
31036 {
31037 Ok(token) => token,
31038 Err(e) => match dlg.token(e) {
31039 Ok(token) => token,
31040 Err(e) => {
31041 dlg.finished(false);
31042 return Err(common::Error::MissingToken(e));
31043 }
31044 },
31045 };
31046 let mut req_result = {
31047 let client = &self.hub.client;
31048 dlg.pre_request();
31049 let mut req_builder = hyper::Request::builder()
31050 .method(hyper::Method::GET)
31051 .uri(url.as_str())
31052 .header(USER_AGENT, self.hub._user_agent.clone());
31053
31054 if let Some(token) = token.as_ref() {
31055 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31056 }
31057
31058 let request = req_builder
31059 .header(CONTENT_LENGTH, 0_u64)
31060 .body(common::to_body::<String>(None));
31061
31062 client.request(request.unwrap()).await
31063 };
31064
31065 match req_result {
31066 Err(err) => {
31067 if let common::Retry::After(d) = dlg.http_error(&err) {
31068 sleep(d).await;
31069 continue;
31070 }
31071 dlg.finished(false);
31072 return Err(common::Error::HttpError(err));
31073 }
31074 Ok(res) => {
31075 let (mut parts, body) = res.into_parts();
31076 let mut body = common::Body::new(body);
31077 if !parts.status.is_success() {
31078 let bytes = common::to_bytes(body).await.unwrap_or_default();
31079 let error = serde_json::from_str(&common::to_string(&bytes));
31080 let response = common::to_response(parts, bytes.into());
31081
31082 if let common::Retry::After(d) =
31083 dlg.http_failure(&response, error.as_ref().ok())
31084 {
31085 sleep(d).await;
31086 continue;
31087 }
31088
31089 dlg.finished(false);
31090
31091 return Err(match error {
31092 Ok(value) => common::Error::BadRequest(value),
31093 _ => common::Error::Failure(response),
31094 });
31095 }
31096 let response = {
31097 let bytes = common::to_bytes(body).await.unwrap_or_default();
31098 let encoded = common::to_string(&bytes);
31099 match serde_json::from_str(&encoded) {
31100 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31101 Err(error) => {
31102 dlg.response_json_decode_error(&encoded, &error);
31103 return Err(common::Error::JsonDecodeError(
31104 encoded.to_string(),
31105 error,
31106 ));
31107 }
31108 }
31109 };
31110
31111 dlg.finished(true);
31112 return Ok(response);
31113 }
31114 }
31115 }
31116 }
31117
31118 /// GTM Workspace's API relative path.
31119 ///
31120 /// Sets the *path* path property to the given value.
31121 ///
31122 /// Even though the property as already been set when instantiating this call,
31123 /// we provide this method for API completeness.
31124 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetCall<'a, C> {
31125 self._path = new_value.to_string();
31126 self
31127 }
31128 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31129 /// while executing the actual API request.
31130 ///
31131 /// ````text
31132 /// It should be used to handle progress information, and to implement a certain level of resilience.
31133 /// ````
31134 ///
31135 /// Sets the *delegate* property to the given value.
31136 pub fn delegate(
31137 mut self,
31138 new_value: &'a mut dyn common::Delegate,
31139 ) -> AccountContainerWorkspaceGetCall<'a, C> {
31140 self._delegate = Some(new_value);
31141 self
31142 }
31143
31144 /// Set any additional parameter of the query string used in the request.
31145 /// It should be used to set parameters which are not yet available through their own
31146 /// setters.
31147 ///
31148 /// Please note that this method must not be used to set any of the known parameters
31149 /// which have their own setter method. If done anyway, the request will fail.
31150 ///
31151 /// # Additional Parameters
31152 ///
31153 /// * *$.xgafv* (query-string) - V1 error format.
31154 /// * *access_token* (query-string) - OAuth access token.
31155 /// * *alt* (query-string) - Data format for response.
31156 /// * *callback* (query-string) - JSONP
31157 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31158 /// * *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.
31159 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31160 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31161 /// * *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.
31162 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31163 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31164 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceGetCall<'a, C>
31165 where
31166 T: AsRef<str>,
31167 {
31168 self._additional_params
31169 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31170 self
31171 }
31172
31173 /// Identifies the authorization scope for the method you are building.
31174 ///
31175 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31176 /// [`Scope::Readonly`].
31177 ///
31178 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31179 /// tokens for more than one scope.
31180 ///
31181 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31182 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31183 /// sufficient, a read-write scope will do as well.
31184 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGetCall<'a, C>
31185 where
31186 St: AsRef<str>,
31187 {
31188 self._scopes.insert(String::from(scope.as_ref()));
31189 self
31190 }
31191 /// Identifies the authorization scope(s) for the method you are building.
31192 ///
31193 /// See [`Self::add_scope()`] for details.
31194 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceGetCall<'a, C>
31195 where
31196 I: IntoIterator<Item = St>,
31197 St: AsRef<str>,
31198 {
31199 self._scopes
31200 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31201 self
31202 }
31203
31204 /// Removes all scopes, and no default scope will be used either.
31205 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31206 /// for details).
31207 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGetCall<'a, C> {
31208 self._scopes.clear();
31209 self
31210 }
31211}
31212
31213/// Finds conflicting and modified entities in the workspace.
31214///
31215/// A builder for the *containers.workspaces.getStatus* method supported by a *account* resource.
31216/// It is not used directly, but through a [`AccountMethods`] instance.
31217///
31218/// # Example
31219///
31220/// Instantiate a resource method builder
31221///
31222/// ```test_harness,no_run
31223/// # extern crate hyper;
31224/// # extern crate hyper_rustls;
31225/// # extern crate google_tagmanager2 as tagmanager2;
31226/// # async fn dox() {
31227/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31228///
31229/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31230/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31231/// # .with_native_roots()
31232/// # .unwrap()
31233/// # .https_only()
31234/// # .enable_http2()
31235/// # .build();
31236///
31237/// # let executor = hyper_util::rt::TokioExecutor::new();
31238/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31239/// # secret,
31240/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31241/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31242/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31243/// # ),
31244/// # ).build().await.unwrap();
31245///
31246/// # let client = hyper_util::client::legacy::Client::builder(
31247/// # hyper_util::rt::TokioExecutor::new()
31248/// # )
31249/// # .build(
31250/// # hyper_rustls::HttpsConnectorBuilder::new()
31251/// # .with_native_roots()
31252/// # .unwrap()
31253/// # .https_or_http()
31254/// # .enable_http2()
31255/// # .build()
31256/// # );
31257/// # let mut hub = TagManager::new(client, auth);
31258/// // You can configure optional parameters by calling the respective setters at will, and
31259/// // execute the final call using `doit()`.
31260/// // Values shown here are possibly random and not representative !
31261/// let result = hub.accounts().containers_workspaces_get_status("path")
31262/// .doit().await;
31263/// # }
31264/// ```
31265pub struct AccountContainerWorkspaceGetStatuCall<'a, C>
31266where
31267 C: 'a,
31268{
31269 hub: &'a TagManager<C>,
31270 _path: String,
31271 _delegate: Option<&'a mut dyn common::Delegate>,
31272 _additional_params: HashMap<String, String>,
31273 _scopes: BTreeSet<String>,
31274}
31275
31276impl<'a, C> common::CallBuilder for AccountContainerWorkspaceGetStatuCall<'a, C> {}
31277
31278impl<'a, C> AccountContainerWorkspaceGetStatuCall<'a, C>
31279where
31280 C: common::Connector,
31281{
31282 /// Perform the operation you have build so far.
31283 pub async fn doit(mut self) -> common::Result<(common::Response, GetWorkspaceStatusResponse)> {
31284 use std::borrow::Cow;
31285 use std::io::{Read, Seek};
31286
31287 use common::{url::Params, ToParts};
31288 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31289
31290 let mut dd = common::DefaultDelegate;
31291 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31292 dlg.begin(common::MethodInfo {
31293 id: "tagmanager.accounts.containers.workspaces.getStatus",
31294 http_method: hyper::Method::GET,
31295 });
31296
31297 for &field in ["alt", "path"].iter() {
31298 if self._additional_params.contains_key(field) {
31299 dlg.finished(false);
31300 return Err(common::Error::FieldClash(field));
31301 }
31302 }
31303
31304 let mut params = Params::with_capacity(3 + self._additional_params.len());
31305 params.push("path", self._path);
31306
31307 params.extend(self._additional_params.iter());
31308
31309 params.push("alt", "json");
31310 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}/status";
31311 if self._scopes.is_empty() {
31312 self._scopes.insert(Scope::Readonly.as_ref().to_string());
31313 }
31314
31315 #[allow(clippy::single_element_loop)]
31316 for &(find_this, param_name) in [("{+path}", "path")].iter() {
31317 url = params.uri_replacement(url, param_name, find_this, true);
31318 }
31319 {
31320 let to_remove = ["path"];
31321 params.remove_params(&to_remove);
31322 }
31323
31324 let url = params.parse_with_url(&url);
31325
31326 loop {
31327 let token = match self
31328 .hub
31329 .auth
31330 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31331 .await
31332 {
31333 Ok(token) => token,
31334 Err(e) => match dlg.token(e) {
31335 Ok(token) => token,
31336 Err(e) => {
31337 dlg.finished(false);
31338 return Err(common::Error::MissingToken(e));
31339 }
31340 },
31341 };
31342 let mut req_result = {
31343 let client = &self.hub.client;
31344 dlg.pre_request();
31345 let mut req_builder = hyper::Request::builder()
31346 .method(hyper::Method::GET)
31347 .uri(url.as_str())
31348 .header(USER_AGENT, self.hub._user_agent.clone());
31349
31350 if let Some(token) = token.as_ref() {
31351 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31352 }
31353
31354 let request = req_builder
31355 .header(CONTENT_LENGTH, 0_u64)
31356 .body(common::to_body::<String>(None));
31357
31358 client.request(request.unwrap()).await
31359 };
31360
31361 match req_result {
31362 Err(err) => {
31363 if let common::Retry::After(d) = dlg.http_error(&err) {
31364 sleep(d).await;
31365 continue;
31366 }
31367 dlg.finished(false);
31368 return Err(common::Error::HttpError(err));
31369 }
31370 Ok(res) => {
31371 let (mut parts, body) = res.into_parts();
31372 let mut body = common::Body::new(body);
31373 if !parts.status.is_success() {
31374 let bytes = common::to_bytes(body).await.unwrap_or_default();
31375 let error = serde_json::from_str(&common::to_string(&bytes));
31376 let response = common::to_response(parts, bytes.into());
31377
31378 if let common::Retry::After(d) =
31379 dlg.http_failure(&response, error.as_ref().ok())
31380 {
31381 sleep(d).await;
31382 continue;
31383 }
31384
31385 dlg.finished(false);
31386
31387 return Err(match error {
31388 Ok(value) => common::Error::BadRequest(value),
31389 _ => common::Error::Failure(response),
31390 });
31391 }
31392 let response = {
31393 let bytes = common::to_bytes(body).await.unwrap_or_default();
31394 let encoded = common::to_string(&bytes);
31395 match serde_json::from_str(&encoded) {
31396 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31397 Err(error) => {
31398 dlg.response_json_decode_error(&encoded, &error);
31399 return Err(common::Error::JsonDecodeError(
31400 encoded.to_string(),
31401 error,
31402 ));
31403 }
31404 }
31405 };
31406
31407 dlg.finished(true);
31408 return Ok(response);
31409 }
31410 }
31411 }
31412 }
31413
31414 /// GTM Workspace's API relative path.
31415 ///
31416 /// Sets the *path* path property to the given value.
31417 ///
31418 /// Even though the property as already been set when instantiating this call,
31419 /// we provide this method for API completeness.
31420 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
31421 self._path = new_value.to_string();
31422 self
31423 }
31424 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31425 /// while executing the actual API request.
31426 ///
31427 /// ````text
31428 /// It should be used to handle progress information, and to implement a certain level of resilience.
31429 /// ````
31430 ///
31431 /// Sets the *delegate* property to the given value.
31432 pub fn delegate(
31433 mut self,
31434 new_value: &'a mut dyn common::Delegate,
31435 ) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
31436 self._delegate = Some(new_value);
31437 self
31438 }
31439
31440 /// Set any additional parameter of the query string used in the request.
31441 /// It should be used to set parameters which are not yet available through their own
31442 /// setters.
31443 ///
31444 /// Please note that this method must not be used to set any of the known parameters
31445 /// which have their own setter method. If done anyway, the request will fail.
31446 ///
31447 /// # Additional Parameters
31448 ///
31449 /// * *$.xgafv* (query-string) - V1 error format.
31450 /// * *access_token* (query-string) - OAuth access token.
31451 /// * *alt* (query-string) - Data format for response.
31452 /// * *callback* (query-string) - JSONP
31453 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31454 /// * *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.
31455 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31456 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31457 /// * *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.
31458 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31459 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31460 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceGetStatuCall<'a, C>
31461 where
31462 T: AsRef<str>,
31463 {
31464 self._additional_params
31465 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31466 self
31467 }
31468
31469 /// Identifies the authorization scope for the method you are building.
31470 ///
31471 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31472 /// [`Scope::Readonly`].
31473 ///
31474 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31475 /// tokens for more than one scope.
31476 ///
31477 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31478 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31479 /// sufficient, a read-write scope will do as well.
31480 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceGetStatuCall<'a, C>
31481 where
31482 St: AsRef<str>,
31483 {
31484 self._scopes.insert(String::from(scope.as_ref()));
31485 self
31486 }
31487 /// Identifies the authorization scope(s) for the method you are building.
31488 ///
31489 /// See [`Self::add_scope()`] for details.
31490 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceGetStatuCall<'a, C>
31491 where
31492 I: IntoIterator<Item = St>,
31493 St: AsRef<str>,
31494 {
31495 self._scopes
31496 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31497 self
31498 }
31499
31500 /// Removes all scopes, and no default scope will be used either.
31501 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31502 /// for details).
31503 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceGetStatuCall<'a, C> {
31504 self._scopes.clear();
31505 self
31506 }
31507}
31508
31509/// Lists all Workspaces that belong to a GTM Container.
31510///
31511/// A builder for the *containers.workspaces.list* method supported by a *account* resource.
31512/// It is not used directly, but through a [`AccountMethods`] instance.
31513///
31514/// # Example
31515///
31516/// Instantiate a resource method builder
31517///
31518/// ```test_harness,no_run
31519/// # extern crate hyper;
31520/// # extern crate hyper_rustls;
31521/// # extern crate google_tagmanager2 as tagmanager2;
31522/// # async fn dox() {
31523/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31524///
31525/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31526/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31527/// # .with_native_roots()
31528/// # .unwrap()
31529/// # .https_only()
31530/// # .enable_http2()
31531/// # .build();
31532///
31533/// # let executor = hyper_util::rt::TokioExecutor::new();
31534/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31535/// # secret,
31536/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31537/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31538/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31539/// # ),
31540/// # ).build().await.unwrap();
31541///
31542/// # let client = hyper_util::client::legacy::Client::builder(
31543/// # hyper_util::rt::TokioExecutor::new()
31544/// # )
31545/// # .build(
31546/// # hyper_rustls::HttpsConnectorBuilder::new()
31547/// # .with_native_roots()
31548/// # .unwrap()
31549/// # .https_or_http()
31550/// # .enable_http2()
31551/// # .build()
31552/// # );
31553/// # let mut hub = TagManager::new(client, auth);
31554/// // You can configure optional parameters by calling the respective setters at will, and
31555/// // execute the final call using `doit()`.
31556/// // Values shown here are possibly random and not representative !
31557/// let result = hub.accounts().containers_workspaces_list("parent")
31558/// .page_token("sea")
31559/// .doit().await;
31560/// # }
31561/// ```
31562pub struct AccountContainerWorkspaceListCall<'a, C>
31563where
31564 C: 'a,
31565{
31566 hub: &'a TagManager<C>,
31567 _parent: String,
31568 _page_token: Option<String>,
31569 _delegate: Option<&'a mut dyn common::Delegate>,
31570 _additional_params: HashMap<String, String>,
31571 _scopes: BTreeSet<String>,
31572}
31573
31574impl<'a, C> common::CallBuilder for AccountContainerWorkspaceListCall<'a, C> {}
31575
31576impl<'a, C> AccountContainerWorkspaceListCall<'a, C>
31577where
31578 C: common::Connector,
31579{
31580 /// Perform the operation you have build so far.
31581 pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkspacesResponse)> {
31582 use std::borrow::Cow;
31583 use std::io::{Read, Seek};
31584
31585 use common::{url::Params, ToParts};
31586 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31587
31588 let mut dd = common::DefaultDelegate;
31589 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31590 dlg.begin(common::MethodInfo {
31591 id: "tagmanager.accounts.containers.workspaces.list",
31592 http_method: hyper::Method::GET,
31593 });
31594
31595 for &field in ["alt", "parent", "pageToken"].iter() {
31596 if self._additional_params.contains_key(field) {
31597 dlg.finished(false);
31598 return Err(common::Error::FieldClash(field));
31599 }
31600 }
31601
31602 let mut params = Params::with_capacity(4 + self._additional_params.len());
31603 params.push("parent", self._parent);
31604 if let Some(value) = self._page_token.as_ref() {
31605 params.push("pageToken", value);
31606 }
31607
31608 params.extend(self._additional_params.iter());
31609
31610 params.push("alt", "json");
31611 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/workspaces";
31612 if self._scopes.is_empty() {
31613 self._scopes.insert(Scope::Readonly.as_ref().to_string());
31614 }
31615
31616 #[allow(clippy::single_element_loop)]
31617 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
31618 url = params.uri_replacement(url, param_name, find_this, true);
31619 }
31620 {
31621 let to_remove = ["parent"];
31622 params.remove_params(&to_remove);
31623 }
31624
31625 let url = params.parse_with_url(&url);
31626
31627 loop {
31628 let token = match self
31629 .hub
31630 .auth
31631 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31632 .await
31633 {
31634 Ok(token) => token,
31635 Err(e) => match dlg.token(e) {
31636 Ok(token) => token,
31637 Err(e) => {
31638 dlg.finished(false);
31639 return Err(common::Error::MissingToken(e));
31640 }
31641 },
31642 };
31643 let mut req_result = {
31644 let client = &self.hub.client;
31645 dlg.pre_request();
31646 let mut req_builder = hyper::Request::builder()
31647 .method(hyper::Method::GET)
31648 .uri(url.as_str())
31649 .header(USER_AGENT, self.hub._user_agent.clone());
31650
31651 if let Some(token) = token.as_ref() {
31652 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31653 }
31654
31655 let request = req_builder
31656 .header(CONTENT_LENGTH, 0_u64)
31657 .body(common::to_body::<String>(None));
31658
31659 client.request(request.unwrap()).await
31660 };
31661
31662 match req_result {
31663 Err(err) => {
31664 if let common::Retry::After(d) = dlg.http_error(&err) {
31665 sleep(d).await;
31666 continue;
31667 }
31668 dlg.finished(false);
31669 return Err(common::Error::HttpError(err));
31670 }
31671 Ok(res) => {
31672 let (mut parts, body) = res.into_parts();
31673 let mut body = common::Body::new(body);
31674 if !parts.status.is_success() {
31675 let bytes = common::to_bytes(body).await.unwrap_or_default();
31676 let error = serde_json::from_str(&common::to_string(&bytes));
31677 let response = common::to_response(parts, bytes.into());
31678
31679 if let common::Retry::After(d) =
31680 dlg.http_failure(&response, error.as_ref().ok())
31681 {
31682 sleep(d).await;
31683 continue;
31684 }
31685
31686 dlg.finished(false);
31687
31688 return Err(match error {
31689 Ok(value) => common::Error::BadRequest(value),
31690 _ => common::Error::Failure(response),
31691 });
31692 }
31693 let response = {
31694 let bytes = common::to_bytes(body).await.unwrap_or_default();
31695 let encoded = common::to_string(&bytes);
31696 match serde_json::from_str(&encoded) {
31697 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31698 Err(error) => {
31699 dlg.response_json_decode_error(&encoded, &error);
31700 return Err(common::Error::JsonDecodeError(
31701 encoded.to_string(),
31702 error,
31703 ));
31704 }
31705 }
31706 };
31707
31708 dlg.finished(true);
31709 return Ok(response);
31710 }
31711 }
31712 }
31713 }
31714
31715 /// GTM parent Container's API relative path.
31716 ///
31717 /// Sets the *parent* path property to the given value.
31718 ///
31719 /// Even though the property as already been set when instantiating this call,
31720 /// we provide this method for API completeness.
31721 pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceListCall<'a, C> {
31722 self._parent = new_value.to_string();
31723 self
31724 }
31725 /// Continuation token for fetching the next page of results.
31726 ///
31727 /// Sets the *page token* query property to the given value.
31728 pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceListCall<'a, C> {
31729 self._page_token = Some(new_value.to_string());
31730 self
31731 }
31732 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31733 /// while executing the actual API request.
31734 ///
31735 /// ````text
31736 /// It should be used to handle progress information, and to implement a certain level of resilience.
31737 /// ````
31738 ///
31739 /// Sets the *delegate* property to the given value.
31740 pub fn delegate(
31741 mut self,
31742 new_value: &'a mut dyn common::Delegate,
31743 ) -> AccountContainerWorkspaceListCall<'a, C> {
31744 self._delegate = Some(new_value);
31745 self
31746 }
31747
31748 /// Set any additional parameter of the query string used in the request.
31749 /// It should be used to set parameters which are not yet available through their own
31750 /// setters.
31751 ///
31752 /// Please note that this method must not be used to set any of the known parameters
31753 /// which have their own setter method. If done anyway, the request will fail.
31754 ///
31755 /// # Additional Parameters
31756 ///
31757 /// * *$.xgafv* (query-string) - V1 error format.
31758 /// * *access_token* (query-string) - OAuth access token.
31759 /// * *alt* (query-string) - Data format for response.
31760 /// * *callback* (query-string) - JSONP
31761 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31762 /// * *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.
31763 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31764 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31765 /// * *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.
31766 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31767 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31768 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceListCall<'a, C>
31769 where
31770 T: AsRef<str>,
31771 {
31772 self._additional_params
31773 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31774 self
31775 }
31776
31777 /// Identifies the authorization scope for the method you are building.
31778 ///
31779 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31780 /// [`Scope::Readonly`].
31781 ///
31782 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31783 /// tokens for more than one scope.
31784 ///
31785 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31786 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31787 /// sufficient, a read-write scope will do as well.
31788 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceListCall<'a, C>
31789 where
31790 St: AsRef<str>,
31791 {
31792 self._scopes.insert(String::from(scope.as_ref()));
31793 self
31794 }
31795 /// Identifies the authorization scope(s) for the method you are building.
31796 ///
31797 /// See [`Self::add_scope()`] for details.
31798 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceListCall<'a, C>
31799 where
31800 I: IntoIterator<Item = St>,
31801 St: AsRef<str>,
31802 {
31803 self._scopes
31804 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31805 self
31806 }
31807
31808 /// Removes all scopes, and no default scope will be used either.
31809 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31810 /// for details).
31811 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceListCall<'a, C> {
31812 self._scopes.clear();
31813 self
31814 }
31815}
31816
31817/// Quick previews a workspace by creating a fake container version from all entities in the provided workspace.
31818///
31819/// A builder for the *containers.workspaces.quick_preview* method supported by a *account* resource.
31820/// It is not used directly, but through a [`AccountMethods`] instance.
31821///
31822/// # Example
31823///
31824/// Instantiate a resource method builder
31825///
31826/// ```test_harness,no_run
31827/// # extern crate hyper;
31828/// # extern crate hyper_rustls;
31829/// # extern crate google_tagmanager2 as tagmanager2;
31830/// # async fn dox() {
31831/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31832///
31833/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31834/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31835/// # .with_native_roots()
31836/// # .unwrap()
31837/// # .https_only()
31838/// # .enable_http2()
31839/// # .build();
31840///
31841/// # let executor = hyper_util::rt::TokioExecutor::new();
31842/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31843/// # secret,
31844/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31845/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31846/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31847/// # ),
31848/// # ).build().await.unwrap();
31849///
31850/// # let client = hyper_util::client::legacy::Client::builder(
31851/// # hyper_util::rt::TokioExecutor::new()
31852/// # )
31853/// # .build(
31854/// # hyper_rustls::HttpsConnectorBuilder::new()
31855/// # .with_native_roots()
31856/// # .unwrap()
31857/// # .https_or_http()
31858/// # .enable_http2()
31859/// # .build()
31860/// # );
31861/// # let mut hub = TagManager::new(client, auth);
31862/// // You can configure optional parameters by calling the respective setters at will, and
31863/// // execute the final call using `doit()`.
31864/// // Values shown here are possibly random and not representative !
31865/// let result = hub.accounts().containers_workspaces_quick_preview("path")
31866/// .doit().await;
31867/// # }
31868/// ```
31869pub struct AccountContainerWorkspaceQuickPreviewCall<'a, C>
31870where
31871 C: 'a,
31872{
31873 hub: &'a TagManager<C>,
31874 _path: String,
31875 _delegate: Option<&'a mut dyn common::Delegate>,
31876 _additional_params: HashMap<String, String>,
31877 _scopes: BTreeSet<String>,
31878}
31879
31880impl<'a, C> common::CallBuilder for AccountContainerWorkspaceQuickPreviewCall<'a, C> {}
31881
31882impl<'a, C> AccountContainerWorkspaceQuickPreviewCall<'a, C>
31883where
31884 C: common::Connector,
31885{
31886 /// Perform the operation you have build so far.
31887 pub async fn doit(mut self) -> common::Result<(common::Response, QuickPreviewResponse)> {
31888 use std::borrow::Cow;
31889 use std::io::{Read, Seek};
31890
31891 use common::{url::Params, ToParts};
31892 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31893
31894 let mut dd = common::DefaultDelegate;
31895 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31896 dlg.begin(common::MethodInfo {
31897 id: "tagmanager.accounts.containers.workspaces.quick_preview",
31898 http_method: hyper::Method::POST,
31899 });
31900
31901 for &field in ["alt", "path"].iter() {
31902 if self._additional_params.contains_key(field) {
31903 dlg.finished(false);
31904 return Err(common::Error::FieldClash(field));
31905 }
31906 }
31907
31908 let mut params = Params::with_capacity(3 + self._additional_params.len());
31909 params.push("path", self._path);
31910
31911 params.extend(self._additional_params.iter());
31912
31913 params.push("alt", "json");
31914 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:quick_preview";
31915 if self._scopes.is_empty() {
31916 self._scopes
31917 .insert(Scope::EditContainerversion.as_ref().to_string());
31918 }
31919
31920 #[allow(clippy::single_element_loop)]
31921 for &(find_this, param_name) in [("{+path}", "path")].iter() {
31922 url = params.uri_replacement(url, param_name, find_this, true);
31923 }
31924 {
31925 let to_remove = ["path"];
31926 params.remove_params(&to_remove);
31927 }
31928
31929 let url = params.parse_with_url(&url);
31930
31931 loop {
31932 let token = match self
31933 .hub
31934 .auth
31935 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31936 .await
31937 {
31938 Ok(token) => token,
31939 Err(e) => match dlg.token(e) {
31940 Ok(token) => token,
31941 Err(e) => {
31942 dlg.finished(false);
31943 return Err(common::Error::MissingToken(e));
31944 }
31945 },
31946 };
31947 let mut req_result = {
31948 let client = &self.hub.client;
31949 dlg.pre_request();
31950 let mut req_builder = hyper::Request::builder()
31951 .method(hyper::Method::POST)
31952 .uri(url.as_str())
31953 .header(USER_AGENT, self.hub._user_agent.clone());
31954
31955 if let Some(token) = token.as_ref() {
31956 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31957 }
31958
31959 let request = req_builder
31960 .header(CONTENT_LENGTH, 0_u64)
31961 .body(common::to_body::<String>(None));
31962
31963 client.request(request.unwrap()).await
31964 };
31965
31966 match req_result {
31967 Err(err) => {
31968 if let common::Retry::After(d) = dlg.http_error(&err) {
31969 sleep(d).await;
31970 continue;
31971 }
31972 dlg.finished(false);
31973 return Err(common::Error::HttpError(err));
31974 }
31975 Ok(res) => {
31976 let (mut parts, body) = res.into_parts();
31977 let mut body = common::Body::new(body);
31978 if !parts.status.is_success() {
31979 let bytes = common::to_bytes(body).await.unwrap_or_default();
31980 let error = serde_json::from_str(&common::to_string(&bytes));
31981 let response = common::to_response(parts, bytes.into());
31982
31983 if let common::Retry::After(d) =
31984 dlg.http_failure(&response, error.as_ref().ok())
31985 {
31986 sleep(d).await;
31987 continue;
31988 }
31989
31990 dlg.finished(false);
31991
31992 return Err(match error {
31993 Ok(value) => common::Error::BadRequest(value),
31994 _ => common::Error::Failure(response),
31995 });
31996 }
31997 let response = {
31998 let bytes = common::to_bytes(body).await.unwrap_or_default();
31999 let encoded = common::to_string(&bytes);
32000 match serde_json::from_str(&encoded) {
32001 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32002 Err(error) => {
32003 dlg.response_json_decode_error(&encoded, &error);
32004 return Err(common::Error::JsonDecodeError(
32005 encoded.to_string(),
32006 error,
32007 ));
32008 }
32009 }
32010 };
32011
32012 dlg.finished(true);
32013 return Ok(response);
32014 }
32015 }
32016 }
32017 }
32018
32019 /// GTM Workspace's API relative path.
32020 ///
32021 /// Sets the *path* path property to the given value.
32022 ///
32023 /// Even though the property as already been set when instantiating this call,
32024 /// we provide this method for API completeness.
32025 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
32026 self._path = new_value.to_string();
32027 self
32028 }
32029 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32030 /// while executing the actual API request.
32031 ///
32032 /// ````text
32033 /// It should be used to handle progress information, and to implement a certain level of resilience.
32034 /// ````
32035 ///
32036 /// Sets the *delegate* property to the given value.
32037 pub fn delegate(
32038 mut self,
32039 new_value: &'a mut dyn common::Delegate,
32040 ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
32041 self._delegate = Some(new_value);
32042 self
32043 }
32044
32045 /// Set any additional parameter of the query string used in the request.
32046 /// It should be used to set parameters which are not yet available through their own
32047 /// setters.
32048 ///
32049 /// Please note that this method must not be used to set any of the known parameters
32050 /// which have their own setter method. If done anyway, the request will fail.
32051 ///
32052 /// # Additional Parameters
32053 ///
32054 /// * *$.xgafv* (query-string) - V1 error format.
32055 /// * *access_token* (query-string) - OAuth access token.
32056 /// * *alt* (query-string) - Data format for response.
32057 /// * *callback* (query-string) - JSONP
32058 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32059 /// * *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.
32060 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32061 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32062 /// * *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.
32063 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32064 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32065 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
32066 where
32067 T: AsRef<str>,
32068 {
32069 self._additional_params
32070 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32071 self
32072 }
32073
32074 /// Identifies the authorization scope for the method you are building.
32075 ///
32076 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32077 /// [`Scope::EditContainerversion`].
32078 ///
32079 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32080 /// tokens for more than one scope.
32081 ///
32082 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32083 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32084 /// sufficient, a read-write scope will do as well.
32085 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
32086 where
32087 St: AsRef<str>,
32088 {
32089 self._scopes.insert(String::from(scope.as_ref()));
32090 self
32091 }
32092 /// Identifies the authorization scope(s) for the method you are building.
32093 ///
32094 /// See [`Self::add_scope()`] for details.
32095 pub fn add_scopes<I, St>(
32096 mut self,
32097 scopes: I,
32098 ) -> AccountContainerWorkspaceQuickPreviewCall<'a, C>
32099 where
32100 I: IntoIterator<Item = St>,
32101 St: AsRef<str>,
32102 {
32103 self._scopes
32104 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32105 self
32106 }
32107
32108 /// Removes all scopes, and no default scope will be used either.
32109 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32110 /// for details).
32111 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceQuickPreviewCall<'a, C> {
32112 self._scopes.clear();
32113 self
32114 }
32115}
32116
32117/// Resolves a merge conflict for a workspace entity by updating it to the resolved entity passed in the request.
32118///
32119/// A builder for the *containers.workspaces.resolve_conflict* method supported by a *account* resource.
32120/// It is not used directly, but through a [`AccountMethods`] instance.
32121///
32122/// # Example
32123///
32124/// Instantiate a resource method builder
32125///
32126/// ```test_harness,no_run
32127/// # extern crate hyper;
32128/// # extern crate hyper_rustls;
32129/// # extern crate google_tagmanager2 as tagmanager2;
32130/// use tagmanager2::api::Entity;
32131/// # async fn dox() {
32132/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32133///
32134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32135/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32136/// # .with_native_roots()
32137/// # .unwrap()
32138/// # .https_only()
32139/// # .enable_http2()
32140/// # .build();
32141///
32142/// # let executor = hyper_util::rt::TokioExecutor::new();
32143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32144/// # secret,
32145/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32146/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32147/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32148/// # ),
32149/// # ).build().await.unwrap();
32150///
32151/// # let client = hyper_util::client::legacy::Client::builder(
32152/// # hyper_util::rt::TokioExecutor::new()
32153/// # )
32154/// # .build(
32155/// # hyper_rustls::HttpsConnectorBuilder::new()
32156/// # .with_native_roots()
32157/// # .unwrap()
32158/// # .https_or_http()
32159/// # .enable_http2()
32160/// # .build()
32161/// # );
32162/// # let mut hub = TagManager::new(client, auth);
32163/// // As the method needs a request, you would usually fill it with the desired information
32164/// // into the respective structure. Some of the parts shown here might not be applicable !
32165/// // Values shown here are possibly random and not representative !
32166/// let mut req = Entity::default();
32167///
32168/// // You can configure optional parameters by calling the respective setters at will, and
32169/// // execute the final call using `doit()`.
32170/// // Values shown here are possibly random and not representative !
32171/// let result = hub.accounts().containers_workspaces_resolve_conflict(req, "path")
32172/// .fingerprint("et")
32173/// .doit().await;
32174/// # }
32175/// ```
32176pub struct AccountContainerWorkspaceResolveConflictCall<'a, C>
32177where
32178 C: 'a,
32179{
32180 hub: &'a TagManager<C>,
32181 _request: Entity,
32182 _path: String,
32183 _fingerprint: Option<String>,
32184 _delegate: Option<&'a mut dyn common::Delegate>,
32185 _additional_params: HashMap<String, String>,
32186 _scopes: BTreeSet<String>,
32187}
32188
32189impl<'a, C> common::CallBuilder for AccountContainerWorkspaceResolveConflictCall<'a, C> {}
32190
32191impl<'a, C> AccountContainerWorkspaceResolveConflictCall<'a, C>
32192where
32193 C: common::Connector,
32194{
32195 /// Perform the operation you have build so far.
32196 pub async fn doit(mut self) -> common::Result<common::Response> {
32197 use std::borrow::Cow;
32198 use std::io::{Read, Seek};
32199
32200 use common::{url::Params, ToParts};
32201 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32202
32203 let mut dd = common::DefaultDelegate;
32204 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32205 dlg.begin(common::MethodInfo {
32206 id: "tagmanager.accounts.containers.workspaces.resolve_conflict",
32207 http_method: hyper::Method::POST,
32208 });
32209
32210 for &field in ["path", "fingerprint"].iter() {
32211 if self._additional_params.contains_key(field) {
32212 dlg.finished(false);
32213 return Err(common::Error::FieldClash(field));
32214 }
32215 }
32216
32217 let mut params = Params::with_capacity(4 + self._additional_params.len());
32218 params.push("path", self._path);
32219 if let Some(value) = self._fingerprint.as_ref() {
32220 params.push("fingerprint", value);
32221 }
32222
32223 params.extend(self._additional_params.iter());
32224
32225 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:resolve_conflict";
32226 if self._scopes.is_empty() {
32227 self._scopes
32228 .insert(Scope::EditContainer.as_ref().to_string());
32229 }
32230
32231 #[allow(clippy::single_element_loop)]
32232 for &(find_this, param_name) in [("{+path}", "path")].iter() {
32233 url = params.uri_replacement(url, param_name, find_this, true);
32234 }
32235 {
32236 let to_remove = ["path"];
32237 params.remove_params(&to_remove);
32238 }
32239
32240 let url = params.parse_with_url(&url);
32241
32242 let mut json_mime_type = mime::APPLICATION_JSON;
32243 let mut request_value_reader = {
32244 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32245 common::remove_json_null_values(&mut value);
32246 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32247 serde_json::to_writer(&mut dst, &value).unwrap();
32248 dst
32249 };
32250 let request_size = request_value_reader
32251 .seek(std::io::SeekFrom::End(0))
32252 .unwrap();
32253 request_value_reader
32254 .seek(std::io::SeekFrom::Start(0))
32255 .unwrap();
32256
32257 loop {
32258 let token = match self
32259 .hub
32260 .auth
32261 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32262 .await
32263 {
32264 Ok(token) => token,
32265 Err(e) => match dlg.token(e) {
32266 Ok(token) => token,
32267 Err(e) => {
32268 dlg.finished(false);
32269 return Err(common::Error::MissingToken(e));
32270 }
32271 },
32272 };
32273 request_value_reader
32274 .seek(std::io::SeekFrom::Start(0))
32275 .unwrap();
32276 let mut req_result = {
32277 let client = &self.hub.client;
32278 dlg.pre_request();
32279 let mut req_builder = hyper::Request::builder()
32280 .method(hyper::Method::POST)
32281 .uri(url.as_str())
32282 .header(USER_AGENT, self.hub._user_agent.clone());
32283
32284 if let Some(token) = token.as_ref() {
32285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32286 }
32287
32288 let request = req_builder
32289 .header(CONTENT_TYPE, json_mime_type.to_string())
32290 .header(CONTENT_LENGTH, request_size as u64)
32291 .body(common::to_body(
32292 request_value_reader.get_ref().clone().into(),
32293 ));
32294
32295 client.request(request.unwrap()).await
32296 };
32297
32298 match req_result {
32299 Err(err) => {
32300 if let common::Retry::After(d) = dlg.http_error(&err) {
32301 sleep(d).await;
32302 continue;
32303 }
32304 dlg.finished(false);
32305 return Err(common::Error::HttpError(err));
32306 }
32307 Ok(res) => {
32308 let (mut parts, body) = res.into_parts();
32309 let mut body = common::Body::new(body);
32310 if !parts.status.is_success() {
32311 let bytes = common::to_bytes(body).await.unwrap_or_default();
32312 let error = serde_json::from_str(&common::to_string(&bytes));
32313 let response = common::to_response(parts, bytes.into());
32314
32315 if let common::Retry::After(d) =
32316 dlg.http_failure(&response, error.as_ref().ok())
32317 {
32318 sleep(d).await;
32319 continue;
32320 }
32321
32322 dlg.finished(false);
32323
32324 return Err(match error {
32325 Ok(value) => common::Error::BadRequest(value),
32326 _ => common::Error::Failure(response),
32327 });
32328 }
32329 let response = common::Response::from_parts(parts, body);
32330
32331 dlg.finished(true);
32332 return Ok(response);
32333 }
32334 }
32335 }
32336 }
32337
32338 ///
32339 /// Sets the *request* property to the given value.
32340 ///
32341 /// Even though the property as already been set when instantiating this call,
32342 /// we provide this method for API completeness.
32343 pub fn request(
32344 mut self,
32345 new_value: Entity,
32346 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
32347 self._request = new_value;
32348 self
32349 }
32350 /// GTM Workspace's API relative path.
32351 ///
32352 /// Sets the *path* path property to the given value.
32353 ///
32354 /// Even though the property as already been set when instantiating this call,
32355 /// we provide this method for API completeness.
32356 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
32357 self._path = new_value.to_string();
32358 self
32359 }
32360 /// When provided, this fingerprint must match the fingerprint of the entity_in_workspace in the merge conflict.
32361 ///
32362 /// Sets the *fingerprint* query property to the given value.
32363 pub fn fingerprint(
32364 mut self,
32365 new_value: &str,
32366 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
32367 self._fingerprint = Some(new_value.to_string());
32368 self
32369 }
32370 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32371 /// while executing the actual API request.
32372 ///
32373 /// ````text
32374 /// It should be used to handle progress information, and to implement a certain level of resilience.
32375 /// ````
32376 ///
32377 /// Sets the *delegate* property to the given value.
32378 pub fn delegate(
32379 mut self,
32380 new_value: &'a mut dyn common::Delegate,
32381 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
32382 self._delegate = Some(new_value);
32383 self
32384 }
32385
32386 /// Set any additional parameter of the query string used in the request.
32387 /// It should be used to set parameters which are not yet available through their own
32388 /// setters.
32389 ///
32390 /// Please note that this method must not be used to set any of the known parameters
32391 /// which have their own setter method. If done anyway, the request will fail.
32392 ///
32393 /// # Additional Parameters
32394 ///
32395 /// * *$.xgafv* (query-string) - V1 error format.
32396 /// * *access_token* (query-string) - OAuth access token.
32397 /// * *alt* (query-string) - Data format for response.
32398 /// * *callback* (query-string) - JSONP
32399 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32400 /// * *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.
32401 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32402 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32403 /// * *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.
32404 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32405 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32406 pub fn param<T>(
32407 mut self,
32408 name: T,
32409 value: T,
32410 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
32411 where
32412 T: AsRef<str>,
32413 {
32414 self._additional_params
32415 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32416 self
32417 }
32418
32419 /// Identifies the authorization scope for the method you are building.
32420 ///
32421 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32422 /// [`Scope::EditContainer`].
32423 ///
32424 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32425 /// tokens for more than one scope.
32426 ///
32427 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32428 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32429 /// sufficient, a read-write scope will do as well.
32430 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
32431 where
32432 St: AsRef<str>,
32433 {
32434 self._scopes.insert(String::from(scope.as_ref()));
32435 self
32436 }
32437 /// Identifies the authorization scope(s) for the method you are building.
32438 ///
32439 /// See [`Self::add_scope()`] for details.
32440 pub fn add_scopes<I, St>(
32441 mut self,
32442 scopes: I,
32443 ) -> AccountContainerWorkspaceResolveConflictCall<'a, C>
32444 where
32445 I: IntoIterator<Item = St>,
32446 St: AsRef<str>,
32447 {
32448 self._scopes
32449 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32450 self
32451 }
32452
32453 /// Removes all scopes, and no default scope will be used either.
32454 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32455 /// for details).
32456 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceResolveConflictCall<'a, C> {
32457 self._scopes.clear();
32458 self
32459 }
32460}
32461
32462/// Syncs a workspace to the latest container version by updating all unmodified workspace entities and displaying conflicts for modified entities.
32463///
32464/// A builder for the *containers.workspaces.sync* method supported by a *account* resource.
32465/// It is not used directly, but through a [`AccountMethods`] instance.
32466///
32467/// # Example
32468///
32469/// Instantiate a resource method builder
32470///
32471/// ```test_harness,no_run
32472/// # extern crate hyper;
32473/// # extern crate hyper_rustls;
32474/// # extern crate google_tagmanager2 as tagmanager2;
32475/// # async fn dox() {
32476/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32477///
32478/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32479/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32480/// # .with_native_roots()
32481/// # .unwrap()
32482/// # .https_only()
32483/// # .enable_http2()
32484/// # .build();
32485///
32486/// # let executor = hyper_util::rt::TokioExecutor::new();
32487/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32488/// # secret,
32489/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32490/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32491/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32492/// # ),
32493/// # ).build().await.unwrap();
32494///
32495/// # let client = hyper_util::client::legacy::Client::builder(
32496/// # hyper_util::rt::TokioExecutor::new()
32497/// # )
32498/// # .build(
32499/// # hyper_rustls::HttpsConnectorBuilder::new()
32500/// # .with_native_roots()
32501/// # .unwrap()
32502/// # .https_or_http()
32503/// # .enable_http2()
32504/// # .build()
32505/// # );
32506/// # let mut hub = TagManager::new(client, auth);
32507/// // You can configure optional parameters by calling the respective setters at will, and
32508/// // execute the final call using `doit()`.
32509/// // Values shown here are possibly random and not representative !
32510/// let result = hub.accounts().containers_workspaces_sync("path")
32511/// .doit().await;
32512/// # }
32513/// ```
32514pub struct AccountContainerWorkspaceSyncCall<'a, C>
32515where
32516 C: 'a,
32517{
32518 hub: &'a TagManager<C>,
32519 _path: String,
32520 _delegate: Option<&'a mut dyn common::Delegate>,
32521 _additional_params: HashMap<String, String>,
32522 _scopes: BTreeSet<String>,
32523}
32524
32525impl<'a, C> common::CallBuilder for AccountContainerWorkspaceSyncCall<'a, C> {}
32526
32527impl<'a, C> AccountContainerWorkspaceSyncCall<'a, C>
32528where
32529 C: common::Connector,
32530{
32531 /// Perform the operation you have build so far.
32532 pub async fn doit(mut self) -> common::Result<(common::Response, SyncWorkspaceResponse)> {
32533 use std::borrow::Cow;
32534 use std::io::{Read, Seek};
32535
32536 use common::{url::Params, ToParts};
32537 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32538
32539 let mut dd = common::DefaultDelegate;
32540 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32541 dlg.begin(common::MethodInfo {
32542 id: "tagmanager.accounts.containers.workspaces.sync",
32543 http_method: hyper::Method::POST,
32544 });
32545
32546 for &field in ["alt", "path"].iter() {
32547 if self._additional_params.contains_key(field) {
32548 dlg.finished(false);
32549 return Err(common::Error::FieldClash(field));
32550 }
32551 }
32552
32553 let mut params = Params::with_capacity(3 + self._additional_params.len());
32554 params.push("path", self._path);
32555
32556 params.extend(self._additional_params.iter());
32557
32558 params.push("alt", "json");
32559 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:sync";
32560 if self._scopes.is_empty() {
32561 self._scopes
32562 .insert(Scope::EditContainer.as_ref().to_string());
32563 }
32564
32565 #[allow(clippy::single_element_loop)]
32566 for &(find_this, param_name) in [("{+path}", "path")].iter() {
32567 url = params.uri_replacement(url, param_name, find_this, true);
32568 }
32569 {
32570 let to_remove = ["path"];
32571 params.remove_params(&to_remove);
32572 }
32573
32574 let url = params.parse_with_url(&url);
32575
32576 loop {
32577 let token = match self
32578 .hub
32579 .auth
32580 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32581 .await
32582 {
32583 Ok(token) => token,
32584 Err(e) => match dlg.token(e) {
32585 Ok(token) => token,
32586 Err(e) => {
32587 dlg.finished(false);
32588 return Err(common::Error::MissingToken(e));
32589 }
32590 },
32591 };
32592 let mut req_result = {
32593 let client = &self.hub.client;
32594 dlg.pre_request();
32595 let mut req_builder = hyper::Request::builder()
32596 .method(hyper::Method::POST)
32597 .uri(url.as_str())
32598 .header(USER_AGENT, self.hub._user_agent.clone());
32599
32600 if let Some(token) = token.as_ref() {
32601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32602 }
32603
32604 let request = req_builder
32605 .header(CONTENT_LENGTH, 0_u64)
32606 .body(common::to_body::<String>(None));
32607
32608 client.request(request.unwrap()).await
32609 };
32610
32611 match req_result {
32612 Err(err) => {
32613 if let common::Retry::After(d) = dlg.http_error(&err) {
32614 sleep(d).await;
32615 continue;
32616 }
32617 dlg.finished(false);
32618 return Err(common::Error::HttpError(err));
32619 }
32620 Ok(res) => {
32621 let (mut parts, body) = res.into_parts();
32622 let mut body = common::Body::new(body);
32623 if !parts.status.is_success() {
32624 let bytes = common::to_bytes(body).await.unwrap_or_default();
32625 let error = serde_json::from_str(&common::to_string(&bytes));
32626 let response = common::to_response(parts, bytes.into());
32627
32628 if let common::Retry::After(d) =
32629 dlg.http_failure(&response, error.as_ref().ok())
32630 {
32631 sleep(d).await;
32632 continue;
32633 }
32634
32635 dlg.finished(false);
32636
32637 return Err(match error {
32638 Ok(value) => common::Error::BadRequest(value),
32639 _ => common::Error::Failure(response),
32640 });
32641 }
32642 let response = {
32643 let bytes = common::to_bytes(body).await.unwrap_or_default();
32644 let encoded = common::to_string(&bytes);
32645 match serde_json::from_str(&encoded) {
32646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32647 Err(error) => {
32648 dlg.response_json_decode_error(&encoded, &error);
32649 return Err(common::Error::JsonDecodeError(
32650 encoded.to_string(),
32651 error,
32652 ));
32653 }
32654 }
32655 };
32656
32657 dlg.finished(true);
32658 return Ok(response);
32659 }
32660 }
32661 }
32662 }
32663
32664 /// GTM Workspace's API relative path.
32665 ///
32666 /// Sets the *path* path property to the given value.
32667 ///
32668 /// Even though the property as already been set when instantiating this call,
32669 /// we provide this method for API completeness.
32670 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceSyncCall<'a, C> {
32671 self._path = new_value.to_string();
32672 self
32673 }
32674 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32675 /// while executing the actual API request.
32676 ///
32677 /// ````text
32678 /// It should be used to handle progress information, and to implement a certain level of resilience.
32679 /// ````
32680 ///
32681 /// Sets the *delegate* property to the given value.
32682 pub fn delegate(
32683 mut self,
32684 new_value: &'a mut dyn common::Delegate,
32685 ) -> AccountContainerWorkspaceSyncCall<'a, C> {
32686 self._delegate = Some(new_value);
32687 self
32688 }
32689
32690 /// Set any additional parameter of the query string used in the request.
32691 /// It should be used to set parameters which are not yet available through their own
32692 /// setters.
32693 ///
32694 /// Please note that this method must not be used to set any of the known parameters
32695 /// which have their own setter method. If done anyway, the request will fail.
32696 ///
32697 /// # Additional Parameters
32698 ///
32699 /// * *$.xgafv* (query-string) - V1 error format.
32700 /// * *access_token* (query-string) - OAuth access token.
32701 /// * *alt* (query-string) - Data format for response.
32702 /// * *callback* (query-string) - JSONP
32703 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32704 /// * *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.
32705 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32706 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32707 /// * *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.
32708 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32709 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32710 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceSyncCall<'a, C>
32711 where
32712 T: AsRef<str>,
32713 {
32714 self._additional_params
32715 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32716 self
32717 }
32718
32719 /// Identifies the authorization scope for the method you are building.
32720 ///
32721 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32722 /// [`Scope::EditContainer`].
32723 ///
32724 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32725 /// tokens for more than one scope.
32726 ///
32727 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32728 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32729 /// sufficient, a read-write scope will do as well.
32730 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceSyncCall<'a, C>
32731 where
32732 St: AsRef<str>,
32733 {
32734 self._scopes.insert(String::from(scope.as_ref()));
32735 self
32736 }
32737 /// Identifies the authorization scope(s) for the method you are building.
32738 ///
32739 /// See [`Self::add_scope()`] for details.
32740 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceSyncCall<'a, C>
32741 where
32742 I: IntoIterator<Item = St>,
32743 St: AsRef<str>,
32744 {
32745 self._scopes
32746 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32747 self
32748 }
32749
32750 /// Removes all scopes, and no default scope will be used either.
32751 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32752 /// for details).
32753 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceSyncCall<'a, C> {
32754 self._scopes.clear();
32755 self
32756 }
32757}
32758
32759/// Updates a Workspace.
32760///
32761/// A builder for the *containers.workspaces.update* method supported by a *account* resource.
32762/// It is not used directly, but through a [`AccountMethods`] instance.
32763///
32764/// # Example
32765///
32766/// Instantiate a resource method builder
32767///
32768/// ```test_harness,no_run
32769/// # extern crate hyper;
32770/// # extern crate hyper_rustls;
32771/// # extern crate google_tagmanager2 as tagmanager2;
32772/// use tagmanager2::api::Workspace;
32773/// # async fn dox() {
32774/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32775///
32776/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32777/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32778/// # .with_native_roots()
32779/// # .unwrap()
32780/// # .https_only()
32781/// # .enable_http2()
32782/// # .build();
32783///
32784/// # let executor = hyper_util::rt::TokioExecutor::new();
32785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32786/// # secret,
32787/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32788/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32789/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32790/// # ),
32791/// # ).build().await.unwrap();
32792///
32793/// # let client = hyper_util::client::legacy::Client::builder(
32794/// # hyper_util::rt::TokioExecutor::new()
32795/// # )
32796/// # .build(
32797/// # hyper_rustls::HttpsConnectorBuilder::new()
32798/// # .with_native_roots()
32799/// # .unwrap()
32800/// # .https_or_http()
32801/// # .enable_http2()
32802/// # .build()
32803/// # );
32804/// # let mut hub = TagManager::new(client, auth);
32805/// // As the method needs a request, you would usually fill it with the desired information
32806/// // into the respective structure. Some of the parts shown here might not be applicable !
32807/// // Values shown here are possibly random and not representative !
32808/// let mut req = Workspace::default();
32809///
32810/// // You can configure optional parameters by calling the respective setters at will, and
32811/// // execute the final call using `doit()`.
32812/// // Values shown here are possibly random and not representative !
32813/// let result = hub.accounts().containers_workspaces_update(req, "path")
32814/// .fingerprint("et")
32815/// .doit().await;
32816/// # }
32817/// ```
32818pub struct AccountContainerWorkspaceUpdateCall<'a, C>
32819where
32820 C: 'a,
32821{
32822 hub: &'a TagManager<C>,
32823 _request: Workspace,
32824 _path: String,
32825 _fingerprint: Option<String>,
32826 _delegate: Option<&'a mut dyn common::Delegate>,
32827 _additional_params: HashMap<String, String>,
32828 _scopes: BTreeSet<String>,
32829}
32830
32831impl<'a, C> common::CallBuilder for AccountContainerWorkspaceUpdateCall<'a, C> {}
32832
32833impl<'a, C> AccountContainerWorkspaceUpdateCall<'a, C>
32834where
32835 C: common::Connector,
32836{
32837 /// Perform the operation you have build so far.
32838 pub async fn doit(mut self) -> common::Result<(common::Response, Workspace)> {
32839 use std::borrow::Cow;
32840 use std::io::{Read, Seek};
32841
32842 use common::{url::Params, ToParts};
32843 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32844
32845 let mut dd = common::DefaultDelegate;
32846 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32847 dlg.begin(common::MethodInfo {
32848 id: "tagmanager.accounts.containers.workspaces.update",
32849 http_method: hyper::Method::PUT,
32850 });
32851
32852 for &field in ["alt", "path", "fingerprint"].iter() {
32853 if self._additional_params.contains_key(field) {
32854 dlg.finished(false);
32855 return Err(common::Error::FieldClash(field));
32856 }
32857 }
32858
32859 let mut params = Params::with_capacity(5 + self._additional_params.len());
32860 params.push("path", self._path);
32861 if let Some(value) = self._fingerprint.as_ref() {
32862 params.push("fingerprint", value);
32863 }
32864
32865 params.extend(self._additional_params.iter());
32866
32867 params.push("alt", "json");
32868 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
32869 if self._scopes.is_empty() {
32870 self._scopes
32871 .insert(Scope::EditContainer.as_ref().to_string());
32872 }
32873
32874 #[allow(clippy::single_element_loop)]
32875 for &(find_this, param_name) in [("{+path}", "path")].iter() {
32876 url = params.uri_replacement(url, param_name, find_this, true);
32877 }
32878 {
32879 let to_remove = ["path"];
32880 params.remove_params(&to_remove);
32881 }
32882
32883 let url = params.parse_with_url(&url);
32884
32885 let mut json_mime_type = mime::APPLICATION_JSON;
32886 let mut request_value_reader = {
32887 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32888 common::remove_json_null_values(&mut value);
32889 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32890 serde_json::to_writer(&mut dst, &value).unwrap();
32891 dst
32892 };
32893 let request_size = request_value_reader
32894 .seek(std::io::SeekFrom::End(0))
32895 .unwrap();
32896 request_value_reader
32897 .seek(std::io::SeekFrom::Start(0))
32898 .unwrap();
32899
32900 loop {
32901 let token = match self
32902 .hub
32903 .auth
32904 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32905 .await
32906 {
32907 Ok(token) => token,
32908 Err(e) => match dlg.token(e) {
32909 Ok(token) => token,
32910 Err(e) => {
32911 dlg.finished(false);
32912 return Err(common::Error::MissingToken(e));
32913 }
32914 },
32915 };
32916 request_value_reader
32917 .seek(std::io::SeekFrom::Start(0))
32918 .unwrap();
32919 let mut req_result = {
32920 let client = &self.hub.client;
32921 dlg.pre_request();
32922 let mut req_builder = hyper::Request::builder()
32923 .method(hyper::Method::PUT)
32924 .uri(url.as_str())
32925 .header(USER_AGENT, self.hub._user_agent.clone());
32926
32927 if let Some(token) = token.as_ref() {
32928 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32929 }
32930
32931 let request = req_builder
32932 .header(CONTENT_TYPE, json_mime_type.to_string())
32933 .header(CONTENT_LENGTH, request_size as u64)
32934 .body(common::to_body(
32935 request_value_reader.get_ref().clone().into(),
32936 ));
32937
32938 client.request(request.unwrap()).await
32939 };
32940
32941 match req_result {
32942 Err(err) => {
32943 if let common::Retry::After(d) = dlg.http_error(&err) {
32944 sleep(d).await;
32945 continue;
32946 }
32947 dlg.finished(false);
32948 return Err(common::Error::HttpError(err));
32949 }
32950 Ok(res) => {
32951 let (mut parts, body) = res.into_parts();
32952 let mut body = common::Body::new(body);
32953 if !parts.status.is_success() {
32954 let bytes = common::to_bytes(body).await.unwrap_or_default();
32955 let error = serde_json::from_str(&common::to_string(&bytes));
32956 let response = common::to_response(parts, bytes.into());
32957
32958 if let common::Retry::After(d) =
32959 dlg.http_failure(&response, error.as_ref().ok())
32960 {
32961 sleep(d).await;
32962 continue;
32963 }
32964
32965 dlg.finished(false);
32966
32967 return Err(match error {
32968 Ok(value) => common::Error::BadRequest(value),
32969 _ => common::Error::Failure(response),
32970 });
32971 }
32972 let response = {
32973 let bytes = common::to_bytes(body).await.unwrap_or_default();
32974 let encoded = common::to_string(&bytes);
32975 match serde_json::from_str(&encoded) {
32976 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32977 Err(error) => {
32978 dlg.response_json_decode_error(&encoded, &error);
32979 return Err(common::Error::JsonDecodeError(
32980 encoded.to_string(),
32981 error,
32982 ));
32983 }
32984 }
32985 };
32986
32987 dlg.finished(true);
32988 return Ok(response);
32989 }
32990 }
32991 }
32992 }
32993
32994 ///
32995 /// Sets the *request* property to the given value.
32996 ///
32997 /// Even though the property as already been set when instantiating this call,
32998 /// we provide this method for API completeness.
32999 pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceUpdateCall<'a, C> {
33000 self._request = new_value;
33001 self
33002 }
33003 /// GTM Workspace's API relative path.
33004 ///
33005 /// Sets the *path* path property to the given value.
33006 ///
33007 /// Even though the property as already been set when instantiating this call,
33008 /// we provide this method for API completeness.
33009 pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceUpdateCall<'a, C> {
33010 self._path = new_value.to_string();
33011 self
33012 }
33013 /// When provided, this fingerprint must match the fingerprint of the workspace in storage.
33014 ///
33015 /// Sets the *fingerprint* query property to the given value.
33016 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceUpdateCall<'a, C> {
33017 self._fingerprint = Some(new_value.to_string());
33018 self
33019 }
33020 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33021 /// while executing the actual API request.
33022 ///
33023 /// ````text
33024 /// It should be used to handle progress information, and to implement a certain level of resilience.
33025 /// ````
33026 ///
33027 /// Sets the *delegate* property to the given value.
33028 pub fn delegate(
33029 mut self,
33030 new_value: &'a mut dyn common::Delegate,
33031 ) -> AccountContainerWorkspaceUpdateCall<'a, C> {
33032 self._delegate = Some(new_value);
33033 self
33034 }
33035
33036 /// Set any additional parameter of the query string used in the request.
33037 /// It should be used to set parameters which are not yet available through their own
33038 /// setters.
33039 ///
33040 /// Please note that this method must not be used to set any of the known parameters
33041 /// which have their own setter method. If done anyway, the request will fail.
33042 ///
33043 /// # Additional Parameters
33044 ///
33045 /// * *$.xgafv* (query-string) - V1 error format.
33046 /// * *access_token* (query-string) - OAuth access token.
33047 /// * *alt* (query-string) - Data format for response.
33048 /// * *callback* (query-string) - JSONP
33049 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33050 /// * *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.
33051 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33052 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33053 /// * *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.
33054 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33055 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33056 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerWorkspaceUpdateCall<'a, C>
33057 where
33058 T: AsRef<str>,
33059 {
33060 self._additional_params
33061 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33062 self
33063 }
33064
33065 /// Identifies the authorization scope for the method you are building.
33066 ///
33067 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33068 /// [`Scope::EditContainer`].
33069 ///
33070 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33071 /// tokens for more than one scope.
33072 ///
33073 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33074 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33075 /// sufficient, a read-write scope will do as well.
33076 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerWorkspaceUpdateCall<'a, C>
33077 where
33078 St: AsRef<str>,
33079 {
33080 self._scopes.insert(String::from(scope.as_ref()));
33081 self
33082 }
33083 /// Identifies the authorization scope(s) for the method you are building.
33084 ///
33085 /// See [`Self::add_scope()`] for details.
33086 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerWorkspaceUpdateCall<'a, C>
33087 where
33088 I: IntoIterator<Item = St>,
33089 St: AsRef<str>,
33090 {
33091 self._scopes
33092 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33093 self
33094 }
33095
33096 /// Removes all scopes, and no default scope will be used either.
33097 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33098 /// for details).
33099 pub fn clear_scopes(mut self) -> AccountContainerWorkspaceUpdateCall<'a, C> {
33100 self._scopes.clear();
33101 self
33102 }
33103}
33104
33105/// Combines Containers.
33106///
33107/// A builder for the *containers.combine* method supported by a *account* resource.
33108/// It is not used directly, but through a [`AccountMethods`] instance.
33109///
33110/// # Example
33111///
33112/// Instantiate a resource method builder
33113///
33114/// ```test_harness,no_run
33115/// # extern crate hyper;
33116/// # extern crate hyper_rustls;
33117/// # extern crate google_tagmanager2 as tagmanager2;
33118/// # async fn dox() {
33119/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33120///
33121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33122/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33123/// # .with_native_roots()
33124/// # .unwrap()
33125/// # .https_only()
33126/// # .enable_http2()
33127/// # .build();
33128///
33129/// # let executor = hyper_util::rt::TokioExecutor::new();
33130/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33131/// # secret,
33132/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33133/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33134/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33135/// # ),
33136/// # ).build().await.unwrap();
33137///
33138/// # let client = hyper_util::client::legacy::Client::builder(
33139/// # hyper_util::rt::TokioExecutor::new()
33140/// # )
33141/// # .build(
33142/// # hyper_rustls::HttpsConnectorBuilder::new()
33143/// # .with_native_roots()
33144/// # .unwrap()
33145/// # .https_or_http()
33146/// # .enable_http2()
33147/// # .build()
33148/// # );
33149/// # let mut hub = TagManager::new(client, auth);
33150/// // You can configure optional parameters by calling the respective setters at will, and
33151/// // execute the final call using `doit()`.
33152/// // Values shown here are possibly random and not representative !
33153/// let result = hub.accounts().containers_combine("path")
33154/// .setting_source("erat")
33155/// .container_id("sea")
33156/// .allow_user_permission_feature_update(true)
33157/// .doit().await;
33158/// # }
33159/// ```
33160pub struct AccountContainerCombineCall<'a, C>
33161where
33162 C: 'a,
33163{
33164 hub: &'a TagManager<C>,
33165 _path: String,
33166 _setting_source: Option<String>,
33167 _container_id: Option<String>,
33168 _allow_user_permission_feature_update: Option<bool>,
33169 _delegate: Option<&'a mut dyn common::Delegate>,
33170 _additional_params: HashMap<String, String>,
33171 _scopes: BTreeSet<String>,
33172}
33173
33174impl<'a, C> common::CallBuilder for AccountContainerCombineCall<'a, C> {}
33175
33176impl<'a, C> AccountContainerCombineCall<'a, C>
33177where
33178 C: common::Connector,
33179{
33180 /// Perform the operation you have build so far.
33181 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
33182 use std::borrow::Cow;
33183 use std::io::{Read, Seek};
33184
33185 use common::{url::Params, ToParts};
33186 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33187
33188 let mut dd = common::DefaultDelegate;
33189 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33190 dlg.begin(common::MethodInfo {
33191 id: "tagmanager.accounts.containers.combine",
33192 http_method: hyper::Method::POST,
33193 });
33194
33195 for &field in [
33196 "alt",
33197 "path",
33198 "settingSource",
33199 "containerId",
33200 "allowUserPermissionFeatureUpdate",
33201 ]
33202 .iter()
33203 {
33204 if self._additional_params.contains_key(field) {
33205 dlg.finished(false);
33206 return Err(common::Error::FieldClash(field));
33207 }
33208 }
33209
33210 let mut params = Params::with_capacity(6 + self._additional_params.len());
33211 params.push("path", self._path);
33212 if let Some(value) = self._setting_source.as_ref() {
33213 params.push("settingSource", value);
33214 }
33215 if let Some(value) = self._container_id.as_ref() {
33216 params.push("containerId", value);
33217 }
33218 if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
33219 params.push("allowUserPermissionFeatureUpdate", value.to_string());
33220 }
33221
33222 params.extend(self._additional_params.iter());
33223
33224 params.push("alt", "json");
33225 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:combine";
33226 if self._scopes.is_empty() {
33227 self._scopes
33228 .insert(Scope::EditContainer.as_ref().to_string());
33229 }
33230
33231 #[allow(clippy::single_element_loop)]
33232 for &(find_this, param_name) in [("{+path}", "path")].iter() {
33233 url = params.uri_replacement(url, param_name, find_this, true);
33234 }
33235 {
33236 let to_remove = ["path"];
33237 params.remove_params(&to_remove);
33238 }
33239
33240 let url = params.parse_with_url(&url);
33241
33242 loop {
33243 let token = match self
33244 .hub
33245 .auth
33246 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33247 .await
33248 {
33249 Ok(token) => token,
33250 Err(e) => match dlg.token(e) {
33251 Ok(token) => token,
33252 Err(e) => {
33253 dlg.finished(false);
33254 return Err(common::Error::MissingToken(e));
33255 }
33256 },
33257 };
33258 let mut req_result = {
33259 let client = &self.hub.client;
33260 dlg.pre_request();
33261 let mut req_builder = hyper::Request::builder()
33262 .method(hyper::Method::POST)
33263 .uri(url.as_str())
33264 .header(USER_AGENT, self.hub._user_agent.clone());
33265
33266 if let Some(token) = token.as_ref() {
33267 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33268 }
33269
33270 let request = req_builder
33271 .header(CONTENT_LENGTH, 0_u64)
33272 .body(common::to_body::<String>(None));
33273
33274 client.request(request.unwrap()).await
33275 };
33276
33277 match req_result {
33278 Err(err) => {
33279 if let common::Retry::After(d) = dlg.http_error(&err) {
33280 sleep(d).await;
33281 continue;
33282 }
33283 dlg.finished(false);
33284 return Err(common::Error::HttpError(err));
33285 }
33286 Ok(res) => {
33287 let (mut parts, body) = res.into_parts();
33288 let mut body = common::Body::new(body);
33289 if !parts.status.is_success() {
33290 let bytes = common::to_bytes(body).await.unwrap_or_default();
33291 let error = serde_json::from_str(&common::to_string(&bytes));
33292 let response = common::to_response(parts, bytes.into());
33293
33294 if let common::Retry::After(d) =
33295 dlg.http_failure(&response, error.as_ref().ok())
33296 {
33297 sleep(d).await;
33298 continue;
33299 }
33300
33301 dlg.finished(false);
33302
33303 return Err(match error {
33304 Ok(value) => common::Error::BadRequest(value),
33305 _ => common::Error::Failure(response),
33306 });
33307 }
33308 let response = {
33309 let bytes = common::to_bytes(body).await.unwrap_or_default();
33310 let encoded = common::to_string(&bytes);
33311 match serde_json::from_str(&encoded) {
33312 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33313 Err(error) => {
33314 dlg.response_json_decode_error(&encoded, &error);
33315 return Err(common::Error::JsonDecodeError(
33316 encoded.to_string(),
33317 error,
33318 ));
33319 }
33320 }
33321 };
33322
33323 dlg.finished(true);
33324 return Ok(response);
33325 }
33326 }
33327 }
33328 }
33329
33330 /// GTM Container's API relative path.
33331 ///
33332 /// Sets the *path* path property to the given value.
33333 ///
33334 /// Even though the property as already been set when instantiating this call,
33335 /// we provide this method for API completeness.
33336 pub fn path(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
33337 self._path = new_value.to_string();
33338 self
33339 }
33340 /// Specify the source of config setting after combine
33341 ///
33342 /// Sets the *setting source* query property to the given value.
33343 pub fn setting_source(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
33344 self._setting_source = Some(new_value.to_string());
33345 self
33346 }
33347 /// ID of container that will be merged into the current container.
33348 ///
33349 /// Sets the *container id* query property to the given value.
33350 pub fn container_id(mut self, new_value: &str) -> AccountContainerCombineCall<'a, C> {
33351 self._container_id = Some(new_value.to_string());
33352 self
33353 }
33354 /// 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.
33355 ///
33356 /// Sets the *allow user permission feature update* query property to the given value.
33357 pub fn allow_user_permission_feature_update(
33358 mut self,
33359 new_value: bool,
33360 ) -> AccountContainerCombineCall<'a, C> {
33361 self._allow_user_permission_feature_update = Some(new_value);
33362 self
33363 }
33364 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33365 /// while executing the actual API request.
33366 ///
33367 /// ````text
33368 /// It should be used to handle progress information, and to implement a certain level of resilience.
33369 /// ````
33370 ///
33371 /// Sets the *delegate* property to the given value.
33372 pub fn delegate(
33373 mut self,
33374 new_value: &'a mut dyn common::Delegate,
33375 ) -> AccountContainerCombineCall<'a, C> {
33376 self._delegate = Some(new_value);
33377 self
33378 }
33379
33380 /// Set any additional parameter of the query string used in the request.
33381 /// It should be used to set parameters which are not yet available through their own
33382 /// setters.
33383 ///
33384 /// Please note that this method must not be used to set any of the known parameters
33385 /// which have their own setter method. If done anyway, the request will fail.
33386 ///
33387 /// # Additional Parameters
33388 ///
33389 /// * *$.xgafv* (query-string) - V1 error format.
33390 /// * *access_token* (query-string) - OAuth access token.
33391 /// * *alt* (query-string) - Data format for response.
33392 /// * *callback* (query-string) - JSONP
33393 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33394 /// * *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.
33395 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33396 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33397 /// * *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.
33398 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33399 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33400 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerCombineCall<'a, C>
33401 where
33402 T: AsRef<str>,
33403 {
33404 self._additional_params
33405 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33406 self
33407 }
33408
33409 /// Identifies the authorization scope for the method you are building.
33410 ///
33411 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33412 /// [`Scope::EditContainer`].
33413 ///
33414 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33415 /// tokens for more than one scope.
33416 ///
33417 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33418 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33419 /// sufficient, a read-write scope will do as well.
33420 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerCombineCall<'a, C>
33421 where
33422 St: AsRef<str>,
33423 {
33424 self._scopes.insert(String::from(scope.as_ref()));
33425 self
33426 }
33427 /// Identifies the authorization scope(s) for the method you are building.
33428 ///
33429 /// See [`Self::add_scope()`] for details.
33430 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerCombineCall<'a, C>
33431 where
33432 I: IntoIterator<Item = St>,
33433 St: AsRef<str>,
33434 {
33435 self._scopes
33436 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33437 self
33438 }
33439
33440 /// Removes all scopes, and no default scope will be used either.
33441 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33442 /// for details).
33443 pub fn clear_scopes(mut self) -> AccountContainerCombineCall<'a, C> {
33444 self._scopes.clear();
33445 self
33446 }
33447}
33448
33449/// Creates a Container.
33450///
33451/// A builder for the *containers.create* method supported by a *account* resource.
33452/// It is not used directly, but through a [`AccountMethods`] instance.
33453///
33454/// # Example
33455///
33456/// Instantiate a resource method builder
33457///
33458/// ```test_harness,no_run
33459/// # extern crate hyper;
33460/// # extern crate hyper_rustls;
33461/// # extern crate google_tagmanager2 as tagmanager2;
33462/// use tagmanager2::api::Container;
33463/// # async fn dox() {
33464/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33465///
33466/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33467/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33468/// # .with_native_roots()
33469/// # .unwrap()
33470/// # .https_only()
33471/// # .enable_http2()
33472/// # .build();
33473///
33474/// # let executor = hyper_util::rt::TokioExecutor::new();
33475/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33476/// # secret,
33477/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33478/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33479/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33480/// # ),
33481/// # ).build().await.unwrap();
33482///
33483/// # let client = hyper_util::client::legacy::Client::builder(
33484/// # hyper_util::rt::TokioExecutor::new()
33485/// # )
33486/// # .build(
33487/// # hyper_rustls::HttpsConnectorBuilder::new()
33488/// # .with_native_roots()
33489/// # .unwrap()
33490/// # .https_or_http()
33491/// # .enable_http2()
33492/// # .build()
33493/// # );
33494/// # let mut hub = TagManager::new(client, auth);
33495/// // As the method needs a request, you would usually fill it with the desired information
33496/// // into the respective structure. Some of the parts shown here might not be applicable !
33497/// // Values shown here are possibly random and not representative !
33498/// let mut req = Container::default();
33499///
33500/// // You can configure optional parameters by calling the respective setters at will, and
33501/// // execute the final call using `doit()`.
33502/// // Values shown here are possibly random and not representative !
33503/// let result = hub.accounts().containers_create(req, "parent")
33504/// .doit().await;
33505/// # }
33506/// ```
33507pub struct AccountContainerCreateCall<'a, C>
33508where
33509 C: 'a,
33510{
33511 hub: &'a TagManager<C>,
33512 _request: Container,
33513 _parent: String,
33514 _delegate: Option<&'a mut dyn common::Delegate>,
33515 _additional_params: HashMap<String, String>,
33516 _scopes: BTreeSet<String>,
33517}
33518
33519impl<'a, C> common::CallBuilder for AccountContainerCreateCall<'a, C> {}
33520
33521impl<'a, C> AccountContainerCreateCall<'a, C>
33522where
33523 C: common::Connector,
33524{
33525 /// Perform the operation you have build so far.
33526 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
33527 use std::borrow::Cow;
33528 use std::io::{Read, Seek};
33529
33530 use common::{url::Params, ToParts};
33531 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33532
33533 let mut dd = common::DefaultDelegate;
33534 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33535 dlg.begin(common::MethodInfo {
33536 id: "tagmanager.accounts.containers.create",
33537 http_method: hyper::Method::POST,
33538 });
33539
33540 for &field in ["alt", "parent"].iter() {
33541 if self._additional_params.contains_key(field) {
33542 dlg.finished(false);
33543 return Err(common::Error::FieldClash(field));
33544 }
33545 }
33546
33547 let mut params = Params::with_capacity(4 + self._additional_params.len());
33548 params.push("parent", self._parent);
33549
33550 params.extend(self._additional_params.iter());
33551
33552 params.push("alt", "json");
33553 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/containers";
33554 if self._scopes.is_empty() {
33555 self._scopes
33556 .insert(Scope::EditContainer.as_ref().to_string());
33557 }
33558
33559 #[allow(clippy::single_element_loop)]
33560 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
33561 url = params.uri_replacement(url, param_name, find_this, true);
33562 }
33563 {
33564 let to_remove = ["parent"];
33565 params.remove_params(&to_remove);
33566 }
33567
33568 let url = params.parse_with_url(&url);
33569
33570 let mut json_mime_type = mime::APPLICATION_JSON;
33571 let mut request_value_reader = {
33572 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33573 common::remove_json_null_values(&mut value);
33574 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33575 serde_json::to_writer(&mut dst, &value).unwrap();
33576 dst
33577 };
33578 let request_size = request_value_reader
33579 .seek(std::io::SeekFrom::End(0))
33580 .unwrap();
33581 request_value_reader
33582 .seek(std::io::SeekFrom::Start(0))
33583 .unwrap();
33584
33585 loop {
33586 let token = match self
33587 .hub
33588 .auth
33589 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33590 .await
33591 {
33592 Ok(token) => token,
33593 Err(e) => match dlg.token(e) {
33594 Ok(token) => token,
33595 Err(e) => {
33596 dlg.finished(false);
33597 return Err(common::Error::MissingToken(e));
33598 }
33599 },
33600 };
33601 request_value_reader
33602 .seek(std::io::SeekFrom::Start(0))
33603 .unwrap();
33604 let mut req_result = {
33605 let client = &self.hub.client;
33606 dlg.pre_request();
33607 let mut req_builder = hyper::Request::builder()
33608 .method(hyper::Method::POST)
33609 .uri(url.as_str())
33610 .header(USER_AGENT, self.hub._user_agent.clone());
33611
33612 if let Some(token) = token.as_ref() {
33613 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33614 }
33615
33616 let request = req_builder
33617 .header(CONTENT_TYPE, json_mime_type.to_string())
33618 .header(CONTENT_LENGTH, request_size as u64)
33619 .body(common::to_body(
33620 request_value_reader.get_ref().clone().into(),
33621 ));
33622
33623 client.request(request.unwrap()).await
33624 };
33625
33626 match req_result {
33627 Err(err) => {
33628 if let common::Retry::After(d) = dlg.http_error(&err) {
33629 sleep(d).await;
33630 continue;
33631 }
33632 dlg.finished(false);
33633 return Err(common::Error::HttpError(err));
33634 }
33635 Ok(res) => {
33636 let (mut parts, body) = res.into_parts();
33637 let mut body = common::Body::new(body);
33638 if !parts.status.is_success() {
33639 let bytes = common::to_bytes(body).await.unwrap_or_default();
33640 let error = serde_json::from_str(&common::to_string(&bytes));
33641 let response = common::to_response(parts, bytes.into());
33642
33643 if let common::Retry::After(d) =
33644 dlg.http_failure(&response, error.as_ref().ok())
33645 {
33646 sleep(d).await;
33647 continue;
33648 }
33649
33650 dlg.finished(false);
33651
33652 return Err(match error {
33653 Ok(value) => common::Error::BadRequest(value),
33654 _ => common::Error::Failure(response),
33655 });
33656 }
33657 let response = {
33658 let bytes = common::to_bytes(body).await.unwrap_or_default();
33659 let encoded = common::to_string(&bytes);
33660 match serde_json::from_str(&encoded) {
33661 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33662 Err(error) => {
33663 dlg.response_json_decode_error(&encoded, &error);
33664 return Err(common::Error::JsonDecodeError(
33665 encoded.to_string(),
33666 error,
33667 ));
33668 }
33669 }
33670 };
33671
33672 dlg.finished(true);
33673 return Ok(response);
33674 }
33675 }
33676 }
33677 }
33678
33679 ///
33680 /// Sets the *request* property to the given value.
33681 ///
33682 /// Even though the property as already been set when instantiating this call,
33683 /// we provide this method for API completeness.
33684 pub fn request(mut self, new_value: Container) -> AccountContainerCreateCall<'a, C> {
33685 self._request = new_value;
33686 self
33687 }
33688 /// GTM Account's API relative path.
33689 ///
33690 /// Sets the *parent* path property to the given value.
33691 ///
33692 /// Even though the property as already been set when instantiating this call,
33693 /// we provide this method for API completeness.
33694 pub fn parent(mut self, new_value: &str) -> AccountContainerCreateCall<'a, C> {
33695 self._parent = new_value.to_string();
33696 self
33697 }
33698 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33699 /// while executing the actual API request.
33700 ///
33701 /// ````text
33702 /// It should be used to handle progress information, and to implement a certain level of resilience.
33703 /// ````
33704 ///
33705 /// Sets the *delegate* property to the given value.
33706 pub fn delegate(
33707 mut self,
33708 new_value: &'a mut dyn common::Delegate,
33709 ) -> AccountContainerCreateCall<'a, C> {
33710 self._delegate = Some(new_value);
33711 self
33712 }
33713
33714 /// Set any additional parameter of the query string used in the request.
33715 /// It should be used to set parameters which are not yet available through their own
33716 /// setters.
33717 ///
33718 /// Please note that this method must not be used to set any of the known parameters
33719 /// which have their own setter method. If done anyway, the request will fail.
33720 ///
33721 /// # Additional Parameters
33722 ///
33723 /// * *$.xgafv* (query-string) - V1 error format.
33724 /// * *access_token* (query-string) - OAuth access token.
33725 /// * *alt* (query-string) - Data format for response.
33726 /// * *callback* (query-string) - JSONP
33727 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33728 /// * *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.
33729 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33730 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33731 /// * *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.
33732 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33733 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33734 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerCreateCall<'a, C>
33735 where
33736 T: AsRef<str>,
33737 {
33738 self._additional_params
33739 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33740 self
33741 }
33742
33743 /// Identifies the authorization scope for the method you are building.
33744 ///
33745 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33746 /// [`Scope::EditContainer`].
33747 ///
33748 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33749 /// tokens for more than one scope.
33750 ///
33751 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33752 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33753 /// sufficient, a read-write scope will do as well.
33754 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerCreateCall<'a, C>
33755 where
33756 St: AsRef<str>,
33757 {
33758 self._scopes.insert(String::from(scope.as_ref()));
33759 self
33760 }
33761 /// Identifies the authorization scope(s) for the method you are building.
33762 ///
33763 /// See [`Self::add_scope()`] for details.
33764 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerCreateCall<'a, C>
33765 where
33766 I: IntoIterator<Item = St>,
33767 St: AsRef<str>,
33768 {
33769 self._scopes
33770 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33771 self
33772 }
33773
33774 /// Removes all scopes, and no default scope will be used either.
33775 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33776 /// for details).
33777 pub fn clear_scopes(mut self) -> AccountContainerCreateCall<'a, C> {
33778 self._scopes.clear();
33779 self
33780 }
33781}
33782
33783/// Deletes a Container.
33784///
33785/// A builder for the *containers.delete* method supported by a *account* resource.
33786/// It is not used directly, but through a [`AccountMethods`] instance.
33787///
33788/// # Example
33789///
33790/// Instantiate a resource method builder
33791///
33792/// ```test_harness,no_run
33793/// # extern crate hyper;
33794/// # extern crate hyper_rustls;
33795/// # extern crate google_tagmanager2 as tagmanager2;
33796/// # async fn dox() {
33797/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33798///
33799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33801/// # .with_native_roots()
33802/// # .unwrap()
33803/// # .https_only()
33804/// # .enable_http2()
33805/// # .build();
33806///
33807/// # let executor = hyper_util::rt::TokioExecutor::new();
33808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33809/// # secret,
33810/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33811/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33812/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33813/// # ),
33814/// # ).build().await.unwrap();
33815///
33816/// # let client = hyper_util::client::legacy::Client::builder(
33817/// # hyper_util::rt::TokioExecutor::new()
33818/// # )
33819/// # .build(
33820/// # hyper_rustls::HttpsConnectorBuilder::new()
33821/// # .with_native_roots()
33822/// # .unwrap()
33823/// # .https_or_http()
33824/// # .enable_http2()
33825/// # .build()
33826/// # );
33827/// # let mut hub = TagManager::new(client, auth);
33828/// // You can configure optional parameters by calling the respective setters at will, and
33829/// // execute the final call using `doit()`.
33830/// // Values shown here are possibly random and not representative !
33831/// let result = hub.accounts().containers_delete("path")
33832/// .doit().await;
33833/// # }
33834/// ```
33835pub struct AccountContainerDeleteCall<'a, C>
33836where
33837 C: 'a,
33838{
33839 hub: &'a TagManager<C>,
33840 _path: String,
33841 _delegate: Option<&'a mut dyn common::Delegate>,
33842 _additional_params: HashMap<String, String>,
33843 _scopes: BTreeSet<String>,
33844}
33845
33846impl<'a, C> common::CallBuilder for AccountContainerDeleteCall<'a, C> {}
33847
33848impl<'a, C> AccountContainerDeleteCall<'a, C>
33849where
33850 C: common::Connector,
33851{
33852 /// Perform the operation you have build so far.
33853 pub async fn doit(mut self) -> common::Result<common::Response> {
33854 use std::borrow::Cow;
33855 use std::io::{Read, Seek};
33856
33857 use common::{url::Params, ToParts};
33858 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33859
33860 let mut dd = common::DefaultDelegate;
33861 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33862 dlg.begin(common::MethodInfo {
33863 id: "tagmanager.accounts.containers.delete",
33864 http_method: hyper::Method::DELETE,
33865 });
33866
33867 for &field in ["path"].iter() {
33868 if self._additional_params.contains_key(field) {
33869 dlg.finished(false);
33870 return Err(common::Error::FieldClash(field));
33871 }
33872 }
33873
33874 let mut params = Params::with_capacity(2 + self._additional_params.len());
33875 params.push("path", self._path);
33876
33877 params.extend(self._additional_params.iter());
33878
33879 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
33880 if self._scopes.is_empty() {
33881 self._scopes
33882 .insert(Scope::DeleteContainer.as_ref().to_string());
33883 }
33884
33885 #[allow(clippy::single_element_loop)]
33886 for &(find_this, param_name) in [("{+path}", "path")].iter() {
33887 url = params.uri_replacement(url, param_name, find_this, true);
33888 }
33889 {
33890 let to_remove = ["path"];
33891 params.remove_params(&to_remove);
33892 }
33893
33894 let url = params.parse_with_url(&url);
33895
33896 loop {
33897 let token = match self
33898 .hub
33899 .auth
33900 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33901 .await
33902 {
33903 Ok(token) => token,
33904 Err(e) => match dlg.token(e) {
33905 Ok(token) => token,
33906 Err(e) => {
33907 dlg.finished(false);
33908 return Err(common::Error::MissingToken(e));
33909 }
33910 },
33911 };
33912 let mut req_result = {
33913 let client = &self.hub.client;
33914 dlg.pre_request();
33915 let mut req_builder = hyper::Request::builder()
33916 .method(hyper::Method::DELETE)
33917 .uri(url.as_str())
33918 .header(USER_AGENT, self.hub._user_agent.clone());
33919
33920 if let Some(token) = token.as_ref() {
33921 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33922 }
33923
33924 let request = req_builder
33925 .header(CONTENT_LENGTH, 0_u64)
33926 .body(common::to_body::<String>(None));
33927
33928 client.request(request.unwrap()).await
33929 };
33930
33931 match req_result {
33932 Err(err) => {
33933 if let common::Retry::After(d) = dlg.http_error(&err) {
33934 sleep(d).await;
33935 continue;
33936 }
33937 dlg.finished(false);
33938 return Err(common::Error::HttpError(err));
33939 }
33940 Ok(res) => {
33941 let (mut parts, body) = res.into_parts();
33942 let mut body = common::Body::new(body);
33943 if !parts.status.is_success() {
33944 let bytes = common::to_bytes(body).await.unwrap_or_default();
33945 let error = serde_json::from_str(&common::to_string(&bytes));
33946 let response = common::to_response(parts, bytes.into());
33947
33948 if let common::Retry::After(d) =
33949 dlg.http_failure(&response, error.as_ref().ok())
33950 {
33951 sleep(d).await;
33952 continue;
33953 }
33954
33955 dlg.finished(false);
33956
33957 return Err(match error {
33958 Ok(value) => common::Error::BadRequest(value),
33959 _ => common::Error::Failure(response),
33960 });
33961 }
33962 let response = common::Response::from_parts(parts, body);
33963
33964 dlg.finished(true);
33965 return Ok(response);
33966 }
33967 }
33968 }
33969 }
33970
33971 /// GTM Container's API relative path.
33972 ///
33973 /// Sets the *path* path property to the given value.
33974 ///
33975 /// Even though the property as already been set when instantiating this call,
33976 /// we provide this method for API completeness.
33977 pub fn path(mut self, new_value: &str) -> AccountContainerDeleteCall<'a, C> {
33978 self._path = new_value.to_string();
33979 self
33980 }
33981 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33982 /// while executing the actual API request.
33983 ///
33984 /// ````text
33985 /// It should be used to handle progress information, and to implement a certain level of resilience.
33986 /// ````
33987 ///
33988 /// Sets the *delegate* property to the given value.
33989 pub fn delegate(
33990 mut self,
33991 new_value: &'a mut dyn common::Delegate,
33992 ) -> AccountContainerDeleteCall<'a, C> {
33993 self._delegate = Some(new_value);
33994 self
33995 }
33996
33997 /// Set any additional parameter of the query string used in the request.
33998 /// It should be used to set parameters which are not yet available through their own
33999 /// setters.
34000 ///
34001 /// Please note that this method must not be used to set any of the known parameters
34002 /// which have their own setter method. If done anyway, the request will fail.
34003 ///
34004 /// # Additional Parameters
34005 ///
34006 /// * *$.xgafv* (query-string) - V1 error format.
34007 /// * *access_token* (query-string) - OAuth access token.
34008 /// * *alt* (query-string) - Data format for response.
34009 /// * *callback* (query-string) - JSONP
34010 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34011 /// * *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.
34012 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34013 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34014 /// * *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.
34015 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34016 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34017 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerDeleteCall<'a, C>
34018 where
34019 T: AsRef<str>,
34020 {
34021 self._additional_params
34022 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34023 self
34024 }
34025
34026 /// Identifies the authorization scope for the method you are building.
34027 ///
34028 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34029 /// [`Scope::DeleteContainer`].
34030 ///
34031 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34032 /// tokens for more than one scope.
34033 ///
34034 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34035 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34036 /// sufficient, a read-write scope will do as well.
34037 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerDeleteCall<'a, C>
34038 where
34039 St: AsRef<str>,
34040 {
34041 self._scopes.insert(String::from(scope.as_ref()));
34042 self
34043 }
34044 /// Identifies the authorization scope(s) for the method you are building.
34045 ///
34046 /// See [`Self::add_scope()`] for details.
34047 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerDeleteCall<'a, C>
34048 where
34049 I: IntoIterator<Item = St>,
34050 St: AsRef<str>,
34051 {
34052 self._scopes
34053 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34054 self
34055 }
34056
34057 /// Removes all scopes, and no default scope will be used either.
34058 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34059 /// for details).
34060 pub fn clear_scopes(mut self) -> AccountContainerDeleteCall<'a, C> {
34061 self._scopes.clear();
34062 self
34063 }
34064}
34065
34066/// Gets a Container.
34067///
34068/// A builder for the *containers.get* method supported by a *account* resource.
34069/// It is not used directly, but through a [`AccountMethods`] instance.
34070///
34071/// # Example
34072///
34073/// Instantiate a resource method builder
34074///
34075/// ```test_harness,no_run
34076/// # extern crate hyper;
34077/// # extern crate hyper_rustls;
34078/// # extern crate google_tagmanager2 as tagmanager2;
34079/// # async fn dox() {
34080/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34081///
34082/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34083/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34084/// # .with_native_roots()
34085/// # .unwrap()
34086/// # .https_only()
34087/// # .enable_http2()
34088/// # .build();
34089///
34090/// # let executor = hyper_util::rt::TokioExecutor::new();
34091/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34092/// # secret,
34093/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34094/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34095/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34096/// # ),
34097/// # ).build().await.unwrap();
34098///
34099/// # let client = hyper_util::client::legacy::Client::builder(
34100/// # hyper_util::rt::TokioExecutor::new()
34101/// # )
34102/// # .build(
34103/// # hyper_rustls::HttpsConnectorBuilder::new()
34104/// # .with_native_roots()
34105/// # .unwrap()
34106/// # .https_or_http()
34107/// # .enable_http2()
34108/// # .build()
34109/// # );
34110/// # let mut hub = TagManager::new(client, auth);
34111/// // You can configure optional parameters by calling the respective setters at will, and
34112/// // execute the final call using `doit()`.
34113/// // Values shown here are possibly random and not representative !
34114/// let result = hub.accounts().containers_get("path")
34115/// .doit().await;
34116/// # }
34117/// ```
34118pub struct AccountContainerGetCall<'a, C>
34119where
34120 C: 'a,
34121{
34122 hub: &'a TagManager<C>,
34123 _path: String,
34124 _delegate: Option<&'a mut dyn common::Delegate>,
34125 _additional_params: HashMap<String, String>,
34126 _scopes: BTreeSet<String>,
34127}
34128
34129impl<'a, C> common::CallBuilder for AccountContainerGetCall<'a, C> {}
34130
34131impl<'a, C> AccountContainerGetCall<'a, C>
34132where
34133 C: common::Connector,
34134{
34135 /// Perform the operation you have build so far.
34136 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
34137 use std::borrow::Cow;
34138 use std::io::{Read, Seek};
34139
34140 use common::{url::Params, ToParts};
34141 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34142
34143 let mut dd = common::DefaultDelegate;
34144 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34145 dlg.begin(common::MethodInfo {
34146 id: "tagmanager.accounts.containers.get",
34147 http_method: hyper::Method::GET,
34148 });
34149
34150 for &field in ["alt", "path"].iter() {
34151 if self._additional_params.contains_key(field) {
34152 dlg.finished(false);
34153 return Err(common::Error::FieldClash(field));
34154 }
34155 }
34156
34157 let mut params = Params::with_capacity(3 + self._additional_params.len());
34158 params.push("path", self._path);
34159
34160 params.extend(self._additional_params.iter());
34161
34162 params.push("alt", "json");
34163 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
34164 if self._scopes.is_empty() {
34165 self._scopes.insert(Scope::Readonly.as_ref().to_string());
34166 }
34167
34168 #[allow(clippy::single_element_loop)]
34169 for &(find_this, param_name) in [("{+path}", "path")].iter() {
34170 url = params.uri_replacement(url, param_name, find_this, true);
34171 }
34172 {
34173 let to_remove = ["path"];
34174 params.remove_params(&to_remove);
34175 }
34176
34177 let url = params.parse_with_url(&url);
34178
34179 loop {
34180 let token = match self
34181 .hub
34182 .auth
34183 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34184 .await
34185 {
34186 Ok(token) => token,
34187 Err(e) => match dlg.token(e) {
34188 Ok(token) => token,
34189 Err(e) => {
34190 dlg.finished(false);
34191 return Err(common::Error::MissingToken(e));
34192 }
34193 },
34194 };
34195 let mut req_result = {
34196 let client = &self.hub.client;
34197 dlg.pre_request();
34198 let mut req_builder = hyper::Request::builder()
34199 .method(hyper::Method::GET)
34200 .uri(url.as_str())
34201 .header(USER_AGENT, self.hub._user_agent.clone());
34202
34203 if let Some(token) = token.as_ref() {
34204 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34205 }
34206
34207 let request = req_builder
34208 .header(CONTENT_LENGTH, 0_u64)
34209 .body(common::to_body::<String>(None));
34210
34211 client.request(request.unwrap()).await
34212 };
34213
34214 match req_result {
34215 Err(err) => {
34216 if let common::Retry::After(d) = dlg.http_error(&err) {
34217 sleep(d).await;
34218 continue;
34219 }
34220 dlg.finished(false);
34221 return Err(common::Error::HttpError(err));
34222 }
34223 Ok(res) => {
34224 let (mut parts, body) = res.into_parts();
34225 let mut body = common::Body::new(body);
34226 if !parts.status.is_success() {
34227 let bytes = common::to_bytes(body).await.unwrap_or_default();
34228 let error = serde_json::from_str(&common::to_string(&bytes));
34229 let response = common::to_response(parts, bytes.into());
34230
34231 if let common::Retry::After(d) =
34232 dlg.http_failure(&response, error.as_ref().ok())
34233 {
34234 sleep(d).await;
34235 continue;
34236 }
34237
34238 dlg.finished(false);
34239
34240 return Err(match error {
34241 Ok(value) => common::Error::BadRequest(value),
34242 _ => common::Error::Failure(response),
34243 });
34244 }
34245 let response = {
34246 let bytes = common::to_bytes(body).await.unwrap_or_default();
34247 let encoded = common::to_string(&bytes);
34248 match serde_json::from_str(&encoded) {
34249 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34250 Err(error) => {
34251 dlg.response_json_decode_error(&encoded, &error);
34252 return Err(common::Error::JsonDecodeError(
34253 encoded.to_string(),
34254 error,
34255 ));
34256 }
34257 }
34258 };
34259
34260 dlg.finished(true);
34261 return Ok(response);
34262 }
34263 }
34264 }
34265 }
34266
34267 /// GTM Container's API relative path.
34268 ///
34269 /// Sets the *path* path property to the given value.
34270 ///
34271 /// Even though the property as already been set when instantiating this call,
34272 /// we provide this method for API completeness.
34273 pub fn path(mut self, new_value: &str) -> AccountContainerGetCall<'a, C> {
34274 self._path = new_value.to_string();
34275 self
34276 }
34277 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34278 /// while executing the actual API request.
34279 ///
34280 /// ````text
34281 /// It should be used to handle progress information, and to implement a certain level of resilience.
34282 /// ````
34283 ///
34284 /// Sets the *delegate* property to the given value.
34285 pub fn delegate(
34286 mut self,
34287 new_value: &'a mut dyn common::Delegate,
34288 ) -> AccountContainerGetCall<'a, C> {
34289 self._delegate = Some(new_value);
34290 self
34291 }
34292
34293 /// Set any additional parameter of the query string used in the request.
34294 /// It should be used to set parameters which are not yet available through their own
34295 /// setters.
34296 ///
34297 /// Please note that this method must not be used to set any of the known parameters
34298 /// which have their own setter method. If done anyway, the request will fail.
34299 ///
34300 /// # Additional Parameters
34301 ///
34302 /// * *$.xgafv* (query-string) - V1 error format.
34303 /// * *access_token* (query-string) - OAuth access token.
34304 /// * *alt* (query-string) - Data format for response.
34305 /// * *callback* (query-string) - JSONP
34306 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34307 /// * *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.
34308 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34309 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34310 /// * *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.
34311 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34312 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34313 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerGetCall<'a, C>
34314 where
34315 T: AsRef<str>,
34316 {
34317 self._additional_params
34318 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34319 self
34320 }
34321
34322 /// Identifies the authorization scope for the method you are building.
34323 ///
34324 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34325 /// [`Scope::Readonly`].
34326 ///
34327 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34328 /// tokens for more than one scope.
34329 ///
34330 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34331 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34332 /// sufficient, a read-write scope will do as well.
34333 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerGetCall<'a, C>
34334 where
34335 St: AsRef<str>,
34336 {
34337 self._scopes.insert(String::from(scope.as_ref()));
34338 self
34339 }
34340 /// Identifies the authorization scope(s) for the method you are building.
34341 ///
34342 /// See [`Self::add_scope()`] for details.
34343 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerGetCall<'a, C>
34344 where
34345 I: IntoIterator<Item = St>,
34346 St: AsRef<str>,
34347 {
34348 self._scopes
34349 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34350 self
34351 }
34352
34353 /// Removes all scopes, and no default scope will be used either.
34354 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34355 /// for details).
34356 pub fn clear_scopes(mut self) -> AccountContainerGetCall<'a, C> {
34357 self._scopes.clear();
34358 self
34359 }
34360}
34361
34362/// Lists all Containers that belongs to a GTM Account.
34363///
34364/// A builder for the *containers.list* method supported by a *account* resource.
34365/// It is not used directly, but through a [`AccountMethods`] instance.
34366///
34367/// # Example
34368///
34369/// Instantiate a resource method builder
34370///
34371/// ```test_harness,no_run
34372/// # extern crate hyper;
34373/// # extern crate hyper_rustls;
34374/// # extern crate google_tagmanager2 as tagmanager2;
34375/// # async fn dox() {
34376/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34377///
34378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34379/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34380/// # .with_native_roots()
34381/// # .unwrap()
34382/// # .https_only()
34383/// # .enable_http2()
34384/// # .build();
34385///
34386/// # let executor = hyper_util::rt::TokioExecutor::new();
34387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34388/// # secret,
34389/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34390/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34391/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34392/// # ),
34393/// # ).build().await.unwrap();
34394///
34395/// # let client = hyper_util::client::legacy::Client::builder(
34396/// # hyper_util::rt::TokioExecutor::new()
34397/// # )
34398/// # .build(
34399/// # hyper_rustls::HttpsConnectorBuilder::new()
34400/// # .with_native_roots()
34401/// # .unwrap()
34402/// # .https_or_http()
34403/// # .enable_http2()
34404/// # .build()
34405/// # );
34406/// # let mut hub = TagManager::new(client, auth);
34407/// // You can configure optional parameters by calling the respective setters at will, and
34408/// // execute the final call using `doit()`.
34409/// // Values shown here are possibly random and not representative !
34410/// let result = hub.accounts().containers_list("parent")
34411/// .page_token("consetetur")
34412/// .doit().await;
34413/// # }
34414/// ```
34415pub struct AccountContainerListCall<'a, C>
34416where
34417 C: 'a,
34418{
34419 hub: &'a TagManager<C>,
34420 _parent: String,
34421 _page_token: Option<String>,
34422 _delegate: Option<&'a mut dyn common::Delegate>,
34423 _additional_params: HashMap<String, String>,
34424 _scopes: BTreeSet<String>,
34425}
34426
34427impl<'a, C> common::CallBuilder for AccountContainerListCall<'a, C> {}
34428
34429impl<'a, C> AccountContainerListCall<'a, C>
34430where
34431 C: common::Connector,
34432{
34433 /// Perform the operation you have build so far.
34434 pub async fn doit(mut self) -> common::Result<(common::Response, ListContainersResponse)> {
34435 use std::borrow::Cow;
34436 use std::io::{Read, Seek};
34437
34438 use common::{url::Params, ToParts};
34439 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34440
34441 let mut dd = common::DefaultDelegate;
34442 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34443 dlg.begin(common::MethodInfo {
34444 id: "tagmanager.accounts.containers.list",
34445 http_method: hyper::Method::GET,
34446 });
34447
34448 for &field in ["alt", "parent", "pageToken"].iter() {
34449 if self._additional_params.contains_key(field) {
34450 dlg.finished(false);
34451 return Err(common::Error::FieldClash(field));
34452 }
34453 }
34454
34455 let mut params = Params::with_capacity(4 + self._additional_params.len());
34456 params.push("parent", self._parent);
34457 if let Some(value) = self._page_token.as_ref() {
34458 params.push("pageToken", value);
34459 }
34460
34461 params.extend(self._additional_params.iter());
34462
34463 params.push("alt", "json");
34464 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/containers";
34465 if self._scopes.is_empty() {
34466 self._scopes.insert(Scope::Readonly.as_ref().to_string());
34467 }
34468
34469 #[allow(clippy::single_element_loop)]
34470 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
34471 url = params.uri_replacement(url, param_name, find_this, true);
34472 }
34473 {
34474 let to_remove = ["parent"];
34475 params.remove_params(&to_remove);
34476 }
34477
34478 let url = params.parse_with_url(&url);
34479
34480 loop {
34481 let token = match self
34482 .hub
34483 .auth
34484 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34485 .await
34486 {
34487 Ok(token) => token,
34488 Err(e) => match dlg.token(e) {
34489 Ok(token) => token,
34490 Err(e) => {
34491 dlg.finished(false);
34492 return Err(common::Error::MissingToken(e));
34493 }
34494 },
34495 };
34496 let mut req_result = {
34497 let client = &self.hub.client;
34498 dlg.pre_request();
34499 let mut req_builder = hyper::Request::builder()
34500 .method(hyper::Method::GET)
34501 .uri(url.as_str())
34502 .header(USER_AGENT, self.hub._user_agent.clone());
34503
34504 if let Some(token) = token.as_ref() {
34505 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34506 }
34507
34508 let request = req_builder
34509 .header(CONTENT_LENGTH, 0_u64)
34510 .body(common::to_body::<String>(None));
34511
34512 client.request(request.unwrap()).await
34513 };
34514
34515 match req_result {
34516 Err(err) => {
34517 if let common::Retry::After(d) = dlg.http_error(&err) {
34518 sleep(d).await;
34519 continue;
34520 }
34521 dlg.finished(false);
34522 return Err(common::Error::HttpError(err));
34523 }
34524 Ok(res) => {
34525 let (mut parts, body) = res.into_parts();
34526 let mut body = common::Body::new(body);
34527 if !parts.status.is_success() {
34528 let bytes = common::to_bytes(body).await.unwrap_or_default();
34529 let error = serde_json::from_str(&common::to_string(&bytes));
34530 let response = common::to_response(parts, bytes.into());
34531
34532 if let common::Retry::After(d) =
34533 dlg.http_failure(&response, error.as_ref().ok())
34534 {
34535 sleep(d).await;
34536 continue;
34537 }
34538
34539 dlg.finished(false);
34540
34541 return Err(match error {
34542 Ok(value) => common::Error::BadRequest(value),
34543 _ => common::Error::Failure(response),
34544 });
34545 }
34546 let response = {
34547 let bytes = common::to_bytes(body).await.unwrap_or_default();
34548 let encoded = common::to_string(&bytes);
34549 match serde_json::from_str(&encoded) {
34550 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34551 Err(error) => {
34552 dlg.response_json_decode_error(&encoded, &error);
34553 return Err(common::Error::JsonDecodeError(
34554 encoded.to_string(),
34555 error,
34556 ));
34557 }
34558 }
34559 };
34560
34561 dlg.finished(true);
34562 return Ok(response);
34563 }
34564 }
34565 }
34566 }
34567
34568 /// GTM Account's API relative path.
34569 ///
34570 /// Sets the *parent* path property to the given value.
34571 ///
34572 /// Even though the property as already been set when instantiating this call,
34573 /// we provide this method for API completeness.
34574 pub fn parent(mut self, new_value: &str) -> AccountContainerListCall<'a, C> {
34575 self._parent = new_value.to_string();
34576 self
34577 }
34578 /// Continuation token for fetching the next page of results.
34579 ///
34580 /// Sets the *page token* query property to the given value.
34581 pub fn page_token(mut self, new_value: &str) -> AccountContainerListCall<'a, C> {
34582 self._page_token = Some(new_value.to_string());
34583 self
34584 }
34585 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34586 /// while executing the actual API request.
34587 ///
34588 /// ````text
34589 /// It should be used to handle progress information, and to implement a certain level of resilience.
34590 /// ````
34591 ///
34592 /// Sets the *delegate* property to the given value.
34593 pub fn delegate(
34594 mut self,
34595 new_value: &'a mut dyn common::Delegate,
34596 ) -> AccountContainerListCall<'a, C> {
34597 self._delegate = Some(new_value);
34598 self
34599 }
34600
34601 /// Set any additional parameter of the query string used in the request.
34602 /// It should be used to set parameters which are not yet available through their own
34603 /// setters.
34604 ///
34605 /// Please note that this method must not be used to set any of the known parameters
34606 /// which have their own setter method. If done anyway, the request will fail.
34607 ///
34608 /// # Additional Parameters
34609 ///
34610 /// * *$.xgafv* (query-string) - V1 error format.
34611 /// * *access_token* (query-string) - OAuth access token.
34612 /// * *alt* (query-string) - Data format for response.
34613 /// * *callback* (query-string) - JSONP
34614 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34615 /// * *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.
34616 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34617 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34618 /// * *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.
34619 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34620 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34621 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerListCall<'a, C>
34622 where
34623 T: AsRef<str>,
34624 {
34625 self._additional_params
34626 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34627 self
34628 }
34629
34630 /// Identifies the authorization scope for the method you are building.
34631 ///
34632 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34633 /// [`Scope::Readonly`].
34634 ///
34635 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34636 /// tokens for more than one scope.
34637 ///
34638 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34639 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34640 /// sufficient, a read-write scope will do as well.
34641 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerListCall<'a, C>
34642 where
34643 St: AsRef<str>,
34644 {
34645 self._scopes.insert(String::from(scope.as_ref()));
34646 self
34647 }
34648 /// Identifies the authorization scope(s) for the method you are building.
34649 ///
34650 /// See [`Self::add_scope()`] for details.
34651 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerListCall<'a, C>
34652 where
34653 I: IntoIterator<Item = St>,
34654 St: AsRef<str>,
34655 {
34656 self._scopes
34657 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34658 self
34659 }
34660
34661 /// Removes all scopes, and no default scope will be used either.
34662 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34663 /// for details).
34664 pub fn clear_scopes(mut self) -> AccountContainerListCall<'a, C> {
34665 self._scopes.clear();
34666 self
34667 }
34668}
34669
34670/// Looks up a Container by destination ID or tag ID.
34671///
34672/// A builder for the *containers.lookup* method supported by a *account* resource.
34673/// It is not used directly, but through a [`AccountMethods`] instance.
34674///
34675/// # Example
34676///
34677/// Instantiate a resource method builder
34678///
34679/// ```test_harness,no_run
34680/// # extern crate hyper;
34681/// # extern crate hyper_rustls;
34682/// # extern crate google_tagmanager2 as tagmanager2;
34683/// # async fn dox() {
34684/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34685///
34686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34688/// # .with_native_roots()
34689/// # .unwrap()
34690/// # .https_only()
34691/// # .enable_http2()
34692/// # .build();
34693///
34694/// # let executor = hyper_util::rt::TokioExecutor::new();
34695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34696/// # secret,
34697/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34698/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34699/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34700/// # ),
34701/// # ).build().await.unwrap();
34702///
34703/// # let client = hyper_util::client::legacy::Client::builder(
34704/// # hyper_util::rt::TokioExecutor::new()
34705/// # )
34706/// # .build(
34707/// # hyper_rustls::HttpsConnectorBuilder::new()
34708/// # .with_native_roots()
34709/// # .unwrap()
34710/// # .https_or_http()
34711/// # .enable_http2()
34712/// # .build()
34713/// # );
34714/// # let mut hub = TagManager::new(client, auth);
34715/// // You can configure optional parameters by calling the respective setters at will, and
34716/// // execute the final call using `doit()`.
34717/// // Values shown here are possibly random and not representative !
34718/// let result = hub.accounts().containers_lookup()
34719/// .tag_id("sit")
34720/// .destination_id("aliquyam")
34721/// .doit().await;
34722/// # }
34723/// ```
34724pub struct AccountContainerLookupCall<'a, C>
34725where
34726 C: 'a,
34727{
34728 hub: &'a TagManager<C>,
34729 _tag_id: Option<String>,
34730 _destination_id: Option<String>,
34731 _delegate: Option<&'a mut dyn common::Delegate>,
34732 _additional_params: HashMap<String, String>,
34733 _scopes: BTreeSet<String>,
34734}
34735
34736impl<'a, C> common::CallBuilder for AccountContainerLookupCall<'a, C> {}
34737
34738impl<'a, C> AccountContainerLookupCall<'a, C>
34739where
34740 C: common::Connector,
34741{
34742 /// Perform the operation you have build so far.
34743 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
34744 use std::borrow::Cow;
34745 use std::io::{Read, Seek};
34746
34747 use common::{url::Params, ToParts};
34748 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34749
34750 let mut dd = common::DefaultDelegate;
34751 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34752 dlg.begin(common::MethodInfo {
34753 id: "tagmanager.accounts.containers.lookup",
34754 http_method: hyper::Method::GET,
34755 });
34756
34757 for &field in ["alt", "tagId", "destinationId"].iter() {
34758 if self._additional_params.contains_key(field) {
34759 dlg.finished(false);
34760 return Err(common::Error::FieldClash(field));
34761 }
34762 }
34763
34764 let mut params = Params::with_capacity(4 + self._additional_params.len());
34765 if let Some(value) = self._tag_id.as_ref() {
34766 params.push("tagId", value);
34767 }
34768 if let Some(value) = self._destination_id.as_ref() {
34769 params.push("destinationId", value);
34770 }
34771
34772 params.extend(self._additional_params.iter());
34773
34774 params.push("alt", "json");
34775 let mut url = self.hub._base_url.clone() + "tagmanager/v2/accounts/containers:lookup";
34776 if self._scopes.is_empty() {
34777 self._scopes.insert(Scope::Readonly.as_ref().to_string());
34778 }
34779
34780 let url = params.parse_with_url(&url);
34781
34782 loop {
34783 let token = match self
34784 .hub
34785 .auth
34786 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34787 .await
34788 {
34789 Ok(token) => token,
34790 Err(e) => match dlg.token(e) {
34791 Ok(token) => token,
34792 Err(e) => {
34793 dlg.finished(false);
34794 return Err(common::Error::MissingToken(e));
34795 }
34796 },
34797 };
34798 let mut req_result = {
34799 let client = &self.hub.client;
34800 dlg.pre_request();
34801 let mut req_builder = hyper::Request::builder()
34802 .method(hyper::Method::GET)
34803 .uri(url.as_str())
34804 .header(USER_AGENT, self.hub._user_agent.clone());
34805
34806 if let Some(token) = token.as_ref() {
34807 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34808 }
34809
34810 let request = req_builder
34811 .header(CONTENT_LENGTH, 0_u64)
34812 .body(common::to_body::<String>(None));
34813
34814 client.request(request.unwrap()).await
34815 };
34816
34817 match req_result {
34818 Err(err) => {
34819 if let common::Retry::After(d) = dlg.http_error(&err) {
34820 sleep(d).await;
34821 continue;
34822 }
34823 dlg.finished(false);
34824 return Err(common::Error::HttpError(err));
34825 }
34826 Ok(res) => {
34827 let (mut parts, body) = res.into_parts();
34828 let mut body = common::Body::new(body);
34829 if !parts.status.is_success() {
34830 let bytes = common::to_bytes(body).await.unwrap_or_default();
34831 let error = serde_json::from_str(&common::to_string(&bytes));
34832 let response = common::to_response(parts, bytes.into());
34833
34834 if let common::Retry::After(d) =
34835 dlg.http_failure(&response, error.as_ref().ok())
34836 {
34837 sleep(d).await;
34838 continue;
34839 }
34840
34841 dlg.finished(false);
34842
34843 return Err(match error {
34844 Ok(value) => common::Error::BadRequest(value),
34845 _ => common::Error::Failure(response),
34846 });
34847 }
34848 let response = {
34849 let bytes = common::to_bytes(body).await.unwrap_or_default();
34850 let encoded = common::to_string(&bytes);
34851 match serde_json::from_str(&encoded) {
34852 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34853 Err(error) => {
34854 dlg.response_json_decode_error(&encoded, &error);
34855 return Err(common::Error::JsonDecodeError(
34856 encoded.to_string(),
34857 error,
34858 ));
34859 }
34860 }
34861 };
34862
34863 dlg.finished(true);
34864 return Ok(response);
34865 }
34866 }
34867 }
34868 }
34869
34870 /// Tag ID for a GTM Container, e.g. GTM-123456789. Only one of destination_id or tag_id should be set.
34871 ///
34872 /// Sets the *tag id* query property to the given value.
34873 pub fn tag_id(mut self, new_value: &str) -> AccountContainerLookupCall<'a, C> {
34874 self._tag_id = Some(new_value.to_string());
34875 self
34876 }
34877 /// Destination ID linked to a GTM Container, e.g. AW-123456789. Only one of destination_id or tag_id should be set.
34878 ///
34879 /// Sets the *destination id* query property to the given value.
34880 pub fn destination_id(mut self, new_value: &str) -> AccountContainerLookupCall<'a, C> {
34881 self._destination_id = Some(new_value.to_string());
34882 self
34883 }
34884 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34885 /// while executing the actual API request.
34886 ///
34887 /// ````text
34888 /// It should be used to handle progress information, and to implement a certain level of resilience.
34889 /// ````
34890 ///
34891 /// Sets the *delegate* property to the given value.
34892 pub fn delegate(
34893 mut self,
34894 new_value: &'a mut dyn common::Delegate,
34895 ) -> AccountContainerLookupCall<'a, C> {
34896 self._delegate = Some(new_value);
34897 self
34898 }
34899
34900 /// Set any additional parameter of the query string used in the request.
34901 /// It should be used to set parameters which are not yet available through their own
34902 /// setters.
34903 ///
34904 /// Please note that this method must not be used to set any of the known parameters
34905 /// which have their own setter method. If done anyway, the request will fail.
34906 ///
34907 /// # Additional Parameters
34908 ///
34909 /// * *$.xgafv* (query-string) - V1 error format.
34910 /// * *access_token* (query-string) - OAuth access token.
34911 /// * *alt* (query-string) - Data format for response.
34912 /// * *callback* (query-string) - JSONP
34913 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34914 /// * *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.
34915 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34916 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34917 /// * *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.
34918 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34919 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34920 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerLookupCall<'a, C>
34921 where
34922 T: AsRef<str>,
34923 {
34924 self._additional_params
34925 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34926 self
34927 }
34928
34929 /// Identifies the authorization scope for the method you are building.
34930 ///
34931 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34932 /// [`Scope::Readonly`].
34933 ///
34934 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34935 /// tokens for more than one scope.
34936 ///
34937 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34938 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34939 /// sufficient, a read-write scope will do as well.
34940 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerLookupCall<'a, C>
34941 where
34942 St: AsRef<str>,
34943 {
34944 self._scopes.insert(String::from(scope.as_ref()));
34945 self
34946 }
34947 /// Identifies the authorization scope(s) for the method you are building.
34948 ///
34949 /// See [`Self::add_scope()`] for details.
34950 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerLookupCall<'a, C>
34951 where
34952 I: IntoIterator<Item = St>,
34953 St: AsRef<str>,
34954 {
34955 self._scopes
34956 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34957 self
34958 }
34959
34960 /// Removes all scopes, and no default scope will be used either.
34961 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34962 /// for details).
34963 pub fn clear_scopes(mut self) -> AccountContainerLookupCall<'a, C> {
34964 self._scopes.clear();
34965 self
34966 }
34967}
34968
34969/// Move Tag ID out of a Container.
34970///
34971/// A builder for the *containers.move_tag_id* method supported by a *account* resource.
34972/// It is not used directly, but through a [`AccountMethods`] instance.
34973///
34974/// # Example
34975///
34976/// Instantiate a resource method builder
34977///
34978/// ```test_harness,no_run
34979/// # extern crate hyper;
34980/// # extern crate hyper_rustls;
34981/// # extern crate google_tagmanager2 as tagmanager2;
34982/// # async fn dox() {
34983/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34984///
34985/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34986/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34987/// # .with_native_roots()
34988/// # .unwrap()
34989/// # .https_only()
34990/// # .enable_http2()
34991/// # .build();
34992///
34993/// # let executor = hyper_util::rt::TokioExecutor::new();
34994/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34995/// # secret,
34996/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34997/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34998/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34999/// # ),
35000/// # ).build().await.unwrap();
35001///
35002/// # let client = hyper_util::client::legacy::Client::builder(
35003/// # hyper_util::rt::TokioExecutor::new()
35004/// # )
35005/// # .build(
35006/// # hyper_rustls::HttpsConnectorBuilder::new()
35007/// # .with_native_roots()
35008/// # .unwrap()
35009/// # .https_or_http()
35010/// # .enable_http2()
35011/// # .build()
35012/// # );
35013/// # let mut hub = TagManager::new(client, auth);
35014/// // You can configure optional parameters by calling the respective setters at will, and
35015/// // execute the final call using `doit()`.
35016/// // Values shown here are possibly random and not representative !
35017/// let result = hub.accounts().containers_move_tag_id("path")
35018/// .tag_name("At")
35019/// .tag_id("dolores")
35020/// .copy_users(true)
35021/// .copy_terms_of_service(true)
35022/// .copy_settings(true)
35023/// .allow_user_permission_feature_update(true)
35024/// .doit().await;
35025/// # }
35026/// ```
35027pub struct AccountContainerMoveTagIdCall<'a, C>
35028where
35029 C: 'a,
35030{
35031 hub: &'a TagManager<C>,
35032 _path: String,
35033 _tag_name: Option<String>,
35034 _tag_id: Option<String>,
35035 _copy_users: Option<bool>,
35036 _copy_terms_of_service: Option<bool>,
35037 _copy_settings: Option<bool>,
35038 _allow_user_permission_feature_update: Option<bool>,
35039 _delegate: Option<&'a mut dyn common::Delegate>,
35040 _additional_params: HashMap<String, String>,
35041 _scopes: BTreeSet<String>,
35042}
35043
35044impl<'a, C> common::CallBuilder for AccountContainerMoveTagIdCall<'a, C> {}
35045
35046impl<'a, C> AccountContainerMoveTagIdCall<'a, C>
35047where
35048 C: common::Connector,
35049{
35050 /// Perform the operation you have build so far.
35051 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
35052 use std::borrow::Cow;
35053 use std::io::{Read, Seek};
35054
35055 use common::{url::Params, ToParts};
35056 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35057
35058 let mut dd = common::DefaultDelegate;
35059 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35060 dlg.begin(common::MethodInfo {
35061 id: "tagmanager.accounts.containers.move_tag_id",
35062 http_method: hyper::Method::POST,
35063 });
35064
35065 for &field in [
35066 "alt",
35067 "path",
35068 "tagName",
35069 "tagId",
35070 "copyUsers",
35071 "copyTermsOfService",
35072 "copySettings",
35073 "allowUserPermissionFeatureUpdate",
35074 ]
35075 .iter()
35076 {
35077 if self._additional_params.contains_key(field) {
35078 dlg.finished(false);
35079 return Err(common::Error::FieldClash(field));
35080 }
35081 }
35082
35083 let mut params = Params::with_capacity(9 + self._additional_params.len());
35084 params.push("path", self._path);
35085 if let Some(value) = self._tag_name.as_ref() {
35086 params.push("tagName", value);
35087 }
35088 if let Some(value) = self._tag_id.as_ref() {
35089 params.push("tagId", value);
35090 }
35091 if let Some(value) = self._copy_users.as_ref() {
35092 params.push("copyUsers", value.to_string());
35093 }
35094 if let Some(value) = self._copy_terms_of_service.as_ref() {
35095 params.push("copyTermsOfService", value.to_string());
35096 }
35097 if let Some(value) = self._copy_settings.as_ref() {
35098 params.push("copySettings", value.to_string());
35099 }
35100 if let Some(value) = self._allow_user_permission_feature_update.as_ref() {
35101 params.push("allowUserPermissionFeatureUpdate", value.to_string());
35102 }
35103
35104 params.extend(self._additional_params.iter());
35105
35106 params.push("alt", "json");
35107 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:move_tag_id";
35108 if self._scopes.is_empty() {
35109 self._scopes
35110 .insert(Scope::EditContainer.as_ref().to_string());
35111 }
35112
35113 #[allow(clippy::single_element_loop)]
35114 for &(find_this, param_name) in [("{+path}", "path")].iter() {
35115 url = params.uri_replacement(url, param_name, find_this, true);
35116 }
35117 {
35118 let to_remove = ["path"];
35119 params.remove_params(&to_remove);
35120 }
35121
35122 let url = params.parse_with_url(&url);
35123
35124 loop {
35125 let token = match self
35126 .hub
35127 .auth
35128 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35129 .await
35130 {
35131 Ok(token) => token,
35132 Err(e) => match dlg.token(e) {
35133 Ok(token) => token,
35134 Err(e) => {
35135 dlg.finished(false);
35136 return Err(common::Error::MissingToken(e));
35137 }
35138 },
35139 };
35140 let mut req_result = {
35141 let client = &self.hub.client;
35142 dlg.pre_request();
35143 let mut req_builder = hyper::Request::builder()
35144 .method(hyper::Method::POST)
35145 .uri(url.as_str())
35146 .header(USER_AGENT, self.hub._user_agent.clone());
35147
35148 if let Some(token) = token.as_ref() {
35149 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35150 }
35151
35152 let request = req_builder
35153 .header(CONTENT_LENGTH, 0_u64)
35154 .body(common::to_body::<String>(None));
35155
35156 client.request(request.unwrap()).await
35157 };
35158
35159 match req_result {
35160 Err(err) => {
35161 if let common::Retry::After(d) = dlg.http_error(&err) {
35162 sleep(d).await;
35163 continue;
35164 }
35165 dlg.finished(false);
35166 return Err(common::Error::HttpError(err));
35167 }
35168 Ok(res) => {
35169 let (mut parts, body) = res.into_parts();
35170 let mut body = common::Body::new(body);
35171 if !parts.status.is_success() {
35172 let bytes = common::to_bytes(body).await.unwrap_or_default();
35173 let error = serde_json::from_str(&common::to_string(&bytes));
35174 let response = common::to_response(parts, bytes.into());
35175
35176 if let common::Retry::After(d) =
35177 dlg.http_failure(&response, error.as_ref().ok())
35178 {
35179 sleep(d).await;
35180 continue;
35181 }
35182
35183 dlg.finished(false);
35184
35185 return Err(match error {
35186 Ok(value) => common::Error::BadRequest(value),
35187 _ => common::Error::Failure(response),
35188 });
35189 }
35190 let response = {
35191 let bytes = common::to_bytes(body).await.unwrap_or_default();
35192 let encoded = common::to_string(&bytes);
35193 match serde_json::from_str(&encoded) {
35194 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35195 Err(error) => {
35196 dlg.response_json_decode_error(&encoded, &error);
35197 return Err(common::Error::JsonDecodeError(
35198 encoded.to_string(),
35199 error,
35200 ));
35201 }
35202 }
35203 };
35204
35205 dlg.finished(true);
35206 return Ok(response);
35207 }
35208 }
35209 }
35210 }
35211
35212 /// GTM Container's API relative path.
35213 ///
35214 /// Sets the *path* path property to the given value.
35215 ///
35216 /// Even though the property as already been set when instantiating this call,
35217 /// we provide this method for API completeness.
35218 pub fn path(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
35219 self._path = new_value.to_string();
35220 self
35221 }
35222 /// The name for the newly created tag.
35223 ///
35224 /// Sets the *tag name* query property to the given value.
35225 pub fn tag_name(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
35226 self._tag_name = Some(new_value.to_string());
35227 self
35228 }
35229 /// Tag ID to be removed from the current Container.
35230 ///
35231 /// Sets the *tag id* query property to the given value.
35232 pub fn tag_id(mut self, new_value: &str) -> AccountContainerMoveTagIdCall<'a, C> {
35233 self._tag_id = Some(new_value.to_string());
35234 self
35235 }
35236 /// Whether or not to copy users from this tag to the new tag.
35237 ///
35238 /// Sets the *copy users* query property to the given value.
35239 pub fn copy_users(mut self, new_value: bool) -> AccountContainerMoveTagIdCall<'a, C> {
35240 self._copy_users = Some(new_value);
35241 self
35242 }
35243 /// 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.
35244 ///
35245 /// Sets the *copy terms of service* query property to the given value.
35246 pub fn copy_terms_of_service(
35247 mut self,
35248 new_value: bool,
35249 ) -> AccountContainerMoveTagIdCall<'a, C> {
35250 self._copy_terms_of_service = Some(new_value);
35251 self
35252 }
35253 /// Whether or not to copy tag settings from this tag to the new tag.
35254 ///
35255 /// Sets the *copy settings* query property to the given value.
35256 pub fn copy_settings(mut self, new_value: bool) -> AccountContainerMoveTagIdCall<'a, C> {
35257 self._copy_settings = Some(new_value);
35258 self
35259 }
35260 /// 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.
35261 ///
35262 /// Sets the *allow user permission feature update* query property to the given value.
35263 pub fn allow_user_permission_feature_update(
35264 mut self,
35265 new_value: bool,
35266 ) -> AccountContainerMoveTagIdCall<'a, C> {
35267 self._allow_user_permission_feature_update = Some(new_value);
35268 self
35269 }
35270 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35271 /// while executing the actual API request.
35272 ///
35273 /// ````text
35274 /// It should be used to handle progress information, and to implement a certain level of resilience.
35275 /// ````
35276 ///
35277 /// Sets the *delegate* property to the given value.
35278 pub fn delegate(
35279 mut self,
35280 new_value: &'a mut dyn common::Delegate,
35281 ) -> AccountContainerMoveTagIdCall<'a, C> {
35282 self._delegate = Some(new_value);
35283 self
35284 }
35285
35286 /// Set any additional parameter of the query string used in the request.
35287 /// It should be used to set parameters which are not yet available through their own
35288 /// setters.
35289 ///
35290 /// Please note that this method must not be used to set any of the known parameters
35291 /// which have their own setter method. If done anyway, the request will fail.
35292 ///
35293 /// # Additional Parameters
35294 ///
35295 /// * *$.xgafv* (query-string) - V1 error format.
35296 /// * *access_token* (query-string) - OAuth access token.
35297 /// * *alt* (query-string) - Data format for response.
35298 /// * *callback* (query-string) - JSONP
35299 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35300 /// * *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.
35301 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35302 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35303 /// * *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.
35304 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35305 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35306 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerMoveTagIdCall<'a, C>
35307 where
35308 T: AsRef<str>,
35309 {
35310 self._additional_params
35311 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35312 self
35313 }
35314
35315 /// Identifies the authorization scope for the method you are building.
35316 ///
35317 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35318 /// [`Scope::EditContainer`].
35319 ///
35320 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35321 /// tokens for more than one scope.
35322 ///
35323 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35324 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35325 /// sufficient, a read-write scope will do as well.
35326 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerMoveTagIdCall<'a, C>
35327 where
35328 St: AsRef<str>,
35329 {
35330 self._scopes.insert(String::from(scope.as_ref()));
35331 self
35332 }
35333 /// Identifies the authorization scope(s) for the method you are building.
35334 ///
35335 /// See [`Self::add_scope()`] for details.
35336 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerMoveTagIdCall<'a, C>
35337 where
35338 I: IntoIterator<Item = St>,
35339 St: AsRef<str>,
35340 {
35341 self._scopes
35342 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35343 self
35344 }
35345
35346 /// Removes all scopes, and no default scope will be used either.
35347 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35348 /// for details).
35349 pub fn clear_scopes(mut self) -> AccountContainerMoveTagIdCall<'a, C> {
35350 self._scopes.clear();
35351 self
35352 }
35353}
35354
35355/// Gets the tagging snippet for a Container.
35356///
35357/// A builder for the *containers.snippet* method supported by a *account* resource.
35358/// It is not used directly, but through a [`AccountMethods`] instance.
35359///
35360/// # Example
35361///
35362/// Instantiate a resource method builder
35363///
35364/// ```test_harness,no_run
35365/// # extern crate hyper;
35366/// # extern crate hyper_rustls;
35367/// # extern crate google_tagmanager2 as tagmanager2;
35368/// # async fn dox() {
35369/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35370///
35371/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35372/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35373/// # .with_native_roots()
35374/// # .unwrap()
35375/// # .https_only()
35376/// # .enable_http2()
35377/// # .build();
35378///
35379/// # let executor = hyper_util::rt::TokioExecutor::new();
35380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35381/// # secret,
35382/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35383/// # yup_oauth2::client::CustomHyperClientBuilder::from(
35384/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
35385/// # ),
35386/// # ).build().await.unwrap();
35387///
35388/// # let client = hyper_util::client::legacy::Client::builder(
35389/// # hyper_util::rt::TokioExecutor::new()
35390/// # )
35391/// # .build(
35392/// # hyper_rustls::HttpsConnectorBuilder::new()
35393/// # .with_native_roots()
35394/// # .unwrap()
35395/// # .https_or_http()
35396/// # .enable_http2()
35397/// # .build()
35398/// # );
35399/// # let mut hub = TagManager::new(client, auth);
35400/// // You can configure optional parameters by calling the respective setters at will, and
35401/// // execute the final call using `doit()`.
35402/// // Values shown here are possibly random and not representative !
35403/// let result = hub.accounts().containers_snippet("path")
35404/// .doit().await;
35405/// # }
35406/// ```
35407pub struct AccountContainerSnippetCall<'a, C>
35408where
35409 C: 'a,
35410{
35411 hub: &'a TagManager<C>,
35412 _path: String,
35413 _delegate: Option<&'a mut dyn common::Delegate>,
35414 _additional_params: HashMap<String, String>,
35415 _scopes: BTreeSet<String>,
35416}
35417
35418impl<'a, C> common::CallBuilder for AccountContainerSnippetCall<'a, C> {}
35419
35420impl<'a, C> AccountContainerSnippetCall<'a, C>
35421where
35422 C: common::Connector,
35423{
35424 /// Perform the operation you have build so far.
35425 pub async fn doit(mut self) -> common::Result<(common::Response, GetContainerSnippetResponse)> {
35426 use std::borrow::Cow;
35427 use std::io::{Read, Seek};
35428
35429 use common::{url::Params, ToParts};
35430 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35431
35432 let mut dd = common::DefaultDelegate;
35433 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35434 dlg.begin(common::MethodInfo {
35435 id: "tagmanager.accounts.containers.snippet",
35436 http_method: hyper::Method::GET,
35437 });
35438
35439 for &field in ["alt", "path"].iter() {
35440 if self._additional_params.contains_key(field) {
35441 dlg.finished(false);
35442 return Err(common::Error::FieldClash(field));
35443 }
35444 }
35445
35446 let mut params = Params::with_capacity(3 + self._additional_params.len());
35447 params.push("path", self._path);
35448
35449 params.extend(self._additional_params.iter());
35450
35451 params.push("alt", "json");
35452 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}:snippet";
35453 if self._scopes.is_empty() {
35454 self._scopes.insert(Scope::Readonly.as_ref().to_string());
35455 }
35456
35457 #[allow(clippy::single_element_loop)]
35458 for &(find_this, param_name) in [("{+path}", "path")].iter() {
35459 url = params.uri_replacement(url, param_name, find_this, true);
35460 }
35461 {
35462 let to_remove = ["path"];
35463 params.remove_params(&to_remove);
35464 }
35465
35466 let url = params.parse_with_url(&url);
35467
35468 loop {
35469 let token = match self
35470 .hub
35471 .auth
35472 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35473 .await
35474 {
35475 Ok(token) => token,
35476 Err(e) => match dlg.token(e) {
35477 Ok(token) => token,
35478 Err(e) => {
35479 dlg.finished(false);
35480 return Err(common::Error::MissingToken(e));
35481 }
35482 },
35483 };
35484 let mut req_result = {
35485 let client = &self.hub.client;
35486 dlg.pre_request();
35487 let mut req_builder = hyper::Request::builder()
35488 .method(hyper::Method::GET)
35489 .uri(url.as_str())
35490 .header(USER_AGENT, self.hub._user_agent.clone());
35491
35492 if let Some(token) = token.as_ref() {
35493 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35494 }
35495
35496 let request = req_builder
35497 .header(CONTENT_LENGTH, 0_u64)
35498 .body(common::to_body::<String>(None));
35499
35500 client.request(request.unwrap()).await
35501 };
35502
35503 match req_result {
35504 Err(err) => {
35505 if let common::Retry::After(d) = dlg.http_error(&err) {
35506 sleep(d).await;
35507 continue;
35508 }
35509 dlg.finished(false);
35510 return Err(common::Error::HttpError(err));
35511 }
35512 Ok(res) => {
35513 let (mut parts, body) = res.into_parts();
35514 let mut body = common::Body::new(body);
35515 if !parts.status.is_success() {
35516 let bytes = common::to_bytes(body).await.unwrap_or_default();
35517 let error = serde_json::from_str(&common::to_string(&bytes));
35518 let response = common::to_response(parts, bytes.into());
35519
35520 if let common::Retry::After(d) =
35521 dlg.http_failure(&response, error.as_ref().ok())
35522 {
35523 sleep(d).await;
35524 continue;
35525 }
35526
35527 dlg.finished(false);
35528
35529 return Err(match error {
35530 Ok(value) => common::Error::BadRequest(value),
35531 _ => common::Error::Failure(response),
35532 });
35533 }
35534 let response = {
35535 let bytes = common::to_bytes(body).await.unwrap_or_default();
35536 let encoded = common::to_string(&bytes);
35537 match serde_json::from_str(&encoded) {
35538 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35539 Err(error) => {
35540 dlg.response_json_decode_error(&encoded, &error);
35541 return Err(common::Error::JsonDecodeError(
35542 encoded.to_string(),
35543 error,
35544 ));
35545 }
35546 }
35547 };
35548
35549 dlg.finished(true);
35550 return Ok(response);
35551 }
35552 }
35553 }
35554 }
35555
35556 /// Container snippet's API relative path.
35557 ///
35558 /// Sets the *path* path property to the given value.
35559 ///
35560 /// Even though the property as already been set when instantiating this call,
35561 /// we provide this method for API completeness.
35562 pub fn path(mut self, new_value: &str) -> AccountContainerSnippetCall<'a, C> {
35563 self._path = new_value.to_string();
35564 self
35565 }
35566 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35567 /// while executing the actual API request.
35568 ///
35569 /// ````text
35570 /// It should be used to handle progress information, and to implement a certain level of resilience.
35571 /// ````
35572 ///
35573 /// Sets the *delegate* property to the given value.
35574 pub fn delegate(
35575 mut self,
35576 new_value: &'a mut dyn common::Delegate,
35577 ) -> AccountContainerSnippetCall<'a, C> {
35578 self._delegate = Some(new_value);
35579 self
35580 }
35581
35582 /// Set any additional parameter of the query string used in the request.
35583 /// It should be used to set parameters which are not yet available through their own
35584 /// setters.
35585 ///
35586 /// Please note that this method must not be used to set any of the known parameters
35587 /// which have their own setter method. If done anyway, the request will fail.
35588 ///
35589 /// # Additional Parameters
35590 ///
35591 /// * *$.xgafv* (query-string) - V1 error format.
35592 /// * *access_token* (query-string) - OAuth access token.
35593 /// * *alt* (query-string) - Data format for response.
35594 /// * *callback* (query-string) - JSONP
35595 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35596 /// * *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.
35597 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35598 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35599 /// * *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.
35600 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35601 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35602 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerSnippetCall<'a, C>
35603 where
35604 T: AsRef<str>,
35605 {
35606 self._additional_params
35607 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35608 self
35609 }
35610
35611 /// Identifies the authorization scope for the method you are building.
35612 ///
35613 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35614 /// [`Scope::Readonly`].
35615 ///
35616 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35617 /// tokens for more than one scope.
35618 ///
35619 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35620 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35621 /// sufficient, a read-write scope will do as well.
35622 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerSnippetCall<'a, C>
35623 where
35624 St: AsRef<str>,
35625 {
35626 self._scopes.insert(String::from(scope.as_ref()));
35627 self
35628 }
35629 /// Identifies the authorization scope(s) for the method you are building.
35630 ///
35631 /// See [`Self::add_scope()`] for details.
35632 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerSnippetCall<'a, C>
35633 where
35634 I: IntoIterator<Item = St>,
35635 St: AsRef<str>,
35636 {
35637 self._scopes
35638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35639 self
35640 }
35641
35642 /// Removes all scopes, and no default scope will be used either.
35643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35644 /// for details).
35645 pub fn clear_scopes(mut self) -> AccountContainerSnippetCall<'a, C> {
35646 self._scopes.clear();
35647 self
35648 }
35649}
35650
35651/// Updates a Container.
35652///
35653/// A builder for the *containers.update* method supported by a *account* resource.
35654/// It is not used directly, but through a [`AccountMethods`] instance.
35655///
35656/// # Example
35657///
35658/// Instantiate a resource method builder
35659///
35660/// ```test_harness,no_run
35661/// # extern crate hyper;
35662/// # extern crate hyper_rustls;
35663/// # extern crate google_tagmanager2 as tagmanager2;
35664/// use tagmanager2::api::Container;
35665/// # async fn dox() {
35666/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35667///
35668/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35669/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35670/// # .with_native_roots()
35671/// # .unwrap()
35672/// # .https_only()
35673/// # .enable_http2()
35674/// # .build();
35675///
35676/// # let executor = hyper_util::rt::TokioExecutor::new();
35677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35678/// # secret,
35679/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35680/// # yup_oauth2::client::CustomHyperClientBuilder::from(
35681/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
35682/// # ),
35683/// # ).build().await.unwrap();
35684///
35685/// # let client = hyper_util::client::legacy::Client::builder(
35686/// # hyper_util::rt::TokioExecutor::new()
35687/// # )
35688/// # .build(
35689/// # hyper_rustls::HttpsConnectorBuilder::new()
35690/// # .with_native_roots()
35691/// # .unwrap()
35692/// # .https_or_http()
35693/// # .enable_http2()
35694/// # .build()
35695/// # );
35696/// # let mut hub = TagManager::new(client, auth);
35697/// // As the method needs a request, you would usually fill it with the desired information
35698/// // into the respective structure. Some of the parts shown here might not be applicable !
35699/// // Values shown here are possibly random and not representative !
35700/// let mut req = Container::default();
35701///
35702/// // You can configure optional parameters by calling the respective setters at will, and
35703/// // execute the final call using `doit()`.
35704/// // Values shown here are possibly random and not representative !
35705/// let result = hub.accounts().containers_update(req, "path")
35706/// .fingerprint("gubergren")
35707/// .doit().await;
35708/// # }
35709/// ```
35710pub struct AccountContainerUpdateCall<'a, C>
35711where
35712 C: 'a,
35713{
35714 hub: &'a TagManager<C>,
35715 _request: Container,
35716 _path: String,
35717 _fingerprint: Option<String>,
35718 _delegate: Option<&'a mut dyn common::Delegate>,
35719 _additional_params: HashMap<String, String>,
35720 _scopes: BTreeSet<String>,
35721}
35722
35723impl<'a, C> common::CallBuilder for AccountContainerUpdateCall<'a, C> {}
35724
35725impl<'a, C> AccountContainerUpdateCall<'a, C>
35726where
35727 C: common::Connector,
35728{
35729 /// Perform the operation you have build so far.
35730 pub async fn doit(mut self) -> common::Result<(common::Response, Container)> {
35731 use std::borrow::Cow;
35732 use std::io::{Read, Seek};
35733
35734 use common::{url::Params, ToParts};
35735 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35736
35737 let mut dd = common::DefaultDelegate;
35738 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35739 dlg.begin(common::MethodInfo {
35740 id: "tagmanager.accounts.containers.update",
35741 http_method: hyper::Method::PUT,
35742 });
35743
35744 for &field in ["alt", "path", "fingerprint"].iter() {
35745 if self._additional_params.contains_key(field) {
35746 dlg.finished(false);
35747 return Err(common::Error::FieldClash(field));
35748 }
35749 }
35750
35751 let mut params = Params::with_capacity(5 + self._additional_params.len());
35752 params.push("path", self._path);
35753 if let Some(value) = self._fingerprint.as_ref() {
35754 params.push("fingerprint", value);
35755 }
35756
35757 params.extend(self._additional_params.iter());
35758
35759 params.push("alt", "json");
35760 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
35761 if self._scopes.is_empty() {
35762 self._scopes
35763 .insert(Scope::EditContainer.as_ref().to_string());
35764 }
35765
35766 #[allow(clippy::single_element_loop)]
35767 for &(find_this, param_name) in [("{+path}", "path")].iter() {
35768 url = params.uri_replacement(url, param_name, find_this, true);
35769 }
35770 {
35771 let to_remove = ["path"];
35772 params.remove_params(&to_remove);
35773 }
35774
35775 let url = params.parse_with_url(&url);
35776
35777 let mut json_mime_type = mime::APPLICATION_JSON;
35778 let mut request_value_reader = {
35779 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35780 common::remove_json_null_values(&mut value);
35781 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35782 serde_json::to_writer(&mut dst, &value).unwrap();
35783 dst
35784 };
35785 let request_size = request_value_reader
35786 .seek(std::io::SeekFrom::End(0))
35787 .unwrap();
35788 request_value_reader
35789 .seek(std::io::SeekFrom::Start(0))
35790 .unwrap();
35791
35792 loop {
35793 let token = match self
35794 .hub
35795 .auth
35796 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35797 .await
35798 {
35799 Ok(token) => token,
35800 Err(e) => match dlg.token(e) {
35801 Ok(token) => token,
35802 Err(e) => {
35803 dlg.finished(false);
35804 return Err(common::Error::MissingToken(e));
35805 }
35806 },
35807 };
35808 request_value_reader
35809 .seek(std::io::SeekFrom::Start(0))
35810 .unwrap();
35811 let mut req_result = {
35812 let client = &self.hub.client;
35813 dlg.pre_request();
35814 let mut req_builder = hyper::Request::builder()
35815 .method(hyper::Method::PUT)
35816 .uri(url.as_str())
35817 .header(USER_AGENT, self.hub._user_agent.clone());
35818
35819 if let Some(token) = token.as_ref() {
35820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35821 }
35822
35823 let request = req_builder
35824 .header(CONTENT_TYPE, json_mime_type.to_string())
35825 .header(CONTENT_LENGTH, request_size as u64)
35826 .body(common::to_body(
35827 request_value_reader.get_ref().clone().into(),
35828 ));
35829
35830 client.request(request.unwrap()).await
35831 };
35832
35833 match req_result {
35834 Err(err) => {
35835 if let common::Retry::After(d) = dlg.http_error(&err) {
35836 sleep(d).await;
35837 continue;
35838 }
35839 dlg.finished(false);
35840 return Err(common::Error::HttpError(err));
35841 }
35842 Ok(res) => {
35843 let (mut parts, body) = res.into_parts();
35844 let mut body = common::Body::new(body);
35845 if !parts.status.is_success() {
35846 let bytes = common::to_bytes(body).await.unwrap_or_default();
35847 let error = serde_json::from_str(&common::to_string(&bytes));
35848 let response = common::to_response(parts, bytes.into());
35849
35850 if let common::Retry::After(d) =
35851 dlg.http_failure(&response, error.as_ref().ok())
35852 {
35853 sleep(d).await;
35854 continue;
35855 }
35856
35857 dlg.finished(false);
35858
35859 return Err(match error {
35860 Ok(value) => common::Error::BadRequest(value),
35861 _ => common::Error::Failure(response),
35862 });
35863 }
35864 let response = {
35865 let bytes = common::to_bytes(body).await.unwrap_or_default();
35866 let encoded = common::to_string(&bytes);
35867 match serde_json::from_str(&encoded) {
35868 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35869 Err(error) => {
35870 dlg.response_json_decode_error(&encoded, &error);
35871 return Err(common::Error::JsonDecodeError(
35872 encoded.to_string(),
35873 error,
35874 ));
35875 }
35876 }
35877 };
35878
35879 dlg.finished(true);
35880 return Ok(response);
35881 }
35882 }
35883 }
35884 }
35885
35886 ///
35887 /// Sets the *request* property to the given value.
35888 ///
35889 /// Even though the property as already been set when instantiating this call,
35890 /// we provide this method for API completeness.
35891 pub fn request(mut self, new_value: Container) -> AccountContainerUpdateCall<'a, C> {
35892 self._request = new_value;
35893 self
35894 }
35895 /// GTM Container's API relative path.
35896 ///
35897 /// Sets the *path* path property to the given value.
35898 ///
35899 /// Even though the property as already been set when instantiating this call,
35900 /// we provide this method for API completeness.
35901 pub fn path(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
35902 self._path = new_value.to_string();
35903 self
35904 }
35905 /// When provided, this fingerprint must match the fingerprint of the container in storage.
35906 ///
35907 /// Sets the *fingerprint* query property to the given value.
35908 pub fn fingerprint(mut self, new_value: &str) -> AccountContainerUpdateCall<'a, C> {
35909 self._fingerprint = Some(new_value.to_string());
35910 self
35911 }
35912 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35913 /// while executing the actual API request.
35914 ///
35915 /// ````text
35916 /// It should be used to handle progress information, and to implement a certain level of resilience.
35917 /// ````
35918 ///
35919 /// Sets the *delegate* property to the given value.
35920 pub fn delegate(
35921 mut self,
35922 new_value: &'a mut dyn common::Delegate,
35923 ) -> AccountContainerUpdateCall<'a, C> {
35924 self._delegate = Some(new_value);
35925 self
35926 }
35927
35928 /// Set any additional parameter of the query string used in the request.
35929 /// It should be used to set parameters which are not yet available through their own
35930 /// setters.
35931 ///
35932 /// Please note that this method must not be used to set any of the known parameters
35933 /// which have their own setter method. If done anyway, the request will fail.
35934 ///
35935 /// # Additional Parameters
35936 ///
35937 /// * *$.xgafv* (query-string) - V1 error format.
35938 /// * *access_token* (query-string) - OAuth access token.
35939 /// * *alt* (query-string) - Data format for response.
35940 /// * *callback* (query-string) - JSONP
35941 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35942 /// * *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.
35943 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35944 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35945 /// * *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.
35946 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35947 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35948 pub fn param<T>(mut self, name: T, value: T) -> AccountContainerUpdateCall<'a, C>
35949 where
35950 T: AsRef<str>,
35951 {
35952 self._additional_params
35953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35954 self
35955 }
35956
35957 /// Identifies the authorization scope for the method you are building.
35958 ///
35959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35960 /// [`Scope::EditContainer`].
35961 ///
35962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35963 /// tokens for more than one scope.
35964 ///
35965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35967 /// sufficient, a read-write scope will do as well.
35968 pub fn add_scope<St>(mut self, scope: St) -> AccountContainerUpdateCall<'a, C>
35969 where
35970 St: AsRef<str>,
35971 {
35972 self._scopes.insert(String::from(scope.as_ref()));
35973 self
35974 }
35975 /// Identifies the authorization scope(s) for the method you are building.
35976 ///
35977 /// See [`Self::add_scope()`] for details.
35978 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountContainerUpdateCall<'a, C>
35979 where
35980 I: IntoIterator<Item = St>,
35981 St: AsRef<str>,
35982 {
35983 self._scopes
35984 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35985 self
35986 }
35987
35988 /// Removes all scopes, and no default scope will be used either.
35989 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35990 /// for details).
35991 pub fn clear_scopes(mut self) -> AccountContainerUpdateCall<'a, C> {
35992 self._scopes.clear();
35993 self
35994 }
35995}
35996
35997/// Creates a user's Account & Container access.
35998///
35999/// A builder for the *user_permissions.create* method supported by a *account* resource.
36000/// It is not used directly, but through a [`AccountMethods`] instance.
36001///
36002/// # Example
36003///
36004/// Instantiate a resource method builder
36005///
36006/// ```test_harness,no_run
36007/// # extern crate hyper;
36008/// # extern crate hyper_rustls;
36009/// # extern crate google_tagmanager2 as tagmanager2;
36010/// use tagmanager2::api::UserPermission;
36011/// # async fn dox() {
36012/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36013///
36014/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36015/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36016/// # .with_native_roots()
36017/// # .unwrap()
36018/// # .https_only()
36019/// # .enable_http2()
36020/// # .build();
36021///
36022/// # let executor = hyper_util::rt::TokioExecutor::new();
36023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36024/// # secret,
36025/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36026/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36027/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36028/// # ),
36029/// # ).build().await.unwrap();
36030///
36031/// # let client = hyper_util::client::legacy::Client::builder(
36032/// # hyper_util::rt::TokioExecutor::new()
36033/// # )
36034/// # .build(
36035/// # hyper_rustls::HttpsConnectorBuilder::new()
36036/// # .with_native_roots()
36037/// # .unwrap()
36038/// # .https_or_http()
36039/// # .enable_http2()
36040/// # .build()
36041/// # );
36042/// # let mut hub = TagManager::new(client, auth);
36043/// // As the method needs a request, you would usually fill it with the desired information
36044/// // into the respective structure. Some of the parts shown here might not be applicable !
36045/// // Values shown here are possibly random and not representative !
36046/// let mut req = UserPermission::default();
36047///
36048/// // You can configure optional parameters by calling the respective setters at will, and
36049/// // execute the final call using `doit()`.
36050/// // Values shown here are possibly random and not representative !
36051/// let result = hub.accounts().user_permissions_create(req, "parent")
36052/// .doit().await;
36053/// # }
36054/// ```
36055pub struct AccountUserPermissionCreateCall<'a, C>
36056where
36057 C: 'a,
36058{
36059 hub: &'a TagManager<C>,
36060 _request: UserPermission,
36061 _parent: String,
36062 _delegate: Option<&'a mut dyn common::Delegate>,
36063 _additional_params: HashMap<String, String>,
36064 _scopes: BTreeSet<String>,
36065}
36066
36067impl<'a, C> common::CallBuilder for AccountUserPermissionCreateCall<'a, C> {}
36068
36069impl<'a, C> AccountUserPermissionCreateCall<'a, C>
36070where
36071 C: common::Connector,
36072{
36073 /// Perform the operation you have build so far.
36074 pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
36075 use std::borrow::Cow;
36076 use std::io::{Read, Seek};
36077
36078 use common::{url::Params, ToParts};
36079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36080
36081 let mut dd = common::DefaultDelegate;
36082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36083 dlg.begin(common::MethodInfo {
36084 id: "tagmanager.accounts.user_permissions.create",
36085 http_method: hyper::Method::POST,
36086 });
36087
36088 for &field in ["alt", "parent"].iter() {
36089 if self._additional_params.contains_key(field) {
36090 dlg.finished(false);
36091 return Err(common::Error::FieldClash(field));
36092 }
36093 }
36094
36095 let mut params = Params::with_capacity(4 + self._additional_params.len());
36096 params.push("parent", self._parent);
36097
36098 params.extend(self._additional_params.iter());
36099
36100 params.push("alt", "json");
36101 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/user_permissions";
36102 if self._scopes.is_empty() {
36103 self._scopes.insert(Scope::ManageUser.as_ref().to_string());
36104 }
36105
36106 #[allow(clippy::single_element_loop)]
36107 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
36108 url = params.uri_replacement(url, param_name, find_this, true);
36109 }
36110 {
36111 let to_remove = ["parent"];
36112 params.remove_params(&to_remove);
36113 }
36114
36115 let url = params.parse_with_url(&url);
36116
36117 let mut json_mime_type = mime::APPLICATION_JSON;
36118 let mut request_value_reader = {
36119 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36120 common::remove_json_null_values(&mut value);
36121 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36122 serde_json::to_writer(&mut dst, &value).unwrap();
36123 dst
36124 };
36125 let request_size = request_value_reader
36126 .seek(std::io::SeekFrom::End(0))
36127 .unwrap();
36128 request_value_reader
36129 .seek(std::io::SeekFrom::Start(0))
36130 .unwrap();
36131
36132 loop {
36133 let token = match self
36134 .hub
36135 .auth
36136 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36137 .await
36138 {
36139 Ok(token) => token,
36140 Err(e) => match dlg.token(e) {
36141 Ok(token) => token,
36142 Err(e) => {
36143 dlg.finished(false);
36144 return Err(common::Error::MissingToken(e));
36145 }
36146 },
36147 };
36148 request_value_reader
36149 .seek(std::io::SeekFrom::Start(0))
36150 .unwrap();
36151 let mut req_result = {
36152 let client = &self.hub.client;
36153 dlg.pre_request();
36154 let mut req_builder = hyper::Request::builder()
36155 .method(hyper::Method::POST)
36156 .uri(url.as_str())
36157 .header(USER_AGENT, self.hub._user_agent.clone());
36158
36159 if let Some(token) = token.as_ref() {
36160 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36161 }
36162
36163 let request = req_builder
36164 .header(CONTENT_TYPE, json_mime_type.to_string())
36165 .header(CONTENT_LENGTH, request_size as u64)
36166 .body(common::to_body(
36167 request_value_reader.get_ref().clone().into(),
36168 ));
36169
36170 client.request(request.unwrap()).await
36171 };
36172
36173 match req_result {
36174 Err(err) => {
36175 if let common::Retry::After(d) = dlg.http_error(&err) {
36176 sleep(d).await;
36177 continue;
36178 }
36179 dlg.finished(false);
36180 return Err(common::Error::HttpError(err));
36181 }
36182 Ok(res) => {
36183 let (mut parts, body) = res.into_parts();
36184 let mut body = common::Body::new(body);
36185 if !parts.status.is_success() {
36186 let bytes = common::to_bytes(body).await.unwrap_or_default();
36187 let error = serde_json::from_str(&common::to_string(&bytes));
36188 let response = common::to_response(parts, bytes.into());
36189
36190 if let common::Retry::After(d) =
36191 dlg.http_failure(&response, error.as_ref().ok())
36192 {
36193 sleep(d).await;
36194 continue;
36195 }
36196
36197 dlg.finished(false);
36198
36199 return Err(match error {
36200 Ok(value) => common::Error::BadRequest(value),
36201 _ => common::Error::Failure(response),
36202 });
36203 }
36204 let response = {
36205 let bytes = common::to_bytes(body).await.unwrap_or_default();
36206 let encoded = common::to_string(&bytes);
36207 match serde_json::from_str(&encoded) {
36208 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36209 Err(error) => {
36210 dlg.response_json_decode_error(&encoded, &error);
36211 return Err(common::Error::JsonDecodeError(
36212 encoded.to_string(),
36213 error,
36214 ));
36215 }
36216 }
36217 };
36218
36219 dlg.finished(true);
36220 return Ok(response);
36221 }
36222 }
36223 }
36224 }
36225
36226 ///
36227 /// Sets the *request* property to the given value.
36228 ///
36229 /// Even though the property as already been set when instantiating this call,
36230 /// we provide this method for API completeness.
36231 pub fn request(mut self, new_value: UserPermission) -> AccountUserPermissionCreateCall<'a, C> {
36232 self._request = new_value;
36233 self
36234 }
36235 /// GTM Account's API relative path.
36236 ///
36237 /// Sets the *parent* path property to the given value.
36238 ///
36239 /// Even though the property as already been set when instantiating this call,
36240 /// we provide this method for API completeness.
36241 pub fn parent(mut self, new_value: &str) -> AccountUserPermissionCreateCall<'a, C> {
36242 self._parent = new_value.to_string();
36243 self
36244 }
36245 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36246 /// while executing the actual API request.
36247 ///
36248 /// ````text
36249 /// It should be used to handle progress information, and to implement a certain level of resilience.
36250 /// ````
36251 ///
36252 /// Sets the *delegate* property to the given value.
36253 pub fn delegate(
36254 mut self,
36255 new_value: &'a mut dyn common::Delegate,
36256 ) -> AccountUserPermissionCreateCall<'a, C> {
36257 self._delegate = Some(new_value);
36258 self
36259 }
36260
36261 /// Set any additional parameter of the query string used in the request.
36262 /// It should be used to set parameters which are not yet available through their own
36263 /// setters.
36264 ///
36265 /// Please note that this method must not be used to set any of the known parameters
36266 /// which have their own setter method. If done anyway, the request will fail.
36267 ///
36268 /// # Additional Parameters
36269 ///
36270 /// * *$.xgafv* (query-string) - V1 error format.
36271 /// * *access_token* (query-string) - OAuth access token.
36272 /// * *alt* (query-string) - Data format for response.
36273 /// * *callback* (query-string) - JSONP
36274 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36275 /// * *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.
36276 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36277 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36278 /// * *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.
36279 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36280 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36281 pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionCreateCall<'a, C>
36282 where
36283 T: AsRef<str>,
36284 {
36285 self._additional_params
36286 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36287 self
36288 }
36289
36290 /// Identifies the authorization scope for the method you are building.
36291 ///
36292 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36293 /// [`Scope::ManageUser`].
36294 ///
36295 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36296 /// tokens for more than one scope.
36297 ///
36298 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36299 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36300 /// sufficient, a read-write scope will do as well.
36301 pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionCreateCall<'a, C>
36302 where
36303 St: AsRef<str>,
36304 {
36305 self._scopes.insert(String::from(scope.as_ref()));
36306 self
36307 }
36308 /// Identifies the authorization scope(s) for the method you are building.
36309 ///
36310 /// See [`Self::add_scope()`] for details.
36311 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionCreateCall<'a, C>
36312 where
36313 I: IntoIterator<Item = St>,
36314 St: AsRef<str>,
36315 {
36316 self._scopes
36317 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36318 self
36319 }
36320
36321 /// Removes all scopes, and no default scope will be used either.
36322 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36323 /// for details).
36324 pub fn clear_scopes(mut self) -> AccountUserPermissionCreateCall<'a, C> {
36325 self._scopes.clear();
36326 self
36327 }
36328}
36329
36330/// Removes a user from the account, revoking access to it and all of its containers.
36331///
36332/// A builder for the *user_permissions.delete* method supported by a *account* resource.
36333/// It is not used directly, but through a [`AccountMethods`] instance.
36334///
36335/// # Example
36336///
36337/// Instantiate a resource method builder
36338///
36339/// ```test_harness,no_run
36340/// # extern crate hyper;
36341/// # extern crate hyper_rustls;
36342/// # extern crate google_tagmanager2 as tagmanager2;
36343/// # async fn dox() {
36344/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36345///
36346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36348/// # .with_native_roots()
36349/// # .unwrap()
36350/// # .https_only()
36351/// # .enable_http2()
36352/// # .build();
36353///
36354/// # let executor = hyper_util::rt::TokioExecutor::new();
36355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36356/// # secret,
36357/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36358/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36359/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36360/// # ),
36361/// # ).build().await.unwrap();
36362///
36363/// # let client = hyper_util::client::legacy::Client::builder(
36364/// # hyper_util::rt::TokioExecutor::new()
36365/// # )
36366/// # .build(
36367/// # hyper_rustls::HttpsConnectorBuilder::new()
36368/// # .with_native_roots()
36369/// # .unwrap()
36370/// # .https_or_http()
36371/// # .enable_http2()
36372/// # .build()
36373/// # );
36374/// # let mut hub = TagManager::new(client, auth);
36375/// // You can configure optional parameters by calling the respective setters at will, and
36376/// // execute the final call using `doit()`.
36377/// // Values shown here are possibly random and not representative !
36378/// let result = hub.accounts().user_permissions_delete("path")
36379/// .doit().await;
36380/// # }
36381/// ```
36382pub struct AccountUserPermissionDeleteCall<'a, C>
36383where
36384 C: 'a,
36385{
36386 hub: &'a TagManager<C>,
36387 _path: String,
36388 _delegate: Option<&'a mut dyn common::Delegate>,
36389 _additional_params: HashMap<String, String>,
36390 _scopes: BTreeSet<String>,
36391}
36392
36393impl<'a, C> common::CallBuilder for AccountUserPermissionDeleteCall<'a, C> {}
36394
36395impl<'a, C> AccountUserPermissionDeleteCall<'a, C>
36396where
36397 C: common::Connector,
36398{
36399 /// Perform the operation you have build so far.
36400 pub async fn doit(mut self) -> common::Result<common::Response> {
36401 use std::borrow::Cow;
36402 use std::io::{Read, Seek};
36403
36404 use common::{url::Params, ToParts};
36405 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36406
36407 let mut dd = common::DefaultDelegate;
36408 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36409 dlg.begin(common::MethodInfo {
36410 id: "tagmanager.accounts.user_permissions.delete",
36411 http_method: hyper::Method::DELETE,
36412 });
36413
36414 for &field in ["path"].iter() {
36415 if self._additional_params.contains_key(field) {
36416 dlg.finished(false);
36417 return Err(common::Error::FieldClash(field));
36418 }
36419 }
36420
36421 let mut params = Params::with_capacity(2 + self._additional_params.len());
36422 params.push("path", self._path);
36423
36424 params.extend(self._additional_params.iter());
36425
36426 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
36427 if self._scopes.is_empty() {
36428 self._scopes.insert(Scope::ManageUser.as_ref().to_string());
36429 }
36430
36431 #[allow(clippy::single_element_loop)]
36432 for &(find_this, param_name) in [("{+path}", "path")].iter() {
36433 url = params.uri_replacement(url, param_name, find_this, true);
36434 }
36435 {
36436 let to_remove = ["path"];
36437 params.remove_params(&to_remove);
36438 }
36439
36440 let url = params.parse_with_url(&url);
36441
36442 loop {
36443 let token = match self
36444 .hub
36445 .auth
36446 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36447 .await
36448 {
36449 Ok(token) => token,
36450 Err(e) => match dlg.token(e) {
36451 Ok(token) => token,
36452 Err(e) => {
36453 dlg.finished(false);
36454 return Err(common::Error::MissingToken(e));
36455 }
36456 },
36457 };
36458 let mut req_result = {
36459 let client = &self.hub.client;
36460 dlg.pre_request();
36461 let mut req_builder = hyper::Request::builder()
36462 .method(hyper::Method::DELETE)
36463 .uri(url.as_str())
36464 .header(USER_AGENT, self.hub._user_agent.clone());
36465
36466 if let Some(token) = token.as_ref() {
36467 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36468 }
36469
36470 let request = req_builder
36471 .header(CONTENT_LENGTH, 0_u64)
36472 .body(common::to_body::<String>(None));
36473
36474 client.request(request.unwrap()).await
36475 };
36476
36477 match req_result {
36478 Err(err) => {
36479 if let common::Retry::After(d) = dlg.http_error(&err) {
36480 sleep(d).await;
36481 continue;
36482 }
36483 dlg.finished(false);
36484 return Err(common::Error::HttpError(err));
36485 }
36486 Ok(res) => {
36487 let (mut parts, body) = res.into_parts();
36488 let mut body = common::Body::new(body);
36489 if !parts.status.is_success() {
36490 let bytes = common::to_bytes(body).await.unwrap_or_default();
36491 let error = serde_json::from_str(&common::to_string(&bytes));
36492 let response = common::to_response(parts, bytes.into());
36493
36494 if let common::Retry::After(d) =
36495 dlg.http_failure(&response, error.as_ref().ok())
36496 {
36497 sleep(d).await;
36498 continue;
36499 }
36500
36501 dlg.finished(false);
36502
36503 return Err(match error {
36504 Ok(value) => common::Error::BadRequest(value),
36505 _ => common::Error::Failure(response),
36506 });
36507 }
36508 let response = common::Response::from_parts(parts, body);
36509
36510 dlg.finished(true);
36511 return Ok(response);
36512 }
36513 }
36514 }
36515 }
36516
36517 /// GTM UserPermission's API relative path.
36518 ///
36519 /// Sets the *path* path property to the given value.
36520 ///
36521 /// Even though the property as already been set when instantiating this call,
36522 /// we provide this method for API completeness.
36523 pub fn path(mut self, new_value: &str) -> AccountUserPermissionDeleteCall<'a, C> {
36524 self._path = new_value.to_string();
36525 self
36526 }
36527 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36528 /// while executing the actual API request.
36529 ///
36530 /// ````text
36531 /// It should be used to handle progress information, and to implement a certain level of resilience.
36532 /// ````
36533 ///
36534 /// Sets the *delegate* property to the given value.
36535 pub fn delegate(
36536 mut self,
36537 new_value: &'a mut dyn common::Delegate,
36538 ) -> AccountUserPermissionDeleteCall<'a, C> {
36539 self._delegate = Some(new_value);
36540 self
36541 }
36542
36543 /// Set any additional parameter of the query string used in the request.
36544 /// It should be used to set parameters which are not yet available through their own
36545 /// setters.
36546 ///
36547 /// Please note that this method must not be used to set any of the known parameters
36548 /// which have their own setter method. If done anyway, the request will fail.
36549 ///
36550 /// # Additional Parameters
36551 ///
36552 /// * *$.xgafv* (query-string) - V1 error format.
36553 /// * *access_token* (query-string) - OAuth access token.
36554 /// * *alt* (query-string) - Data format for response.
36555 /// * *callback* (query-string) - JSONP
36556 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36557 /// * *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.
36558 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36559 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36560 /// * *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.
36561 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36562 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36563 pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionDeleteCall<'a, C>
36564 where
36565 T: AsRef<str>,
36566 {
36567 self._additional_params
36568 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36569 self
36570 }
36571
36572 /// Identifies the authorization scope for the method you are building.
36573 ///
36574 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36575 /// [`Scope::ManageUser`].
36576 ///
36577 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36578 /// tokens for more than one scope.
36579 ///
36580 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36581 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36582 /// sufficient, a read-write scope will do as well.
36583 pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionDeleteCall<'a, C>
36584 where
36585 St: AsRef<str>,
36586 {
36587 self._scopes.insert(String::from(scope.as_ref()));
36588 self
36589 }
36590 /// Identifies the authorization scope(s) for the method you are building.
36591 ///
36592 /// See [`Self::add_scope()`] for details.
36593 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionDeleteCall<'a, C>
36594 where
36595 I: IntoIterator<Item = St>,
36596 St: AsRef<str>,
36597 {
36598 self._scopes
36599 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36600 self
36601 }
36602
36603 /// Removes all scopes, and no default scope will be used either.
36604 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36605 /// for details).
36606 pub fn clear_scopes(mut self) -> AccountUserPermissionDeleteCall<'a, C> {
36607 self._scopes.clear();
36608 self
36609 }
36610}
36611
36612/// Gets a user's Account & Container access.
36613///
36614/// A builder for the *user_permissions.get* method supported by a *account* resource.
36615/// It is not used directly, but through a [`AccountMethods`] instance.
36616///
36617/// # Example
36618///
36619/// Instantiate a resource method builder
36620///
36621/// ```test_harness,no_run
36622/// # extern crate hyper;
36623/// # extern crate hyper_rustls;
36624/// # extern crate google_tagmanager2 as tagmanager2;
36625/// # async fn dox() {
36626/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36627///
36628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36630/// # .with_native_roots()
36631/// # .unwrap()
36632/// # .https_only()
36633/// # .enable_http2()
36634/// # .build();
36635///
36636/// # let executor = hyper_util::rt::TokioExecutor::new();
36637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36638/// # secret,
36639/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36640/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36641/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36642/// # ),
36643/// # ).build().await.unwrap();
36644///
36645/// # let client = hyper_util::client::legacy::Client::builder(
36646/// # hyper_util::rt::TokioExecutor::new()
36647/// # )
36648/// # .build(
36649/// # hyper_rustls::HttpsConnectorBuilder::new()
36650/// # .with_native_roots()
36651/// # .unwrap()
36652/// # .https_or_http()
36653/// # .enable_http2()
36654/// # .build()
36655/// # );
36656/// # let mut hub = TagManager::new(client, auth);
36657/// // You can configure optional parameters by calling the respective setters at will, and
36658/// // execute the final call using `doit()`.
36659/// // Values shown here are possibly random and not representative !
36660/// let result = hub.accounts().user_permissions_get("path")
36661/// .doit().await;
36662/// # }
36663/// ```
36664pub struct AccountUserPermissionGetCall<'a, C>
36665where
36666 C: 'a,
36667{
36668 hub: &'a TagManager<C>,
36669 _path: String,
36670 _delegate: Option<&'a mut dyn common::Delegate>,
36671 _additional_params: HashMap<String, String>,
36672 _scopes: BTreeSet<String>,
36673}
36674
36675impl<'a, C> common::CallBuilder for AccountUserPermissionGetCall<'a, C> {}
36676
36677impl<'a, C> AccountUserPermissionGetCall<'a, C>
36678where
36679 C: common::Connector,
36680{
36681 /// Perform the operation you have build so far.
36682 pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
36683 use std::borrow::Cow;
36684 use std::io::{Read, Seek};
36685
36686 use common::{url::Params, ToParts};
36687 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36688
36689 let mut dd = common::DefaultDelegate;
36690 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36691 dlg.begin(common::MethodInfo {
36692 id: "tagmanager.accounts.user_permissions.get",
36693 http_method: hyper::Method::GET,
36694 });
36695
36696 for &field in ["alt", "path"].iter() {
36697 if self._additional_params.contains_key(field) {
36698 dlg.finished(false);
36699 return Err(common::Error::FieldClash(field));
36700 }
36701 }
36702
36703 let mut params = Params::with_capacity(3 + self._additional_params.len());
36704 params.push("path", self._path);
36705
36706 params.extend(self._additional_params.iter());
36707
36708 params.push("alt", "json");
36709 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
36710 if self._scopes.is_empty() {
36711 self._scopes.insert(Scope::ManageUser.as_ref().to_string());
36712 }
36713
36714 #[allow(clippy::single_element_loop)]
36715 for &(find_this, param_name) in [("{+path}", "path")].iter() {
36716 url = params.uri_replacement(url, param_name, find_this, true);
36717 }
36718 {
36719 let to_remove = ["path"];
36720 params.remove_params(&to_remove);
36721 }
36722
36723 let url = params.parse_with_url(&url);
36724
36725 loop {
36726 let token = match self
36727 .hub
36728 .auth
36729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36730 .await
36731 {
36732 Ok(token) => token,
36733 Err(e) => match dlg.token(e) {
36734 Ok(token) => token,
36735 Err(e) => {
36736 dlg.finished(false);
36737 return Err(common::Error::MissingToken(e));
36738 }
36739 },
36740 };
36741 let mut req_result = {
36742 let client = &self.hub.client;
36743 dlg.pre_request();
36744 let mut req_builder = hyper::Request::builder()
36745 .method(hyper::Method::GET)
36746 .uri(url.as_str())
36747 .header(USER_AGENT, self.hub._user_agent.clone());
36748
36749 if let Some(token) = token.as_ref() {
36750 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36751 }
36752
36753 let request = req_builder
36754 .header(CONTENT_LENGTH, 0_u64)
36755 .body(common::to_body::<String>(None));
36756
36757 client.request(request.unwrap()).await
36758 };
36759
36760 match req_result {
36761 Err(err) => {
36762 if let common::Retry::After(d) = dlg.http_error(&err) {
36763 sleep(d).await;
36764 continue;
36765 }
36766 dlg.finished(false);
36767 return Err(common::Error::HttpError(err));
36768 }
36769 Ok(res) => {
36770 let (mut parts, body) = res.into_parts();
36771 let mut body = common::Body::new(body);
36772 if !parts.status.is_success() {
36773 let bytes = common::to_bytes(body).await.unwrap_or_default();
36774 let error = serde_json::from_str(&common::to_string(&bytes));
36775 let response = common::to_response(parts, bytes.into());
36776
36777 if let common::Retry::After(d) =
36778 dlg.http_failure(&response, error.as_ref().ok())
36779 {
36780 sleep(d).await;
36781 continue;
36782 }
36783
36784 dlg.finished(false);
36785
36786 return Err(match error {
36787 Ok(value) => common::Error::BadRequest(value),
36788 _ => common::Error::Failure(response),
36789 });
36790 }
36791 let response = {
36792 let bytes = common::to_bytes(body).await.unwrap_or_default();
36793 let encoded = common::to_string(&bytes);
36794 match serde_json::from_str(&encoded) {
36795 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36796 Err(error) => {
36797 dlg.response_json_decode_error(&encoded, &error);
36798 return Err(common::Error::JsonDecodeError(
36799 encoded.to_string(),
36800 error,
36801 ));
36802 }
36803 }
36804 };
36805
36806 dlg.finished(true);
36807 return Ok(response);
36808 }
36809 }
36810 }
36811 }
36812
36813 /// GTM UserPermission's API relative path.
36814 ///
36815 /// Sets the *path* path property to the given value.
36816 ///
36817 /// Even though the property as already been set when instantiating this call,
36818 /// we provide this method for API completeness.
36819 pub fn path(mut self, new_value: &str) -> AccountUserPermissionGetCall<'a, C> {
36820 self._path = new_value.to_string();
36821 self
36822 }
36823 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36824 /// while executing the actual API request.
36825 ///
36826 /// ````text
36827 /// It should be used to handle progress information, and to implement a certain level of resilience.
36828 /// ````
36829 ///
36830 /// Sets the *delegate* property to the given value.
36831 pub fn delegate(
36832 mut self,
36833 new_value: &'a mut dyn common::Delegate,
36834 ) -> AccountUserPermissionGetCall<'a, C> {
36835 self._delegate = Some(new_value);
36836 self
36837 }
36838
36839 /// Set any additional parameter of the query string used in the request.
36840 /// It should be used to set parameters which are not yet available through their own
36841 /// setters.
36842 ///
36843 /// Please note that this method must not be used to set any of the known parameters
36844 /// which have their own setter method. If done anyway, the request will fail.
36845 ///
36846 /// # Additional Parameters
36847 ///
36848 /// * *$.xgafv* (query-string) - V1 error format.
36849 /// * *access_token* (query-string) - OAuth access token.
36850 /// * *alt* (query-string) - Data format for response.
36851 /// * *callback* (query-string) - JSONP
36852 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36853 /// * *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.
36854 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36855 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36856 /// * *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.
36857 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36858 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36859 pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionGetCall<'a, C>
36860 where
36861 T: AsRef<str>,
36862 {
36863 self._additional_params
36864 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36865 self
36866 }
36867
36868 /// Identifies the authorization scope for the method you are building.
36869 ///
36870 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36871 /// [`Scope::ManageUser`].
36872 ///
36873 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36874 /// tokens for more than one scope.
36875 ///
36876 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36877 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36878 /// sufficient, a read-write scope will do as well.
36879 pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionGetCall<'a, C>
36880 where
36881 St: AsRef<str>,
36882 {
36883 self._scopes.insert(String::from(scope.as_ref()));
36884 self
36885 }
36886 /// Identifies the authorization scope(s) for the method you are building.
36887 ///
36888 /// See [`Self::add_scope()`] for details.
36889 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionGetCall<'a, C>
36890 where
36891 I: IntoIterator<Item = St>,
36892 St: AsRef<str>,
36893 {
36894 self._scopes
36895 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36896 self
36897 }
36898
36899 /// Removes all scopes, and no default scope will be used either.
36900 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36901 /// for details).
36902 pub fn clear_scopes(mut self) -> AccountUserPermissionGetCall<'a, C> {
36903 self._scopes.clear();
36904 self
36905 }
36906}
36907
36908/// List all users that have access to the account along with Account and Container user access granted to each of them.
36909///
36910/// A builder for the *user_permissions.list* method supported by a *account* resource.
36911/// It is not used directly, but through a [`AccountMethods`] instance.
36912///
36913/// # Example
36914///
36915/// Instantiate a resource method builder
36916///
36917/// ```test_harness,no_run
36918/// # extern crate hyper;
36919/// # extern crate hyper_rustls;
36920/// # extern crate google_tagmanager2 as tagmanager2;
36921/// # async fn dox() {
36922/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36923///
36924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36925/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36926/// # .with_native_roots()
36927/// # .unwrap()
36928/// # .https_only()
36929/// # .enable_http2()
36930/// # .build();
36931///
36932/// # let executor = hyper_util::rt::TokioExecutor::new();
36933/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36934/// # secret,
36935/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36936/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36937/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36938/// # ),
36939/// # ).build().await.unwrap();
36940///
36941/// # let client = hyper_util::client::legacy::Client::builder(
36942/// # hyper_util::rt::TokioExecutor::new()
36943/// # )
36944/// # .build(
36945/// # hyper_rustls::HttpsConnectorBuilder::new()
36946/// # .with_native_roots()
36947/// # .unwrap()
36948/// # .https_or_http()
36949/// # .enable_http2()
36950/// # .build()
36951/// # );
36952/// # let mut hub = TagManager::new(client, auth);
36953/// // You can configure optional parameters by calling the respective setters at will, and
36954/// // execute the final call using `doit()`.
36955/// // Values shown here are possibly random and not representative !
36956/// let result = hub.accounts().user_permissions_list("parent")
36957/// .page_token("sit")
36958/// .doit().await;
36959/// # }
36960/// ```
36961pub struct AccountUserPermissionListCall<'a, C>
36962where
36963 C: 'a,
36964{
36965 hub: &'a TagManager<C>,
36966 _parent: String,
36967 _page_token: Option<String>,
36968 _delegate: Option<&'a mut dyn common::Delegate>,
36969 _additional_params: HashMap<String, String>,
36970 _scopes: BTreeSet<String>,
36971}
36972
36973impl<'a, C> common::CallBuilder for AccountUserPermissionListCall<'a, C> {}
36974
36975impl<'a, C> AccountUserPermissionListCall<'a, C>
36976where
36977 C: common::Connector,
36978{
36979 /// Perform the operation you have build so far.
36980 pub async fn doit(mut self) -> common::Result<(common::Response, ListUserPermissionsResponse)> {
36981 use std::borrow::Cow;
36982 use std::io::{Read, Seek};
36983
36984 use common::{url::Params, ToParts};
36985 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36986
36987 let mut dd = common::DefaultDelegate;
36988 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36989 dlg.begin(common::MethodInfo {
36990 id: "tagmanager.accounts.user_permissions.list",
36991 http_method: hyper::Method::GET,
36992 });
36993
36994 for &field in ["alt", "parent", "pageToken"].iter() {
36995 if self._additional_params.contains_key(field) {
36996 dlg.finished(false);
36997 return Err(common::Error::FieldClash(field));
36998 }
36999 }
37000
37001 let mut params = Params::with_capacity(4 + self._additional_params.len());
37002 params.push("parent", self._parent);
37003 if let Some(value) = self._page_token.as_ref() {
37004 params.push("pageToken", value);
37005 }
37006
37007 params.extend(self._additional_params.iter());
37008
37009 params.push("alt", "json");
37010 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+parent}/user_permissions";
37011 if self._scopes.is_empty() {
37012 self._scopes.insert(Scope::ManageUser.as_ref().to_string());
37013 }
37014
37015 #[allow(clippy::single_element_loop)]
37016 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
37017 url = params.uri_replacement(url, param_name, find_this, true);
37018 }
37019 {
37020 let to_remove = ["parent"];
37021 params.remove_params(&to_remove);
37022 }
37023
37024 let url = params.parse_with_url(&url);
37025
37026 loop {
37027 let token = match self
37028 .hub
37029 .auth
37030 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37031 .await
37032 {
37033 Ok(token) => token,
37034 Err(e) => match dlg.token(e) {
37035 Ok(token) => token,
37036 Err(e) => {
37037 dlg.finished(false);
37038 return Err(common::Error::MissingToken(e));
37039 }
37040 },
37041 };
37042 let mut req_result = {
37043 let client = &self.hub.client;
37044 dlg.pre_request();
37045 let mut req_builder = hyper::Request::builder()
37046 .method(hyper::Method::GET)
37047 .uri(url.as_str())
37048 .header(USER_AGENT, self.hub._user_agent.clone());
37049
37050 if let Some(token) = token.as_ref() {
37051 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37052 }
37053
37054 let request = req_builder
37055 .header(CONTENT_LENGTH, 0_u64)
37056 .body(common::to_body::<String>(None));
37057
37058 client.request(request.unwrap()).await
37059 };
37060
37061 match req_result {
37062 Err(err) => {
37063 if let common::Retry::After(d) = dlg.http_error(&err) {
37064 sleep(d).await;
37065 continue;
37066 }
37067 dlg.finished(false);
37068 return Err(common::Error::HttpError(err));
37069 }
37070 Ok(res) => {
37071 let (mut parts, body) = res.into_parts();
37072 let mut body = common::Body::new(body);
37073 if !parts.status.is_success() {
37074 let bytes = common::to_bytes(body).await.unwrap_or_default();
37075 let error = serde_json::from_str(&common::to_string(&bytes));
37076 let response = common::to_response(parts, bytes.into());
37077
37078 if let common::Retry::After(d) =
37079 dlg.http_failure(&response, error.as_ref().ok())
37080 {
37081 sleep(d).await;
37082 continue;
37083 }
37084
37085 dlg.finished(false);
37086
37087 return Err(match error {
37088 Ok(value) => common::Error::BadRequest(value),
37089 _ => common::Error::Failure(response),
37090 });
37091 }
37092 let response = {
37093 let bytes = common::to_bytes(body).await.unwrap_or_default();
37094 let encoded = common::to_string(&bytes);
37095 match serde_json::from_str(&encoded) {
37096 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37097 Err(error) => {
37098 dlg.response_json_decode_error(&encoded, &error);
37099 return Err(common::Error::JsonDecodeError(
37100 encoded.to_string(),
37101 error,
37102 ));
37103 }
37104 }
37105 };
37106
37107 dlg.finished(true);
37108 return Ok(response);
37109 }
37110 }
37111 }
37112 }
37113
37114 /// GTM Account's API relative path.
37115 ///
37116 /// Sets the *parent* path property to the given value.
37117 ///
37118 /// Even though the property as already been set when instantiating this call,
37119 /// we provide this method for API completeness.
37120 pub fn parent(mut self, new_value: &str) -> AccountUserPermissionListCall<'a, C> {
37121 self._parent = new_value.to_string();
37122 self
37123 }
37124 /// Continuation token for fetching the next page of results.
37125 ///
37126 /// Sets the *page token* query property to the given value.
37127 pub fn page_token(mut self, new_value: &str) -> AccountUserPermissionListCall<'a, C> {
37128 self._page_token = Some(new_value.to_string());
37129 self
37130 }
37131 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37132 /// while executing the actual API request.
37133 ///
37134 /// ````text
37135 /// It should be used to handle progress information, and to implement a certain level of resilience.
37136 /// ````
37137 ///
37138 /// Sets the *delegate* property to the given value.
37139 pub fn delegate(
37140 mut self,
37141 new_value: &'a mut dyn common::Delegate,
37142 ) -> AccountUserPermissionListCall<'a, C> {
37143 self._delegate = Some(new_value);
37144 self
37145 }
37146
37147 /// Set any additional parameter of the query string used in the request.
37148 /// It should be used to set parameters which are not yet available through their own
37149 /// setters.
37150 ///
37151 /// Please note that this method must not be used to set any of the known parameters
37152 /// which have their own setter method. If done anyway, the request will fail.
37153 ///
37154 /// # Additional Parameters
37155 ///
37156 /// * *$.xgafv* (query-string) - V1 error format.
37157 /// * *access_token* (query-string) - OAuth access token.
37158 /// * *alt* (query-string) - Data format for response.
37159 /// * *callback* (query-string) - JSONP
37160 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37161 /// * *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.
37162 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37163 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37164 /// * *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.
37165 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37166 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37167 pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionListCall<'a, C>
37168 where
37169 T: AsRef<str>,
37170 {
37171 self._additional_params
37172 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37173 self
37174 }
37175
37176 /// Identifies the authorization scope for the method you are building.
37177 ///
37178 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37179 /// [`Scope::ManageUser`].
37180 ///
37181 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37182 /// tokens for more than one scope.
37183 ///
37184 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37185 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37186 /// sufficient, a read-write scope will do as well.
37187 pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionListCall<'a, C>
37188 where
37189 St: AsRef<str>,
37190 {
37191 self._scopes.insert(String::from(scope.as_ref()));
37192 self
37193 }
37194 /// Identifies the authorization scope(s) for the method you are building.
37195 ///
37196 /// See [`Self::add_scope()`] for details.
37197 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionListCall<'a, C>
37198 where
37199 I: IntoIterator<Item = St>,
37200 St: AsRef<str>,
37201 {
37202 self._scopes
37203 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37204 self
37205 }
37206
37207 /// Removes all scopes, and no default scope will be used either.
37208 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37209 /// for details).
37210 pub fn clear_scopes(mut self) -> AccountUserPermissionListCall<'a, C> {
37211 self._scopes.clear();
37212 self
37213 }
37214}
37215
37216/// Updates a user's Account & Container access.
37217///
37218/// A builder for the *user_permissions.update* method supported by a *account* resource.
37219/// It is not used directly, but through a [`AccountMethods`] instance.
37220///
37221/// # Example
37222///
37223/// Instantiate a resource method builder
37224///
37225/// ```test_harness,no_run
37226/// # extern crate hyper;
37227/// # extern crate hyper_rustls;
37228/// # extern crate google_tagmanager2 as tagmanager2;
37229/// use tagmanager2::api::UserPermission;
37230/// # async fn dox() {
37231/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37232///
37233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37235/// # .with_native_roots()
37236/// # .unwrap()
37237/// # .https_only()
37238/// # .enable_http2()
37239/// # .build();
37240///
37241/// # let executor = hyper_util::rt::TokioExecutor::new();
37242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37243/// # secret,
37244/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37245/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37246/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37247/// # ),
37248/// # ).build().await.unwrap();
37249///
37250/// # let client = hyper_util::client::legacy::Client::builder(
37251/// # hyper_util::rt::TokioExecutor::new()
37252/// # )
37253/// # .build(
37254/// # hyper_rustls::HttpsConnectorBuilder::new()
37255/// # .with_native_roots()
37256/// # .unwrap()
37257/// # .https_or_http()
37258/// # .enable_http2()
37259/// # .build()
37260/// # );
37261/// # let mut hub = TagManager::new(client, auth);
37262/// // As the method needs a request, you would usually fill it with the desired information
37263/// // into the respective structure. Some of the parts shown here might not be applicable !
37264/// // Values shown here are possibly random and not representative !
37265/// let mut req = UserPermission::default();
37266///
37267/// // You can configure optional parameters by calling the respective setters at will, and
37268/// // execute the final call using `doit()`.
37269/// // Values shown here are possibly random and not representative !
37270/// let result = hub.accounts().user_permissions_update(req, "path")
37271/// .doit().await;
37272/// # }
37273/// ```
37274pub struct AccountUserPermissionUpdateCall<'a, C>
37275where
37276 C: 'a,
37277{
37278 hub: &'a TagManager<C>,
37279 _request: UserPermission,
37280 _path: String,
37281 _delegate: Option<&'a mut dyn common::Delegate>,
37282 _additional_params: HashMap<String, String>,
37283 _scopes: BTreeSet<String>,
37284}
37285
37286impl<'a, C> common::CallBuilder for AccountUserPermissionUpdateCall<'a, C> {}
37287
37288impl<'a, C> AccountUserPermissionUpdateCall<'a, C>
37289where
37290 C: common::Connector,
37291{
37292 /// Perform the operation you have build so far.
37293 pub async fn doit(mut self) -> common::Result<(common::Response, UserPermission)> {
37294 use std::borrow::Cow;
37295 use std::io::{Read, Seek};
37296
37297 use common::{url::Params, ToParts};
37298 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37299
37300 let mut dd = common::DefaultDelegate;
37301 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37302 dlg.begin(common::MethodInfo {
37303 id: "tagmanager.accounts.user_permissions.update",
37304 http_method: hyper::Method::PUT,
37305 });
37306
37307 for &field in ["alt", "path"].iter() {
37308 if self._additional_params.contains_key(field) {
37309 dlg.finished(false);
37310 return Err(common::Error::FieldClash(field));
37311 }
37312 }
37313
37314 let mut params = Params::with_capacity(4 + self._additional_params.len());
37315 params.push("path", self._path);
37316
37317 params.extend(self._additional_params.iter());
37318
37319 params.push("alt", "json");
37320 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
37321 if self._scopes.is_empty() {
37322 self._scopes.insert(Scope::ManageUser.as_ref().to_string());
37323 }
37324
37325 #[allow(clippy::single_element_loop)]
37326 for &(find_this, param_name) in [("{+path}", "path")].iter() {
37327 url = params.uri_replacement(url, param_name, find_this, true);
37328 }
37329 {
37330 let to_remove = ["path"];
37331 params.remove_params(&to_remove);
37332 }
37333
37334 let url = params.parse_with_url(&url);
37335
37336 let mut json_mime_type = mime::APPLICATION_JSON;
37337 let mut request_value_reader = {
37338 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37339 common::remove_json_null_values(&mut value);
37340 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37341 serde_json::to_writer(&mut dst, &value).unwrap();
37342 dst
37343 };
37344 let request_size = request_value_reader
37345 .seek(std::io::SeekFrom::End(0))
37346 .unwrap();
37347 request_value_reader
37348 .seek(std::io::SeekFrom::Start(0))
37349 .unwrap();
37350
37351 loop {
37352 let token = match self
37353 .hub
37354 .auth
37355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37356 .await
37357 {
37358 Ok(token) => token,
37359 Err(e) => match dlg.token(e) {
37360 Ok(token) => token,
37361 Err(e) => {
37362 dlg.finished(false);
37363 return Err(common::Error::MissingToken(e));
37364 }
37365 },
37366 };
37367 request_value_reader
37368 .seek(std::io::SeekFrom::Start(0))
37369 .unwrap();
37370 let mut req_result = {
37371 let client = &self.hub.client;
37372 dlg.pre_request();
37373 let mut req_builder = hyper::Request::builder()
37374 .method(hyper::Method::PUT)
37375 .uri(url.as_str())
37376 .header(USER_AGENT, self.hub._user_agent.clone());
37377
37378 if let Some(token) = token.as_ref() {
37379 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37380 }
37381
37382 let request = req_builder
37383 .header(CONTENT_TYPE, json_mime_type.to_string())
37384 .header(CONTENT_LENGTH, request_size as u64)
37385 .body(common::to_body(
37386 request_value_reader.get_ref().clone().into(),
37387 ));
37388
37389 client.request(request.unwrap()).await
37390 };
37391
37392 match req_result {
37393 Err(err) => {
37394 if let common::Retry::After(d) = dlg.http_error(&err) {
37395 sleep(d).await;
37396 continue;
37397 }
37398 dlg.finished(false);
37399 return Err(common::Error::HttpError(err));
37400 }
37401 Ok(res) => {
37402 let (mut parts, body) = res.into_parts();
37403 let mut body = common::Body::new(body);
37404 if !parts.status.is_success() {
37405 let bytes = common::to_bytes(body).await.unwrap_or_default();
37406 let error = serde_json::from_str(&common::to_string(&bytes));
37407 let response = common::to_response(parts, bytes.into());
37408
37409 if let common::Retry::After(d) =
37410 dlg.http_failure(&response, error.as_ref().ok())
37411 {
37412 sleep(d).await;
37413 continue;
37414 }
37415
37416 dlg.finished(false);
37417
37418 return Err(match error {
37419 Ok(value) => common::Error::BadRequest(value),
37420 _ => common::Error::Failure(response),
37421 });
37422 }
37423 let response = {
37424 let bytes = common::to_bytes(body).await.unwrap_or_default();
37425 let encoded = common::to_string(&bytes);
37426 match serde_json::from_str(&encoded) {
37427 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37428 Err(error) => {
37429 dlg.response_json_decode_error(&encoded, &error);
37430 return Err(common::Error::JsonDecodeError(
37431 encoded.to_string(),
37432 error,
37433 ));
37434 }
37435 }
37436 };
37437
37438 dlg.finished(true);
37439 return Ok(response);
37440 }
37441 }
37442 }
37443 }
37444
37445 ///
37446 /// Sets the *request* property to the given value.
37447 ///
37448 /// Even though the property as already been set when instantiating this call,
37449 /// we provide this method for API completeness.
37450 pub fn request(mut self, new_value: UserPermission) -> AccountUserPermissionUpdateCall<'a, C> {
37451 self._request = new_value;
37452 self
37453 }
37454 /// GTM UserPermission's API relative path.
37455 ///
37456 /// Sets the *path* path property to the given value.
37457 ///
37458 /// Even though the property as already been set when instantiating this call,
37459 /// we provide this method for API completeness.
37460 pub fn path(mut self, new_value: &str) -> AccountUserPermissionUpdateCall<'a, C> {
37461 self._path = new_value.to_string();
37462 self
37463 }
37464 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37465 /// while executing the actual API request.
37466 ///
37467 /// ````text
37468 /// It should be used to handle progress information, and to implement a certain level of resilience.
37469 /// ````
37470 ///
37471 /// Sets the *delegate* property to the given value.
37472 pub fn delegate(
37473 mut self,
37474 new_value: &'a mut dyn common::Delegate,
37475 ) -> AccountUserPermissionUpdateCall<'a, C> {
37476 self._delegate = Some(new_value);
37477 self
37478 }
37479
37480 /// Set any additional parameter of the query string used in the request.
37481 /// It should be used to set parameters which are not yet available through their own
37482 /// setters.
37483 ///
37484 /// Please note that this method must not be used to set any of the known parameters
37485 /// which have their own setter method. If done anyway, the request will fail.
37486 ///
37487 /// # Additional Parameters
37488 ///
37489 /// * *$.xgafv* (query-string) - V1 error format.
37490 /// * *access_token* (query-string) - OAuth access token.
37491 /// * *alt* (query-string) - Data format for response.
37492 /// * *callback* (query-string) - JSONP
37493 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37494 /// * *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.
37495 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37496 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37497 /// * *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.
37498 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37499 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37500 pub fn param<T>(mut self, name: T, value: T) -> AccountUserPermissionUpdateCall<'a, C>
37501 where
37502 T: AsRef<str>,
37503 {
37504 self._additional_params
37505 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37506 self
37507 }
37508
37509 /// Identifies the authorization scope for the method you are building.
37510 ///
37511 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37512 /// [`Scope::ManageUser`].
37513 ///
37514 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37515 /// tokens for more than one scope.
37516 ///
37517 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37518 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37519 /// sufficient, a read-write scope will do as well.
37520 pub fn add_scope<St>(mut self, scope: St) -> AccountUserPermissionUpdateCall<'a, C>
37521 where
37522 St: AsRef<str>,
37523 {
37524 self._scopes.insert(String::from(scope.as_ref()));
37525 self
37526 }
37527 /// Identifies the authorization scope(s) for the method you are building.
37528 ///
37529 /// See [`Self::add_scope()`] for details.
37530 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserPermissionUpdateCall<'a, C>
37531 where
37532 I: IntoIterator<Item = St>,
37533 St: AsRef<str>,
37534 {
37535 self._scopes
37536 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37537 self
37538 }
37539
37540 /// Removes all scopes, and no default scope will be used either.
37541 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37542 /// for details).
37543 pub fn clear_scopes(mut self) -> AccountUserPermissionUpdateCall<'a, C> {
37544 self._scopes.clear();
37545 self
37546 }
37547}
37548
37549/// Gets a GTM Account.
37550///
37551/// A builder for the *get* method supported by a *account* resource.
37552/// It is not used directly, but through a [`AccountMethods`] instance.
37553///
37554/// # Example
37555///
37556/// Instantiate a resource method builder
37557///
37558/// ```test_harness,no_run
37559/// # extern crate hyper;
37560/// # extern crate hyper_rustls;
37561/// # extern crate google_tagmanager2 as tagmanager2;
37562/// # async fn dox() {
37563/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37564///
37565/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37566/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37567/// # .with_native_roots()
37568/// # .unwrap()
37569/// # .https_only()
37570/// # .enable_http2()
37571/// # .build();
37572///
37573/// # let executor = hyper_util::rt::TokioExecutor::new();
37574/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37575/// # secret,
37576/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37577/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37578/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37579/// # ),
37580/// # ).build().await.unwrap();
37581///
37582/// # let client = hyper_util::client::legacy::Client::builder(
37583/// # hyper_util::rt::TokioExecutor::new()
37584/// # )
37585/// # .build(
37586/// # hyper_rustls::HttpsConnectorBuilder::new()
37587/// # .with_native_roots()
37588/// # .unwrap()
37589/// # .https_or_http()
37590/// # .enable_http2()
37591/// # .build()
37592/// # );
37593/// # let mut hub = TagManager::new(client, auth);
37594/// // You can configure optional parameters by calling the respective setters at will, and
37595/// // execute the final call using `doit()`.
37596/// // Values shown here are possibly random and not representative !
37597/// let result = hub.accounts().get("path")
37598/// .doit().await;
37599/// # }
37600/// ```
37601pub struct AccountGetCall<'a, C>
37602where
37603 C: 'a,
37604{
37605 hub: &'a TagManager<C>,
37606 _path: String,
37607 _delegate: Option<&'a mut dyn common::Delegate>,
37608 _additional_params: HashMap<String, String>,
37609 _scopes: BTreeSet<String>,
37610}
37611
37612impl<'a, C> common::CallBuilder for AccountGetCall<'a, C> {}
37613
37614impl<'a, C> AccountGetCall<'a, C>
37615where
37616 C: common::Connector,
37617{
37618 /// Perform the operation you have build so far.
37619 pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
37620 use std::borrow::Cow;
37621 use std::io::{Read, Seek};
37622
37623 use common::{url::Params, ToParts};
37624 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37625
37626 let mut dd = common::DefaultDelegate;
37627 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37628 dlg.begin(common::MethodInfo {
37629 id: "tagmanager.accounts.get",
37630 http_method: hyper::Method::GET,
37631 });
37632
37633 for &field in ["alt", "path"].iter() {
37634 if self._additional_params.contains_key(field) {
37635 dlg.finished(false);
37636 return Err(common::Error::FieldClash(field));
37637 }
37638 }
37639
37640 let mut params = Params::with_capacity(3 + self._additional_params.len());
37641 params.push("path", self._path);
37642
37643 params.extend(self._additional_params.iter());
37644
37645 params.push("alt", "json");
37646 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
37647 if self._scopes.is_empty() {
37648 self._scopes.insert(Scope::Readonly.as_ref().to_string());
37649 }
37650
37651 #[allow(clippy::single_element_loop)]
37652 for &(find_this, param_name) in [("{+path}", "path")].iter() {
37653 url = params.uri_replacement(url, param_name, find_this, true);
37654 }
37655 {
37656 let to_remove = ["path"];
37657 params.remove_params(&to_remove);
37658 }
37659
37660 let url = params.parse_with_url(&url);
37661
37662 loop {
37663 let token = match self
37664 .hub
37665 .auth
37666 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37667 .await
37668 {
37669 Ok(token) => token,
37670 Err(e) => match dlg.token(e) {
37671 Ok(token) => token,
37672 Err(e) => {
37673 dlg.finished(false);
37674 return Err(common::Error::MissingToken(e));
37675 }
37676 },
37677 };
37678 let mut req_result = {
37679 let client = &self.hub.client;
37680 dlg.pre_request();
37681 let mut req_builder = hyper::Request::builder()
37682 .method(hyper::Method::GET)
37683 .uri(url.as_str())
37684 .header(USER_AGENT, self.hub._user_agent.clone());
37685
37686 if let Some(token) = token.as_ref() {
37687 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37688 }
37689
37690 let request = req_builder
37691 .header(CONTENT_LENGTH, 0_u64)
37692 .body(common::to_body::<String>(None));
37693
37694 client.request(request.unwrap()).await
37695 };
37696
37697 match req_result {
37698 Err(err) => {
37699 if let common::Retry::After(d) = dlg.http_error(&err) {
37700 sleep(d).await;
37701 continue;
37702 }
37703 dlg.finished(false);
37704 return Err(common::Error::HttpError(err));
37705 }
37706 Ok(res) => {
37707 let (mut parts, body) = res.into_parts();
37708 let mut body = common::Body::new(body);
37709 if !parts.status.is_success() {
37710 let bytes = common::to_bytes(body).await.unwrap_or_default();
37711 let error = serde_json::from_str(&common::to_string(&bytes));
37712 let response = common::to_response(parts, bytes.into());
37713
37714 if let common::Retry::After(d) =
37715 dlg.http_failure(&response, error.as_ref().ok())
37716 {
37717 sleep(d).await;
37718 continue;
37719 }
37720
37721 dlg.finished(false);
37722
37723 return Err(match error {
37724 Ok(value) => common::Error::BadRequest(value),
37725 _ => common::Error::Failure(response),
37726 });
37727 }
37728 let response = {
37729 let bytes = common::to_bytes(body).await.unwrap_or_default();
37730 let encoded = common::to_string(&bytes);
37731 match serde_json::from_str(&encoded) {
37732 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37733 Err(error) => {
37734 dlg.response_json_decode_error(&encoded, &error);
37735 return Err(common::Error::JsonDecodeError(
37736 encoded.to_string(),
37737 error,
37738 ));
37739 }
37740 }
37741 };
37742
37743 dlg.finished(true);
37744 return Ok(response);
37745 }
37746 }
37747 }
37748 }
37749
37750 /// GTM Account's API relative path.
37751 ///
37752 /// Sets the *path* path property to the given value.
37753 ///
37754 /// Even though the property as already been set when instantiating this call,
37755 /// we provide this method for API completeness.
37756 pub fn path(mut self, new_value: &str) -> AccountGetCall<'a, C> {
37757 self._path = new_value.to_string();
37758 self
37759 }
37760 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37761 /// while executing the actual API request.
37762 ///
37763 /// ````text
37764 /// It should be used to handle progress information, and to implement a certain level of resilience.
37765 /// ````
37766 ///
37767 /// Sets the *delegate* property to the given value.
37768 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountGetCall<'a, C> {
37769 self._delegate = Some(new_value);
37770 self
37771 }
37772
37773 /// Set any additional parameter of the query string used in the request.
37774 /// It should be used to set parameters which are not yet available through their own
37775 /// setters.
37776 ///
37777 /// Please note that this method must not be used to set any of the known parameters
37778 /// which have their own setter method. If done anyway, the request will fail.
37779 ///
37780 /// # Additional Parameters
37781 ///
37782 /// * *$.xgafv* (query-string) - V1 error format.
37783 /// * *access_token* (query-string) - OAuth access token.
37784 /// * *alt* (query-string) - Data format for response.
37785 /// * *callback* (query-string) - JSONP
37786 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37787 /// * *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.
37788 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37789 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37790 /// * *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.
37791 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37792 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37793 pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, C>
37794 where
37795 T: AsRef<str>,
37796 {
37797 self._additional_params
37798 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37799 self
37800 }
37801
37802 /// Identifies the authorization scope for the method you are building.
37803 ///
37804 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37805 /// [`Scope::Readonly`].
37806 ///
37807 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37808 /// tokens for more than one scope.
37809 ///
37810 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37811 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37812 /// sufficient, a read-write scope will do as well.
37813 pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, C>
37814 where
37815 St: AsRef<str>,
37816 {
37817 self._scopes.insert(String::from(scope.as_ref()));
37818 self
37819 }
37820 /// Identifies the authorization scope(s) for the method you are building.
37821 ///
37822 /// See [`Self::add_scope()`] for details.
37823 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, C>
37824 where
37825 I: IntoIterator<Item = St>,
37826 St: AsRef<str>,
37827 {
37828 self._scopes
37829 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37830 self
37831 }
37832
37833 /// Removes all scopes, and no default scope will be used either.
37834 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37835 /// for details).
37836 pub fn clear_scopes(mut self) -> AccountGetCall<'a, C> {
37837 self._scopes.clear();
37838 self
37839 }
37840}
37841
37842/// Lists all GTM Accounts that a user has access to.
37843///
37844/// A builder for the *list* method supported by a *account* resource.
37845/// It is not used directly, but through a [`AccountMethods`] instance.
37846///
37847/// # Example
37848///
37849/// Instantiate a resource method builder
37850///
37851/// ```test_harness,no_run
37852/// # extern crate hyper;
37853/// # extern crate hyper_rustls;
37854/// # extern crate google_tagmanager2 as tagmanager2;
37855/// # async fn dox() {
37856/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37857///
37858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37859/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37860/// # .with_native_roots()
37861/// # .unwrap()
37862/// # .https_only()
37863/// # .enable_http2()
37864/// # .build();
37865///
37866/// # let executor = hyper_util::rt::TokioExecutor::new();
37867/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37868/// # secret,
37869/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37870/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37871/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37872/// # ),
37873/// # ).build().await.unwrap();
37874///
37875/// # let client = hyper_util::client::legacy::Client::builder(
37876/// # hyper_util::rt::TokioExecutor::new()
37877/// # )
37878/// # .build(
37879/// # hyper_rustls::HttpsConnectorBuilder::new()
37880/// # .with_native_roots()
37881/// # .unwrap()
37882/// # .https_or_http()
37883/// # .enable_http2()
37884/// # .build()
37885/// # );
37886/// # let mut hub = TagManager::new(client, auth);
37887/// // You can configure optional parameters by calling the respective setters at will, and
37888/// // execute the final call using `doit()`.
37889/// // Values shown here are possibly random and not representative !
37890/// let result = hub.accounts().list()
37891/// .page_token("rebum.")
37892/// .include_google_tags(false)
37893/// .doit().await;
37894/// # }
37895/// ```
37896pub struct AccountListCall<'a, C>
37897where
37898 C: 'a,
37899{
37900 hub: &'a TagManager<C>,
37901 _page_token: Option<String>,
37902 _include_google_tags: Option<bool>,
37903 _delegate: Option<&'a mut dyn common::Delegate>,
37904 _additional_params: HashMap<String, String>,
37905 _scopes: BTreeSet<String>,
37906}
37907
37908impl<'a, C> common::CallBuilder for AccountListCall<'a, C> {}
37909
37910impl<'a, C> AccountListCall<'a, C>
37911where
37912 C: common::Connector,
37913{
37914 /// Perform the operation you have build so far.
37915 pub async fn doit(mut self) -> common::Result<(common::Response, ListAccountsResponse)> {
37916 use std::borrow::Cow;
37917 use std::io::{Read, Seek};
37918
37919 use common::{url::Params, ToParts};
37920 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37921
37922 let mut dd = common::DefaultDelegate;
37923 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37924 dlg.begin(common::MethodInfo {
37925 id: "tagmanager.accounts.list",
37926 http_method: hyper::Method::GET,
37927 });
37928
37929 for &field in ["alt", "pageToken", "includeGoogleTags"].iter() {
37930 if self._additional_params.contains_key(field) {
37931 dlg.finished(false);
37932 return Err(common::Error::FieldClash(field));
37933 }
37934 }
37935
37936 let mut params = Params::with_capacity(4 + self._additional_params.len());
37937 if let Some(value) = self._page_token.as_ref() {
37938 params.push("pageToken", value);
37939 }
37940 if let Some(value) = self._include_google_tags.as_ref() {
37941 params.push("includeGoogleTags", value.to_string());
37942 }
37943
37944 params.extend(self._additional_params.iter());
37945
37946 params.push("alt", "json");
37947 let mut url = self.hub._base_url.clone() + "tagmanager/v2/accounts";
37948 if self._scopes.is_empty() {
37949 self._scopes.insert(Scope::Readonly.as_ref().to_string());
37950 }
37951
37952 let url = params.parse_with_url(&url);
37953
37954 loop {
37955 let token = match self
37956 .hub
37957 .auth
37958 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37959 .await
37960 {
37961 Ok(token) => token,
37962 Err(e) => match dlg.token(e) {
37963 Ok(token) => token,
37964 Err(e) => {
37965 dlg.finished(false);
37966 return Err(common::Error::MissingToken(e));
37967 }
37968 },
37969 };
37970 let mut req_result = {
37971 let client = &self.hub.client;
37972 dlg.pre_request();
37973 let mut req_builder = hyper::Request::builder()
37974 .method(hyper::Method::GET)
37975 .uri(url.as_str())
37976 .header(USER_AGENT, self.hub._user_agent.clone());
37977
37978 if let Some(token) = token.as_ref() {
37979 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37980 }
37981
37982 let request = req_builder
37983 .header(CONTENT_LENGTH, 0_u64)
37984 .body(common::to_body::<String>(None));
37985
37986 client.request(request.unwrap()).await
37987 };
37988
37989 match req_result {
37990 Err(err) => {
37991 if let common::Retry::After(d) = dlg.http_error(&err) {
37992 sleep(d).await;
37993 continue;
37994 }
37995 dlg.finished(false);
37996 return Err(common::Error::HttpError(err));
37997 }
37998 Ok(res) => {
37999 let (mut parts, body) = res.into_parts();
38000 let mut body = common::Body::new(body);
38001 if !parts.status.is_success() {
38002 let bytes = common::to_bytes(body).await.unwrap_or_default();
38003 let error = serde_json::from_str(&common::to_string(&bytes));
38004 let response = common::to_response(parts, bytes.into());
38005
38006 if let common::Retry::After(d) =
38007 dlg.http_failure(&response, error.as_ref().ok())
38008 {
38009 sleep(d).await;
38010 continue;
38011 }
38012
38013 dlg.finished(false);
38014
38015 return Err(match error {
38016 Ok(value) => common::Error::BadRequest(value),
38017 _ => common::Error::Failure(response),
38018 });
38019 }
38020 let response = {
38021 let bytes = common::to_bytes(body).await.unwrap_or_default();
38022 let encoded = common::to_string(&bytes);
38023 match serde_json::from_str(&encoded) {
38024 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38025 Err(error) => {
38026 dlg.response_json_decode_error(&encoded, &error);
38027 return Err(common::Error::JsonDecodeError(
38028 encoded.to_string(),
38029 error,
38030 ));
38031 }
38032 }
38033 };
38034
38035 dlg.finished(true);
38036 return Ok(response);
38037 }
38038 }
38039 }
38040 }
38041
38042 /// Continuation token for fetching the next page of results.
38043 ///
38044 /// Sets the *page token* query property to the given value.
38045 pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C> {
38046 self._page_token = Some(new_value.to_string());
38047 self
38048 }
38049 /// Also retrieve accounts associated with Google Tag when true.
38050 ///
38051 /// Sets the *include google tags* query property to the given value.
38052 pub fn include_google_tags(mut self, new_value: bool) -> AccountListCall<'a, C> {
38053 self._include_google_tags = Some(new_value);
38054 self
38055 }
38056 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38057 /// while executing the actual API request.
38058 ///
38059 /// ````text
38060 /// It should be used to handle progress information, and to implement a certain level of resilience.
38061 /// ````
38062 ///
38063 /// Sets the *delegate* property to the given value.
38064 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountListCall<'a, C> {
38065 self._delegate = Some(new_value);
38066 self
38067 }
38068
38069 /// Set any additional parameter of the query string used in the request.
38070 /// It should be used to set parameters which are not yet available through their own
38071 /// setters.
38072 ///
38073 /// Please note that this method must not be used to set any of the known parameters
38074 /// which have their own setter method. If done anyway, the request will fail.
38075 ///
38076 /// # Additional Parameters
38077 ///
38078 /// * *$.xgafv* (query-string) - V1 error format.
38079 /// * *access_token* (query-string) - OAuth access token.
38080 /// * *alt* (query-string) - Data format for response.
38081 /// * *callback* (query-string) - JSONP
38082 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38083 /// * *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.
38084 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38085 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38086 /// * *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.
38087 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38088 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38089 pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, C>
38090 where
38091 T: AsRef<str>,
38092 {
38093 self._additional_params
38094 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38095 self
38096 }
38097
38098 /// Identifies the authorization scope for the method you are building.
38099 ///
38100 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38101 /// [`Scope::Readonly`].
38102 ///
38103 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38104 /// tokens for more than one scope.
38105 ///
38106 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38107 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38108 /// sufficient, a read-write scope will do as well.
38109 pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, C>
38110 where
38111 St: AsRef<str>,
38112 {
38113 self._scopes.insert(String::from(scope.as_ref()));
38114 self
38115 }
38116 /// Identifies the authorization scope(s) for the method you are building.
38117 ///
38118 /// See [`Self::add_scope()`] for details.
38119 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, C>
38120 where
38121 I: IntoIterator<Item = St>,
38122 St: AsRef<str>,
38123 {
38124 self._scopes
38125 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38126 self
38127 }
38128
38129 /// Removes all scopes, and no default scope will be used either.
38130 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38131 /// for details).
38132 pub fn clear_scopes(mut self) -> AccountListCall<'a, C> {
38133 self._scopes.clear();
38134 self
38135 }
38136}
38137
38138/// Updates a GTM Account.
38139///
38140/// A builder for the *update* method supported by a *account* resource.
38141/// It is not used directly, but through a [`AccountMethods`] instance.
38142///
38143/// # Example
38144///
38145/// Instantiate a resource method builder
38146///
38147/// ```test_harness,no_run
38148/// # extern crate hyper;
38149/// # extern crate hyper_rustls;
38150/// # extern crate google_tagmanager2 as tagmanager2;
38151/// use tagmanager2::api::Account;
38152/// # async fn dox() {
38153/// # use tagmanager2::{TagManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38154///
38155/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38156/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38157/// # .with_native_roots()
38158/// # .unwrap()
38159/// # .https_only()
38160/// # .enable_http2()
38161/// # .build();
38162///
38163/// # let executor = hyper_util::rt::TokioExecutor::new();
38164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38165/// # secret,
38166/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38167/// # yup_oauth2::client::CustomHyperClientBuilder::from(
38168/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
38169/// # ),
38170/// # ).build().await.unwrap();
38171///
38172/// # let client = hyper_util::client::legacy::Client::builder(
38173/// # hyper_util::rt::TokioExecutor::new()
38174/// # )
38175/// # .build(
38176/// # hyper_rustls::HttpsConnectorBuilder::new()
38177/// # .with_native_roots()
38178/// # .unwrap()
38179/// # .https_or_http()
38180/// # .enable_http2()
38181/// # .build()
38182/// # );
38183/// # let mut hub = TagManager::new(client, auth);
38184/// // As the method needs a request, you would usually fill it with the desired information
38185/// // into the respective structure. Some of the parts shown here might not be applicable !
38186/// // Values shown here are possibly random and not representative !
38187/// let mut req = Account::default();
38188///
38189/// // You can configure optional parameters by calling the respective setters at will, and
38190/// // execute the final call using `doit()`.
38191/// // Values shown here are possibly random and not representative !
38192/// let result = hub.accounts().update(req, "path")
38193/// .fingerprint("no")
38194/// .doit().await;
38195/// # }
38196/// ```
38197pub struct AccountUpdateCall<'a, C>
38198where
38199 C: 'a,
38200{
38201 hub: &'a TagManager<C>,
38202 _request: Account,
38203 _path: String,
38204 _fingerprint: Option<String>,
38205 _delegate: Option<&'a mut dyn common::Delegate>,
38206 _additional_params: HashMap<String, String>,
38207 _scopes: BTreeSet<String>,
38208}
38209
38210impl<'a, C> common::CallBuilder for AccountUpdateCall<'a, C> {}
38211
38212impl<'a, C> AccountUpdateCall<'a, C>
38213where
38214 C: common::Connector,
38215{
38216 /// Perform the operation you have build so far.
38217 pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
38218 use std::borrow::Cow;
38219 use std::io::{Read, Seek};
38220
38221 use common::{url::Params, ToParts};
38222 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38223
38224 let mut dd = common::DefaultDelegate;
38225 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38226 dlg.begin(common::MethodInfo {
38227 id: "tagmanager.accounts.update",
38228 http_method: hyper::Method::PUT,
38229 });
38230
38231 for &field in ["alt", "path", "fingerprint"].iter() {
38232 if self._additional_params.contains_key(field) {
38233 dlg.finished(false);
38234 return Err(common::Error::FieldClash(field));
38235 }
38236 }
38237
38238 let mut params = Params::with_capacity(5 + self._additional_params.len());
38239 params.push("path", self._path);
38240 if let Some(value) = self._fingerprint.as_ref() {
38241 params.push("fingerprint", value);
38242 }
38243
38244 params.extend(self._additional_params.iter());
38245
38246 params.push("alt", "json");
38247 let mut url = self.hub._base_url.clone() + "tagmanager/v2/{+path}";
38248 if self._scopes.is_empty() {
38249 self._scopes
38250 .insert(Scope::ManageAccount.as_ref().to_string());
38251 }
38252
38253 #[allow(clippy::single_element_loop)]
38254 for &(find_this, param_name) in [("{+path}", "path")].iter() {
38255 url = params.uri_replacement(url, param_name, find_this, true);
38256 }
38257 {
38258 let to_remove = ["path"];
38259 params.remove_params(&to_remove);
38260 }
38261
38262 let url = params.parse_with_url(&url);
38263
38264 let mut json_mime_type = mime::APPLICATION_JSON;
38265 let mut request_value_reader = {
38266 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38267 common::remove_json_null_values(&mut value);
38268 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38269 serde_json::to_writer(&mut dst, &value).unwrap();
38270 dst
38271 };
38272 let request_size = request_value_reader
38273 .seek(std::io::SeekFrom::End(0))
38274 .unwrap();
38275 request_value_reader
38276 .seek(std::io::SeekFrom::Start(0))
38277 .unwrap();
38278
38279 loop {
38280 let token = match self
38281 .hub
38282 .auth
38283 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38284 .await
38285 {
38286 Ok(token) => token,
38287 Err(e) => match dlg.token(e) {
38288 Ok(token) => token,
38289 Err(e) => {
38290 dlg.finished(false);
38291 return Err(common::Error::MissingToken(e));
38292 }
38293 },
38294 };
38295 request_value_reader
38296 .seek(std::io::SeekFrom::Start(0))
38297 .unwrap();
38298 let mut req_result = {
38299 let client = &self.hub.client;
38300 dlg.pre_request();
38301 let mut req_builder = hyper::Request::builder()
38302 .method(hyper::Method::PUT)
38303 .uri(url.as_str())
38304 .header(USER_AGENT, self.hub._user_agent.clone());
38305
38306 if let Some(token) = token.as_ref() {
38307 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38308 }
38309
38310 let request = req_builder
38311 .header(CONTENT_TYPE, json_mime_type.to_string())
38312 .header(CONTENT_LENGTH, request_size as u64)
38313 .body(common::to_body(
38314 request_value_reader.get_ref().clone().into(),
38315 ));
38316
38317 client.request(request.unwrap()).await
38318 };
38319
38320 match req_result {
38321 Err(err) => {
38322 if let common::Retry::After(d) = dlg.http_error(&err) {
38323 sleep(d).await;
38324 continue;
38325 }
38326 dlg.finished(false);
38327 return Err(common::Error::HttpError(err));
38328 }
38329 Ok(res) => {
38330 let (mut parts, body) = res.into_parts();
38331 let mut body = common::Body::new(body);
38332 if !parts.status.is_success() {
38333 let bytes = common::to_bytes(body).await.unwrap_or_default();
38334 let error = serde_json::from_str(&common::to_string(&bytes));
38335 let response = common::to_response(parts, bytes.into());
38336
38337 if let common::Retry::After(d) =
38338 dlg.http_failure(&response, error.as_ref().ok())
38339 {
38340 sleep(d).await;
38341 continue;
38342 }
38343
38344 dlg.finished(false);
38345
38346 return Err(match error {
38347 Ok(value) => common::Error::BadRequest(value),
38348 _ => common::Error::Failure(response),
38349 });
38350 }
38351 let response = {
38352 let bytes = common::to_bytes(body).await.unwrap_or_default();
38353 let encoded = common::to_string(&bytes);
38354 match serde_json::from_str(&encoded) {
38355 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38356 Err(error) => {
38357 dlg.response_json_decode_error(&encoded, &error);
38358 return Err(common::Error::JsonDecodeError(
38359 encoded.to_string(),
38360 error,
38361 ));
38362 }
38363 }
38364 };
38365
38366 dlg.finished(true);
38367 return Ok(response);
38368 }
38369 }
38370 }
38371 }
38372
38373 ///
38374 /// Sets the *request* property to the given value.
38375 ///
38376 /// Even though the property as already been set when instantiating this call,
38377 /// we provide this method for API completeness.
38378 pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C> {
38379 self._request = new_value;
38380 self
38381 }
38382 /// GTM Account's API relative path.
38383 ///
38384 /// Sets the *path* path property to the given value.
38385 ///
38386 /// Even though the property as already been set when instantiating this call,
38387 /// we provide this method for API completeness.
38388 pub fn path(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
38389 self._path = new_value.to_string();
38390 self
38391 }
38392 /// When provided, this fingerprint must match the fingerprint of the account in storage.
38393 ///
38394 /// Sets the *fingerprint* query property to the given value.
38395 pub fn fingerprint(mut self, new_value: &str) -> AccountUpdateCall<'a, C> {
38396 self._fingerprint = Some(new_value.to_string());
38397 self
38398 }
38399 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38400 /// while executing the actual API request.
38401 ///
38402 /// ````text
38403 /// It should be used to handle progress information, and to implement a certain level of resilience.
38404 /// ````
38405 ///
38406 /// Sets the *delegate* property to the given value.
38407 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountUpdateCall<'a, C> {
38408 self._delegate = Some(new_value);
38409 self
38410 }
38411
38412 /// Set any additional parameter of the query string used in the request.
38413 /// It should be used to set parameters which are not yet available through their own
38414 /// setters.
38415 ///
38416 /// Please note that this method must not be used to set any of the known parameters
38417 /// which have their own setter method. If done anyway, the request will fail.
38418 ///
38419 /// # Additional Parameters
38420 ///
38421 /// * *$.xgafv* (query-string) - V1 error format.
38422 /// * *access_token* (query-string) - OAuth access token.
38423 /// * *alt* (query-string) - Data format for response.
38424 /// * *callback* (query-string) - JSONP
38425 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38426 /// * *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.
38427 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38428 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38429 /// * *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.
38430 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38431 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38432 pub fn param<T>(mut self, name: T, value: T) -> AccountUpdateCall<'a, C>
38433 where
38434 T: AsRef<str>,
38435 {
38436 self._additional_params
38437 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38438 self
38439 }
38440
38441 /// Identifies the authorization scope for the method you are building.
38442 ///
38443 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38444 /// [`Scope::ManageAccount`].
38445 ///
38446 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38447 /// tokens for more than one scope.
38448 ///
38449 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38450 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38451 /// sufficient, a read-write scope will do as well.
38452 pub fn add_scope<St>(mut self, scope: St) -> AccountUpdateCall<'a, C>
38453 where
38454 St: AsRef<str>,
38455 {
38456 self._scopes.insert(String::from(scope.as_ref()));
38457 self
38458 }
38459 /// Identifies the authorization scope(s) for the method you are building.
38460 ///
38461 /// See [`Self::add_scope()`] for details.
38462 pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUpdateCall<'a, C>
38463 where
38464 I: IntoIterator<Item = St>,
38465 St: AsRef<str>,
38466 {
38467 self._scopes
38468 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38469 self
38470 }
38471
38472 /// Removes all scopes, and no default scope will be used either.
38473 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38474 /// for details).
38475 pub fn clear_scopes(mut self) -> AccountUpdateCall<'a, C> {
38476 self._scopes.clear();
38477 self
38478 }
38479}