google_analyticsadmin1_alpha/
api.rs

1use std::collections::HashMap;
2use std::cell::RefCell;
3use std::default::Default;
4use std::collections::BTreeSet;
5use std::error::Error as StdError;
6use serde_json as json;
7use std::io;
8use std::fs;
9use std::mem;
10
11use hyper::client::connect;
12use tokio::io::{AsyncRead, AsyncWrite};
13use tokio::time::sleep;
14use tower_service;
15use serde::{Serialize, Deserialize};
16
17use crate::{client, client::GetToken, client::serde_with};
18
19// ##############
20// UTILITIES ###
21// ############
22
23/// Identifies the an OAuth2 authorization scope.
24/// A scope is needed when requesting an
25/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
26#[derive(PartialEq, Eq, Hash)]
27pub enum Scope {
28    /// Edit Google Analytics management entities
29    AnalyticEdit,
30
31    /// Manage Google Analytics Account users by email address
32    AnalyticManageUser,
33
34    /// View Google Analytics user permissions
35    AnalyticManageUserReadonly,
36
37    /// See and download your Google Analytics data
38    AnalyticReadonly,
39}
40
41impl AsRef<str> for Scope {
42    fn as_ref(&self) -> &str {
43        match *self {
44            Scope::AnalyticEdit => "https://www.googleapis.com/auth/analytics.edit",
45            Scope::AnalyticManageUser => "https://www.googleapis.com/auth/analytics.manage.users",
46            Scope::AnalyticManageUserReadonly => "https://www.googleapis.com/auth/analytics.manage.users.readonly",
47            Scope::AnalyticReadonly => "https://www.googleapis.com/auth/analytics.readonly",
48        }
49    }
50}
51
52impl Default for Scope {
53    fn default() -> Scope {
54        Scope::AnalyticManageUserReadonly
55    }
56}
57
58
59
60// ########
61// HUB ###
62// ######
63
64/// Central instance to access all GoogleAnalyticsAdmin related resource activities
65///
66/// # Examples
67///
68/// Instantiate a new hub
69///
70/// ```test_harness,no_run
71/// extern crate hyper;
72/// extern crate hyper_rustls;
73/// extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
74/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest;
75/// use analyticsadmin1_alpha::{Result, Error};
76/// # async fn dox() {
77/// use std::default::Default;
78/// use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
79/// 
80/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and 
81/// // `client_secret`, among other things.
82/// let secret: oauth2::ApplicationSecret = Default::default();
83/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, 
84/// // unless you replace  `None` with the desired Flow.
85/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
86/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
87/// // retrieve them from storage.
88/// let auth = oauth2::InstalledFlowAuthenticator::builder(
89///         secret,
90///         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
91///     ).build().await.unwrap();
92/// let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
93/// // As the method needs a request, you would usually fill it with the desired information
94/// // into the respective structure. Some of the parts shown here might not be applicable !
95/// // Values shown here are possibly random and not representative !
96/// let mut req = GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest::default();
97/// 
98/// // You can configure optional parameters by calling the respective setters at will, and
99/// // execute the final call using `doit()`.
100/// // Values shown here are possibly random and not representative !
101/// let result = hub.accounts().user_links_batch_delete(req, "parent")
102///              .doit().await;
103/// 
104/// match result {
105///     Err(e) => match e {
106///         // The Error enum provides details about what exactly happened.
107///         // You can also just use its `Debug`, `Display` or `Error` traits
108///          Error::HttpError(_)
109///         |Error::Io(_)
110///         |Error::MissingAPIKey
111///         |Error::MissingToken(_)
112///         |Error::Cancelled
113///         |Error::UploadSizeLimitExceeded(_, _)
114///         |Error::Failure(_)
115///         |Error::BadRequest(_)
116///         |Error::FieldClash(_)
117///         |Error::JsonDecodeError(_, _) => println!("{}", e),
118///     },
119///     Ok(res) => println!("Success: {:?}", res),
120/// }
121/// # }
122/// ```
123#[derive(Clone)]
124pub struct GoogleAnalyticsAdmin<S> {
125    pub client: hyper::Client<S, hyper::body::Body>,
126    pub auth: Box<dyn client::GetToken>,
127    _user_agent: String,
128    _base_url: String,
129    _root_url: String,
130}
131
132impl<'a, S> client::Hub for GoogleAnalyticsAdmin<S> {}
133
134impl<'a, S> GoogleAnalyticsAdmin<S> {
135
136    pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> GoogleAnalyticsAdmin<S> {
137        GoogleAnalyticsAdmin {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/5.0.3".to_string(),
141            _base_url: "https://analyticsadmin.googleapis.com/".to_string(),
142            _root_url: "https://analyticsadmin.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn account_summaries(&'a self) -> AccountSummaryMethods<'a, S> {
147        AccountSummaryMethods { hub: &self }
148    }
149    pub fn accounts(&'a self) -> AccountMethods<'a, S> {
150        AccountMethods { hub: &self }
151    }
152    pub fn properties(&'a self) -> PropertyMethods<'a, S> {
153        PropertyMethods { hub: &self }
154    }
155
156    /// Set the user-agent header field to use in all requests to the server.
157    /// It defaults to `google-api-rust-client/5.0.3`.
158    ///
159    /// Returns the previously set user-agent.
160    pub fn user_agent(&mut self, agent_name: String) -> String {
161        mem::replace(&mut self._user_agent, agent_name)
162    }
163
164    /// Set the base url to use in all requests to the server.
165    /// It defaults to `https://analyticsadmin.googleapis.com/`.
166    ///
167    /// Returns the previously set base url.
168    pub fn base_url(&mut self, new_base_url: String) -> String {
169        mem::replace(&mut self._base_url, new_base_url)
170    }
171
172    /// Set the root url to use in all requests to the server.
173    /// It defaults to `https://analyticsadmin.googleapis.com/`.
174    ///
175    /// Returns the previously set root url.
176    pub fn root_url(&mut self, new_root_url: String) -> String {
177        mem::replace(&mut self._root_url, new_root_url)
178    }
179}
180
181
182// ############
183// SCHEMAS ###
184// ##########
185/// A resource message representing a Google Analytics account.
186/// 
187/// # Activities
188/// 
189/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
190/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
191/// 
192/// * [get accounts](AccountGetCall) (response)
193/// * [patch accounts](AccountPatchCall) (request|response)
194#[serde_with::serde_as(crate = "::client::serde_with")]
195#[derive(Default, Clone, Debug, Serialize, Deserialize)]
196pub struct GoogleAnalyticsAdminV1alphaAccount {
197    /// Output only. Time when this account was originally created.
198    #[serde(rename="createTime")]
199    
200    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
201    /// Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
202    
203    pub deleted: Option<bool>,
204    /// Required. Human-readable display name for this account.
205    #[serde(rename="displayName")]
206    
207    pub display_name: Option<String>,
208    /// Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
209    
210    pub name: Option<String>,
211    /// Country of business. Must be a Unicode CLDR region code.
212    #[serde(rename="regionCode")]
213    
214    pub region_code: Option<String>,
215    /// Output only. Time when account payload fields were last updated.
216    #[serde(rename="updateTime")]
217    
218    pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
219}
220
221impl client::RequestValue for GoogleAnalyticsAdminV1alphaAccount {}
222impl client::ResponseResult for GoogleAnalyticsAdminV1alphaAccount {}
223
224
225/// A virtual resource representing an overview of an account and all its child GA4 properties.
226/// 
227/// This type is not used in any activity, and only used as *part* of another schema.
228/// 
229#[serde_with::serde_as(crate = "::client::serde_with")]
230#[derive(Default, Clone, Debug, Serialize, Deserialize)]
231pub struct GoogleAnalyticsAdminV1alphaAccountSummary {
232    /// Resource name of account referred to by this account summary Format: accounts/{account_id} Example: "accounts/1000"
233    
234    pub account: Option<String>,
235    /// Display name for the account referred to in this account summary.
236    #[serde(rename="displayName")]
237    
238    pub display_name: Option<String>,
239    /// Resource name for this account summary. Format: accountSummaries/{account_id} Example: "accountSummaries/1000"
240    
241    pub name: Option<String>,
242    /// List of summaries for child accounts of this account.
243    #[serde(rename="propertySummaries")]
244    
245    pub property_summaries: Option<Vec<GoogleAnalyticsAdminV1alphaPropertySummary>>,
246}
247
248impl client::Part for GoogleAnalyticsAdminV1alphaAccountSummary {}
249
250
251/// Request message for AcknowledgeUserDataCollection RPC.
252/// 
253/// # Activities
254/// 
255/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
256/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
257/// 
258/// * [acknowledge user data collection properties](PropertyAcknowledgeUserDataCollectionCall) (request)
259#[serde_with::serde_as(crate = "::client::serde_with")]
260#[derive(Default, Clone, Debug, Serialize, Deserialize)]
261pub struct GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest {
262    /// Required. An acknowledgement that the caller of this method understands the terms of user data collection. This field must contain the exact value: "I acknowledge that I have the necessary privacy disclosures and rights from my end users for the collection and processing of their data, including the association of such data with the visitation information Google Analytics collects from my site and/or app property."
263    
264    pub acknowledgement: Option<String>,
265}
266
267impl client::RequestValue for GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest {}
268
269
270/// Response message for AcknowledgeUserDataCollection RPC.
271/// 
272/// # Activities
273/// 
274/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
275/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
276/// 
277/// * [acknowledge user data collection properties](PropertyAcknowledgeUserDataCollectionCall) (response)
278#[serde_with::serde_as(crate = "::client::serde_with")]
279#[derive(Default, Clone, Debug, Serialize, Deserialize)]
280pub struct GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse { _never_set: Option<bool> }
281
282impl client::ResponseResult for GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse {}
283
284
285/// Request message for ApproveDisplayVideo360AdvertiserLinkProposal RPC.
286/// 
287/// # Activities
288/// 
289/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
290/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
291/// 
292/// * [display video360 advertiser link proposals approve properties](PropertyDisplayVideo360AdvertiserLinkProposalApproveCall) (request)
293#[serde_with::serde_as(crate = "::client::serde_with")]
294#[derive(Default, Clone, Debug, Serialize, Deserialize)]
295pub struct GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest { _never_set: Option<bool> }
296
297impl client::RequestValue for GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest {}
298
299
300/// Response message for ApproveDisplayVideo360AdvertiserLinkProposal RPC.
301/// 
302/// # Activities
303/// 
304/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
305/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
306/// 
307/// * [display video360 advertiser link proposals approve properties](PropertyDisplayVideo360AdvertiserLinkProposalApproveCall) (response)
308#[serde_with::serde_as(crate = "::client::serde_with")]
309#[derive(Default, Clone, Debug, Serialize, Deserialize)]
310pub struct GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalResponse {
311    /// The DisplayVideo360AdvertiserLink created as a result of approving the proposal.
312    #[serde(rename="displayVideo360AdvertiserLink")]
313    
314    pub display_video360_advertiser_link: Option<GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink>,
315}
316
317impl client::ResponseResult for GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalResponse {}
318
319
320/// Request message for ArchiveCustomDimension RPC.
321/// 
322/// # Activities
323/// 
324/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
325/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
326/// 
327/// * [custom dimensions archive properties](PropertyCustomDimensionArchiveCall) (request)
328#[serde_with::serde_as(crate = "::client::serde_with")]
329#[derive(Default, Clone, Debug, Serialize, Deserialize)]
330pub struct GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest { _never_set: Option<bool> }
331
332impl client::RequestValue for GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest {}
333
334
335/// Request message for ArchiveCustomMetric RPC.
336/// 
337/// # Activities
338/// 
339/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
341/// 
342/// * [custom metrics archive properties](PropertyCustomMetricArchiveCall) (request)
343#[serde_with::serde_as(crate = "::client::serde_with")]
344#[derive(Default, Clone, Debug, Serialize, Deserialize)]
345pub struct GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest { _never_set: Option<bool> }
346
347impl client::RequestValue for GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest {}
348
349
350/// Read-only resource used to summarize a principal's effective roles.
351/// 
352/// This type is not used in any activity, and only used as *part* of another schema.
353/// 
354#[serde_with::serde_as(crate = "::client::serde_with")]
355#[derive(Default, Clone, Debug, Serialize, Deserialize)]
356pub struct GoogleAnalyticsAdminV1alphaAuditUserLink {
357    /// Roles directly assigned to this user for this entity. Format: predefinedRoles/viewer Excludes roles that are inherited from an account (if this is for a property), group, or organization admin role.
358    #[serde(rename="directRoles")]
359    
360    pub direct_roles: Option<Vec<String>>,
361    /// Union of all permissions a user has at this account or property (includes direct permissions, group-inherited permissions, etc.). Format: predefinedRoles/viewer
362    #[serde(rename="effectiveRoles")]
363    
364    pub effective_roles: Option<Vec<String>>,
365    /// Email address of the linked user
366    #[serde(rename="emailAddress")]
367    
368    pub email_address: Option<String>,
369    /// Example format: properties/1234/userLinks/5678
370    
371    pub name: Option<String>,
372}
373
374impl client::Part for GoogleAnalyticsAdminV1alphaAuditUserLink {}
375
376
377/// Request message for AuditUserLinks RPC.
378/// 
379/// # Activities
380/// 
381/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
383/// 
384/// * [user links audit accounts](AccountUserLinkAuditCall) (request)
385/// * [user links audit properties](PropertyUserLinkAuditCall) (request)
386#[serde_with::serde_as(crate = "::client::serde_with")]
387#[derive(Default, Clone, Debug, Serialize, Deserialize)]
388pub struct GoogleAnalyticsAdminV1alphaAuditUserLinksRequest {
389    /// The maximum number of user links to return. The service may return fewer than this value. If unspecified, at most 1000 user links will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000.
390    #[serde(rename="pageSize")]
391    
392    pub page_size: Option<i32>,
393    /// A page token, received from a previous `AuditUserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `AuditUserLinks` must match the call that provided the page token.
394    #[serde(rename="pageToken")]
395    
396    pub page_token: Option<String>,
397}
398
399impl client::RequestValue for GoogleAnalyticsAdminV1alphaAuditUserLinksRequest {}
400
401
402/// Response message for AuditUserLinks RPC.
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/// * [user links audit accounts](AccountUserLinkAuditCall) (response)
410/// * [user links audit properties](PropertyUserLinkAuditCall) (response)
411#[serde_with::serde_as(crate = "::client::serde_with")]
412#[derive(Default, Clone, Debug, Serialize, Deserialize)]
413pub struct GoogleAnalyticsAdminV1alphaAuditUserLinksResponse {
414    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
415    #[serde(rename="nextPageToken")]
416    
417    pub next_page_token: Option<String>,
418    /// List of AuditUserLinks. These will be ordered stably, but in an arbitrary order.
419    #[serde(rename="userLinks")]
420    
421    pub user_links: Option<Vec<GoogleAnalyticsAdminV1alphaAuditUserLink>>,
422}
423
424impl client::ResponseResult for GoogleAnalyticsAdminV1alphaAuditUserLinksResponse {}
425
426
427/// Request message for BatchCreateUserLinks RPC.
428/// 
429/// # Activities
430/// 
431/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
432/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
433/// 
434/// * [user links batch create accounts](AccountUserLinkBatchCreateCall) (request)
435/// * [user links batch create properties](PropertyUserLinkBatchCreateCall) (request)
436#[serde_with::serde_as(crate = "::client::serde_with")]
437#[derive(Default, Clone, Debug, Serialize, Deserialize)]
438pub struct GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest {
439    /// Optional. If set, then email the new users notifying them that they've been granted permissions to the resource. Regardless of whether this is set or not, notify_new_user field inside each individual request is ignored.
440    #[serde(rename="notifyNewUsers")]
441    
442    pub notify_new_users: Option<bool>,
443    /// Required. The requests specifying the user links to create. A maximum of 1000 user links can be created in a batch.
444    
445    pub requests: Option<Vec<GoogleAnalyticsAdminV1alphaCreateUserLinkRequest>>,
446}
447
448impl client::RequestValue for GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest {}
449
450
451/// Response message for BatchCreateUserLinks RPC.
452/// 
453/// # Activities
454/// 
455/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
457/// 
458/// * [user links batch create accounts](AccountUserLinkBatchCreateCall) (response)
459/// * [user links batch create properties](PropertyUserLinkBatchCreateCall) (response)
460#[serde_with::serde_as(crate = "::client::serde_with")]
461#[derive(Default, Clone, Debug, Serialize, Deserialize)]
462pub struct GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse {
463    /// The user links created.
464    #[serde(rename="userLinks")]
465    
466    pub user_links: Option<Vec<GoogleAnalyticsAdminV1alphaUserLink>>,
467}
468
469impl client::ResponseResult for GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse {}
470
471
472/// Request message for BatchDeleteUserLinks RPC.
473/// 
474/// # Activities
475/// 
476/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
478/// 
479/// * [user links batch delete accounts](AccountUserLinkBatchDeleteCall) (request)
480/// * [user links batch delete properties](PropertyUserLinkBatchDeleteCall) (request)
481#[serde_with::serde_as(crate = "::client::serde_with")]
482#[derive(Default, Clone, Debug, Serialize, Deserialize)]
483pub struct GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest {
484    /// Required. The requests specifying the user links to update. A maximum of 1000 user links can be updated in a batch.
485    
486    pub requests: Option<Vec<GoogleAnalyticsAdminV1alphaDeleteUserLinkRequest>>,
487}
488
489impl client::RequestValue for GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest {}
490
491
492/// Response message for BatchGetUserLinks RPC.
493/// 
494/// # Activities
495/// 
496/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
497/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
498/// 
499/// * [user links batch get accounts](AccountUserLinkBatchGetCall) (response)
500/// * [user links batch get properties](PropertyUserLinkBatchGetCall) (response)
501#[serde_with::serde_as(crate = "::client::serde_with")]
502#[derive(Default, Clone, Debug, Serialize, Deserialize)]
503pub struct GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse {
504    /// The requested user links.
505    #[serde(rename="userLinks")]
506    
507    pub user_links: Option<Vec<GoogleAnalyticsAdminV1alphaUserLink>>,
508}
509
510impl client::ResponseResult for GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse {}
511
512
513/// Request message for BatchUpdateUserLinks RPC.
514/// 
515/// # Activities
516/// 
517/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
518/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
519/// 
520/// * [user links batch update accounts](AccountUserLinkBatchUpdateCall) (request)
521/// * [user links batch update properties](PropertyUserLinkBatchUpdateCall) (request)
522#[serde_with::serde_as(crate = "::client::serde_with")]
523#[derive(Default, Clone, Debug, Serialize, Deserialize)]
524pub struct GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest {
525    /// Required. The requests specifying the user links to update. A maximum of 1000 user links can be updated in a batch.
526    
527    pub requests: Option<Vec<GoogleAnalyticsAdminV1alphaUpdateUserLinkRequest>>,
528}
529
530impl client::RequestValue for GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest {}
531
532
533/// Response message for BatchUpdateUserLinks RPC.
534/// 
535/// # Activities
536/// 
537/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
538/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
539/// 
540/// * [user links batch update accounts](AccountUserLinkBatchUpdateCall) (response)
541/// * [user links batch update properties](PropertyUserLinkBatchUpdateCall) (response)
542#[serde_with::serde_as(crate = "::client::serde_with")]
543#[derive(Default, Clone, Debug, Serialize, Deserialize)]
544pub struct GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse {
545    /// The user links updated.
546    #[serde(rename="userLinks")]
547    
548    pub user_links: Option<Vec<GoogleAnalyticsAdminV1alphaUserLink>>,
549}
550
551impl client::ResponseResult for GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse {}
552
553
554/// Request message for CancelDisplayVideo360AdvertiserLinkProposal RPC.
555/// 
556/// # Activities
557/// 
558/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
559/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
560/// 
561/// * [display video360 advertiser link proposals cancel properties](PropertyDisplayVideo360AdvertiserLinkProposalCancelCall) (request)
562#[serde_with::serde_as(crate = "::client::serde_with")]
563#[derive(Default, Clone, Debug, Serialize, Deserialize)]
564pub struct GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest { _never_set: Option<bool> }
565
566impl client::RequestValue for GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest {}
567
568
569/// A description of a change to a single Google Analytics resource.
570/// 
571/// This type is not used in any activity, and only used as *part* of another schema.
572/// 
573#[serde_with::serde_as(crate = "::client::serde_with")]
574#[derive(Default, Clone, Debug, Serialize, Deserialize)]
575pub struct GoogleAnalyticsAdminV1alphaChangeHistoryChange {
576    /// The type of action that changed this resource.
577    
578    pub action: Option<String>,
579    /// Resource name of the resource whose changes are described by this entry.
580    
581    pub resource: Option<String>,
582    /// Resource contents from after the change was made. If this resource was deleted in this change, this field will be missing.
583    #[serde(rename="resourceAfterChange")]
584    
585    pub resource_after_change: Option<GoogleAnalyticsAdminV1alphaChangeHistoryChangeChangeHistoryResource>,
586    /// Resource contents from before the change was made. If this resource was created in this change, this field will be missing.
587    #[serde(rename="resourceBeforeChange")]
588    
589    pub resource_before_change: Option<GoogleAnalyticsAdminV1alphaChangeHistoryChangeChangeHistoryResource>,
590}
591
592impl client::Part for GoogleAnalyticsAdminV1alphaChangeHistoryChange {}
593
594
595/// A snapshot of a resource as before or after the result of a change in change history.
596/// 
597/// This type is not used in any activity, and only used as *part* of another schema.
598/// 
599#[serde_with::serde_as(crate = "::client::serde_with")]
600#[derive(Default, Clone, Debug, Serialize, Deserialize)]
601pub struct GoogleAnalyticsAdminV1alphaChangeHistoryChangeChangeHistoryResource {
602    /// A snapshot of an Account resource in change history.
603    
604    pub account: Option<GoogleAnalyticsAdminV1alphaAccount>,
605    /// A snapshot of a ConversionEvent resource in change history.
606    #[serde(rename="conversionEvent")]
607    
608    pub conversion_event: Option<GoogleAnalyticsAdminV1alphaConversionEvent>,
609    /// A snapshot of a CustomDimension resource in change history.
610    #[serde(rename="customDimension")]
611    
612    pub custom_dimension: Option<GoogleAnalyticsAdminV1alphaCustomDimension>,
613    /// A snapshot of a CustomMetric resource in change history.
614    #[serde(rename="customMetric")]
615    
616    pub custom_metric: Option<GoogleAnalyticsAdminV1alphaCustomMetric>,
617    /// A snapshot of a data retention settings resource in change history.
618    #[serde(rename="dataRetentionSettings")]
619    
620    pub data_retention_settings: Option<GoogleAnalyticsAdminV1alphaDataRetentionSettings>,
621    /// A snapshot of a DataStream resource in change history.
622    #[serde(rename="dataStream")]
623    
624    pub data_stream: Option<GoogleAnalyticsAdminV1alphaDataStream>,
625    /// A snapshot of a DisplayVideo360AdvertiserLink resource in change history.
626    #[serde(rename="displayVideo360AdvertiserLink")]
627    
628    pub display_video360_advertiser_link: Option<GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink>,
629    /// A snapshot of a DisplayVideo360AdvertiserLinkProposal resource in change history.
630    #[serde(rename="displayVideo360AdvertiserLinkProposal")]
631    
632    pub display_video360_advertiser_link_proposal: Option<GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal>,
633    /// A snapshot of a FirebaseLink resource in change history.
634    #[serde(rename="firebaseLink")]
635    
636    pub firebase_link: Option<GoogleAnalyticsAdminV1alphaFirebaseLink>,
637    /// A snapshot of a GoogleAdsLink resource in change history.
638    #[serde(rename="googleAdsLink")]
639    
640    pub google_ads_link: Option<GoogleAnalyticsAdminV1alphaGoogleAdsLink>,
641    /// A snapshot of a GoogleSignalsSettings resource in change history.
642    #[serde(rename="googleSignalsSettings")]
643    
644    pub google_signals_settings: Option<GoogleAnalyticsAdminV1alphaGoogleSignalsSettings>,
645    /// A snapshot of a MeasurementProtocolSecret resource in change history.
646    #[serde(rename="measurementProtocolSecret")]
647    
648    pub measurement_protocol_secret: Option<GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret>,
649    /// A snapshot of a Property resource in change history.
650    
651    pub property: Option<GoogleAnalyticsAdminV1alphaProperty>,
652}
653
654impl client::Part for GoogleAnalyticsAdminV1alphaChangeHistoryChangeChangeHistoryResource {}
655
656
657/// A set of changes within a Google Analytics account or its child properties that resulted from the same cause. Common causes would be updates made in the Google Analytics UI, changes from customer support, or automatic Google Analytics system changes.
658/// 
659/// This type is not used in any activity, and only used as *part* of another schema.
660/// 
661#[serde_with::serde_as(crate = "::client::serde_with")]
662#[derive(Default, Clone, Debug, Serialize, Deserialize)]
663pub struct GoogleAnalyticsAdminV1alphaChangeHistoryEvent {
664    /// The type of actor that made this change.
665    #[serde(rename="actorType")]
666    
667    pub actor_type: Option<String>,
668    /// Time when change was made.
669    #[serde(rename="changeTime")]
670    
671    pub change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
672    /// A list of changes made in this change history event that fit the filters specified in SearchChangeHistoryEventsRequest.
673    
674    pub changes: Option<Vec<GoogleAnalyticsAdminV1alphaChangeHistoryChange>>,
675    /// If true, then the list of changes returned was filtered, and does not represent all changes that occurred in this event.
676    #[serde(rename="changesFiltered")]
677    
678    pub changes_filtered: Option<bool>,
679    /// ID of this change history event. This ID is unique across Google Analytics.
680    
681    pub id: Option<String>,
682    /// Email address of the Google account that made the change. This will be a valid email address if the actor field is set to USER, and empty otherwise. Google accounts that have been deleted will cause an error.
683    #[serde(rename="userActorEmail")]
684    
685    pub user_actor_email: Option<String>,
686}
687
688impl client::Part for GoogleAnalyticsAdminV1alphaChangeHistoryEvent {}
689
690
691/// A conversion event in a Google Analytics property.
692/// 
693/// # Activities
694/// 
695/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
696/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
697/// 
698/// * [conversion events create properties](PropertyConversionEventCreateCall) (request|response)
699/// * [conversion events get properties](PropertyConversionEventGetCall) (response)
700#[serde_with::serde_as(crate = "::client::serde_with")]
701#[derive(Default, Clone, Debug, Serialize, Deserialize)]
702pub struct GoogleAnalyticsAdminV1alphaConversionEvent {
703    /// Output only. Time when this conversion event was created in the property.
704    #[serde(rename="createTime")]
705    
706    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
707    /// Output only. If set to true, this conversion event refers to a custom event. If set to false, this conversion event refers to a default event in GA. Default events typically have special meaning in GA. Default events are usually created for you by the GA system, but in some cases can be created by property admins. Custom events count towards the maximum number of custom conversion events that may be created per property.
708    
709    pub custom: Option<bool>,
710    /// Output only. If set, this event can currently be deleted via DeleteConversionEvent.
711    
712    pub deletable: Option<bool>,
713    /// Immutable. The event name for this conversion event. Examples: 'click', 'purchase'
714    #[serde(rename="eventName")]
715    
716    pub event_name: Option<String>,
717    /// Output only. Resource name of this conversion event. Format: properties/{property}/conversionEvents/{conversion_event}
718    
719    pub name: Option<String>,
720}
721
722impl client::RequestValue for GoogleAnalyticsAdminV1alphaConversionEvent {}
723impl client::ResponseResult for GoogleAnalyticsAdminV1alphaConversionEvent {}
724
725
726/// Request message for CreateUserLink RPC. Users can have multiple email addresses associated with their Google account, and one of these email addresses is the "primary" email address. Any of the email addresses associated with a Google account may be used for a new UserLink, but the returned UserLink will always contain the "primary" email address. As a result, the input and output email address for this request may differ.
727/// 
728/// This type is not used in any activity, and only used as *part* of another schema.
729/// 
730#[serde_with::serde_as(crate = "::client::serde_with")]
731#[derive(Default, Clone, Debug, Serialize, Deserialize)]
732pub struct GoogleAnalyticsAdminV1alphaCreateUserLinkRequest {
733    /// Optional. If set, then email the new user notifying them that they've been granted permissions to the resource.
734    #[serde(rename="notifyNewUser")]
735    
736    pub notify_new_user: Option<bool>,
737    /// Required. Example format: accounts/1234
738    
739    pub parent: Option<String>,
740    /// Required. The user link to create.
741    #[serde(rename="userLink")]
742    
743    pub user_link: Option<GoogleAnalyticsAdminV1alphaUserLink>,
744}
745
746impl client::Part for GoogleAnalyticsAdminV1alphaCreateUserLinkRequest {}
747
748
749/// A definition for a CustomDimension.
750/// 
751/// # Activities
752/// 
753/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
754/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
755/// 
756/// * [custom dimensions create properties](PropertyCustomDimensionCreateCall) (request|response)
757/// * [custom dimensions get properties](PropertyCustomDimensionGetCall) (response)
758/// * [custom dimensions patch properties](PropertyCustomDimensionPatchCall) (request|response)
759#[serde_with::serde_as(crate = "::client::serde_with")]
760#[derive(Default, Clone, Debug, Serialize, Deserialize)]
761pub struct GoogleAnalyticsAdminV1alphaCustomDimension {
762    /// Optional. Description for this custom dimension. Max length of 150 characters.
763    
764    pub description: Option<String>,
765    /// Optional. If set to true, sets this dimension as NPA and excludes it from ads personalization. This is currently only supported by user-scoped custom dimensions.
766    #[serde(rename="disallowAdsPersonalization")]
767    
768    pub disallow_ads_personalization: Option<bool>,
769    /// Required. Display name for this custom dimension as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets.
770    #[serde(rename="displayName")]
771    
772    pub display_name: Option<String>,
773    /// Output only. Resource name for this CustomDimension resource. Format: properties/{property}/customDimensions/{customDimension}
774    
775    pub name: Option<String>,
776    /// Required. Immutable. Tagging parameter name for this custom dimension. If this is a user-scoped dimension, then this is the user property name. If this is an event-scoped dimension, then this is the event parameter name. May only contain alphanumeric and underscore characters, starting with a letter. Max length of 24 characters for user-scoped dimensions, 40 characters for event-scoped dimensions.
777    #[serde(rename="parameterName")]
778    
779    pub parameter_name: Option<String>,
780    /// Required. Immutable. The scope of this dimension.
781    
782    pub scope: Option<String>,
783}
784
785impl client::RequestValue for GoogleAnalyticsAdminV1alphaCustomDimension {}
786impl client::ResponseResult for GoogleAnalyticsAdminV1alphaCustomDimension {}
787
788
789/// A definition for a custom metric.
790/// 
791/// # Activities
792/// 
793/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
794/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
795/// 
796/// * [custom metrics create properties](PropertyCustomMetricCreateCall) (request|response)
797/// * [custom metrics get properties](PropertyCustomMetricGetCall) (response)
798/// * [custom metrics patch properties](PropertyCustomMetricPatchCall) (request|response)
799#[serde_with::serde_as(crate = "::client::serde_with")]
800#[derive(Default, Clone, Debug, Serialize, Deserialize)]
801pub struct GoogleAnalyticsAdminV1alphaCustomMetric {
802    /// Optional. Description for this custom dimension. Max length of 150 characters.
803    
804    pub description: Option<String>,
805    /// Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets.
806    #[serde(rename="displayName")]
807    
808    pub display_name: Option<String>,
809    /// Required. The type for the custom metric's value.
810    #[serde(rename="measurementUnit")]
811    
812    pub measurement_unit: Option<String>,
813    /// Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
814    
815    pub name: Option<String>,
816    /// Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics.
817    #[serde(rename="parameterName")]
818    
819    pub parameter_name: Option<String>,
820    /// Optional. Types of restricted data that this metric may contain. Required for metrics with CURRENCY measurement unit. Must be empty for metrics with a non-CURRENCY measurement unit.
821    #[serde(rename="restrictedMetricType")]
822    
823    pub restricted_metric_type: Option<Vec<String>>,
824    /// Required. Immutable. The scope of this custom metric.
825    
826    pub scope: Option<String>,
827}
828
829impl client::RequestValue for GoogleAnalyticsAdminV1alphaCustomMetric {}
830impl client::ResponseResult for GoogleAnalyticsAdminV1alphaCustomMetric {}
831
832
833/// Settings values for data retention. This is a singleton resource.
834/// 
835/// # Activities
836/// 
837/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
838/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
839/// 
840/// * [get data retention settings properties](PropertyGetDataRetentionSettingCall) (response)
841/// * [update data retention settings properties](PropertyUpdateDataRetentionSettingCall) (request|response)
842#[serde_with::serde_as(crate = "::client::serde_with")]
843#[derive(Default, Clone, Debug, Serialize, Deserialize)]
844pub struct GoogleAnalyticsAdminV1alphaDataRetentionSettings {
845    /// The length of time that event-level data is retained.
846    #[serde(rename="eventDataRetention")]
847    
848    pub event_data_retention: Option<String>,
849    /// Output only. Resource name for this DataRetentionSetting resource. Format: properties/{property}/dataRetentionSettings
850    
851    pub name: Option<String>,
852    /// If true, reset the retention period for the user identifier with every event from that user.
853    #[serde(rename="resetUserDataOnNewActivity")]
854    
855    pub reset_user_data_on_new_activity: Option<bool>,
856}
857
858impl client::RequestValue for GoogleAnalyticsAdminV1alphaDataRetentionSettings {}
859impl client::ResponseResult for GoogleAnalyticsAdminV1alphaDataRetentionSettings {}
860
861
862/// A resource message representing data sharing settings of a Google Analytics account.
863/// 
864/// # Activities
865/// 
866/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
867/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
868/// 
869/// * [get data sharing settings accounts](AccountGetDataSharingSettingCall) (response)
870#[serde_with::serde_as(crate = "::client::serde_with")]
871#[derive(Default, Clone, Debug, Serialize, Deserialize)]
872pub struct GoogleAnalyticsAdminV1alphaDataSharingSettings {
873    /// Output only. Resource name. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings"
874    
875    pub name: Option<String>,
876    /// Allows any of Google sales to access the data in order to suggest configuration changes to improve results.
877    #[serde(rename="sharingWithGoogleAnySalesEnabled")]
878    
879    pub sharing_with_google_any_sales_enabled: Option<bool>,
880    /// Allows Google sales teams that are assigned to the customer to access the data in order to suggest configuration changes to improve results. Sales team restrictions still apply when enabled.
881    #[serde(rename="sharingWithGoogleAssignedSalesEnabled")]
882    
883    pub sharing_with_google_assigned_sales_enabled: Option<bool>,
884    /// Allows Google to use the data to improve other Google products or services.
885    #[serde(rename="sharingWithGoogleProductsEnabled")]
886    
887    pub sharing_with_google_products_enabled: Option<bool>,
888    /// Allows Google support to access the data in order to help troubleshoot issues.
889    #[serde(rename="sharingWithGoogleSupportEnabled")]
890    
891    pub sharing_with_google_support_enabled: Option<bool>,
892    /// Allows Google to share the data anonymously in aggregate form with others.
893    #[serde(rename="sharingWithOthersEnabled")]
894    
895    pub sharing_with_others_enabled: Option<bool>,
896}
897
898impl client::ResponseResult for GoogleAnalyticsAdminV1alphaDataSharingSettings {}
899
900
901/// A resource message representing a data stream.
902/// 
903/// # Activities
904/// 
905/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
906/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
907/// 
908/// * [data streams create properties](PropertyDataStreamCreateCall) (request|response)
909/// * [data streams get properties](PropertyDataStreamGetCall) (response)
910/// * [data streams patch properties](PropertyDataStreamPatchCall) (request|response)
911#[serde_with::serde_as(crate = "::client::serde_with")]
912#[derive(Default, Clone, Debug, Serialize, Deserialize)]
913pub struct GoogleAnalyticsAdminV1alphaDataStream {
914    /// Data specific to Android app streams. Must be populated if type is ANDROID_APP_DATA_STREAM.
915    #[serde(rename="androidAppStreamData")]
916    
917    pub android_app_stream_data: Option<GoogleAnalyticsAdminV1alphaDataStreamAndroidAppStreamData>,
918    /// Output only. Time when this stream was originally created.
919    #[serde(rename="createTime")]
920    
921    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
922    /// Human-readable display name for the Data Stream. Required for web data streams. The max allowed display name length is 255 UTF-16 code units.
923    #[serde(rename="displayName")]
924    
925    pub display_name: Option<String>,
926    /// Data specific to iOS app streams. Must be populated if type is IOS_APP_DATA_STREAM.
927    #[serde(rename="iosAppStreamData")]
928    
929    pub ios_app_stream_data: Option<GoogleAnalyticsAdminV1alphaDataStreamIosAppStreamData>,
930    /// Output only. Resource name of this Data Stream. Format: properties/{property_id}/dataStreams/{stream_id} Example: "properties/1000/dataStreams/2000"
931    
932    pub name: Option<String>,
933    /// Required. Immutable. The type of this DataStream resource.
934    #[serde(rename="type")]
935    
936    pub type_: Option<String>,
937    /// Output only. Time when stream payload fields were last updated.
938    #[serde(rename="updateTime")]
939    
940    pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
941    /// Data specific to web streams. Must be populated if type is WEB_DATA_STREAM.
942    #[serde(rename="webStreamData")]
943    
944    pub web_stream_data: Option<GoogleAnalyticsAdminV1alphaDataStreamWebStreamData>,
945}
946
947impl client::RequestValue for GoogleAnalyticsAdminV1alphaDataStream {}
948impl client::ResponseResult for GoogleAnalyticsAdminV1alphaDataStream {}
949
950
951/// Data specific to Android app streams.
952/// 
953/// This type is not used in any activity, and only used as *part* of another schema.
954/// 
955#[serde_with::serde_as(crate = "::client::serde_with")]
956#[derive(Default, Clone, Debug, Serialize, Deserialize)]
957pub struct GoogleAnalyticsAdminV1alphaDataStreamAndroidAppStreamData {
958    /// Output only. ID of the corresponding Android app in Firebase, if any. This ID can change if the Android app is deleted and recreated.
959    #[serde(rename="firebaseAppId")]
960    
961    pub firebase_app_id: Option<String>,
962    /// Immutable. The package name for the app being measured. Example: "com.example.myandroidapp"
963    #[serde(rename="packageName")]
964    
965    pub package_name: Option<String>,
966}
967
968impl client::Part for GoogleAnalyticsAdminV1alphaDataStreamAndroidAppStreamData {}
969
970
971/// Data specific to iOS app streams.
972/// 
973/// This type is not used in any activity, and only used as *part* of another schema.
974/// 
975#[serde_with::serde_as(crate = "::client::serde_with")]
976#[derive(Default, Clone, Debug, Serialize, Deserialize)]
977pub struct GoogleAnalyticsAdminV1alphaDataStreamIosAppStreamData {
978    /// Required. Immutable. The Apple App Store Bundle ID for the app Example: "com.example.myiosapp"
979    #[serde(rename="bundleId")]
980    
981    pub bundle_id: Option<String>,
982    /// Output only. ID of the corresponding iOS app in Firebase, if any. This ID can change if the iOS app is deleted and recreated.
983    #[serde(rename="firebaseAppId")]
984    
985    pub firebase_app_id: Option<String>,
986}
987
988impl client::Part for GoogleAnalyticsAdminV1alphaDataStreamIosAppStreamData {}
989
990
991/// Data specific to web streams.
992/// 
993/// This type is not used in any activity, and only used as *part* of another schema.
994/// 
995#[serde_with::serde_as(crate = "::client::serde_with")]
996#[derive(Default, Clone, Debug, Serialize, Deserialize)]
997pub struct GoogleAnalyticsAdminV1alphaDataStreamWebStreamData {
998    /// Immutable. Domain name of the web app being measured, or empty. Example: "http://www.google.com", "https://www.google.com"
999    #[serde(rename="defaultUri")]
1000    
1001    pub default_uri: Option<String>,
1002    /// Output only. ID of the corresponding web app in Firebase, if any. This ID can change if the web app is deleted and recreated.
1003    #[serde(rename="firebaseAppId")]
1004    
1005    pub firebase_app_id: Option<String>,
1006    /// Output only. Analytics "Measurement ID", without the "G-" prefix. Example: "G-1A2BCD345E" would just be "1A2BCD345E"
1007    #[serde(rename="measurementId")]
1008    
1009    pub measurement_id: Option<String>,
1010}
1011
1012impl client::Part for GoogleAnalyticsAdminV1alphaDataStreamWebStreamData {}
1013
1014
1015/// Request message for DeleteUserLink RPC.
1016/// 
1017/// This type is not used in any activity, and only used as *part* of another schema.
1018/// 
1019#[serde_with::serde_as(crate = "::client::serde_with")]
1020#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1021pub struct GoogleAnalyticsAdminV1alphaDeleteUserLinkRequest {
1022    /// Required. Example format: accounts/1234/userLinks/5678
1023    
1024    pub name: Option<String>,
1025}
1026
1027impl client::Part for GoogleAnalyticsAdminV1alphaDeleteUserLinkRequest {}
1028
1029
1030/// A link between a GA4 property and a Display & Video 360 advertiser.
1031/// 
1032/// # Activities
1033/// 
1034/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1035/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1036/// 
1037/// * [display video360 advertiser links create properties](PropertyDisplayVideo360AdvertiserLinkCreateCall) (request|response)
1038/// * [display video360 advertiser links get properties](PropertyDisplayVideo360AdvertiserLinkGetCall) (response)
1039/// * [display video360 advertiser links patch properties](PropertyDisplayVideo360AdvertiserLinkPatchCall) (request|response)
1040#[serde_with::serde_as(crate = "::client::serde_with")]
1041#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1042pub struct GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink {
1043    /// Enables personalized advertising features with this integration. If this field is not set on create/update, it will be defaulted to true.
1044    #[serde(rename="adsPersonalizationEnabled")]
1045    
1046    pub ads_personalization_enabled: Option<bool>,
1047    /// Output only. The display name of the Display & Video 360 Advertiser.
1048    #[serde(rename="advertiserDisplayName")]
1049    
1050    pub advertiser_display_name: Option<String>,
1051    /// Immutable. The Display & Video 360 Advertiser's advertiser ID.
1052    #[serde(rename="advertiserId")]
1053    
1054    pub advertiser_id: Option<String>,
1055    /// Immutable. Enables the import of campaign data from Display & Video 360 into the GA4 property. After link creation, this can only be updated from the Display & Video 360 product. If this field is not set on create, it will be defaulted to true.
1056    #[serde(rename="campaignDataSharingEnabled")]
1057    
1058    pub campaign_data_sharing_enabled: Option<bool>,
1059    /// Immutable. Enables the import of cost data from Display & Video 360 into the GA4 property. This can only be enabled if campaign_data_sharing_enabled is enabled. After link creation, this can only be updated from the Display & Video 360 product. If this field is not set on create, it will be defaulted to true.
1060    #[serde(rename="costDataSharingEnabled")]
1061    
1062    pub cost_data_sharing_enabled: Option<bool>,
1063    /// Output only. The resource name for this DisplayVideo360AdvertiserLink resource. Format: properties/{propertyId}/displayVideo360AdvertiserLinks/{linkId} Note: linkId is not the Display & Video 360 Advertiser ID
1064    
1065    pub name: Option<String>,
1066}
1067
1068impl client::RequestValue for GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink {}
1069impl client::ResponseResult for GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink {}
1070
1071
1072/// A proposal for a link between a GA4 property and a Display & Video 360 advertiser. A proposal is converted to a DisplayVideo360AdvertiserLink once approved. Google Analytics admins approve inbound proposals while Display & Video 360 admins approve outbound proposals.
1073/// 
1074/// # Activities
1075/// 
1076/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1077/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1078/// 
1079/// * [display video360 advertiser link proposals cancel properties](PropertyDisplayVideo360AdvertiserLinkProposalCancelCall) (response)
1080/// * [display video360 advertiser link proposals create properties](PropertyDisplayVideo360AdvertiserLinkProposalCreateCall) (request|response)
1081/// * [display video360 advertiser link proposals get properties](PropertyDisplayVideo360AdvertiserLinkProposalGetCall) (response)
1082#[serde_with::serde_as(crate = "::client::serde_with")]
1083#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1084pub struct GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal {
1085    /// Immutable. Enables personalized advertising features with this integration. If this field is not set on create, it will be defaulted to true.
1086    #[serde(rename="adsPersonalizationEnabled")]
1087    
1088    pub ads_personalization_enabled: Option<bool>,
1089    /// Output only. The display name of the Display & Video Advertiser. Only populated for proposals that originated from Display & Video 360.
1090    #[serde(rename="advertiserDisplayName")]
1091    
1092    pub advertiser_display_name: Option<String>,
1093    /// Immutable. The Display & Video 360 Advertiser's advertiser ID.
1094    #[serde(rename="advertiserId")]
1095    
1096    pub advertiser_id: Option<String>,
1097    /// Immutable. Enables the import of campaign data from Display & Video 360. If this field is not set on create, it will be defaulted to true.
1098    #[serde(rename="campaignDataSharingEnabled")]
1099    
1100    pub campaign_data_sharing_enabled: Option<bool>,
1101    /// Immutable. Enables the import of cost data from Display & Video 360. This can only be enabled if campaign_data_sharing_enabled is enabled. If this field is not set on create, it will be defaulted to true.
1102    #[serde(rename="costDataSharingEnabled")]
1103    
1104    pub cost_data_sharing_enabled: Option<bool>,
1105    /// Output only. The status information for this link proposal.
1106    #[serde(rename="linkProposalStatusDetails")]
1107    
1108    pub link_proposal_status_details: Option<GoogleAnalyticsAdminV1alphaLinkProposalStatusDetails>,
1109    /// Output only. The resource name for this DisplayVideo360AdvertiserLinkProposal resource. Format: properties/{propertyId}/displayVideo360AdvertiserLinkProposals/{proposalId} Note: proposalId is not the Display & Video 360 Advertiser ID
1110    
1111    pub name: Option<String>,
1112    /// Input only. On a proposal being sent to Display & Video 360, this field must be set to the email address of an admin on the target advertiser. This is used to verify that the Google Analytics admin is aware of at least one admin on the Display & Video 360 Advertiser. This does not restrict approval of the proposal to a single user. Any admin on the Display & Video 360 Advertiser may approve the proposal.
1113    #[serde(rename="validationEmail")]
1114    
1115    pub validation_email: Option<String>,
1116}
1117
1118impl client::RequestValue for GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal {}
1119impl client::ResponseResult for GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal {}
1120
1121
1122/// A link between a GA4 property and a Firebase project.
1123/// 
1124/// # Activities
1125/// 
1126/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1127/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1128/// 
1129/// * [firebase links create properties](PropertyFirebaseLinkCreateCall) (request|response)
1130#[serde_with::serde_as(crate = "::client::serde_with")]
1131#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1132pub struct GoogleAnalyticsAdminV1alphaFirebaseLink {
1133    /// Output only. Time when this FirebaseLink was originally created.
1134    #[serde(rename="createTime")]
1135    
1136    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1137    /// Output only. Example format: properties/1234/firebaseLinks/5678
1138    
1139    pub name: Option<String>,
1140    /// Immutable. Firebase project resource name. When creating a FirebaseLink, you may provide this resource name using either a project number or project ID. Once this resource has been created, returned FirebaseLinks will always have a project_name that contains a project number. Format: 'projects/{project number}' Example: 'projects/1234'
1141    
1142    pub project: Option<String>,
1143}
1144
1145impl client::RequestValue for GoogleAnalyticsAdminV1alphaFirebaseLink {}
1146impl client::ResponseResult for GoogleAnalyticsAdminV1alphaFirebaseLink {}
1147
1148
1149/// Read-only resource with the tag for sending data from a website to a DataStream. Only present for web DataStream resources.
1150/// 
1151/// # Activities
1152/// 
1153/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1154/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1155/// 
1156/// * [data streams get global site tag properties](PropertyDataStreamGetGlobalSiteTagCall) (response)
1157#[serde_with::serde_as(crate = "::client::serde_with")]
1158#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1159pub struct GoogleAnalyticsAdminV1alphaGlobalSiteTag {
1160    /// Output only. Resource name for this GlobalSiteTag resource. Format: properties/{property_id}/dataStreams/{stream_id}/globalSiteTag Example: "properties/123/dataStreams/456/globalSiteTag"
1161    
1162    pub name: Option<String>,
1163    /// Immutable. JavaScript code snippet to be pasted as the first item into the head tag of every webpage to measure.
1164    
1165    pub snippet: Option<String>,
1166}
1167
1168impl client::ResponseResult for GoogleAnalyticsAdminV1alphaGlobalSiteTag {}
1169
1170
1171/// A link between a GA4 property and a Google Ads account.
1172/// 
1173/// # Activities
1174/// 
1175/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1176/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1177/// 
1178/// * [google ads links create properties](PropertyGoogleAdsLinkCreateCall) (request|response)
1179/// * [google ads links patch properties](PropertyGoogleAdsLinkPatchCall) (request|response)
1180#[serde_with::serde_as(crate = "::client::serde_with")]
1181#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1182pub struct GoogleAnalyticsAdminV1alphaGoogleAdsLink {
1183    /// Enable personalized advertising features with this integration. Automatically publish my Google Analytics audience lists and Google Analytics remarketing events/parameters to the linked Google Ads account. If this field is not set on create/update, it will be defaulted to true.
1184    #[serde(rename="adsPersonalizationEnabled")]
1185    
1186    pub ads_personalization_enabled: Option<bool>,
1187    /// Output only. If true, this link is for a Google Ads manager account.
1188    #[serde(rename="canManageClients")]
1189    
1190    pub can_manage_clients: Option<bool>,
1191    /// Output only. Time when this link was originally created.
1192    #[serde(rename="createTime")]
1193    
1194    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1195    /// Output only. Email address of the user that created the link. An empty string will be returned if the email address can't be retrieved.
1196    #[serde(rename="creatorEmailAddress")]
1197    
1198    pub creator_email_address: Option<String>,
1199    /// Immutable. Google Ads customer ID.
1200    #[serde(rename="customerId")]
1201    
1202    pub customer_id: Option<String>,
1203    /// Output only. Format: properties/{propertyId}/googleAdsLinks/{googleAdsLinkId} Note: googleAdsLinkId is not the Google Ads customer ID.
1204    
1205    pub name: Option<String>,
1206    /// Output only. Time when this link was last updated.
1207    #[serde(rename="updateTime")]
1208    
1209    pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1210}
1211
1212impl client::RequestValue for GoogleAnalyticsAdminV1alphaGoogleAdsLink {}
1213impl client::ResponseResult for GoogleAnalyticsAdminV1alphaGoogleAdsLink {}
1214
1215
1216/// Settings values for Google Signals. This is a singleton resource.
1217/// 
1218/// # Activities
1219/// 
1220/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1221/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1222/// 
1223/// * [get google signals settings properties](PropertyGetGoogleSignalsSettingCall) (response)
1224/// * [update google signals settings properties](PropertyUpdateGoogleSignalsSettingCall) (request|response)
1225#[serde_with::serde_as(crate = "::client::serde_with")]
1226#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1227pub struct GoogleAnalyticsAdminV1alphaGoogleSignalsSettings {
1228    /// Output only. Terms of Service acceptance.
1229    
1230    pub consent: Option<String>,
1231    /// Output only. Resource name of this setting. Format: properties/{property_id}/googleSignalsSettings Example: "properties/1000/googleSignalsSettings"
1232    
1233    pub name: Option<String>,
1234    /// Status of this setting.
1235    
1236    pub state: Option<String>,
1237}
1238
1239impl client::RequestValue for GoogleAnalyticsAdminV1alphaGoogleSignalsSettings {}
1240impl client::ResponseResult for GoogleAnalyticsAdminV1alphaGoogleSignalsSettings {}
1241
1242
1243/// Status information for a link proposal.
1244/// 
1245/// This type is not used in any activity, and only used as *part* of another schema.
1246/// 
1247#[serde_with::serde_as(crate = "::client::serde_with")]
1248#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1249pub struct GoogleAnalyticsAdminV1alphaLinkProposalStatusDetails {
1250    /// Output only. The source of this proposal.
1251    #[serde(rename="linkProposalInitiatingProduct")]
1252    
1253    pub link_proposal_initiating_product: Option<String>,
1254    /// Output only. The state of this proposal.
1255    #[serde(rename="linkProposalState")]
1256    
1257    pub link_proposal_state: Option<String>,
1258    /// Output only. The email address of the user that proposed this linkage.
1259    #[serde(rename="requestorEmail")]
1260    
1261    pub requestor_email: Option<String>,
1262}
1263
1264impl client::Part for GoogleAnalyticsAdminV1alphaLinkProposalStatusDetails {}
1265
1266
1267/// Response message for ListAccountSummaries RPC.
1268/// 
1269/// # Activities
1270/// 
1271/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1272/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1273/// 
1274/// * [list account summaries](AccountSummaryListCall) (response)
1275#[serde_with::serde_as(crate = "::client::serde_with")]
1276#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1277pub struct GoogleAnalyticsAdminV1alphaListAccountSummariesResponse {
1278    /// Account summaries of all accounts the caller has access to.
1279    #[serde(rename="accountSummaries")]
1280    
1281    pub account_summaries: Option<Vec<GoogleAnalyticsAdminV1alphaAccountSummary>>,
1282    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1283    #[serde(rename="nextPageToken")]
1284    
1285    pub next_page_token: Option<String>,
1286}
1287
1288impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListAccountSummariesResponse {}
1289
1290
1291/// Request message for ListAccounts RPC.
1292/// 
1293/// # Activities
1294/// 
1295/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1296/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1297/// 
1298/// * [list accounts](AccountListCall) (response)
1299#[serde_with::serde_as(crate = "::client::serde_with")]
1300#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1301pub struct GoogleAnalyticsAdminV1alphaListAccountsResponse {
1302    /// Results that were accessible to the caller.
1303    
1304    pub accounts: Option<Vec<GoogleAnalyticsAdminV1alphaAccount>>,
1305    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1306    #[serde(rename="nextPageToken")]
1307    
1308    pub next_page_token: Option<String>,
1309}
1310
1311impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListAccountsResponse {}
1312
1313
1314/// Response message for ListConversionEvents RPC.
1315/// 
1316/// # Activities
1317/// 
1318/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1319/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1320/// 
1321/// * [conversion events list properties](PropertyConversionEventListCall) (response)
1322#[serde_with::serde_as(crate = "::client::serde_with")]
1323#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1324pub struct GoogleAnalyticsAdminV1alphaListConversionEventsResponse {
1325    /// The requested conversion events
1326    #[serde(rename="conversionEvents")]
1327    
1328    pub conversion_events: Option<Vec<GoogleAnalyticsAdminV1alphaConversionEvent>>,
1329    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1330    #[serde(rename="nextPageToken")]
1331    
1332    pub next_page_token: Option<String>,
1333}
1334
1335impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListConversionEventsResponse {}
1336
1337
1338/// Response message for ListCustomDimensions RPC.
1339/// 
1340/// # Activities
1341/// 
1342/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1343/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1344/// 
1345/// * [custom dimensions list properties](PropertyCustomDimensionListCall) (response)
1346#[serde_with::serde_as(crate = "::client::serde_with")]
1347#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1348pub struct GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse {
1349    /// List of CustomDimensions.
1350    #[serde(rename="customDimensions")]
1351    
1352    pub custom_dimensions: Option<Vec<GoogleAnalyticsAdminV1alphaCustomDimension>>,
1353    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1354    #[serde(rename="nextPageToken")]
1355    
1356    pub next_page_token: Option<String>,
1357}
1358
1359impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse {}
1360
1361
1362/// Response message for ListCustomMetrics RPC.
1363/// 
1364/// # Activities
1365/// 
1366/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1367/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1368/// 
1369/// * [custom metrics list properties](PropertyCustomMetricListCall) (response)
1370#[serde_with::serde_as(crate = "::client::serde_with")]
1371#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1372pub struct GoogleAnalyticsAdminV1alphaListCustomMetricsResponse {
1373    /// List of CustomMetrics.
1374    #[serde(rename="customMetrics")]
1375    
1376    pub custom_metrics: Option<Vec<GoogleAnalyticsAdminV1alphaCustomMetric>>,
1377    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1378    #[serde(rename="nextPageToken")]
1379    
1380    pub next_page_token: Option<String>,
1381}
1382
1383impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListCustomMetricsResponse {}
1384
1385
1386/// Response message for ListDataStreams RPC.
1387/// 
1388/// # Activities
1389/// 
1390/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1391/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1392/// 
1393/// * [data streams list properties](PropertyDataStreamListCall) (response)
1394#[serde_with::serde_as(crate = "::client::serde_with")]
1395#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1396pub struct GoogleAnalyticsAdminV1alphaListDataStreamsResponse {
1397    /// List of DataStreams.
1398    #[serde(rename="dataStreams")]
1399    
1400    pub data_streams: Option<Vec<GoogleAnalyticsAdminV1alphaDataStream>>,
1401    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1402    #[serde(rename="nextPageToken")]
1403    
1404    pub next_page_token: Option<String>,
1405}
1406
1407impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListDataStreamsResponse {}
1408
1409
1410/// Response message for ListDisplayVideo360AdvertiserLinkProposals RPC.
1411/// 
1412/// # Activities
1413/// 
1414/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1415/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1416/// 
1417/// * [display video360 advertiser link proposals list properties](PropertyDisplayVideo360AdvertiserLinkProposalListCall) (response)
1418#[serde_with::serde_as(crate = "::client::serde_with")]
1419#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1420pub struct GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinkProposalsResponse {
1421    /// List of DisplayVideo360AdvertiserLinkProposals.
1422    #[serde(rename="displayVideo360AdvertiserLinkProposals")]
1423    
1424    pub display_video360_advertiser_link_proposals: Option<Vec<GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal>>,
1425    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1426    #[serde(rename="nextPageToken")]
1427    
1428    pub next_page_token: Option<String>,
1429}
1430
1431impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinkProposalsResponse {}
1432
1433
1434/// Response message for ListDisplayVideo360AdvertiserLinks RPC.
1435/// 
1436/// # Activities
1437/// 
1438/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1439/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1440/// 
1441/// * [display video360 advertiser links list properties](PropertyDisplayVideo360AdvertiserLinkListCall) (response)
1442#[serde_with::serde_as(crate = "::client::serde_with")]
1443#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1444pub struct GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinksResponse {
1445    /// List of DisplayVideo360AdvertiserLinks.
1446    #[serde(rename="displayVideo360AdvertiserLinks")]
1447    
1448    pub display_video360_advertiser_links: Option<Vec<GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink>>,
1449    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1450    #[serde(rename="nextPageToken")]
1451    
1452    pub next_page_token: Option<String>,
1453}
1454
1455impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinksResponse {}
1456
1457
1458/// Response message for ListFirebaseLinks RPC
1459/// 
1460/// # Activities
1461/// 
1462/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1463/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1464/// 
1465/// * [firebase links list properties](PropertyFirebaseLinkListCall) (response)
1466#[serde_with::serde_as(crate = "::client::serde_with")]
1467#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1468pub struct GoogleAnalyticsAdminV1alphaListFirebaseLinksResponse {
1469    /// List of FirebaseLinks. This will have at most one value.
1470    #[serde(rename="firebaseLinks")]
1471    
1472    pub firebase_links: Option<Vec<GoogleAnalyticsAdminV1alphaFirebaseLink>>,
1473    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. Currently, Google Analytics supports only one FirebaseLink per property, so this will never be populated.
1474    #[serde(rename="nextPageToken")]
1475    
1476    pub next_page_token: Option<String>,
1477}
1478
1479impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListFirebaseLinksResponse {}
1480
1481
1482/// Response message for ListGoogleAdsLinks RPC.
1483/// 
1484/// # Activities
1485/// 
1486/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1487/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1488/// 
1489/// * [google ads links list properties](PropertyGoogleAdsLinkListCall) (response)
1490#[serde_with::serde_as(crate = "::client::serde_with")]
1491#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1492pub struct GoogleAnalyticsAdminV1alphaListGoogleAdsLinksResponse {
1493    /// List of GoogleAdsLinks.
1494    #[serde(rename="googleAdsLinks")]
1495    
1496    pub google_ads_links: Option<Vec<GoogleAnalyticsAdminV1alphaGoogleAdsLink>>,
1497    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1498    #[serde(rename="nextPageToken")]
1499    
1500    pub next_page_token: Option<String>,
1501}
1502
1503impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListGoogleAdsLinksResponse {}
1504
1505
1506/// Response message for ListMeasurementProtocolSecret RPC
1507/// 
1508/// # Activities
1509/// 
1510/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1512/// 
1513/// * [data streams measurement protocol secrets list properties](PropertyDataStreamMeasurementProtocolSecretListCall) (response)
1514#[serde_with::serde_as(crate = "::client::serde_with")]
1515#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1516pub struct GoogleAnalyticsAdminV1alphaListMeasurementProtocolSecretsResponse {
1517    /// A list of secrets for the parent stream specified in the request.
1518    #[serde(rename="measurementProtocolSecrets")]
1519    
1520    pub measurement_protocol_secrets: Option<Vec<GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret>>,
1521    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1522    #[serde(rename="nextPageToken")]
1523    
1524    pub next_page_token: Option<String>,
1525}
1526
1527impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListMeasurementProtocolSecretsResponse {}
1528
1529
1530/// Response message for ListProperties RPC.
1531/// 
1532/// # Activities
1533/// 
1534/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1535/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1536/// 
1537/// * [list properties](PropertyListCall) (response)
1538#[serde_with::serde_as(crate = "::client::serde_with")]
1539#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1540pub struct GoogleAnalyticsAdminV1alphaListPropertiesResponse {
1541    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1542    #[serde(rename="nextPageToken")]
1543    
1544    pub next_page_token: Option<String>,
1545    /// Results that matched the filter criteria and were accessible to the caller.
1546    
1547    pub properties: Option<Vec<GoogleAnalyticsAdminV1alphaProperty>>,
1548}
1549
1550impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListPropertiesResponse {}
1551
1552
1553/// Response message for ListUserLinks RPC.
1554/// 
1555/// # Activities
1556/// 
1557/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1558/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1559/// 
1560/// * [user links list accounts](AccountUserLinkListCall) (response)
1561/// * [user links list properties](PropertyUserLinkListCall) (response)
1562#[serde_with::serde_as(crate = "::client::serde_with")]
1563#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1564pub struct GoogleAnalyticsAdminV1alphaListUserLinksResponse {
1565    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1566    #[serde(rename="nextPageToken")]
1567    
1568    pub next_page_token: Option<String>,
1569    /// List of UserLinks. These will be ordered stably, but in an arbitrary order.
1570    #[serde(rename="userLinks")]
1571    
1572    pub user_links: Option<Vec<GoogleAnalyticsAdminV1alphaUserLink>>,
1573}
1574
1575impl client::ResponseResult for GoogleAnalyticsAdminV1alphaListUserLinksResponse {}
1576
1577
1578/// A secret value used for sending hits to Measurement Protocol.
1579/// 
1580/// # Activities
1581/// 
1582/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1583/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1584/// 
1585/// * [data streams measurement protocol secrets create properties](PropertyDataStreamMeasurementProtocolSecretCreateCall) (request|response)
1586/// * [data streams measurement protocol secrets get properties](PropertyDataStreamMeasurementProtocolSecretGetCall) (response)
1587/// * [data streams measurement protocol secrets patch properties](PropertyDataStreamMeasurementProtocolSecretPatchCall) (request|response)
1588#[serde_with::serde_as(crate = "::client::serde_with")]
1589#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1590pub struct GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret {
1591    /// Required. Human-readable display name for this secret.
1592    #[serde(rename="displayName")]
1593    
1594    pub display_name: Option<String>,
1595    /// Output only. Resource name of this secret. This secret may be a child of any type of stream. Format: properties/{property}/webDataStreams/{webDataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
1596    
1597    pub name: Option<String>,
1598    /// Output only. The measurement protocol secret value. Pass this value to the api_secret field of the Measurement Protocol API when sending hits to this secret's parent property.
1599    #[serde(rename="secretValue")]
1600    
1601    pub secret_value: Option<String>,
1602}
1603
1604impl client::RequestValue for GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret {}
1605impl client::ResponseResult for GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret {}
1606
1607
1608/// A resource message representing a Google Analytics GA4 property.
1609/// 
1610/// # Activities
1611/// 
1612/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1613/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1614/// 
1615/// * [create properties](PropertyCreateCall) (request|response)
1616/// * [delete properties](PropertyDeleteCall) (response)
1617/// * [get properties](PropertyGetCall) (response)
1618/// * [patch properties](PropertyPatchCall) (request|response)
1619#[serde_with::serde_as(crate = "::client::serde_with")]
1620#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1621pub struct GoogleAnalyticsAdminV1alphaProperty {
1622    /// Immutable. The resource name of the parent account Format: accounts/{account_id} Example: "accounts/123"
1623    
1624    pub account: Option<String>,
1625    /// Output only. Time when the entity was originally created.
1626    #[serde(rename="createTime")]
1627    
1628    pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1629    /// The currency type used in reports involving monetary values. Format: https://en.wikipedia.org/wiki/ISO_4217 Examples: "USD", "EUR", "JPY"
1630    #[serde(rename="currencyCode")]
1631    
1632    pub currency_code: Option<String>,
1633    /// Output only. If set, the time at which this property was trashed. If not set, then this property is not currently in the trash can.
1634    #[serde(rename="deleteTime")]
1635    
1636    pub delete_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1637    /// Required. Human-readable display name for this property. The max allowed display name length is 100 UTF-16 code units.
1638    #[serde(rename="displayName")]
1639    
1640    pub display_name: Option<String>,
1641    /// Output only. If set, the time at which this trashed property will be permanently deleted. If not set, then this property is not currently in the trash can and is not slated to be deleted.
1642    #[serde(rename="expireTime")]
1643    
1644    pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1645    /// Industry associated with this property Example: AUTOMOTIVE, FOOD_AND_DRINK
1646    #[serde(rename="industryCategory")]
1647    
1648    pub industry_category: Option<String>,
1649    /// Output only. Resource name of this property. Format: properties/{property_id} Example: "properties/1000"
1650    
1651    pub name: Option<String>,
1652    /// Immutable. Resource name of this property's logical parent. Note: The Property-Moving UI can be used to change the parent. Format: accounts/{account} Example: "accounts/100"
1653    
1654    pub parent: Option<String>,
1655    /// Output only. The Google Analytics service level that applies to this property.
1656    #[serde(rename="serviceLevel")]
1657    
1658    pub service_level: Option<String>,
1659    /// Required. Reporting Time Zone, used as the day boundary for reports, regardless of where the data originates. If the time zone honors DST, Analytics will automatically adjust for the changes. NOTE: Changing the time zone only affects data going forward, and is not applied retroactively. Format: https://www.iana.org/time-zones Example: "America/Los_Angeles"
1660    #[serde(rename="timeZone")]
1661    
1662    pub time_zone: Option<String>,
1663    /// Output only. Time when entity payload fields were last updated.
1664    #[serde(rename="updateTime")]
1665    
1666    pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1667}
1668
1669impl client::RequestValue for GoogleAnalyticsAdminV1alphaProperty {}
1670impl client::ResponseResult for GoogleAnalyticsAdminV1alphaProperty {}
1671
1672
1673/// A virtual resource representing metadata for a GA4 property.
1674/// 
1675/// This type is not used in any activity, and only used as *part* of another schema.
1676/// 
1677#[serde_with::serde_as(crate = "::client::serde_with")]
1678#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1679pub struct GoogleAnalyticsAdminV1alphaPropertySummary {
1680    /// Display name for the property referred to in this property summary.
1681    #[serde(rename="displayName")]
1682    
1683    pub display_name: Option<String>,
1684    /// Resource name of property referred to by this property summary Format: properties/{property_id} Example: "properties/1000"
1685    
1686    pub property: Option<String>,
1687}
1688
1689impl client::Part for GoogleAnalyticsAdminV1alphaPropertySummary {}
1690
1691
1692/// Request message for ProvisionAccountTicket RPC.
1693/// 
1694/// # Activities
1695/// 
1696/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1697/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1698/// 
1699/// * [provision account ticket accounts](AccountProvisionAccountTicketCall) (request)
1700#[serde_with::serde_as(crate = "::client::serde_with")]
1701#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1702pub struct GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest {
1703    /// The account to create.
1704    
1705    pub account: Option<GoogleAnalyticsAdminV1alphaAccount>,
1706    /// Redirect URI where the user will be sent after accepting Terms of Service. Must be configured in Developers Console as a Redirect URI
1707    #[serde(rename="redirectUri")]
1708    
1709    pub redirect_uri: Option<String>,
1710}
1711
1712impl client::RequestValue for GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest {}
1713
1714
1715/// Response message for ProvisionAccountTicket RPC.
1716/// 
1717/// # Activities
1718/// 
1719/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1720/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1721/// 
1722/// * [provision account ticket accounts](AccountProvisionAccountTicketCall) (response)
1723#[serde_with::serde_as(crate = "::client::serde_with")]
1724#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1725pub struct GoogleAnalyticsAdminV1alphaProvisionAccountTicketResponse {
1726    /// The param to be passed in the ToS link.
1727    #[serde(rename="accountTicketId")]
1728    
1729    pub account_ticket_id: Option<String>,
1730}
1731
1732impl client::ResponseResult for GoogleAnalyticsAdminV1alphaProvisionAccountTicketResponse {}
1733
1734
1735/// Request message for SearchChangeHistoryEvents RPC.
1736/// 
1737/// # Activities
1738/// 
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741/// 
1742/// * [search change history events accounts](AccountSearchChangeHistoryEventCall) (request)
1743#[serde_with::serde_as(crate = "::client::serde_with")]
1744#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1745pub struct GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest {
1746    /// Optional. If set, only return changes that match one or more of these types of actions.
1747    
1748    pub action: Option<Vec<String>>,
1749    /// Optional. If set, only return changes if they are made by a user in this list.
1750    #[serde(rename="actorEmail")]
1751    
1752    pub actor_email: Option<Vec<String>>,
1753    /// Optional. If set, only return changes made after this time (inclusive).
1754    #[serde(rename="earliestChangeTime")]
1755    
1756    pub earliest_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1757    /// Optional. If set, only return changes made before this time (inclusive).
1758    #[serde(rename="latestChangeTime")]
1759    
1760    pub latest_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1761    /// Optional. The maximum number of ChangeHistoryEvent items to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 items will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
1762    #[serde(rename="pageSize")]
1763    
1764    pub page_size: Option<i32>,
1765    /// Optional. A page token, received from a previous `SearchChangeHistoryEvents` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `SearchChangeHistoryEvents` must match the call that provided the page token.
1766    #[serde(rename="pageToken")]
1767    
1768    pub page_token: Option<String>,
1769    /// Optional. Resource name for a child property. If set, only return changes made to this property or its child resources.
1770    
1771    pub property: Option<String>,
1772    /// Optional. If set, only return changes if they are for a resource that matches at least one of these types.
1773    #[serde(rename="resourceType")]
1774    
1775    pub resource_type: Option<Vec<String>>,
1776}
1777
1778impl client::RequestValue for GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest {}
1779
1780
1781/// Response message for SearchAccounts RPC.
1782/// 
1783/// # Activities
1784/// 
1785/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1786/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1787/// 
1788/// * [search change history events accounts](AccountSearchChangeHistoryEventCall) (response)
1789#[serde_with::serde_as(crate = "::client::serde_with")]
1790#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1791pub struct GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsResponse {
1792    /// Results that were accessible to the caller.
1793    #[serde(rename="changeHistoryEvents")]
1794    
1795    pub change_history_events: Option<Vec<GoogleAnalyticsAdminV1alphaChangeHistoryEvent>>,
1796    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1797    #[serde(rename="nextPageToken")]
1798    
1799    pub next_page_token: Option<String>,
1800}
1801
1802impl client::ResponseResult for GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsResponse {}
1803
1804
1805/// Request message for UpdateUserLink RPC.
1806/// 
1807/// This type is not used in any activity, and only used as *part* of another schema.
1808/// 
1809#[serde_with::serde_as(crate = "::client::serde_with")]
1810#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1811pub struct GoogleAnalyticsAdminV1alphaUpdateUserLinkRequest {
1812    /// Required. The user link to update.
1813    #[serde(rename="userLink")]
1814    
1815    pub user_link: Option<GoogleAnalyticsAdminV1alphaUserLink>,
1816}
1817
1818impl client::Part for GoogleAnalyticsAdminV1alphaUpdateUserLinkRequest {}
1819
1820
1821/// A resource message representing a user’s permissions on an Account or Property resource.
1822/// 
1823/// # Activities
1824/// 
1825/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1826/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1827/// 
1828/// * [user links create accounts](AccountUserLinkCreateCall) (request|response)
1829/// * [user links get accounts](AccountUserLinkGetCall) (response)
1830/// * [user links patch accounts](AccountUserLinkPatchCall) (request|response)
1831/// * [user links create properties](PropertyUserLinkCreateCall) (request|response)
1832/// * [user links get properties](PropertyUserLinkGetCall) (response)
1833/// * [user links patch properties](PropertyUserLinkPatchCall) (request|response)
1834#[serde_with::serde_as(crate = "::client::serde_with")]
1835#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1836pub struct GoogleAnalyticsAdminV1alphaUserLink {
1837    /// Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/viewer predefinedRoles/analyst predefinedRoles/editor predefinedRoles/admin predefinedRoles/no-cost-data predefinedRoles/no-revenue-data Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
1838    #[serde(rename="directRoles")]
1839    
1840    pub direct_roles: Option<Vec<String>>,
1841    /// Immutable. Email address of the user to link
1842    #[serde(rename="emailAddress")]
1843    
1844    pub email_address: Option<String>,
1845    /// Output only. Example format: properties/1234/userLinks/5678
1846    
1847    pub name: Option<String>,
1848}
1849
1850impl client::RequestValue for GoogleAnalyticsAdminV1alphaUserLink {}
1851impl client::ResponseResult for GoogleAnalyticsAdminV1alphaUserLink {}
1852
1853
1854/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
1855/// 
1856/// # Activities
1857/// 
1858/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
1859/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1860/// 
1861/// * [user links batch delete accounts](AccountUserLinkBatchDeleteCall) (response)
1862/// * [user links delete accounts](AccountUserLinkDeleteCall) (response)
1863/// * [delete accounts](AccountDeleteCall) (response)
1864/// * [conversion events delete properties](PropertyConversionEventDeleteCall) (response)
1865/// * [custom dimensions archive properties](PropertyCustomDimensionArchiveCall) (response)
1866/// * [custom metrics archive properties](PropertyCustomMetricArchiveCall) (response)
1867/// * [data streams measurement protocol secrets delete properties](PropertyDataStreamMeasurementProtocolSecretDeleteCall) (response)
1868/// * [data streams delete properties](PropertyDataStreamDeleteCall) (response)
1869/// * [display video360 advertiser link proposals delete properties](PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall) (response)
1870/// * [display video360 advertiser links delete properties](PropertyDisplayVideo360AdvertiserLinkDeleteCall) (response)
1871/// * [firebase links delete properties](PropertyFirebaseLinkDeleteCall) (response)
1872/// * [google ads links delete properties](PropertyGoogleAdsLinkDeleteCall) (response)
1873/// * [user links batch delete properties](PropertyUserLinkBatchDeleteCall) (response)
1874/// * [user links delete properties](PropertyUserLinkDeleteCall) (response)
1875#[serde_with::serde_as(crate = "::client::serde_with")]
1876#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1877pub struct GoogleProtobufEmpty { _never_set: Option<bool> }
1878
1879impl client::ResponseResult for GoogleProtobufEmpty {}
1880
1881
1882
1883// ###################
1884// MethodBuilders ###
1885// #################
1886
1887/// A builder providing access to all methods supported on *accountSummary* resources.
1888/// It is not used directly, but through the [`GoogleAnalyticsAdmin`] hub.
1889///
1890/// # Example
1891///
1892/// Instantiate a resource builder
1893///
1894/// ```test_harness,no_run
1895/// extern crate hyper;
1896/// extern crate hyper_rustls;
1897/// extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
1898/// 
1899/// # async fn dox() {
1900/// use std::default::Default;
1901/// use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
1902/// 
1903/// let secret: oauth2::ApplicationSecret = Default::default();
1904/// let auth = oauth2::InstalledFlowAuthenticator::builder(
1905///         secret,
1906///         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1907///     ).build().await.unwrap();
1908/// let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
1909/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1910/// // like `list(...)`
1911/// // to build up your call.
1912/// let rb = hub.account_summaries();
1913/// # }
1914/// ```
1915pub struct AccountSummaryMethods<'a, S>
1916    where S: 'a {
1917
1918    hub: &'a GoogleAnalyticsAdmin<S>,
1919}
1920
1921impl<'a, S> client::MethodsBuilder for AccountSummaryMethods<'a, S> {}
1922
1923impl<'a, S> AccountSummaryMethods<'a, S> {
1924    
1925    /// Create a builder to help you perform the following task:
1926    ///
1927    /// Returns summaries of all accounts accessible by the caller.
1928    pub fn list(&self) -> AccountSummaryListCall<'a, S> {
1929        AccountSummaryListCall {
1930            hub: self.hub,
1931            _page_token: Default::default(),
1932            _page_size: Default::default(),
1933            _delegate: Default::default(),
1934            _additional_params: Default::default(),
1935            _scopes: Default::default(),
1936        }
1937    }
1938}
1939
1940
1941
1942/// A builder providing access to all methods supported on *account* resources.
1943/// It is not used directly, but through the [`GoogleAnalyticsAdmin`] hub.
1944///
1945/// # Example
1946///
1947/// Instantiate a resource builder
1948///
1949/// ```test_harness,no_run
1950/// extern crate hyper;
1951/// extern crate hyper_rustls;
1952/// extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
1953/// 
1954/// # async fn dox() {
1955/// use std::default::Default;
1956/// use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
1957/// 
1958/// let secret: oauth2::ApplicationSecret = Default::default();
1959/// let auth = oauth2::InstalledFlowAuthenticator::builder(
1960///         secret,
1961///         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1962///     ).build().await.unwrap();
1963/// let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
1964/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1965/// // like `delete(...)`, `get(...)`, `get_data_sharing_settings(...)`, `list(...)`, `patch(...)`, `provision_account_ticket(...)`, `search_change_history_events(...)`, `user_links_audit(...)`, `user_links_batch_create(...)`, `user_links_batch_delete(...)`, `user_links_batch_get(...)`, `user_links_batch_update(...)`, `user_links_create(...)`, `user_links_delete(...)`, `user_links_get(...)`, `user_links_list(...)` and `user_links_patch(...)`
1966/// // to build up your call.
1967/// let rb = hub.accounts();
1968/// # }
1969/// ```
1970pub struct AccountMethods<'a, S>
1971    where S: 'a {
1972
1973    hub: &'a GoogleAnalyticsAdmin<S>,
1974}
1975
1976impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
1977
1978impl<'a, S> AccountMethods<'a, S> {
1979    
1980    /// Create a builder to help you perform the following task:
1981    ///
1982    /// Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.
1983    /// 
1984    /// # Arguments
1985    ///
1986    /// * `request` - No description provided.
1987    /// * `parent` - Required. Example format: accounts/1234
1988    pub fn user_links_audit(&self, request: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest, parent: &str) -> AccountUserLinkAuditCall<'a, S> {
1989        AccountUserLinkAuditCall {
1990            hub: self.hub,
1991            _request: request,
1992            _parent: parent.to_string(),
1993            _delegate: Default::default(),
1994            _additional_params: Default::default(),
1995            _scopes: Default::default(),
1996        }
1997    }
1998    
1999    /// Create a builder to help you perform the following task:
2000    ///
2001    /// Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.
2002    /// 
2003    /// # Arguments
2004    ///
2005    /// * `request` - No description provided.
2006    /// * `parent` - Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
2007    pub fn user_links_batch_create(&self, request: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest, parent: &str) -> AccountUserLinkBatchCreateCall<'a, S> {
2008        AccountUserLinkBatchCreateCall {
2009            hub: self.hub,
2010            _request: request,
2011            _parent: parent.to_string(),
2012            _delegate: Default::default(),
2013            _additional_params: Default::default(),
2014            _scopes: Default::default(),
2015        }
2016    }
2017    
2018    /// Create a builder to help you perform the following task:
2019    ///
2020    /// Deletes information about multiple users' links to an account or property.
2021    /// 
2022    /// # Arguments
2023    ///
2024    /// * `request` - No description provided.
2025    /// * `parent` - Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234
2026    pub fn user_links_batch_delete(&self, request: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest, parent: &str) -> AccountUserLinkBatchDeleteCall<'a, S> {
2027        AccountUserLinkBatchDeleteCall {
2028            hub: self.hub,
2029            _request: request,
2030            _parent: parent.to_string(),
2031            _delegate: Default::default(),
2032            _additional_params: Default::default(),
2033            _scopes: Default::default(),
2034        }
2035    }
2036    
2037    /// Create a builder to help you perform the following task:
2038    ///
2039    /// Gets information about multiple users' links to an account or property.
2040    /// 
2041    /// # Arguments
2042    ///
2043    /// * `parent` - Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234
2044    pub fn user_links_batch_get(&self, parent: &str) -> AccountUserLinkBatchGetCall<'a, S> {
2045        AccountUserLinkBatchGetCall {
2046            hub: self.hub,
2047            _parent: parent.to_string(),
2048            _names: Default::default(),
2049            _delegate: Default::default(),
2050            _additional_params: Default::default(),
2051            _scopes: Default::default(),
2052        }
2053    }
2054    
2055    /// Create a builder to help you perform the following task:
2056    ///
2057    /// Updates information about multiple users' links to an account or property.
2058    /// 
2059    /// # Arguments
2060    ///
2061    /// * `request` - No description provided.
2062    /// * `parent` - Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
2063    pub fn user_links_batch_update(&self, request: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest, parent: &str) -> AccountUserLinkBatchUpdateCall<'a, S> {
2064        AccountUserLinkBatchUpdateCall {
2065            hub: self.hub,
2066            _request: request,
2067            _parent: parent.to_string(),
2068            _delegate: Default::default(),
2069            _additional_params: Default::default(),
2070            _scopes: Default::default(),
2071        }
2072    }
2073    
2074    /// Create a builder to help you perform the following task:
2075    ///
2076    /// Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.
2077    /// 
2078    /// # Arguments
2079    ///
2080    /// * `request` - No description provided.
2081    /// * `parent` - Required. Example format: accounts/1234
2082    pub fn user_links_create(&self, request: GoogleAnalyticsAdminV1alphaUserLink, parent: &str) -> AccountUserLinkCreateCall<'a, S> {
2083        AccountUserLinkCreateCall {
2084            hub: self.hub,
2085            _request: request,
2086            _parent: parent.to_string(),
2087            _notify_new_user: Default::default(),
2088            _delegate: Default::default(),
2089            _additional_params: Default::default(),
2090            _scopes: Default::default(),
2091        }
2092    }
2093    
2094    /// Create a builder to help you perform the following task:
2095    ///
2096    /// Deletes a user link on an account or property.
2097    /// 
2098    /// # Arguments
2099    ///
2100    /// * `name` - Required. Example format: accounts/1234/userLinks/5678
2101    pub fn user_links_delete(&self, name: &str) -> AccountUserLinkDeleteCall<'a, S> {
2102        AccountUserLinkDeleteCall {
2103            hub: self.hub,
2104            _name: name.to_string(),
2105            _delegate: Default::default(),
2106            _additional_params: Default::default(),
2107            _scopes: Default::default(),
2108        }
2109    }
2110    
2111    /// Create a builder to help you perform the following task:
2112    ///
2113    /// Gets information about a user's link to an account or property.
2114    /// 
2115    /// # Arguments
2116    ///
2117    /// * `name` - Required. Example format: accounts/1234/userLinks/5678
2118    pub fn user_links_get(&self, name: &str) -> AccountUserLinkGetCall<'a, S> {
2119        AccountUserLinkGetCall {
2120            hub: self.hub,
2121            _name: name.to_string(),
2122            _delegate: Default::default(),
2123            _additional_params: Default::default(),
2124            _scopes: Default::default(),
2125        }
2126    }
2127    
2128    /// Create a builder to help you perform the following task:
2129    ///
2130    /// Lists all user links on an account or property.
2131    /// 
2132    /// # Arguments
2133    ///
2134    /// * `parent` - Required. Example format: accounts/1234
2135    pub fn user_links_list(&self, parent: &str) -> AccountUserLinkListCall<'a, S> {
2136        AccountUserLinkListCall {
2137            hub: self.hub,
2138            _parent: parent.to_string(),
2139            _page_token: Default::default(),
2140            _page_size: Default::default(),
2141            _delegate: Default::default(),
2142            _additional_params: Default::default(),
2143            _scopes: Default::default(),
2144        }
2145    }
2146    
2147    /// Create a builder to help you perform the following task:
2148    ///
2149    /// Updates a user link on an account or property.
2150    /// 
2151    /// # Arguments
2152    ///
2153    /// * `request` - No description provided.
2154    /// * `name` - Output only. Example format: properties/1234/userLinks/5678
2155    pub fn user_links_patch(&self, request: GoogleAnalyticsAdminV1alphaUserLink, name: &str) -> AccountUserLinkPatchCall<'a, S> {
2156        AccountUserLinkPatchCall {
2157            hub: self.hub,
2158            _request: request,
2159            _name: name.to_string(),
2160            _delegate: Default::default(),
2161            _additional_params: Default::default(),
2162            _scopes: Default::default(),
2163        }
2164    }
2165    
2166    /// Create a builder to help you perform the following task:
2167    ///
2168    /// Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.
2169    /// 
2170    /// # Arguments
2171    ///
2172    /// * `name` - Required. The name of the Account to soft-delete. Format: accounts/{account} Example: "accounts/100"
2173    pub fn delete(&self, name: &str) -> AccountDeleteCall<'a, S> {
2174        AccountDeleteCall {
2175            hub: self.hub,
2176            _name: name.to_string(),
2177            _delegate: Default::default(),
2178            _additional_params: Default::default(),
2179            _scopes: Default::default(),
2180        }
2181    }
2182    
2183    /// Create a builder to help you perform the following task:
2184    ///
2185    /// Lookup for a single Account.
2186    /// 
2187    /// # Arguments
2188    ///
2189    /// * `name` - Required. The name of the account to lookup. Format: accounts/{account} Example: "accounts/100"
2190    pub fn get(&self, name: &str) -> AccountGetCall<'a, S> {
2191        AccountGetCall {
2192            hub: self.hub,
2193            _name: name.to_string(),
2194            _delegate: Default::default(),
2195            _additional_params: Default::default(),
2196            _scopes: Default::default(),
2197        }
2198    }
2199    
2200    /// Create a builder to help you perform the following task:
2201    ///
2202    /// Get data sharing settings on an account. Data sharing settings are singletons.
2203    /// 
2204    /// # Arguments
2205    ///
2206    /// * `name` - Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings"
2207    pub fn get_data_sharing_settings(&self, name: &str) -> AccountGetDataSharingSettingCall<'a, S> {
2208        AccountGetDataSharingSettingCall {
2209            hub: self.hub,
2210            _name: name.to_string(),
2211            _delegate: Default::default(),
2212            _additional_params: Default::default(),
2213            _scopes: Default::default(),
2214        }
2215    }
2216    
2217    /// Create a builder to help you perform the following task:
2218    ///
2219    /// Returns all accounts accessible by the caller. Note that these accounts might not currently have GA4 properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.
2220    pub fn list(&self) -> AccountListCall<'a, S> {
2221        AccountListCall {
2222            hub: self.hub,
2223            _show_deleted: Default::default(),
2224            _page_token: Default::default(),
2225            _page_size: Default::default(),
2226            _delegate: Default::default(),
2227            _additional_params: Default::default(),
2228            _scopes: Default::default(),
2229        }
2230    }
2231    
2232    /// Create a builder to help you perform the following task:
2233    ///
2234    /// Updates an account.
2235    /// 
2236    /// # Arguments
2237    ///
2238    /// * `request` - No description provided.
2239    /// * `name` - Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
2240    pub fn patch(&self, request: GoogleAnalyticsAdminV1alphaAccount, name: &str) -> AccountPatchCall<'a, S> {
2241        AccountPatchCall {
2242            hub: self.hub,
2243            _request: request,
2244            _name: name.to_string(),
2245            _update_mask: Default::default(),
2246            _delegate: Default::default(),
2247            _additional_params: Default::default(),
2248            _scopes: Default::default(),
2249        }
2250    }
2251    
2252    /// Create a builder to help you perform the following task:
2253    ///
2254    /// Requests a ticket for creating an account.
2255    /// 
2256    /// # Arguments
2257    ///
2258    /// * `request` - No description provided.
2259    pub fn provision_account_ticket(&self, request: GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest) -> AccountProvisionAccountTicketCall<'a, S> {
2260        AccountProvisionAccountTicketCall {
2261            hub: self.hub,
2262            _request: request,
2263            _delegate: Default::default(),
2264            _additional_params: Default::default(),
2265            _scopes: Default::default(),
2266        }
2267    }
2268    
2269    /// Create a builder to help you perform the following task:
2270    ///
2271    /// Searches through all changes to an account or its children given the specified set of filters.
2272    /// 
2273    /// # Arguments
2274    ///
2275    /// * `request` - No description provided.
2276    /// * `account` - Required. The account resource for which to return change history resources.
2277    pub fn search_change_history_events(&self, request: GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest, account: &str) -> AccountSearchChangeHistoryEventCall<'a, S> {
2278        AccountSearchChangeHistoryEventCall {
2279            hub: self.hub,
2280            _request: request,
2281            _account: account.to_string(),
2282            _delegate: Default::default(),
2283            _additional_params: Default::default(),
2284            _scopes: Default::default(),
2285        }
2286    }
2287}
2288
2289
2290
2291/// A builder providing access to all methods supported on *property* resources.
2292/// It is not used directly, but through the [`GoogleAnalyticsAdmin`] hub.
2293///
2294/// # Example
2295///
2296/// Instantiate a resource builder
2297///
2298/// ```test_harness,no_run
2299/// extern crate hyper;
2300/// extern crate hyper_rustls;
2301/// extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
2302/// 
2303/// # async fn dox() {
2304/// use std::default::Default;
2305/// use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
2306/// 
2307/// let secret: oauth2::ApplicationSecret = Default::default();
2308/// let auth = oauth2::InstalledFlowAuthenticator::builder(
2309///         secret,
2310///         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2311///     ).build().await.unwrap();
2312/// let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
2313/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2314/// // like `acknowledge_user_data_collection(...)`, `conversion_events_create(...)`, `conversion_events_delete(...)`, `conversion_events_get(...)`, `conversion_events_list(...)`, `create(...)`, `custom_dimensions_archive(...)`, `custom_dimensions_create(...)`, `custom_dimensions_get(...)`, `custom_dimensions_list(...)`, `custom_dimensions_patch(...)`, `custom_metrics_archive(...)`, `custom_metrics_create(...)`, `custom_metrics_get(...)`, `custom_metrics_list(...)`, `custom_metrics_patch(...)`, `data_streams_create(...)`, `data_streams_delete(...)`, `data_streams_get(...)`, `data_streams_get_global_site_tag(...)`, `data_streams_list(...)`, `data_streams_measurement_protocol_secrets_create(...)`, `data_streams_measurement_protocol_secrets_delete(...)`, `data_streams_measurement_protocol_secrets_get(...)`, `data_streams_measurement_protocol_secrets_list(...)`, `data_streams_measurement_protocol_secrets_patch(...)`, `data_streams_patch(...)`, `delete(...)`, `display_video360_advertiser_link_proposals_approve(...)`, `display_video360_advertiser_link_proposals_cancel(...)`, `display_video360_advertiser_link_proposals_create(...)`, `display_video360_advertiser_link_proposals_delete(...)`, `display_video360_advertiser_link_proposals_get(...)`, `display_video360_advertiser_link_proposals_list(...)`, `display_video360_advertiser_links_create(...)`, `display_video360_advertiser_links_delete(...)`, `display_video360_advertiser_links_get(...)`, `display_video360_advertiser_links_list(...)`, `display_video360_advertiser_links_patch(...)`, `firebase_links_create(...)`, `firebase_links_delete(...)`, `firebase_links_list(...)`, `get(...)`, `get_data_retention_settings(...)`, `get_google_signals_settings(...)`, `google_ads_links_create(...)`, `google_ads_links_delete(...)`, `google_ads_links_list(...)`, `google_ads_links_patch(...)`, `list(...)`, `patch(...)`, `update_data_retention_settings(...)`, `update_google_signals_settings(...)`, `user_links_audit(...)`, `user_links_batch_create(...)`, `user_links_batch_delete(...)`, `user_links_batch_get(...)`, `user_links_batch_update(...)`, `user_links_create(...)`, `user_links_delete(...)`, `user_links_get(...)`, `user_links_list(...)` and `user_links_patch(...)`
2315/// // to build up your call.
2316/// let rb = hub.properties();
2317/// # }
2318/// ```
2319pub struct PropertyMethods<'a, S>
2320    where S: 'a {
2321
2322    hub: &'a GoogleAnalyticsAdmin<S>,
2323}
2324
2325impl<'a, S> client::MethodsBuilder for PropertyMethods<'a, S> {}
2326
2327impl<'a, S> PropertyMethods<'a, S> {
2328    
2329    /// Create a builder to help you perform the following task:
2330    ///
2331    /// Creates a conversion event with the specified attributes.
2332    /// 
2333    /// # Arguments
2334    ///
2335    /// * `request` - No description provided.
2336    /// * `parent` - Required. The resource name of the parent property where this conversion event will be created. Format: properties/123
2337    pub fn conversion_events_create(&self, request: GoogleAnalyticsAdminV1alphaConversionEvent, parent: &str) -> PropertyConversionEventCreateCall<'a, S> {
2338        PropertyConversionEventCreateCall {
2339            hub: self.hub,
2340            _request: request,
2341            _parent: parent.to_string(),
2342            _delegate: Default::default(),
2343            _additional_params: Default::default(),
2344            _scopes: Default::default(),
2345        }
2346    }
2347    
2348    /// Create a builder to help you perform the following task:
2349    ///
2350    /// Deletes a conversion event in a property.
2351    /// 
2352    /// # Arguments
2353    ///
2354    /// * `name` - Required. The resource name of the conversion event to delete. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"
2355    pub fn conversion_events_delete(&self, name: &str) -> PropertyConversionEventDeleteCall<'a, S> {
2356        PropertyConversionEventDeleteCall {
2357            hub: self.hub,
2358            _name: name.to_string(),
2359            _delegate: Default::default(),
2360            _additional_params: Default::default(),
2361            _scopes: Default::default(),
2362        }
2363    }
2364    
2365    /// Create a builder to help you perform the following task:
2366    ///
2367    /// Retrieve a single conversion event.
2368    /// 
2369    /// # Arguments
2370    ///
2371    /// * `name` - Required. The resource name of the conversion event to retrieve. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"
2372    pub fn conversion_events_get(&self, name: &str) -> PropertyConversionEventGetCall<'a, S> {
2373        PropertyConversionEventGetCall {
2374            hub: self.hub,
2375            _name: name.to_string(),
2376            _delegate: Default::default(),
2377            _additional_params: Default::default(),
2378            _scopes: Default::default(),
2379        }
2380    }
2381    
2382    /// Create a builder to help you perform the following task:
2383    ///
2384    /// Returns a list of conversion events in the specified parent property. Returns an empty list if no conversion events are found.
2385    /// 
2386    /// # Arguments
2387    ///
2388    /// * `parent` - Required. The resource name of the parent property. Example: 'properties/123'
2389    pub fn conversion_events_list(&self, parent: &str) -> PropertyConversionEventListCall<'a, S> {
2390        PropertyConversionEventListCall {
2391            hub: self.hub,
2392            _parent: parent.to_string(),
2393            _page_token: Default::default(),
2394            _page_size: Default::default(),
2395            _delegate: Default::default(),
2396            _additional_params: Default::default(),
2397            _scopes: Default::default(),
2398        }
2399    }
2400    
2401    /// Create a builder to help you perform the following task:
2402    ///
2403    /// Archives a CustomDimension on a property.
2404    /// 
2405    /// # Arguments
2406    ///
2407    /// * `request` - No description provided.
2408    /// * `name` - Required. The name of the CustomDimension to archive. Example format: properties/1234/customDimensions/5678
2409    pub fn custom_dimensions_archive(&self, request: GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest, name: &str) -> PropertyCustomDimensionArchiveCall<'a, S> {
2410        PropertyCustomDimensionArchiveCall {
2411            hub: self.hub,
2412            _request: request,
2413            _name: name.to_string(),
2414            _delegate: Default::default(),
2415            _additional_params: Default::default(),
2416            _scopes: Default::default(),
2417        }
2418    }
2419    
2420    /// Create a builder to help you perform the following task:
2421    ///
2422    /// Creates a CustomDimension.
2423    /// 
2424    /// # Arguments
2425    ///
2426    /// * `request` - No description provided.
2427    /// * `parent` - Required. Example format: properties/1234
2428    pub fn custom_dimensions_create(&self, request: GoogleAnalyticsAdminV1alphaCustomDimension, parent: &str) -> PropertyCustomDimensionCreateCall<'a, S> {
2429        PropertyCustomDimensionCreateCall {
2430            hub: self.hub,
2431            _request: request,
2432            _parent: parent.to_string(),
2433            _delegate: Default::default(),
2434            _additional_params: Default::default(),
2435            _scopes: Default::default(),
2436        }
2437    }
2438    
2439    /// Create a builder to help you perform the following task:
2440    ///
2441    /// Lookup for a single CustomDimension.
2442    /// 
2443    /// # Arguments
2444    ///
2445    /// * `name` - Required. The name of the CustomDimension to get. Example format: properties/1234/customDimensions/5678
2446    pub fn custom_dimensions_get(&self, name: &str) -> PropertyCustomDimensionGetCall<'a, S> {
2447        PropertyCustomDimensionGetCall {
2448            hub: self.hub,
2449            _name: name.to_string(),
2450            _delegate: Default::default(),
2451            _additional_params: Default::default(),
2452            _scopes: Default::default(),
2453        }
2454    }
2455    
2456    /// Create a builder to help you perform the following task:
2457    ///
2458    /// Lists CustomDimensions on a property.
2459    /// 
2460    /// # Arguments
2461    ///
2462    /// * `parent` - Required. Example format: properties/1234
2463    pub fn custom_dimensions_list(&self, parent: &str) -> PropertyCustomDimensionListCall<'a, S> {
2464        PropertyCustomDimensionListCall {
2465            hub: self.hub,
2466            _parent: parent.to_string(),
2467            _page_token: Default::default(),
2468            _page_size: Default::default(),
2469            _delegate: Default::default(),
2470            _additional_params: Default::default(),
2471            _scopes: Default::default(),
2472        }
2473    }
2474    
2475    /// Create a builder to help you perform the following task:
2476    ///
2477    /// Updates a CustomDimension on a property.
2478    /// 
2479    /// # Arguments
2480    ///
2481    /// * `request` - No description provided.
2482    /// * `name` - Output only. Resource name for this CustomDimension resource. Format: properties/{property}/customDimensions/{customDimension}
2483    pub fn custom_dimensions_patch(&self, request: GoogleAnalyticsAdminV1alphaCustomDimension, name: &str) -> PropertyCustomDimensionPatchCall<'a, S> {
2484        PropertyCustomDimensionPatchCall {
2485            hub: self.hub,
2486            _request: request,
2487            _name: name.to_string(),
2488            _update_mask: Default::default(),
2489            _delegate: Default::default(),
2490            _additional_params: Default::default(),
2491            _scopes: Default::default(),
2492        }
2493    }
2494    
2495    /// Create a builder to help you perform the following task:
2496    ///
2497    /// Archives a CustomMetric on a property.
2498    /// 
2499    /// # Arguments
2500    ///
2501    /// * `request` - No description provided.
2502    /// * `name` - Required. The name of the CustomMetric to archive. Example format: properties/1234/customMetrics/5678
2503    pub fn custom_metrics_archive(&self, request: GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest, name: &str) -> PropertyCustomMetricArchiveCall<'a, S> {
2504        PropertyCustomMetricArchiveCall {
2505            hub: self.hub,
2506            _request: request,
2507            _name: name.to_string(),
2508            _delegate: Default::default(),
2509            _additional_params: Default::default(),
2510            _scopes: Default::default(),
2511        }
2512    }
2513    
2514    /// Create a builder to help you perform the following task:
2515    ///
2516    /// Creates a CustomMetric.
2517    /// 
2518    /// # Arguments
2519    ///
2520    /// * `request` - No description provided.
2521    /// * `parent` - Required. Example format: properties/1234
2522    pub fn custom_metrics_create(&self, request: GoogleAnalyticsAdminV1alphaCustomMetric, parent: &str) -> PropertyCustomMetricCreateCall<'a, S> {
2523        PropertyCustomMetricCreateCall {
2524            hub: self.hub,
2525            _request: request,
2526            _parent: parent.to_string(),
2527            _delegate: Default::default(),
2528            _additional_params: Default::default(),
2529            _scopes: Default::default(),
2530        }
2531    }
2532    
2533    /// Create a builder to help you perform the following task:
2534    ///
2535    /// Lookup for a single CustomMetric.
2536    /// 
2537    /// # Arguments
2538    ///
2539    /// * `name` - Required. The name of the CustomMetric to get. Example format: properties/1234/customMetrics/5678
2540    pub fn custom_metrics_get(&self, name: &str) -> PropertyCustomMetricGetCall<'a, S> {
2541        PropertyCustomMetricGetCall {
2542            hub: self.hub,
2543            _name: name.to_string(),
2544            _delegate: Default::default(),
2545            _additional_params: Default::default(),
2546            _scopes: Default::default(),
2547        }
2548    }
2549    
2550    /// Create a builder to help you perform the following task:
2551    ///
2552    /// Lists CustomMetrics on a property.
2553    /// 
2554    /// # Arguments
2555    ///
2556    /// * `parent` - Required. Example format: properties/1234
2557    pub fn custom_metrics_list(&self, parent: &str) -> PropertyCustomMetricListCall<'a, S> {
2558        PropertyCustomMetricListCall {
2559            hub: self.hub,
2560            _parent: parent.to_string(),
2561            _page_token: Default::default(),
2562            _page_size: Default::default(),
2563            _delegate: Default::default(),
2564            _additional_params: Default::default(),
2565            _scopes: Default::default(),
2566        }
2567    }
2568    
2569    /// Create a builder to help you perform the following task:
2570    ///
2571    /// Updates a CustomMetric on a property.
2572    /// 
2573    /// # Arguments
2574    ///
2575    /// * `request` - No description provided.
2576    /// * `name` - Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
2577    pub fn custom_metrics_patch(&self, request: GoogleAnalyticsAdminV1alphaCustomMetric, name: &str) -> PropertyCustomMetricPatchCall<'a, S> {
2578        PropertyCustomMetricPatchCall {
2579            hub: self.hub,
2580            _request: request,
2581            _name: name.to_string(),
2582            _update_mask: Default::default(),
2583            _delegate: Default::default(),
2584            _additional_params: Default::default(),
2585            _scopes: Default::default(),
2586        }
2587    }
2588    
2589    /// Create a builder to help you perform the following task:
2590    ///
2591    /// Creates a measurement protocol secret.
2592    /// 
2593    /// # Arguments
2594    ///
2595    /// * `request` - No description provided.
2596    /// * `parent` - Required. The parent resource where this secret will be created. Format: properties/{property}/dataStreams/{dataStream}
2597    pub fn data_streams_measurement_protocol_secrets_create(&self, request: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret, parent: &str) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {
2598        PropertyDataStreamMeasurementProtocolSecretCreateCall {
2599            hub: self.hub,
2600            _request: request,
2601            _parent: parent.to_string(),
2602            _delegate: Default::default(),
2603            _additional_params: Default::default(),
2604            _scopes: Default::default(),
2605        }
2606    }
2607    
2608    /// Create a builder to help you perform the following task:
2609    ///
2610    /// Deletes target MeasurementProtocolSecret.
2611    /// 
2612    /// # Arguments
2613    ///
2614    /// * `name` - Required. The name of the MeasurementProtocolSecret to delete. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
2615    pub fn data_streams_measurement_protocol_secrets_delete(&self, name: &str) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S> {
2616        PropertyDataStreamMeasurementProtocolSecretDeleteCall {
2617            hub: self.hub,
2618            _name: name.to_string(),
2619            _delegate: Default::default(),
2620            _additional_params: Default::default(),
2621            _scopes: Default::default(),
2622        }
2623    }
2624    
2625    /// Create a builder to help you perform the following task:
2626    ///
2627    /// Lookup for a single "GA4" MeasurementProtocolSecret.
2628    /// 
2629    /// # Arguments
2630    ///
2631    /// * `name` - Required. The name of the measurement protocol secret to lookup. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
2632    pub fn data_streams_measurement_protocol_secrets_get(&self, name: &str) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S> {
2633        PropertyDataStreamMeasurementProtocolSecretGetCall {
2634            hub: self.hub,
2635            _name: name.to_string(),
2636            _delegate: Default::default(),
2637            _additional_params: Default::default(),
2638            _scopes: Default::default(),
2639        }
2640    }
2641    
2642    /// Create a builder to help you perform the following task:
2643    ///
2644    /// Returns child MeasurementProtocolSecrets under the specified parent Property.
2645    /// 
2646    /// # Arguments
2647    ///
2648    /// * `parent` - Required. The resource name of the parent stream. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets
2649    pub fn data_streams_measurement_protocol_secrets_list(&self, parent: &str) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
2650        PropertyDataStreamMeasurementProtocolSecretListCall {
2651            hub: self.hub,
2652            _parent: parent.to_string(),
2653            _page_token: Default::default(),
2654            _page_size: Default::default(),
2655            _delegate: Default::default(),
2656            _additional_params: Default::default(),
2657            _scopes: Default::default(),
2658        }
2659    }
2660    
2661    /// Create a builder to help you perform the following task:
2662    ///
2663    /// Updates a measurement protocol secret.
2664    /// 
2665    /// # Arguments
2666    ///
2667    /// * `request` - No description provided.
2668    /// * `name` - Output only. Resource name of this secret. This secret may be a child of any type of stream. Format: properties/{property}/webDataStreams/{webDataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
2669    pub fn data_streams_measurement_protocol_secrets_patch(&self, request: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret, name: &str) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
2670        PropertyDataStreamMeasurementProtocolSecretPatchCall {
2671            hub: self.hub,
2672            _request: request,
2673            _name: name.to_string(),
2674            _update_mask: Default::default(),
2675            _delegate: Default::default(),
2676            _additional_params: Default::default(),
2677            _scopes: Default::default(),
2678        }
2679    }
2680    
2681    /// Create a builder to help you perform the following task:
2682    ///
2683    /// Creates a DataStream.
2684    /// 
2685    /// # Arguments
2686    ///
2687    /// * `request` - No description provided.
2688    /// * `parent` - Required. Example format: properties/1234
2689    pub fn data_streams_create(&self, request: GoogleAnalyticsAdminV1alphaDataStream, parent: &str) -> PropertyDataStreamCreateCall<'a, S> {
2690        PropertyDataStreamCreateCall {
2691            hub: self.hub,
2692            _request: request,
2693            _parent: parent.to_string(),
2694            _delegate: Default::default(),
2695            _additional_params: Default::default(),
2696            _scopes: Default::default(),
2697        }
2698    }
2699    
2700    /// Create a builder to help you perform the following task:
2701    ///
2702    /// Deletes a DataStream on a property.
2703    /// 
2704    /// # Arguments
2705    ///
2706    /// * `name` - Required. The name of the DataStream to delete. Example format: properties/1234/dataStreams/5678
2707    pub fn data_streams_delete(&self, name: &str) -> PropertyDataStreamDeleteCall<'a, S> {
2708        PropertyDataStreamDeleteCall {
2709            hub: self.hub,
2710            _name: name.to_string(),
2711            _delegate: Default::default(),
2712            _additional_params: Default::default(),
2713            _scopes: Default::default(),
2714        }
2715    }
2716    
2717    /// Create a builder to help you perform the following task:
2718    ///
2719    /// Lookup for a single DataStream.
2720    /// 
2721    /// # Arguments
2722    ///
2723    /// * `name` - Required. The name of the DataStream to get. Example format: properties/1234/dataStreams/5678
2724    pub fn data_streams_get(&self, name: &str) -> PropertyDataStreamGetCall<'a, S> {
2725        PropertyDataStreamGetCall {
2726            hub: self.hub,
2727            _name: name.to_string(),
2728            _delegate: Default::default(),
2729            _additional_params: Default::default(),
2730            _scopes: Default::default(),
2731        }
2732    }
2733    
2734    /// Create a builder to help you perform the following task:
2735    ///
2736    /// Returns the Site Tag for the specified web stream. Site Tags are immutable singletons.
2737    /// 
2738    /// # Arguments
2739    ///
2740    /// * `name` - Required. The name of the site tag to lookup. Note that site tags are singletons and do not have unique IDs. Format: properties/{property_id}/dataStreams/{stream_id}/globalSiteTag Example: "properties/123/dataStreams/456/globalSiteTag"
2741    pub fn data_streams_get_global_site_tag(&self, name: &str) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S> {
2742        PropertyDataStreamGetGlobalSiteTagCall {
2743            hub: self.hub,
2744            _name: name.to_string(),
2745            _delegate: Default::default(),
2746            _additional_params: Default::default(),
2747            _scopes: Default::default(),
2748        }
2749    }
2750    
2751    /// Create a builder to help you perform the following task:
2752    ///
2753    /// Lists DataStreams on a property.
2754    /// 
2755    /// # Arguments
2756    ///
2757    /// * `parent` - Required. Example format: properties/1234
2758    pub fn data_streams_list(&self, parent: &str) -> PropertyDataStreamListCall<'a, S> {
2759        PropertyDataStreamListCall {
2760            hub: self.hub,
2761            _parent: parent.to_string(),
2762            _page_token: Default::default(),
2763            _page_size: Default::default(),
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    /// Updates a DataStream on a property.
2773    /// 
2774    /// # Arguments
2775    ///
2776    /// * `request` - No description provided.
2777    /// * `name` - Output only. Resource name of this Data Stream. Format: properties/{property_id}/dataStreams/{stream_id} Example: "properties/1000/dataStreams/2000"
2778    pub fn data_streams_patch(&self, request: GoogleAnalyticsAdminV1alphaDataStream, name: &str) -> PropertyDataStreamPatchCall<'a, S> {
2779        PropertyDataStreamPatchCall {
2780            hub: self.hub,
2781            _request: request,
2782            _name: name.to_string(),
2783            _update_mask: Default::default(),
2784            _delegate: Default::default(),
2785            _additional_params: Default::default(),
2786            _scopes: Default::default(),
2787        }
2788    }
2789    
2790    /// Create a builder to help you perform the following task:
2791    ///
2792    /// Approves a DisplayVideo360AdvertiserLinkProposal. The DisplayVideo360AdvertiserLinkProposal will be deleted and a new DisplayVideo360AdvertiserLink will be created.
2793    /// 
2794    /// # Arguments
2795    ///
2796    /// * `request` - No description provided.
2797    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLinkProposal to approve. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
2798    pub fn display_video360_advertiser_link_proposals_approve(&self, request: GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest, name: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {
2799        PropertyDisplayVideo360AdvertiserLinkProposalApproveCall {
2800            hub: self.hub,
2801            _request: request,
2802            _name: name.to_string(),
2803            _delegate: Default::default(),
2804            _additional_params: Default::default(),
2805            _scopes: Default::default(),
2806        }
2807    }
2808    
2809    /// Create a builder to help you perform the following task:
2810    ///
2811    /// Cancels a DisplayVideo360AdvertiserLinkProposal. Cancelling can mean either: - Declining a proposal initiated from Display & Video 360 - Withdrawing a proposal initiated from Google Analytics After being cancelled, a proposal will eventually be deleted automatically.
2812    /// 
2813    /// # Arguments
2814    ///
2815    /// * `request` - No description provided.
2816    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLinkProposal to cancel. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
2817    pub fn display_video360_advertiser_link_proposals_cancel(&self, request: GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest, name: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {
2818        PropertyDisplayVideo360AdvertiserLinkProposalCancelCall {
2819            hub: self.hub,
2820            _request: request,
2821            _name: name.to_string(),
2822            _delegate: Default::default(),
2823            _additional_params: Default::default(),
2824            _scopes: Default::default(),
2825        }
2826    }
2827    
2828    /// Create a builder to help you perform the following task:
2829    ///
2830    /// Creates a DisplayVideo360AdvertiserLinkProposal.
2831    /// 
2832    /// # Arguments
2833    ///
2834    /// * `request` - No description provided.
2835    /// * `parent` - Required. Example format: properties/1234
2836    pub fn display_video360_advertiser_link_proposals_create(&self, request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal, parent: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {
2837        PropertyDisplayVideo360AdvertiserLinkProposalCreateCall {
2838            hub: self.hub,
2839            _request: request,
2840            _parent: parent.to_string(),
2841            _delegate: Default::default(),
2842            _additional_params: Default::default(),
2843            _scopes: Default::default(),
2844        }
2845    }
2846    
2847    /// Create a builder to help you perform the following task:
2848    ///
2849    /// Deletes a DisplayVideo360AdvertiserLinkProposal on a property. This can only be used on cancelled proposals.
2850    /// 
2851    /// # Arguments
2852    ///
2853    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLinkProposal to delete. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
2854    pub fn display_video360_advertiser_link_proposals_delete(&self, name: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S> {
2855        PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall {
2856            hub: self.hub,
2857            _name: name.to_string(),
2858            _delegate: Default::default(),
2859            _additional_params: Default::default(),
2860            _scopes: Default::default(),
2861        }
2862    }
2863    
2864    /// Create a builder to help you perform the following task:
2865    ///
2866    /// Lookup for a single DisplayVideo360AdvertiserLinkProposal.
2867    /// 
2868    /// # Arguments
2869    ///
2870    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLinkProposal to get. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
2871    pub fn display_video360_advertiser_link_proposals_get(&self, name: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S> {
2872        PropertyDisplayVideo360AdvertiserLinkProposalGetCall {
2873            hub: self.hub,
2874            _name: name.to_string(),
2875            _delegate: Default::default(),
2876            _additional_params: Default::default(),
2877            _scopes: Default::default(),
2878        }
2879    }
2880    
2881    /// Create a builder to help you perform the following task:
2882    ///
2883    /// Lists DisplayVideo360AdvertiserLinkProposals on a property.
2884    /// 
2885    /// # Arguments
2886    ///
2887    /// * `parent` - Required. Example format: properties/1234
2888    pub fn display_video360_advertiser_link_proposals_list(&self, parent: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
2889        PropertyDisplayVideo360AdvertiserLinkProposalListCall {
2890            hub: self.hub,
2891            _parent: parent.to_string(),
2892            _page_token: Default::default(),
2893            _page_size: Default::default(),
2894            _delegate: Default::default(),
2895            _additional_params: Default::default(),
2896            _scopes: Default::default(),
2897        }
2898    }
2899    
2900    /// Create a builder to help you perform the following task:
2901    ///
2902    /// Creates a DisplayVideo360AdvertiserLink. This can only be utilized by users who have proper authorization both on the Google Analytics property and on the Display & Video 360 advertiser. Users who do not have access to the Display & Video 360 advertiser should instead seek to create a DisplayVideo360LinkProposal.
2903    /// 
2904    /// # Arguments
2905    ///
2906    /// * `request` - No description provided.
2907    /// * `parent` - Required. Example format: properties/1234
2908    pub fn display_video360_advertiser_links_create(&self, request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink, parent: &str) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {
2909        PropertyDisplayVideo360AdvertiserLinkCreateCall {
2910            hub: self.hub,
2911            _request: request,
2912            _parent: parent.to_string(),
2913            _delegate: Default::default(),
2914            _additional_params: Default::default(),
2915            _scopes: Default::default(),
2916        }
2917    }
2918    
2919    /// Create a builder to help you perform the following task:
2920    ///
2921    /// Deletes a DisplayVideo360AdvertiserLink on a property.
2922    /// 
2923    /// # Arguments
2924    ///
2925    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLink to delete. Example format: properties/1234/displayVideo360AdvertiserLinks/5678
2926    pub fn display_video360_advertiser_links_delete(&self, name: &str) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S> {
2927        PropertyDisplayVideo360AdvertiserLinkDeleteCall {
2928            hub: self.hub,
2929            _name: name.to_string(),
2930            _delegate: Default::default(),
2931            _additional_params: Default::default(),
2932            _scopes: Default::default(),
2933        }
2934    }
2935    
2936    /// Create a builder to help you perform the following task:
2937    ///
2938    /// Look up a single DisplayVideo360AdvertiserLink
2939    /// 
2940    /// # Arguments
2941    ///
2942    /// * `name` - Required. The name of the DisplayVideo360AdvertiserLink to get. Example format: properties/1234/displayVideo360AdvertiserLink/5678
2943    pub fn display_video360_advertiser_links_get(&self, name: &str) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S> {
2944        PropertyDisplayVideo360AdvertiserLinkGetCall {
2945            hub: self.hub,
2946            _name: name.to_string(),
2947            _delegate: Default::default(),
2948            _additional_params: Default::default(),
2949            _scopes: Default::default(),
2950        }
2951    }
2952    
2953    /// Create a builder to help you perform the following task:
2954    ///
2955    /// Lists all DisplayVideo360AdvertiserLinks on a property.
2956    /// 
2957    /// # Arguments
2958    ///
2959    /// * `parent` - Required. Example format: properties/1234
2960    pub fn display_video360_advertiser_links_list(&self, parent: &str) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
2961        PropertyDisplayVideo360AdvertiserLinkListCall {
2962            hub: self.hub,
2963            _parent: parent.to_string(),
2964            _page_token: Default::default(),
2965            _page_size: Default::default(),
2966            _delegate: Default::default(),
2967            _additional_params: Default::default(),
2968            _scopes: Default::default(),
2969        }
2970    }
2971    
2972    /// Create a builder to help you perform the following task:
2973    ///
2974    /// Updates a DisplayVideo360AdvertiserLink on a property.
2975    /// 
2976    /// # Arguments
2977    ///
2978    /// * `request` - No description provided.
2979    /// * `name` - Output only. The resource name for this DisplayVideo360AdvertiserLink resource. Format: properties/{propertyId}/displayVideo360AdvertiserLinks/{linkId} Note: linkId is not the Display & Video 360 Advertiser ID
2980    pub fn display_video360_advertiser_links_patch(&self, request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink, name: &str) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
2981        PropertyDisplayVideo360AdvertiserLinkPatchCall {
2982            hub: self.hub,
2983            _request: request,
2984            _name: name.to_string(),
2985            _update_mask: Default::default(),
2986            _delegate: Default::default(),
2987            _additional_params: Default::default(),
2988            _scopes: Default::default(),
2989        }
2990    }
2991    
2992    /// Create a builder to help you perform the following task:
2993    ///
2994    /// Creates a FirebaseLink. Properties can have at most one FirebaseLink.
2995    /// 
2996    /// # Arguments
2997    ///
2998    /// * `request` - No description provided.
2999    /// * `parent` - Required. Format: properties/{property_id} Example: properties/1234
3000    pub fn firebase_links_create(&self, request: GoogleAnalyticsAdminV1alphaFirebaseLink, parent: &str) -> PropertyFirebaseLinkCreateCall<'a, S> {
3001        PropertyFirebaseLinkCreateCall {
3002            hub: self.hub,
3003            _request: request,
3004            _parent: parent.to_string(),
3005            _delegate: Default::default(),
3006            _additional_params: Default::default(),
3007            _scopes: Default::default(),
3008        }
3009    }
3010    
3011    /// Create a builder to help you perform the following task:
3012    ///
3013    /// Deletes a FirebaseLink on a property
3014    /// 
3015    /// # Arguments
3016    ///
3017    /// * `name` - Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} Example: properties/1234/firebaseLinks/5678
3018    pub fn firebase_links_delete(&self, name: &str) -> PropertyFirebaseLinkDeleteCall<'a, S> {
3019        PropertyFirebaseLinkDeleteCall {
3020            hub: self.hub,
3021            _name: name.to_string(),
3022            _delegate: Default::default(),
3023            _additional_params: Default::default(),
3024            _scopes: Default::default(),
3025        }
3026    }
3027    
3028    /// Create a builder to help you perform the following task:
3029    ///
3030    /// Lists FirebaseLinks on a property. Properties can have at most one FirebaseLink.
3031    /// 
3032    /// # Arguments
3033    ///
3034    /// * `parent` - Required. Format: properties/{property_id} Example: properties/1234
3035    pub fn firebase_links_list(&self, parent: &str) -> PropertyFirebaseLinkListCall<'a, S> {
3036        PropertyFirebaseLinkListCall {
3037            hub: self.hub,
3038            _parent: parent.to_string(),
3039            _page_token: Default::default(),
3040            _page_size: Default::default(),
3041            _delegate: Default::default(),
3042            _additional_params: Default::default(),
3043            _scopes: Default::default(),
3044        }
3045    }
3046    
3047    /// Create a builder to help you perform the following task:
3048    ///
3049    /// Creates a GoogleAdsLink.
3050    /// 
3051    /// # Arguments
3052    ///
3053    /// * `request` - No description provided.
3054    /// * `parent` - Required. Example format: properties/1234
3055    pub fn google_ads_links_create(&self, request: GoogleAnalyticsAdminV1alphaGoogleAdsLink, parent: &str) -> PropertyGoogleAdsLinkCreateCall<'a, S> {
3056        PropertyGoogleAdsLinkCreateCall {
3057            hub: self.hub,
3058            _request: request,
3059            _parent: parent.to_string(),
3060            _delegate: Default::default(),
3061            _additional_params: Default::default(),
3062            _scopes: Default::default(),
3063        }
3064    }
3065    
3066    /// Create a builder to help you perform the following task:
3067    ///
3068    /// Deletes a GoogleAdsLink on a property
3069    /// 
3070    /// # Arguments
3071    ///
3072    /// * `name` - Required. Example format: properties/1234/googleAdsLinks/5678
3073    pub fn google_ads_links_delete(&self, name: &str) -> PropertyGoogleAdsLinkDeleteCall<'a, S> {
3074        PropertyGoogleAdsLinkDeleteCall {
3075            hub: self.hub,
3076            _name: name.to_string(),
3077            _delegate: Default::default(),
3078            _additional_params: Default::default(),
3079            _scopes: Default::default(),
3080        }
3081    }
3082    
3083    /// Create a builder to help you perform the following task:
3084    ///
3085    /// Lists GoogleAdsLinks on a property.
3086    /// 
3087    /// # Arguments
3088    ///
3089    /// * `parent` - Required. Example format: properties/1234
3090    pub fn google_ads_links_list(&self, parent: &str) -> PropertyGoogleAdsLinkListCall<'a, S> {
3091        PropertyGoogleAdsLinkListCall {
3092            hub: self.hub,
3093            _parent: parent.to_string(),
3094            _page_token: Default::default(),
3095            _page_size: Default::default(),
3096            _delegate: Default::default(),
3097            _additional_params: Default::default(),
3098            _scopes: Default::default(),
3099        }
3100    }
3101    
3102    /// Create a builder to help you perform the following task:
3103    ///
3104    /// Updates a GoogleAdsLink on a property
3105    /// 
3106    /// # Arguments
3107    ///
3108    /// * `request` - No description provided.
3109    /// * `name` - Output only. Format: properties/{propertyId}/googleAdsLinks/{googleAdsLinkId} Note: googleAdsLinkId is not the Google Ads customer ID.
3110    pub fn google_ads_links_patch(&self, request: GoogleAnalyticsAdminV1alphaGoogleAdsLink, name: &str) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
3111        PropertyGoogleAdsLinkPatchCall {
3112            hub: self.hub,
3113            _request: request,
3114            _name: name.to_string(),
3115            _update_mask: Default::default(),
3116            _delegate: Default::default(),
3117            _additional_params: Default::default(),
3118            _scopes: Default::default(),
3119        }
3120    }
3121    
3122    /// Create a builder to help you perform the following task:
3123    ///
3124    /// Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.
3125    /// 
3126    /// # Arguments
3127    ///
3128    /// * `request` - No description provided.
3129    /// * `parent` - Required. Example format: accounts/1234
3130    pub fn user_links_audit(&self, request: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest, parent: &str) -> PropertyUserLinkAuditCall<'a, S> {
3131        PropertyUserLinkAuditCall {
3132            hub: self.hub,
3133            _request: request,
3134            _parent: parent.to_string(),
3135            _delegate: Default::default(),
3136            _additional_params: Default::default(),
3137            _scopes: Default::default(),
3138        }
3139    }
3140    
3141    /// Create a builder to help you perform the following task:
3142    ///
3143    /// Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.
3144    /// 
3145    /// # Arguments
3146    ///
3147    /// * `request` - No description provided.
3148    /// * `parent` - Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
3149    pub fn user_links_batch_create(&self, request: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest, parent: &str) -> PropertyUserLinkBatchCreateCall<'a, S> {
3150        PropertyUserLinkBatchCreateCall {
3151            hub: self.hub,
3152            _request: request,
3153            _parent: parent.to_string(),
3154            _delegate: Default::default(),
3155            _additional_params: Default::default(),
3156            _scopes: Default::default(),
3157        }
3158    }
3159    
3160    /// Create a builder to help you perform the following task:
3161    ///
3162    /// Deletes information about multiple users' links to an account or property.
3163    /// 
3164    /// # Arguments
3165    ///
3166    /// * `request` - No description provided.
3167    /// * `parent` - Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234
3168    pub fn user_links_batch_delete(&self, request: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest, parent: &str) -> PropertyUserLinkBatchDeleteCall<'a, S> {
3169        PropertyUserLinkBatchDeleteCall {
3170            hub: self.hub,
3171            _request: request,
3172            _parent: parent.to_string(),
3173            _delegate: Default::default(),
3174            _additional_params: Default::default(),
3175            _scopes: Default::default(),
3176        }
3177    }
3178    
3179    /// Create a builder to help you perform the following task:
3180    ///
3181    /// Gets information about multiple users' links to an account or property.
3182    /// 
3183    /// # Arguments
3184    ///
3185    /// * `parent` - Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234
3186    pub fn user_links_batch_get(&self, parent: &str) -> PropertyUserLinkBatchGetCall<'a, S> {
3187        PropertyUserLinkBatchGetCall {
3188            hub: self.hub,
3189            _parent: parent.to_string(),
3190            _names: Default::default(),
3191            _delegate: Default::default(),
3192            _additional_params: Default::default(),
3193            _scopes: Default::default(),
3194        }
3195    }
3196    
3197    /// Create a builder to help you perform the following task:
3198    ///
3199    /// Updates information about multiple users' links to an account or property.
3200    /// 
3201    /// # Arguments
3202    ///
3203    /// * `request` - No description provided.
3204    /// * `parent` - Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
3205    pub fn user_links_batch_update(&self, request: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest, parent: &str) -> PropertyUserLinkBatchUpdateCall<'a, S> {
3206        PropertyUserLinkBatchUpdateCall {
3207            hub: self.hub,
3208            _request: request,
3209            _parent: parent.to_string(),
3210            _delegate: Default::default(),
3211            _additional_params: Default::default(),
3212            _scopes: Default::default(),
3213        }
3214    }
3215    
3216    /// Create a builder to help you perform the following task:
3217    ///
3218    /// Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.
3219    /// 
3220    /// # Arguments
3221    ///
3222    /// * `request` - No description provided.
3223    /// * `parent` - Required. Example format: accounts/1234
3224    pub fn user_links_create(&self, request: GoogleAnalyticsAdminV1alphaUserLink, parent: &str) -> PropertyUserLinkCreateCall<'a, S> {
3225        PropertyUserLinkCreateCall {
3226            hub: self.hub,
3227            _request: request,
3228            _parent: parent.to_string(),
3229            _notify_new_user: Default::default(),
3230            _delegate: Default::default(),
3231            _additional_params: Default::default(),
3232            _scopes: Default::default(),
3233        }
3234    }
3235    
3236    /// Create a builder to help you perform the following task:
3237    ///
3238    /// Deletes a user link on an account or property.
3239    /// 
3240    /// # Arguments
3241    ///
3242    /// * `name` - Required. Example format: accounts/1234/userLinks/5678
3243    pub fn user_links_delete(&self, name: &str) -> PropertyUserLinkDeleteCall<'a, S> {
3244        PropertyUserLinkDeleteCall {
3245            hub: self.hub,
3246            _name: name.to_string(),
3247            _delegate: Default::default(),
3248            _additional_params: Default::default(),
3249            _scopes: Default::default(),
3250        }
3251    }
3252    
3253    /// Create a builder to help you perform the following task:
3254    ///
3255    /// Gets information about a user's link to an account or property.
3256    /// 
3257    /// # Arguments
3258    ///
3259    /// * `name` - Required. Example format: accounts/1234/userLinks/5678
3260    pub fn user_links_get(&self, name: &str) -> PropertyUserLinkGetCall<'a, S> {
3261        PropertyUserLinkGetCall {
3262            hub: self.hub,
3263            _name: name.to_string(),
3264            _delegate: Default::default(),
3265            _additional_params: Default::default(),
3266            _scopes: Default::default(),
3267        }
3268    }
3269    
3270    /// Create a builder to help you perform the following task:
3271    ///
3272    /// Lists all user links on an account or property.
3273    /// 
3274    /// # Arguments
3275    ///
3276    /// * `parent` - Required. Example format: accounts/1234
3277    pub fn user_links_list(&self, parent: &str) -> PropertyUserLinkListCall<'a, S> {
3278        PropertyUserLinkListCall {
3279            hub: self.hub,
3280            _parent: parent.to_string(),
3281            _page_token: Default::default(),
3282            _page_size: Default::default(),
3283            _delegate: Default::default(),
3284            _additional_params: Default::default(),
3285            _scopes: Default::default(),
3286        }
3287    }
3288    
3289    /// Create a builder to help you perform the following task:
3290    ///
3291    /// Updates a user link on an account or property.
3292    /// 
3293    /// # Arguments
3294    ///
3295    /// * `request` - No description provided.
3296    /// * `name` - Output only. Example format: properties/1234/userLinks/5678
3297    pub fn user_links_patch(&self, request: GoogleAnalyticsAdminV1alphaUserLink, name: &str) -> PropertyUserLinkPatchCall<'a, S> {
3298        PropertyUserLinkPatchCall {
3299            hub: self.hub,
3300            _request: request,
3301            _name: name.to_string(),
3302            _delegate: Default::default(),
3303            _additional_params: Default::default(),
3304            _scopes: Default::default(),
3305        }
3306    }
3307    
3308    /// Create a builder to help you perform the following task:
3309    ///
3310    /// Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or via this API) before MeasurementProtocolSecret resources may be created.
3311    /// 
3312    /// # Arguments
3313    ///
3314    /// * `request` - No description provided.
3315    /// * `property` - Required. The property for which to acknowledge user data collection.
3316    pub fn acknowledge_user_data_collection(&self, request: GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest, property: &str) -> PropertyAcknowledgeUserDataCollectionCall<'a, S> {
3317        PropertyAcknowledgeUserDataCollectionCall {
3318            hub: self.hub,
3319            _request: request,
3320            _property: property.to_string(),
3321            _delegate: Default::default(),
3322            _additional_params: Default::default(),
3323            _scopes: Default::default(),
3324        }
3325    }
3326    
3327    /// Create a builder to help you perform the following task:
3328    ///
3329    /// Creates an "GA4" property with the specified location and attributes.
3330    /// 
3331    /// # Arguments
3332    ///
3333    /// * `request` - No description provided.
3334    pub fn create(&self, request: GoogleAnalyticsAdminV1alphaProperty) -> PropertyCreateCall<'a, S> {
3335        PropertyCreateCall {
3336            hub: self.hub,
3337            _request: request,
3338            _delegate: Default::default(),
3339            _additional_params: Default::default(),
3340            _scopes: Default::default(),
3341        }
3342    }
3343    
3344    /// Create a builder to help you perform the following task:
3345    ///
3346    /// Marks target Property as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI. If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not an GA4 Property.
3347    /// 
3348    /// # Arguments
3349    ///
3350    /// * `name` - Required. The name of the Property to soft-delete. Format: properties/{property_id} Example: "properties/1000"
3351    pub fn delete(&self, name: &str) -> PropertyDeleteCall<'a, S> {
3352        PropertyDeleteCall {
3353            hub: self.hub,
3354            _name: name.to_string(),
3355            _delegate: Default::default(),
3356            _additional_params: Default::default(),
3357            _scopes: Default::default(),
3358        }
3359    }
3360    
3361    /// Create a builder to help you perform the following task:
3362    ///
3363    /// Lookup for a single "GA4" Property.
3364    /// 
3365    /// # Arguments
3366    ///
3367    /// * `name` - Required. The name of the property to lookup. Format: properties/{property_id} Example: "properties/1000"
3368    pub fn get(&self, name: &str) -> PropertyGetCall<'a, S> {
3369        PropertyGetCall {
3370            hub: self.hub,
3371            _name: name.to_string(),
3372            _delegate: Default::default(),
3373            _additional_params: Default::default(),
3374            _scopes: Default::default(),
3375        }
3376    }
3377    
3378    /// Create a builder to help you perform the following task:
3379    ///
3380    /// Returns the singleton data retention settings for this property.
3381    /// 
3382    /// # Arguments
3383    ///
3384    /// * `name` - Required. The name of the settings to lookup. Format: properties/{property}/dataRetentionSettings Example: "properties/1000/dataRetentionSettings"
3385    pub fn get_data_retention_settings(&self, name: &str) -> PropertyGetDataRetentionSettingCall<'a, S> {
3386        PropertyGetDataRetentionSettingCall {
3387            hub: self.hub,
3388            _name: name.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    /// Lookup for Google Signals settings for a property.
3398    /// 
3399    /// # Arguments
3400    ///
3401    /// * `name` - Required. The name of the google signals settings to retrieve. Format: properties/{property}/googleSignalsSettings
3402    pub fn get_google_signals_settings(&self, name: &str) -> PropertyGetGoogleSignalsSettingCall<'a, S> {
3403        PropertyGetGoogleSignalsSettingCall {
3404            hub: self.hub,
3405            _name: name.to_string(),
3406            _delegate: Default::default(),
3407            _additional_params: Default::default(),
3408            _scopes: Default::default(),
3409        }
3410    }
3411    
3412    /// Create a builder to help you perform the following task:
3413    ///
3414    /// Returns child Properties under the specified parent Account. Only "GA4" properties will be returned. Properties will be excluded if the caller does not have access. Soft-deleted (ie: "trashed") properties are excluded by default. Returns an empty list if no relevant properties are found.
3415    pub fn list(&self) -> PropertyListCall<'a, S> {
3416        PropertyListCall {
3417            hub: self.hub,
3418            _show_deleted: Default::default(),
3419            _page_token: Default::default(),
3420            _page_size: Default::default(),
3421            _filter: Default::default(),
3422            _delegate: Default::default(),
3423            _additional_params: Default::default(),
3424            _scopes: Default::default(),
3425        }
3426    }
3427    
3428    /// Create a builder to help you perform the following task:
3429    ///
3430    /// Updates a property.
3431    /// 
3432    /// # Arguments
3433    ///
3434    /// * `request` - No description provided.
3435    /// * `name` - Output only. Resource name of this property. Format: properties/{property_id} Example: "properties/1000"
3436    pub fn patch(&self, request: GoogleAnalyticsAdminV1alphaProperty, name: &str) -> PropertyPatchCall<'a, S> {
3437        PropertyPatchCall {
3438            hub: self.hub,
3439            _request: request,
3440            _name: name.to_string(),
3441            _update_mask: Default::default(),
3442            _delegate: Default::default(),
3443            _additional_params: Default::default(),
3444            _scopes: Default::default(),
3445        }
3446    }
3447    
3448    /// Create a builder to help you perform the following task:
3449    ///
3450    /// Updates the singleton data retention settings for this property.
3451    /// 
3452    /// # Arguments
3453    ///
3454    /// * `request` - No description provided.
3455    /// * `name` - Output only. Resource name for this DataRetentionSetting resource. Format: properties/{property}/dataRetentionSettings
3456    pub fn update_data_retention_settings(&self, request: GoogleAnalyticsAdminV1alphaDataRetentionSettings, name: &str) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
3457        PropertyUpdateDataRetentionSettingCall {
3458            hub: self.hub,
3459            _request: request,
3460            _name: name.to_string(),
3461            _update_mask: Default::default(),
3462            _delegate: Default::default(),
3463            _additional_params: Default::default(),
3464            _scopes: Default::default(),
3465        }
3466    }
3467    
3468    /// Create a builder to help you perform the following task:
3469    ///
3470    /// Updates Google Signals settings for a property.
3471    /// 
3472    /// # Arguments
3473    ///
3474    /// * `request` - No description provided.
3475    /// * `name` - Output only. Resource name of this setting. Format: properties/{property_id}/googleSignalsSettings Example: "properties/1000/googleSignalsSettings"
3476    pub fn update_google_signals_settings(&self, request: GoogleAnalyticsAdminV1alphaGoogleSignalsSettings, name: &str) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
3477        PropertyUpdateGoogleSignalsSettingCall {
3478            hub: self.hub,
3479            _request: request,
3480            _name: name.to_string(),
3481            _update_mask: Default::default(),
3482            _delegate: Default::default(),
3483            _additional_params: Default::default(),
3484            _scopes: Default::default(),
3485        }
3486    }
3487}
3488
3489
3490
3491
3492
3493// ###################
3494// CallBuilders   ###
3495// #################
3496
3497/// Returns summaries of all accounts accessible by the caller.
3498///
3499/// A builder for the *list* method supported by a *accountSummary* resource.
3500/// It is not used directly, but through a [`AccountSummaryMethods`] instance.
3501///
3502/// # Example
3503///
3504/// Instantiate a resource method builder
3505///
3506/// ```test_harness,no_run
3507/// # extern crate hyper;
3508/// # extern crate hyper_rustls;
3509/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
3510/// # async fn dox() {
3511/// # use std::default::Default;
3512/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3513/// 
3514/// # let secret: oauth2::ApplicationSecret = Default::default();
3515/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3516/// #         secret,
3517/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3518/// #     ).build().await.unwrap();
3519/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3520/// // You can configure optional parameters by calling the respective setters at will, and
3521/// // execute the final call using `doit()`.
3522/// // Values shown here are possibly random and not representative !
3523/// let result = hub.account_summaries().list()
3524///              .page_token("ipsum")
3525///              .page_size(-28)
3526///              .doit().await;
3527/// # }
3528/// ```
3529pub struct AccountSummaryListCall<'a, S>
3530    where S: 'a {
3531
3532    hub: &'a GoogleAnalyticsAdmin<S>,
3533    _page_token: Option<String>,
3534    _page_size: Option<i32>,
3535    _delegate: Option<&'a mut dyn client::Delegate>,
3536    _additional_params: HashMap<String, String>,
3537    _scopes: BTreeSet<String>
3538}
3539
3540impl<'a, S> client::CallBuilder for AccountSummaryListCall<'a, S> {}
3541
3542impl<'a, S> AccountSummaryListCall<'a, S>
3543where
3544    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3545    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3546    S::Future: Send + Unpin + 'static,
3547    S::Error: Into<Box<dyn StdError + Send + Sync>>,
3548{
3549
3550
3551    /// Perform the operation you have build so far.
3552    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListAccountSummariesResponse)> {
3553        use std::io::{Read, Seek};
3554        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3555        use client::{ToParts, url::Params};
3556        use std::borrow::Cow;
3557
3558        let mut dd = client::DefaultDelegate;
3559        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3560        dlg.begin(client::MethodInfo { id: "analyticsadmin.accountSummaries.list",
3561                               http_method: hyper::Method::GET });
3562
3563        for &field in ["alt", "pageToken", "pageSize"].iter() {
3564            if self._additional_params.contains_key(field) {
3565                dlg.finished(false);
3566                return Err(client::Error::FieldClash(field));
3567            }
3568        }
3569
3570        let mut params = Params::with_capacity(4 + self._additional_params.len());
3571        if let Some(value) = self._page_token.as_ref() {
3572            params.push("pageToken", value);
3573        }
3574        if let Some(value) = self._page_size.as_ref() {
3575            params.push("pageSize", value.to_string());
3576        }
3577
3578        params.extend(self._additional_params.iter());
3579
3580        params.push("alt", "json");
3581        let mut url = self.hub._base_url.clone() + "v1alpha/accountSummaries";
3582        if self._scopes.is_empty() {
3583            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
3584        }
3585
3586
3587        let url = params.parse_with_url(&url);
3588
3589
3590
3591        loop {
3592            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3593                Ok(token) => token,
3594                Err(e) => {
3595                    match dlg.token(e) {
3596                        Ok(token) => token,
3597                        Err(e) => {
3598                            dlg.finished(false);
3599                            return Err(client::Error::MissingToken(e));
3600                        }
3601                    }
3602                }
3603            };
3604            let mut req_result = {
3605                let client = &self.hub.client;
3606                dlg.pre_request();
3607                let mut req_builder = hyper::Request::builder()
3608                    .method(hyper::Method::GET)
3609                    .uri(url.as_str())
3610                    .header(USER_AGENT, self.hub._user_agent.clone());
3611
3612                if let Some(token) = token.as_ref() {
3613                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3614                }
3615
3616
3617                        let request = req_builder
3618                        .body(hyper::body::Body::empty());
3619
3620                client.request(request.unwrap()).await
3621
3622            };
3623
3624            match req_result {
3625                Err(err) => {
3626                    if let client::Retry::After(d) = dlg.http_error(&err) {
3627                        sleep(d).await;
3628                        continue;
3629                    }
3630                    dlg.finished(false);
3631                    return Err(client::Error::HttpError(err))
3632                }
3633                Ok(mut res) => {
3634                    if !res.status().is_success() {
3635                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
3636                        let (parts, _) = res.into_parts();
3637                        let body = hyper::Body::from(res_body_string.clone());
3638                        let restored_response = hyper::Response::from_parts(parts, body);
3639
3640                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3641
3642                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3643                            sleep(d).await;
3644                            continue;
3645                        }
3646
3647                        dlg.finished(false);
3648
3649                        return match server_response {
3650                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
3651                            None => Err(client::Error::Failure(restored_response)),
3652                        }
3653                    }
3654                    let result_value = {
3655                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
3656
3657                        match json::from_str(&res_body_string) {
3658                            Ok(decoded) => (res, decoded),
3659                            Err(err) => {
3660                                dlg.response_json_decode_error(&res_body_string, &err);
3661                                return Err(client::Error::JsonDecodeError(res_body_string, err));
3662                            }
3663                        }
3664                    };
3665
3666                    dlg.finished(true);
3667                    return Ok(result_value)
3668                }
3669            }
3670        }
3671    }
3672
3673
3674    /// A page token, received from a previous `ListAccountSummaries` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAccountSummaries` must match the call that provided the page token.
3675    ///
3676    /// Sets the *page token* query property to the given value.
3677    pub fn page_token(mut self, new_value: &str) -> AccountSummaryListCall<'a, S> {
3678        self._page_token = Some(new_value.to_string());
3679        self
3680    }
3681    /// The maximum number of AccountSummary resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
3682    ///
3683    /// Sets the *page size* query property to the given value.
3684    pub fn page_size(mut self, new_value: i32) -> AccountSummaryListCall<'a, S> {
3685        self._page_size = Some(new_value);
3686        self
3687    }
3688    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3689    /// while executing the actual API request.
3690    /// 
3691    /// ````text
3692    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3693    /// ````
3694    ///
3695    /// Sets the *delegate* property to the given value.
3696    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountSummaryListCall<'a, S> {
3697        self._delegate = Some(new_value);
3698        self
3699    }
3700
3701    /// Set any additional parameter of the query string used in the request.
3702    /// It should be used to set parameters which are not yet available through their own
3703    /// setters.
3704    ///
3705    /// Please note that this method must not be used to set any of the known parameters
3706    /// which have their own setter method. If done anyway, the request will fail.
3707    ///
3708    /// # Additional Parameters
3709    ///
3710    /// * *$.xgafv* (query-string) - V1 error format.
3711    /// * *access_token* (query-string) - OAuth access token.
3712    /// * *alt* (query-string) - Data format for response.
3713    /// * *callback* (query-string) - JSONP
3714    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3715    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3716    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3717    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3718    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3719    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3720    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3721    pub fn param<T>(mut self, name: T, value: T) -> AccountSummaryListCall<'a, S>
3722                                                        where T: AsRef<str> {
3723        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3724        self
3725    }
3726
3727    /// Identifies the authorization scope for the method you are building.
3728    ///
3729    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3730    /// [`Scope::AnalyticReadonly`].
3731    ///
3732    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3733    /// tokens for more than one scope.
3734    ///
3735    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3736    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3737    /// sufficient, a read-write scope will do as well.
3738    pub fn add_scope<St>(mut self, scope: St) -> AccountSummaryListCall<'a, S>
3739                                                        where St: AsRef<str> {
3740        self._scopes.insert(String::from(scope.as_ref()));
3741        self
3742    }
3743    /// Identifies the authorization scope(s) for the method you are building.
3744    ///
3745    /// See [`Self::add_scope()`] for details.
3746    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountSummaryListCall<'a, S>
3747                                                        where I: IntoIterator<Item = St>,
3748                                                         St: AsRef<str> {
3749        self._scopes
3750            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3751        self
3752    }
3753
3754    /// Removes all scopes, and no default scope will be used either.
3755    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3756    /// for details).
3757    pub fn clear_scopes(mut self) -> AccountSummaryListCall<'a, S> {
3758        self._scopes.clear();
3759        self
3760    }
3761}
3762
3763
3764/// Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.
3765///
3766/// A builder for the *userLinks.audit* method supported by a *account* resource.
3767/// It is not used directly, but through a [`AccountMethods`] instance.
3768///
3769/// # Example
3770///
3771/// Instantiate a resource method builder
3772///
3773/// ```test_harness,no_run
3774/// # extern crate hyper;
3775/// # extern crate hyper_rustls;
3776/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
3777/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaAuditUserLinksRequest;
3778/// # async fn dox() {
3779/// # use std::default::Default;
3780/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3781/// 
3782/// # let secret: oauth2::ApplicationSecret = Default::default();
3783/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3784/// #         secret,
3785/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3786/// #     ).build().await.unwrap();
3787/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3788/// // As the method needs a request, you would usually fill it with the desired information
3789/// // into the respective structure. Some of the parts shown here might not be applicable !
3790/// // Values shown here are possibly random and not representative !
3791/// let mut req = GoogleAnalyticsAdminV1alphaAuditUserLinksRequest::default();
3792/// 
3793/// // You can configure optional parameters by calling the respective setters at will, and
3794/// // execute the final call using `doit()`.
3795/// // Values shown here are possibly random and not representative !
3796/// let result = hub.accounts().user_links_audit(req, "parent")
3797///              .doit().await;
3798/// # }
3799/// ```
3800pub struct AccountUserLinkAuditCall<'a, S>
3801    where S: 'a {
3802
3803    hub: &'a GoogleAnalyticsAdmin<S>,
3804    _request: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest,
3805    _parent: String,
3806    _delegate: Option<&'a mut dyn client::Delegate>,
3807    _additional_params: HashMap<String, String>,
3808    _scopes: BTreeSet<String>
3809}
3810
3811impl<'a, S> client::CallBuilder for AccountUserLinkAuditCall<'a, S> {}
3812
3813impl<'a, S> AccountUserLinkAuditCall<'a, S>
3814where
3815    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3816    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3817    S::Future: Send + Unpin + 'static,
3818    S::Error: Into<Box<dyn StdError + Send + Sync>>,
3819{
3820
3821
3822    /// Perform the operation you have build so far.
3823    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaAuditUserLinksResponse)> {
3824        use std::io::{Read, Seek};
3825        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3826        use client::{ToParts, url::Params};
3827        use std::borrow::Cow;
3828
3829        let mut dd = client::DefaultDelegate;
3830        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3831        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.audit",
3832                               http_method: hyper::Method::POST });
3833
3834        for &field in ["alt", "parent"].iter() {
3835            if self._additional_params.contains_key(field) {
3836                dlg.finished(false);
3837                return Err(client::Error::FieldClash(field));
3838            }
3839        }
3840
3841        let mut params = Params::with_capacity(4 + self._additional_params.len());
3842        params.push("parent", self._parent);
3843
3844        params.extend(self._additional_params.iter());
3845
3846        params.push("alt", "json");
3847        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:audit";
3848        if self._scopes.is_empty() {
3849            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
3850        }
3851
3852        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3853            url = params.uri_replacement(url, param_name, find_this, true);
3854        }
3855        {
3856            let to_remove = ["parent"];
3857            params.remove_params(&to_remove);
3858        }
3859
3860        let url = params.parse_with_url(&url);
3861
3862        let mut json_mime_type = mime::APPLICATION_JSON;
3863        let mut request_value_reader =
3864            {
3865                let mut value = json::value::to_value(&self._request).expect("serde to work");
3866                client::remove_json_null_values(&mut value);
3867                let mut dst = io::Cursor::new(Vec::with_capacity(128));
3868                json::to_writer(&mut dst, &value).unwrap();
3869                dst
3870            };
3871        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
3872        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
3873
3874
3875        loop {
3876            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3877                Ok(token) => token,
3878                Err(e) => {
3879                    match dlg.token(e) {
3880                        Ok(token) => token,
3881                        Err(e) => {
3882                            dlg.finished(false);
3883                            return Err(client::Error::MissingToken(e));
3884                        }
3885                    }
3886                }
3887            };
3888            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
3889            let mut req_result = {
3890                let client = &self.hub.client;
3891                dlg.pre_request();
3892                let mut req_builder = hyper::Request::builder()
3893                    .method(hyper::Method::POST)
3894                    .uri(url.as_str())
3895                    .header(USER_AGENT, self.hub._user_agent.clone());
3896
3897                if let Some(token) = token.as_ref() {
3898                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3899                }
3900
3901
3902                        let request = req_builder
3903                        .header(CONTENT_TYPE, json_mime_type.to_string())
3904                        .header(CONTENT_LENGTH, request_size as u64)
3905                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
3906
3907                client.request(request.unwrap()).await
3908
3909            };
3910
3911            match req_result {
3912                Err(err) => {
3913                    if let client::Retry::After(d) = dlg.http_error(&err) {
3914                        sleep(d).await;
3915                        continue;
3916                    }
3917                    dlg.finished(false);
3918                    return Err(client::Error::HttpError(err))
3919                }
3920                Ok(mut res) => {
3921                    if !res.status().is_success() {
3922                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
3923                        let (parts, _) = res.into_parts();
3924                        let body = hyper::Body::from(res_body_string.clone());
3925                        let restored_response = hyper::Response::from_parts(parts, body);
3926
3927                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3928
3929                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3930                            sleep(d).await;
3931                            continue;
3932                        }
3933
3934                        dlg.finished(false);
3935
3936                        return match server_response {
3937                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
3938                            None => Err(client::Error::Failure(restored_response)),
3939                        }
3940                    }
3941                    let result_value = {
3942                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
3943
3944                        match json::from_str(&res_body_string) {
3945                            Ok(decoded) => (res, decoded),
3946                            Err(err) => {
3947                                dlg.response_json_decode_error(&res_body_string, &err);
3948                                return Err(client::Error::JsonDecodeError(res_body_string, err));
3949                            }
3950                        }
3951                    };
3952
3953                    dlg.finished(true);
3954                    return Ok(result_value)
3955                }
3956            }
3957        }
3958    }
3959
3960
3961    ///
3962    /// Sets the *request* property to the given value.
3963    ///
3964    /// Even though the property as already been set when instantiating this call,
3965    /// we provide this method for API completeness.
3966    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest) -> AccountUserLinkAuditCall<'a, S> {
3967        self._request = new_value;
3968        self
3969    }
3970    /// Required. Example format: accounts/1234
3971    ///
3972    /// Sets the *parent* path property to the given value.
3973    ///
3974    /// Even though the property as already been set when instantiating this call,
3975    /// we provide this method for API completeness.
3976    pub fn parent(mut self, new_value: &str) -> AccountUserLinkAuditCall<'a, S> {
3977        self._parent = new_value.to_string();
3978        self
3979    }
3980    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3981    /// while executing the actual API request.
3982    /// 
3983    /// ````text
3984    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3985    /// ````
3986    ///
3987    /// Sets the *delegate* property to the given value.
3988    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkAuditCall<'a, S> {
3989        self._delegate = Some(new_value);
3990        self
3991    }
3992
3993    /// Set any additional parameter of the query string used in the request.
3994    /// It should be used to set parameters which are not yet available through their own
3995    /// setters.
3996    ///
3997    /// Please note that this method must not be used to set any of the known parameters
3998    /// which have their own setter method. If done anyway, the request will fail.
3999    ///
4000    /// # Additional Parameters
4001    ///
4002    /// * *$.xgafv* (query-string) - V1 error format.
4003    /// * *access_token* (query-string) - OAuth access token.
4004    /// * *alt* (query-string) - Data format for response.
4005    /// * *callback* (query-string) - JSONP
4006    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4007    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4008    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4009    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4010    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4011    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4012    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4013    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkAuditCall<'a, S>
4014                                                        where T: AsRef<str> {
4015        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4016        self
4017    }
4018
4019    /// Identifies the authorization scope for the method you are building.
4020    ///
4021    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4022    /// [`Scope::AnalyticManageUser`].
4023    ///
4024    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4025    /// tokens for more than one scope.
4026    ///
4027    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4028    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4029    /// sufficient, a read-write scope will do as well.
4030    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkAuditCall<'a, S>
4031                                                        where St: AsRef<str> {
4032        self._scopes.insert(String::from(scope.as_ref()));
4033        self
4034    }
4035    /// Identifies the authorization scope(s) for the method you are building.
4036    ///
4037    /// See [`Self::add_scope()`] for details.
4038    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkAuditCall<'a, S>
4039                                                        where I: IntoIterator<Item = St>,
4040                                                         St: AsRef<str> {
4041        self._scopes
4042            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4043        self
4044    }
4045
4046    /// Removes all scopes, and no default scope will be used either.
4047    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4048    /// for details).
4049    pub fn clear_scopes(mut self) -> AccountUserLinkAuditCall<'a, S> {
4050        self._scopes.clear();
4051        self
4052    }
4053}
4054
4055
4056/// Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.
4057///
4058/// A builder for the *userLinks.batchCreate* method supported by a *account* resource.
4059/// It is not used directly, but through a [`AccountMethods`] instance.
4060///
4061/// # Example
4062///
4063/// Instantiate a resource method builder
4064///
4065/// ```test_harness,no_run
4066/// # extern crate hyper;
4067/// # extern crate hyper_rustls;
4068/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
4069/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest;
4070/// # async fn dox() {
4071/// # use std::default::Default;
4072/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4073/// 
4074/// # let secret: oauth2::ApplicationSecret = Default::default();
4075/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4076/// #         secret,
4077/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4078/// #     ).build().await.unwrap();
4079/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4080/// // As the method needs a request, you would usually fill it with the desired information
4081/// // into the respective structure. Some of the parts shown here might not be applicable !
4082/// // Values shown here are possibly random and not representative !
4083/// let mut req = GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest::default();
4084/// 
4085/// // You can configure optional parameters by calling the respective setters at will, and
4086/// // execute the final call using `doit()`.
4087/// // Values shown here are possibly random and not representative !
4088/// let result = hub.accounts().user_links_batch_create(req, "parent")
4089///              .doit().await;
4090/// # }
4091/// ```
4092pub struct AccountUserLinkBatchCreateCall<'a, S>
4093    where S: 'a {
4094
4095    hub: &'a GoogleAnalyticsAdmin<S>,
4096    _request: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest,
4097    _parent: String,
4098    _delegate: Option<&'a mut dyn client::Delegate>,
4099    _additional_params: HashMap<String, String>,
4100    _scopes: BTreeSet<String>
4101}
4102
4103impl<'a, S> client::CallBuilder for AccountUserLinkBatchCreateCall<'a, S> {}
4104
4105impl<'a, S> AccountUserLinkBatchCreateCall<'a, S>
4106where
4107    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4108    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4109    S::Future: Send + Unpin + 'static,
4110    S::Error: Into<Box<dyn StdError + Send + Sync>>,
4111{
4112
4113
4114    /// Perform the operation you have build so far.
4115    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse)> {
4116        use std::io::{Read, Seek};
4117        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4118        use client::{ToParts, url::Params};
4119        use std::borrow::Cow;
4120
4121        let mut dd = client::DefaultDelegate;
4122        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4123        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.batchCreate",
4124                               http_method: hyper::Method::POST });
4125
4126        for &field in ["alt", "parent"].iter() {
4127            if self._additional_params.contains_key(field) {
4128                dlg.finished(false);
4129                return Err(client::Error::FieldClash(field));
4130            }
4131        }
4132
4133        let mut params = Params::with_capacity(4 + self._additional_params.len());
4134        params.push("parent", self._parent);
4135
4136        params.extend(self._additional_params.iter());
4137
4138        params.push("alt", "json");
4139        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchCreate";
4140        if self._scopes.is_empty() {
4141            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
4142        }
4143
4144        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4145            url = params.uri_replacement(url, param_name, find_this, true);
4146        }
4147        {
4148            let to_remove = ["parent"];
4149            params.remove_params(&to_remove);
4150        }
4151
4152        let url = params.parse_with_url(&url);
4153
4154        let mut json_mime_type = mime::APPLICATION_JSON;
4155        let mut request_value_reader =
4156            {
4157                let mut value = json::value::to_value(&self._request).expect("serde to work");
4158                client::remove_json_null_values(&mut value);
4159                let mut dst = io::Cursor::new(Vec::with_capacity(128));
4160                json::to_writer(&mut dst, &value).unwrap();
4161                dst
4162            };
4163        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4164        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4165
4166
4167        loop {
4168            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4169                Ok(token) => token,
4170                Err(e) => {
4171                    match dlg.token(e) {
4172                        Ok(token) => token,
4173                        Err(e) => {
4174                            dlg.finished(false);
4175                            return Err(client::Error::MissingToken(e));
4176                        }
4177                    }
4178                }
4179            };
4180            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4181            let mut req_result = {
4182                let client = &self.hub.client;
4183                dlg.pre_request();
4184                let mut req_builder = hyper::Request::builder()
4185                    .method(hyper::Method::POST)
4186                    .uri(url.as_str())
4187                    .header(USER_AGENT, self.hub._user_agent.clone());
4188
4189                if let Some(token) = token.as_ref() {
4190                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4191                }
4192
4193
4194                        let request = req_builder
4195                        .header(CONTENT_TYPE, json_mime_type.to_string())
4196                        .header(CONTENT_LENGTH, request_size as u64)
4197                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4198
4199                client.request(request.unwrap()).await
4200
4201            };
4202
4203            match req_result {
4204                Err(err) => {
4205                    if let client::Retry::After(d) = dlg.http_error(&err) {
4206                        sleep(d).await;
4207                        continue;
4208                    }
4209                    dlg.finished(false);
4210                    return Err(client::Error::HttpError(err))
4211                }
4212                Ok(mut res) => {
4213                    if !res.status().is_success() {
4214                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4215                        let (parts, _) = res.into_parts();
4216                        let body = hyper::Body::from(res_body_string.clone());
4217                        let restored_response = hyper::Response::from_parts(parts, body);
4218
4219                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4220
4221                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4222                            sleep(d).await;
4223                            continue;
4224                        }
4225
4226                        dlg.finished(false);
4227
4228                        return match server_response {
4229                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
4230                            None => Err(client::Error::Failure(restored_response)),
4231                        }
4232                    }
4233                    let result_value = {
4234                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4235
4236                        match json::from_str(&res_body_string) {
4237                            Ok(decoded) => (res, decoded),
4238                            Err(err) => {
4239                                dlg.response_json_decode_error(&res_body_string, &err);
4240                                return Err(client::Error::JsonDecodeError(res_body_string, err));
4241                            }
4242                        }
4243                    };
4244
4245                    dlg.finished(true);
4246                    return Ok(result_value)
4247                }
4248            }
4249        }
4250    }
4251
4252
4253    ///
4254    /// Sets the *request* property to the given value.
4255    ///
4256    /// Even though the property as already been set when instantiating this call,
4257    /// we provide this method for API completeness.
4258    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest) -> AccountUserLinkBatchCreateCall<'a, S> {
4259        self._request = new_value;
4260        self
4261    }
4262    /// Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
4263    ///
4264    /// Sets the *parent* path property to the given value.
4265    ///
4266    /// Even though the property as already been set when instantiating this call,
4267    /// we provide this method for API completeness.
4268    pub fn parent(mut self, new_value: &str) -> AccountUserLinkBatchCreateCall<'a, S> {
4269        self._parent = new_value.to_string();
4270        self
4271    }
4272    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4273    /// while executing the actual API request.
4274    /// 
4275    /// ````text
4276    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4277    /// ````
4278    ///
4279    /// Sets the *delegate* property to the given value.
4280    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkBatchCreateCall<'a, S> {
4281        self._delegate = Some(new_value);
4282        self
4283    }
4284
4285    /// Set any additional parameter of the query string used in the request.
4286    /// It should be used to set parameters which are not yet available through their own
4287    /// setters.
4288    ///
4289    /// Please note that this method must not be used to set any of the known parameters
4290    /// which have their own setter method. If done anyway, the request will fail.
4291    ///
4292    /// # Additional Parameters
4293    ///
4294    /// * *$.xgafv* (query-string) - V1 error format.
4295    /// * *access_token* (query-string) - OAuth access token.
4296    /// * *alt* (query-string) - Data format for response.
4297    /// * *callback* (query-string) - JSONP
4298    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4299    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4300    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4301    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4302    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4303    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4304    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4305    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkBatchCreateCall<'a, S>
4306                                                        where T: AsRef<str> {
4307        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4308        self
4309    }
4310
4311    /// Identifies the authorization scope for the method you are building.
4312    ///
4313    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4314    /// [`Scope::AnalyticManageUser`].
4315    ///
4316    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4317    /// tokens for more than one scope.
4318    ///
4319    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4320    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4321    /// sufficient, a read-write scope will do as well.
4322    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkBatchCreateCall<'a, S>
4323                                                        where St: AsRef<str> {
4324        self._scopes.insert(String::from(scope.as_ref()));
4325        self
4326    }
4327    /// Identifies the authorization scope(s) for the method you are building.
4328    ///
4329    /// See [`Self::add_scope()`] for details.
4330    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkBatchCreateCall<'a, S>
4331                                                        where I: IntoIterator<Item = St>,
4332                                                         St: AsRef<str> {
4333        self._scopes
4334            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4335        self
4336    }
4337
4338    /// Removes all scopes, and no default scope will be used either.
4339    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4340    /// for details).
4341    pub fn clear_scopes(mut self) -> AccountUserLinkBatchCreateCall<'a, S> {
4342        self._scopes.clear();
4343        self
4344    }
4345}
4346
4347
4348/// Deletes information about multiple users' links to an account or property.
4349///
4350/// A builder for the *userLinks.batchDelete* method supported by a *account* resource.
4351/// It is not used directly, but through a [`AccountMethods`] instance.
4352///
4353/// # Example
4354///
4355/// Instantiate a resource method builder
4356///
4357/// ```test_harness,no_run
4358/// # extern crate hyper;
4359/// # extern crate hyper_rustls;
4360/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
4361/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest;
4362/// # async fn dox() {
4363/// # use std::default::Default;
4364/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4365/// 
4366/// # let secret: oauth2::ApplicationSecret = Default::default();
4367/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4368/// #         secret,
4369/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4370/// #     ).build().await.unwrap();
4371/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4372/// // As the method needs a request, you would usually fill it with the desired information
4373/// // into the respective structure. Some of the parts shown here might not be applicable !
4374/// // Values shown here are possibly random and not representative !
4375/// let mut req = GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest::default();
4376/// 
4377/// // You can configure optional parameters by calling the respective setters at will, and
4378/// // execute the final call using `doit()`.
4379/// // Values shown here are possibly random and not representative !
4380/// let result = hub.accounts().user_links_batch_delete(req, "parent")
4381///              .doit().await;
4382/// # }
4383/// ```
4384pub struct AccountUserLinkBatchDeleteCall<'a, S>
4385    where S: 'a {
4386
4387    hub: &'a GoogleAnalyticsAdmin<S>,
4388    _request: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest,
4389    _parent: String,
4390    _delegate: Option<&'a mut dyn client::Delegate>,
4391    _additional_params: HashMap<String, String>,
4392    _scopes: BTreeSet<String>
4393}
4394
4395impl<'a, S> client::CallBuilder for AccountUserLinkBatchDeleteCall<'a, S> {}
4396
4397impl<'a, S> AccountUserLinkBatchDeleteCall<'a, S>
4398where
4399    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4400    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4401    S::Future: Send + Unpin + 'static,
4402    S::Error: Into<Box<dyn StdError + Send + Sync>>,
4403{
4404
4405
4406    /// Perform the operation you have build so far.
4407    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
4408        use std::io::{Read, Seek};
4409        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4410        use client::{ToParts, url::Params};
4411        use std::borrow::Cow;
4412
4413        let mut dd = client::DefaultDelegate;
4414        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4415        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.batchDelete",
4416                               http_method: hyper::Method::POST });
4417
4418        for &field in ["alt", "parent"].iter() {
4419            if self._additional_params.contains_key(field) {
4420                dlg.finished(false);
4421                return Err(client::Error::FieldClash(field));
4422            }
4423        }
4424
4425        let mut params = Params::with_capacity(4 + self._additional_params.len());
4426        params.push("parent", self._parent);
4427
4428        params.extend(self._additional_params.iter());
4429
4430        params.push("alt", "json");
4431        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchDelete";
4432        if self._scopes.is_empty() {
4433            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
4434        }
4435
4436        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4437            url = params.uri_replacement(url, param_name, find_this, true);
4438        }
4439        {
4440            let to_remove = ["parent"];
4441            params.remove_params(&to_remove);
4442        }
4443
4444        let url = params.parse_with_url(&url);
4445
4446        let mut json_mime_type = mime::APPLICATION_JSON;
4447        let mut request_value_reader =
4448            {
4449                let mut value = json::value::to_value(&self._request).expect("serde to work");
4450                client::remove_json_null_values(&mut value);
4451                let mut dst = io::Cursor::new(Vec::with_capacity(128));
4452                json::to_writer(&mut dst, &value).unwrap();
4453                dst
4454            };
4455        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4456        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4457
4458
4459        loop {
4460            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4461                Ok(token) => token,
4462                Err(e) => {
4463                    match dlg.token(e) {
4464                        Ok(token) => token,
4465                        Err(e) => {
4466                            dlg.finished(false);
4467                            return Err(client::Error::MissingToken(e));
4468                        }
4469                    }
4470                }
4471            };
4472            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4473            let mut req_result = {
4474                let client = &self.hub.client;
4475                dlg.pre_request();
4476                let mut req_builder = hyper::Request::builder()
4477                    .method(hyper::Method::POST)
4478                    .uri(url.as_str())
4479                    .header(USER_AGENT, self.hub._user_agent.clone());
4480
4481                if let Some(token) = token.as_ref() {
4482                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4483                }
4484
4485
4486                        let request = req_builder
4487                        .header(CONTENT_TYPE, json_mime_type.to_string())
4488                        .header(CONTENT_LENGTH, request_size as u64)
4489                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4490
4491                client.request(request.unwrap()).await
4492
4493            };
4494
4495            match req_result {
4496                Err(err) => {
4497                    if let client::Retry::After(d) = dlg.http_error(&err) {
4498                        sleep(d).await;
4499                        continue;
4500                    }
4501                    dlg.finished(false);
4502                    return Err(client::Error::HttpError(err))
4503                }
4504                Ok(mut res) => {
4505                    if !res.status().is_success() {
4506                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4507                        let (parts, _) = res.into_parts();
4508                        let body = hyper::Body::from(res_body_string.clone());
4509                        let restored_response = hyper::Response::from_parts(parts, body);
4510
4511                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4512
4513                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4514                            sleep(d).await;
4515                            continue;
4516                        }
4517
4518                        dlg.finished(false);
4519
4520                        return match server_response {
4521                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
4522                            None => Err(client::Error::Failure(restored_response)),
4523                        }
4524                    }
4525                    let result_value = {
4526                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4527
4528                        match json::from_str(&res_body_string) {
4529                            Ok(decoded) => (res, decoded),
4530                            Err(err) => {
4531                                dlg.response_json_decode_error(&res_body_string, &err);
4532                                return Err(client::Error::JsonDecodeError(res_body_string, err));
4533                            }
4534                        }
4535                    };
4536
4537                    dlg.finished(true);
4538                    return Ok(result_value)
4539                }
4540            }
4541        }
4542    }
4543
4544
4545    ///
4546    /// Sets the *request* property to the given value.
4547    ///
4548    /// Even though the property as already been set when instantiating this call,
4549    /// we provide this method for API completeness.
4550    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest) -> AccountUserLinkBatchDeleteCall<'a, S> {
4551        self._request = new_value;
4552        self
4553    }
4554    /// Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234
4555    ///
4556    /// Sets the *parent* path property to the given value.
4557    ///
4558    /// Even though the property as already been set when instantiating this call,
4559    /// we provide this method for API completeness.
4560    pub fn parent(mut self, new_value: &str) -> AccountUserLinkBatchDeleteCall<'a, S> {
4561        self._parent = new_value.to_string();
4562        self
4563    }
4564    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4565    /// while executing the actual API request.
4566    /// 
4567    /// ````text
4568    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4569    /// ````
4570    ///
4571    /// Sets the *delegate* property to the given value.
4572    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkBatchDeleteCall<'a, S> {
4573        self._delegate = Some(new_value);
4574        self
4575    }
4576
4577    /// Set any additional parameter of the query string used in the request.
4578    /// It should be used to set parameters which are not yet available through their own
4579    /// setters.
4580    ///
4581    /// Please note that this method must not be used to set any of the known parameters
4582    /// which have their own setter method. If done anyway, the request will fail.
4583    ///
4584    /// # Additional Parameters
4585    ///
4586    /// * *$.xgafv* (query-string) - V1 error format.
4587    /// * *access_token* (query-string) - OAuth access token.
4588    /// * *alt* (query-string) - Data format for response.
4589    /// * *callback* (query-string) - JSONP
4590    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4591    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4592    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4593    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4594    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4595    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4596    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4597    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkBatchDeleteCall<'a, S>
4598                                                        where T: AsRef<str> {
4599        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4600        self
4601    }
4602
4603    /// Identifies the authorization scope for the method you are building.
4604    ///
4605    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4606    /// [`Scope::AnalyticManageUser`].
4607    ///
4608    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4609    /// tokens for more than one scope.
4610    ///
4611    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4612    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4613    /// sufficient, a read-write scope will do as well.
4614    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkBatchDeleteCall<'a, S>
4615                                                        where St: AsRef<str> {
4616        self._scopes.insert(String::from(scope.as_ref()));
4617        self
4618    }
4619    /// Identifies the authorization scope(s) for the method you are building.
4620    ///
4621    /// See [`Self::add_scope()`] for details.
4622    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkBatchDeleteCall<'a, S>
4623                                                        where I: IntoIterator<Item = St>,
4624                                                         St: AsRef<str> {
4625        self._scopes
4626            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4627        self
4628    }
4629
4630    /// Removes all scopes, and no default scope will be used either.
4631    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4632    /// for details).
4633    pub fn clear_scopes(mut self) -> AccountUserLinkBatchDeleteCall<'a, S> {
4634        self._scopes.clear();
4635        self
4636    }
4637}
4638
4639
4640/// Gets information about multiple users' links to an account or property.
4641///
4642/// A builder for the *userLinks.batchGet* method supported by a *account* resource.
4643/// It is not used directly, but through a [`AccountMethods`] instance.
4644///
4645/// # Example
4646///
4647/// Instantiate a resource method builder
4648///
4649/// ```test_harness,no_run
4650/// # extern crate hyper;
4651/// # extern crate hyper_rustls;
4652/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
4653/// # async fn dox() {
4654/// # use std::default::Default;
4655/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4656/// 
4657/// # let secret: oauth2::ApplicationSecret = Default::default();
4658/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4659/// #         secret,
4660/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4661/// #     ).build().await.unwrap();
4662/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4663/// // You can configure optional parameters by calling the respective setters at will, and
4664/// // execute the final call using `doit()`.
4665/// // Values shown here are possibly random and not representative !
4666/// let result = hub.accounts().user_links_batch_get("parent")
4667///              .add_names("takimata")
4668///              .doit().await;
4669/// # }
4670/// ```
4671pub struct AccountUserLinkBatchGetCall<'a, S>
4672    where S: 'a {
4673
4674    hub: &'a GoogleAnalyticsAdmin<S>,
4675    _parent: String,
4676    _names: Vec<String>,
4677    _delegate: Option<&'a mut dyn client::Delegate>,
4678    _additional_params: HashMap<String, String>,
4679    _scopes: BTreeSet<String>
4680}
4681
4682impl<'a, S> client::CallBuilder for AccountUserLinkBatchGetCall<'a, S> {}
4683
4684impl<'a, S> AccountUserLinkBatchGetCall<'a, S>
4685where
4686    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4687    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4688    S::Future: Send + Unpin + 'static,
4689    S::Error: Into<Box<dyn StdError + Send + Sync>>,
4690{
4691
4692
4693    /// Perform the operation you have build so far.
4694    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse)> {
4695        use std::io::{Read, Seek};
4696        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4697        use client::{ToParts, url::Params};
4698        use std::borrow::Cow;
4699
4700        let mut dd = client::DefaultDelegate;
4701        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4702        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.batchGet",
4703                               http_method: hyper::Method::GET });
4704
4705        for &field in ["alt", "parent", "names"].iter() {
4706            if self._additional_params.contains_key(field) {
4707                dlg.finished(false);
4708                return Err(client::Error::FieldClash(field));
4709            }
4710        }
4711
4712        let mut params = Params::with_capacity(4 + self._additional_params.len());
4713        params.push("parent", self._parent);
4714        if self._names.len() > 0 {
4715            for f in self._names.iter() {
4716                params.push("names", f);
4717            }
4718        }
4719
4720        params.extend(self._additional_params.iter());
4721
4722        params.push("alt", "json");
4723        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchGet";
4724        if self._scopes.is_empty() {
4725            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
4726        }
4727
4728        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4729            url = params.uri_replacement(url, param_name, find_this, true);
4730        }
4731        {
4732            let to_remove = ["parent"];
4733            params.remove_params(&to_remove);
4734        }
4735
4736        let url = params.parse_with_url(&url);
4737
4738
4739
4740        loop {
4741            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4742                Ok(token) => token,
4743                Err(e) => {
4744                    match dlg.token(e) {
4745                        Ok(token) => token,
4746                        Err(e) => {
4747                            dlg.finished(false);
4748                            return Err(client::Error::MissingToken(e));
4749                        }
4750                    }
4751                }
4752            };
4753            let mut req_result = {
4754                let client = &self.hub.client;
4755                dlg.pre_request();
4756                let mut req_builder = hyper::Request::builder()
4757                    .method(hyper::Method::GET)
4758                    .uri(url.as_str())
4759                    .header(USER_AGENT, self.hub._user_agent.clone());
4760
4761                if let Some(token) = token.as_ref() {
4762                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4763                }
4764
4765
4766                        let request = req_builder
4767                        .body(hyper::body::Body::empty());
4768
4769                client.request(request.unwrap()).await
4770
4771            };
4772
4773            match req_result {
4774                Err(err) => {
4775                    if let client::Retry::After(d) = dlg.http_error(&err) {
4776                        sleep(d).await;
4777                        continue;
4778                    }
4779                    dlg.finished(false);
4780                    return Err(client::Error::HttpError(err))
4781                }
4782                Ok(mut res) => {
4783                    if !res.status().is_success() {
4784                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4785                        let (parts, _) = res.into_parts();
4786                        let body = hyper::Body::from(res_body_string.clone());
4787                        let restored_response = hyper::Response::from_parts(parts, body);
4788
4789                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4790
4791                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4792                            sleep(d).await;
4793                            continue;
4794                        }
4795
4796                        dlg.finished(false);
4797
4798                        return match server_response {
4799                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
4800                            None => Err(client::Error::Failure(restored_response)),
4801                        }
4802                    }
4803                    let result_value = {
4804                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
4805
4806                        match json::from_str(&res_body_string) {
4807                            Ok(decoded) => (res, decoded),
4808                            Err(err) => {
4809                                dlg.response_json_decode_error(&res_body_string, &err);
4810                                return Err(client::Error::JsonDecodeError(res_body_string, err));
4811                            }
4812                        }
4813                    };
4814
4815                    dlg.finished(true);
4816                    return Ok(result_value)
4817                }
4818            }
4819        }
4820    }
4821
4822
4823    /// Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234
4824    ///
4825    /// Sets the *parent* path property to the given value.
4826    ///
4827    /// Even though the property as already been set when instantiating this call,
4828    /// we provide this method for API completeness.
4829    pub fn parent(mut self, new_value: &str) -> AccountUserLinkBatchGetCall<'a, S> {
4830        self._parent = new_value.to_string();
4831        self
4832    }
4833    /// Required. The names of the user links to retrieve. A maximum of 1000 user links can be retrieved in a batch. Format: accounts/{accountId}/userLinks/{userLinkId}
4834    ///
4835    /// Append the given value to the *names* query property.
4836    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4837    pub fn add_names(mut self, new_value: &str) -> AccountUserLinkBatchGetCall<'a, S> {
4838        self._names.push(new_value.to_string());
4839        self
4840    }
4841    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4842    /// while executing the actual API request.
4843    /// 
4844    /// ````text
4845    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4846    /// ````
4847    ///
4848    /// Sets the *delegate* property to the given value.
4849    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkBatchGetCall<'a, S> {
4850        self._delegate = Some(new_value);
4851        self
4852    }
4853
4854    /// Set any additional parameter of the query string used in the request.
4855    /// It should be used to set parameters which are not yet available through their own
4856    /// setters.
4857    ///
4858    /// Please note that this method must not be used to set any of the known parameters
4859    /// which have their own setter method. If done anyway, the request will fail.
4860    ///
4861    /// # Additional Parameters
4862    ///
4863    /// * *$.xgafv* (query-string) - V1 error format.
4864    /// * *access_token* (query-string) - OAuth access token.
4865    /// * *alt* (query-string) - Data format for response.
4866    /// * *callback* (query-string) - JSONP
4867    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4868    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4869    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4870    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4871    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4872    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4873    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4874    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkBatchGetCall<'a, S>
4875                                                        where T: AsRef<str> {
4876        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4877        self
4878    }
4879
4880    /// Identifies the authorization scope for the method you are building.
4881    ///
4882    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4883    /// [`Scope::AnalyticManageUserReadonly`].
4884    ///
4885    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4886    /// tokens for more than one scope.
4887    ///
4888    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4889    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4890    /// sufficient, a read-write scope will do as well.
4891    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkBatchGetCall<'a, S>
4892                                                        where St: AsRef<str> {
4893        self._scopes.insert(String::from(scope.as_ref()));
4894        self
4895    }
4896    /// Identifies the authorization scope(s) for the method you are building.
4897    ///
4898    /// See [`Self::add_scope()`] for details.
4899    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkBatchGetCall<'a, S>
4900                                                        where I: IntoIterator<Item = St>,
4901                                                         St: AsRef<str> {
4902        self._scopes
4903            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4904        self
4905    }
4906
4907    /// Removes all scopes, and no default scope will be used either.
4908    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4909    /// for details).
4910    pub fn clear_scopes(mut self) -> AccountUserLinkBatchGetCall<'a, S> {
4911        self._scopes.clear();
4912        self
4913    }
4914}
4915
4916
4917/// Updates information about multiple users' links to an account or property.
4918///
4919/// A builder for the *userLinks.batchUpdate* method supported by a *account* resource.
4920/// It is not used directly, but through a [`AccountMethods`] instance.
4921///
4922/// # Example
4923///
4924/// Instantiate a resource method builder
4925///
4926/// ```test_harness,no_run
4927/// # extern crate hyper;
4928/// # extern crate hyper_rustls;
4929/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
4930/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest;
4931/// # async fn dox() {
4932/// # use std::default::Default;
4933/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4934/// 
4935/// # let secret: oauth2::ApplicationSecret = Default::default();
4936/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4937/// #         secret,
4938/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4939/// #     ).build().await.unwrap();
4940/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4941/// // As the method needs a request, you would usually fill it with the desired information
4942/// // into the respective structure. Some of the parts shown here might not be applicable !
4943/// // Values shown here are possibly random and not representative !
4944/// let mut req = GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest::default();
4945/// 
4946/// // You can configure optional parameters by calling the respective setters at will, and
4947/// // execute the final call using `doit()`.
4948/// // Values shown here are possibly random and not representative !
4949/// let result = hub.accounts().user_links_batch_update(req, "parent")
4950///              .doit().await;
4951/// # }
4952/// ```
4953pub struct AccountUserLinkBatchUpdateCall<'a, S>
4954    where S: 'a {
4955
4956    hub: &'a GoogleAnalyticsAdmin<S>,
4957    _request: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest,
4958    _parent: String,
4959    _delegate: Option<&'a mut dyn client::Delegate>,
4960    _additional_params: HashMap<String, String>,
4961    _scopes: BTreeSet<String>
4962}
4963
4964impl<'a, S> client::CallBuilder for AccountUserLinkBatchUpdateCall<'a, S> {}
4965
4966impl<'a, S> AccountUserLinkBatchUpdateCall<'a, S>
4967where
4968    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4969    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4970    S::Future: Send + Unpin + 'static,
4971    S::Error: Into<Box<dyn StdError + Send + Sync>>,
4972{
4973
4974
4975    /// Perform the operation you have build so far.
4976    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse)> {
4977        use std::io::{Read, Seek};
4978        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4979        use client::{ToParts, url::Params};
4980        use std::borrow::Cow;
4981
4982        let mut dd = client::DefaultDelegate;
4983        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4984        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.batchUpdate",
4985                               http_method: hyper::Method::POST });
4986
4987        for &field in ["alt", "parent"].iter() {
4988            if self._additional_params.contains_key(field) {
4989                dlg.finished(false);
4990                return Err(client::Error::FieldClash(field));
4991            }
4992        }
4993
4994        let mut params = Params::with_capacity(4 + self._additional_params.len());
4995        params.push("parent", self._parent);
4996
4997        params.extend(self._additional_params.iter());
4998
4999        params.push("alt", "json");
5000        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchUpdate";
5001        if self._scopes.is_empty() {
5002            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
5003        }
5004
5005        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5006            url = params.uri_replacement(url, param_name, find_this, true);
5007        }
5008        {
5009            let to_remove = ["parent"];
5010            params.remove_params(&to_remove);
5011        }
5012
5013        let url = params.parse_with_url(&url);
5014
5015        let mut json_mime_type = mime::APPLICATION_JSON;
5016        let mut request_value_reader =
5017            {
5018                let mut value = json::value::to_value(&self._request).expect("serde to work");
5019                client::remove_json_null_values(&mut value);
5020                let mut dst = io::Cursor::new(Vec::with_capacity(128));
5021                json::to_writer(&mut dst, &value).unwrap();
5022                dst
5023            };
5024        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
5025        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5026
5027
5028        loop {
5029            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5030                Ok(token) => token,
5031                Err(e) => {
5032                    match dlg.token(e) {
5033                        Ok(token) => token,
5034                        Err(e) => {
5035                            dlg.finished(false);
5036                            return Err(client::Error::MissingToken(e));
5037                        }
5038                    }
5039                }
5040            };
5041            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5042            let mut req_result = {
5043                let client = &self.hub.client;
5044                dlg.pre_request();
5045                let mut req_builder = hyper::Request::builder()
5046                    .method(hyper::Method::POST)
5047                    .uri(url.as_str())
5048                    .header(USER_AGENT, self.hub._user_agent.clone());
5049
5050                if let Some(token) = token.as_ref() {
5051                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5052                }
5053
5054
5055                        let request = req_builder
5056                        .header(CONTENT_TYPE, json_mime_type.to_string())
5057                        .header(CONTENT_LENGTH, request_size as u64)
5058                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
5059
5060                client.request(request.unwrap()).await
5061
5062            };
5063
5064            match req_result {
5065                Err(err) => {
5066                    if let client::Retry::After(d) = dlg.http_error(&err) {
5067                        sleep(d).await;
5068                        continue;
5069                    }
5070                    dlg.finished(false);
5071                    return Err(client::Error::HttpError(err))
5072                }
5073                Ok(mut res) => {
5074                    if !res.status().is_success() {
5075                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5076                        let (parts, _) = res.into_parts();
5077                        let body = hyper::Body::from(res_body_string.clone());
5078                        let restored_response = hyper::Response::from_parts(parts, body);
5079
5080                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5081
5082                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5083                            sleep(d).await;
5084                            continue;
5085                        }
5086
5087                        dlg.finished(false);
5088
5089                        return match server_response {
5090                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
5091                            None => Err(client::Error::Failure(restored_response)),
5092                        }
5093                    }
5094                    let result_value = {
5095                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5096
5097                        match json::from_str(&res_body_string) {
5098                            Ok(decoded) => (res, decoded),
5099                            Err(err) => {
5100                                dlg.response_json_decode_error(&res_body_string, &err);
5101                                return Err(client::Error::JsonDecodeError(res_body_string, err));
5102                            }
5103                        }
5104                    };
5105
5106                    dlg.finished(true);
5107                    return Ok(result_value)
5108                }
5109            }
5110        }
5111    }
5112
5113
5114    ///
5115    /// Sets the *request* property to the given value.
5116    ///
5117    /// Even though the property as already been set when instantiating this call,
5118    /// we provide this method for API completeness.
5119    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest) -> AccountUserLinkBatchUpdateCall<'a, S> {
5120        self._request = new_value;
5121        self
5122    }
5123    /// Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
5124    ///
5125    /// Sets the *parent* path property to the given value.
5126    ///
5127    /// Even though the property as already been set when instantiating this call,
5128    /// we provide this method for API completeness.
5129    pub fn parent(mut self, new_value: &str) -> AccountUserLinkBatchUpdateCall<'a, S> {
5130        self._parent = new_value.to_string();
5131        self
5132    }
5133    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5134    /// while executing the actual API request.
5135    /// 
5136    /// ````text
5137    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5138    /// ````
5139    ///
5140    /// Sets the *delegate* property to the given value.
5141    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkBatchUpdateCall<'a, S> {
5142        self._delegate = Some(new_value);
5143        self
5144    }
5145
5146    /// Set any additional parameter of the query string used in the request.
5147    /// It should be used to set parameters which are not yet available through their own
5148    /// setters.
5149    ///
5150    /// Please note that this method must not be used to set any of the known parameters
5151    /// which have their own setter method. If done anyway, the request will fail.
5152    ///
5153    /// # Additional Parameters
5154    ///
5155    /// * *$.xgafv* (query-string) - V1 error format.
5156    /// * *access_token* (query-string) - OAuth access token.
5157    /// * *alt* (query-string) - Data format for response.
5158    /// * *callback* (query-string) - JSONP
5159    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5160    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5161    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5162    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5163    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5164    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5165    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5166    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkBatchUpdateCall<'a, S>
5167                                                        where T: AsRef<str> {
5168        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5169        self
5170    }
5171
5172    /// Identifies the authorization scope for the method you are building.
5173    ///
5174    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5175    /// [`Scope::AnalyticManageUser`].
5176    ///
5177    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5178    /// tokens for more than one scope.
5179    ///
5180    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5181    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5182    /// sufficient, a read-write scope will do as well.
5183    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkBatchUpdateCall<'a, S>
5184                                                        where St: AsRef<str> {
5185        self._scopes.insert(String::from(scope.as_ref()));
5186        self
5187    }
5188    /// Identifies the authorization scope(s) for the method you are building.
5189    ///
5190    /// See [`Self::add_scope()`] for details.
5191    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkBatchUpdateCall<'a, S>
5192                                                        where I: IntoIterator<Item = St>,
5193                                                         St: AsRef<str> {
5194        self._scopes
5195            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5196        self
5197    }
5198
5199    /// Removes all scopes, and no default scope will be used either.
5200    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5201    /// for details).
5202    pub fn clear_scopes(mut self) -> AccountUserLinkBatchUpdateCall<'a, S> {
5203        self._scopes.clear();
5204        self
5205    }
5206}
5207
5208
5209/// Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.
5210///
5211/// A builder for the *userLinks.create* method supported by a *account* resource.
5212/// It is not used directly, but through a [`AccountMethods`] instance.
5213///
5214/// # Example
5215///
5216/// Instantiate a resource method builder
5217///
5218/// ```test_harness,no_run
5219/// # extern crate hyper;
5220/// # extern crate hyper_rustls;
5221/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
5222/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaUserLink;
5223/// # async fn dox() {
5224/// # use std::default::Default;
5225/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5226/// 
5227/// # let secret: oauth2::ApplicationSecret = Default::default();
5228/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5229/// #         secret,
5230/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5231/// #     ).build().await.unwrap();
5232/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5233/// // As the method needs a request, you would usually fill it with the desired information
5234/// // into the respective structure. Some of the parts shown here might not be applicable !
5235/// // Values shown here are possibly random and not representative !
5236/// let mut req = GoogleAnalyticsAdminV1alphaUserLink::default();
5237/// 
5238/// // You can configure optional parameters by calling the respective setters at will, and
5239/// // execute the final call using `doit()`.
5240/// // Values shown here are possibly random and not representative !
5241/// let result = hub.accounts().user_links_create(req, "parent")
5242///              .notify_new_user(true)
5243///              .doit().await;
5244/// # }
5245/// ```
5246pub struct AccountUserLinkCreateCall<'a, S>
5247    where S: 'a {
5248
5249    hub: &'a GoogleAnalyticsAdmin<S>,
5250    _request: GoogleAnalyticsAdminV1alphaUserLink,
5251    _parent: String,
5252    _notify_new_user: Option<bool>,
5253    _delegate: Option<&'a mut dyn client::Delegate>,
5254    _additional_params: HashMap<String, String>,
5255    _scopes: BTreeSet<String>
5256}
5257
5258impl<'a, S> client::CallBuilder for AccountUserLinkCreateCall<'a, S> {}
5259
5260impl<'a, S> AccountUserLinkCreateCall<'a, S>
5261where
5262    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5263    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5264    S::Future: Send + Unpin + 'static,
5265    S::Error: Into<Box<dyn StdError + Send + Sync>>,
5266{
5267
5268
5269    /// Perform the operation you have build so far.
5270    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
5271        use std::io::{Read, Seek};
5272        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5273        use client::{ToParts, url::Params};
5274        use std::borrow::Cow;
5275
5276        let mut dd = client::DefaultDelegate;
5277        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5278        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.create",
5279                               http_method: hyper::Method::POST });
5280
5281        for &field in ["alt", "parent", "notifyNewUser"].iter() {
5282            if self._additional_params.contains_key(field) {
5283                dlg.finished(false);
5284                return Err(client::Error::FieldClash(field));
5285            }
5286        }
5287
5288        let mut params = Params::with_capacity(5 + self._additional_params.len());
5289        params.push("parent", self._parent);
5290        if let Some(value) = self._notify_new_user.as_ref() {
5291            params.push("notifyNewUser", value.to_string());
5292        }
5293
5294        params.extend(self._additional_params.iter());
5295
5296        params.push("alt", "json");
5297        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks";
5298        if self._scopes.is_empty() {
5299            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
5300        }
5301
5302        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5303            url = params.uri_replacement(url, param_name, find_this, true);
5304        }
5305        {
5306            let to_remove = ["parent"];
5307            params.remove_params(&to_remove);
5308        }
5309
5310        let url = params.parse_with_url(&url);
5311
5312        let mut json_mime_type = mime::APPLICATION_JSON;
5313        let mut request_value_reader =
5314            {
5315                let mut value = json::value::to_value(&self._request).expect("serde to work");
5316                client::remove_json_null_values(&mut value);
5317                let mut dst = io::Cursor::new(Vec::with_capacity(128));
5318                json::to_writer(&mut dst, &value).unwrap();
5319                dst
5320            };
5321        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
5322        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5323
5324
5325        loop {
5326            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5327                Ok(token) => token,
5328                Err(e) => {
5329                    match dlg.token(e) {
5330                        Ok(token) => token,
5331                        Err(e) => {
5332                            dlg.finished(false);
5333                            return Err(client::Error::MissingToken(e));
5334                        }
5335                    }
5336                }
5337            };
5338            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5339            let mut req_result = {
5340                let client = &self.hub.client;
5341                dlg.pre_request();
5342                let mut req_builder = hyper::Request::builder()
5343                    .method(hyper::Method::POST)
5344                    .uri(url.as_str())
5345                    .header(USER_AGENT, self.hub._user_agent.clone());
5346
5347                if let Some(token) = token.as_ref() {
5348                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5349                }
5350
5351
5352                        let request = req_builder
5353                        .header(CONTENT_TYPE, json_mime_type.to_string())
5354                        .header(CONTENT_LENGTH, request_size as u64)
5355                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
5356
5357                client.request(request.unwrap()).await
5358
5359            };
5360
5361            match req_result {
5362                Err(err) => {
5363                    if let client::Retry::After(d) = dlg.http_error(&err) {
5364                        sleep(d).await;
5365                        continue;
5366                    }
5367                    dlg.finished(false);
5368                    return Err(client::Error::HttpError(err))
5369                }
5370                Ok(mut res) => {
5371                    if !res.status().is_success() {
5372                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5373                        let (parts, _) = res.into_parts();
5374                        let body = hyper::Body::from(res_body_string.clone());
5375                        let restored_response = hyper::Response::from_parts(parts, body);
5376
5377                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5378
5379                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5380                            sleep(d).await;
5381                            continue;
5382                        }
5383
5384                        dlg.finished(false);
5385
5386                        return match server_response {
5387                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
5388                            None => Err(client::Error::Failure(restored_response)),
5389                        }
5390                    }
5391                    let result_value = {
5392                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5393
5394                        match json::from_str(&res_body_string) {
5395                            Ok(decoded) => (res, decoded),
5396                            Err(err) => {
5397                                dlg.response_json_decode_error(&res_body_string, &err);
5398                                return Err(client::Error::JsonDecodeError(res_body_string, err));
5399                            }
5400                        }
5401                    };
5402
5403                    dlg.finished(true);
5404                    return Ok(result_value)
5405                }
5406            }
5407        }
5408    }
5409
5410
5411    ///
5412    /// Sets the *request* property to the given value.
5413    ///
5414    /// Even though the property as already been set when instantiating this call,
5415    /// we provide this method for API completeness.
5416    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaUserLink) -> AccountUserLinkCreateCall<'a, S> {
5417        self._request = new_value;
5418        self
5419    }
5420    /// Required. Example format: accounts/1234
5421    ///
5422    /// Sets the *parent* path property to the given value.
5423    ///
5424    /// Even though the property as already been set when instantiating this call,
5425    /// we provide this method for API completeness.
5426    pub fn parent(mut self, new_value: &str) -> AccountUserLinkCreateCall<'a, S> {
5427        self._parent = new_value.to_string();
5428        self
5429    }
5430    /// Optional. If set, then email the new user notifying them that they've been granted permissions to the resource.
5431    ///
5432    /// Sets the *notify new user* query property to the given value.
5433    pub fn notify_new_user(mut self, new_value: bool) -> AccountUserLinkCreateCall<'a, S> {
5434        self._notify_new_user = Some(new_value);
5435        self
5436    }
5437    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5438    /// while executing the actual API request.
5439    /// 
5440    /// ````text
5441    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5442    /// ````
5443    ///
5444    /// Sets the *delegate* property to the given value.
5445    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkCreateCall<'a, S> {
5446        self._delegate = Some(new_value);
5447        self
5448    }
5449
5450    /// Set any additional parameter of the query string used in the request.
5451    /// It should be used to set parameters which are not yet available through their own
5452    /// setters.
5453    ///
5454    /// Please note that this method must not be used to set any of the known parameters
5455    /// which have their own setter method. If done anyway, the request will fail.
5456    ///
5457    /// # Additional Parameters
5458    ///
5459    /// * *$.xgafv* (query-string) - V1 error format.
5460    /// * *access_token* (query-string) - OAuth access token.
5461    /// * *alt* (query-string) - Data format for response.
5462    /// * *callback* (query-string) - JSONP
5463    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5464    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5465    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5466    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5467    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5468    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5469    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5470    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkCreateCall<'a, S>
5471                                                        where T: AsRef<str> {
5472        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5473        self
5474    }
5475
5476    /// Identifies the authorization scope for the method you are building.
5477    ///
5478    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5479    /// [`Scope::AnalyticManageUser`].
5480    ///
5481    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5482    /// tokens for more than one scope.
5483    ///
5484    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5485    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5486    /// sufficient, a read-write scope will do as well.
5487    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkCreateCall<'a, S>
5488                                                        where St: AsRef<str> {
5489        self._scopes.insert(String::from(scope.as_ref()));
5490        self
5491    }
5492    /// Identifies the authorization scope(s) for the method you are building.
5493    ///
5494    /// See [`Self::add_scope()`] for details.
5495    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkCreateCall<'a, S>
5496                                                        where I: IntoIterator<Item = St>,
5497                                                         St: AsRef<str> {
5498        self._scopes
5499            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5500        self
5501    }
5502
5503    /// Removes all scopes, and no default scope will be used either.
5504    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5505    /// for details).
5506    pub fn clear_scopes(mut self) -> AccountUserLinkCreateCall<'a, S> {
5507        self._scopes.clear();
5508        self
5509    }
5510}
5511
5512
5513/// Deletes a user link on an account or property.
5514///
5515/// A builder for the *userLinks.delete* method supported by a *account* resource.
5516/// It is not used directly, but through a [`AccountMethods`] instance.
5517///
5518/// # Example
5519///
5520/// Instantiate a resource method builder
5521///
5522/// ```test_harness,no_run
5523/// # extern crate hyper;
5524/// # extern crate hyper_rustls;
5525/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
5526/// # async fn dox() {
5527/// # use std::default::Default;
5528/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5529/// 
5530/// # let secret: oauth2::ApplicationSecret = Default::default();
5531/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5532/// #         secret,
5533/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5534/// #     ).build().await.unwrap();
5535/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5536/// // You can configure optional parameters by calling the respective setters at will, and
5537/// // execute the final call using `doit()`.
5538/// // Values shown here are possibly random and not representative !
5539/// let result = hub.accounts().user_links_delete("name")
5540///              .doit().await;
5541/// # }
5542/// ```
5543pub struct AccountUserLinkDeleteCall<'a, S>
5544    where S: 'a {
5545
5546    hub: &'a GoogleAnalyticsAdmin<S>,
5547    _name: String,
5548    _delegate: Option<&'a mut dyn client::Delegate>,
5549    _additional_params: HashMap<String, String>,
5550    _scopes: BTreeSet<String>
5551}
5552
5553impl<'a, S> client::CallBuilder for AccountUserLinkDeleteCall<'a, S> {}
5554
5555impl<'a, S> AccountUserLinkDeleteCall<'a, S>
5556where
5557    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5558    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5559    S::Future: Send + Unpin + 'static,
5560    S::Error: Into<Box<dyn StdError + Send + Sync>>,
5561{
5562
5563
5564    /// Perform the operation you have build so far.
5565    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
5566        use std::io::{Read, Seek};
5567        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5568        use client::{ToParts, url::Params};
5569        use std::borrow::Cow;
5570
5571        let mut dd = client::DefaultDelegate;
5572        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5573        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.delete",
5574                               http_method: hyper::Method::DELETE });
5575
5576        for &field in ["alt", "name"].iter() {
5577            if self._additional_params.contains_key(field) {
5578                dlg.finished(false);
5579                return Err(client::Error::FieldClash(field));
5580            }
5581        }
5582
5583        let mut params = Params::with_capacity(3 + self._additional_params.len());
5584        params.push("name", self._name);
5585
5586        params.extend(self._additional_params.iter());
5587
5588        params.push("alt", "json");
5589        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
5590        if self._scopes.is_empty() {
5591            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
5592        }
5593
5594        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5595            url = params.uri_replacement(url, param_name, find_this, true);
5596        }
5597        {
5598            let to_remove = ["name"];
5599            params.remove_params(&to_remove);
5600        }
5601
5602        let url = params.parse_with_url(&url);
5603
5604
5605
5606        loop {
5607            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5608                Ok(token) => token,
5609                Err(e) => {
5610                    match dlg.token(e) {
5611                        Ok(token) => token,
5612                        Err(e) => {
5613                            dlg.finished(false);
5614                            return Err(client::Error::MissingToken(e));
5615                        }
5616                    }
5617                }
5618            };
5619            let mut req_result = {
5620                let client = &self.hub.client;
5621                dlg.pre_request();
5622                let mut req_builder = hyper::Request::builder()
5623                    .method(hyper::Method::DELETE)
5624                    .uri(url.as_str())
5625                    .header(USER_AGENT, self.hub._user_agent.clone());
5626
5627                if let Some(token) = token.as_ref() {
5628                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5629                }
5630
5631
5632                        let request = req_builder
5633                        .body(hyper::body::Body::empty());
5634
5635                client.request(request.unwrap()).await
5636
5637            };
5638
5639            match req_result {
5640                Err(err) => {
5641                    if let client::Retry::After(d) = dlg.http_error(&err) {
5642                        sleep(d).await;
5643                        continue;
5644                    }
5645                    dlg.finished(false);
5646                    return Err(client::Error::HttpError(err))
5647                }
5648                Ok(mut res) => {
5649                    if !res.status().is_success() {
5650                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5651                        let (parts, _) = res.into_parts();
5652                        let body = hyper::Body::from(res_body_string.clone());
5653                        let restored_response = hyper::Response::from_parts(parts, body);
5654
5655                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5656
5657                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5658                            sleep(d).await;
5659                            continue;
5660                        }
5661
5662                        dlg.finished(false);
5663
5664                        return match server_response {
5665                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
5666                            None => Err(client::Error::Failure(restored_response)),
5667                        }
5668                    }
5669                    let result_value = {
5670                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5671
5672                        match json::from_str(&res_body_string) {
5673                            Ok(decoded) => (res, decoded),
5674                            Err(err) => {
5675                                dlg.response_json_decode_error(&res_body_string, &err);
5676                                return Err(client::Error::JsonDecodeError(res_body_string, err));
5677                            }
5678                        }
5679                    };
5680
5681                    dlg.finished(true);
5682                    return Ok(result_value)
5683                }
5684            }
5685        }
5686    }
5687
5688
5689    /// Required. Example format: accounts/1234/userLinks/5678
5690    ///
5691    /// Sets the *name* path property to the given value.
5692    ///
5693    /// Even though the property as already been set when instantiating this call,
5694    /// we provide this method for API completeness.
5695    pub fn name(mut self, new_value: &str) -> AccountUserLinkDeleteCall<'a, S> {
5696        self._name = new_value.to_string();
5697        self
5698    }
5699    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5700    /// while executing the actual API request.
5701    /// 
5702    /// ````text
5703    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5704    /// ````
5705    ///
5706    /// Sets the *delegate* property to the given value.
5707    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkDeleteCall<'a, S> {
5708        self._delegate = Some(new_value);
5709        self
5710    }
5711
5712    /// Set any additional parameter of the query string used in the request.
5713    /// It should be used to set parameters which are not yet available through their own
5714    /// setters.
5715    ///
5716    /// Please note that this method must not be used to set any of the known parameters
5717    /// which have their own setter method. If done anyway, the request will fail.
5718    ///
5719    /// # Additional Parameters
5720    ///
5721    /// * *$.xgafv* (query-string) - V1 error format.
5722    /// * *access_token* (query-string) - OAuth access token.
5723    /// * *alt* (query-string) - Data format for response.
5724    /// * *callback* (query-string) - JSONP
5725    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5726    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5727    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5728    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5729    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5730    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5731    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5732    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkDeleteCall<'a, S>
5733                                                        where T: AsRef<str> {
5734        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5735        self
5736    }
5737
5738    /// Identifies the authorization scope for the method you are building.
5739    ///
5740    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5741    /// [`Scope::AnalyticManageUser`].
5742    ///
5743    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5744    /// tokens for more than one scope.
5745    ///
5746    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5747    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5748    /// sufficient, a read-write scope will do as well.
5749    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkDeleteCall<'a, S>
5750                                                        where St: AsRef<str> {
5751        self._scopes.insert(String::from(scope.as_ref()));
5752        self
5753    }
5754    /// Identifies the authorization scope(s) for the method you are building.
5755    ///
5756    /// See [`Self::add_scope()`] for details.
5757    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkDeleteCall<'a, S>
5758                                                        where I: IntoIterator<Item = St>,
5759                                                         St: AsRef<str> {
5760        self._scopes
5761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5762        self
5763    }
5764
5765    /// Removes all scopes, and no default scope will be used either.
5766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5767    /// for details).
5768    pub fn clear_scopes(mut self) -> AccountUserLinkDeleteCall<'a, S> {
5769        self._scopes.clear();
5770        self
5771    }
5772}
5773
5774
5775/// Gets information about a user's link to an account or property.
5776///
5777/// A builder for the *userLinks.get* method supported by a *account* resource.
5778/// It is not used directly, but through a [`AccountMethods`] instance.
5779///
5780/// # Example
5781///
5782/// Instantiate a resource method builder
5783///
5784/// ```test_harness,no_run
5785/// # extern crate hyper;
5786/// # extern crate hyper_rustls;
5787/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
5788/// # async fn dox() {
5789/// # use std::default::Default;
5790/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5791/// 
5792/// # let secret: oauth2::ApplicationSecret = Default::default();
5793/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5794/// #         secret,
5795/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5796/// #     ).build().await.unwrap();
5797/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5798/// // You can configure optional parameters by calling the respective setters at will, and
5799/// // execute the final call using `doit()`.
5800/// // Values shown here are possibly random and not representative !
5801/// let result = hub.accounts().user_links_get("name")
5802///              .doit().await;
5803/// # }
5804/// ```
5805pub struct AccountUserLinkGetCall<'a, S>
5806    where S: 'a {
5807
5808    hub: &'a GoogleAnalyticsAdmin<S>,
5809    _name: String,
5810    _delegate: Option<&'a mut dyn client::Delegate>,
5811    _additional_params: HashMap<String, String>,
5812    _scopes: BTreeSet<String>
5813}
5814
5815impl<'a, S> client::CallBuilder for AccountUserLinkGetCall<'a, S> {}
5816
5817impl<'a, S> AccountUserLinkGetCall<'a, S>
5818where
5819    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5820    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5821    S::Future: Send + Unpin + 'static,
5822    S::Error: Into<Box<dyn StdError + Send + Sync>>,
5823{
5824
5825
5826    /// Perform the operation you have build so far.
5827    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
5828        use std::io::{Read, Seek};
5829        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5830        use client::{ToParts, url::Params};
5831        use std::borrow::Cow;
5832
5833        let mut dd = client::DefaultDelegate;
5834        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5835        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.get",
5836                               http_method: hyper::Method::GET });
5837
5838        for &field in ["alt", "name"].iter() {
5839            if self._additional_params.contains_key(field) {
5840                dlg.finished(false);
5841                return Err(client::Error::FieldClash(field));
5842            }
5843        }
5844
5845        let mut params = Params::with_capacity(3 + self._additional_params.len());
5846        params.push("name", self._name);
5847
5848        params.extend(self._additional_params.iter());
5849
5850        params.push("alt", "json");
5851        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
5852        if self._scopes.is_empty() {
5853            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
5854        }
5855
5856        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5857            url = params.uri_replacement(url, param_name, find_this, true);
5858        }
5859        {
5860            let to_remove = ["name"];
5861            params.remove_params(&to_remove);
5862        }
5863
5864        let url = params.parse_with_url(&url);
5865
5866
5867
5868        loop {
5869            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5870                Ok(token) => token,
5871                Err(e) => {
5872                    match dlg.token(e) {
5873                        Ok(token) => token,
5874                        Err(e) => {
5875                            dlg.finished(false);
5876                            return Err(client::Error::MissingToken(e));
5877                        }
5878                    }
5879                }
5880            };
5881            let mut req_result = {
5882                let client = &self.hub.client;
5883                dlg.pre_request();
5884                let mut req_builder = hyper::Request::builder()
5885                    .method(hyper::Method::GET)
5886                    .uri(url.as_str())
5887                    .header(USER_AGENT, self.hub._user_agent.clone());
5888
5889                if let Some(token) = token.as_ref() {
5890                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5891                }
5892
5893
5894                        let request = req_builder
5895                        .body(hyper::body::Body::empty());
5896
5897                client.request(request.unwrap()).await
5898
5899            };
5900
5901            match req_result {
5902                Err(err) => {
5903                    if let client::Retry::After(d) = dlg.http_error(&err) {
5904                        sleep(d).await;
5905                        continue;
5906                    }
5907                    dlg.finished(false);
5908                    return Err(client::Error::HttpError(err))
5909                }
5910                Ok(mut res) => {
5911                    if !res.status().is_success() {
5912                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5913                        let (parts, _) = res.into_parts();
5914                        let body = hyper::Body::from(res_body_string.clone());
5915                        let restored_response = hyper::Response::from_parts(parts, body);
5916
5917                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5918
5919                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5920                            sleep(d).await;
5921                            continue;
5922                        }
5923
5924                        dlg.finished(false);
5925
5926                        return match server_response {
5927                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
5928                            None => Err(client::Error::Failure(restored_response)),
5929                        }
5930                    }
5931                    let result_value = {
5932                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
5933
5934                        match json::from_str(&res_body_string) {
5935                            Ok(decoded) => (res, decoded),
5936                            Err(err) => {
5937                                dlg.response_json_decode_error(&res_body_string, &err);
5938                                return Err(client::Error::JsonDecodeError(res_body_string, err));
5939                            }
5940                        }
5941                    };
5942
5943                    dlg.finished(true);
5944                    return Ok(result_value)
5945                }
5946            }
5947        }
5948    }
5949
5950
5951    /// Required. Example format: accounts/1234/userLinks/5678
5952    ///
5953    /// Sets the *name* path property to the given value.
5954    ///
5955    /// Even though the property as already been set when instantiating this call,
5956    /// we provide this method for API completeness.
5957    pub fn name(mut self, new_value: &str) -> AccountUserLinkGetCall<'a, S> {
5958        self._name = new_value.to_string();
5959        self
5960    }
5961    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5962    /// while executing the actual API request.
5963    /// 
5964    /// ````text
5965    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5966    /// ````
5967    ///
5968    /// Sets the *delegate* property to the given value.
5969    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkGetCall<'a, S> {
5970        self._delegate = Some(new_value);
5971        self
5972    }
5973
5974    /// Set any additional parameter of the query string used in the request.
5975    /// It should be used to set parameters which are not yet available through their own
5976    /// setters.
5977    ///
5978    /// Please note that this method must not be used to set any of the known parameters
5979    /// which have their own setter method. If done anyway, the request will fail.
5980    ///
5981    /// # Additional Parameters
5982    ///
5983    /// * *$.xgafv* (query-string) - V1 error format.
5984    /// * *access_token* (query-string) - OAuth access token.
5985    /// * *alt* (query-string) - Data format for response.
5986    /// * *callback* (query-string) - JSONP
5987    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5988    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5989    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5990    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5991    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5992    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5993    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5994    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkGetCall<'a, S>
5995                                                        where T: AsRef<str> {
5996        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5997        self
5998    }
5999
6000    /// Identifies the authorization scope for the method you are building.
6001    ///
6002    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6003    /// [`Scope::AnalyticManageUserReadonly`].
6004    ///
6005    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6006    /// tokens for more than one scope.
6007    ///
6008    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6009    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6010    /// sufficient, a read-write scope will do as well.
6011    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkGetCall<'a, S>
6012                                                        where St: AsRef<str> {
6013        self._scopes.insert(String::from(scope.as_ref()));
6014        self
6015    }
6016    /// Identifies the authorization scope(s) for the method you are building.
6017    ///
6018    /// See [`Self::add_scope()`] for details.
6019    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkGetCall<'a, S>
6020                                                        where I: IntoIterator<Item = St>,
6021                                                         St: AsRef<str> {
6022        self._scopes
6023            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6024        self
6025    }
6026
6027    /// Removes all scopes, and no default scope will be used either.
6028    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6029    /// for details).
6030    pub fn clear_scopes(mut self) -> AccountUserLinkGetCall<'a, S> {
6031        self._scopes.clear();
6032        self
6033    }
6034}
6035
6036
6037/// Lists all user links on an account or property.
6038///
6039/// A builder for the *userLinks.list* method supported by a *account* resource.
6040/// It is not used directly, but through a [`AccountMethods`] instance.
6041///
6042/// # Example
6043///
6044/// Instantiate a resource method builder
6045///
6046/// ```test_harness,no_run
6047/// # extern crate hyper;
6048/// # extern crate hyper_rustls;
6049/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
6050/// # async fn dox() {
6051/// # use std::default::Default;
6052/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6053/// 
6054/// # let secret: oauth2::ApplicationSecret = Default::default();
6055/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6056/// #         secret,
6057/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6058/// #     ).build().await.unwrap();
6059/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6060/// // You can configure optional parameters by calling the respective setters at will, and
6061/// // execute the final call using `doit()`.
6062/// // Values shown here are possibly random and not representative !
6063/// let result = hub.accounts().user_links_list("parent")
6064///              .page_token("eos")
6065///              .page_size(-4)
6066///              .doit().await;
6067/// # }
6068/// ```
6069pub struct AccountUserLinkListCall<'a, S>
6070    where S: 'a {
6071
6072    hub: &'a GoogleAnalyticsAdmin<S>,
6073    _parent: String,
6074    _page_token: Option<String>,
6075    _page_size: Option<i32>,
6076    _delegate: Option<&'a mut dyn client::Delegate>,
6077    _additional_params: HashMap<String, String>,
6078    _scopes: BTreeSet<String>
6079}
6080
6081impl<'a, S> client::CallBuilder for AccountUserLinkListCall<'a, S> {}
6082
6083impl<'a, S> AccountUserLinkListCall<'a, S>
6084where
6085    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6086    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6087    S::Future: Send + Unpin + 'static,
6088    S::Error: Into<Box<dyn StdError + Send + Sync>>,
6089{
6090
6091
6092    /// Perform the operation you have build so far.
6093    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListUserLinksResponse)> {
6094        use std::io::{Read, Seek};
6095        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6096        use client::{ToParts, url::Params};
6097        use std::borrow::Cow;
6098
6099        let mut dd = client::DefaultDelegate;
6100        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6101        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.list",
6102                               http_method: hyper::Method::GET });
6103
6104        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6105            if self._additional_params.contains_key(field) {
6106                dlg.finished(false);
6107                return Err(client::Error::FieldClash(field));
6108            }
6109        }
6110
6111        let mut params = Params::with_capacity(5 + self._additional_params.len());
6112        params.push("parent", self._parent);
6113        if let Some(value) = self._page_token.as_ref() {
6114            params.push("pageToken", value);
6115        }
6116        if let Some(value) = self._page_size.as_ref() {
6117            params.push("pageSize", value.to_string());
6118        }
6119
6120        params.extend(self._additional_params.iter());
6121
6122        params.push("alt", "json");
6123        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks";
6124        if self._scopes.is_empty() {
6125            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
6126        }
6127
6128        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6129            url = params.uri_replacement(url, param_name, find_this, true);
6130        }
6131        {
6132            let to_remove = ["parent"];
6133            params.remove_params(&to_remove);
6134        }
6135
6136        let url = params.parse_with_url(&url);
6137
6138
6139
6140        loop {
6141            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6142                Ok(token) => token,
6143                Err(e) => {
6144                    match dlg.token(e) {
6145                        Ok(token) => token,
6146                        Err(e) => {
6147                            dlg.finished(false);
6148                            return Err(client::Error::MissingToken(e));
6149                        }
6150                    }
6151                }
6152            };
6153            let mut req_result = {
6154                let client = &self.hub.client;
6155                dlg.pre_request();
6156                let mut req_builder = hyper::Request::builder()
6157                    .method(hyper::Method::GET)
6158                    .uri(url.as_str())
6159                    .header(USER_AGENT, self.hub._user_agent.clone());
6160
6161                if let Some(token) = token.as_ref() {
6162                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6163                }
6164
6165
6166                        let request = req_builder
6167                        .body(hyper::body::Body::empty());
6168
6169                client.request(request.unwrap()).await
6170
6171            };
6172
6173            match req_result {
6174                Err(err) => {
6175                    if let client::Retry::After(d) = dlg.http_error(&err) {
6176                        sleep(d).await;
6177                        continue;
6178                    }
6179                    dlg.finished(false);
6180                    return Err(client::Error::HttpError(err))
6181                }
6182                Ok(mut res) => {
6183                    if !res.status().is_success() {
6184                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6185                        let (parts, _) = res.into_parts();
6186                        let body = hyper::Body::from(res_body_string.clone());
6187                        let restored_response = hyper::Response::from_parts(parts, body);
6188
6189                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6190
6191                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6192                            sleep(d).await;
6193                            continue;
6194                        }
6195
6196                        dlg.finished(false);
6197
6198                        return match server_response {
6199                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
6200                            None => Err(client::Error::Failure(restored_response)),
6201                        }
6202                    }
6203                    let result_value = {
6204                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6205
6206                        match json::from_str(&res_body_string) {
6207                            Ok(decoded) => (res, decoded),
6208                            Err(err) => {
6209                                dlg.response_json_decode_error(&res_body_string, &err);
6210                                return Err(client::Error::JsonDecodeError(res_body_string, err));
6211                            }
6212                        }
6213                    };
6214
6215                    dlg.finished(true);
6216                    return Ok(result_value)
6217                }
6218            }
6219        }
6220    }
6221
6222
6223    /// Required. Example format: accounts/1234
6224    ///
6225    /// Sets the *parent* path property to the given value.
6226    ///
6227    /// Even though the property as already been set when instantiating this call,
6228    /// we provide this method for API completeness.
6229    pub fn parent(mut self, new_value: &str) -> AccountUserLinkListCall<'a, S> {
6230        self._parent = new_value.to_string();
6231        self
6232    }
6233    /// A page token, received from a previous `ListUserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListUserLinks` must match the call that provided the page token.
6234    ///
6235    /// Sets the *page token* query property to the given value.
6236    pub fn page_token(mut self, new_value: &str) -> AccountUserLinkListCall<'a, S> {
6237        self._page_token = Some(new_value.to_string());
6238        self
6239    }
6240    /// The maximum number of user links to return. The service may return fewer than this value. If unspecified, at most 200 user links will be returned. The maximum value is 500; values above 500 will be coerced to 500.
6241    ///
6242    /// Sets the *page size* query property to the given value.
6243    pub fn page_size(mut self, new_value: i32) -> AccountUserLinkListCall<'a, S> {
6244        self._page_size = Some(new_value);
6245        self
6246    }
6247    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6248    /// while executing the actual API request.
6249    /// 
6250    /// ````text
6251    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6252    /// ````
6253    ///
6254    /// Sets the *delegate* property to the given value.
6255    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkListCall<'a, S> {
6256        self._delegate = Some(new_value);
6257        self
6258    }
6259
6260    /// Set any additional parameter of the query string used in the request.
6261    /// It should be used to set parameters which are not yet available through their own
6262    /// setters.
6263    ///
6264    /// Please note that this method must not be used to set any of the known parameters
6265    /// which have their own setter method. If done anyway, the request will fail.
6266    ///
6267    /// # Additional Parameters
6268    ///
6269    /// * *$.xgafv* (query-string) - V1 error format.
6270    /// * *access_token* (query-string) - OAuth access token.
6271    /// * *alt* (query-string) - Data format for response.
6272    /// * *callback* (query-string) - JSONP
6273    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6274    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6275    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6276    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6277    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6278    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6279    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6280    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkListCall<'a, S>
6281                                                        where T: AsRef<str> {
6282        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6283        self
6284    }
6285
6286    /// Identifies the authorization scope for the method you are building.
6287    ///
6288    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6289    /// [`Scope::AnalyticManageUserReadonly`].
6290    ///
6291    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6292    /// tokens for more than one scope.
6293    ///
6294    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6295    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6296    /// sufficient, a read-write scope will do as well.
6297    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkListCall<'a, S>
6298                                                        where St: AsRef<str> {
6299        self._scopes.insert(String::from(scope.as_ref()));
6300        self
6301    }
6302    /// Identifies the authorization scope(s) for the method you are building.
6303    ///
6304    /// See [`Self::add_scope()`] for details.
6305    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkListCall<'a, S>
6306                                                        where I: IntoIterator<Item = St>,
6307                                                         St: AsRef<str> {
6308        self._scopes
6309            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6310        self
6311    }
6312
6313    /// Removes all scopes, and no default scope will be used either.
6314    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6315    /// for details).
6316    pub fn clear_scopes(mut self) -> AccountUserLinkListCall<'a, S> {
6317        self._scopes.clear();
6318        self
6319    }
6320}
6321
6322
6323/// Updates a user link on an account or property.
6324///
6325/// A builder for the *userLinks.patch* method supported by a *account* resource.
6326/// It is not used directly, but through a [`AccountMethods`] instance.
6327///
6328/// # Example
6329///
6330/// Instantiate a resource method builder
6331///
6332/// ```test_harness,no_run
6333/// # extern crate hyper;
6334/// # extern crate hyper_rustls;
6335/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
6336/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaUserLink;
6337/// # async fn dox() {
6338/// # use std::default::Default;
6339/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6340/// 
6341/// # let secret: oauth2::ApplicationSecret = Default::default();
6342/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6343/// #         secret,
6344/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6345/// #     ).build().await.unwrap();
6346/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6347/// // As the method needs a request, you would usually fill it with the desired information
6348/// // into the respective structure. Some of the parts shown here might not be applicable !
6349/// // Values shown here are possibly random and not representative !
6350/// let mut req = GoogleAnalyticsAdminV1alphaUserLink::default();
6351/// 
6352/// // You can configure optional parameters by calling the respective setters at will, and
6353/// // execute the final call using `doit()`.
6354/// // Values shown here are possibly random and not representative !
6355/// let result = hub.accounts().user_links_patch(req, "name")
6356///              .doit().await;
6357/// # }
6358/// ```
6359pub struct AccountUserLinkPatchCall<'a, S>
6360    where S: 'a {
6361
6362    hub: &'a GoogleAnalyticsAdmin<S>,
6363    _request: GoogleAnalyticsAdminV1alphaUserLink,
6364    _name: String,
6365    _delegate: Option<&'a mut dyn client::Delegate>,
6366    _additional_params: HashMap<String, String>,
6367    _scopes: BTreeSet<String>
6368}
6369
6370impl<'a, S> client::CallBuilder for AccountUserLinkPatchCall<'a, S> {}
6371
6372impl<'a, S> AccountUserLinkPatchCall<'a, S>
6373where
6374    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6375    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6376    S::Future: Send + Unpin + 'static,
6377    S::Error: Into<Box<dyn StdError + Send + Sync>>,
6378{
6379
6380
6381    /// Perform the operation you have build so far.
6382    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
6383        use std::io::{Read, Seek};
6384        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6385        use client::{ToParts, url::Params};
6386        use std::borrow::Cow;
6387
6388        let mut dd = client::DefaultDelegate;
6389        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6390        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.userLinks.patch",
6391                               http_method: hyper::Method::PATCH });
6392
6393        for &field in ["alt", "name"].iter() {
6394            if self._additional_params.contains_key(field) {
6395                dlg.finished(false);
6396                return Err(client::Error::FieldClash(field));
6397            }
6398        }
6399
6400        let mut params = Params::with_capacity(4 + self._additional_params.len());
6401        params.push("name", self._name);
6402
6403        params.extend(self._additional_params.iter());
6404
6405        params.push("alt", "json");
6406        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
6407        if self._scopes.is_empty() {
6408            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
6409        }
6410
6411        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6412            url = params.uri_replacement(url, param_name, find_this, true);
6413        }
6414        {
6415            let to_remove = ["name"];
6416            params.remove_params(&to_remove);
6417        }
6418
6419        let url = params.parse_with_url(&url);
6420
6421        let mut json_mime_type = mime::APPLICATION_JSON;
6422        let mut request_value_reader =
6423            {
6424                let mut value = json::value::to_value(&self._request).expect("serde to work");
6425                client::remove_json_null_values(&mut value);
6426                let mut dst = io::Cursor::new(Vec::with_capacity(128));
6427                json::to_writer(&mut dst, &value).unwrap();
6428                dst
6429            };
6430        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
6431        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
6432
6433
6434        loop {
6435            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6436                Ok(token) => token,
6437                Err(e) => {
6438                    match dlg.token(e) {
6439                        Ok(token) => token,
6440                        Err(e) => {
6441                            dlg.finished(false);
6442                            return Err(client::Error::MissingToken(e));
6443                        }
6444                    }
6445                }
6446            };
6447            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
6448            let mut req_result = {
6449                let client = &self.hub.client;
6450                dlg.pre_request();
6451                let mut req_builder = hyper::Request::builder()
6452                    .method(hyper::Method::PATCH)
6453                    .uri(url.as_str())
6454                    .header(USER_AGENT, self.hub._user_agent.clone());
6455
6456                if let Some(token) = token.as_ref() {
6457                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6458                }
6459
6460
6461                        let request = req_builder
6462                        .header(CONTENT_TYPE, json_mime_type.to_string())
6463                        .header(CONTENT_LENGTH, request_size as u64)
6464                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
6465
6466                client.request(request.unwrap()).await
6467
6468            };
6469
6470            match req_result {
6471                Err(err) => {
6472                    if let client::Retry::After(d) = dlg.http_error(&err) {
6473                        sleep(d).await;
6474                        continue;
6475                    }
6476                    dlg.finished(false);
6477                    return Err(client::Error::HttpError(err))
6478                }
6479                Ok(mut res) => {
6480                    if !res.status().is_success() {
6481                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6482                        let (parts, _) = res.into_parts();
6483                        let body = hyper::Body::from(res_body_string.clone());
6484                        let restored_response = hyper::Response::from_parts(parts, body);
6485
6486                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6487
6488                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6489                            sleep(d).await;
6490                            continue;
6491                        }
6492
6493                        dlg.finished(false);
6494
6495                        return match server_response {
6496                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
6497                            None => Err(client::Error::Failure(restored_response)),
6498                        }
6499                    }
6500                    let result_value = {
6501                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6502
6503                        match json::from_str(&res_body_string) {
6504                            Ok(decoded) => (res, decoded),
6505                            Err(err) => {
6506                                dlg.response_json_decode_error(&res_body_string, &err);
6507                                return Err(client::Error::JsonDecodeError(res_body_string, err));
6508                            }
6509                        }
6510                    };
6511
6512                    dlg.finished(true);
6513                    return Ok(result_value)
6514                }
6515            }
6516        }
6517    }
6518
6519
6520    ///
6521    /// Sets the *request* property to the given value.
6522    ///
6523    /// Even though the property as already been set when instantiating this call,
6524    /// we provide this method for API completeness.
6525    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaUserLink) -> AccountUserLinkPatchCall<'a, S> {
6526        self._request = new_value;
6527        self
6528    }
6529    /// Output only. Example format: properties/1234/userLinks/5678
6530    ///
6531    /// Sets the *name* path property to the given value.
6532    ///
6533    /// Even though the property as already been set when instantiating this call,
6534    /// we provide this method for API completeness.
6535    pub fn name(mut self, new_value: &str) -> AccountUserLinkPatchCall<'a, S> {
6536        self._name = new_value.to_string();
6537        self
6538    }
6539    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6540    /// while executing the actual API request.
6541    /// 
6542    /// ````text
6543    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6544    /// ````
6545    ///
6546    /// Sets the *delegate* property to the given value.
6547    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountUserLinkPatchCall<'a, S> {
6548        self._delegate = Some(new_value);
6549        self
6550    }
6551
6552    /// Set any additional parameter of the query string used in the request.
6553    /// It should be used to set parameters which are not yet available through their own
6554    /// setters.
6555    ///
6556    /// Please note that this method must not be used to set any of the known parameters
6557    /// which have their own setter method. If done anyway, the request will fail.
6558    ///
6559    /// # Additional Parameters
6560    ///
6561    /// * *$.xgafv* (query-string) - V1 error format.
6562    /// * *access_token* (query-string) - OAuth access token.
6563    /// * *alt* (query-string) - Data format for response.
6564    /// * *callback* (query-string) - JSONP
6565    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6566    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6567    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6568    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6569    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6570    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6571    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6572    pub fn param<T>(mut self, name: T, value: T) -> AccountUserLinkPatchCall<'a, S>
6573                                                        where T: AsRef<str> {
6574        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6575        self
6576    }
6577
6578    /// Identifies the authorization scope for the method you are building.
6579    ///
6580    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6581    /// [`Scope::AnalyticManageUser`].
6582    ///
6583    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6584    /// tokens for more than one scope.
6585    ///
6586    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6587    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6588    /// sufficient, a read-write scope will do as well.
6589    pub fn add_scope<St>(mut self, scope: St) -> AccountUserLinkPatchCall<'a, S>
6590                                                        where St: AsRef<str> {
6591        self._scopes.insert(String::from(scope.as_ref()));
6592        self
6593    }
6594    /// Identifies the authorization scope(s) for the method you are building.
6595    ///
6596    /// See [`Self::add_scope()`] for details.
6597    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserLinkPatchCall<'a, S>
6598                                                        where I: IntoIterator<Item = St>,
6599                                                         St: AsRef<str> {
6600        self._scopes
6601            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6602        self
6603    }
6604
6605    /// Removes all scopes, and no default scope will be used either.
6606    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6607    /// for details).
6608    pub fn clear_scopes(mut self) -> AccountUserLinkPatchCall<'a, S> {
6609        self._scopes.clear();
6610        self
6611    }
6612}
6613
6614
6615/// Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.
6616///
6617/// A builder for the *delete* method supported by a *account* resource.
6618/// It is not used directly, but through a [`AccountMethods`] instance.
6619///
6620/// # Example
6621///
6622/// Instantiate a resource method builder
6623///
6624/// ```test_harness,no_run
6625/// # extern crate hyper;
6626/// # extern crate hyper_rustls;
6627/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
6628/// # async fn dox() {
6629/// # use std::default::Default;
6630/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6631/// 
6632/// # let secret: oauth2::ApplicationSecret = Default::default();
6633/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6634/// #         secret,
6635/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6636/// #     ).build().await.unwrap();
6637/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6638/// // You can configure optional parameters by calling the respective setters at will, and
6639/// // execute the final call using `doit()`.
6640/// // Values shown here are possibly random and not representative !
6641/// let result = hub.accounts().delete("name")
6642///              .doit().await;
6643/// # }
6644/// ```
6645pub struct AccountDeleteCall<'a, S>
6646    where S: 'a {
6647
6648    hub: &'a GoogleAnalyticsAdmin<S>,
6649    _name: String,
6650    _delegate: Option<&'a mut dyn client::Delegate>,
6651    _additional_params: HashMap<String, String>,
6652    _scopes: BTreeSet<String>
6653}
6654
6655impl<'a, S> client::CallBuilder for AccountDeleteCall<'a, S> {}
6656
6657impl<'a, S> AccountDeleteCall<'a, S>
6658where
6659    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6660    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6661    S::Future: Send + Unpin + 'static,
6662    S::Error: Into<Box<dyn StdError + Send + Sync>>,
6663{
6664
6665
6666    /// Perform the operation you have build so far.
6667    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
6668        use std::io::{Read, Seek};
6669        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6670        use client::{ToParts, url::Params};
6671        use std::borrow::Cow;
6672
6673        let mut dd = client::DefaultDelegate;
6674        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6675        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.delete",
6676                               http_method: hyper::Method::DELETE });
6677
6678        for &field in ["alt", "name"].iter() {
6679            if self._additional_params.contains_key(field) {
6680                dlg.finished(false);
6681                return Err(client::Error::FieldClash(field));
6682            }
6683        }
6684
6685        let mut params = Params::with_capacity(3 + self._additional_params.len());
6686        params.push("name", self._name);
6687
6688        params.extend(self._additional_params.iter());
6689
6690        params.push("alt", "json");
6691        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
6692        if self._scopes.is_empty() {
6693            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
6694        }
6695
6696        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6697            url = params.uri_replacement(url, param_name, find_this, true);
6698        }
6699        {
6700            let to_remove = ["name"];
6701            params.remove_params(&to_remove);
6702        }
6703
6704        let url = params.parse_with_url(&url);
6705
6706
6707
6708        loop {
6709            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6710                Ok(token) => token,
6711                Err(e) => {
6712                    match dlg.token(e) {
6713                        Ok(token) => token,
6714                        Err(e) => {
6715                            dlg.finished(false);
6716                            return Err(client::Error::MissingToken(e));
6717                        }
6718                    }
6719                }
6720            };
6721            let mut req_result = {
6722                let client = &self.hub.client;
6723                dlg.pre_request();
6724                let mut req_builder = hyper::Request::builder()
6725                    .method(hyper::Method::DELETE)
6726                    .uri(url.as_str())
6727                    .header(USER_AGENT, self.hub._user_agent.clone());
6728
6729                if let Some(token) = token.as_ref() {
6730                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6731                }
6732
6733
6734                        let request = req_builder
6735                        .body(hyper::body::Body::empty());
6736
6737                client.request(request.unwrap()).await
6738
6739            };
6740
6741            match req_result {
6742                Err(err) => {
6743                    if let client::Retry::After(d) = dlg.http_error(&err) {
6744                        sleep(d).await;
6745                        continue;
6746                    }
6747                    dlg.finished(false);
6748                    return Err(client::Error::HttpError(err))
6749                }
6750                Ok(mut res) => {
6751                    if !res.status().is_success() {
6752                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6753                        let (parts, _) = res.into_parts();
6754                        let body = hyper::Body::from(res_body_string.clone());
6755                        let restored_response = hyper::Response::from_parts(parts, body);
6756
6757                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6758
6759                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6760                            sleep(d).await;
6761                            continue;
6762                        }
6763
6764                        dlg.finished(false);
6765
6766                        return match server_response {
6767                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
6768                            None => Err(client::Error::Failure(restored_response)),
6769                        }
6770                    }
6771                    let result_value = {
6772                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
6773
6774                        match json::from_str(&res_body_string) {
6775                            Ok(decoded) => (res, decoded),
6776                            Err(err) => {
6777                                dlg.response_json_decode_error(&res_body_string, &err);
6778                                return Err(client::Error::JsonDecodeError(res_body_string, err));
6779                            }
6780                        }
6781                    };
6782
6783                    dlg.finished(true);
6784                    return Ok(result_value)
6785                }
6786            }
6787        }
6788    }
6789
6790
6791    /// Required. The name of the Account to soft-delete. Format: accounts/{account} Example: "accounts/100"
6792    ///
6793    /// Sets the *name* path property to the given value.
6794    ///
6795    /// Even though the property as already been set when instantiating this call,
6796    /// we provide this method for API completeness.
6797    pub fn name(mut self, new_value: &str) -> AccountDeleteCall<'a, S> {
6798        self._name = new_value.to_string();
6799        self
6800    }
6801    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6802    /// while executing the actual API request.
6803    /// 
6804    /// ````text
6805    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6806    /// ````
6807    ///
6808    /// Sets the *delegate* property to the given value.
6809    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountDeleteCall<'a, S> {
6810        self._delegate = Some(new_value);
6811        self
6812    }
6813
6814    /// Set any additional parameter of the query string used in the request.
6815    /// It should be used to set parameters which are not yet available through their own
6816    /// setters.
6817    ///
6818    /// Please note that this method must not be used to set any of the known parameters
6819    /// which have their own setter method. If done anyway, the request will fail.
6820    ///
6821    /// # Additional Parameters
6822    ///
6823    /// * *$.xgafv* (query-string) - V1 error format.
6824    /// * *access_token* (query-string) - OAuth access token.
6825    /// * *alt* (query-string) - Data format for response.
6826    /// * *callback* (query-string) - JSONP
6827    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6828    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6829    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6830    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6831    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6832    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6833    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6834    pub fn param<T>(mut self, name: T, value: T) -> AccountDeleteCall<'a, S>
6835                                                        where T: AsRef<str> {
6836        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6837        self
6838    }
6839
6840    /// Identifies the authorization scope for the method you are building.
6841    ///
6842    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6843    /// [`Scope::AnalyticEdit`].
6844    ///
6845    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6846    /// tokens for more than one scope.
6847    ///
6848    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6849    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6850    /// sufficient, a read-write scope will do as well.
6851    pub fn add_scope<St>(mut self, scope: St) -> AccountDeleteCall<'a, S>
6852                                                        where St: AsRef<str> {
6853        self._scopes.insert(String::from(scope.as_ref()));
6854        self
6855    }
6856    /// Identifies the authorization scope(s) for the method you are building.
6857    ///
6858    /// See [`Self::add_scope()`] for details.
6859    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountDeleteCall<'a, S>
6860                                                        where I: IntoIterator<Item = St>,
6861                                                         St: AsRef<str> {
6862        self._scopes
6863            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6864        self
6865    }
6866
6867    /// Removes all scopes, and no default scope will be used either.
6868    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6869    /// for details).
6870    pub fn clear_scopes(mut self) -> AccountDeleteCall<'a, S> {
6871        self._scopes.clear();
6872        self
6873    }
6874}
6875
6876
6877/// Lookup for a single Account.
6878///
6879/// A builder for the *get* method supported by a *account* resource.
6880/// It is not used directly, but through a [`AccountMethods`] instance.
6881///
6882/// # Example
6883///
6884/// Instantiate a resource method builder
6885///
6886/// ```test_harness,no_run
6887/// # extern crate hyper;
6888/// # extern crate hyper_rustls;
6889/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
6890/// # async fn dox() {
6891/// # use std::default::Default;
6892/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6893/// 
6894/// # let secret: oauth2::ApplicationSecret = Default::default();
6895/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6896/// #         secret,
6897/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6898/// #     ).build().await.unwrap();
6899/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6900/// // You can configure optional parameters by calling the respective setters at will, and
6901/// // execute the final call using `doit()`.
6902/// // Values shown here are possibly random and not representative !
6903/// let result = hub.accounts().get("name")
6904///              .doit().await;
6905/// # }
6906/// ```
6907pub struct AccountGetCall<'a, S>
6908    where S: 'a {
6909
6910    hub: &'a GoogleAnalyticsAdmin<S>,
6911    _name: String,
6912    _delegate: Option<&'a mut dyn client::Delegate>,
6913    _additional_params: HashMap<String, String>,
6914    _scopes: BTreeSet<String>
6915}
6916
6917impl<'a, S> client::CallBuilder for AccountGetCall<'a, S> {}
6918
6919impl<'a, S> AccountGetCall<'a, S>
6920where
6921    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6922    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6923    S::Future: Send + Unpin + 'static,
6924    S::Error: Into<Box<dyn StdError + Send + Sync>>,
6925{
6926
6927
6928    /// Perform the operation you have build so far.
6929    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaAccount)> {
6930        use std::io::{Read, Seek};
6931        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6932        use client::{ToParts, url::Params};
6933        use std::borrow::Cow;
6934
6935        let mut dd = client::DefaultDelegate;
6936        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6937        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.get",
6938                               http_method: hyper::Method::GET });
6939
6940        for &field in ["alt", "name"].iter() {
6941            if self._additional_params.contains_key(field) {
6942                dlg.finished(false);
6943                return Err(client::Error::FieldClash(field));
6944            }
6945        }
6946
6947        let mut params = Params::with_capacity(3 + self._additional_params.len());
6948        params.push("name", self._name);
6949
6950        params.extend(self._additional_params.iter());
6951
6952        params.push("alt", "json");
6953        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
6954        if self._scopes.is_empty() {
6955            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
6956        }
6957
6958        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6959            url = params.uri_replacement(url, param_name, find_this, true);
6960        }
6961        {
6962            let to_remove = ["name"];
6963            params.remove_params(&to_remove);
6964        }
6965
6966        let url = params.parse_with_url(&url);
6967
6968
6969
6970        loop {
6971            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6972                Ok(token) => token,
6973                Err(e) => {
6974                    match dlg.token(e) {
6975                        Ok(token) => token,
6976                        Err(e) => {
6977                            dlg.finished(false);
6978                            return Err(client::Error::MissingToken(e));
6979                        }
6980                    }
6981                }
6982            };
6983            let mut req_result = {
6984                let client = &self.hub.client;
6985                dlg.pre_request();
6986                let mut req_builder = hyper::Request::builder()
6987                    .method(hyper::Method::GET)
6988                    .uri(url.as_str())
6989                    .header(USER_AGENT, self.hub._user_agent.clone());
6990
6991                if let Some(token) = token.as_ref() {
6992                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6993                }
6994
6995
6996                        let request = req_builder
6997                        .body(hyper::body::Body::empty());
6998
6999                client.request(request.unwrap()).await
7000
7001            };
7002
7003            match req_result {
7004                Err(err) => {
7005                    if let client::Retry::After(d) = dlg.http_error(&err) {
7006                        sleep(d).await;
7007                        continue;
7008                    }
7009                    dlg.finished(false);
7010                    return Err(client::Error::HttpError(err))
7011                }
7012                Ok(mut res) => {
7013                    if !res.status().is_success() {
7014                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7015                        let (parts, _) = res.into_parts();
7016                        let body = hyper::Body::from(res_body_string.clone());
7017                        let restored_response = hyper::Response::from_parts(parts, body);
7018
7019                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7020
7021                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7022                            sleep(d).await;
7023                            continue;
7024                        }
7025
7026                        dlg.finished(false);
7027
7028                        return match server_response {
7029                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
7030                            None => Err(client::Error::Failure(restored_response)),
7031                        }
7032                    }
7033                    let result_value = {
7034                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7035
7036                        match json::from_str(&res_body_string) {
7037                            Ok(decoded) => (res, decoded),
7038                            Err(err) => {
7039                                dlg.response_json_decode_error(&res_body_string, &err);
7040                                return Err(client::Error::JsonDecodeError(res_body_string, err));
7041                            }
7042                        }
7043                    };
7044
7045                    dlg.finished(true);
7046                    return Ok(result_value)
7047                }
7048            }
7049        }
7050    }
7051
7052
7053    /// Required. The name of the account to lookup. Format: accounts/{account} Example: "accounts/100"
7054    ///
7055    /// Sets the *name* path property to the given value.
7056    ///
7057    /// Even though the property as already been set when instantiating this call,
7058    /// we provide this method for API completeness.
7059    pub fn name(mut self, new_value: &str) -> AccountGetCall<'a, S> {
7060        self._name = new_value.to_string();
7061        self
7062    }
7063    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7064    /// while executing the actual API request.
7065    /// 
7066    /// ````text
7067    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7068    /// ````
7069    ///
7070    /// Sets the *delegate* property to the given value.
7071    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountGetCall<'a, S> {
7072        self._delegate = Some(new_value);
7073        self
7074    }
7075
7076    /// Set any additional parameter of the query string used in the request.
7077    /// It should be used to set parameters which are not yet available through their own
7078    /// setters.
7079    ///
7080    /// Please note that this method must not be used to set any of the known parameters
7081    /// which have their own setter method. If done anyway, the request will fail.
7082    ///
7083    /// # Additional Parameters
7084    ///
7085    /// * *$.xgafv* (query-string) - V1 error format.
7086    /// * *access_token* (query-string) - OAuth access token.
7087    /// * *alt* (query-string) - Data format for response.
7088    /// * *callback* (query-string) - JSONP
7089    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7090    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7091    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7092    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7093    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7094    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7095    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7096    pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, S>
7097                                                        where T: AsRef<str> {
7098        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7099        self
7100    }
7101
7102    /// Identifies the authorization scope for the method you are building.
7103    ///
7104    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7105    /// [`Scope::AnalyticReadonly`].
7106    ///
7107    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7108    /// tokens for more than one scope.
7109    ///
7110    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7111    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7112    /// sufficient, a read-write scope will do as well.
7113    pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, S>
7114                                                        where St: AsRef<str> {
7115        self._scopes.insert(String::from(scope.as_ref()));
7116        self
7117    }
7118    /// Identifies the authorization scope(s) for the method you are building.
7119    ///
7120    /// See [`Self::add_scope()`] for details.
7121    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, S>
7122                                                        where I: IntoIterator<Item = St>,
7123                                                         St: AsRef<str> {
7124        self._scopes
7125            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7126        self
7127    }
7128
7129    /// Removes all scopes, and no default scope will be used either.
7130    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7131    /// for details).
7132    pub fn clear_scopes(mut self) -> AccountGetCall<'a, S> {
7133        self._scopes.clear();
7134        self
7135    }
7136}
7137
7138
7139/// Get data sharing settings on an account. Data sharing settings are singletons.
7140///
7141/// A builder for the *getDataSharingSettings* method supported by a *account* resource.
7142/// It is not used directly, but through a [`AccountMethods`] instance.
7143///
7144/// # Example
7145///
7146/// Instantiate a resource method builder
7147///
7148/// ```test_harness,no_run
7149/// # extern crate hyper;
7150/// # extern crate hyper_rustls;
7151/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
7152/// # async fn dox() {
7153/// # use std::default::Default;
7154/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7155/// 
7156/// # let secret: oauth2::ApplicationSecret = Default::default();
7157/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7158/// #         secret,
7159/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7160/// #     ).build().await.unwrap();
7161/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7162/// // You can configure optional parameters by calling the respective setters at will, and
7163/// // execute the final call using `doit()`.
7164/// // Values shown here are possibly random and not representative !
7165/// let result = hub.accounts().get_data_sharing_settings("name")
7166///              .doit().await;
7167/// # }
7168/// ```
7169pub struct AccountGetDataSharingSettingCall<'a, S>
7170    where S: 'a {
7171
7172    hub: &'a GoogleAnalyticsAdmin<S>,
7173    _name: String,
7174    _delegate: Option<&'a mut dyn client::Delegate>,
7175    _additional_params: HashMap<String, String>,
7176    _scopes: BTreeSet<String>
7177}
7178
7179impl<'a, S> client::CallBuilder for AccountGetDataSharingSettingCall<'a, S> {}
7180
7181impl<'a, S> AccountGetDataSharingSettingCall<'a, S>
7182where
7183    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7184    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7185    S::Future: Send + Unpin + 'static,
7186    S::Error: Into<Box<dyn StdError + Send + Sync>>,
7187{
7188
7189
7190    /// Perform the operation you have build so far.
7191    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataSharingSettings)> {
7192        use std::io::{Read, Seek};
7193        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7194        use client::{ToParts, url::Params};
7195        use std::borrow::Cow;
7196
7197        let mut dd = client::DefaultDelegate;
7198        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7199        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.getDataSharingSettings",
7200                               http_method: hyper::Method::GET });
7201
7202        for &field in ["alt", "name"].iter() {
7203            if self._additional_params.contains_key(field) {
7204                dlg.finished(false);
7205                return Err(client::Error::FieldClash(field));
7206            }
7207        }
7208
7209        let mut params = Params::with_capacity(3 + self._additional_params.len());
7210        params.push("name", self._name);
7211
7212        params.extend(self._additional_params.iter());
7213
7214        params.push("alt", "json");
7215        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
7216        if self._scopes.is_empty() {
7217            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
7218        }
7219
7220        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7221            url = params.uri_replacement(url, param_name, find_this, true);
7222        }
7223        {
7224            let to_remove = ["name"];
7225            params.remove_params(&to_remove);
7226        }
7227
7228        let url = params.parse_with_url(&url);
7229
7230
7231
7232        loop {
7233            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7234                Ok(token) => token,
7235                Err(e) => {
7236                    match dlg.token(e) {
7237                        Ok(token) => token,
7238                        Err(e) => {
7239                            dlg.finished(false);
7240                            return Err(client::Error::MissingToken(e));
7241                        }
7242                    }
7243                }
7244            };
7245            let mut req_result = {
7246                let client = &self.hub.client;
7247                dlg.pre_request();
7248                let mut req_builder = hyper::Request::builder()
7249                    .method(hyper::Method::GET)
7250                    .uri(url.as_str())
7251                    .header(USER_AGENT, self.hub._user_agent.clone());
7252
7253                if let Some(token) = token.as_ref() {
7254                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7255                }
7256
7257
7258                        let request = req_builder
7259                        .body(hyper::body::Body::empty());
7260
7261                client.request(request.unwrap()).await
7262
7263            };
7264
7265            match req_result {
7266                Err(err) => {
7267                    if let client::Retry::After(d) = dlg.http_error(&err) {
7268                        sleep(d).await;
7269                        continue;
7270                    }
7271                    dlg.finished(false);
7272                    return Err(client::Error::HttpError(err))
7273                }
7274                Ok(mut res) => {
7275                    if !res.status().is_success() {
7276                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7277                        let (parts, _) = res.into_parts();
7278                        let body = hyper::Body::from(res_body_string.clone());
7279                        let restored_response = hyper::Response::from_parts(parts, body);
7280
7281                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7282
7283                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7284                            sleep(d).await;
7285                            continue;
7286                        }
7287
7288                        dlg.finished(false);
7289
7290                        return match server_response {
7291                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
7292                            None => Err(client::Error::Failure(restored_response)),
7293                        }
7294                    }
7295                    let result_value = {
7296                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7297
7298                        match json::from_str(&res_body_string) {
7299                            Ok(decoded) => (res, decoded),
7300                            Err(err) => {
7301                                dlg.response_json_decode_error(&res_body_string, &err);
7302                                return Err(client::Error::JsonDecodeError(res_body_string, err));
7303                            }
7304                        }
7305                    };
7306
7307                    dlg.finished(true);
7308                    return Ok(result_value)
7309                }
7310            }
7311        }
7312    }
7313
7314
7315    /// Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings"
7316    ///
7317    /// Sets the *name* path property to the given value.
7318    ///
7319    /// Even though the property as already been set when instantiating this call,
7320    /// we provide this method for API completeness.
7321    pub fn name(mut self, new_value: &str) -> AccountGetDataSharingSettingCall<'a, S> {
7322        self._name = new_value.to_string();
7323        self
7324    }
7325    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7326    /// while executing the actual API request.
7327    /// 
7328    /// ````text
7329    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7330    /// ````
7331    ///
7332    /// Sets the *delegate* property to the given value.
7333    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountGetDataSharingSettingCall<'a, S> {
7334        self._delegate = Some(new_value);
7335        self
7336    }
7337
7338    /// Set any additional parameter of the query string used in the request.
7339    /// It should be used to set parameters which are not yet available through their own
7340    /// setters.
7341    ///
7342    /// Please note that this method must not be used to set any of the known parameters
7343    /// which have their own setter method. If done anyway, the request will fail.
7344    ///
7345    /// # Additional Parameters
7346    ///
7347    /// * *$.xgafv* (query-string) - V1 error format.
7348    /// * *access_token* (query-string) - OAuth access token.
7349    /// * *alt* (query-string) - Data format for response.
7350    /// * *callback* (query-string) - JSONP
7351    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7352    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7353    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7354    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7355    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7356    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7357    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7358    pub fn param<T>(mut self, name: T, value: T) -> AccountGetDataSharingSettingCall<'a, S>
7359                                                        where T: AsRef<str> {
7360        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7361        self
7362    }
7363
7364    /// Identifies the authorization scope for the method you are building.
7365    ///
7366    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7367    /// [`Scope::AnalyticReadonly`].
7368    ///
7369    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7370    /// tokens for more than one scope.
7371    ///
7372    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7373    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7374    /// sufficient, a read-write scope will do as well.
7375    pub fn add_scope<St>(mut self, scope: St) -> AccountGetDataSharingSettingCall<'a, S>
7376                                                        where St: AsRef<str> {
7377        self._scopes.insert(String::from(scope.as_ref()));
7378        self
7379    }
7380    /// Identifies the authorization scope(s) for the method you are building.
7381    ///
7382    /// See [`Self::add_scope()`] for details.
7383    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetDataSharingSettingCall<'a, S>
7384                                                        where I: IntoIterator<Item = St>,
7385                                                         St: AsRef<str> {
7386        self._scopes
7387            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7388        self
7389    }
7390
7391    /// Removes all scopes, and no default scope will be used either.
7392    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7393    /// for details).
7394    pub fn clear_scopes(mut self) -> AccountGetDataSharingSettingCall<'a, S> {
7395        self._scopes.clear();
7396        self
7397    }
7398}
7399
7400
7401/// Returns all accounts accessible by the caller. Note that these accounts might not currently have GA4 properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.
7402///
7403/// A builder for the *list* method supported by a *account* resource.
7404/// It is not used directly, but through a [`AccountMethods`] instance.
7405///
7406/// # Example
7407///
7408/// Instantiate a resource method builder
7409///
7410/// ```test_harness,no_run
7411/// # extern crate hyper;
7412/// # extern crate hyper_rustls;
7413/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
7414/// # async fn dox() {
7415/// # use std::default::Default;
7416/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7417/// 
7418/// # let secret: oauth2::ApplicationSecret = Default::default();
7419/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7420/// #         secret,
7421/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7422/// #     ).build().await.unwrap();
7423/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7424/// // You can configure optional parameters by calling the respective setters at will, and
7425/// // execute the final call using `doit()`.
7426/// // Values shown here are possibly random and not representative !
7427/// let result = hub.accounts().list()
7428///              .show_deleted(true)
7429///              .page_token("sed")
7430///              .page_size(-37)
7431///              .doit().await;
7432/// # }
7433/// ```
7434pub struct AccountListCall<'a, S>
7435    where S: 'a {
7436
7437    hub: &'a GoogleAnalyticsAdmin<S>,
7438    _show_deleted: Option<bool>,
7439    _page_token: Option<String>,
7440    _page_size: Option<i32>,
7441    _delegate: Option<&'a mut dyn client::Delegate>,
7442    _additional_params: HashMap<String, String>,
7443    _scopes: BTreeSet<String>
7444}
7445
7446impl<'a, S> client::CallBuilder for AccountListCall<'a, S> {}
7447
7448impl<'a, S> AccountListCall<'a, S>
7449where
7450    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7451    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7452    S::Future: Send + Unpin + 'static,
7453    S::Error: Into<Box<dyn StdError + Send + Sync>>,
7454{
7455
7456
7457    /// Perform the operation you have build so far.
7458    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListAccountsResponse)> {
7459        use std::io::{Read, Seek};
7460        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7461        use client::{ToParts, url::Params};
7462        use std::borrow::Cow;
7463
7464        let mut dd = client::DefaultDelegate;
7465        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7466        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.list",
7467                               http_method: hyper::Method::GET });
7468
7469        for &field in ["alt", "showDeleted", "pageToken", "pageSize"].iter() {
7470            if self._additional_params.contains_key(field) {
7471                dlg.finished(false);
7472                return Err(client::Error::FieldClash(field));
7473            }
7474        }
7475
7476        let mut params = Params::with_capacity(5 + self._additional_params.len());
7477        if let Some(value) = self._show_deleted.as_ref() {
7478            params.push("showDeleted", value.to_string());
7479        }
7480        if let Some(value) = self._page_token.as_ref() {
7481            params.push("pageToken", value);
7482        }
7483        if let Some(value) = self._page_size.as_ref() {
7484            params.push("pageSize", value.to_string());
7485        }
7486
7487        params.extend(self._additional_params.iter());
7488
7489        params.push("alt", "json");
7490        let mut url = self.hub._base_url.clone() + "v1alpha/accounts";
7491        if self._scopes.is_empty() {
7492            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
7493        }
7494
7495
7496        let url = params.parse_with_url(&url);
7497
7498
7499
7500        loop {
7501            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7502                Ok(token) => token,
7503                Err(e) => {
7504                    match dlg.token(e) {
7505                        Ok(token) => token,
7506                        Err(e) => {
7507                            dlg.finished(false);
7508                            return Err(client::Error::MissingToken(e));
7509                        }
7510                    }
7511                }
7512            };
7513            let mut req_result = {
7514                let client = &self.hub.client;
7515                dlg.pre_request();
7516                let mut req_builder = hyper::Request::builder()
7517                    .method(hyper::Method::GET)
7518                    .uri(url.as_str())
7519                    .header(USER_AGENT, self.hub._user_agent.clone());
7520
7521                if let Some(token) = token.as_ref() {
7522                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7523                }
7524
7525
7526                        let request = req_builder
7527                        .body(hyper::body::Body::empty());
7528
7529                client.request(request.unwrap()).await
7530
7531            };
7532
7533            match req_result {
7534                Err(err) => {
7535                    if let client::Retry::After(d) = dlg.http_error(&err) {
7536                        sleep(d).await;
7537                        continue;
7538                    }
7539                    dlg.finished(false);
7540                    return Err(client::Error::HttpError(err))
7541                }
7542                Ok(mut res) => {
7543                    if !res.status().is_success() {
7544                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7545                        let (parts, _) = res.into_parts();
7546                        let body = hyper::Body::from(res_body_string.clone());
7547                        let restored_response = hyper::Response::from_parts(parts, body);
7548
7549                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7550
7551                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7552                            sleep(d).await;
7553                            continue;
7554                        }
7555
7556                        dlg.finished(false);
7557
7558                        return match server_response {
7559                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
7560                            None => Err(client::Error::Failure(restored_response)),
7561                        }
7562                    }
7563                    let result_value = {
7564                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7565
7566                        match json::from_str(&res_body_string) {
7567                            Ok(decoded) => (res, decoded),
7568                            Err(err) => {
7569                                dlg.response_json_decode_error(&res_body_string, &err);
7570                                return Err(client::Error::JsonDecodeError(res_body_string, err));
7571                            }
7572                        }
7573                    };
7574
7575                    dlg.finished(true);
7576                    return Ok(result_value)
7577                }
7578            }
7579        }
7580    }
7581
7582
7583    /// Whether to include soft-deleted (ie: "trashed") Accounts in the results. Accounts can be inspected to determine whether they are deleted or not.
7584    ///
7585    /// Sets the *show deleted* query property to the given value.
7586    pub fn show_deleted(mut self, new_value: bool) -> AccountListCall<'a, S> {
7587        self._show_deleted = Some(new_value);
7588        self
7589    }
7590    /// A page token, received from a previous `ListAccounts` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAccounts` must match the call that provided the page token.
7591    ///
7592    /// Sets the *page token* query property to the given value.
7593    pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, S> {
7594        self._page_token = Some(new_value.to_string());
7595        self
7596    }
7597    /// The maximum number of resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
7598    ///
7599    /// Sets the *page size* query property to the given value.
7600    pub fn page_size(mut self, new_value: i32) -> AccountListCall<'a, S> {
7601        self._page_size = Some(new_value);
7602        self
7603    }
7604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7605    /// while executing the actual API request.
7606    /// 
7607    /// ````text
7608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7609    /// ````
7610    ///
7611    /// Sets the *delegate* property to the given value.
7612    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountListCall<'a, S> {
7613        self._delegate = Some(new_value);
7614        self
7615    }
7616
7617    /// Set any additional parameter of the query string used in the request.
7618    /// It should be used to set parameters which are not yet available through their own
7619    /// setters.
7620    ///
7621    /// Please note that this method must not be used to set any of the known parameters
7622    /// which have their own setter method. If done anyway, the request will fail.
7623    ///
7624    /// # Additional Parameters
7625    ///
7626    /// * *$.xgafv* (query-string) - V1 error format.
7627    /// * *access_token* (query-string) - OAuth access token.
7628    /// * *alt* (query-string) - Data format for response.
7629    /// * *callback* (query-string) - JSONP
7630    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7631    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7632    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7633    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7634    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7635    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7636    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7637    pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, S>
7638                                                        where T: AsRef<str> {
7639        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7640        self
7641    }
7642
7643    /// Identifies the authorization scope for the method you are building.
7644    ///
7645    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7646    /// [`Scope::AnalyticReadonly`].
7647    ///
7648    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7649    /// tokens for more than one scope.
7650    ///
7651    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7652    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7653    /// sufficient, a read-write scope will do as well.
7654    pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, S>
7655                                                        where St: AsRef<str> {
7656        self._scopes.insert(String::from(scope.as_ref()));
7657        self
7658    }
7659    /// Identifies the authorization scope(s) for the method you are building.
7660    ///
7661    /// See [`Self::add_scope()`] for details.
7662    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, S>
7663                                                        where I: IntoIterator<Item = St>,
7664                                                         St: AsRef<str> {
7665        self._scopes
7666            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7667        self
7668    }
7669
7670    /// Removes all scopes, and no default scope will be used either.
7671    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7672    /// for details).
7673    pub fn clear_scopes(mut self) -> AccountListCall<'a, S> {
7674        self._scopes.clear();
7675        self
7676    }
7677}
7678
7679
7680/// Updates an account.
7681///
7682/// A builder for the *patch* method supported by a *account* resource.
7683/// It is not used directly, but through a [`AccountMethods`] instance.
7684///
7685/// # Example
7686///
7687/// Instantiate a resource method builder
7688///
7689/// ```test_harness,no_run
7690/// # extern crate hyper;
7691/// # extern crate hyper_rustls;
7692/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
7693/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaAccount;
7694/// # async fn dox() {
7695/// # use std::default::Default;
7696/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7697/// 
7698/// # let secret: oauth2::ApplicationSecret = Default::default();
7699/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7700/// #         secret,
7701/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7702/// #     ).build().await.unwrap();
7703/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7704/// // As the method needs a request, you would usually fill it with the desired information
7705/// // into the respective structure. Some of the parts shown here might not be applicable !
7706/// // Values shown here are possibly random and not representative !
7707/// let mut req = GoogleAnalyticsAdminV1alphaAccount::default();
7708/// 
7709/// // You can configure optional parameters by calling the respective setters at will, and
7710/// // execute the final call using `doit()`.
7711/// // Values shown here are possibly random and not representative !
7712/// let result = hub.accounts().patch(req, "name")
7713///              .update_mask(&Default::default())
7714///              .doit().await;
7715/// # }
7716/// ```
7717pub struct AccountPatchCall<'a, S>
7718    where S: 'a {
7719
7720    hub: &'a GoogleAnalyticsAdmin<S>,
7721    _request: GoogleAnalyticsAdminV1alphaAccount,
7722    _name: String,
7723    _update_mask: Option<client::FieldMask>,
7724    _delegate: Option<&'a mut dyn client::Delegate>,
7725    _additional_params: HashMap<String, String>,
7726    _scopes: BTreeSet<String>
7727}
7728
7729impl<'a, S> client::CallBuilder for AccountPatchCall<'a, S> {}
7730
7731impl<'a, S> AccountPatchCall<'a, S>
7732where
7733    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7734    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7735    S::Future: Send + Unpin + 'static,
7736    S::Error: Into<Box<dyn StdError + Send + Sync>>,
7737{
7738
7739
7740    /// Perform the operation you have build so far.
7741    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaAccount)> {
7742        use std::io::{Read, Seek};
7743        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7744        use client::{ToParts, url::Params};
7745        use std::borrow::Cow;
7746
7747        let mut dd = client::DefaultDelegate;
7748        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7749        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.patch",
7750                               http_method: hyper::Method::PATCH });
7751
7752        for &field in ["alt", "name", "updateMask"].iter() {
7753            if self._additional_params.contains_key(field) {
7754                dlg.finished(false);
7755                return Err(client::Error::FieldClash(field));
7756            }
7757        }
7758
7759        let mut params = Params::with_capacity(5 + self._additional_params.len());
7760        params.push("name", self._name);
7761        if let Some(value) = self._update_mask.as_ref() {
7762            params.push("updateMask", value.to_string());
7763        }
7764
7765        params.extend(self._additional_params.iter());
7766
7767        params.push("alt", "json");
7768        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
7769        if self._scopes.is_empty() {
7770            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
7771        }
7772
7773        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7774            url = params.uri_replacement(url, param_name, find_this, true);
7775        }
7776        {
7777            let to_remove = ["name"];
7778            params.remove_params(&to_remove);
7779        }
7780
7781        let url = params.parse_with_url(&url);
7782
7783        let mut json_mime_type = mime::APPLICATION_JSON;
7784        let mut request_value_reader =
7785            {
7786                let mut value = json::value::to_value(&self._request).expect("serde to work");
7787                client::remove_json_null_values(&mut value);
7788                let mut dst = io::Cursor::new(Vec::with_capacity(128));
7789                json::to_writer(&mut dst, &value).unwrap();
7790                dst
7791            };
7792        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
7793        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7794
7795
7796        loop {
7797            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7798                Ok(token) => token,
7799                Err(e) => {
7800                    match dlg.token(e) {
7801                        Ok(token) => token,
7802                        Err(e) => {
7803                            dlg.finished(false);
7804                            return Err(client::Error::MissingToken(e));
7805                        }
7806                    }
7807                }
7808            };
7809            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7810            let mut req_result = {
7811                let client = &self.hub.client;
7812                dlg.pre_request();
7813                let mut req_builder = hyper::Request::builder()
7814                    .method(hyper::Method::PATCH)
7815                    .uri(url.as_str())
7816                    .header(USER_AGENT, self.hub._user_agent.clone());
7817
7818                if let Some(token) = token.as_ref() {
7819                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7820                }
7821
7822
7823                        let request = req_builder
7824                        .header(CONTENT_TYPE, json_mime_type.to_string())
7825                        .header(CONTENT_LENGTH, request_size as u64)
7826                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
7827
7828                client.request(request.unwrap()).await
7829
7830            };
7831
7832            match req_result {
7833                Err(err) => {
7834                    if let client::Retry::After(d) = dlg.http_error(&err) {
7835                        sleep(d).await;
7836                        continue;
7837                    }
7838                    dlg.finished(false);
7839                    return Err(client::Error::HttpError(err))
7840                }
7841                Ok(mut res) => {
7842                    if !res.status().is_success() {
7843                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7844                        let (parts, _) = res.into_parts();
7845                        let body = hyper::Body::from(res_body_string.clone());
7846                        let restored_response = hyper::Response::from_parts(parts, body);
7847
7848                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7849
7850                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7851                            sleep(d).await;
7852                            continue;
7853                        }
7854
7855                        dlg.finished(false);
7856
7857                        return match server_response {
7858                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
7859                            None => Err(client::Error::Failure(restored_response)),
7860                        }
7861                    }
7862                    let result_value = {
7863                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
7864
7865                        match json::from_str(&res_body_string) {
7866                            Ok(decoded) => (res, decoded),
7867                            Err(err) => {
7868                                dlg.response_json_decode_error(&res_body_string, &err);
7869                                return Err(client::Error::JsonDecodeError(res_body_string, err));
7870                            }
7871                        }
7872                    };
7873
7874                    dlg.finished(true);
7875                    return Ok(result_value)
7876                }
7877            }
7878        }
7879    }
7880
7881
7882    ///
7883    /// Sets the *request* property to the given value.
7884    ///
7885    /// Even though the property as already been set when instantiating this call,
7886    /// we provide this method for API completeness.
7887    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaAccount) -> AccountPatchCall<'a, S> {
7888        self._request = new_value;
7889        self
7890    }
7891    /// Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
7892    ///
7893    /// Sets the *name* path property to the given value.
7894    ///
7895    /// Even though the property as already been set when instantiating this call,
7896    /// we provide this method for API completeness.
7897    pub fn name(mut self, new_value: &str) -> AccountPatchCall<'a, S> {
7898        self._name = new_value.to_string();
7899        self
7900    }
7901    /// Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
7902    ///
7903    /// Sets the *update mask* query property to the given value.
7904    pub fn update_mask(mut self, new_value: client::FieldMask) -> AccountPatchCall<'a, S> {
7905        self._update_mask = Some(new_value);
7906        self
7907    }
7908    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7909    /// while executing the actual API request.
7910    /// 
7911    /// ````text
7912    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7913    /// ````
7914    ///
7915    /// Sets the *delegate* property to the given value.
7916    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountPatchCall<'a, S> {
7917        self._delegate = Some(new_value);
7918        self
7919    }
7920
7921    /// Set any additional parameter of the query string used in the request.
7922    /// It should be used to set parameters which are not yet available through their own
7923    /// setters.
7924    ///
7925    /// Please note that this method must not be used to set any of the known parameters
7926    /// which have their own setter method. If done anyway, the request will fail.
7927    ///
7928    /// # Additional Parameters
7929    ///
7930    /// * *$.xgafv* (query-string) - V1 error format.
7931    /// * *access_token* (query-string) - OAuth access token.
7932    /// * *alt* (query-string) - Data format for response.
7933    /// * *callback* (query-string) - JSONP
7934    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7935    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7936    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7937    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7938    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7939    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7940    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7941    pub fn param<T>(mut self, name: T, value: T) -> AccountPatchCall<'a, S>
7942                                                        where T: AsRef<str> {
7943        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7944        self
7945    }
7946
7947    /// Identifies the authorization scope for the method you are building.
7948    ///
7949    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7950    /// [`Scope::AnalyticEdit`].
7951    ///
7952    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7953    /// tokens for more than one scope.
7954    ///
7955    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7956    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7957    /// sufficient, a read-write scope will do as well.
7958    pub fn add_scope<St>(mut self, scope: St) -> AccountPatchCall<'a, S>
7959                                                        where St: AsRef<str> {
7960        self._scopes.insert(String::from(scope.as_ref()));
7961        self
7962    }
7963    /// Identifies the authorization scope(s) for the method you are building.
7964    ///
7965    /// See [`Self::add_scope()`] for details.
7966    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPatchCall<'a, S>
7967                                                        where I: IntoIterator<Item = St>,
7968                                                         St: AsRef<str> {
7969        self._scopes
7970            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7971        self
7972    }
7973
7974    /// Removes all scopes, and no default scope will be used either.
7975    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7976    /// for details).
7977    pub fn clear_scopes(mut self) -> AccountPatchCall<'a, S> {
7978        self._scopes.clear();
7979        self
7980    }
7981}
7982
7983
7984/// Requests a ticket for creating an account.
7985///
7986/// A builder for the *provisionAccountTicket* method supported by a *account* resource.
7987/// It is not used directly, but through a [`AccountMethods`] instance.
7988///
7989/// # Example
7990///
7991/// Instantiate a resource method builder
7992///
7993/// ```test_harness,no_run
7994/// # extern crate hyper;
7995/// # extern crate hyper_rustls;
7996/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
7997/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest;
7998/// # async fn dox() {
7999/// # use std::default::Default;
8000/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8001/// 
8002/// # let secret: oauth2::ApplicationSecret = Default::default();
8003/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8004/// #         secret,
8005/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8006/// #     ).build().await.unwrap();
8007/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8008/// // As the method needs a request, you would usually fill it with the desired information
8009/// // into the respective structure. Some of the parts shown here might not be applicable !
8010/// // Values shown here are possibly random and not representative !
8011/// let mut req = GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest::default();
8012/// 
8013/// // You can configure optional parameters by calling the respective setters at will, and
8014/// // execute the final call using `doit()`.
8015/// // Values shown here are possibly random and not representative !
8016/// let result = hub.accounts().provision_account_ticket(req)
8017///              .doit().await;
8018/// # }
8019/// ```
8020pub struct AccountProvisionAccountTicketCall<'a, S>
8021    where S: 'a {
8022
8023    hub: &'a GoogleAnalyticsAdmin<S>,
8024    _request: GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest,
8025    _delegate: Option<&'a mut dyn client::Delegate>,
8026    _additional_params: HashMap<String, String>,
8027    _scopes: BTreeSet<String>
8028}
8029
8030impl<'a, S> client::CallBuilder for AccountProvisionAccountTicketCall<'a, S> {}
8031
8032impl<'a, S> AccountProvisionAccountTicketCall<'a, S>
8033where
8034    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8035    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8036    S::Future: Send + Unpin + 'static,
8037    S::Error: Into<Box<dyn StdError + Send + Sync>>,
8038{
8039
8040
8041    /// Perform the operation you have build so far.
8042    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaProvisionAccountTicketResponse)> {
8043        use std::io::{Read, Seek};
8044        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8045        use client::{ToParts, url::Params};
8046        use std::borrow::Cow;
8047
8048        let mut dd = client::DefaultDelegate;
8049        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8050        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.provisionAccountTicket",
8051                               http_method: hyper::Method::POST });
8052
8053        for &field in ["alt"].iter() {
8054            if self._additional_params.contains_key(field) {
8055                dlg.finished(false);
8056                return Err(client::Error::FieldClash(field));
8057            }
8058        }
8059
8060        let mut params = Params::with_capacity(3 + self._additional_params.len());
8061
8062        params.extend(self._additional_params.iter());
8063
8064        params.push("alt", "json");
8065        let mut url = self.hub._base_url.clone() + "v1alpha/accounts:provisionAccountTicket";
8066        if self._scopes.is_empty() {
8067            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
8068        }
8069
8070
8071        let url = params.parse_with_url(&url);
8072
8073        let mut json_mime_type = mime::APPLICATION_JSON;
8074        let mut request_value_reader =
8075            {
8076                let mut value = json::value::to_value(&self._request).expect("serde to work");
8077                client::remove_json_null_values(&mut value);
8078                let mut dst = io::Cursor::new(Vec::with_capacity(128));
8079                json::to_writer(&mut dst, &value).unwrap();
8080                dst
8081            };
8082        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
8083        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8084
8085
8086        loop {
8087            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8088                Ok(token) => token,
8089                Err(e) => {
8090                    match dlg.token(e) {
8091                        Ok(token) => token,
8092                        Err(e) => {
8093                            dlg.finished(false);
8094                            return Err(client::Error::MissingToken(e));
8095                        }
8096                    }
8097                }
8098            };
8099            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8100            let mut req_result = {
8101                let client = &self.hub.client;
8102                dlg.pre_request();
8103                let mut req_builder = hyper::Request::builder()
8104                    .method(hyper::Method::POST)
8105                    .uri(url.as_str())
8106                    .header(USER_AGENT, self.hub._user_agent.clone());
8107
8108                if let Some(token) = token.as_ref() {
8109                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8110                }
8111
8112
8113                        let request = req_builder
8114                        .header(CONTENT_TYPE, json_mime_type.to_string())
8115                        .header(CONTENT_LENGTH, request_size as u64)
8116                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
8117
8118                client.request(request.unwrap()).await
8119
8120            };
8121
8122            match req_result {
8123                Err(err) => {
8124                    if let client::Retry::After(d) = dlg.http_error(&err) {
8125                        sleep(d).await;
8126                        continue;
8127                    }
8128                    dlg.finished(false);
8129                    return Err(client::Error::HttpError(err))
8130                }
8131                Ok(mut res) => {
8132                    if !res.status().is_success() {
8133                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8134                        let (parts, _) = res.into_parts();
8135                        let body = hyper::Body::from(res_body_string.clone());
8136                        let restored_response = hyper::Response::from_parts(parts, body);
8137
8138                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8139
8140                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8141                            sleep(d).await;
8142                            continue;
8143                        }
8144
8145                        dlg.finished(false);
8146
8147                        return match server_response {
8148                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
8149                            None => Err(client::Error::Failure(restored_response)),
8150                        }
8151                    }
8152                    let result_value = {
8153                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8154
8155                        match json::from_str(&res_body_string) {
8156                            Ok(decoded) => (res, decoded),
8157                            Err(err) => {
8158                                dlg.response_json_decode_error(&res_body_string, &err);
8159                                return Err(client::Error::JsonDecodeError(res_body_string, err));
8160                            }
8161                        }
8162                    };
8163
8164                    dlg.finished(true);
8165                    return Ok(result_value)
8166                }
8167            }
8168        }
8169    }
8170
8171
8172    ///
8173    /// Sets the *request* property to the given value.
8174    ///
8175    /// Even though the property as already been set when instantiating this call,
8176    /// we provide this method for API completeness.
8177    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaProvisionAccountTicketRequest) -> AccountProvisionAccountTicketCall<'a, S> {
8178        self._request = new_value;
8179        self
8180    }
8181    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8182    /// while executing the actual API request.
8183    /// 
8184    /// ````text
8185    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8186    /// ````
8187    ///
8188    /// Sets the *delegate* property to the given value.
8189    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountProvisionAccountTicketCall<'a, S> {
8190        self._delegate = Some(new_value);
8191        self
8192    }
8193
8194    /// Set any additional parameter of the query string used in the request.
8195    /// It should be used to set parameters which are not yet available through their own
8196    /// setters.
8197    ///
8198    /// Please note that this method must not be used to set any of the known parameters
8199    /// which have their own setter method. If done anyway, the request will fail.
8200    ///
8201    /// # Additional Parameters
8202    ///
8203    /// * *$.xgafv* (query-string) - V1 error format.
8204    /// * *access_token* (query-string) - OAuth access token.
8205    /// * *alt* (query-string) - Data format for response.
8206    /// * *callback* (query-string) - JSONP
8207    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8208    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8209    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8210    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8211    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8212    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8213    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8214    pub fn param<T>(mut self, name: T, value: T) -> AccountProvisionAccountTicketCall<'a, S>
8215                                                        where T: AsRef<str> {
8216        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8217        self
8218    }
8219
8220    /// Identifies the authorization scope for the method you are building.
8221    ///
8222    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8223    /// [`Scope::AnalyticEdit`].
8224    ///
8225    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8226    /// tokens for more than one scope.
8227    ///
8228    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8229    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8230    /// sufficient, a read-write scope will do as well.
8231    pub fn add_scope<St>(mut self, scope: St) -> AccountProvisionAccountTicketCall<'a, S>
8232                                                        where St: AsRef<str> {
8233        self._scopes.insert(String::from(scope.as_ref()));
8234        self
8235    }
8236    /// Identifies the authorization scope(s) for the method you are building.
8237    ///
8238    /// See [`Self::add_scope()`] for details.
8239    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountProvisionAccountTicketCall<'a, S>
8240                                                        where I: IntoIterator<Item = St>,
8241                                                         St: AsRef<str> {
8242        self._scopes
8243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8244        self
8245    }
8246
8247    /// Removes all scopes, and no default scope will be used either.
8248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8249    /// for details).
8250    pub fn clear_scopes(mut self) -> AccountProvisionAccountTicketCall<'a, S> {
8251        self._scopes.clear();
8252        self
8253    }
8254}
8255
8256
8257/// Searches through all changes to an account or its children given the specified set of filters.
8258///
8259/// A builder for the *searchChangeHistoryEvents* method supported by a *account* resource.
8260/// It is not used directly, but through a [`AccountMethods`] instance.
8261///
8262/// # Example
8263///
8264/// Instantiate a resource method builder
8265///
8266/// ```test_harness,no_run
8267/// # extern crate hyper;
8268/// # extern crate hyper_rustls;
8269/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
8270/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest;
8271/// # async fn dox() {
8272/// # use std::default::Default;
8273/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8274/// 
8275/// # let secret: oauth2::ApplicationSecret = Default::default();
8276/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8277/// #         secret,
8278/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8279/// #     ).build().await.unwrap();
8280/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8281/// // As the method needs a request, you would usually fill it with the desired information
8282/// // into the respective structure. Some of the parts shown here might not be applicable !
8283/// // Values shown here are possibly random and not representative !
8284/// let mut req = GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest::default();
8285/// 
8286/// // You can configure optional parameters by calling the respective setters at will, and
8287/// // execute the final call using `doit()`.
8288/// // Values shown here are possibly random and not representative !
8289/// let result = hub.accounts().search_change_history_events(req, "account")
8290///              .doit().await;
8291/// # }
8292/// ```
8293pub struct AccountSearchChangeHistoryEventCall<'a, S>
8294    where S: 'a {
8295
8296    hub: &'a GoogleAnalyticsAdmin<S>,
8297    _request: GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest,
8298    _account: String,
8299    _delegate: Option<&'a mut dyn client::Delegate>,
8300    _additional_params: HashMap<String, String>,
8301    _scopes: BTreeSet<String>
8302}
8303
8304impl<'a, S> client::CallBuilder for AccountSearchChangeHistoryEventCall<'a, S> {}
8305
8306impl<'a, S> AccountSearchChangeHistoryEventCall<'a, S>
8307where
8308    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8309    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8310    S::Future: Send + Unpin + 'static,
8311    S::Error: Into<Box<dyn StdError + Send + Sync>>,
8312{
8313
8314
8315    /// Perform the operation you have build so far.
8316    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsResponse)> {
8317        use std::io::{Read, Seek};
8318        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8319        use client::{ToParts, url::Params};
8320        use std::borrow::Cow;
8321
8322        let mut dd = client::DefaultDelegate;
8323        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8324        dlg.begin(client::MethodInfo { id: "analyticsadmin.accounts.searchChangeHistoryEvents",
8325                               http_method: hyper::Method::POST });
8326
8327        for &field in ["alt", "account"].iter() {
8328            if self._additional_params.contains_key(field) {
8329                dlg.finished(false);
8330                return Err(client::Error::FieldClash(field));
8331            }
8332        }
8333
8334        let mut params = Params::with_capacity(4 + self._additional_params.len());
8335        params.push("account", self._account);
8336
8337        params.extend(self._additional_params.iter());
8338
8339        params.push("alt", "json");
8340        let mut url = self.hub._base_url.clone() + "v1alpha/{+account}:searchChangeHistoryEvents";
8341        if self._scopes.is_empty() {
8342            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
8343        }
8344
8345        for &(find_this, param_name) in [("{+account}", "account")].iter() {
8346            url = params.uri_replacement(url, param_name, find_this, true);
8347        }
8348        {
8349            let to_remove = ["account"];
8350            params.remove_params(&to_remove);
8351        }
8352
8353        let url = params.parse_with_url(&url);
8354
8355        let mut json_mime_type = mime::APPLICATION_JSON;
8356        let mut request_value_reader =
8357            {
8358                let mut value = json::value::to_value(&self._request).expect("serde to work");
8359                client::remove_json_null_values(&mut value);
8360                let mut dst = io::Cursor::new(Vec::with_capacity(128));
8361                json::to_writer(&mut dst, &value).unwrap();
8362                dst
8363            };
8364        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
8365        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8366
8367
8368        loop {
8369            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8370                Ok(token) => token,
8371                Err(e) => {
8372                    match dlg.token(e) {
8373                        Ok(token) => token,
8374                        Err(e) => {
8375                            dlg.finished(false);
8376                            return Err(client::Error::MissingToken(e));
8377                        }
8378                    }
8379                }
8380            };
8381            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8382            let mut req_result = {
8383                let client = &self.hub.client;
8384                dlg.pre_request();
8385                let mut req_builder = hyper::Request::builder()
8386                    .method(hyper::Method::POST)
8387                    .uri(url.as_str())
8388                    .header(USER_AGENT, self.hub._user_agent.clone());
8389
8390                if let Some(token) = token.as_ref() {
8391                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8392                }
8393
8394
8395                        let request = req_builder
8396                        .header(CONTENT_TYPE, json_mime_type.to_string())
8397                        .header(CONTENT_LENGTH, request_size as u64)
8398                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
8399
8400                client.request(request.unwrap()).await
8401
8402            };
8403
8404            match req_result {
8405                Err(err) => {
8406                    if let client::Retry::After(d) = dlg.http_error(&err) {
8407                        sleep(d).await;
8408                        continue;
8409                    }
8410                    dlg.finished(false);
8411                    return Err(client::Error::HttpError(err))
8412                }
8413                Ok(mut res) => {
8414                    if !res.status().is_success() {
8415                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8416                        let (parts, _) = res.into_parts();
8417                        let body = hyper::Body::from(res_body_string.clone());
8418                        let restored_response = hyper::Response::from_parts(parts, body);
8419
8420                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8421
8422                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8423                            sleep(d).await;
8424                            continue;
8425                        }
8426
8427                        dlg.finished(false);
8428
8429                        return match server_response {
8430                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
8431                            None => Err(client::Error::Failure(restored_response)),
8432                        }
8433                    }
8434                    let result_value = {
8435                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8436
8437                        match json::from_str(&res_body_string) {
8438                            Ok(decoded) => (res, decoded),
8439                            Err(err) => {
8440                                dlg.response_json_decode_error(&res_body_string, &err);
8441                                return Err(client::Error::JsonDecodeError(res_body_string, err));
8442                            }
8443                        }
8444                    };
8445
8446                    dlg.finished(true);
8447                    return Ok(result_value)
8448                }
8449            }
8450        }
8451    }
8452
8453
8454    ///
8455    /// Sets the *request* property to the given value.
8456    ///
8457    /// Even though the property as already been set when instantiating this call,
8458    /// we provide this method for API completeness.
8459    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaSearchChangeHistoryEventsRequest) -> AccountSearchChangeHistoryEventCall<'a, S> {
8460        self._request = new_value;
8461        self
8462    }
8463    /// Required. The account resource for which to return change history resources.
8464    ///
8465    /// Sets the *account* path property to the given value.
8466    ///
8467    /// Even though the property as already been set when instantiating this call,
8468    /// we provide this method for API completeness.
8469    pub fn account(mut self, new_value: &str) -> AccountSearchChangeHistoryEventCall<'a, S> {
8470        self._account = new_value.to_string();
8471        self
8472    }
8473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8474    /// while executing the actual API request.
8475    /// 
8476    /// ````text
8477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8478    /// ````
8479    ///
8480    /// Sets the *delegate* property to the given value.
8481    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AccountSearchChangeHistoryEventCall<'a, S> {
8482        self._delegate = Some(new_value);
8483        self
8484    }
8485
8486    /// Set any additional parameter of the query string used in the request.
8487    /// It should be used to set parameters which are not yet available through their own
8488    /// setters.
8489    ///
8490    /// Please note that this method must not be used to set any of the known parameters
8491    /// which have their own setter method. If done anyway, the request will fail.
8492    ///
8493    /// # Additional Parameters
8494    ///
8495    /// * *$.xgafv* (query-string) - V1 error format.
8496    /// * *access_token* (query-string) - OAuth access token.
8497    /// * *alt* (query-string) - Data format for response.
8498    /// * *callback* (query-string) - JSONP
8499    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8500    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8501    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8502    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8503    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8504    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8505    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8506    pub fn param<T>(mut self, name: T, value: T) -> AccountSearchChangeHistoryEventCall<'a, S>
8507                                                        where T: AsRef<str> {
8508        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8509        self
8510    }
8511
8512    /// Identifies the authorization scope for the method you are building.
8513    ///
8514    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8515    /// [`Scope::AnalyticEdit`].
8516    ///
8517    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8518    /// tokens for more than one scope.
8519    ///
8520    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8521    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8522    /// sufficient, a read-write scope will do as well.
8523    pub fn add_scope<St>(mut self, scope: St) -> AccountSearchChangeHistoryEventCall<'a, S>
8524                                                        where St: AsRef<str> {
8525        self._scopes.insert(String::from(scope.as_ref()));
8526        self
8527    }
8528    /// Identifies the authorization scope(s) for the method you are building.
8529    ///
8530    /// See [`Self::add_scope()`] for details.
8531    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountSearchChangeHistoryEventCall<'a, S>
8532                                                        where I: IntoIterator<Item = St>,
8533                                                         St: AsRef<str> {
8534        self._scopes
8535            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8536        self
8537    }
8538
8539    /// Removes all scopes, and no default scope will be used either.
8540    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8541    /// for details).
8542    pub fn clear_scopes(mut self) -> AccountSearchChangeHistoryEventCall<'a, S> {
8543        self._scopes.clear();
8544        self
8545    }
8546}
8547
8548
8549/// Creates a conversion event with the specified attributes.
8550///
8551/// A builder for the *conversionEvents.create* method supported by a *property* resource.
8552/// It is not used directly, but through a [`PropertyMethods`] instance.
8553///
8554/// # Example
8555///
8556/// Instantiate a resource method builder
8557///
8558/// ```test_harness,no_run
8559/// # extern crate hyper;
8560/// # extern crate hyper_rustls;
8561/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
8562/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaConversionEvent;
8563/// # async fn dox() {
8564/// # use std::default::Default;
8565/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8566/// 
8567/// # let secret: oauth2::ApplicationSecret = Default::default();
8568/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8569/// #         secret,
8570/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8571/// #     ).build().await.unwrap();
8572/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8573/// // As the method needs a request, you would usually fill it with the desired information
8574/// // into the respective structure. Some of the parts shown here might not be applicable !
8575/// // Values shown here are possibly random and not representative !
8576/// let mut req = GoogleAnalyticsAdminV1alphaConversionEvent::default();
8577/// 
8578/// // You can configure optional parameters by calling the respective setters at will, and
8579/// // execute the final call using `doit()`.
8580/// // Values shown here are possibly random and not representative !
8581/// let result = hub.properties().conversion_events_create(req, "parent")
8582///              .doit().await;
8583/// # }
8584/// ```
8585pub struct PropertyConversionEventCreateCall<'a, S>
8586    where S: 'a {
8587
8588    hub: &'a GoogleAnalyticsAdmin<S>,
8589    _request: GoogleAnalyticsAdminV1alphaConversionEvent,
8590    _parent: String,
8591    _delegate: Option<&'a mut dyn client::Delegate>,
8592    _additional_params: HashMap<String, String>,
8593    _scopes: BTreeSet<String>
8594}
8595
8596impl<'a, S> client::CallBuilder for PropertyConversionEventCreateCall<'a, S> {}
8597
8598impl<'a, S> PropertyConversionEventCreateCall<'a, S>
8599where
8600    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8601    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8602    S::Future: Send + Unpin + 'static,
8603    S::Error: Into<Box<dyn StdError + Send + Sync>>,
8604{
8605
8606
8607    /// Perform the operation you have build so far.
8608    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaConversionEvent)> {
8609        use std::io::{Read, Seek};
8610        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8611        use client::{ToParts, url::Params};
8612        use std::borrow::Cow;
8613
8614        let mut dd = client::DefaultDelegate;
8615        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8616        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.conversionEvents.create",
8617                               http_method: hyper::Method::POST });
8618
8619        for &field in ["alt", "parent"].iter() {
8620            if self._additional_params.contains_key(field) {
8621                dlg.finished(false);
8622                return Err(client::Error::FieldClash(field));
8623            }
8624        }
8625
8626        let mut params = Params::with_capacity(4 + self._additional_params.len());
8627        params.push("parent", self._parent);
8628
8629        params.extend(self._additional_params.iter());
8630
8631        params.push("alt", "json");
8632        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/conversionEvents";
8633        if self._scopes.is_empty() {
8634            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
8635        }
8636
8637        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8638            url = params.uri_replacement(url, param_name, find_this, true);
8639        }
8640        {
8641            let to_remove = ["parent"];
8642            params.remove_params(&to_remove);
8643        }
8644
8645        let url = params.parse_with_url(&url);
8646
8647        let mut json_mime_type = mime::APPLICATION_JSON;
8648        let mut request_value_reader =
8649            {
8650                let mut value = json::value::to_value(&self._request).expect("serde to work");
8651                client::remove_json_null_values(&mut value);
8652                let mut dst = io::Cursor::new(Vec::with_capacity(128));
8653                json::to_writer(&mut dst, &value).unwrap();
8654                dst
8655            };
8656        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
8657        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8658
8659
8660        loop {
8661            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8662                Ok(token) => token,
8663                Err(e) => {
8664                    match dlg.token(e) {
8665                        Ok(token) => token,
8666                        Err(e) => {
8667                            dlg.finished(false);
8668                            return Err(client::Error::MissingToken(e));
8669                        }
8670                    }
8671                }
8672            };
8673            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
8674            let mut req_result = {
8675                let client = &self.hub.client;
8676                dlg.pre_request();
8677                let mut req_builder = hyper::Request::builder()
8678                    .method(hyper::Method::POST)
8679                    .uri(url.as_str())
8680                    .header(USER_AGENT, self.hub._user_agent.clone());
8681
8682                if let Some(token) = token.as_ref() {
8683                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8684                }
8685
8686
8687                        let request = req_builder
8688                        .header(CONTENT_TYPE, json_mime_type.to_string())
8689                        .header(CONTENT_LENGTH, request_size as u64)
8690                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
8691
8692                client.request(request.unwrap()).await
8693
8694            };
8695
8696            match req_result {
8697                Err(err) => {
8698                    if let client::Retry::After(d) = dlg.http_error(&err) {
8699                        sleep(d).await;
8700                        continue;
8701                    }
8702                    dlg.finished(false);
8703                    return Err(client::Error::HttpError(err))
8704                }
8705                Ok(mut res) => {
8706                    if !res.status().is_success() {
8707                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8708                        let (parts, _) = res.into_parts();
8709                        let body = hyper::Body::from(res_body_string.clone());
8710                        let restored_response = hyper::Response::from_parts(parts, body);
8711
8712                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8713
8714                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8715                            sleep(d).await;
8716                            continue;
8717                        }
8718
8719                        dlg.finished(false);
8720
8721                        return match server_response {
8722                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
8723                            None => Err(client::Error::Failure(restored_response)),
8724                        }
8725                    }
8726                    let result_value = {
8727                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8728
8729                        match json::from_str(&res_body_string) {
8730                            Ok(decoded) => (res, decoded),
8731                            Err(err) => {
8732                                dlg.response_json_decode_error(&res_body_string, &err);
8733                                return Err(client::Error::JsonDecodeError(res_body_string, err));
8734                            }
8735                        }
8736                    };
8737
8738                    dlg.finished(true);
8739                    return Ok(result_value)
8740                }
8741            }
8742        }
8743    }
8744
8745
8746    ///
8747    /// Sets the *request* property to the given value.
8748    ///
8749    /// Even though the property as already been set when instantiating this call,
8750    /// we provide this method for API completeness.
8751    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaConversionEvent) -> PropertyConversionEventCreateCall<'a, S> {
8752        self._request = new_value;
8753        self
8754    }
8755    /// Required. The resource name of the parent property where this conversion event will be created. Format: properties/123
8756    ///
8757    /// Sets the *parent* path property to the given value.
8758    ///
8759    /// Even though the property as already been set when instantiating this call,
8760    /// we provide this method for API completeness.
8761    pub fn parent(mut self, new_value: &str) -> PropertyConversionEventCreateCall<'a, S> {
8762        self._parent = new_value.to_string();
8763        self
8764    }
8765    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8766    /// while executing the actual API request.
8767    /// 
8768    /// ````text
8769    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8770    /// ````
8771    ///
8772    /// Sets the *delegate* property to the given value.
8773    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyConversionEventCreateCall<'a, S> {
8774        self._delegate = Some(new_value);
8775        self
8776    }
8777
8778    /// Set any additional parameter of the query string used in the request.
8779    /// It should be used to set parameters which are not yet available through their own
8780    /// setters.
8781    ///
8782    /// Please note that this method must not be used to set any of the known parameters
8783    /// which have their own setter method. If done anyway, the request will fail.
8784    ///
8785    /// # Additional Parameters
8786    ///
8787    /// * *$.xgafv* (query-string) - V1 error format.
8788    /// * *access_token* (query-string) - OAuth access token.
8789    /// * *alt* (query-string) - Data format for response.
8790    /// * *callback* (query-string) - JSONP
8791    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8792    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8793    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8794    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8795    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8796    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8797    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8798    pub fn param<T>(mut self, name: T, value: T) -> PropertyConversionEventCreateCall<'a, S>
8799                                                        where T: AsRef<str> {
8800        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8801        self
8802    }
8803
8804    /// Identifies the authorization scope for the method you are building.
8805    ///
8806    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8807    /// [`Scope::AnalyticEdit`].
8808    ///
8809    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8810    /// tokens for more than one scope.
8811    ///
8812    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8813    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8814    /// sufficient, a read-write scope will do as well.
8815    pub fn add_scope<St>(mut self, scope: St) -> PropertyConversionEventCreateCall<'a, S>
8816                                                        where St: AsRef<str> {
8817        self._scopes.insert(String::from(scope.as_ref()));
8818        self
8819    }
8820    /// Identifies the authorization scope(s) for the method you are building.
8821    ///
8822    /// See [`Self::add_scope()`] for details.
8823    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyConversionEventCreateCall<'a, S>
8824                                                        where I: IntoIterator<Item = St>,
8825                                                         St: AsRef<str> {
8826        self._scopes
8827            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8828        self
8829    }
8830
8831    /// Removes all scopes, and no default scope will be used either.
8832    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8833    /// for details).
8834    pub fn clear_scopes(mut self) -> PropertyConversionEventCreateCall<'a, S> {
8835        self._scopes.clear();
8836        self
8837    }
8838}
8839
8840
8841/// Deletes a conversion event in a property.
8842///
8843/// A builder for the *conversionEvents.delete* method supported by a *property* resource.
8844/// It is not used directly, but through a [`PropertyMethods`] instance.
8845///
8846/// # Example
8847///
8848/// Instantiate a resource method builder
8849///
8850/// ```test_harness,no_run
8851/// # extern crate hyper;
8852/// # extern crate hyper_rustls;
8853/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
8854/// # async fn dox() {
8855/// # use std::default::Default;
8856/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8857/// 
8858/// # let secret: oauth2::ApplicationSecret = Default::default();
8859/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8860/// #         secret,
8861/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8862/// #     ).build().await.unwrap();
8863/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8864/// // You can configure optional parameters by calling the respective setters at will, and
8865/// // execute the final call using `doit()`.
8866/// // Values shown here are possibly random and not representative !
8867/// let result = hub.properties().conversion_events_delete("name")
8868///              .doit().await;
8869/// # }
8870/// ```
8871pub struct PropertyConversionEventDeleteCall<'a, S>
8872    where S: 'a {
8873
8874    hub: &'a GoogleAnalyticsAdmin<S>,
8875    _name: String,
8876    _delegate: Option<&'a mut dyn client::Delegate>,
8877    _additional_params: HashMap<String, String>,
8878    _scopes: BTreeSet<String>
8879}
8880
8881impl<'a, S> client::CallBuilder for PropertyConversionEventDeleteCall<'a, S> {}
8882
8883impl<'a, S> PropertyConversionEventDeleteCall<'a, S>
8884where
8885    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8886    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8887    S::Future: Send + Unpin + 'static,
8888    S::Error: Into<Box<dyn StdError + Send + Sync>>,
8889{
8890
8891
8892    /// Perform the operation you have build so far.
8893    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
8894        use std::io::{Read, Seek};
8895        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8896        use client::{ToParts, url::Params};
8897        use std::borrow::Cow;
8898
8899        let mut dd = client::DefaultDelegate;
8900        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8901        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.conversionEvents.delete",
8902                               http_method: hyper::Method::DELETE });
8903
8904        for &field in ["alt", "name"].iter() {
8905            if self._additional_params.contains_key(field) {
8906                dlg.finished(false);
8907                return Err(client::Error::FieldClash(field));
8908            }
8909        }
8910
8911        let mut params = Params::with_capacity(3 + self._additional_params.len());
8912        params.push("name", self._name);
8913
8914        params.extend(self._additional_params.iter());
8915
8916        params.push("alt", "json");
8917        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
8918        if self._scopes.is_empty() {
8919            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
8920        }
8921
8922        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8923            url = params.uri_replacement(url, param_name, find_this, true);
8924        }
8925        {
8926            let to_remove = ["name"];
8927            params.remove_params(&to_remove);
8928        }
8929
8930        let url = params.parse_with_url(&url);
8931
8932
8933
8934        loop {
8935            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8936                Ok(token) => token,
8937                Err(e) => {
8938                    match dlg.token(e) {
8939                        Ok(token) => token,
8940                        Err(e) => {
8941                            dlg.finished(false);
8942                            return Err(client::Error::MissingToken(e));
8943                        }
8944                    }
8945                }
8946            };
8947            let mut req_result = {
8948                let client = &self.hub.client;
8949                dlg.pre_request();
8950                let mut req_builder = hyper::Request::builder()
8951                    .method(hyper::Method::DELETE)
8952                    .uri(url.as_str())
8953                    .header(USER_AGENT, self.hub._user_agent.clone());
8954
8955                if let Some(token) = token.as_ref() {
8956                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8957                }
8958
8959
8960                        let request = req_builder
8961                        .body(hyper::body::Body::empty());
8962
8963                client.request(request.unwrap()).await
8964
8965            };
8966
8967            match req_result {
8968                Err(err) => {
8969                    if let client::Retry::After(d) = dlg.http_error(&err) {
8970                        sleep(d).await;
8971                        continue;
8972                    }
8973                    dlg.finished(false);
8974                    return Err(client::Error::HttpError(err))
8975                }
8976                Ok(mut res) => {
8977                    if !res.status().is_success() {
8978                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8979                        let (parts, _) = res.into_parts();
8980                        let body = hyper::Body::from(res_body_string.clone());
8981                        let restored_response = hyper::Response::from_parts(parts, body);
8982
8983                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8984
8985                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8986                            sleep(d).await;
8987                            continue;
8988                        }
8989
8990                        dlg.finished(false);
8991
8992                        return match server_response {
8993                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
8994                            None => Err(client::Error::Failure(restored_response)),
8995                        }
8996                    }
8997                    let result_value = {
8998                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
8999
9000                        match json::from_str(&res_body_string) {
9001                            Ok(decoded) => (res, decoded),
9002                            Err(err) => {
9003                                dlg.response_json_decode_error(&res_body_string, &err);
9004                                return Err(client::Error::JsonDecodeError(res_body_string, err));
9005                            }
9006                        }
9007                    };
9008
9009                    dlg.finished(true);
9010                    return Ok(result_value)
9011                }
9012            }
9013        }
9014    }
9015
9016
9017    /// Required. The resource name of the conversion event to delete. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"
9018    ///
9019    /// Sets the *name* path property to the given value.
9020    ///
9021    /// Even though the property as already been set when instantiating this call,
9022    /// we provide this method for API completeness.
9023    pub fn name(mut self, new_value: &str) -> PropertyConversionEventDeleteCall<'a, S> {
9024        self._name = new_value.to_string();
9025        self
9026    }
9027    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9028    /// while executing the actual API request.
9029    /// 
9030    /// ````text
9031    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9032    /// ````
9033    ///
9034    /// Sets the *delegate* property to the given value.
9035    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyConversionEventDeleteCall<'a, S> {
9036        self._delegate = Some(new_value);
9037        self
9038    }
9039
9040    /// Set any additional parameter of the query string used in the request.
9041    /// It should be used to set parameters which are not yet available through their own
9042    /// setters.
9043    ///
9044    /// Please note that this method must not be used to set any of the known parameters
9045    /// which have their own setter method. If done anyway, the request will fail.
9046    ///
9047    /// # Additional Parameters
9048    ///
9049    /// * *$.xgafv* (query-string) - V1 error format.
9050    /// * *access_token* (query-string) - OAuth access token.
9051    /// * *alt* (query-string) - Data format for response.
9052    /// * *callback* (query-string) - JSONP
9053    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9054    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9055    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9056    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9057    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9058    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9059    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9060    pub fn param<T>(mut self, name: T, value: T) -> PropertyConversionEventDeleteCall<'a, S>
9061                                                        where T: AsRef<str> {
9062        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9063        self
9064    }
9065
9066    /// Identifies the authorization scope for the method you are building.
9067    ///
9068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9069    /// [`Scope::AnalyticEdit`].
9070    ///
9071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9072    /// tokens for more than one scope.
9073    ///
9074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9076    /// sufficient, a read-write scope will do as well.
9077    pub fn add_scope<St>(mut self, scope: St) -> PropertyConversionEventDeleteCall<'a, S>
9078                                                        where St: AsRef<str> {
9079        self._scopes.insert(String::from(scope.as_ref()));
9080        self
9081    }
9082    /// Identifies the authorization scope(s) for the method you are building.
9083    ///
9084    /// See [`Self::add_scope()`] for details.
9085    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyConversionEventDeleteCall<'a, S>
9086                                                        where I: IntoIterator<Item = St>,
9087                                                         St: AsRef<str> {
9088        self._scopes
9089            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9090        self
9091    }
9092
9093    /// Removes all scopes, and no default scope will be used either.
9094    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9095    /// for details).
9096    pub fn clear_scopes(mut self) -> PropertyConversionEventDeleteCall<'a, S> {
9097        self._scopes.clear();
9098        self
9099    }
9100}
9101
9102
9103/// Retrieve a single conversion event.
9104///
9105/// A builder for the *conversionEvents.get* method supported by a *property* resource.
9106/// It is not used directly, but through a [`PropertyMethods`] instance.
9107///
9108/// # Example
9109///
9110/// Instantiate a resource method builder
9111///
9112/// ```test_harness,no_run
9113/// # extern crate hyper;
9114/// # extern crate hyper_rustls;
9115/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
9116/// # async fn dox() {
9117/// # use std::default::Default;
9118/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
9119/// 
9120/// # let secret: oauth2::ApplicationSecret = Default::default();
9121/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
9122/// #         secret,
9123/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9124/// #     ).build().await.unwrap();
9125/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
9126/// // You can configure optional parameters by calling the respective setters at will, and
9127/// // execute the final call using `doit()`.
9128/// // Values shown here are possibly random and not representative !
9129/// let result = hub.properties().conversion_events_get("name")
9130///              .doit().await;
9131/// # }
9132/// ```
9133pub struct PropertyConversionEventGetCall<'a, S>
9134    where S: 'a {
9135
9136    hub: &'a GoogleAnalyticsAdmin<S>,
9137    _name: String,
9138    _delegate: Option<&'a mut dyn client::Delegate>,
9139    _additional_params: HashMap<String, String>,
9140    _scopes: BTreeSet<String>
9141}
9142
9143impl<'a, S> client::CallBuilder for PropertyConversionEventGetCall<'a, S> {}
9144
9145impl<'a, S> PropertyConversionEventGetCall<'a, S>
9146where
9147    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
9148    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
9149    S::Future: Send + Unpin + 'static,
9150    S::Error: Into<Box<dyn StdError + Send + Sync>>,
9151{
9152
9153
9154    /// Perform the operation you have build so far.
9155    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaConversionEvent)> {
9156        use std::io::{Read, Seek};
9157        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
9158        use client::{ToParts, url::Params};
9159        use std::borrow::Cow;
9160
9161        let mut dd = client::DefaultDelegate;
9162        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
9163        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.conversionEvents.get",
9164                               http_method: hyper::Method::GET });
9165
9166        for &field in ["alt", "name"].iter() {
9167            if self._additional_params.contains_key(field) {
9168                dlg.finished(false);
9169                return Err(client::Error::FieldClash(field));
9170            }
9171        }
9172
9173        let mut params = Params::with_capacity(3 + self._additional_params.len());
9174        params.push("name", self._name);
9175
9176        params.extend(self._additional_params.iter());
9177
9178        params.push("alt", "json");
9179        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
9180        if self._scopes.is_empty() {
9181            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
9182        }
9183
9184        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9185            url = params.uri_replacement(url, param_name, find_this, true);
9186        }
9187        {
9188            let to_remove = ["name"];
9189            params.remove_params(&to_remove);
9190        }
9191
9192        let url = params.parse_with_url(&url);
9193
9194
9195
9196        loop {
9197            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
9198                Ok(token) => token,
9199                Err(e) => {
9200                    match dlg.token(e) {
9201                        Ok(token) => token,
9202                        Err(e) => {
9203                            dlg.finished(false);
9204                            return Err(client::Error::MissingToken(e));
9205                        }
9206                    }
9207                }
9208            };
9209            let mut req_result = {
9210                let client = &self.hub.client;
9211                dlg.pre_request();
9212                let mut req_builder = hyper::Request::builder()
9213                    .method(hyper::Method::GET)
9214                    .uri(url.as_str())
9215                    .header(USER_AGENT, self.hub._user_agent.clone());
9216
9217                if let Some(token) = token.as_ref() {
9218                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9219                }
9220
9221
9222                        let request = req_builder
9223                        .body(hyper::body::Body::empty());
9224
9225                client.request(request.unwrap()).await
9226
9227            };
9228
9229            match req_result {
9230                Err(err) => {
9231                    if let client::Retry::After(d) = dlg.http_error(&err) {
9232                        sleep(d).await;
9233                        continue;
9234                    }
9235                    dlg.finished(false);
9236                    return Err(client::Error::HttpError(err))
9237                }
9238                Ok(mut res) => {
9239                    if !res.status().is_success() {
9240                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9241                        let (parts, _) = res.into_parts();
9242                        let body = hyper::Body::from(res_body_string.clone());
9243                        let restored_response = hyper::Response::from_parts(parts, body);
9244
9245                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
9246
9247                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
9248                            sleep(d).await;
9249                            continue;
9250                        }
9251
9252                        dlg.finished(false);
9253
9254                        return match server_response {
9255                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
9256                            None => Err(client::Error::Failure(restored_response)),
9257                        }
9258                    }
9259                    let result_value = {
9260                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9261
9262                        match json::from_str(&res_body_string) {
9263                            Ok(decoded) => (res, decoded),
9264                            Err(err) => {
9265                                dlg.response_json_decode_error(&res_body_string, &err);
9266                                return Err(client::Error::JsonDecodeError(res_body_string, err));
9267                            }
9268                        }
9269                    };
9270
9271                    dlg.finished(true);
9272                    return Ok(result_value)
9273                }
9274            }
9275        }
9276    }
9277
9278
9279    /// Required. The resource name of the conversion event to retrieve. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"
9280    ///
9281    /// Sets the *name* path property to the given value.
9282    ///
9283    /// Even though the property as already been set when instantiating this call,
9284    /// we provide this method for API completeness.
9285    pub fn name(mut self, new_value: &str) -> PropertyConversionEventGetCall<'a, S> {
9286        self._name = new_value.to_string();
9287        self
9288    }
9289    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9290    /// while executing the actual API request.
9291    /// 
9292    /// ````text
9293    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9294    /// ````
9295    ///
9296    /// Sets the *delegate* property to the given value.
9297    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyConversionEventGetCall<'a, S> {
9298        self._delegate = Some(new_value);
9299        self
9300    }
9301
9302    /// Set any additional parameter of the query string used in the request.
9303    /// It should be used to set parameters which are not yet available through their own
9304    /// setters.
9305    ///
9306    /// Please note that this method must not be used to set any of the known parameters
9307    /// which have their own setter method. If done anyway, the request will fail.
9308    ///
9309    /// # Additional Parameters
9310    ///
9311    /// * *$.xgafv* (query-string) - V1 error format.
9312    /// * *access_token* (query-string) - OAuth access token.
9313    /// * *alt* (query-string) - Data format for response.
9314    /// * *callback* (query-string) - JSONP
9315    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9316    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9317    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9318    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9319    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9320    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9321    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9322    pub fn param<T>(mut self, name: T, value: T) -> PropertyConversionEventGetCall<'a, S>
9323                                                        where T: AsRef<str> {
9324        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9325        self
9326    }
9327
9328    /// Identifies the authorization scope for the method you are building.
9329    ///
9330    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9331    /// [`Scope::AnalyticReadonly`].
9332    ///
9333    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9334    /// tokens for more than one scope.
9335    ///
9336    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9337    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9338    /// sufficient, a read-write scope will do as well.
9339    pub fn add_scope<St>(mut self, scope: St) -> PropertyConversionEventGetCall<'a, S>
9340                                                        where St: AsRef<str> {
9341        self._scopes.insert(String::from(scope.as_ref()));
9342        self
9343    }
9344    /// Identifies the authorization scope(s) for the method you are building.
9345    ///
9346    /// See [`Self::add_scope()`] for details.
9347    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyConversionEventGetCall<'a, S>
9348                                                        where I: IntoIterator<Item = St>,
9349                                                         St: AsRef<str> {
9350        self._scopes
9351            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9352        self
9353    }
9354
9355    /// Removes all scopes, and no default scope will be used either.
9356    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9357    /// for details).
9358    pub fn clear_scopes(mut self) -> PropertyConversionEventGetCall<'a, S> {
9359        self._scopes.clear();
9360        self
9361    }
9362}
9363
9364
9365/// Returns a list of conversion events in the specified parent property. Returns an empty list if no conversion events are found.
9366///
9367/// A builder for the *conversionEvents.list* method supported by a *property* resource.
9368/// It is not used directly, but through a [`PropertyMethods`] instance.
9369///
9370/// # Example
9371///
9372/// Instantiate a resource method builder
9373///
9374/// ```test_harness,no_run
9375/// # extern crate hyper;
9376/// # extern crate hyper_rustls;
9377/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
9378/// # async fn dox() {
9379/// # use std::default::Default;
9380/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
9381/// 
9382/// # let secret: oauth2::ApplicationSecret = Default::default();
9383/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
9384/// #         secret,
9385/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9386/// #     ).build().await.unwrap();
9387/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
9388/// // You can configure optional parameters by calling the respective setters at will, and
9389/// // execute the final call using `doit()`.
9390/// // Values shown here are possibly random and not representative !
9391/// let result = hub.properties().conversion_events_list("parent")
9392///              .page_token("gubergren")
9393///              .page_size(-17)
9394///              .doit().await;
9395/// # }
9396/// ```
9397pub struct PropertyConversionEventListCall<'a, S>
9398    where S: 'a {
9399
9400    hub: &'a GoogleAnalyticsAdmin<S>,
9401    _parent: String,
9402    _page_token: Option<String>,
9403    _page_size: Option<i32>,
9404    _delegate: Option<&'a mut dyn client::Delegate>,
9405    _additional_params: HashMap<String, String>,
9406    _scopes: BTreeSet<String>
9407}
9408
9409impl<'a, S> client::CallBuilder for PropertyConversionEventListCall<'a, S> {}
9410
9411impl<'a, S> PropertyConversionEventListCall<'a, S>
9412where
9413    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
9414    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
9415    S::Future: Send + Unpin + 'static,
9416    S::Error: Into<Box<dyn StdError + Send + Sync>>,
9417{
9418
9419
9420    /// Perform the operation you have build so far.
9421    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListConversionEventsResponse)> {
9422        use std::io::{Read, Seek};
9423        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
9424        use client::{ToParts, url::Params};
9425        use std::borrow::Cow;
9426
9427        let mut dd = client::DefaultDelegate;
9428        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
9429        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.conversionEvents.list",
9430                               http_method: hyper::Method::GET });
9431
9432        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9433            if self._additional_params.contains_key(field) {
9434                dlg.finished(false);
9435                return Err(client::Error::FieldClash(field));
9436            }
9437        }
9438
9439        let mut params = Params::with_capacity(5 + self._additional_params.len());
9440        params.push("parent", self._parent);
9441        if let Some(value) = self._page_token.as_ref() {
9442            params.push("pageToken", value);
9443        }
9444        if let Some(value) = self._page_size.as_ref() {
9445            params.push("pageSize", value.to_string());
9446        }
9447
9448        params.extend(self._additional_params.iter());
9449
9450        params.push("alt", "json");
9451        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/conversionEvents";
9452        if self._scopes.is_empty() {
9453            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
9454        }
9455
9456        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9457            url = params.uri_replacement(url, param_name, find_this, true);
9458        }
9459        {
9460            let to_remove = ["parent"];
9461            params.remove_params(&to_remove);
9462        }
9463
9464        let url = params.parse_with_url(&url);
9465
9466
9467
9468        loop {
9469            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
9470                Ok(token) => token,
9471                Err(e) => {
9472                    match dlg.token(e) {
9473                        Ok(token) => token,
9474                        Err(e) => {
9475                            dlg.finished(false);
9476                            return Err(client::Error::MissingToken(e));
9477                        }
9478                    }
9479                }
9480            };
9481            let mut req_result = {
9482                let client = &self.hub.client;
9483                dlg.pre_request();
9484                let mut req_builder = hyper::Request::builder()
9485                    .method(hyper::Method::GET)
9486                    .uri(url.as_str())
9487                    .header(USER_AGENT, self.hub._user_agent.clone());
9488
9489                if let Some(token) = token.as_ref() {
9490                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9491                }
9492
9493
9494                        let request = req_builder
9495                        .body(hyper::body::Body::empty());
9496
9497                client.request(request.unwrap()).await
9498
9499            };
9500
9501            match req_result {
9502                Err(err) => {
9503                    if let client::Retry::After(d) = dlg.http_error(&err) {
9504                        sleep(d).await;
9505                        continue;
9506                    }
9507                    dlg.finished(false);
9508                    return Err(client::Error::HttpError(err))
9509                }
9510                Ok(mut res) => {
9511                    if !res.status().is_success() {
9512                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9513                        let (parts, _) = res.into_parts();
9514                        let body = hyper::Body::from(res_body_string.clone());
9515                        let restored_response = hyper::Response::from_parts(parts, body);
9516
9517                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
9518
9519                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
9520                            sleep(d).await;
9521                            continue;
9522                        }
9523
9524                        dlg.finished(false);
9525
9526                        return match server_response {
9527                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
9528                            None => Err(client::Error::Failure(restored_response)),
9529                        }
9530                    }
9531                    let result_value = {
9532                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9533
9534                        match json::from_str(&res_body_string) {
9535                            Ok(decoded) => (res, decoded),
9536                            Err(err) => {
9537                                dlg.response_json_decode_error(&res_body_string, &err);
9538                                return Err(client::Error::JsonDecodeError(res_body_string, err));
9539                            }
9540                        }
9541                    };
9542
9543                    dlg.finished(true);
9544                    return Ok(result_value)
9545                }
9546            }
9547        }
9548    }
9549
9550
9551    /// Required. The resource name of the parent property. Example: 'properties/123'
9552    ///
9553    /// Sets the *parent* path property to the given value.
9554    ///
9555    /// Even though the property as already been set when instantiating this call,
9556    /// we provide this method for API completeness.
9557    pub fn parent(mut self, new_value: &str) -> PropertyConversionEventListCall<'a, S> {
9558        self._parent = new_value.to_string();
9559        self
9560    }
9561    /// A page token, received from a previous `ListConversionEvents` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListConversionEvents` must match the call that provided the page token.
9562    ///
9563    /// Sets the *page token* query property to the given value.
9564    pub fn page_token(mut self, new_value: &str) -> PropertyConversionEventListCall<'a, S> {
9565        self._page_token = Some(new_value.to_string());
9566        self
9567    }
9568    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
9569    ///
9570    /// Sets the *page size* query property to the given value.
9571    pub fn page_size(mut self, new_value: i32) -> PropertyConversionEventListCall<'a, S> {
9572        self._page_size = Some(new_value);
9573        self
9574    }
9575    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9576    /// while executing the actual API request.
9577    /// 
9578    /// ````text
9579    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9580    /// ````
9581    ///
9582    /// Sets the *delegate* property to the given value.
9583    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyConversionEventListCall<'a, S> {
9584        self._delegate = Some(new_value);
9585        self
9586    }
9587
9588    /// Set any additional parameter of the query string used in the request.
9589    /// It should be used to set parameters which are not yet available through their own
9590    /// setters.
9591    ///
9592    /// Please note that this method must not be used to set any of the known parameters
9593    /// which have their own setter method. If done anyway, the request will fail.
9594    ///
9595    /// # Additional Parameters
9596    ///
9597    /// * *$.xgafv* (query-string) - V1 error format.
9598    /// * *access_token* (query-string) - OAuth access token.
9599    /// * *alt* (query-string) - Data format for response.
9600    /// * *callback* (query-string) - JSONP
9601    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9602    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9603    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9604    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9605    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9606    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9607    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9608    pub fn param<T>(mut self, name: T, value: T) -> PropertyConversionEventListCall<'a, S>
9609                                                        where T: AsRef<str> {
9610        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9611        self
9612    }
9613
9614    /// Identifies the authorization scope for the method you are building.
9615    ///
9616    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9617    /// [`Scope::AnalyticReadonly`].
9618    ///
9619    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9620    /// tokens for more than one scope.
9621    ///
9622    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9623    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9624    /// sufficient, a read-write scope will do as well.
9625    pub fn add_scope<St>(mut self, scope: St) -> PropertyConversionEventListCall<'a, S>
9626                                                        where St: AsRef<str> {
9627        self._scopes.insert(String::from(scope.as_ref()));
9628        self
9629    }
9630    /// Identifies the authorization scope(s) for the method you are building.
9631    ///
9632    /// See [`Self::add_scope()`] for details.
9633    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyConversionEventListCall<'a, S>
9634                                                        where I: IntoIterator<Item = St>,
9635                                                         St: AsRef<str> {
9636        self._scopes
9637            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9638        self
9639    }
9640
9641    /// Removes all scopes, and no default scope will be used either.
9642    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9643    /// for details).
9644    pub fn clear_scopes(mut self) -> PropertyConversionEventListCall<'a, S> {
9645        self._scopes.clear();
9646        self
9647    }
9648}
9649
9650
9651/// Archives a CustomDimension on a property.
9652///
9653/// A builder for the *customDimensions.archive* method supported by a *property* resource.
9654/// It is not used directly, but through a [`PropertyMethods`] instance.
9655///
9656/// # Example
9657///
9658/// Instantiate a resource method builder
9659///
9660/// ```test_harness,no_run
9661/// # extern crate hyper;
9662/// # extern crate hyper_rustls;
9663/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
9664/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest;
9665/// # async fn dox() {
9666/// # use std::default::Default;
9667/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
9668/// 
9669/// # let secret: oauth2::ApplicationSecret = Default::default();
9670/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
9671/// #         secret,
9672/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9673/// #     ).build().await.unwrap();
9674/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
9675/// // As the method needs a request, you would usually fill it with the desired information
9676/// // into the respective structure. Some of the parts shown here might not be applicable !
9677/// // Values shown here are possibly random and not representative !
9678/// let mut req = GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest::default();
9679/// 
9680/// // You can configure optional parameters by calling the respective setters at will, and
9681/// // execute the final call using `doit()`.
9682/// // Values shown here are possibly random and not representative !
9683/// let result = hub.properties().custom_dimensions_archive(req, "name")
9684///              .doit().await;
9685/// # }
9686/// ```
9687pub struct PropertyCustomDimensionArchiveCall<'a, S>
9688    where S: 'a {
9689
9690    hub: &'a GoogleAnalyticsAdmin<S>,
9691    _request: GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest,
9692    _name: String,
9693    _delegate: Option<&'a mut dyn client::Delegate>,
9694    _additional_params: HashMap<String, String>,
9695    _scopes: BTreeSet<String>
9696}
9697
9698impl<'a, S> client::CallBuilder for PropertyCustomDimensionArchiveCall<'a, S> {}
9699
9700impl<'a, S> PropertyCustomDimensionArchiveCall<'a, S>
9701where
9702    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
9703    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
9704    S::Future: Send + Unpin + 'static,
9705    S::Error: Into<Box<dyn StdError + Send + Sync>>,
9706{
9707
9708
9709    /// Perform the operation you have build so far.
9710    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
9711        use std::io::{Read, Seek};
9712        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
9713        use client::{ToParts, url::Params};
9714        use std::borrow::Cow;
9715
9716        let mut dd = client::DefaultDelegate;
9717        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
9718        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customDimensions.archive",
9719                               http_method: hyper::Method::POST });
9720
9721        for &field in ["alt", "name"].iter() {
9722            if self._additional_params.contains_key(field) {
9723                dlg.finished(false);
9724                return Err(client::Error::FieldClash(field));
9725            }
9726        }
9727
9728        let mut params = Params::with_capacity(4 + self._additional_params.len());
9729        params.push("name", self._name);
9730
9731        params.extend(self._additional_params.iter());
9732
9733        params.push("alt", "json");
9734        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}:archive";
9735        if self._scopes.is_empty() {
9736            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
9737        }
9738
9739        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9740            url = params.uri_replacement(url, param_name, find_this, true);
9741        }
9742        {
9743            let to_remove = ["name"];
9744            params.remove_params(&to_remove);
9745        }
9746
9747        let url = params.parse_with_url(&url);
9748
9749        let mut json_mime_type = mime::APPLICATION_JSON;
9750        let mut request_value_reader =
9751            {
9752                let mut value = json::value::to_value(&self._request).expect("serde to work");
9753                client::remove_json_null_values(&mut value);
9754                let mut dst = io::Cursor::new(Vec::with_capacity(128));
9755                json::to_writer(&mut dst, &value).unwrap();
9756                dst
9757            };
9758        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
9759        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
9760
9761
9762        loop {
9763            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
9764                Ok(token) => token,
9765                Err(e) => {
9766                    match dlg.token(e) {
9767                        Ok(token) => token,
9768                        Err(e) => {
9769                            dlg.finished(false);
9770                            return Err(client::Error::MissingToken(e));
9771                        }
9772                    }
9773                }
9774            };
9775            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
9776            let mut req_result = {
9777                let client = &self.hub.client;
9778                dlg.pre_request();
9779                let mut req_builder = hyper::Request::builder()
9780                    .method(hyper::Method::POST)
9781                    .uri(url.as_str())
9782                    .header(USER_AGENT, self.hub._user_agent.clone());
9783
9784                if let Some(token) = token.as_ref() {
9785                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9786                }
9787
9788
9789                        let request = req_builder
9790                        .header(CONTENT_TYPE, json_mime_type.to_string())
9791                        .header(CONTENT_LENGTH, request_size as u64)
9792                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
9793
9794                client.request(request.unwrap()).await
9795
9796            };
9797
9798            match req_result {
9799                Err(err) => {
9800                    if let client::Retry::After(d) = dlg.http_error(&err) {
9801                        sleep(d).await;
9802                        continue;
9803                    }
9804                    dlg.finished(false);
9805                    return Err(client::Error::HttpError(err))
9806                }
9807                Ok(mut res) => {
9808                    if !res.status().is_success() {
9809                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9810                        let (parts, _) = res.into_parts();
9811                        let body = hyper::Body::from(res_body_string.clone());
9812                        let restored_response = hyper::Response::from_parts(parts, body);
9813
9814                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
9815
9816                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
9817                            sleep(d).await;
9818                            continue;
9819                        }
9820
9821                        dlg.finished(false);
9822
9823                        return match server_response {
9824                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
9825                            None => Err(client::Error::Failure(restored_response)),
9826                        }
9827                    }
9828                    let result_value = {
9829                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
9830
9831                        match json::from_str(&res_body_string) {
9832                            Ok(decoded) => (res, decoded),
9833                            Err(err) => {
9834                                dlg.response_json_decode_error(&res_body_string, &err);
9835                                return Err(client::Error::JsonDecodeError(res_body_string, err));
9836                            }
9837                        }
9838                    };
9839
9840                    dlg.finished(true);
9841                    return Ok(result_value)
9842                }
9843            }
9844        }
9845    }
9846
9847
9848    ///
9849    /// Sets the *request* property to the given value.
9850    ///
9851    /// Even though the property as already been set when instantiating this call,
9852    /// we provide this method for API completeness.
9853    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaArchiveCustomDimensionRequest) -> PropertyCustomDimensionArchiveCall<'a, S> {
9854        self._request = new_value;
9855        self
9856    }
9857    /// Required. The name of the CustomDimension to archive. Example format: properties/1234/customDimensions/5678
9858    ///
9859    /// Sets the *name* path property to the given value.
9860    ///
9861    /// Even though the property as already been set when instantiating this call,
9862    /// we provide this method for API completeness.
9863    pub fn name(mut self, new_value: &str) -> PropertyCustomDimensionArchiveCall<'a, S> {
9864        self._name = new_value.to_string();
9865        self
9866    }
9867    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9868    /// while executing the actual API request.
9869    /// 
9870    /// ````text
9871    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9872    /// ````
9873    ///
9874    /// Sets the *delegate* property to the given value.
9875    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomDimensionArchiveCall<'a, S> {
9876        self._delegate = Some(new_value);
9877        self
9878    }
9879
9880    /// Set any additional parameter of the query string used in the request.
9881    /// It should be used to set parameters which are not yet available through their own
9882    /// setters.
9883    ///
9884    /// Please note that this method must not be used to set any of the known parameters
9885    /// which have their own setter method. If done anyway, the request will fail.
9886    ///
9887    /// # Additional Parameters
9888    ///
9889    /// * *$.xgafv* (query-string) - V1 error format.
9890    /// * *access_token* (query-string) - OAuth access token.
9891    /// * *alt* (query-string) - Data format for response.
9892    /// * *callback* (query-string) - JSONP
9893    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9894    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9895    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9896    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9897    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9898    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9899    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9900    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomDimensionArchiveCall<'a, S>
9901                                                        where T: AsRef<str> {
9902        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9903        self
9904    }
9905
9906    /// Identifies the authorization scope for the method you are building.
9907    ///
9908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9909    /// [`Scope::AnalyticEdit`].
9910    ///
9911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9912    /// tokens for more than one scope.
9913    ///
9914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9916    /// sufficient, a read-write scope will do as well.
9917    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomDimensionArchiveCall<'a, S>
9918                                                        where St: AsRef<str> {
9919        self._scopes.insert(String::from(scope.as_ref()));
9920        self
9921    }
9922    /// Identifies the authorization scope(s) for the method you are building.
9923    ///
9924    /// See [`Self::add_scope()`] for details.
9925    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomDimensionArchiveCall<'a, S>
9926                                                        where I: IntoIterator<Item = St>,
9927                                                         St: AsRef<str> {
9928        self._scopes
9929            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9930        self
9931    }
9932
9933    /// Removes all scopes, and no default scope will be used either.
9934    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9935    /// for details).
9936    pub fn clear_scopes(mut self) -> PropertyCustomDimensionArchiveCall<'a, S> {
9937        self._scopes.clear();
9938        self
9939    }
9940}
9941
9942
9943/// Creates a CustomDimension.
9944///
9945/// A builder for the *customDimensions.create* method supported by a *property* resource.
9946/// It is not used directly, but through a [`PropertyMethods`] instance.
9947///
9948/// # Example
9949///
9950/// Instantiate a resource method builder
9951///
9952/// ```test_harness,no_run
9953/// # extern crate hyper;
9954/// # extern crate hyper_rustls;
9955/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
9956/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaCustomDimension;
9957/// # async fn dox() {
9958/// # use std::default::Default;
9959/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
9960/// 
9961/// # let secret: oauth2::ApplicationSecret = Default::default();
9962/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
9963/// #         secret,
9964/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9965/// #     ).build().await.unwrap();
9966/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
9967/// // As the method needs a request, you would usually fill it with the desired information
9968/// // into the respective structure. Some of the parts shown here might not be applicable !
9969/// // Values shown here are possibly random and not representative !
9970/// let mut req = GoogleAnalyticsAdminV1alphaCustomDimension::default();
9971/// 
9972/// // You can configure optional parameters by calling the respective setters at will, and
9973/// // execute the final call using `doit()`.
9974/// // Values shown here are possibly random and not representative !
9975/// let result = hub.properties().custom_dimensions_create(req, "parent")
9976///              .doit().await;
9977/// # }
9978/// ```
9979pub struct PropertyCustomDimensionCreateCall<'a, S>
9980    where S: 'a {
9981
9982    hub: &'a GoogleAnalyticsAdmin<S>,
9983    _request: GoogleAnalyticsAdminV1alphaCustomDimension,
9984    _parent: String,
9985    _delegate: Option<&'a mut dyn client::Delegate>,
9986    _additional_params: HashMap<String, String>,
9987    _scopes: BTreeSet<String>
9988}
9989
9990impl<'a, S> client::CallBuilder for PropertyCustomDimensionCreateCall<'a, S> {}
9991
9992impl<'a, S> PropertyCustomDimensionCreateCall<'a, S>
9993where
9994    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
9995    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
9996    S::Future: Send + Unpin + 'static,
9997    S::Error: Into<Box<dyn StdError + Send + Sync>>,
9998{
9999
10000
10001    /// Perform the operation you have build so far.
10002    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomDimension)> {
10003        use std::io::{Read, Seek};
10004        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
10005        use client::{ToParts, url::Params};
10006        use std::borrow::Cow;
10007
10008        let mut dd = client::DefaultDelegate;
10009        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
10010        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customDimensions.create",
10011                               http_method: hyper::Method::POST });
10012
10013        for &field in ["alt", "parent"].iter() {
10014            if self._additional_params.contains_key(field) {
10015                dlg.finished(false);
10016                return Err(client::Error::FieldClash(field));
10017            }
10018        }
10019
10020        let mut params = Params::with_capacity(4 + self._additional_params.len());
10021        params.push("parent", self._parent);
10022
10023        params.extend(self._additional_params.iter());
10024
10025        params.push("alt", "json");
10026        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/customDimensions";
10027        if self._scopes.is_empty() {
10028            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
10029        }
10030
10031        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10032            url = params.uri_replacement(url, param_name, find_this, true);
10033        }
10034        {
10035            let to_remove = ["parent"];
10036            params.remove_params(&to_remove);
10037        }
10038
10039        let url = params.parse_with_url(&url);
10040
10041        let mut json_mime_type = mime::APPLICATION_JSON;
10042        let mut request_value_reader =
10043            {
10044                let mut value = json::value::to_value(&self._request).expect("serde to work");
10045                client::remove_json_null_values(&mut value);
10046                let mut dst = io::Cursor::new(Vec::with_capacity(128));
10047                json::to_writer(&mut dst, &value).unwrap();
10048                dst
10049            };
10050        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
10051        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
10052
10053
10054        loop {
10055            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
10056                Ok(token) => token,
10057                Err(e) => {
10058                    match dlg.token(e) {
10059                        Ok(token) => token,
10060                        Err(e) => {
10061                            dlg.finished(false);
10062                            return Err(client::Error::MissingToken(e));
10063                        }
10064                    }
10065                }
10066            };
10067            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
10068            let mut req_result = {
10069                let client = &self.hub.client;
10070                dlg.pre_request();
10071                let mut req_builder = hyper::Request::builder()
10072                    .method(hyper::Method::POST)
10073                    .uri(url.as_str())
10074                    .header(USER_AGENT, self.hub._user_agent.clone());
10075
10076                if let Some(token) = token.as_ref() {
10077                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10078                }
10079
10080
10081                        let request = req_builder
10082                        .header(CONTENT_TYPE, json_mime_type.to_string())
10083                        .header(CONTENT_LENGTH, request_size as u64)
10084                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
10085
10086                client.request(request.unwrap()).await
10087
10088            };
10089
10090            match req_result {
10091                Err(err) => {
10092                    if let client::Retry::After(d) = dlg.http_error(&err) {
10093                        sleep(d).await;
10094                        continue;
10095                    }
10096                    dlg.finished(false);
10097                    return Err(client::Error::HttpError(err))
10098                }
10099                Ok(mut res) => {
10100                    if !res.status().is_success() {
10101                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10102                        let (parts, _) = res.into_parts();
10103                        let body = hyper::Body::from(res_body_string.clone());
10104                        let restored_response = hyper::Response::from_parts(parts, body);
10105
10106                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
10107
10108                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
10109                            sleep(d).await;
10110                            continue;
10111                        }
10112
10113                        dlg.finished(false);
10114
10115                        return match server_response {
10116                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
10117                            None => Err(client::Error::Failure(restored_response)),
10118                        }
10119                    }
10120                    let result_value = {
10121                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10122
10123                        match json::from_str(&res_body_string) {
10124                            Ok(decoded) => (res, decoded),
10125                            Err(err) => {
10126                                dlg.response_json_decode_error(&res_body_string, &err);
10127                                return Err(client::Error::JsonDecodeError(res_body_string, err));
10128                            }
10129                        }
10130                    };
10131
10132                    dlg.finished(true);
10133                    return Ok(result_value)
10134                }
10135            }
10136        }
10137    }
10138
10139
10140    ///
10141    /// Sets the *request* property to the given value.
10142    ///
10143    /// Even though the property as already been set when instantiating this call,
10144    /// we provide this method for API completeness.
10145    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaCustomDimension) -> PropertyCustomDimensionCreateCall<'a, S> {
10146        self._request = new_value;
10147        self
10148    }
10149    /// Required. Example format: properties/1234
10150    ///
10151    /// Sets the *parent* path property to the given value.
10152    ///
10153    /// Even though the property as already been set when instantiating this call,
10154    /// we provide this method for API completeness.
10155    pub fn parent(mut self, new_value: &str) -> PropertyCustomDimensionCreateCall<'a, S> {
10156        self._parent = new_value.to_string();
10157        self
10158    }
10159    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10160    /// while executing the actual API request.
10161    /// 
10162    /// ````text
10163    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10164    /// ````
10165    ///
10166    /// Sets the *delegate* property to the given value.
10167    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomDimensionCreateCall<'a, S> {
10168        self._delegate = Some(new_value);
10169        self
10170    }
10171
10172    /// Set any additional parameter of the query string used in the request.
10173    /// It should be used to set parameters which are not yet available through their own
10174    /// setters.
10175    ///
10176    /// Please note that this method must not be used to set any of the known parameters
10177    /// which have their own setter method. If done anyway, the request will fail.
10178    ///
10179    /// # Additional Parameters
10180    ///
10181    /// * *$.xgafv* (query-string) - V1 error format.
10182    /// * *access_token* (query-string) - OAuth access token.
10183    /// * *alt* (query-string) - Data format for response.
10184    /// * *callback* (query-string) - JSONP
10185    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10186    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10187    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10188    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10189    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10190    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10191    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10192    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomDimensionCreateCall<'a, S>
10193                                                        where T: AsRef<str> {
10194        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
10195        self
10196    }
10197
10198    /// Identifies the authorization scope for the method you are building.
10199    ///
10200    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10201    /// [`Scope::AnalyticEdit`].
10202    ///
10203    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10204    /// tokens for more than one scope.
10205    ///
10206    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10207    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10208    /// sufficient, a read-write scope will do as well.
10209    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomDimensionCreateCall<'a, S>
10210                                                        where St: AsRef<str> {
10211        self._scopes.insert(String::from(scope.as_ref()));
10212        self
10213    }
10214    /// Identifies the authorization scope(s) for the method you are building.
10215    ///
10216    /// See [`Self::add_scope()`] for details.
10217    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomDimensionCreateCall<'a, S>
10218                                                        where I: IntoIterator<Item = St>,
10219                                                         St: AsRef<str> {
10220        self._scopes
10221            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10222        self
10223    }
10224
10225    /// Removes all scopes, and no default scope will be used either.
10226    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10227    /// for details).
10228    pub fn clear_scopes(mut self) -> PropertyCustomDimensionCreateCall<'a, S> {
10229        self._scopes.clear();
10230        self
10231    }
10232}
10233
10234
10235/// Lookup for a single CustomDimension.
10236///
10237/// A builder for the *customDimensions.get* method supported by a *property* resource.
10238/// It is not used directly, but through a [`PropertyMethods`] instance.
10239///
10240/// # Example
10241///
10242/// Instantiate a resource method builder
10243///
10244/// ```test_harness,no_run
10245/// # extern crate hyper;
10246/// # extern crate hyper_rustls;
10247/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
10248/// # async fn dox() {
10249/// # use std::default::Default;
10250/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
10251/// 
10252/// # let secret: oauth2::ApplicationSecret = Default::default();
10253/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
10254/// #         secret,
10255/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10256/// #     ).build().await.unwrap();
10257/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
10258/// // You can configure optional parameters by calling the respective setters at will, and
10259/// // execute the final call using `doit()`.
10260/// // Values shown here are possibly random and not representative !
10261/// let result = hub.properties().custom_dimensions_get("name")
10262///              .doit().await;
10263/// # }
10264/// ```
10265pub struct PropertyCustomDimensionGetCall<'a, S>
10266    where S: 'a {
10267
10268    hub: &'a GoogleAnalyticsAdmin<S>,
10269    _name: String,
10270    _delegate: Option<&'a mut dyn client::Delegate>,
10271    _additional_params: HashMap<String, String>,
10272    _scopes: BTreeSet<String>
10273}
10274
10275impl<'a, S> client::CallBuilder for PropertyCustomDimensionGetCall<'a, S> {}
10276
10277impl<'a, S> PropertyCustomDimensionGetCall<'a, S>
10278where
10279    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
10280    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
10281    S::Future: Send + Unpin + 'static,
10282    S::Error: Into<Box<dyn StdError + Send + Sync>>,
10283{
10284
10285
10286    /// Perform the operation you have build so far.
10287    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomDimension)> {
10288        use std::io::{Read, Seek};
10289        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
10290        use client::{ToParts, url::Params};
10291        use std::borrow::Cow;
10292
10293        let mut dd = client::DefaultDelegate;
10294        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
10295        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customDimensions.get",
10296                               http_method: hyper::Method::GET });
10297
10298        for &field in ["alt", "name"].iter() {
10299            if self._additional_params.contains_key(field) {
10300                dlg.finished(false);
10301                return Err(client::Error::FieldClash(field));
10302            }
10303        }
10304
10305        let mut params = Params::with_capacity(3 + self._additional_params.len());
10306        params.push("name", self._name);
10307
10308        params.extend(self._additional_params.iter());
10309
10310        params.push("alt", "json");
10311        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
10312        if self._scopes.is_empty() {
10313            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
10314        }
10315
10316        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10317            url = params.uri_replacement(url, param_name, find_this, true);
10318        }
10319        {
10320            let to_remove = ["name"];
10321            params.remove_params(&to_remove);
10322        }
10323
10324        let url = params.parse_with_url(&url);
10325
10326
10327
10328        loop {
10329            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
10330                Ok(token) => token,
10331                Err(e) => {
10332                    match dlg.token(e) {
10333                        Ok(token) => token,
10334                        Err(e) => {
10335                            dlg.finished(false);
10336                            return Err(client::Error::MissingToken(e));
10337                        }
10338                    }
10339                }
10340            };
10341            let mut req_result = {
10342                let client = &self.hub.client;
10343                dlg.pre_request();
10344                let mut req_builder = hyper::Request::builder()
10345                    .method(hyper::Method::GET)
10346                    .uri(url.as_str())
10347                    .header(USER_AGENT, self.hub._user_agent.clone());
10348
10349                if let Some(token) = token.as_ref() {
10350                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10351                }
10352
10353
10354                        let request = req_builder
10355                        .body(hyper::body::Body::empty());
10356
10357                client.request(request.unwrap()).await
10358
10359            };
10360
10361            match req_result {
10362                Err(err) => {
10363                    if let client::Retry::After(d) = dlg.http_error(&err) {
10364                        sleep(d).await;
10365                        continue;
10366                    }
10367                    dlg.finished(false);
10368                    return Err(client::Error::HttpError(err))
10369                }
10370                Ok(mut res) => {
10371                    if !res.status().is_success() {
10372                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10373                        let (parts, _) = res.into_parts();
10374                        let body = hyper::Body::from(res_body_string.clone());
10375                        let restored_response = hyper::Response::from_parts(parts, body);
10376
10377                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
10378
10379                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
10380                            sleep(d).await;
10381                            continue;
10382                        }
10383
10384                        dlg.finished(false);
10385
10386                        return match server_response {
10387                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
10388                            None => Err(client::Error::Failure(restored_response)),
10389                        }
10390                    }
10391                    let result_value = {
10392                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10393
10394                        match json::from_str(&res_body_string) {
10395                            Ok(decoded) => (res, decoded),
10396                            Err(err) => {
10397                                dlg.response_json_decode_error(&res_body_string, &err);
10398                                return Err(client::Error::JsonDecodeError(res_body_string, err));
10399                            }
10400                        }
10401                    };
10402
10403                    dlg.finished(true);
10404                    return Ok(result_value)
10405                }
10406            }
10407        }
10408    }
10409
10410
10411    /// Required. The name of the CustomDimension to get. Example format: properties/1234/customDimensions/5678
10412    ///
10413    /// Sets the *name* path property to the given value.
10414    ///
10415    /// Even though the property as already been set when instantiating this call,
10416    /// we provide this method for API completeness.
10417    pub fn name(mut self, new_value: &str) -> PropertyCustomDimensionGetCall<'a, S> {
10418        self._name = new_value.to_string();
10419        self
10420    }
10421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10422    /// while executing the actual API request.
10423    /// 
10424    /// ````text
10425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10426    /// ````
10427    ///
10428    /// Sets the *delegate* property to the given value.
10429    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomDimensionGetCall<'a, S> {
10430        self._delegate = Some(new_value);
10431        self
10432    }
10433
10434    /// Set any additional parameter of the query string used in the request.
10435    /// It should be used to set parameters which are not yet available through their own
10436    /// setters.
10437    ///
10438    /// Please note that this method must not be used to set any of the known parameters
10439    /// which have their own setter method. If done anyway, the request will fail.
10440    ///
10441    /// # Additional Parameters
10442    ///
10443    /// * *$.xgafv* (query-string) - V1 error format.
10444    /// * *access_token* (query-string) - OAuth access token.
10445    /// * *alt* (query-string) - Data format for response.
10446    /// * *callback* (query-string) - JSONP
10447    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10448    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10449    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10450    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10451    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10452    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10453    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10454    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomDimensionGetCall<'a, S>
10455                                                        where T: AsRef<str> {
10456        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
10457        self
10458    }
10459
10460    /// Identifies the authorization scope for the method you are building.
10461    ///
10462    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10463    /// [`Scope::AnalyticReadonly`].
10464    ///
10465    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10466    /// tokens for more than one scope.
10467    ///
10468    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10469    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10470    /// sufficient, a read-write scope will do as well.
10471    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomDimensionGetCall<'a, S>
10472                                                        where St: AsRef<str> {
10473        self._scopes.insert(String::from(scope.as_ref()));
10474        self
10475    }
10476    /// Identifies the authorization scope(s) for the method you are building.
10477    ///
10478    /// See [`Self::add_scope()`] for details.
10479    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomDimensionGetCall<'a, S>
10480                                                        where I: IntoIterator<Item = St>,
10481                                                         St: AsRef<str> {
10482        self._scopes
10483            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10484        self
10485    }
10486
10487    /// Removes all scopes, and no default scope will be used either.
10488    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10489    /// for details).
10490    pub fn clear_scopes(mut self) -> PropertyCustomDimensionGetCall<'a, S> {
10491        self._scopes.clear();
10492        self
10493    }
10494}
10495
10496
10497/// Lists CustomDimensions on a property.
10498///
10499/// A builder for the *customDimensions.list* method supported by a *property* resource.
10500/// It is not used directly, but through a [`PropertyMethods`] instance.
10501///
10502/// # Example
10503///
10504/// Instantiate a resource method builder
10505///
10506/// ```test_harness,no_run
10507/// # extern crate hyper;
10508/// # extern crate hyper_rustls;
10509/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
10510/// # async fn dox() {
10511/// # use std::default::Default;
10512/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
10513/// 
10514/// # let secret: oauth2::ApplicationSecret = Default::default();
10515/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
10516/// #         secret,
10517/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10518/// #     ).build().await.unwrap();
10519/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
10520/// // You can configure optional parameters by calling the respective setters at will, and
10521/// // execute the final call using `doit()`.
10522/// // Values shown here are possibly random and not representative !
10523/// let result = hub.properties().custom_dimensions_list("parent")
10524///              .page_token("sed")
10525///              .page_size(-70)
10526///              .doit().await;
10527/// # }
10528/// ```
10529pub struct PropertyCustomDimensionListCall<'a, S>
10530    where S: 'a {
10531
10532    hub: &'a GoogleAnalyticsAdmin<S>,
10533    _parent: String,
10534    _page_token: Option<String>,
10535    _page_size: Option<i32>,
10536    _delegate: Option<&'a mut dyn client::Delegate>,
10537    _additional_params: HashMap<String, String>,
10538    _scopes: BTreeSet<String>
10539}
10540
10541impl<'a, S> client::CallBuilder for PropertyCustomDimensionListCall<'a, S> {}
10542
10543impl<'a, S> PropertyCustomDimensionListCall<'a, S>
10544where
10545    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
10546    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
10547    S::Future: Send + Unpin + 'static,
10548    S::Error: Into<Box<dyn StdError + Send + Sync>>,
10549{
10550
10551
10552    /// Perform the operation you have build so far.
10553    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse)> {
10554        use std::io::{Read, Seek};
10555        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
10556        use client::{ToParts, url::Params};
10557        use std::borrow::Cow;
10558
10559        let mut dd = client::DefaultDelegate;
10560        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
10561        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customDimensions.list",
10562                               http_method: hyper::Method::GET });
10563
10564        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
10565            if self._additional_params.contains_key(field) {
10566                dlg.finished(false);
10567                return Err(client::Error::FieldClash(field));
10568            }
10569        }
10570
10571        let mut params = Params::with_capacity(5 + self._additional_params.len());
10572        params.push("parent", self._parent);
10573        if let Some(value) = self._page_token.as_ref() {
10574            params.push("pageToken", value);
10575        }
10576        if let Some(value) = self._page_size.as_ref() {
10577            params.push("pageSize", value.to_string());
10578        }
10579
10580        params.extend(self._additional_params.iter());
10581
10582        params.push("alt", "json");
10583        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/customDimensions";
10584        if self._scopes.is_empty() {
10585            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
10586        }
10587
10588        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10589            url = params.uri_replacement(url, param_name, find_this, true);
10590        }
10591        {
10592            let to_remove = ["parent"];
10593            params.remove_params(&to_remove);
10594        }
10595
10596        let url = params.parse_with_url(&url);
10597
10598
10599
10600        loop {
10601            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
10602                Ok(token) => token,
10603                Err(e) => {
10604                    match dlg.token(e) {
10605                        Ok(token) => token,
10606                        Err(e) => {
10607                            dlg.finished(false);
10608                            return Err(client::Error::MissingToken(e));
10609                        }
10610                    }
10611                }
10612            };
10613            let mut req_result = {
10614                let client = &self.hub.client;
10615                dlg.pre_request();
10616                let mut req_builder = hyper::Request::builder()
10617                    .method(hyper::Method::GET)
10618                    .uri(url.as_str())
10619                    .header(USER_AGENT, self.hub._user_agent.clone());
10620
10621                if let Some(token) = token.as_ref() {
10622                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10623                }
10624
10625
10626                        let request = req_builder
10627                        .body(hyper::body::Body::empty());
10628
10629                client.request(request.unwrap()).await
10630
10631            };
10632
10633            match req_result {
10634                Err(err) => {
10635                    if let client::Retry::After(d) = dlg.http_error(&err) {
10636                        sleep(d).await;
10637                        continue;
10638                    }
10639                    dlg.finished(false);
10640                    return Err(client::Error::HttpError(err))
10641                }
10642                Ok(mut res) => {
10643                    if !res.status().is_success() {
10644                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10645                        let (parts, _) = res.into_parts();
10646                        let body = hyper::Body::from(res_body_string.clone());
10647                        let restored_response = hyper::Response::from_parts(parts, body);
10648
10649                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
10650
10651                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
10652                            sleep(d).await;
10653                            continue;
10654                        }
10655
10656                        dlg.finished(false);
10657
10658                        return match server_response {
10659                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
10660                            None => Err(client::Error::Failure(restored_response)),
10661                        }
10662                    }
10663                    let result_value = {
10664                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10665
10666                        match json::from_str(&res_body_string) {
10667                            Ok(decoded) => (res, decoded),
10668                            Err(err) => {
10669                                dlg.response_json_decode_error(&res_body_string, &err);
10670                                return Err(client::Error::JsonDecodeError(res_body_string, err));
10671                            }
10672                        }
10673                    };
10674
10675                    dlg.finished(true);
10676                    return Ok(result_value)
10677                }
10678            }
10679        }
10680    }
10681
10682
10683    /// Required. Example format: properties/1234
10684    ///
10685    /// Sets the *parent* path property to the given value.
10686    ///
10687    /// Even though the property as already been set when instantiating this call,
10688    /// we provide this method for API completeness.
10689    pub fn parent(mut self, new_value: &str) -> PropertyCustomDimensionListCall<'a, S> {
10690        self._parent = new_value.to_string();
10691        self
10692    }
10693    /// A page token, received from a previous `ListCustomDimensions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListCustomDimensions` must match the call that provided the page token.
10694    ///
10695    /// Sets the *page token* query property to the given value.
10696    pub fn page_token(mut self, new_value: &str) -> PropertyCustomDimensionListCall<'a, S> {
10697        self._page_token = Some(new_value.to_string());
10698        self
10699    }
10700    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
10701    ///
10702    /// Sets the *page size* query property to the given value.
10703    pub fn page_size(mut self, new_value: i32) -> PropertyCustomDimensionListCall<'a, S> {
10704        self._page_size = Some(new_value);
10705        self
10706    }
10707    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10708    /// while executing the actual API request.
10709    /// 
10710    /// ````text
10711    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10712    /// ````
10713    ///
10714    /// Sets the *delegate* property to the given value.
10715    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomDimensionListCall<'a, S> {
10716        self._delegate = Some(new_value);
10717        self
10718    }
10719
10720    /// Set any additional parameter of the query string used in the request.
10721    /// It should be used to set parameters which are not yet available through their own
10722    /// setters.
10723    ///
10724    /// Please note that this method must not be used to set any of the known parameters
10725    /// which have their own setter method. If done anyway, the request will fail.
10726    ///
10727    /// # Additional Parameters
10728    ///
10729    /// * *$.xgafv* (query-string) - V1 error format.
10730    /// * *access_token* (query-string) - OAuth access token.
10731    /// * *alt* (query-string) - Data format for response.
10732    /// * *callback* (query-string) - JSONP
10733    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10734    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10735    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10736    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10737    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10738    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10739    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10740    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomDimensionListCall<'a, S>
10741                                                        where T: AsRef<str> {
10742        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
10743        self
10744    }
10745
10746    /// Identifies the authorization scope for the method you are building.
10747    ///
10748    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10749    /// [`Scope::AnalyticReadonly`].
10750    ///
10751    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10752    /// tokens for more than one scope.
10753    ///
10754    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10755    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10756    /// sufficient, a read-write scope will do as well.
10757    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomDimensionListCall<'a, S>
10758                                                        where St: AsRef<str> {
10759        self._scopes.insert(String::from(scope.as_ref()));
10760        self
10761    }
10762    /// Identifies the authorization scope(s) for the method you are building.
10763    ///
10764    /// See [`Self::add_scope()`] for details.
10765    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomDimensionListCall<'a, S>
10766                                                        where I: IntoIterator<Item = St>,
10767                                                         St: AsRef<str> {
10768        self._scopes
10769            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10770        self
10771    }
10772
10773    /// Removes all scopes, and no default scope will be used either.
10774    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10775    /// for details).
10776    pub fn clear_scopes(mut self) -> PropertyCustomDimensionListCall<'a, S> {
10777        self._scopes.clear();
10778        self
10779    }
10780}
10781
10782
10783/// Updates a CustomDimension on a property.
10784///
10785/// A builder for the *customDimensions.patch* method supported by a *property* resource.
10786/// It is not used directly, but through a [`PropertyMethods`] instance.
10787///
10788/// # Example
10789///
10790/// Instantiate a resource method builder
10791///
10792/// ```test_harness,no_run
10793/// # extern crate hyper;
10794/// # extern crate hyper_rustls;
10795/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
10796/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaCustomDimension;
10797/// # async fn dox() {
10798/// # use std::default::Default;
10799/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
10800/// 
10801/// # let secret: oauth2::ApplicationSecret = Default::default();
10802/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
10803/// #         secret,
10804/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10805/// #     ).build().await.unwrap();
10806/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
10807/// // As the method needs a request, you would usually fill it with the desired information
10808/// // into the respective structure. Some of the parts shown here might not be applicable !
10809/// // Values shown here are possibly random and not representative !
10810/// let mut req = GoogleAnalyticsAdminV1alphaCustomDimension::default();
10811/// 
10812/// // You can configure optional parameters by calling the respective setters at will, and
10813/// // execute the final call using `doit()`.
10814/// // Values shown here are possibly random and not representative !
10815/// let result = hub.properties().custom_dimensions_patch(req, "name")
10816///              .update_mask(&Default::default())
10817///              .doit().await;
10818/// # }
10819/// ```
10820pub struct PropertyCustomDimensionPatchCall<'a, S>
10821    where S: 'a {
10822
10823    hub: &'a GoogleAnalyticsAdmin<S>,
10824    _request: GoogleAnalyticsAdminV1alphaCustomDimension,
10825    _name: String,
10826    _update_mask: Option<client::FieldMask>,
10827    _delegate: Option<&'a mut dyn client::Delegate>,
10828    _additional_params: HashMap<String, String>,
10829    _scopes: BTreeSet<String>
10830}
10831
10832impl<'a, S> client::CallBuilder for PropertyCustomDimensionPatchCall<'a, S> {}
10833
10834impl<'a, S> PropertyCustomDimensionPatchCall<'a, S>
10835where
10836    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
10837    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
10838    S::Future: Send + Unpin + 'static,
10839    S::Error: Into<Box<dyn StdError + Send + Sync>>,
10840{
10841
10842
10843    /// Perform the operation you have build so far.
10844    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomDimension)> {
10845        use std::io::{Read, Seek};
10846        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
10847        use client::{ToParts, url::Params};
10848        use std::borrow::Cow;
10849
10850        let mut dd = client::DefaultDelegate;
10851        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
10852        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customDimensions.patch",
10853                               http_method: hyper::Method::PATCH });
10854
10855        for &field in ["alt", "name", "updateMask"].iter() {
10856            if self._additional_params.contains_key(field) {
10857                dlg.finished(false);
10858                return Err(client::Error::FieldClash(field));
10859            }
10860        }
10861
10862        let mut params = Params::with_capacity(5 + self._additional_params.len());
10863        params.push("name", self._name);
10864        if let Some(value) = self._update_mask.as_ref() {
10865            params.push("updateMask", value.to_string());
10866        }
10867
10868        params.extend(self._additional_params.iter());
10869
10870        params.push("alt", "json");
10871        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
10872        if self._scopes.is_empty() {
10873            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
10874        }
10875
10876        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10877            url = params.uri_replacement(url, param_name, find_this, true);
10878        }
10879        {
10880            let to_remove = ["name"];
10881            params.remove_params(&to_remove);
10882        }
10883
10884        let url = params.parse_with_url(&url);
10885
10886        let mut json_mime_type = mime::APPLICATION_JSON;
10887        let mut request_value_reader =
10888            {
10889                let mut value = json::value::to_value(&self._request).expect("serde to work");
10890                client::remove_json_null_values(&mut value);
10891                let mut dst = io::Cursor::new(Vec::with_capacity(128));
10892                json::to_writer(&mut dst, &value).unwrap();
10893                dst
10894            };
10895        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
10896        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
10897
10898
10899        loop {
10900            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
10901                Ok(token) => token,
10902                Err(e) => {
10903                    match dlg.token(e) {
10904                        Ok(token) => token,
10905                        Err(e) => {
10906                            dlg.finished(false);
10907                            return Err(client::Error::MissingToken(e));
10908                        }
10909                    }
10910                }
10911            };
10912            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
10913            let mut req_result = {
10914                let client = &self.hub.client;
10915                dlg.pre_request();
10916                let mut req_builder = hyper::Request::builder()
10917                    .method(hyper::Method::PATCH)
10918                    .uri(url.as_str())
10919                    .header(USER_AGENT, self.hub._user_agent.clone());
10920
10921                if let Some(token) = token.as_ref() {
10922                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10923                }
10924
10925
10926                        let request = req_builder
10927                        .header(CONTENT_TYPE, json_mime_type.to_string())
10928                        .header(CONTENT_LENGTH, request_size as u64)
10929                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
10930
10931                client.request(request.unwrap()).await
10932
10933            };
10934
10935            match req_result {
10936                Err(err) => {
10937                    if let client::Retry::After(d) = dlg.http_error(&err) {
10938                        sleep(d).await;
10939                        continue;
10940                    }
10941                    dlg.finished(false);
10942                    return Err(client::Error::HttpError(err))
10943                }
10944                Ok(mut res) => {
10945                    if !res.status().is_success() {
10946                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10947                        let (parts, _) = res.into_parts();
10948                        let body = hyper::Body::from(res_body_string.clone());
10949                        let restored_response = hyper::Response::from_parts(parts, body);
10950
10951                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
10952
10953                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
10954                            sleep(d).await;
10955                            continue;
10956                        }
10957
10958                        dlg.finished(false);
10959
10960                        return match server_response {
10961                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
10962                            None => Err(client::Error::Failure(restored_response)),
10963                        }
10964                    }
10965                    let result_value = {
10966                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
10967
10968                        match json::from_str(&res_body_string) {
10969                            Ok(decoded) => (res, decoded),
10970                            Err(err) => {
10971                                dlg.response_json_decode_error(&res_body_string, &err);
10972                                return Err(client::Error::JsonDecodeError(res_body_string, err));
10973                            }
10974                        }
10975                    };
10976
10977                    dlg.finished(true);
10978                    return Ok(result_value)
10979                }
10980            }
10981        }
10982    }
10983
10984
10985    ///
10986    /// Sets the *request* property to the given value.
10987    ///
10988    /// Even though the property as already been set when instantiating this call,
10989    /// we provide this method for API completeness.
10990    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaCustomDimension) -> PropertyCustomDimensionPatchCall<'a, S> {
10991        self._request = new_value;
10992        self
10993    }
10994    /// Output only. Resource name for this CustomDimension resource. Format: properties/{property}/customDimensions/{customDimension}
10995    ///
10996    /// Sets the *name* path property to the given value.
10997    ///
10998    /// Even though the property as already been set when instantiating this call,
10999    /// we provide this method for API completeness.
11000    pub fn name(mut self, new_value: &str) -> PropertyCustomDimensionPatchCall<'a, S> {
11001        self._name = new_value.to_string();
11002        self
11003    }
11004    /// Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
11005    ///
11006    /// Sets the *update mask* query property to the given value.
11007    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyCustomDimensionPatchCall<'a, S> {
11008        self._update_mask = Some(new_value);
11009        self
11010    }
11011    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11012    /// while executing the actual API request.
11013    /// 
11014    /// ````text
11015    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11016    /// ````
11017    ///
11018    /// Sets the *delegate* property to the given value.
11019    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomDimensionPatchCall<'a, S> {
11020        self._delegate = Some(new_value);
11021        self
11022    }
11023
11024    /// Set any additional parameter of the query string used in the request.
11025    /// It should be used to set parameters which are not yet available through their own
11026    /// setters.
11027    ///
11028    /// Please note that this method must not be used to set any of the known parameters
11029    /// which have their own setter method. If done anyway, the request will fail.
11030    ///
11031    /// # Additional Parameters
11032    ///
11033    /// * *$.xgafv* (query-string) - V1 error format.
11034    /// * *access_token* (query-string) - OAuth access token.
11035    /// * *alt* (query-string) - Data format for response.
11036    /// * *callback* (query-string) - JSONP
11037    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11038    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11039    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11040    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11041    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11042    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11043    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11044    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomDimensionPatchCall<'a, S>
11045                                                        where T: AsRef<str> {
11046        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
11047        self
11048    }
11049
11050    /// Identifies the authorization scope for the method you are building.
11051    ///
11052    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11053    /// [`Scope::AnalyticEdit`].
11054    ///
11055    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11056    /// tokens for more than one scope.
11057    ///
11058    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11059    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11060    /// sufficient, a read-write scope will do as well.
11061    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomDimensionPatchCall<'a, S>
11062                                                        where St: AsRef<str> {
11063        self._scopes.insert(String::from(scope.as_ref()));
11064        self
11065    }
11066    /// Identifies the authorization scope(s) for the method you are building.
11067    ///
11068    /// See [`Self::add_scope()`] for details.
11069    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomDimensionPatchCall<'a, S>
11070                                                        where I: IntoIterator<Item = St>,
11071                                                         St: AsRef<str> {
11072        self._scopes
11073            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11074        self
11075    }
11076
11077    /// Removes all scopes, and no default scope will be used either.
11078    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11079    /// for details).
11080    pub fn clear_scopes(mut self) -> PropertyCustomDimensionPatchCall<'a, S> {
11081        self._scopes.clear();
11082        self
11083    }
11084}
11085
11086
11087/// Archives a CustomMetric on a property.
11088///
11089/// A builder for the *customMetrics.archive* method supported by a *property* resource.
11090/// It is not used directly, but through a [`PropertyMethods`] instance.
11091///
11092/// # Example
11093///
11094/// Instantiate a resource method builder
11095///
11096/// ```test_harness,no_run
11097/// # extern crate hyper;
11098/// # extern crate hyper_rustls;
11099/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
11100/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest;
11101/// # async fn dox() {
11102/// # use std::default::Default;
11103/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
11104/// 
11105/// # let secret: oauth2::ApplicationSecret = Default::default();
11106/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
11107/// #         secret,
11108/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11109/// #     ).build().await.unwrap();
11110/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
11111/// // As the method needs a request, you would usually fill it with the desired information
11112/// // into the respective structure. Some of the parts shown here might not be applicable !
11113/// // Values shown here are possibly random and not representative !
11114/// let mut req = GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest::default();
11115/// 
11116/// // You can configure optional parameters by calling the respective setters at will, and
11117/// // execute the final call using `doit()`.
11118/// // Values shown here are possibly random and not representative !
11119/// let result = hub.properties().custom_metrics_archive(req, "name")
11120///              .doit().await;
11121/// # }
11122/// ```
11123pub struct PropertyCustomMetricArchiveCall<'a, S>
11124    where S: 'a {
11125
11126    hub: &'a GoogleAnalyticsAdmin<S>,
11127    _request: GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest,
11128    _name: String,
11129    _delegate: Option<&'a mut dyn client::Delegate>,
11130    _additional_params: HashMap<String, String>,
11131    _scopes: BTreeSet<String>
11132}
11133
11134impl<'a, S> client::CallBuilder for PropertyCustomMetricArchiveCall<'a, S> {}
11135
11136impl<'a, S> PropertyCustomMetricArchiveCall<'a, S>
11137where
11138    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
11139    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
11140    S::Future: Send + Unpin + 'static,
11141    S::Error: Into<Box<dyn StdError + Send + Sync>>,
11142{
11143
11144
11145    /// Perform the operation you have build so far.
11146    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
11147        use std::io::{Read, Seek};
11148        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
11149        use client::{ToParts, url::Params};
11150        use std::borrow::Cow;
11151
11152        let mut dd = client::DefaultDelegate;
11153        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
11154        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customMetrics.archive",
11155                               http_method: hyper::Method::POST });
11156
11157        for &field in ["alt", "name"].iter() {
11158            if self._additional_params.contains_key(field) {
11159                dlg.finished(false);
11160                return Err(client::Error::FieldClash(field));
11161            }
11162        }
11163
11164        let mut params = Params::with_capacity(4 + self._additional_params.len());
11165        params.push("name", self._name);
11166
11167        params.extend(self._additional_params.iter());
11168
11169        params.push("alt", "json");
11170        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}:archive";
11171        if self._scopes.is_empty() {
11172            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
11173        }
11174
11175        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11176            url = params.uri_replacement(url, param_name, find_this, true);
11177        }
11178        {
11179            let to_remove = ["name"];
11180            params.remove_params(&to_remove);
11181        }
11182
11183        let url = params.parse_with_url(&url);
11184
11185        let mut json_mime_type = mime::APPLICATION_JSON;
11186        let mut request_value_reader =
11187            {
11188                let mut value = json::value::to_value(&self._request).expect("serde to work");
11189                client::remove_json_null_values(&mut value);
11190                let mut dst = io::Cursor::new(Vec::with_capacity(128));
11191                json::to_writer(&mut dst, &value).unwrap();
11192                dst
11193            };
11194        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
11195        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
11196
11197
11198        loop {
11199            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
11200                Ok(token) => token,
11201                Err(e) => {
11202                    match dlg.token(e) {
11203                        Ok(token) => token,
11204                        Err(e) => {
11205                            dlg.finished(false);
11206                            return Err(client::Error::MissingToken(e));
11207                        }
11208                    }
11209                }
11210            };
11211            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
11212            let mut req_result = {
11213                let client = &self.hub.client;
11214                dlg.pre_request();
11215                let mut req_builder = hyper::Request::builder()
11216                    .method(hyper::Method::POST)
11217                    .uri(url.as_str())
11218                    .header(USER_AGENT, self.hub._user_agent.clone());
11219
11220                if let Some(token) = token.as_ref() {
11221                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11222                }
11223
11224
11225                        let request = req_builder
11226                        .header(CONTENT_TYPE, json_mime_type.to_string())
11227                        .header(CONTENT_LENGTH, request_size as u64)
11228                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
11229
11230                client.request(request.unwrap()).await
11231
11232            };
11233
11234            match req_result {
11235                Err(err) => {
11236                    if let client::Retry::After(d) = dlg.http_error(&err) {
11237                        sleep(d).await;
11238                        continue;
11239                    }
11240                    dlg.finished(false);
11241                    return Err(client::Error::HttpError(err))
11242                }
11243                Ok(mut res) => {
11244                    if !res.status().is_success() {
11245                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11246                        let (parts, _) = res.into_parts();
11247                        let body = hyper::Body::from(res_body_string.clone());
11248                        let restored_response = hyper::Response::from_parts(parts, body);
11249
11250                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
11251
11252                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
11253                            sleep(d).await;
11254                            continue;
11255                        }
11256
11257                        dlg.finished(false);
11258
11259                        return match server_response {
11260                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
11261                            None => Err(client::Error::Failure(restored_response)),
11262                        }
11263                    }
11264                    let result_value = {
11265                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11266
11267                        match json::from_str(&res_body_string) {
11268                            Ok(decoded) => (res, decoded),
11269                            Err(err) => {
11270                                dlg.response_json_decode_error(&res_body_string, &err);
11271                                return Err(client::Error::JsonDecodeError(res_body_string, err));
11272                            }
11273                        }
11274                    };
11275
11276                    dlg.finished(true);
11277                    return Ok(result_value)
11278                }
11279            }
11280        }
11281    }
11282
11283
11284    ///
11285    /// Sets the *request* property to the given value.
11286    ///
11287    /// Even though the property as already been set when instantiating this call,
11288    /// we provide this method for API completeness.
11289    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest) -> PropertyCustomMetricArchiveCall<'a, S> {
11290        self._request = new_value;
11291        self
11292    }
11293    /// Required. The name of the CustomMetric to archive. Example format: properties/1234/customMetrics/5678
11294    ///
11295    /// Sets the *name* path property to the given value.
11296    ///
11297    /// Even though the property as already been set when instantiating this call,
11298    /// we provide this method for API completeness.
11299    pub fn name(mut self, new_value: &str) -> PropertyCustomMetricArchiveCall<'a, S> {
11300        self._name = new_value.to_string();
11301        self
11302    }
11303    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11304    /// while executing the actual API request.
11305    /// 
11306    /// ````text
11307    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11308    /// ````
11309    ///
11310    /// Sets the *delegate* property to the given value.
11311    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomMetricArchiveCall<'a, S> {
11312        self._delegate = Some(new_value);
11313        self
11314    }
11315
11316    /// Set any additional parameter of the query string used in the request.
11317    /// It should be used to set parameters which are not yet available through their own
11318    /// setters.
11319    ///
11320    /// Please note that this method must not be used to set any of the known parameters
11321    /// which have their own setter method. If done anyway, the request will fail.
11322    ///
11323    /// # Additional Parameters
11324    ///
11325    /// * *$.xgafv* (query-string) - V1 error format.
11326    /// * *access_token* (query-string) - OAuth access token.
11327    /// * *alt* (query-string) - Data format for response.
11328    /// * *callback* (query-string) - JSONP
11329    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11330    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11331    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11332    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11333    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11334    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11335    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11336    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomMetricArchiveCall<'a, S>
11337                                                        where T: AsRef<str> {
11338        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
11339        self
11340    }
11341
11342    /// Identifies the authorization scope for the method you are building.
11343    ///
11344    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11345    /// [`Scope::AnalyticEdit`].
11346    ///
11347    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11348    /// tokens for more than one scope.
11349    ///
11350    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11351    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11352    /// sufficient, a read-write scope will do as well.
11353    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomMetricArchiveCall<'a, S>
11354                                                        where St: AsRef<str> {
11355        self._scopes.insert(String::from(scope.as_ref()));
11356        self
11357    }
11358    /// Identifies the authorization scope(s) for the method you are building.
11359    ///
11360    /// See [`Self::add_scope()`] for details.
11361    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomMetricArchiveCall<'a, S>
11362                                                        where I: IntoIterator<Item = St>,
11363                                                         St: AsRef<str> {
11364        self._scopes
11365            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11366        self
11367    }
11368
11369    /// Removes all scopes, and no default scope will be used either.
11370    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11371    /// for details).
11372    pub fn clear_scopes(mut self) -> PropertyCustomMetricArchiveCall<'a, S> {
11373        self._scopes.clear();
11374        self
11375    }
11376}
11377
11378
11379/// Creates a CustomMetric.
11380///
11381/// A builder for the *customMetrics.create* method supported by a *property* resource.
11382/// It is not used directly, but through a [`PropertyMethods`] instance.
11383///
11384/// # Example
11385///
11386/// Instantiate a resource method builder
11387///
11388/// ```test_harness,no_run
11389/// # extern crate hyper;
11390/// # extern crate hyper_rustls;
11391/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
11392/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaCustomMetric;
11393/// # async fn dox() {
11394/// # use std::default::Default;
11395/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
11396/// 
11397/// # let secret: oauth2::ApplicationSecret = Default::default();
11398/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
11399/// #         secret,
11400/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11401/// #     ).build().await.unwrap();
11402/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
11403/// // As the method needs a request, you would usually fill it with the desired information
11404/// // into the respective structure. Some of the parts shown here might not be applicable !
11405/// // Values shown here are possibly random and not representative !
11406/// let mut req = GoogleAnalyticsAdminV1alphaCustomMetric::default();
11407/// 
11408/// // You can configure optional parameters by calling the respective setters at will, and
11409/// // execute the final call using `doit()`.
11410/// // Values shown here are possibly random and not representative !
11411/// let result = hub.properties().custom_metrics_create(req, "parent")
11412///              .doit().await;
11413/// # }
11414/// ```
11415pub struct PropertyCustomMetricCreateCall<'a, S>
11416    where S: 'a {
11417
11418    hub: &'a GoogleAnalyticsAdmin<S>,
11419    _request: GoogleAnalyticsAdminV1alphaCustomMetric,
11420    _parent: String,
11421    _delegate: Option<&'a mut dyn client::Delegate>,
11422    _additional_params: HashMap<String, String>,
11423    _scopes: BTreeSet<String>
11424}
11425
11426impl<'a, S> client::CallBuilder for PropertyCustomMetricCreateCall<'a, S> {}
11427
11428impl<'a, S> PropertyCustomMetricCreateCall<'a, S>
11429where
11430    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
11431    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
11432    S::Future: Send + Unpin + 'static,
11433    S::Error: Into<Box<dyn StdError + Send + Sync>>,
11434{
11435
11436
11437    /// Perform the operation you have build so far.
11438    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomMetric)> {
11439        use std::io::{Read, Seek};
11440        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
11441        use client::{ToParts, url::Params};
11442        use std::borrow::Cow;
11443
11444        let mut dd = client::DefaultDelegate;
11445        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
11446        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customMetrics.create",
11447                               http_method: hyper::Method::POST });
11448
11449        for &field in ["alt", "parent"].iter() {
11450            if self._additional_params.contains_key(field) {
11451                dlg.finished(false);
11452                return Err(client::Error::FieldClash(field));
11453            }
11454        }
11455
11456        let mut params = Params::with_capacity(4 + self._additional_params.len());
11457        params.push("parent", self._parent);
11458
11459        params.extend(self._additional_params.iter());
11460
11461        params.push("alt", "json");
11462        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/customMetrics";
11463        if self._scopes.is_empty() {
11464            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
11465        }
11466
11467        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11468            url = params.uri_replacement(url, param_name, find_this, true);
11469        }
11470        {
11471            let to_remove = ["parent"];
11472            params.remove_params(&to_remove);
11473        }
11474
11475        let url = params.parse_with_url(&url);
11476
11477        let mut json_mime_type = mime::APPLICATION_JSON;
11478        let mut request_value_reader =
11479            {
11480                let mut value = json::value::to_value(&self._request).expect("serde to work");
11481                client::remove_json_null_values(&mut value);
11482                let mut dst = io::Cursor::new(Vec::with_capacity(128));
11483                json::to_writer(&mut dst, &value).unwrap();
11484                dst
11485            };
11486        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
11487        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
11488
11489
11490        loop {
11491            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
11492                Ok(token) => token,
11493                Err(e) => {
11494                    match dlg.token(e) {
11495                        Ok(token) => token,
11496                        Err(e) => {
11497                            dlg.finished(false);
11498                            return Err(client::Error::MissingToken(e));
11499                        }
11500                    }
11501                }
11502            };
11503            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
11504            let mut req_result = {
11505                let client = &self.hub.client;
11506                dlg.pre_request();
11507                let mut req_builder = hyper::Request::builder()
11508                    .method(hyper::Method::POST)
11509                    .uri(url.as_str())
11510                    .header(USER_AGENT, self.hub._user_agent.clone());
11511
11512                if let Some(token) = token.as_ref() {
11513                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11514                }
11515
11516
11517                        let request = req_builder
11518                        .header(CONTENT_TYPE, json_mime_type.to_string())
11519                        .header(CONTENT_LENGTH, request_size as u64)
11520                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
11521
11522                client.request(request.unwrap()).await
11523
11524            };
11525
11526            match req_result {
11527                Err(err) => {
11528                    if let client::Retry::After(d) = dlg.http_error(&err) {
11529                        sleep(d).await;
11530                        continue;
11531                    }
11532                    dlg.finished(false);
11533                    return Err(client::Error::HttpError(err))
11534                }
11535                Ok(mut res) => {
11536                    if !res.status().is_success() {
11537                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11538                        let (parts, _) = res.into_parts();
11539                        let body = hyper::Body::from(res_body_string.clone());
11540                        let restored_response = hyper::Response::from_parts(parts, body);
11541
11542                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
11543
11544                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
11545                            sleep(d).await;
11546                            continue;
11547                        }
11548
11549                        dlg.finished(false);
11550
11551                        return match server_response {
11552                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
11553                            None => Err(client::Error::Failure(restored_response)),
11554                        }
11555                    }
11556                    let result_value = {
11557                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11558
11559                        match json::from_str(&res_body_string) {
11560                            Ok(decoded) => (res, decoded),
11561                            Err(err) => {
11562                                dlg.response_json_decode_error(&res_body_string, &err);
11563                                return Err(client::Error::JsonDecodeError(res_body_string, err));
11564                            }
11565                        }
11566                    };
11567
11568                    dlg.finished(true);
11569                    return Ok(result_value)
11570                }
11571            }
11572        }
11573    }
11574
11575
11576    ///
11577    /// Sets the *request* property to the given value.
11578    ///
11579    /// Even though the property as already been set when instantiating this call,
11580    /// we provide this method for API completeness.
11581    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaCustomMetric) -> PropertyCustomMetricCreateCall<'a, S> {
11582        self._request = new_value;
11583        self
11584    }
11585    /// Required. Example format: properties/1234
11586    ///
11587    /// Sets the *parent* path property to the given value.
11588    ///
11589    /// Even though the property as already been set when instantiating this call,
11590    /// we provide this method for API completeness.
11591    pub fn parent(mut self, new_value: &str) -> PropertyCustomMetricCreateCall<'a, S> {
11592        self._parent = new_value.to_string();
11593        self
11594    }
11595    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11596    /// while executing the actual API request.
11597    /// 
11598    /// ````text
11599    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11600    /// ````
11601    ///
11602    /// Sets the *delegate* property to the given value.
11603    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomMetricCreateCall<'a, S> {
11604        self._delegate = Some(new_value);
11605        self
11606    }
11607
11608    /// Set any additional parameter of the query string used in the request.
11609    /// It should be used to set parameters which are not yet available through their own
11610    /// setters.
11611    ///
11612    /// Please note that this method must not be used to set any of the known parameters
11613    /// which have their own setter method. If done anyway, the request will fail.
11614    ///
11615    /// # Additional Parameters
11616    ///
11617    /// * *$.xgafv* (query-string) - V1 error format.
11618    /// * *access_token* (query-string) - OAuth access token.
11619    /// * *alt* (query-string) - Data format for response.
11620    /// * *callback* (query-string) - JSONP
11621    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11622    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11623    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11624    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11625    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11626    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11627    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11628    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomMetricCreateCall<'a, S>
11629                                                        where T: AsRef<str> {
11630        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
11631        self
11632    }
11633
11634    /// Identifies the authorization scope for the method you are building.
11635    ///
11636    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11637    /// [`Scope::AnalyticEdit`].
11638    ///
11639    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11640    /// tokens for more than one scope.
11641    ///
11642    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11643    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11644    /// sufficient, a read-write scope will do as well.
11645    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomMetricCreateCall<'a, S>
11646                                                        where St: AsRef<str> {
11647        self._scopes.insert(String::from(scope.as_ref()));
11648        self
11649    }
11650    /// Identifies the authorization scope(s) for the method you are building.
11651    ///
11652    /// See [`Self::add_scope()`] for details.
11653    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomMetricCreateCall<'a, S>
11654                                                        where I: IntoIterator<Item = St>,
11655                                                         St: AsRef<str> {
11656        self._scopes
11657            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11658        self
11659    }
11660
11661    /// Removes all scopes, and no default scope will be used either.
11662    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11663    /// for details).
11664    pub fn clear_scopes(mut self) -> PropertyCustomMetricCreateCall<'a, S> {
11665        self._scopes.clear();
11666        self
11667    }
11668}
11669
11670
11671/// Lookup for a single CustomMetric.
11672///
11673/// A builder for the *customMetrics.get* method supported by a *property* resource.
11674/// It is not used directly, but through a [`PropertyMethods`] instance.
11675///
11676/// # Example
11677///
11678/// Instantiate a resource method builder
11679///
11680/// ```test_harness,no_run
11681/// # extern crate hyper;
11682/// # extern crate hyper_rustls;
11683/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
11684/// # async fn dox() {
11685/// # use std::default::Default;
11686/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
11687/// 
11688/// # let secret: oauth2::ApplicationSecret = Default::default();
11689/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
11690/// #         secret,
11691/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11692/// #     ).build().await.unwrap();
11693/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
11694/// // You can configure optional parameters by calling the respective setters at will, and
11695/// // execute the final call using `doit()`.
11696/// // Values shown here are possibly random and not representative !
11697/// let result = hub.properties().custom_metrics_get("name")
11698///              .doit().await;
11699/// # }
11700/// ```
11701pub struct PropertyCustomMetricGetCall<'a, S>
11702    where S: 'a {
11703
11704    hub: &'a GoogleAnalyticsAdmin<S>,
11705    _name: String,
11706    _delegate: Option<&'a mut dyn client::Delegate>,
11707    _additional_params: HashMap<String, String>,
11708    _scopes: BTreeSet<String>
11709}
11710
11711impl<'a, S> client::CallBuilder for PropertyCustomMetricGetCall<'a, S> {}
11712
11713impl<'a, S> PropertyCustomMetricGetCall<'a, S>
11714where
11715    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
11716    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
11717    S::Future: Send + Unpin + 'static,
11718    S::Error: Into<Box<dyn StdError + Send + Sync>>,
11719{
11720
11721
11722    /// Perform the operation you have build so far.
11723    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomMetric)> {
11724        use std::io::{Read, Seek};
11725        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
11726        use client::{ToParts, url::Params};
11727        use std::borrow::Cow;
11728
11729        let mut dd = client::DefaultDelegate;
11730        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
11731        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customMetrics.get",
11732                               http_method: hyper::Method::GET });
11733
11734        for &field in ["alt", "name"].iter() {
11735            if self._additional_params.contains_key(field) {
11736                dlg.finished(false);
11737                return Err(client::Error::FieldClash(field));
11738            }
11739        }
11740
11741        let mut params = Params::with_capacity(3 + self._additional_params.len());
11742        params.push("name", self._name);
11743
11744        params.extend(self._additional_params.iter());
11745
11746        params.push("alt", "json");
11747        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
11748        if self._scopes.is_empty() {
11749            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
11750        }
11751
11752        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11753            url = params.uri_replacement(url, param_name, find_this, true);
11754        }
11755        {
11756            let to_remove = ["name"];
11757            params.remove_params(&to_remove);
11758        }
11759
11760        let url = params.parse_with_url(&url);
11761
11762
11763
11764        loop {
11765            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
11766                Ok(token) => token,
11767                Err(e) => {
11768                    match dlg.token(e) {
11769                        Ok(token) => token,
11770                        Err(e) => {
11771                            dlg.finished(false);
11772                            return Err(client::Error::MissingToken(e));
11773                        }
11774                    }
11775                }
11776            };
11777            let mut req_result = {
11778                let client = &self.hub.client;
11779                dlg.pre_request();
11780                let mut req_builder = hyper::Request::builder()
11781                    .method(hyper::Method::GET)
11782                    .uri(url.as_str())
11783                    .header(USER_AGENT, self.hub._user_agent.clone());
11784
11785                if let Some(token) = token.as_ref() {
11786                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11787                }
11788
11789
11790                        let request = req_builder
11791                        .body(hyper::body::Body::empty());
11792
11793                client.request(request.unwrap()).await
11794
11795            };
11796
11797            match req_result {
11798                Err(err) => {
11799                    if let client::Retry::After(d) = dlg.http_error(&err) {
11800                        sleep(d).await;
11801                        continue;
11802                    }
11803                    dlg.finished(false);
11804                    return Err(client::Error::HttpError(err))
11805                }
11806                Ok(mut res) => {
11807                    if !res.status().is_success() {
11808                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11809                        let (parts, _) = res.into_parts();
11810                        let body = hyper::Body::from(res_body_string.clone());
11811                        let restored_response = hyper::Response::from_parts(parts, body);
11812
11813                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
11814
11815                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
11816                            sleep(d).await;
11817                            continue;
11818                        }
11819
11820                        dlg.finished(false);
11821
11822                        return match server_response {
11823                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
11824                            None => Err(client::Error::Failure(restored_response)),
11825                        }
11826                    }
11827                    let result_value = {
11828                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
11829
11830                        match json::from_str(&res_body_string) {
11831                            Ok(decoded) => (res, decoded),
11832                            Err(err) => {
11833                                dlg.response_json_decode_error(&res_body_string, &err);
11834                                return Err(client::Error::JsonDecodeError(res_body_string, err));
11835                            }
11836                        }
11837                    };
11838
11839                    dlg.finished(true);
11840                    return Ok(result_value)
11841                }
11842            }
11843        }
11844    }
11845
11846
11847    /// Required. The name of the CustomMetric to get. Example format: properties/1234/customMetrics/5678
11848    ///
11849    /// Sets the *name* path property to the given value.
11850    ///
11851    /// Even though the property as already been set when instantiating this call,
11852    /// we provide this method for API completeness.
11853    pub fn name(mut self, new_value: &str) -> PropertyCustomMetricGetCall<'a, S> {
11854        self._name = new_value.to_string();
11855        self
11856    }
11857    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11858    /// while executing the actual API request.
11859    /// 
11860    /// ````text
11861    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11862    /// ````
11863    ///
11864    /// Sets the *delegate* property to the given value.
11865    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomMetricGetCall<'a, S> {
11866        self._delegate = Some(new_value);
11867        self
11868    }
11869
11870    /// Set any additional parameter of the query string used in the request.
11871    /// It should be used to set parameters which are not yet available through their own
11872    /// setters.
11873    ///
11874    /// Please note that this method must not be used to set any of the known parameters
11875    /// which have their own setter method. If done anyway, the request will fail.
11876    ///
11877    /// # Additional Parameters
11878    ///
11879    /// * *$.xgafv* (query-string) - V1 error format.
11880    /// * *access_token* (query-string) - OAuth access token.
11881    /// * *alt* (query-string) - Data format for response.
11882    /// * *callback* (query-string) - JSONP
11883    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11884    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11885    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11886    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11887    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11888    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11889    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11890    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomMetricGetCall<'a, S>
11891                                                        where T: AsRef<str> {
11892        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
11893        self
11894    }
11895
11896    /// Identifies the authorization scope for the method you are building.
11897    ///
11898    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11899    /// [`Scope::AnalyticReadonly`].
11900    ///
11901    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11902    /// tokens for more than one scope.
11903    ///
11904    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11905    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11906    /// sufficient, a read-write scope will do as well.
11907    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomMetricGetCall<'a, S>
11908                                                        where St: AsRef<str> {
11909        self._scopes.insert(String::from(scope.as_ref()));
11910        self
11911    }
11912    /// Identifies the authorization scope(s) for the method you are building.
11913    ///
11914    /// See [`Self::add_scope()`] for details.
11915    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomMetricGetCall<'a, S>
11916                                                        where I: IntoIterator<Item = St>,
11917                                                         St: AsRef<str> {
11918        self._scopes
11919            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11920        self
11921    }
11922
11923    /// Removes all scopes, and no default scope will be used either.
11924    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11925    /// for details).
11926    pub fn clear_scopes(mut self) -> PropertyCustomMetricGetCall<'a, S> {
11927        self._scopes.clear();
11928        self
11929    }
11930}
11931
11932
11933/// Lists CustomMetrics on a property.
11934///
11935/// A builder for the *customMetrics.list* method supported by a *property* resource.
11936/// It is not used directly, but through a [`PropertyMethods`] instance.
11937///
11938/// # Example
11939///
11940/// Instantiate a resource method builder
11941///
11942/// ```test_harness,no_run
11943/// # extern crate hyper;
11944/// # extern crate hyper_rustls;
11945/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
11946/// # async fn dox() {
11947/// # use std::default::Default;
11948/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
11949/// 
11950/// # let secret: oauth2::ApplicationSecret = Default::default();
11951/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
11952/// #         secret,
11953/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11954/// #     ).build().await.unwrap();
11955/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
11956/// // You can configure optional parameters by calling the respective setters at will, and
11957/// // execute the final call using `doit()`.
11958/// // Values shown here are possibly random and not representative !
11959/// let result = hub.properties().custom_metrics_list("parent")
11960///              .page_token("sed")
11961///              .page_size(-24)
11962///              .doit().await;
11963/// # }
11964/// ```
11965pub struct PropertyCustomMetricListCall<'a, S>
11966    where S: 'a {
11967
11968    hub: &'a GoogleAnalyticsAdmin<S>,
11969    _parent: String,
11970    _page_token: Option<String>,
11971    _page_size: Option<i32>,
11972    _delegate: Option<&'a mut dyn client::Delegate>,
11973    _additional_params: HashMap<String, String>,
11974    _scopes: BTreeSet<String>
11975}
11976
11977impl<'a, S> client::CallBuilder for PropertyCustomMetricListCall<'a, S> {}
11978
11979impl<'a, S> PropertyCustomMetricListCall<'a, S>
11980where
11981    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
11982    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
11983    S::Future: Send + Unpin + 'static,
11984    S::Error: Into<Box<dyn StdError + Send + Sync>>,
11985{
11986
11987
11988    /// Perform the operation you have build so far.
11989    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListCustomMetricsResponse)> {
11990        use std::io::{Read, Seek};
11991        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
11992        use client::{ToParts, url::Params};
11993        use std::borrow::Cow;
11994
11995        let mut dd = client::DefaultDelegate;
11996        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
11997        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customMetrics.list",
11998                               http_method: hyper::Method::GET });
11999
12000        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
12001            if self._additional_params.contains_key(field) {
12002                dlg.finished(false);
12003                return Err(client::Error::FieldClash(field));
12004            }
12005        }
12006
12007        let mut params = Params::with_capacity(5 + self._additional_params.len());
12008        params.push("parent", self._parent);
12009        if let Some(value) = self._page_token.as_ref() {
12010            params.push("pageToken", value);
12011        }
12012        if let Some(value) = self._page_size.as_ref() {
12013            params.push("pageSize", value.to_string());
12014        }
12015
12016        params.extend(self._additional_params.iter());
12017
12018        params.push("alt", "json");
12019        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/customMetrics";
12020        if self._scopes.is_empty() {
12021            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
12022        }
12023
12024        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12025            url = params.uri_replacement(url, param_name, find_this, true);
12026        }
12027        {
12028            let to_remove = ["parent"];
12029            params.remove_params(&to_remove);
12030        }
12031
12032        let url = params.parse_with_url(&url);
12033
12034
12035
12036        loop {
12037            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
12038                Ok(token) => token,
12039                Err(e) => {
12040                    match dlg.token(e) {
12041                        Ok(token) => token,
12042                        Err(e) => {
12043                            dlg.finished(false);
12044                            return Err(client::Error::MissingToken(e));
12045                        }
12046                    }
12047                }
12048            };
12049            let mut req_result = {
12050                let client = &self.hub.client;
12051                dlg.pre_request();
12052                let mut req_builder = hyper::Request::builder()
12053                    .method(hyper::Method::GET)
12054                    .uri(url.as_str())
12055                    .header(USER_AGENT, self.hub._user_agent.clone());
12056
12057                if let Some(token) = token.as_ref() {
12058                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12059                }
12060
12061
12062                        let request = req_builder
12063                        .body(hyper::body::Body::empty());
12064
12065                client.request(request.unwrap()).await
12066
12067            };
12068
12069            match req_result {
12070                Err(err) => {
12071                    if let client::Retry::After(d) = dlg.http_error(&err) {
12072                        sleep(d).await;
12073                        continue;
12074                    }
12075                    dlg.finished(false);
12076                    return Err(client::Error::HttpError(err))
12077                }
12078                Ok(mut res) => {
12079                    if !res.status().is_success() {
12080                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12081                        let (parts, _) = res.into_parts();
12082                        let body = hyper::Body::from(res_body_string.clone());
12083                        let restored_response = hyper::Response::from_parts(parts, body);
12084
12085                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
12086
12087                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
12088                            sleep(d).await;
12089                            continue;
12090                        }
12091
12092                        dlg.finished(false);
12093
12094                        return match server_response {
12095                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
12096                            None => Err(client::Error::Failure(restored_response)),
12097                        }
12098                    }
12099                    let result_value = {
12100                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12101
12102                        match json::from_str(&res_body_string) {
12103                            Ok(decoded) => (res, decoded),
12104                            Err(err) => {
12105                                dlg.response_json_decode_error(&res_body_string, &err);
12106                                return Err(client::Error::JsonDecodeError(res_body_string, err));
12107                            }
12108                        }
12109                    };
12110
12111                    dlg.finished(true);
12112                    return Ok(result_value)
12113                }
12114            }
12115        }
12116    }
12117
12118
12119    /// Required. Example format: properties/1234
12120    ///
12121    /// Sets the *parent* path property to the given value.
12122    ///
12123    /// Even though the property as already been set when instantiating this call,
12124    /// we provide this method for API completeness.
12125    pub fn parent(mut self, new_value: &str) -> PropertyCustomMetricListCall<'a, S> {
12126        self._parent = new_value.to_string();
12127        self
12128    }
12129    /// A page token, received from a previous `ListCustomMetrics` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListCustomMetrics` must match the call that provided the page token.
12130    ///
12131    /// Sets the *page token* query property to the given value.
12132    pub fn page_token(mut self, new_value: &str) -> PropertyCustomMetricListCall<'a, S> {
12133        self._page_token = Some(new_value.to_string());
12134        self
12135    }
12136    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
12137    ///
12138    /// Sets the *page size* query property to the given value.
12139    pub fn page_size(mut self, new_value: i32) -> PropertyCustomMetricListCall<'a, S> {
12140        self._page_size = Some(new_value);
12141        self
12142    }
12143    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12144    /// while executing the actual API request.
12145    /// 
12146    /// ````text
12147    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12148    /// ````
12149    ///
12150    /// Sets the *delegate* property to the given value.
12151    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomMetricListCall<'a, S> {
12152        self._delegate = Some(new_value);
12153        self
12154    }
12155
12156    /// Set any additional parameter of the query string used in the request.
12157    /// It should be used to set parameters which are not yet available through their own
12158    /// setters.
12159    ///
12160    /// Please note that this method must not be used to set any of the known parameters
12161    /// which have their own setter method. If done anyway, the request will fail.
12162    ///
12163    /// # Additional Parameters
12164    ///
12165    /// * *$.xgafv* (query-string) - V1 error format.
12166    /// * *access_token* (query-string) - OAuth access token.
12167    /// * *alt* (query-string) - Data format for response.
12168    /// * *callback* (query-string) - JSONP
12169    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12170    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12171    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12172    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12173    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12174    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12175    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12176    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomMetricListCall<'a, S>
12177                                                        where T: AsRef<str> {
12178        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
12179        self
12180    }
12181
12182    /// Identifies the authorization scope for the method you are building.
12183    ///
12184    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12185    /// [`Scope::AnalyticReadonly`].
12186    ///
12187    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12188    /// tokens for more than one scope.
12189    ///
12190    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12191    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12192    /// sufficient, a read-write scope will do as well.
12193    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomMetricListCall<'a, S>
12194                                                        where St: AsRef<str> {
12195        self._scopes.insert(String::from(scope.as_ref()));
12196        self
12197    }
12198    /// Identifies the authorization scope(s) for the method you are building.
12199    ///
12200    /// See [`Self::add_scope()`] for details.
12201    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomMetricListCall<'a, S>
12202                                                        where I: IntoIterator<Item = St>,
12203                                                         St: AsRef<str> {
12204        self._scopes
12205            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12206        self
12207    }
12208
12209    /// Removes all scopes, and no default scope will be used either.
12210    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12211    /// for details).
12212    pub fn clear_scopes(mut self) -> PropertyCustomMetricListCall<'a, S> {
12213        self._scopes.clear();
12214        self
12215    }
12216}
12217
12218
12219/// Updates a CustomMetric on a property.
12220///
12221/// A builder for the *customMetrics.patch* method supported by a *property* resource.
12222/// It is not used directly, but through a [`PropertyMethods`] instance.
12223///
12224/// # Example
12225///
12226/// Instantiate a resource method builder
12227///
12228/// ```test_harness,no_run
12229/// # extern crate hyper;
12230/// # extern crate hyper_rustls;
12231/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
12232/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaCustomMetric;
12233/// # async fn dox() {
12234/// # use std::default::Default;
12235/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
12236/// 
12237/// # let secret: oauth2::ApplicationSecret = Default::default();
12238/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
12239/// #         secret,
12240/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12241/// #     ).build().await.unwrap();
12242/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
12243/// // As the method needs a request, you would usually fill it with the desired information
12244/// // into the respective structure. Some of the parts shown here might not be applicable !
12245/// // Values shown here are possibly random and not representative !
12246/// let mut req = GoogleAnalyticsAdminV1alphaCustomMetric::default();
12247/// 
12248/// // You can configure optional parameters by calling the respective setters at will, and
12249/// // execute the final call using `doit()`.
12250/// // Values shown here are possibly random and not representative !
12251/// let result = hub.properties().custom_metrics_patch(req, "name")
12252///              .update_mask(&Default::default())
12253///              .doit().await;
12254/// # }
12255/// ```
12256pub struct PropertyCustomMetricPatchCall<'a, S>
12257    where S: 'a {
12258
12259    hub: &'a GoogleAnalyticsAdmin<S>,
12260    _request: GoogleAnalyticsAdminV1alphaCustomMetric,
12261    _name: String,
12262    _update_mask: Option<client::FieldMask>,
12263    _delegate: Option<&'a mut dyn client::Delegate>,
12264    _additional_params: HashMap<String, String>,
12265    _scopes: BTreeSet<String>
12266}
12267
12268impl<'a, S> client::CallBuilder for PropertyCustomMetricPatchCall<'a, S> {}
12269
12270impl<'a, S> PropertyCustomMetricPatchCall<'a, S>
12271where
12272    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
12273    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
12274    S::Future: Send + Unpin + 'static,
12275    S::Error: Into<Box<dyn StdError + Send + Sync>>,
12276{
12277
12278
12279    /// Perform the operation you have build so far.
12280    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaCustomMetric)> {
12281        use std::io::{Read, Seek};
12282        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
12283        use client::{ToParts, url::Params};
12284        use std::borrow::Cow;
12285
12286        let mut dd = client::DefaultDelegate;
12287        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
12288        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.customMetrics.patch",
12289                               http_method: hyper::Method::PATCH });
12290
12291        for &field in ["alt", "name", "updateMask"].iter() {
12292            if self._additional_params.contains_key(field) {
12293                dlg.finished(false);
12294                return Err(client::Error::FieldClash(field));
12295            }
12296        }
12297
12298        let mut params = Params::with_capacity(5 + self._additional_params.len());
12299        params.push("name", self._name);
12300        if let Some(value) = self._update_mask.as_ref() {
12301            params.push("updateMask", value.to_string());
12302        }
12303
12304        params.extend(self._additional_params.iter());
12305
12306        params.push("alt", "json");
12307        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
12308        if self._scopes.is_empty() {
12309            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
12310        }
12311
12312        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12313            url = params.uri_replacement(url, param_name, find_this, true);
12314        }
12315        {
12316            let to_remove = ["name"];
12317            params.remove_params(&to_remove);
12318        }
12319
12320        let url = params.parse_with_url(&url);
12321
12322        let mut json_mime_type = mime::APPLICATION_JSON;
12323        let mut request_value_reader =
12324            {
12325                let mut value = json::value::to_value(&self._request).expect("serde to work");
12326                client::remove_json_null_values(&mut value);
12327                let mut dst = io::Cursor::new(Vec::with_capacity(128));
12328                json::to_writer(&mut dst, &value).unwrap();
12329                dst
12330            };
12331        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
12332        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
12333
12334
12335        loop {
12336            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
12337                Ok(token) => token,
12338                Err(e) => {
12339                    match dlg.token(e) {
12340                        Ok(token) => token,
12341                        Err(e) => {
12342                            dlg.finished(false);
12343                            return Err(client::Error::MissingToken(e));
12344                        }
12345                    }
12346                }
12347            };
12348            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
12349            let mut req_result = {
12350                let client = &self.hub.client;
12351                dlg.pre_request();
12352                let mut req_builder = hyper::Request::builder()
12353                    .method(hyper::Method::PATCH)
12354                    .uri(url.as_str())
12355                    .header(USER_AGENT, self.hub._user_agent.clone());
12356
12357                if let Some(token) = token.as_ref() {
12358                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12359                }
12360
12361
12362                        let request = req_builder
12363                        .header(CONTENT_TYPE, json_mime_type.to_string())
12364                        .header(CONTENT_LENGTH, request_size as u64)
12365                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
12366
12367                client.request(request.unwrap()).await
12368
12369            };
12370
12371            match req_result {
12372                Err(err) => {
12373                    if let client::Retry::After(d) = dlg.http_error(&err) {
12374                        sleep(d).await;
12375                        continue;
12376                    }
12377                    dlg.finished(false);
12378                    return Err(client::Error::HttpError(err))
12379                }
12380                Ok(mut res) => {
12381                    if !res.status().is_success() {
12382                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12383                        let (parts, _) = res.into_parts();
12384                        let body = hyper::Body::from(res_body_string.clone());
12385                        let restored_response = hyper::Response::from_parts(parts, body);
12386
12387                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
12388
12389                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
12390                            sleep(d).await;
12391                            continue;
12392                        }
12393
12394                        dlg.finished(false);
12395
12396                        return match server_response {
12397                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
12398                            None => Err(client::Error::Failure(restored_response)),
12399                        }
12400                    }
12401                    let result_value = {
12402                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12403
12404                        match json::from_str(&res_body_string) {
12405                            Ok(decoded) => (res, decoded),
12406                            Err(err) => {
12407                                dlg.response_json_decode_error(&res_body_string, &err);
12408                                return Err(client::Error::JsonDecodeError(res_body_string, err));
12409                            }
12410                        }
12411                    };
12412
12413                    dlg.finished(true);
12414                    return Ok(result_value)
12415                }
12416            }
12417        }
12418    }
12419
12420
12421    ///
12422    /// Sets the *request* property to the given value.
12423    ///
12424    /// Even though the property as already been set when instantiating this call,
12425    /// we provide this method for API completeness.
12426    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaCustomMetric) -> PropertyCustomMetricPatchCall<'a, S> {
12427        self._request = new_value;
12428        self
12429    }
12430    /// Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
12431    ///
12432    /// Sets the *name* path property to the given value.
12433    ///
12434    /// Even though the property as already been set when instantiating this call,
12435    /// we provide this method for API completeness.
12436    pub fn name(mut self, new_value: &str) -> PropertyCustomMetricPatchCall<'a, S> {
12437        self._name = new_value.to_string();
12438        self
12439    }
12440    /// Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
12441    ///
12442    /// Sets the *update mask* query property to the given value.
12443    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyCustomMetricPatchCall<'a, S> {
12444        self._update_mask = Some(new_value);
12445        self
12446    }
12447    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12448    /// while executing the actual API request.
12449    /// 
12450    /// ````text
12451    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12452    /// ````
12453    ///
12454    /// Sets the *delegate* property to the given value.
12455    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCustomMetricPatchCall<'a, S> {
12456        self._delegate = Some(new_value);
12457        self
12458    }
12459
12460    /// Set any additional parameter of the query string used in the request.
12461    /// It should be used to set parameters which are not yet available through their own
12462    /// setters.
12463    ///
12464    /// Please note that this method must not be used to set any of the known parameters
12465    /// which have their own setter method. If done anyway, the request will fail.
12466    ///
12467    /// # Additional Parameters
12468    ///
12469    /// * *$.xgafv* (query-string) - V1 error format.
12470    /// * *access_token* (query-string) - OAuth access token.
12471    /// * *alt* (query-string) - Data format for response.
12472    /// * *callback* (query-string) - JSONP
12473    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12474    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12475    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12476    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12477    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12478    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12479    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12480    pub fn param<T>(mut self, name: T, value: T) -> PropertyCustomMetricPatchCall<'a, S>
12481                                                        where T: AsRef<str> {
12482        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
12483        self
12484    }
12485
12486    /// Identifies the authorization scope for the method you are building.
12487    ///
12488    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12489    /// [`Scope::AnalyticEdit`].
12490    ///
12491    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12492    /// tokens for more than one scope.
12493    ///
12494    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12495    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12496    /// sufficient, a read-write scope will do as well.
12497    pub fn add_scope<St>(mut self, scope: St) -> PropertyCustomMetricPatchCall<'a, S>
12498                                                        where St: AsRef<str> {
12499        self._scopes.insert(String::from(scope.as_ref()));
12500        self
12501    }
12502    /// Identifies the authorization scope(s) for the method you are building.
12503    ///
12504    /// See [`Self::add_scope()`] for details.
12505    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCustomMetricPatchCall<'a, S>
12506                                                        where I: IntoIterator<Item = St>,
12507                                                         St: AsRef<str> {
12508        self._scopes
12509            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12510        self
12511    }
12512
12513    /// Removes all scopes, and no default scope will be used either.
12514    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12515    /// for details).
12516    pub fn clear_scopes(mut self) -> PropertyCustomMetricPatchCall<'a, S> {
12517        self._scopes.clear();
12518        self
12519    }
12520}
12521
12522
12523/// Creates a measurement protocol secret.
12524///
12525/// A builder for the *dataStreams.measurementProtocolSecrets.create* method supported by a *property* resource.
12526/// It is not used directly, but through a [`PropertyMethods`] instance.
12527///
12528/// # Example
12529///
12530/// Instantiate a resource method builder
12531///
12532/// ```test_harness,no_run
12533/// # extern crate hyper;
12534/// # extern crate hyper_rustls;
12535/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
12536/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret;
12537/// # async fn dox() {
12538/// # use std::default::Default;
12539/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
12540/// 
12541/// # let secret: oauth2::ApplicationSecret = Default::default();
12542/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
12543/// #         secret,
12544/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12545/// #     ).build().await.unwrap();
12546/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
12547/// // As the method needs a request, you would usually fill it with the desired information
12548/// // into the respective structure. Some of the parts shown here might not be applicable !
12549/// // Values shown here are possibly random and not representative !
12550/// let mut req = GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret::default();
12551/// 
12552/// // You can configure optional parameters by calling the respective setters at will, and
12553/// // execute the final call using `doit()`.
12554/// // Values shown here are possibly random and not representative !
12555/// let result = hub.properties().data_streams_measurement_protocol_secrets_create(req, "parent")
12556///              .doit().await;
12557/// # }
12558/// ```
12559pub struct PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S>
12560    where S: 'a {
12561
12562    hub: &'a GoogleAnalyticsAdmin<S>,
12563    _request: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret,
12564    _parent: String,
12565    _delegate: Option<&'a mut dyn client::Delegate>,
12566    _additional_params: HashMap<String, String>,
12567    _scopes: BTreeSet<String>
12568}
12569
12570impl<'a, S> client::CallBuilder for PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {}
12571
12572impl<'a, S> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S>
12573where
12574    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
12575    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
12576    S::Future: Send + Unpin + 'static,
12577    S::Error: Into<Box<dyn StdError + Send + Sync>>,
12578{
12579
12580
12581    /// Perform the operation you have build so far.
12582    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret)> {
12583        use std::io::{Read, Seek};
12584        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
12585        use client::{ToParts, url::Params};
12586        use std::borrow::Cow;
12587
12588        let mut dd = client::DefaultDelegate;
12589        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
12590        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.measurementProtocolSecrets.create",
12591                               http_method: hyper::Method::POST });
12592
12593        for &field in ["alt", "parent"].iter() {
12594            if self._additional_params.contains_key(field) {
12595                dlg.finished(false);
12596                return Err(client::Error::FieldClash(field));
12597            }
12598        }
12599
12600        let mut params = Params::with_capacity(4 + self._additional_params.len());
12601        params.push("parent", self._parent);
12602
12603        params.extend(self._additional_params.iter());
12604
12605        params.push("alt", "json");
12606        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/measurementProtocolSecrets";
12607        if self._scopes.is_empty() {
12608            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
12609        }
12610
12611        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12612            url = params.uri_replacement(url, param_name, find_this, true);
12613        }
12614        {
12615            let to_remove = ["parent"];
12616            params.remove_params(&to_remove);
12617        }
12618
12619        let url = params.parse_with_url(&url);
12620
12621        let mut json_mime_type = mime::APPLICATION_JSON;
12622        let mut request_value_reader =
12623            {
12624                let mut value = json::value::to_value(&self._request).expect("serde to work");
12625                client::remove_json_null_values(&mut value);
12626                let mut dst = io::Cursor::new(Vec::with_capacity(128));
12627                json::to_writer(&mut dst, &value).unwrap();
12628                dst
12629            };
12630        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
12631        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
12632
12633
12634        loop {
12635            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
12636                Ok(token) => token,
12637                Err(e) => {
12638                    match dlg.token(e) {
12639                        Ok(token) => token,
12640                        Err(e) => {
12641                            dlg.finished(false);
12642                            return Err(client::Error::MissingToken(e));
12643                        }
12644                    }
12645                }
12646            };
12647            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
12648            let mut req_result = {
12649                let client = &self.hub.client;
12650                dlg.pre_request();
12651                let mut req_builder = hyper::Request::builder()
12652                    .method(hyper::Method::POST)
12653                    .uri(url.as_str())
12654                    .header(USER_AGENT, self.hub._user_agent.clone());
12655
12656                if let Some(token) = token.as_ref() {
12657                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12658                }
12659
12660
12661                        let request = req_builder
12662                        .header(CONTENT_TYPE, json_mime_type.to_string())
12663                        .header(CONTENT_LENGTH, request_size as u64)
12664                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
12665
12666                client.request(request.unwrap()).await
12667
12668            };
12669
12670            match req_result {
12671                Err(err) => {
12672                    if let client::Retry::After(d) = dlg.http_error(&err) {
12673                        sleep(d).await;
12674                        continue;
12675                    }
12676                    dlg.finished(false);
12677                    return Err(client::Error::HttpError(err))
12678                }
12679                Ok(mut res) => {
12680                    if !res.status().is_success() {
12681                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12682                        let (parts, _) = res.into_parts();
12683                        let body = hyper::Body::from(res_body_string.clone());
12684                        let restored_response = hyper::Response::from_parts(parts, body);
12685
12686                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
12687
12688                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
12689                            sleep(d).await;
12690                            continue;
12691                        }
12692
12693                        dlg.finished(false);
12694
12695                        return match server_response {
12696                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
12697                            None => Err(client::Error::Failure(restored_response)),
12698                        }
12699                    }
12700                    let result_value = {
12701                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12702
12703                        match json::from_str(&res_body_string) {
12704                            Ok(decoded) => (res, decoded),
12705                            Err(err) => {
12706                                dlg.response_json_decode_error(&res_body_string, &err);
12707                                return Err(client::Error::JsonDecodeError(res_body_string, err));
12708                            }
12709                        }
12710                    };
12711
12712                    dlg.finished(true);
12713                    return Ok(result_value)
12714                }
12715            }
12716        }
12717    }
12718
12719
12720    ///
12721    /// Sets the *request* property to the given value.
12722    ///
12723    /// Even though the property as already been set when instantiating this call,
12724    /// we provide this method for API completeness.
12725    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {
12726        self._request = new_value;
12727        self
12728    }
12729    /// Required. The parent resource where this secret will be created. Format: properties/{property}/dataStreams/{dataStream}
12730    ///
12731    /// Sets the *parent* path property to the given value.
12732    ///
12733    /// Even though the property as already been set when instantiating this call,
12734    /// we provide this method for API completeness.
12735    pub fn parent(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {
12736        self._parent = new_value.to_string();
12737        self
12738    }
12739    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12740    /// while executing the actual API request.
12741    /// 
12742    /// ````text
12743    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12744    /// ````
12745    ///
12746    /// Sets the *delegate* property to the given value.
12747    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {
12748        self._delegate = Some(new_value);
12749        self
12750    }
12751
12752    /// Set any additional parameter of the query string used in the request.
12753    /// It should be used to set parameters which are not yet available through their own
12754    /// setters.
12755    ///
12756    /// Please note that this method must not be used to set any of the known parameters
12757    /// which have their own setter method. If done anyway, the request will fail.
12758    ///
12759    /// # Additional Parameters
12760    ///
12761    /// * *$.xgafv* (query-string) - V1 error format.
12762    /// * *access_token* (query-string) - OAuth access token.
12763    /// * *alt* (query-string) - Data format for response.
12764    /// * *callback* (query-string) - JSONP
12765    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12766    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12767    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12768    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12769    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12770    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12771    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12772    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S>
12773                                                        where T: AsRef<str> {
12774        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
12775        self
12776    }
12777
12778    /// Identifies the authorization scope for the method you are building.
12779    ///
12780    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12781    /// [`Scope::AnalyticEdit`].
12782    ///
12783    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12784    /// tokens for more than one scope.
12785    ///
12786    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12787    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12788    /// sufficient, a read-write scope will do as well.
12789    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S>
12790                                                        where St: AsRef<str> {
12791        self._scopes.insert(String::from(scope.as_ref()));
12792        self
12793    }
12794    /// Identifies the authorization scope(s) for the method you are building.
12795    ///
12796    /// See [`Self::add_scope()`] for details.
12797    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S>
12798                                                        where I: IntoIterator<Item = St>,
12799                                                         St: AsRef<str> {
12800        self._scopes
12801            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12802        self
12803    }
12804
12805    /// Removes all scopes, and no default scope will be used either.
12806    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12807    /// for details).
12808    pub fn clear_scopes(mut self) -> PropertyDataStreamMeasurementProtocolSecretCreateCall<'a, S> {
12809        self._scopes.clear();
12810        self
12811    }
12812}
12813
12814
12815/// Deletes target MeasurementProtocolSecret.
12816///
12817/// A builder for the *dataStreams.measurementProtocolSecrets.delete* method supported by a *property* resource.
12818/// It is not used directly, but through a [`PropertyMethods`] instance.
12819///
12820/// # Example
12821///
12822/// Instantiate a resource method builder
12823///
12824/// ```test_harness,no_run
12825/// # extern crate hyper;
12826/// # extern crate hyper_rustls;
12827/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
12828/// # async fn dox() {
12829/// # use std::default::Default;
12830/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
12831/// 
12832/// # let secret: oauth2::ApplicationSecret = Default::default();
12833/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
12834/// #         secret,
12835/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12836/// #     ).build().await.unwrap();
12837/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
12838/// // You can configure optional parameters by calling the respective setters at will, and
12839/// // execute the final call using `doit()`.
12840/// // Values shown here are possibly random and not representative !
12841/// let result = hub.properties().data_streams_measurement_protocol_secrets_delete("name")
12842///              .doit().await;
12843/// # }
12844/// ```
12845pub struct PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S>
12846    where S: 'a {
12847
12848    hub: &'a GoogleAnalyticsAdmin<S>,
12849    _name: String,
12850    _delegate: Option<&'a mut dyn client::Delegate>,
12851    _additional_params: HashMap<String, String>,
12852    _scopes: BTreeSet<String>
12853}
12854
12855impl<'a, S> client::CallBuilder for PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S> {}
12856
12857impl<'a, S> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S>
12858where
12859    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
12860    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
12861    S::Future: Send + Unpin + 'static,
12862    S::Error: Into<Box<dyn StdError + Send + Sync>>,
12863{
12864
12865
12866    /// Perform the operation you have build so far.
12867    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
12868        use std::io::{Read, Seek};
12869        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
12870        use client::{ToParts, url::Params};
12871        use std::borrow::Cow;
12872
12873        let mut dd = client::DefaultDelegate;
12874        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
12875        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.measurementProtocolSecrets.delete",
12876                               http_method: hyper::Method::DELETE });
12877
12878        for &field in ["alt", "name"].iter() {
12879            if self._additional_params.contains_key(field) {
12880                dlg.finished(false);
12881                return Err(client::Error::FieldClash(field));
12882            }
12883        }
12884
12885        let mut params = Params::with_capacity(3 + self._additional_params.len());
12886        params.push("name", self._name);
12887
12888        params.extend(self._additional_params.iter());
12889
12890        params.push("alt", "json");
12891        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
12892        if self._scopes.is_empty() {
12893            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
12894        }
12895
12896        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12897            url = params.uri_replacement(url, param_name, find_this, true);
12898        }
12899        {
12900            let to_remove = ["name"];
12901            params.remove_params(&to_remove);
12902        }
12903
12904        let url = params.parse_with_url(&url);
12905
12906
12907
12908        loop {
12909            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
12910                Ok(token) => token,
12911                Err(e) => {
12912                    match dlg.token(e) {
12913                        Ok(token) => token,
12914                        Err(e) => {
12915                            dlg.finished(false);
12916                            return Err(client::Error::MissingToken(e));
12917                        }
12918                    }
12919                }
12920            };
12921            let mut req_result = {
12922                let client = &self.hub.client;
12923                dlg.pre_request();
12924                let mut req_builder = hyper::Request::builder()
12925                    .method(hyper::Method::DELETE)
12926                    .uri(url.as_str())
12927                    .header(USER_AGENT, self.hub._user_agent.clone());
12928
12929                if let Some(token) = token.as_ref() {
12930                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12931                }
12932
12933
12934                        let request = req_builder
12935                        .body(hyper::body::Body::empty());
12936
12937                client.request(request.unwrap()).await
12938
12939            };
12940
12941            match req_result {
12942                Err(err) => {
12943                    if let client::Retry::After(d) = dlg.http_error(&err) {
12944                        sleep(d).await;
12945                        continue;
12946                    }
12947                    dlg.finished(false);
12948                    return Err(client::Error::HttpError(err))
12949                }
12950                Ok(mut res) => {
12951                    if !res.status().is_success() {
12952                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12953                        let (parts, _) = res.into_parts();
12954                        let body = hyper::Body::from(res_body_string.clone());
12955                        let restored_response = hyper::Response::from_parts(parts, body);
12956
12957                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
12958
12959                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
12960                            sleep(d).await;
12961                            continue;
12962                        }
12963
12964                        dlg.finished(false);
12965
12966                        return match server_response {
12967                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
12968                            None => Err(client::Error::Failure(restored_response)),
12969                        }
12970                    }
12971                    let result_value = {
12972                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
12973
12974                        match json::from_str(&res_body_string) {
12975                            Ok(decoded) => (res, decoded),
12976                            Err(err) => {
12977                                dlg.response_json_decode_error(&res_body_string, &err);
12978                                return Err(client::Error::JsonDecodeError(res_body_string, err));
12979                            }
12980                        }
12981                    };
12982
12983                    dlg.finished(true);
12984                    return Ok(result_value)
12985                }
12986            }
12987        }
12988    }
12989
12990
12991    /// Required. The name of the MeasurementProtocolSecret to delete. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
12992    ///
12993    /// Sets the *name* path property to the given value.
12994    ///
12995    /// Even though the property as already been set when instantiating this call,
12996    /// we provide this method for API completeness.
12997    pub fn name(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S> {
12998        self._name = new_value.to_string();
12999        self
13000    }
13001    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13002    /// while executing the actual API request.
13003    /// 
13004    /// ````text
13005    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13006    /// ````
13007    ///
13008    /// Sets the *delegate* property to the given value.
13009    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S> {
13010        self._delegate = Some(new_value);
13011        self
13012    }
13013
13014    /// Set any additional parameter of the query string used in the request.
13015    /// It should be used to set parameters which are not yet available through their own
13016    /// setters.
13017    ///
13018    /// Please note that this method must not be used to set any of the known parameters
13019    /// which have their own setter method. If done anyway, the request will fail.
13020    ///
13021    /// # Additional Parameters
13022    ///
13023    /// * *$.xgafv* (query-string) - V1 error format.
13024    /// * *access_token* (query-string) - OAuth access token.
13025    /// * *alt* (query-string) - Data format for response.
13026    /// * *callback* (query-string) - JSONP
13027    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13028    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13029    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13030    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13031    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13032    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13033    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13034    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S>
13035                                                        where T: AsRef<str> {
13036        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
13037        self
13038    }
13039
13040    /// Identifies the authorization scope for the method you are building.
13041    ///
13042    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13043    /// [`Scope::AnalyticEdit`].
13044    ///
13045    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13046    /// tokens for more than one scope.
13047    ///
13048    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13049    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13050    /// sufficient, a read-write scope will do as well.
13051    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S>
13052                                                        where St: AsRef<str> {
13053        self._scopes.insert(String::from(scope.as_ref()));
13054        self
13055    }
13056    /// Identifies the authorization scope(s) for the method you are building.
13057    ///
13058    /// See [`Self::add_scope()`] for details.
13059    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S>
13060                                                        where I: IntoIterator<Item = St>,
13061                                                         St: AsRef<str> {
13062        self._scopes
13063            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13064        self
13065    }
13066
13067    /// Removes all scopes, and no default scope will be used either.
13068    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13069    /// for details).
13070    pub fn clear_scopes(mut self) -> PropertyDataStreamMeasurementProtocolSecretDeleteCall<'a, S> {
13071        self._scopes.clear();
13072        self
13073    }
13074}
13075
13076
13077/// Lookup for a single "GA4" MeasurementProtocolSecret.
13078///
13079/// A builder for the *dataStreams.measurementProtocolSecrets.get* method supported by a *property* resource.
13080/// It is not used directly, but through a [`PropertyMethods`] instance.
13081///
13082/// # Example
13083///
13084/// Instantiate a resource method builder
13085///
13086/// ```test_harness,no_run
13087/// # extern crate hyper;
13088/// # extern crate hyper_rustls;
13089/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
13090/// # async fn dox() {
13091/// # use std::default::Default;
13092/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
13093/// 
13094/// # let secret: oauth2::ApplicationSecret = Default::default();
13095/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
13096/// #         secret,
13097/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13098/// #     ).build().await.unwrap();
13099/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
13100/// // You can configure optional parameters by calling the respective setters at will, and
13101/// // execute the final call using `doit()`.
13102/// // Values shown here are possibly random and not representative !
13103/// let result = hub.properties().data_streams_measurement_protocol_secrets_get("name")
13104///              .doit().await;
13105/// # }
13106/// ```
13107pub struct PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S>
13108    where S: 'a {
13109
13110    hub: &'a GoogleAnalyticsAdmin<S>,
13111    _name: String,
13112    _delegate: Option<&'a mut dyn client::Delegate>,
13113    _additional_params: HashMap<String, String>,
13114    _scopes: BTreeSet<String>
13115}
13116
13117impl<'a, S> client::CallBuilder for PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S> {}
13118
13119impl<'a, S> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S>
13120where
13121    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
13122    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
13123    S::Future: Send + Unpin + 'static,
13124    S::Error: Into<Box<dyn StdError + Send + Sync>>,
13125{
13126
13127
13128    /// Perform the operation you have build so far.
13129    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret)> {
13130        use std::io::{Read, Seek};
13131        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
13132        use client::{ToParts, url::Params};
13133        use std::borrow::Cow;
13134
13135        let mut dd = client::DefaultDelegate;
13136        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
13137        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.measurementProtocolSecrets.get",
13138                               http_method: hyper::Method::GET });
13139
13140        for &field in ["alt", "name"].iter() {
13141            if self._additional_params.contains_key(field) {
13142                dlg.finished(false);
13143                return Err(client::Error::FieldClash(field));
13144            }
13145        }
13146
13147        let mut params = Params::with_capacity(3 + self._additional_params.len());
13148        params.push("name", self._name);
13149
13150        params.extend(self._additional_params.iter());
13151
13152        params.push("alt", "json");
13153        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
13154        if self._scopes.is_empty() {
13155            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
13156        }
13157
13158        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13159            url = params.uri_replacement(url, param_name, find_this, true);
13160        }
13161        {
13162            let to_remove = ["name"];
13163            params.remove_params(&to_remove);
13164        }
13165
13166        let url = params.parse_with_url(&url);
13167
13168
13169
13170        loop {
13171            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
13172                Ok(token) => token,
13173                Err(e) => {
13174                    match dlg.token(e) {
13175                        Ok(token) => token,
13176                        Err(e) => {
13177                            dlg.finished(false);
13178                            return Err(client::Error::MissingToken(e));
13179                        }
13180                    }
13181                }
13182            };
13183            let mut req_result = {
13184                let client = &self.hub.client;
13185                dlg.pre_request();
13186                let mut req_builder = hyper::Request::builder()
13187                    .method(hyper::Method::GET)
13188                    .uri(url.as_str())
13189                    .header(USER_AGENT, self.hub._user_agent.clone());
13190
13191                if let Some(token) = token.as_ref() {
13192                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13193                }
13194
13195
13196                        let request = req_builder
13197                        .body(hyper::body::Body::empty());
13198
13199                client.request(request.unwrap()).await
13200
13201            };
13202
13203            match req_result {
13204                Err(err) => {
13205                    if let client::Retry::After(d) = dlg.http_error(&err) {
13206                        sleep(d).await;
13207                        continue;
13208                    }
13209                    dlg.finished(false);
13210                    return Err(client::Error::HttpError(err))
13211                }
13212                Ok(mut res) => {
13213                    if !res.status().is_success() {
13214                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13215                        let (parts, _) = res.into_parts();
13216                        let body = hyper::Body::from(res_body_string.clone());
13217                        let restored_response = hyper::Response::from_parts(parts, body);
13218
13219                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
13220
13221                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
13222                            sleep(d).await;
13223                            continue;
13224                        }
13225
13226                        dlg.finished(false);
13227
13228                        return match server_response {
13229                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
13230                            None => Err(client::Error::Failure(restored_response)),
13231                        }
13232                    }
13233                    let result_value = {
13234                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13235
13236                        match json::from_str(&res_body_string) {
13237                            Ok(decoded) => (res, decoded),
13238                            Err(err) => {
13239                                dlg.response_json_decode_error(&res_body_string, &err);
13240                                return Err(client::Error::JsonDecodeError(res_body_string, err));
13241                            }
13242                        }
13243                    };
13244
13245                    dlg.finished(true);
13246                    return Ok(result_value)
13247                }
13248            }
13249        }
13250    }
13251
13252
13253    /// Required. The name of the measurement protocol secret to lookup. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
13254    ///
13255    /// Sets the *name* path property to the given value.
13256    ///
13257    /// Even though the property as already been set when instantiating this call,
13258    /// we provide this method for API completeness.
13259    pub fn name(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S> {
13260        self._name = new_value.to_string();
13261        self
13262    }
13263    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13264    /// while executing the actual API request.
13265    /// 
13266    /// ````text
13267    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13268    /// ````
13269    ///
13270    /// Sets the *delegate* property to the given value.
13271    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S> {
13272        self._delegate = Some(new_value);
13273        self
13274    }
13275
13276    /// Set any additional parameter of the query string used in the request.
13277    /// It should be used to set parameters which are not yet available through their own
13278    /// setters.
13279    ///
13280    /// Please note that this method must not be used to set any of the known parameters
13281    /// which have their own setter method. If done anyway, the request will fail.
13282    ///
13283    /// # Additional Parameters
13284    ///
13285    /// * *$.xgafv* (query-string) - V1 error format.
13286    /// * *access_token* (query-string) - OAuth access token.
13287    /// * *alt* (query-string) - Data format for response.
13288    /// * *callback* (query-string) - JSONP
13289    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13290    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13291    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13292    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13293    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13294    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13295    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13296    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S>
13297                                                        where T: AsRef<str> {
13298        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
13299        self
13300    }
13301
13302    /// Identifies the authorization scope for the method you are building.
13303    ///
13304    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13305    /// [`Scope::AnalyticReadonly`].
13306    ///
13307    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13308    /// tokens for more than one scope.
13309    ///
13310    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13311    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13312    /// sufficient, a read-write scope will do as well.
13313    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S>
13314                                                        where St: AsRef<str> {
13315        self._scopes.insert(String::from(scope.as_ref()));
13316        self
13317    }
13318    /// Identifies the authorization scope(s) for the method you are building.
13319    ///
13320    /// See [`Self::add_scope()`] for details.
13321    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S>
13322                                                        where I: IntoIterator<Item = St>,
13323                                                         St: AsRef<str> {
13324        self._scopes
13325            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13326        self
13327    }
13328
13329    /// Removes all scopes, and no default scope will be used either.
13330    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13331    /// for details).
13332    pub fn clear_scopes(mut self) -> PropertyDataStreamMeasurementProtocolSecretGetCall<'a, S> {
13333        self._scopes.clear();
13334        self
13335    }
13336}
13337
13338
13339/// Returns child MeasurementProtocolSecrets under the specified parent Property.
13340///
13341/// A builder for the *dataStreams.measurementProtocolSecrets.list* method supported by a *property* resource.
13342/// It is not used directly, but through a [`PropertyMethods`] instance.
13343///
13344/// # Example
13345///
13346/// Instantiate a resource method builder
13347///
13348/// ```test_harness,no_run
13349/// # extern crate hyper;
13350/// # extern crate hyper_rustls;
13351/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
13352/// # async fn dox() {
13353/// # use std::default::Default;
13354/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
13355/// 
13356/// # let secret: oauth2::ApplicationSecret = Default::default();
13357/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
13358/// #         secret,
13359/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13360/// #     ).build().await.unwrap();
13361/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
13362/// // You can configure optional parameters by calling the respective setters at will, and
13363/// // execute the final call using `doit()`.
13364/// // Values shown here are possibly random and not representative !
13365/// let result = hub.properties().data_streams_measurement_protocol_secrets_list("parent")
13366///              .page_token("dolore")
13367///              .page_size(-22)
13368///              .doit().await;
13369/// # }
13370/// ```
13371pub struct PropertyDataStreamMeasurementProtocolSecretListCall<'a, S>
13372    where S: 'a {
13373
13374    hub: &'a GoogleAnalyticsAdmin<S>,
13375    _parent: String,
13376    _page_token: Option<String>,
13377    _page_size: Option<i32>,
13378    _delegate: Option<&'a mut dyn client::Delegate>,
13379    _additional_params: HashMap<String, String>,
13380    _scopes: BTreeSet<String>
13381}
13382
13383impl<'a, S> client::CallBuilder for PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {}
13384
13385impl<'a, S> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S>
13386where
13387    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
13388    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
13389    S::Future: Send + Unpin + 'static,
13390    S::Error: Into<Box<dyn StdError + Send + Sync>>,
13391{
13392
13393
13394    /// Perform the operation you have build so far.
13395    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListMeasurementProtocolSecretsResponse)> {
13396        use std::io::{Read, Seek};
13397        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
13398        use client::{ToParts, url::Params};
13399        use std::borrow::Cow;
13400
13401        let mut dd = client::DefaultDelegate;
13402        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
13403        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.measurementProtocolSecrets.list",
13404                               http_method: hyper::Method::GET });
13405
13406        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
13407            if self._additional_params.contains_key(field) {
13408                dlg.finished(false);
13409                return Err(client::Error::FieldClash(field));
13410            }
13411        }
13412
13413        let mut params = Params::with_capacity(5 + self._additional_params.len());
13414        params.push("parent", self._parent);
13415        if let Some(value) = self._page_token.as_ref() {
13416            params.push("pageToken", value);
13417        }
13418        if let Some(value) = self._page_size.as_ref() {
13419            params.push("pageSize", value.to_string());
13420        }
13421
13422        params.extend(self._additional_params.iter());
13423
13424        params.push("alt", "json");
13425        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/measurementProtocolSecrets";
13426        if self._scopes.is_empty() {
13427            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
13428        }
13429
13430        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13431            url = params.uri_replacement(url, param_name, find_this, true);
13432        }
13433        {
13434            let to_remove = ["parent"];
13435            params.remove_params(&to_remove);
13436        }
13437
13438        let url = params.parse_with_url(&url);
13439
13440
13441
13442        loop {
13443            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
13444                Ok(token) => token,
13445                Err(e) => {
13446                    match dlg.token(e) {
13447                        Ok(token) => token,
13448                        Err(e) => {
13449                            dlg.finished(false);
13450                            return Err(client::Error::MissingToken(e));
13451                        }
13452                    }
13453                }
13454            };
13455            let mut req_result = {
13456                let client = &self.hub.client;
13457                dlg.pre_request();
13458                let mut req_builder = hyper::Request::builder()
13459                    .method(hyper::Method::GET)
13460                    .uri(url.as_str())
13461                    .header(USER_AGENT, self.hub._user_agent.clone());
13462
13463                if let Some(token) = token.as_ref() {
13464                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13465                }
13466
13467
13468                        let request = req_builder
13469                        .body(hyper::body::Body::empty());
13470
13471                client.request(request.unwrap()).await
13472
13473            };
13474
13475            match req_result {
13476                Err(err) => {
13477                    if let client::Retry::After(d) = dlg.http_error(&err) {
13478                        sleep(d).await;
13479                        continue;
13480                    }
13481                    dlg.finished(false);
13482                    return Err(client::Error::HttpError(err))
13483                }
13484                Ok(mut res) => {
13485                    if !res.status().is_success() {
13486                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13487                        let (parts, _) = res.into_parts();
13488                        let body = hyper::Body::from(res_body_string.clone());
13489                        let restored_response = hyper::Response::from_parts(parts, body);
13490
13491                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
13492
13493                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
13494                            sleep(d).await;
13495                            continue;
13496                        }
13497
13498                        dlg.finished(false);
13499
13500                        return match server_response {
13501                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
13502                            None => Err(client::Error::Failure(restored_response)),
13503                        }
13504                    }
13505                    let result_value = {
13506                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13507
13508                        match json::from_str(&res_body_string) {
13509                            Ok(decoded) => (res, decoded),
13510                            Err(err) => {
13511                                dlg.response_json_decode_error(&res_body_string, &err);
13512                                return Err(client::Error::JsonDecodeError(res_body_string, err));
13513                            }
13514                        }
13515                    };
13516
13517                    dlg.finished(true);
13518                    return Ok(result_value)
13519                }
13520            }
13521        }
13522    }
13523
13524
13525    /// Required. The resource name of the parent stream. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets
13526    ///
13527    /// Sets the *parent* path property to the given value.
13528    ///
13529    /// Even though the property as already been set when instantiating this call,
13530    /// we provide this method for API completeness.
13531    pub fn parent(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
13532        self._parent = new_value.to_string();
13533        self
13534    }
13535    /// A page token, received from a previous `ListMeasurementProtocolSecrets` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListMeasurementProtocolSecrets` must match the call that provided the page token.
13536    ///
13537    /// Sets the *page token* query property to the given value.
13538    pub fn page_token(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
13539        self._page_token = Some(new_value.to_string());
13540        self
13541    }
13542    /// The maximum number of resources to return. If unspecified, at most 10 resources will be returned. The maximum value is 10. Higher values will be coerced to the maximum.
13543    ///
13544    /// Sets the *page size* query property to the given value.
13545    pub fn page_size(mut self, new_value: i32) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
13546        self._page_size = Some(new_value);
13547        self
13548    }
13549    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13550    /// while executing the actual API request.
13551    /// 
13552    /// ````text
13553    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13554    /// ````
13555    ///
13556    /// Sets the *delegate* property to the given value.
13557    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
13558        self._delegate = Some(new_value);
13559        self
13560    }
13561
13562    /// Set any additional parameter of the query string used in the request.
13563    /// It should be used to set parameters which are not yet available through their own
13564    /// setters.
13565    ///
13566    /// Please note that this method must not be used to set any of the known parameters
13567    /// which have their own setter method. If done anyway, the request will fail.
13568    ///
13569    /// # Additional Parameters
13570    ///
13571    /// * *$.xgafv* (query-string) - V1 error format.
13572    /// * *access_token* (query-string) - OAuth access token.
13573    /// * *alt* (query-string) - Data format for response.
13574    /// * *callback* (query-string) - JSONP
13575    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13576    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13577    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13578    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13579    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13580    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13581    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13582    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S>
13583                                                        where T: AsRef<str> {
13584        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
13585        self
13586    }
13587
13588    /// Identifies the authorization scope for the method you are building.
13589    ///
13590    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13591    /// [`Scope::AnalyticReadonly`].
13592    ///
13593    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13594    /// tokens for more than one scope.
13595    ///
13596    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13597    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13598    /// sufficient, a read-write scope will do as well.
13599    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S>
13600                                                        where St: AsRef<str> {
13601        self._scopes.insert(String::from(scope.as_ref()));
13602        self
13603    }
13604    /// Identifies the authorization scope(s) for the method you are building.
13605    ///
13606    /// See [`Self::add_scope()`] for details.
13607    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S>
13608                                                        where I: IntoIterator<Item = St>,
13609                                                         St: AsRef<str> {
13610        self._scopes
13611            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13612        self
13613    }
13614
13615    /// Removes all scopes, and no default scope will be used either.
13616    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13617    /// for details).
13618    pub fn clear_scopes(mut self) -> PropertyDataStreamMeasurementProtocolSecretListCall<'a, S> {
13619        self._scopes.clear();
13620        self
13621    }
13622}
13623
13624
13625/// Updates a measurement protocol secret.
13626///
13627/// A builder for the *dataStreams.measurementProtocolSecrets.patch* method supported by a *property* resource.
13628/// It is not used directly, but through a [`PropertyMethods`] instance.
13629///
13630/// # Example
13631///
13632/// Instantiate a resource method builder
13633///
13634/// ```test_harness,no_run
13635/// # extern crate hyper;
13636/// # extern crate hyper_rustls;
13637/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
13638/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret;
13639/// # async fn dox() {
13640/// # use std::default::Default;
13641/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
13642/// 
13643/// # let secret: oauth2::ApplicationSecret = Default::default();
13644/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
13645/// #         secret,
13646/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13647/// #     ).build().await.unwrap();
13648/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
13649/// // As the method needs a request, you would usually fill it with the desired information
13650/// // into the respective structure. Some of the parts shown here might not be applicable !
13651/// // Values shown here are possibly random and not representative !
13652/// let mut req = GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret::default();
13653/// 
13654/// // You can configure optional parameters by calling the respective setters at will, and
13655/// // execute the final call using `doit()`.
13656/// // Values shown here are possibly random and not representative !
13657/// let result = hub.properties().data_streams_measurement_protocol_secrets_patch(req, "name")
13658///              .update_mask(&Default::default())
13659///              .doit().await;
13660/// # }
13661/// ```
13662pub struct PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S>
13663    where S: 'a {
13664
13665    hub: &'a GoogleAnalyticsAdmin<S>,
13666    _request: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret,
13667    _name: String,
13668    _update_mask: Option<client::FieldMask>,
13669    _delegate: Option<&'a mut dyn client::Delegate>,
13670    _additional_params: HashMap<String, String>,
13671    _scopes: BTreeSet<String>
13672}
13673
13674impl<'a, S> client::CallBuilder for PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {}
13675
13676impl<'a, S> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S>
13677where
13678    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
13679    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
13680    S::Future: Send + Unpin + 'static,
13681    S::Error: Into<Box<dyn StdError + Send + Sync>>,
13682{
13683
13684
13685    /// Perform the operation you have build so far.
13686    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret)> {
13687        use std::io::{Read, Seek};
13688        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
13689        use client::{ToParts, url::Params};
13690        use std::borrow::Cow;
13691
13692        let mut dd = client::DefaultDelegate;
13693        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
13694        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.measurementProtocolSecrets.patch",
13695                               http_method: hyper::Method::PATCH });
13696
13697        for &field in ["alt", "name", "updateMask"].iter() {
13698            if self._additional_params.contains_key(field) {
13699                dlg.finished(false);
13700                return Err(client::Error::FieldClash(field));
13701            }
13702        }
13703
13704        let mut params = Params::with_capacity(5 + self._additional_params.len());
13705        params.push("name", self._name);
13706        if let Some(value) = self._update_mask.as_ref() {
13707            params.push("updateMask", value.to_string());
13708        }
13709
13710        params.extend(self._additional_params.iter());
13711
13712        params.push("alt", "json");
13713        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
13714        if self._scopes.is_empty() {
13715            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
13716        }
13717
13718        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13719            url = params.uri_replacement(url, param_name, find_this, true);
13720        }
13721        {
13722            let to_remove = ["name"];
13723            params.remove_params(&to_remove);
13724        }
13725
13726        let url = params.parse_with_url(&url);
13727
13728        let mut json_mime_type = mime::APPLICATION_JSON;
13729        let mut request_value_reader =
13730            {
13731                let mut value = json::value::to_value(&self._request).expect("serde to work");
13732                client::remove_json_null_values(&mut value);
13733                let mut dst = io::Cursor::new(Vec::with_capacity(128));
13734                json::to_writer(&mut dst, &value).unwrap();
13735                dst
13736            };
13737        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
13738        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
13739
13740
13741        loop {
13742            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
13743                Ok(token) => token,
13744                Err(e) => {
13745                    match dlg.token(e) {
13746                        Ok(token) => token,
13747                        Err(e) => {
13748                            dlg.finished(false);
13749                            return Err(client::Error::MissingToken(e));
13750                        }
13751                    }
13752                }
13753            };
13754            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
13755            let mut req_result = {
13756                let client = &self.hub.client;
13757                dlg.pre_request();
13758                let mut req_builder = hyper::Request::builder()
13759                    .method(hyper::Method::PATCH)
13760                    .uri(url.as_str())
13761                    .header(USER_AGENT, self.hub._user_agent.clone());
13762
13763                if let Some(token) = token.as_ref() {
13764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13765                }
13766
13767
13768                        let request = req_builder
13769                        .header(CONTENT_TYPE, json_mime_type.to_string())
13770                        .header(CONTENT_LENGTH, request_size as u64)
13771                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
13772
13773                client.request(request.unwrap()).await
13774
13775            };
13776
13777            match req_result {
13778                Err(err) => {
13779                    if let client::Retry::After(d) = dlg.http_error(&err) {
13780                        sleep(d).await;
13781                        continue;
13782                    }
13783                    dlg.finished(false);
13784                    return Err(client::Error::HttpError(err))
13785                }
13786                Ok(mut res) => {
13787                    if !res.status().is_success() {
13788                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13789                        let (parts, _) = res.into_parts();
13790                        let body = hyper::Body::from(res_body_string.clone());
13791                        let restored_response = hyper::Response::from_parts(parts, body);
13792
13793                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
13794
13795                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
13796                            sleep(d).await;
13797                            continue;
13798                        }
13799
13800                        dlg.finished(false);
13801
13802                        return match server_response {
13803                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
13804                            None => Err(client::Error::Failure(restored_response)),
13805                        }
13806                    }
13807                    let result_value = {
13808                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
13809
13810                        match json::from_str(&res_body_string) {
13811                            Ok(decoded) => (res, decoded),
13812                            Err(err) => {
13813                                dlg.response_json_decode_error(&res_body_string, &err);
13814                                return Err(client::Error::JsonDecodeError(res_body_string, err));
13815                            }
13816                        }
13817                    };
13818
13819                    dlg.finished(true);
13820                    return Ok(result_value)
13821                }
13822            }
13823        }
13824    }
13825
13826
13827    ///
13828    /// Sets the *request* property to the given value.
13829    ///
13830    /// Even though the property as already been set when instantiating this call,
13831    /// we provide this method for API completeness.
13832    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaMeasurementProtocolSecret) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
13833        self._request = new_value;
13834        self
13835    }
13836    /// Output only. Resource name of this secret. This secret may be a child of any type of stream. Format: properties/{property}/webDataStreams/{webDataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
13837    ///
13838    /// Sets the *name* path property to the given value.
13839    ///
13840    /// Even though the property as already been set when instantiating this call,
13841    /// we provide this method for API completeness.
13842    pub fn name(mut self, new_value: &str) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
13843        self._name = new_value.to_string();
13844        self
13845    }
13846    /// The list of fields to be updated. Omitted fields will not be updated.
13847    ///
13848    /// Sets the *update mask* query property to the given value.
13849    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
13850        self._update_mask = Some(new_value);
13851        self
13852    }
13853    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13854    /// while executing the actual API request.
13855    /// 
13856    /// ````text
13857    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13858    /// ````
13859    ///
13860    /// Sets the *delegate* property to the given value.
13861    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
13862        self._delegate = Some(new_value);
13863        self
13864    }
13865
13866    /// Set any additional parameter of the query string used in the request.
13867    /// It should be used to set parameters which are not yet available through their own
13868    /// setters.
13869    ///
13870    /// Please note that this method must not be used to set any of the known parameters
13871    /// which have their own setter method. If done anyway, the request will fail.
13872    ///
13873    /// # Additional Parameters
13874    ///
13875    /// * *$.xgafv* (query-string) - V1 error format.
13876    /// * *access_token* (query-string) - OAuth access token.
13877    /// * *alt* (query-string) - Data format for response.
13878    /// * *callback* (query-string) - JSONP
13879    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13880    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13881    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13882    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13883    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13884    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13885    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13886    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S>
13887                                                        where T: AsRef<str> {
13888        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
13889        self
13890    }
13891
13892    /// Identifies the authorization scope for the method you are building.
13893    ///
13894    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13895    /// [`Scope::AnalyticEdit`].
13896    ///
13897    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13898    /// tokens for more than one scope.
13899    ///
13900    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13901    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13902    /// sufficient, a read-write scope will do as well.
13903    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S>
13904                                                        where St: AsRef<str> {
13905        self._scopes.insert(String::from(scope.as_ref()));
13906        self
13907    }
13908    /// Identifies the authorization scope(s) for the method you are building.
13909    ///
13910    /// See [`Self::add_scope()`] for details.
13911    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S>
13912                                                        where I: IntoIterator<Item = St>,
13913                                                         St: AsRef<str> {
13914        self._scopes
13915            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13916        self
13917    }
13918
13919    /// Removes all scopes, and no default scope will be used either.
13920    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13921    /// for details).
13922    pub fn clear_scopes(mut self) -> PropertyDataStreamMeasurementProtocolSecretPatchCall<'a, S> {
13923        self._scopes.clear();
13924        self
13925    }
13926}
13927
13928
13929/// Creates a DataStream.
13930///
13931/// A builder for the *dataStreams.create* method supported by a *property* resource.
13932/// It is not used directly, but through a [`PropertyMethods`] instance.
13933///
13934/// # Example
13935///
13936/// Instantiate a resource method builder
13937///
13938/// ```test_harness,no_run
13939/// # extern crate hyper;
13940/// # extern crate hyper_rustls;
13941/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
13942/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDataStream;
13943/// # async fn dox() {
13944/// # use std::default::Default;
13945/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
13946/// 
13947/// # let secret: oauth2::ApplicationSecret = Default::default();
13948/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
13949/// #         secret,
13950/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13951/// #     ).build().await.unwrap();
13952/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
13953/// // As the method needs a request, you would usually fill it with the desired information
13954/// // into the respective structure. Some of the parts shown here might not be applicable !
13955/// // Values shown here are possibly random and not representative !
13956/// let mut req = GoogleAnalyticsAdminV1alphaDataStream::default();
13957/// 
13958/// // You can configure optional parameters by calling the respective setters at will, and
13959/// // execute the final call using `doit()`.
13960/// // Values shown here are possibly random and not representative !
13961/// let result = hub.properties().data_streams_create(req, "parent")
13962///              .doit().await;
13963/// # }
13964/// ```
13965pub struct PropertyDataStreamCreateCall<'a, S>
13966    where S: 'a {
13967
13968    hub: &'a GoogleAnalyticsAdmin<S>,
13969    _request: GoogleAnalyticsAdminV1alphaDataStream,
13970    _parent: String,
13971    _delegate: Option<&'a mut dyn client::Delegate>,
13972    _additional_params: HashMap<String, String>,
13973    _scopes: BTreeSet<String>
13974}
13975
13976impl<'a, S> client::CallBuilder for PropertyDataStreamCreateCall<'a, S> {}
13977
13978impl<'a, S> PropertyDataStreamCreateCall<'a, S>
13979where
13980    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
13981    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
13982    S::Future: Send + Unpin + 'static,
13983    S::Error: Into<Box<dyn StdError + Send + Sync>>,
13984{
13985
13986
13987    /// Perform the operation you have build so far.
13988    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataStream)> {
13989        use std::io::{Read, Seek};
13990        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
13991        use client::{ToParts, url::Params};
13992        use std::borrow::Cow;
13993
13994        let mut dd = client::DefaultDelegate;
13995        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
13996        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.create",
13997                               http_method: hyper::Method::POST });
13998
13999        for &field in ["alt", "parent"].iter() {
14000            if self._additional_params.contains_key(field) {
14001                dlg.finished(false);
14002                return Err(client::Error::FieldClash(field));
14003            }
14004        }
14005
14006        let mut params = Params::with_capacity(4 + self._additional_params.len());
14007        params.push("parent", self._parent);
14008
14009        params.extend(self._additional_params.iter());
14010
14011        params.push("alt", "json");
14012        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/dataStreams";
14013        if self._scopes.is_empty() {
14014            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
14015        }
14016
14017        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14018            url = params.uri_replacement(url, param_name, find_this, true);
14019        }
14020        {
14021            let to_remove = ["parent"];
14022            params.remove_params(&to_remove);
14023        }
14024
14025        let url = params.parse_with_url(&url);
14026
14027        let mut json_mime_type = mime::APPLICATION_JSON;
14028        let mut request_value_reader =
14029            {
14030                let mut value = json::value::to_value(&self._request).expect("serde to work");
14031                client::remove_json_null_values(&mut value);
14032                let mut dst = io::Cursor::new(Vec::with_capacity(128));
14033                json::to_writer(&mut dst, &value).unwrap();
14034                dst
14035            };
14036        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
14037        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
14038
14039
14040        loop {
14041            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
14042                Ok(token) => token,
14043                Err(e) => {
14044                    match dlg.token(e) {
14045                        Ok(token) => token,
14046                        Err(e) => {
14047                            dlg.finished(false);
14048                            return Err(client::Error::MissingToken(e));
14049                        }
14050                    }
14051                }
14052            };
14053            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
14054            let mut req_result = {
14055                let client = &self.hub.client;
14056                dlg.pre_request();
14057                let mut req_builder = hyper::Request::builder()
14058                    .method(hyper::Method::POST)
14059                    .uri(url.as_str())
14060                    .header(USER_AGENT, self.hub._user_agent.clone());
14061
14062                if let Some(token) = token.as_ref() {
14063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14064                }
14065
14066
14067                        let request = req_builder
14068                        .header(CONTENT_TYPE, json_mime_type.to_string())
14069                        .header(CONTENT_LENGTH, request_size as u64)
14070                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
14071
14072                client.request(request.unwrap()).await
14073
14074            };
14075
14076            match req_result {
14077                Err(err) => {
14078                    if let client::Retry::After(d) = dlg.http_error(&err) {
14079                        sleep(d).await;
14080                        continue;
14081                    }
14082                    dlg.finished(false);
14083                    return Err(client::Error::HttpError(err))
14084                }
14085                Ok(mut res) => {
14086                    if !res.status().is_success() {
14087                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14088                        let (parts, _) = res.into_parts();
14089                        let body = hyper::Body::from(res_body_string.clone());
14090                        let restored_response = hyper::Response::from_parts(parts, body);
14091
14092                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
14093
14094                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
14095                            sleep(d).await;
14096                            continue;
14097                        }
14098
14099                        dlg.finished(false);
14100
14101                        return match server_response {
14102                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
14103                            None => Err(client::Error::Failure(restored_response)),
14104                        }
14105                    }
14106                    let result_value = {
14107                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14108
14109                        match json::from_str(&res_body_string) {
14110                            Ok(decoded) => (res, decoded),
14111                            Err(err) => {
14112                                dlg.response_json_decode_error(&res_body_string, &err);
14113                                return Err(client::Error::JsonDecodeError(res_body_string, err));
14114                            }
14115                        }
14116                    };
14117
14118                    dlg.finished(true);
14119                    return Ok(result_value)
14120                }
14121            }
14122        }
14123    }
14124
14125
14126    ///
14127    /// Sets the *request* property to the given value.
14128    ///
14129    /// Even though the property as already been set when instantiating this call,
14130    /// we provide this method for API completeness.
14131    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDataStream) -> PropertyDataStreamCreateCall<'a, S> {
14132        self._request = new_value;
14133        self
14134    }
14135    /// Required. Example format: properties/1234
14136    ///
14137    /// Sets the *parent* path property to the given value.
14138    ///
14139    /// Even though the property as already been set when instantiating this call,
14140    /// we provide this method for API completeness.
14141    pub fn parent(mut self, new_value: &str) -> PropertyDataStreamCreateCall<'a, S> {
14142        self._parent = new_value.to_string();
14143        self
14144    }
14145    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14146    /// while executing the actual API request.
14147    /// 
14148    /// ````text
14149    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14150    /// ````
14151    ///
14152    /// Sets the *delegate* property to the given value.
14153    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamCreateCall<'a, S> {
14154        self._delegate = Some(new_value);
14155        self
14156    }
14157
14158    /// Set any additional parameter of the query string used in the request.
14159    /// It should be used to set parameters which are not yet available through their own
14160    /// setters.
14161    ///
14162    /// Please note that this method must not be used to set any of the known parameters
14163    /// which have their own setter method. If done anyway, the request will fail.
14164    ///
14165    /// # Additional Parameters
14166    ///
14167    /// * *$.xgafv* (query-string) - V1 error format.
14168    /// * *access_token* (query-string) - OAuth access token.
14169    /// * *alt* (query-string) - Data format for response.
14170    /// * *callback* (query-string) - JSONP
14171    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14172    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14173    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14174    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14175    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14176    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14177    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14178    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamCreateCall<'a, S>
14179                                                        where T: AsRef<str> {
14180        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
14181        self
14182    }
14183
14184    /// Identifies the authorization scope for the method you are building.
14185    ///
14186    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14187    /// [`Scope::AnalyticEdit`].
14188    ///
14189    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14190    /// tokens for more than one scope.
14191    ///
14192    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14193    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14194    /// sufficient, a read-write scope will do as well.
14195    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamCreateCall<'a, S>
14196                                                        where St: AsRef<str> {
14197        self._scopes.insert(String::from(scope.as_ref()));
14198        self
14199    }
14200    /// Identifies the authorization scope(s) for the method you are building.
14201    ///
14202    /// See [`Self::add_scope()`] for details.
14203    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamCreateCall<'a, S>
14204                                                        where I: IntoIterator<Item = St>,
14205                                                         St: AsRef<str> {
14206        self._scopes
14207            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14208        self
14209    }
14210
14211    /// Removes all scopes, and no default scope will be used either.
14212    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14213    /// for details).
14214    pub fn clear_scopes(mut self) -> PropertyDataStreamCreateCall<'a, S> {
14215        self._scopes.clear();
14216        self
14217    }
14218}
14219
14220
14221/// Deletes a DataStream on a property.
14222///
14223/// A builder for the *dataStreams.delete* method supported by a *property* resource.
14224/// It is not used directly, but through a [`PropertyMethods`] instance.
14225///
14226/// # Example
14227///
14228/// Instantiate a resource method builder
14229///
14230/// ```test_harness,no_run
14231/// # extern crate hyper;
14232/// # extern crate hyper_rustls;
14233/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
14234/// # async fn dox() {
14235/// # use std::default::Default;
14236/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
14237/// 
14238/// # let secret: oauth2::ApplicationSecret = Default::default();
14239/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
14240/// #         secret,
14241/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14242/// #     ).build().await.unwrap();
14243/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
14244/// // You can configure optional parameters by calling the respective setters at will, and
14245/// // execute the final call using `doit()`.
14246/// // Values shown here are possibly random and not representative !
14247/// let result = hub.properties().data_streams_delete("name")
14248///              .doit().await;
14249/// # }
14250/// ```
14251pub struct PropertyDataStreamDeleteCall<'a, S>
14252    where S: 'a {
14253
14254    hub: &'a GoogleAnalyticsAdmin<S>,
14255    _name: String,
14256    _delegate: Option<&'a mut dyn client::Delegate>,
14257    _additional_params: HashMap<String, String>,
14258    _scopes: BTreeSet<String>
14259}
14260
14261impl<'a, S> client::CallBuilder for PropertyDataStreamDeleteCall<'a, S> {}
14262
14263impl<'a, S> PropertyDataStreamDeleteCall<'a, S>
14264where
14265    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
14266    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
14267    S::Future: Send + Unpin + 'static,
14268    S::Error: Into<Box<dyn StdError + Send + Sync>>,
14269{
14270
14271
14272    /// Perform the operation you have build so far.
14273    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
14274        use std::io::{Read, Seek};
14275        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
14276        use client::{ToParts, url::Params};
14277        use std::borrow::Cow;
14278
14279        let mut dd = client::DefaultDelegate;
14280        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
14281        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.delete",
14282                               http_method: hyper::Method::DELETE });
14283
14284        for &field in ["alt", "name"].iter() {
14285            if self._additional_params.contains_key(field) {
14286                dlg.finished(false);
14287                return Err(client::Error::FieldClash(field));
14288            }
14289        }
14290
14291        let mut params = Params::with_capacity(3 + self._additional_params.len());
14292        params.push("name", self._name);
14293
14294        params.extend(self._additional_params.iter());
14295
14296        params.push("alt", "json");
14297        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
14298        if self._scopes.is_empty() {
14299            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
14300        }
14301
14302        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14303            url = params.uri_replacement(url, param_name, find_this, true);
14304        }
14305        {
14306            let to_remove = ["name"];
14307            params.remove_params(&to_remove);
14308        }
14309
14310        let url = params.parse_with_url(&url);
14311
14312
14313
14314        loop {
14315            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
14316                Ok(token) => token,
14317                Err(e) => {
14318                    match dlg.token(e) {
14319                        Ok(token) => token,
14320                        Err(e) => {
14321                            dlg.finished(false);
14322                            return Err(client::Error::MissingToken(e));
14323                        }
14324                    }
14325                }
14326            };
14327            let mut req_result = {
14328                let client = &self.hub.client;
14329                dlg.pre_request();
14330                let mut req_builder = hyper::Request::builder()
14331                    .method(hyper::Method::DELETE)
14332                    .uri(url.as_str())
14333                    .header(USER_AGENT, self.hub._user_agent.clone());
14334
14335                if let Some(token) = token.as_ref() {
14336                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14337                }
14338
14339
14340                        let request = req_builder
14341                        .body(hyper::body::Body::empty());
14342
14343                client.request(request.unwrap()).await
14344
14345            };
14346
14347            match req_result {
14348                Err(err) => {
14349                    if let client::Retry::After(d) = dlg.http_error(&err) {
14350                        sleep(d).await;
14351                        continue;
14352                    }
14353                    dlg.finished(false);
14354                    return Err(client::Error::HttpError(err))
14355                }
14356                Ok(mut res) => {
14357                    if !res.status().is_success() {
14358                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14359                        let (parts, _) = res.into_parts();
14360                        let body = hyper::Body::from(res_body_string.clone());
14361                        let restored_response = hyper::Response::from_parts(parts, body);
14362
14363                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
14364
14365                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
14366                            sleep(d).await;
14367                            continue;
14368                        }
14369
14370                        dlg.finished(false);
14371
14372                        return match server_response {
14373                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
14374                            None => Err(client::Error::Failure(restored_response)),
14375                        }
14376                    }
14377                    let result_value = {
14378                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14379
14380                        match json::from_str(&res_body_string) {
14381                            Ok(decoded) => (res, decoded),
14382                            Err(err) => {
14383                                dlg.response_json_decode_error(&res_body_string, &err);
14384                                return Err(client::Error::JsonDecodeError(res_body_string, err));
14385                            }
14386                        }
14387                    };
14388
14389                    dlg.finished(true);
14390                    return Ok(result_value)
14391                }
14392            }
14393        }
14394    }
14395
14396
14397    /// Required. The name of the DataStream to delete. Example format: properties/1234/dataStreams/5678
14398    ///
14399    /// Sets the *name* path property to the given value.
14400    ///
14401    /// Even though the property as already been set when instantiating this call,
14402    /// we provide this method for API completeness.
14403    pub fn name(mut self, new_value: &str) -> PropertyDataStreamDeleteCall<'a, S> {
14404        self._name = new_value.to_string();
14405        self
14406    }
14407    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14408    /// while executing the actual API request.
14409    /// 
14410    /// ````text
14411    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14412    /// ````
14413    ///
14414    /// Sets the *delegate* property to the given value.
14415    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamDeleteCall<'a, S> {
14416        self._delegate = Some(new_value);
14417        self
14418    }
14419
14420    /// Set any additional parameter of the query string used in the request.
14421    /// It should be used to set parameters which are not yet available through their own
14422    /// setters.
14423    ///
14424    /// Please note that this method must not be used to set any of the known parameters
14425    /// which have their own setter method. If done anyway, the request will fail.
14426    ///
14427    /// # Additional Parameters
14428    ///
14429    /// * *$.xgafv* (query-string) - V1 error format.
14430    /// * *access_token* (query-string) - OAuth access token.
14431    /// * *alt* (query-string) - Data format for response.
14432    /// * *callback* (query-string) - JSONP
14433    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14434    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14435    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14436    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14437    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14438    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14439    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14440    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamDeleteCall<'a, S>
14441                                                        where T: AsRef<str> {
14442        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
14443        self
14444    }
14445
14446    /// Identifies the authorization scope for the method you are building.
14447    ///
14448    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14449    /// [`Scope::AnalyticEdit`].
14450    ///
14451    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14452    /// tokens for more than one scope.
14453    ///
14454    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14455    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14456    /// sufficient, a read-write scope will do as well.
14457    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamDeleteCall<'a, S>
14458                                                        where St: AsRef<str> {
14459        self._scopes.insert(String::from(scope.as_ref()));
14460        self
14461    }
14462    /// Identifies the authorization scope(s) for the method you are building.
14463    ///
14464    /// See [`Self::add_scope()`] for details.
14465    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamDeleteCall<'a, S>
14466                                                        where I: IntoIterator<Item = St>,
14467                                                         St: AsRef<str> {
14468        self._scopes
14469            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14470        self
14471    }
14472
14473    /// Removes all scopes, and no default scope will be used either.
14474    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14475    /// for details).
14476    pub fn clear_scopes(mut self) -> PropertyDataStreamDeleteCall<'a, S> {
14477        self._scopes.clear();
14478        self
14479    }
14480}
14481
14482
14483/// Lookup for a single DataStream.
14484///
14485/// A builder for the *dataStreams.get* method supported by a *property* resource.
14486/// It is not used directly, but through a [`PropertyMethods`] instance.
14487///
14488/// # Example
14489///
14490/// Instantiate a resource method builder
14491///
14492/// ```test_harness,no_run
14493/// # extern crate hyper;
14494/// # extern crate hyper_rustls;
14495/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
14496/// # async fn dox() {
14497/// # use std::default::Default;
14498/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
14499/// 
14500/// # let secret: oauth2::ApplicationSecret = Default::default();
14501/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
14502/// #         secret,
14503/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14504/// #     ).build().await.unwrap();
14505/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
14506/// // You can configure optional parameters by calling the respective setters at will, and
14507/// // execute the final call using `doit()`.
14508/// // Values shown here are possibly random and not representative !
14509/// let result = hub.properties().data_streams_get("name")
14510///              .doit().await;
14511/// # }
14512/// ```
14513pub struct PropertyDataStreamGetCall<'a, S>
14514    where S: 'a {
14515
14516    hub: &'a GoogleAnalyticsAdmin<S>,
14517    _name: String,
14518    _delegate: Option<&'a mut dyn client::Delegate>,
14519    _additional_params: HashMap<String, String>,
14520    _scopes: BTreeSet<String>
14521}
14522
14523impl<'a, S> client::CallBuilder for PropertyDataStreamGetCall<'a, S> {}
14524
14525impl<'a, S> PropertyDataStreamGetCall<'a, S>
14526where
14527    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
14528    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
14529    S::Future: Send + Unpin + 'static,
14530    S::Error: Into<Box<dyn StdError + Send + Sync>>,
14531{
14532
14533
14534    /// Perform the operation you have build so far.
14535    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataStream)> {
14536        use std::io::{Read, Seek};
14537        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
14538        use client::{ToParts, url::Params};
14539        use std::borrow::Cow;
14540
14541        let mut dd = client::DefaultDelegate;
14542        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
14543        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.get",
14544                               http_method: hyper::Method::GET });
14545
14546        for &field in ["alt", "name"].iter() {
14547            if self._additional_params.contains_key(field) {
14548                dlg.finished(false);
14549                return Err(client::Error::FieldClash(field));
14550            }
14551        }
14552
14553        let mut params = Params::with_capacity(3 + self._additional_params.len());
14554        params.push("name", self._name);
14555
14556        params.extend(self._additional_params.iter());
14557
14558        params.push("alt", "json");
14559        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
14560        if self._scopes.is_empty() {
14561            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
14562        }
14563
14564        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14565            url = params.uri_replacement(url, param_name, find_this, true);
14566        }
14567        {
14568            let to_remove = ["name"];
14569            params.remove_params(&to_remove);
14570        }
14571
14572        let url = params.parse_with_url(&url);
14573
14574
14575
14576        loop {
14577            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
14578                Ok(token) => token,
14579                Err(e) => {
14580                    match dlg.token(e) {
14581                        Ok(token) => token,
14582                        Err(e) => {
14583                            dlg.finished(false);
14584                            return Err(client::Error::MissingToken(e));
14585                        }
14586                    }
14587                }
14588            };
14589            let mut req_result = {
14590                let client = &self.hub.client;
14591                dlg.pre_request();
14592                let mut req_builder = hyper::Request::builder()
14593                    .method(hyper::Method::GET)
14594                    .uri(url.as_str())
14595                    .header(USER_AGENT, self.hub._user_agent.clone());
14596
14597                if let Some(token) = token.as_ref() {
14598                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14599                }
14600
14601
14602                        let request = req_builder
14603                        .body(hyper::body::Body::empty());
14604
14605                client.request(request.unwrap()).await
14606
14607            };
14608
14609            match req_result {
14610                Err(err) => {
14611                    if let client::Retry::After(d) = dlg.http_error(&err) {
14612                        sleep(d).await;
14613                        continue;
14614                    }
14615                    dlg.finished(false);
14616                    return Err(client::Error::HttpError(err))
14617                }
14618                Ok(mut res) => {
14619                    if !res.status().is_success() {
14620                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14621                        let (parts, _) = res.into_parts();
14622                        let body = hyper::Body::from(res_body_string.clone());
14623                        let restored_response = hyper::Response::from_parts(parts, body);
14624
14625                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
14626
14627                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
14628                            sleep(d).await;
14629                            continue;
14630                        }
14631
14632                        dlg.finished(false);
14633
14634                        return match server_response {
14635                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
14636                            None => Err(client::Error::Failure(restored_response)),
14637                        }
14638                    }
14639                    let result_value = {
14640                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14641
14642                        match json::from_str(&res_body_string) {
14643                            Ok(decoded) => (res, decoded),
14644                            Err(err) => {
14645                                dlg.response_json_decode_error(&res_body_string, &err);
14646                                return Err(client::Error::JsonDecodeError(res_body_string, err));
14647                            }
14648                        }
14649                    };
14650
14651                    dlg.finished(true);
14652                    return Ok(result_value)
14653                }
14654            }
14655        }
14656    }
14657
14658
14659    /// Required. The name of the DataStream to get. Example format: properties/1234/dataStreams/5678
14660    ///
14661    /// Sets the *name* path property to the given value.
14662    ///
14663    /// Even though the property as already been set when instantiating this call,
14664    /// we provide this method for API completeness.
14665    pub fn name(mut self, new_value: &str) -> PropertyDataStreamGetCall<'a, S> {
14666        self._name = new_value.to_string();
14667        self
14668    }
14669    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14670    /// while executing the actual API request.
14671    /// 
14672    /// ````text
14673    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14674    /// ````
14675    ///
14676    /// Sets the *delegate* property to the given value.
14677    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamGetCall<'a, S> {
14678        self._delegate = Some(new_value);
14679        self
14680    }
14681
14682    /// Set any additional parameter of the query string used in the request.
14683    /// It should be used to set parameters which are not yet available through their own
14684    /// setters.
14685    ///
14686    /// Please note that this method must not be used to set any of the known parameters
14687    /// which have their own setter method. If done anyway, the request will fail.
14688    ///
14689    /// # Additional Parameters
14690    ///
14691    /// * *$.xgafv* (query-string) - V1 error format.
14692    /// * *access_token* (query-string) - OAuth access token.
14693    /// * *alt* (query-string) - Data format for response.
14694    /// * *callback* (query-string) - JSONP
14695    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14696    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14697    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14698    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14699    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14700    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14701    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14702    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamGetCall<'a, S>
14703                                                        where T: AsRef<str> {
14704        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
14705        self
14706    }
14707
14708    /// Identifies the authorization scope for the method you are building.
14709    ///
14710    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14711    /// [`Scope::AnalyticReadonly`].
14712    ///
14713    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14714    /// tokens for more than one scope.
14715    ///
14716    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14717    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14718    /// sufficient, a read-write scope will do as well.
14719    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamGetCall<'a, S>
14720                                                        where St: AsRef<str> {
14721        self._scopes.insert(String::from(scope.as_ref()));
14722        self
14723    }
14724    /// Identifies the authorization scope(s) for the method you are building.
14725    ///
14726    /// See [`Self::add_scope()`] for details.
14727    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamGetCall<'a, S>
14728                                                        where I: IntoIterator<Item = St>,
14729                                                         St: AsRef<str> {
14730        self._scopes
14731            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14732        self
14733    }
14734
14735    /// Removes all scopes, and no default scope will be used either.
14736    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14737    /// for details).
14738    pub fn clear_scopes(mut self) -> PropertyDataStreamGetCall<'a, S> {
14739        self._scopes.clear();
14740        self
14741    }
14742}
14743
14744
14745/// Returns the Site Tag for the specified web stream. Site Tags are immutable singletons.
14746///
14747/// A builder for the *dataStreams.getGlobalSiteTag* method supported by a *property* resource.
14748/// It is not used directly, but through a [`PropertyMethods`] instance.
14749///
14750/// # Example
14751///
14752/// Instantiate a resource method builder
14753///
14754/// ```test_harness,no_run
14755/// # extern crate hyper;
14756/// # extern crate hyper_rustls;
14757/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
14758/// # async fn dox() {
14759/// # use std::default::Default;
14760/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
14761/// 
14762/// # let secret: oauth2::ApplicationSecret = Default::default();
14763/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
14764/// #         secret,
14765/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14766/// #     ).build().await.unwrap();
14767/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
14768/// // You can configure optional parameters by calling the respective setters at will, and
14769/// // execute the final call using `doit()`.
14770/// // Values shown here are possibly random and not representative !
14771/// let result = hub.properties().data_streams_get_global_site_tag("name")
14772///              .doit().await;
14773/// # }
14774/// ```
14775pub struct PropertyDataStreamGetGlobalSiteTagCall<'a, S>
14776    where S: 'a {
14777
14778    hub: &'a GoogleAnalyticsAdmin<S>,
14779    _name: String,
14780    _delegate: Option<&'a mut dyn client::Delegate>,
14781    _additional_params: HashMap<String, String>,
14782    _scopes: BTreeSet<String>
14783}
14784
14785impl<'a, S> client::CallBuilder for PropertyDataStreamGetGlobalSiteTagCall<'a, S> {}
14786
14787impl<'a, S> PropertyDataStreamGetGlobalSiteTagCall<'a, S>
14788where
14789    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
14790    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
14791    S::Future: Send + Unpin + 'static,
14792    S::Error: Into<Box<dyn StdError + Send + Sync>>,
14793{
14794
14795
14796    /// Perform the operation you have build so far.
14797    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaGlobalSiteTag)> {
14798        use std::io::{Read, Seek};
14799        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
14800        use client::{ToParts, url::Params};
14801        use std::borrow::Cow;
14802
14803        let mut dd = client::DefaultDelegate;
14804        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
14805        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.getGlobalSiteTag",
14806                               http_method: hyper::Method::GET });
14807
14808        for &field in ["alt", "name"].iter() {
14809            if self._additional_params.contains_key(field) {
14810                dlg.finished(false);
14811                return Err(client::Error::FieldClash(field));
14812            }
14813        }
14814
14815        let mut params = Params::with_capacity(3 + self._additional_params.len());
14816        params.push("name", self._name);
14817
14818        params.extend(self._additional_params.iter());
14819
14820        params.push("alt", "json");
14821        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
14822        if self._scopes.is_empty() {
14823            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
14824        }
14825
14826        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14827            url = params.uri_replacement(url, param_name, find_this, true);
14828        }
14829        {
14830            let to_remove = ["name"];
14831            params.remove_params(&to_remove);
14832        }
14833
14834        let url = params.parse_with_url(&url);
14835
14836
14837
14838        loop {
14839            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
14840                Ok(token) => token,
14841                Err(e) => {
14842                    match dlg.token(e) {
14843                        Ok(token) => token,
14844                        Err(e) => {
14845                            dlg.finished(false);
14846                            return Err(client::Error::MissingToken(e));
14847                        }
14848                    }
14849                }
14850            };
14851            let mut req_result = {
14852                let client = &self.hub.client;
14853                dlg.pre_request();
14854                let mut req_builder = hyper::Request::builder()
14855                    .method(hyper::Method::GET)
14856                    .uri(url.as_str())
14857                    .header(USER_AGENT, self.hub._user_agent.clone());
14858
14859                if let Some(token) = token.as_ref() {
14860                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14861                }
14862
14863
14864                        let request = req_builder
14865                        .body(hyper::body::Body::empty());
14866
14867                client.request(request.unwrap()).await
14868
14869            };
14870
14871            match req_result {
14872                Err(err) => {
14873                    if let client::Retry::After(d) = dlg.http_error(&err) {
14874                        sleep(d).await;
14875                        continue;
14876                    }
14877                    dlg.finished(false);
14878                    return Err(client::Error::HttpError(err))
14879                }
14880                Ok(mut res) => {
14881                    if !res.status().is_success() {
14882                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14883                        let (parts, _) = res.into_parts();
14884                        let body = hyper::Body::from(res_body_string.clone());
14885                        let restored_response = hyper::Response::from_parts(parts, body);
14886
14887                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
14888
14889                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
14890                            sleep(d).await;
14891                            continue;
14892                        }
14893
14894                        dlg.finished(false);
14895
14896                        return match server_response {
14897                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
14898                            None => Err(client::Error::Failure(restored_response)),
14899                        }
14900                    }
14901                    let result_value = {
14902                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
14903
14904                        match json::from_str(&res_body_string) {
14905                            Ok(decoded) => (res, decoded),
14906                            Err(err) => {
14907                                dlg.response_json_decode_error(&res_body_string, &err);
14908                                return Err(client::Error::JsonDecodeError(res_body_string, err));
14909                            }
14910                        }
14911                    };
14912
14913                    dlg.finished(true);
14914                    return Ok(result_value)
14915                }
14916            }
14917        }
14918    }
14919
14920
14921    /// Required. The name of the site tag to lookup. Note that site tags are singletons and do not have unique IDs. Format: properties/{property_id}/dataStreams/{stream_id}/globalSiteTag Example: "properties/123/dataStreams/456/globalSiteTag"
14922    ///
14923    /// Sets the *name* path property to the given value.
14924    ///
14925    /// Even though the property as already been set when instantiating this call,
14926    /// we provide this method for API completeness.
14927    pub fn name(mut self, new_value: &str) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S> {
14928        self._name = new_value.to_string();
14929        self
14930    }
14931    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14932    /// while executing the actual API request.
14933    /// 
14934    /// ````text
14935    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14936    /// ````
14937    ///
14938    /// Sets the *delegate* property to the given value.
14939    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S> {
14940        self._delegate = Some(new_value);
14941        self
14942    }
14943
14944    /// Set any additional parameter of the query string used in the request.
14945    /// It should be used to set parameters which are not yet available through their own
14946    /// setters.
14947    ///
14948    /// Please note that this method must not be used to set any of the known parameters
14949    /// which have their own setter method. If done anyway, the request will fail.
14950    ///
14951    /// # Additional Parameters
14952    ///
14953    /// * *$.xgafv* (query-string) - V1 error format.
14954    /// * *access_token* (query-string) - OAuth access token.
14955    /// * *alt* (query-string) - Data format for response.
14956    /// * *callback* (query-string) - JSONP
14957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14958    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14961    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14964    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S>
14965                                                        where T: AsRef<str> {
14966        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
14967        self
14968    }
14969
14970    /// Identifies the authorization scope for the method you are building.
14971    ///
14972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14973    /// [`Scope::AnalyticReadonly`].
14974    ///
14975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14976    /// tokens for more than one scope.
14977    ///
14978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14980    /// sufficient, a read-write scope will do as well.
14981    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S>
14982                                                        where St: AsRef<str> {
14983        self._scopes.insert(String::from(scope.as_ref()));
14984        self
14985    }
14986    /// Identifies the authorization scope(s) for the method you are building.
14987    ///
14988    /// See [`Self::add_scope()`] for details.
14989    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S>
14990                                                        where I: IntoIterator<Item = St>,
14991                                                         St: AsRef<str> {
14992        self._scopes
14993            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14994        self
14995    }
14996
14997    /// Removes all scopes, and no default scope will be used either.
14998    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14999    /// for details).
15000    pub fn clear_scopes(mut self) -> PropertyDataStreamGetGlobalSiteTagCall<'a, S> {
15001        self._scopes.clear();
15002        self
15003    }
15004}
15005
15006
15007/// Lists DataStreams on a property.
15008///
15009/// A builder for the *dataStreams.list* method supported by a *property* resource.
15010/// It is not used directly, but through a [`PropertyMethods`] instance.
15011///
15012/// # Example
15013///
15014/// Instantiate a resource method builder
15015///
15016/// ```test_harness,no_run
15017/// # extern crate hyper;
15018/// # extern crate hyper_rustls;
15019/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
15020/// # async fn dox() {
15021/// # use std::default::Default;
15022/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
15023/// 
15024/// # let secret: oauth2::ApplicationSecret = Default::default();
15025/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
15026/// #         secret,
15027/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15028/// #     ).build().await.unwrap();
15029/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
15030/// // You can configure optional parameters by calling the respective setters at will, and
15031/// // execute the final call using `doit()`.
15032/// // Values shown here are possibly random and not representative !
15033/// let result = hub.properties().data_streams_list("parent")
15034///              .page_token("et")
15035///              .page_size(-95)
15036///              .doit().await;
15037/// # }
15038/// ```
15039pub struct PropertyDataStreamListCall<'a, S>
15040    where S: 'a {
15041
15042    hub: &'a GoogleAnalyticsAdmin<S>,
15043    _parent: String,
15044    _page_token: Option<String>,
15045    _page_size: Option<i32>,
15046    _delegate: Option<&'a mut dyn client::Delegate>,
15047    _additional_params: HashMap<String, String>,
15048    _scopes: BTreeSet<String>
15049}
15050
15051impl<'a, S> client::CallBuilder for PropertyDataStreamListCall<'a, S> {}
15052
15053impl<'a, S> PropertyDataStreamListCall<'a, S>
15054where
15055    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
15056    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
15057    S::Future: Send + Unpin + 'static,
15058    S::Error: Into<Box<dyn StdError + Send + Sync>>,
15059{
15060
15061
15062    /// Perform the operation you have build so far.
15063    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListDataStreamsResponse)> {
15064        use std::io::{Read, Seek};
15065        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
15066        use client::{ToParts, url::Params};
15067        use std::borrow::Cow;
15068
15069        let mut dd = client::DefaultDelegate;
15070        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
15071        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.list",
15072                               http_method: hyper::Method::GET });
15073
15074        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
15075            if self._additional_params.contains_key(field) {
15076                dlg.finished(false);
15077                return Err(client::Error::FieldClash(field));
15078            }
15079        }
15080
15081        let mut params = Params::with_capacity(5 + self._additional_params.len());
15082        params.push("parent", self._parent);
15083        if let Some(value) = self._page_token.as_ref() {
15084            params.push("pageToken", value);
15085        }
15086        if let Some(value) = self._page_size.as_ref() {
15087            params.push("pageSize", value.to_string());
15088        }
15089
15090        params.extend(self._additional_params.iter());
15091
15092        params.push("alt", "json");
15093        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/dataStreams";
15094        if self._scopes.is_empty() {
15095            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
15096        }
15097
15098        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15099            url = params.uri_replacement(url, param_name, find_this, true);
15100        }
15101        {
15102            let to_remove = ["parent"];
15103            params.remove_params(&to_remove);
15104        }
15105
15106        let url = params.parse_with_url(&url);
15107
15108
15109
15110        loop {
15111            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
15112                Ok(token) => token,
15113                Err(e) => {
15114                    match dlg.token(e) {
15115                        Ok(token) => token,
15116                        Err(e) => {
15117                            dlg.finished(false);
15118                            return Err(client::Error::MissingToken(e));
15119                        }
15120                    }
15121                }
15122            };
15123            let mut req_result = {
15124                let client = &self.hub.client;
15125                dlg.pre_request();
15126                let mut req_builder = hyper::Request::builder()
15127                    .method(hyper::Method::GET)
15128                    .uri(url.as_str())
15129                    .header(USER_AGENT, self.hub._user_agent.clone());
15130
15131                if let Some(token) = token.as_ref() {
15132                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15133                }
15134
15135
15136                        let request = req_builder
15137                        .body(hyper::body::Body::empty());
15138
15139                client.request(request.unwrap()).await
15140
15141            };
15142
15143            match req_result {
15144                Err(err) => {
15145                    if let client::Retry::After(d) = dlg.http_error(&err) {
15146                        sleep(d).await;
15147                        continue;
15148                    }
15149                    dlg.finished(false);
15150                    return Err(client::Error::HttpError(err))
15151                }
15152                Ok(mut res) => {
15153                    if !res.status().is_success() {
15154                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15155                        let (parts, _) = res.into_parts();
15156                        let body = hyper::Body::from(res_body_string.clone());
15157                        let restored_response = hyper::Response::from_parts(parts, body);
15158
15159                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
15160
15161                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
15162                            sleep(d).await;
15163                            continue;
15164                        }
15165
15166                        dlg.finished(false);
15167
15168                        return match server_response {
15169                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
15170                            None => Err(client::Error::Failure(restored_response)),
15171                        }
15172                    }
15173                    let result_value = {
15174                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15175
15176                        match json::from_str(&res_body_string) {
15177                            Ok(decoded) => (res, decoded),
15178                            Err(err) => {
15179                                dlg.response_json_decode_error(&res_body_string, &err);
15180                                return Err(client::Error::JsonDecodeError(res_body_string, err));
15181                            }
15182                        }
15183                    };
15184
15185                    dlg.finished(true);
15186                    return Ok(result_value)
15187                }
15188            }
15189        }
15190    }
15191
15192
15193    /// Required. Example format: properties/1234
15194    ///
15195    /// Sets the *parent* path property to the given value.
15196    ///
15197    /// Even though the property as already been set when instantiating this call,
15198    /// we provide this method for API completeness.
15199    pub fn parent(mut self, new_value: &str) -> PropertyDataStreamListCall<'a, S> {
15200        self._parent = new_value.to_string();
15201        self
15202    }
15203    /// A page token, received from a previous `ListDataStreams` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDataStreams` must match the call that provided the page token.
15204    ///
15205    /// Sets the *page token* query property to the given value.
15206    pub fn page_token(mut self, new_value: &str) -> PropertyDataStreamListCall<'a, S> {
15207        self._page_token = Some(new_value.to_string());
15208        self
15209    }
15210    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
15211    ///
15212    /// Sets the *page size* query property to the given value.
15213    pub fn page_size(mut self, new_value: i32) -> PropertyDataStreamListCall<'a, S> {
15214        self._page_size = Some(new_value);
15215        self
15216    }
15217    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15218    /// while executing the actual API request.
15219    /// 
15220    /// ````text
15221    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15222    /// ````
15223    ///
15224    /// Sets the *delegate* property to the given value.
15225    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamListCall<'a, S> {
15226        self._delegate = Some(new_value);
15227        self
15228    }
15229
15230    /// Set any additional parameter of the query string used in the request.
15231    /// It should be used to set parameters which are not yet available through their own
15232    /// setters.
15233    ///
15234    /// Please note that this method must not be used to set any of the known parameters
15235    /// which have their own setter method. If done anyway, the request will fail.
15236    ///
15237    /// # Additional Parameters
15238    ///
15239    /// * *$.xgafv* (query-string) - V1 error format.
15240    /// * *access_token* (query-string) - OAuth access token.
15241    /// * *alt* (query-string) - Data format for response.
15242    /// * *callback* (query-string) - JSONP
15243    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15244    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15245    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15246    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15247    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15248    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15249    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15250    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamListCall<'a, S>
15251                                                        where T: AsRef<str> {
15252        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
15253        self
15254    }
15255
15256    /// Identifies the authorization scope for the method you are building.
15257    ///
15258    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15259    /// [`Scope::AnalyticReadonly`].
15260    ///
15261    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15262    /// tokens for more than one scope.
15263    ///
15264    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15265    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15266    /// sufficient, a read-write scope will do as well.
15267    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamListCall<'a, S>
15268                                                        where St: AsRef<str> {
15269        self._scopes.insert(String::from(scope.as_ref()));
15270        self
15271    }
15272    /// Identifies the authorization scope(s) for the method you are building.
15273    ///
15274    /// See [`Self::add_scope()`] for details.
15275    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamListCall<'a, S>
15276                                                        where I: IntoIterator<Item = St>,
15277                                                         St: AsRef<str> {
15278        self._scopes
15279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15280        self
15281    }
15282
15283    /// Removes all scopes, and no default scope will be used either.
15284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15285    /// for details).
15286    pub fn clear_scopes(mut self) -> PropertyDataStreamListCall<'a, S> {
15287        self._scopes.clear();
15288        self
15289    }
15290}
15291
15292
15293/// Updates a DataStream on a property.
15294///
15295/// A builder for the *dataStreams.patch* method supported by a *property* resource.
15296/// It is not used directly, but through a [`PropertyMethods`] instance.
15297///
15298/// # Example
15299///
15300/// Instantiate a resource method builder
15301///
15302/// ```test_harness,no_run
15303/// # extern crate hyper;
15304/// # extern crate hyper_rustls;
15305/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
15306/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDataStream;
15307/// # async fn dox() {
15308/// # use std::default::Default;
15309/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
15310/// 
15311/// # let secret: oauth2::ApplicationSecret = Default::default();
15312/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
15313/// #         secret,
15314/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15315/// #     ).build().await.unwrap();
15316/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
15317/// // As the method needs a request, you would usually fill it with the desired information
15318/// // into the respective structure. Some of the parts shown here might not be applicable !
15319/// // Values shown here are possibly random and not representative !
15320/// let mut req = GoogleAnalyticsAdminV1alphaDataStream::default();
15321/// 
15322/// // You can configure optional parameters by calling the respective setters at will, and
15323/// // execute the final call using `doit()`.
15324/// // Values shown here are possibly random and not representative !
15325/// let result = hub.properties().data_streams_patch(req, "name")
15326///              .update_mask(&Default::default())
15327///              .doit().await;
15328/// # }
15329/// ```
15330pub struct PropertyDataStreamPatchCall<'a, S>
15331    where S: 'a {
15332
15333    hub: &'a GoogleAnalyticsAdmin<S>,
15334    _request: GoogleAnalyticsAdminV1alphaDataStream,
15335    _name: String,
15336    _update_mask: Option<client::FieldMask>,
15337    _delegate: Option<&'a mut dyn client::Delegate>,
15338    _additional_params: HashMap<String, String>,
15339    _scopes: BTreeSet<String>
15340}
15341
15342impl<'a, S> client::CallBuilder for PropertyDataStreamPatchCall<'a, S> {}
15343
15344impl<'a, S> PropertyDataStreamPatchCall<'a, S>
15345where
15346    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
15347    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
15348    S::Future: Send + Unpin + 'static,
15349    S::Error: Into<Box<dyn StdError + Send + Sync>>,
15350{
15351
15352
15353    /// Perform the operation you have build so far.
15354    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataStream)> {
15355        use std::io::{Read, Seek};
15356        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
15357        use client::{ToParts, url::Params};
15358        use std::borrow::Cow;
15359
15360        let mut dd = client::DefaultDelegate;
15361        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
15362        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.dataStreams.patch",
15363                               http_method: hyper::Method::PATCH });
15364
15365        for &field in ["alt", "name", "updateMask"].iter() {
15366            if self._additional_params.contains_key(field) {
15367                dlg.finished(false);
15368                return Err(client::Error::FieldClash(field));
15369            }
15370        }
15371
15372        let mut params = Params::with_capacity(5 + self._additional_params.len());
15373        params.push("name", self._name);
15374        if let Some(value) = self._update_mask.as_ref() {
15375            params.push("updateMask", value.to_string());
15376        }
15377
15378        params.extend(self._additional_params.iter());
15379
15380        params.push("alt", "json");
15381        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
15382        if self._scopes.is_empty() {
15383            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
15384        }
15385
15386        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15387            url = params.uri_replacement(url, param_name, find_this, true);
15388        }
15389        {
15390            let to_remove = ["name"];
15391            params.remove_params(&to_remove);
15392        }
15393
15394        let url = params.parse_with_url(&url);
15395
15396        let mut json_mime_type = mime::APPLICATION_JSON;
15397        let mut request_value_reader =
15398            {
15399                let mut value = json::value::to_value(&self._request).expect("serde to work");
15400                client::remove_json_null_values(&mut value);
15401                let mut dst = io::Cursor::new(Vec::with_capacity(128));
15402                json::to_writer(&mut dst, &value).unwrap();
15403                dst
15404            };
15405        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
15406        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
15407
15408
15409        loop {
15410            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
15411                Ok(token) => token,
15412                Err(e) => {
15413                    match dlg.token(e) {
15414                        Ok(token) => token,
15415                        Err(e) => {
15416                            dlg.finished(false);
15417                            return Err(client::Error::MissingToken(e));
15418                        }
15419                    }
15420                }
15421            };
15422            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
15423            let mut req_result = {
15424                let client = &self.hub.client;
15425                dlg.pre_request();
15426                let mut req_builder = hyper::Request::builder()
15427                    .method(hyper::Method::PATCH)
15428                    .uri(url.as_str())
15429                    .header(USER_AGENT, self.hub._user_agent.clone());
15430
15431                if let Some(token) = token.as_ref() {
15432                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15433                }
15434
15435
15436                        let request = req_builder
15437                        .header(CONTENT_TYPE, json_mime_type.to_string())
15438                        .header(CONTENT_LENGTH, request_size as u64)
15439                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
15440
15441                client.request(request.unwrap()).await
15442
15443            };
15444
15445            match req_result {
15446                Err(err) => {
15447                    if let client::Retry::After(d) = dlg.http_error(&err) {
15448                        sleep(d).await;
15449                        continue;
15450                    }
15451                    dlg.finished(false);
15452                    return Err(client::Error::HttpError(err))
15453                }
15454                Ok(mut res) => {
15455                    if !res.status().is_success() {
15456                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15457                        let (parts, _) = res.into_parts();
15458                        let body = hyper::Body::from(res_body_string.clone());
15459                        let restored_response = hyper::Response::from_parts(parts, body);
15460
15461                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
15462
15463                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
15464                            sleep(d).await;
15465                            continue;
15466                        }
15467
15468                        dlg.finished(false);
15469
15470                        return match server_response {
15471                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
15472                            None => Err(client::Error::Failure(restored_response)),
15473                        }
15474                    }
15475                    let result_value = {
15476                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15477
15478                        match json::from_str(&res_body_string) {
15479                            Ok(decoded) => (res, decoded),
15480                            Err(err) => {
15481                                dlg.response_json_decode_error(&res_body_string, &err);
15482                                return Err(client::Error::JsonDecodeError(res_body_string, err));
15483                            }
15484                        }
15485                    };
15486
15487                    dlg.finished(true);
15488                    return Ok(result_value)
15489                }
15490            }
15491        }
15492    }
15493
15494
15495    ///
15496    /// Sets the *request* property to the given value.
15497    ///
15498    /// Even though the property as already been set when instantiating this call,
15499    /// we provide this method for API completeness.
15500    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDataStream) -> PropertyDataStreamPatchCall<'a, S> {
15501        self._request = new_value;
15502        self
15503    }
15504    /// Output only. Resource name of this Data Stream. Format: properties/{property_id}/dataStreams/{stream_id} Example: "properties/1000/dataStreams/2000"
15505    ///
15506    /// Sets the *name* path property to the given value.
15507    ///
15508    /// Even though the property as already been set when instantiating this call,
15509    /// we provide this method for API completeness.
15510    pub fn name(mut self, new_value: &str) -> PropertyDataStreamPatchCall<'a, S> {
15511        self._name = new_value.to_string();
15512        self
15513    }
15514    /// Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
15515    ///
15516    /// Sets the *update mask* query property to the given value.
15517    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyDataStreamPatchCall<'a, S> {
15518        self._update_mask = Some(new_value);
15519        self
15520    }
15521    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15522    /// while executing the actual API request.
15523    /// 
15524    /// ````text
15525    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15526    /// ````
15527    ///
15528    /// Sets the *delegate* property to the given value.
15529    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDataStreamPatchCall<'a, S> {
15530        self._delegate = Some(new_value);
15531        self
15532    }
15533
15534    /// Set any additional parameter of the query string used in the request.
15535    /// It should be used to set parameters which are not yet available through their own
15536    /// setters.
15537    ///
15538    /// Please note that this method must not be used to set any of the known parameters
15539    /// which have their own setter method. If done anyway, the request will fail.
15540    ///
15541    /// # Additional Parameters
15542    ///
15543    /// * *$.xgafv* (query-string) - V1 error format.
15544    /// * *access_token* (query-string) - OAuth access token.
15545    /// * *alt* (query-string) - Data format for response.
15546    /// * *callback* (query-string) - JSONP
15547    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15548    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15549    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15550    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15551    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15552    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15553    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15554    pub fn param<T>(mut self, name: T, value: T) -> PropertyDataStreamPatchCall<'a, S>
15555                                                        where T: AsRef<str> {
15556        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
15557        self
15558    }
15559
15560    /// Identifies the authorization scope for the method you are building.
15561    ///
15562    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15563    /// [`Scope::AnalyticEdit`].
15564    ///
15565    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15566    /// tokens for more than one scope.
15567    ///
15568    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15569    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15570    /// sufficient, a read-write scope will do as well.
15571    pub fn add_scope<St>(mut self, scope: St) -> PropertyDataStreamPatchCall<'a, S>
15572                                                        where St: AsRef<str> {
15573        self._scopes.insert(String::from(scope.as_ref()));
15574        self
15575    }
15576    /// Identifies the authorization scope(s) for the method you are building.
15577    ///
15578    /// See [`Self::add_scope()`] for details.
15579    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDataStreamPatchCall<'a, S>
15580                                                        where I: IntoIterator<Item = St>,
15581                                                         St: AsRef<str> {
15582        self._scopes
15583            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15584        self
15585    }
15586
15587    /// Removes all scopes, and no default scope will be used either.
15588    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15589    /// for details).
15590    pub fn clear_scopes(mut self) -> PropertyDataStreamPatchCall<'a, S> {
15591        self._scopes.clear();
15592        self
15593    }
15594}
15595
15596
15597/// Approves a DisplayVideo360AdvertiserLinkProposal. The DisplayVideo360AdvertiserLinkProposal will be deleted and a new DisplayVideo360AdvertiserLink will be created.
15598///
15599/// A builder for the *displayVideo360AdvertiserLinkProposals.approve* method supported by a *property* resource.
15600/// It is not used directly, but through a [`PropertyMethods`] instance.
15601///
15602/// # Example
15603///
15604/// Instantiate a resource method builder
15605///
15606/// ```test_harness,no_run
15607/// # extern crate hyper;
15608/// # extern crate hyper_rustls;
15609/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
15610/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest;
15611/// # async fn dox() {
15612/// # use std::default::Default;
15613/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
15614/// 
15615/// # let secret: oauth2::ApplicationSecret = Default::default();
15616/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
15617/// #         secret,
15618/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15619/// #     ).build().await.unwrap();
15620/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
15621/// // As the method needs a request, you would usually fill it with the desired information
15622/// // into the respective structure. Some of the parts shown here might not be applicable !
15623/// // Values shown here are possibly random and not representative !
15624/// let mut req = GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest::default();
15625/// 
15626/// // You can configure optional parameters by calling the respective setters at will, and
15627/// // execute the final call using `doit()`.
15628/// // Values shown here are possibly random and not representative !
15629/// let result = hub.properties().display_video360_advertiser_link_proposals_approve(req, "name")
15630///              .doit().await;
15631/// # }
15632/// ```
15633pub struct PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S>
15634    where S: 'a {
15635
15636    hub: &'a GoogleAnalyticsAdmin<S>,
15637    _request: GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest,
15638    _name: String,
15639    _delegate: Option<&'a mut dyn client::Delegate>,
15640    _additional_params: HashMap<String, String>,
15641    _scopes: BTreeSet<String>
15642}
15643
15644impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {}
15645
15646impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S>
15647where
15648    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
15649    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
15650    S::Future: Send + Unpin + 'static,
15651    S::Error: Into<Box<dyn StdError + Send + Sync>>,
15652{
15653
15654
15655    /// Perform the operation you have build so far.
15656    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalResponse)> {
15657        use std::io::{Read, Seek};
15658        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
15659        use client::{ToParts, url::Params};
15660        use std::borrow::Cow;
15661
15662        let mut dd = client::DefaultDelegate;
15663        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
15664        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.approve",
15665                               http_method: hyper::Method::POST });
15666
15667        for &field in ["alt", "name"].iter() {
15668            if self._additional_params.contains_key(field) {
15669                dlg.finished(false);
15670                return Err(client::Error::FieldClash(field));
15671            }
15672        }
15673
15674        let mut params = Params::with_capacity(4 + self._additional_params.len());
15675        params.push("name", self._name);
15676
15677        params.extend(self._additional_params.iter());
15678
15679        params.push("alt", "json");
15680        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}:approve";
15681        if self._scopes.is_empty() {
15682            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
15683        }
15684
15685        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15686            url = params.uri_replacement(url, param_name, find_this, true);
15687        }
15688        {
15689            let to_remove = ["name"];
15690            params.remove_params(&to_remove);
15691        }
15692
15693        let url = params.parse_with_url(&url);
15694
15695        let mut json_mime_type = mime::APPLICATION_JSON;
15696        let mut request_value_reader =
15697            {
15698                let mut value = json::value::to_value(&self._request).expect("serde to work");
15699                client::remove_json_null_values(&mut value);
15700                let mut dst = io::Cursor::new(Vec::with_capacity(128));
15701                json::to_writer(&mut dst, &value).unwrap();
15702                dst
15703            };
15704        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
15705        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
15706
15707
15708        loop {
15709            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
15710                Ok(token) => token,
15711                Err(e) => {
15712                    match dlg.token(e) {
15713                        Ok(token) => token,
15714                        Err(e) => {
15715                            dlg.finished(false);
15716                            return Err(client::Error::MissingToken(e));
15717                        }
15718                    }
15719                }
15720            };
15721            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
15722            let mut req_result = {
15723                let client = &self.hub.client;
15724                dlg.pre_request();
15725                let mut req_builder = hyper::Request::builder()
15726                    .method(hyper::Method::POST)
15727                    .uri(url.as_str())
15728                    .header(USER_AGENT, self.hub._user_agent.clone());
15729
15730                if let Some(token) = token.as_ref() {
15731                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15732                }
15733
15734
15735                        let request = req_builder
15736                        .header(CONTENT_TYPE, json_mime_type.to_string())
15737                        .header(CONTENT_LENGTH, request_size as u64)
15738                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
15739
15740                client.request(request.unwrap()).await
15741
15742            };
15743
15744            match req_result {
15745                Err(err) => {
15746                    if let client::Retry::After(d) = dlg.http_error(&err) {
15747                        sleep(d).await;
15748                        continue;
15749                    }
15750                    dlg.finished(false);
15751                    return Err(client::Error::HttpError(err))
15752                }
15753                Ok(mut res) => {
15754                    if !res.status().is_success() {
15755                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15756                        let (parts, _) = res.into_parts();
15757                        let body = hyper::Body::from(res_body_string.clone());
15758                        let restored_response = hyper::Response::from_parts(parts, body);
15759
15760                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
15761
15762                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
15763                            sleep(d).await;
15764                            continue;
15765                        }
15766
15767                        dlg.finished(false);
15768
15769                        return match server_response {
15770                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
15771                            None => Err(client::Error::Failure(restored_response)),
15772                        }
15773                    }
15774                    let result_value = {
15775                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
15776
15777                        match json::from_str(&res_body_string) {
15778                            Ok(decoded) => (res, decoded),
15779                            Err(err) => {
15780                                dlg.response_json_decode_error(&res_body_string, &err);
15781                                return Err(client::Error::JsonDecodeError(res_body_string, err));
15782                            }
15783                        }
15784                    };
15785
15786                    dlg.finished(true);
15787                    return Ok(result_value)
15788                }
15789            }
15790        }
15791    }
15792
15793
15794    ///
15795    /// Sets the *request* property to the given value.
15796    ///
15797    /// Even though the property as already been set when instantiating this call,
15798    /// we provide this method for API completeness.
15799    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaApproveDisplayVideo360AdvertiserLinkProposalRequest) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {
15800        self._request = new_value;
15801        self
15802    }
15803    /// Required. The name of the DisplayVideo360AdvertiserLinkProposal to approve. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
15804    ///
15805    /// Sets the *name* path property to the given value.
15806    ///
15807    /// Even though the property as already been set when instantiating this call,
15808    /// we provide this method for API completeness.
15809    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {
15810        self._name = new_value.to_string();
15811        self
15812    }
15813    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15814    /// while executing the actual API request.
15815    /// 
15816    /// ````text
15817    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15818    /// ````
15819    ///
15820    /// Sets the *delegate* property to the given value.
15821    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {
15822        self._delegate = Some(new_value);
15823        self
15824    }
15825
15826    /// Set any additional parameter of the query string used in the request.
15827    /// It should be used to set parameters which are not yet available through their own
15828    /// setters.
15829    ///
15830    /// Please note that this method must not be used to set any of the known parameters
15831    /// which have their own setter method. If done anyway, the request will fail.
15832    ///
15833    /// # Additional Parameters
15834    ///
15835    /// * *$.xgafv* (query-string) - V1 error format.
15836    /// * *access_token* (query-string) - OAuth access token.
15837    /// * *alt* (query-string) - Data format for response.
15838    /// * *callback* (query-string) - JSONP
15839    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15840    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15841    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15842    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15843    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15844    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15845    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15846    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S>
15847                                                        where T: AsRef<str> {
15848        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
15849        self
15850    }
15851
15852    /// Identifies the authorization scope for the method you are building.
15853    ///
15854    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15855    /// [`Scope::AnalyticEdit`].
15856    ///
15857    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15858    /// tokens for more than one scope.
15859    ///
15860    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15861    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15862    /// sufficient, a read-write scope will do as well.
15863    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S>
15864                                                        where St: AsRef<str> {
15865        self._scopes.insert(String::from(scope.as_ref()));
15866        self
15867    }
15868    /// Identifies the authorization scope(s) for the method you are building.
15869    ///
15870    /// See [`Self::add_scope()`] for details.
15871    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S>
15872                                                        where I: IntoIterator<Item = St>,
15873                                                         St: AsRef<str> {
15874        self._scopes
15875            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15876        self
15877    }
15878
15879    /// Removes all scopes, and no default scope will be used either.
15880    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15881    /// for details).
15882    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalApproveCall<'a, S> {
15883        self._scopes.clear();
15884        self
15885    }
15886}
15887
15888
15889/// Cancels a DisplayVideo360AdvertiserLinkProposal. Cancelling can mean either: - Declining a proposal initiated from Display & Video 360 - Withdrawing a proposal initiated from Google Analytics After being cancelled, a proposal will eventually be deleted automatically.
15890///
15891/// A builder for the *displayVideo360AdvertiserLinkProposals.cancel* method supported by a *property* resource.
15892/// It is not used directly, but through a [`PropertyMethods`] instance.
15893///
15894/// # Example
15895///
15896/// Instantiate a resource method builder
15897///
15898/// ```test_harness,no_run
15899/// # extern crate hyper;
15900/// # extern crate hyper_rustls;
15901/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
15902/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest;
15903/// # async fn dox() {
15904/// # use std::default::Default;
15905/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
15906/// 
15907/// # let secret: oauth2::ApplicationSecret = Default::default();
15908/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
15909/// #         secret,
15910/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15911/// #     ).build().await.unwrap();
15912/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
15913/// // As the method needs a request, you would usually fill it with the desired information
15914/// // into the respective structure. Some of the parts shown here might not be applicable !
15915/// // Values shown here are possibly random and not representative !
15916/// let mut req = GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest::default();
15917/// 
15918/// // You can configure optional parameters by calling the respective setters at will, and
15919/// // execute the final call using `doit()`.
15920/// // Values shown here are possibly random and not representative !
15921/// let result = hub.properties().display_video360_advertiser_link_proposals_cancel(req, "name")
15922///              .doit().await;
15923/// # }
15924/// ```
15925pub struct PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S>
15926    where S: 'a {
15927
15928    hub: &'a GoogleAnalyticsAdmin<S>,
15929    _request: GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest,
15930    _name: String,
15931    _delegate: Option<&'a mut dyn client::Delegate>,
15932    _additional_params: HashMap<String, String>,
15933    _scopes: BTreeSet<String>
15934}
15935
15936impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {}
15937
15938impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S>
15939where
15940    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
15941    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
15942    S::Future: Send + Unpin + 'static,
15943    S::Error: Into<Box<dyn StdError + Send + Sync>>,
15944{
15945
15946
15947    /// Perform the operation you have build so far.
15948    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal)> {
15949        use std::io::{Read, Seek};
15950        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
15951        use client::{ToParts, url::Params};
15952        use std::borrow::Cow;
15953
15954        let mut dd = client::DefaultDelegate;
15955        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
15956        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.cancel",
15957                               http_method: hyper::Method::POST });
15958
15959        for &field in ["alt", "name"].iter() {
15960            if self._additional_params.contains_key(field) {
15961                dlg.finished(false);
15962                return Err(client::Error::FieldClash(field));
15963            }
15964        }
15965
15966        let mut params = Params::with_capacity(4 + self._additional_params.len());
15967        params.push("name", self._name);
15968
15969        params.extend(self._additional_params.iter());
15970
15971        params.push("alt", "json");
15972        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}:cancel";
15973        if self._scopes.is_empty() {
15974            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
15975        }
15976
15977        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15978            url = params.uri_replacement(url, param_name, find_this, true);
15979        }
15980        {
15981            let to_remove = ["name"];
15982            params.remove_params(&to_remove);
15983        }
15984
15985        let url = params.parse_with_url(&url);
15986
15987        let mut json_mime_type = mime::APPLICATION_JSON;
15988        let mut request_value_reader =
15989            {
15990                let mut value = json::value::to_value(&self._request).expect("serde to work");
15991                client::remove_json_null_values(&mut value);
15992                let mut dst = io::Cursor::new(Vec::with_capacity(128));
15993                json::to_writer(&mut dst, &value).unwrap();
15994                dst
15995            };
15996        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
15997        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
15998
15999
16000        loop {
16001            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
16002                Ok(token) => token,
16003                Err(e) => {
16004                    match dlg.token(e) {
16005                        Ok(token) => token,
16006                        Err(e) => {
16007                            dlg.finished(false);
16008                            return Err(client::Error::MissingToken(e));
16009                        }
16010                    }
16011                }
16012            };
16013            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
16014            let mut req_result = {
16015                let client = &self.hub.client;
16016                dlg.pre_request();
16017                let mut req_builder = hyper::Request::builder()
16018                    .method(hyper::Method::POST)
16019                    .uri(url.as_str())
16020                    .header(USER_AGENT, self.hub._user_agent.clone());
16021
16022                if let Some(token) = token.as_ref() {
16023                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16024                }
16025
16026
16027                        let request = req_builder
16028                        .header(CONTENT_TYPE, json_mime_type.to_string())
16029                        .header(CONTENT_LENGTH, request_size as u64)
16030                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
16031
16032                client.request(request.unwrap()).await
16033
16034            };
16035
16036            match req_result {
16037                Err(err) => {
16038                    if let client::Retry::After(d) = dlg.http_error(&err) {
16039                        sleep(d).await;
16040                        continue;
16041                    }
16042                    dlg.finished(false);
16043                    return Err(client::Error::HttpError(err))
16044                }
16045                Ok(mut res) => {
16046                    if !res.status().is_success() {
16047                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16048                        let (parts, _) = res.into_parts();
16049                        let body = hyper::Body::from(res_body_string.clone());
16050                        let restored_response = hyper::Response::from_parts(parts, body);
16051
16052                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
16053
16054                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
16055                            sleep(d).await;
16056                            continue;
16057                        }
16058
16059                        dlg.finished(false);
16060
16061                        return match server_response {
16062                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
16063                            None => Err(client::Error::Failure(restored_response)),
16064                        }
16065                    }
16066                    let result_value = {
16067                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16068
16069                        match json::from_str(&res_body_string) {
16070                            Ok(decoded) => (res, decoded),
16071                            Err(err) => {
16072                                dlg.response_json_decode_error(&res_body_string, &err);
16073                                return Err(client::Error::JsonDecodeError(res_body_string, err));
16074                            }
16075                        }
16076                    };
16077
16078                    dlg.finished(true);
16079                    return Ok(result_value)
16080                }
16081            }
16082        }
16083    }
16084
16085
16086    ///
16087    /// Sets the *request* property to the given value.
16088    ///
16089    /// Even though the property as already been set when instantiating this call,
16090    /// we provide this method for API completeness.
16091    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaCancelDisplayVideo360AdvertiserLinkProposalRequest) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {
16092        self._request = new_value;
16093        self
16094    }
16095    /// Required. The name of the DisplayVideo360AdvertiserLinkProposal to cancel. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
16096    ///
16097    /// Sets the *name* path property to the given value.
16098    ///
16099    /// Even though the property as already been set when instantiating this call,
16100    /// we provide this method for API completeness.
16101    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {
16102        self._name = new_value.to_string();
16103        self
16104    }
16105    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16106    /// while executing the actual API request.
16107    /// 
16108    /// ````text
16109    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16110    /// ````
16111    ///
16112    /// Sets the *delegate* property to the given value.
16113    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {
16114        self._delegate = Some(new_value);
16115        self
16116    }
16117
16118    /// Set any additional parameter of the query string used in the request.
16119    /// It should be used to set parameters which are not yet available through their own
16120    /// setters.
16121    ///
16122    /// Please note that this method must not be used to set any of the known parameters
16123    /// which have their own setter method. If done anyway, the request will fail.
16124    ///
16125    /// # Additional Parameters
16126    ///
16127    /// * *$.xgafv* (query-string) - V1 error format.
16128    /// * *access_token* (query-string) - OAuth access token.
16129    /// * *alt* (query-string) - Data format for response.
16130    /// * *callback* (query-string) - JSONP
16131    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16132    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16133    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16134    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16135    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16136    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16137    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16138    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S>
16139                                                        where T: AsRef<str> {
16140        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
16141        self
16142    }
16143
16144    /// Identifies the authorization scope for the method you are building.
16145    ///
16146    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16147    /// [`Scope::AnalyticEdit`].
16148    ///
16149    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16150    /// tokens for more than one scope.
16151    ///
16152    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16153    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16154    /// sufficient, a read-write scope will do as well.
16155    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S>
16156                                                        where St: AsRef<str> {
16157        self._scopes.insert(String::from(scope.as_ref()));
16158        self
16159    }
16160    /// Identifies the authorization scope(s) for the method you are building.
16161    ///
16162    /// See [`Self::add_scope()`] for details.
16163    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S>
16164                                                        where I: IntoIterator<Item = St>,
16165                                                         St: AsRef<str> {
16166        self._scopes
16167            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16168        self
16169    }
16170
16171    /// Removes all scopes, and no default scope will be used either.
16172    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16173    /// for details).
16174    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalCancelCall<'a, S> {
16175        self._scopes.clear();
16176        self
16177    }
16178}
16179
16180
16181/// Creates a DisplayVideo360AdvertiserLinkProposal.
16182///
16183/// A builder for the *displayVideo360AdvertiserLinkProposals.create* method supported by a *property* resource.
16184/// It is not used directly, but through a [`PropertyMethods`] instance.
16185///
16186/// # Example
16187///
16188/// Instantiate a resource method builder
16189///
16190/// ```test_harness,no_run
16191/// # extern crate hyper;
16192/// # extern crate hyper_rustls;
16193/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
16194/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal;
16195/// # async fn dox() {
16196/// # use std::default::Default;
16197/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
16198/// 
16199/// # let secret: oauth2::ApplicationSecret = Default::default();
16200/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
16201/// #         secret,
16202/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16203/// #     ).build().await.unwrap();
16204/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
16205/// // As the method needs a request, you would usually fill it with the desired information
16206/// // into the respective structure. Some of the parts shown here might not be applicable !
16207/// // Values shown here are possibly random and not representative !
16208/// let mut req = GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal::default();
16209/// 
16210/// // You can configure optional parameters by calling the respective setters at will, and
16211/// // execute the final call using `doit()`.
16212/// // Values shown here are possibly random and not representative !
16213/// let result = hub.properties().display_video360_advertiser_link_proposals_create(req, "parent")
16214///              .doit().await;
16215/// # }
16216/// ```
16217pub struct PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S>
16218    where S: 'a {
16219
16220    hub: &'a GoogleAnalyticsAdmin<S>,
16221    _request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal,
16222    _parent: String,
16223    _delegate: Option<&'a mut dyn client::Delegate>,
16224    _additional_params: HashMap<String, String>,
16225    _scopes: BTreeSet<String>
16226}
16227
16228impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {}
16229
16230impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S>
16231where
16232    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
16233    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
16234    S::Future: Send + Unpin + 'static,
16235    S::Error: Into<Box<dyn StdError + Send + Sync>>,
16236{
16237
16238
16239    /// Perform the operation you have build so far.
16240    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal)> {
16241        use std::io::{Read, Seek};
16242        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
16243        use client::{ToParts, url::Params};
16244        use std::borrow::Cow;
16245
16246        let mut dd = client::DefaultDelegate;
16247        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
16248        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.create",
16249                               http_method: hyper::Method::POST });
16250
16251        for &field in ["alt", "parent"].iter() {
16252            if self._additional_params.contains_key(field) {
16253                dlg.finished(false);
16254                return Err(client::Error::FieldClash(field));
16255            }
16256        }
16257
16258        let mut params = Params::with_capacity(4 + self._additional_params.len());
16259        params.push("parent", self._parent);
16260
16261        params.extend(self._additional_params.iter());
16262
16263        params.push("alt", "json");
16264        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/displayVideo360AdvertiserLinkProposals";
16265        if self._scopes.is_empty() {
16266            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
16267        }
16268
16269        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16270            url = params.uri_replacement(url, param_name, find_this, true);
16271        }
16272        {
16273            let to_remove = ["parent"];
16274            params.remove_params(&to_remove);
16275        }
16276
16277        let url = params.parse_with_url(&url);
16278
16279        let mut json_mime_type = mime::APPLICATION_JSON;
16280        let mut request_value_reader =
16281            {
16282                let mut value = json::value::to_value(&self._request).expect("serde to work");
16283                client::remove_json_null_values(&mut value);
16284                let mut dst = io::Cursor::new(Vec::with_capacity(128));
16285                json::to_writer(&mut dst, &value).unwrap();
16286                dst
16287            };
16288        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
16289        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
16290
16291
16292        loop {
16293            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
16294                Ok(token) => token,
16295                Err(e) => {
16296                    match dlg.token(e) {
16297                        Ok(token) => token,
16298                        Err(e) => {
16299                            dlg.finished(false);
16300                            return Err(client::Error::MissingToken(e));
16301                        }
16302                    }
16303                }
16304            };
16305            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
16306            let mut req_result = {
16307                let client = &self.hub.client;
16308                dlg.pre_request();
16309                let mut req_builder = hyper::Request::builder()
16310                    .method(hyper::Method::POST)
16311                    .uri(url.as_str())
16312                    .header(USER_AGENT, self.hub._user_agent.clone());
16313
16314                if let Some(token) = token.as_ref() {
16315                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16316                }
16317
16318
16319                        let request = req_builder
16320                        .header(CONTENT_TYPE, json_mime_type.to_string())
16321                        .header(CONTENT_LENGTH, request_size as u64)
16322                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
16323
16324                client.request(request.unwrap()).await
16325
16326            };
16327
16328            match req_result {
16329                Err(err) => {
16330                    if let client::Retry::After(d) = dlg.http_error(&err) {
16331                        sleep(d).await;
16332                        continue;
16333                    }
16334                    dlg.finished(false);
16335                    return Err(client::Error::HttpError(err))
16336                }
16337                Ok(mut res) => {
16338                    if !res.status().is_success() {
16339                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16340                        let (parts, _) = res.into_parts();
16341                        let body = hyper::Body::from(res_body_string.clone());
16342                        let restored_response = hyper::Response::from_parts(parts, body);
16343
16344                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
16345
16346                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
16347                            sleep(d).await;
16348                            continue;
16349                        }
16350
16351                        dlg.finished(false);
16352
16353                        return match server_response {
16354                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
16355                            None => Err(client::Error::Failure(restored_response)),
16356                        }
16357                    }
16358                    let result_value = {
16359                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16360
16361                        match json::from_str(&res_body_string) {
16362                            Ok(decoded) => (res, decoded),
16363                            Err(err) => {
16364                                dlg.response_json_decode_error(&res_body_string, &err);
16365                                return Err(client::Error::JsonDecodeError(res_body_string, err));
16366                            }
16367                        }
16368                    };
16369
16370                    dlg.finished(true);
16371                    return Ok(result_value)
16372                }
16373            }
16374        }
16375    }
16376
16377
16378    ///
16379    /// Sets the *request* property to the given value.
16380    ///
16381    /// Even though the property as already been set when instantiating this call,
16382    /// we provide this method for API completeness.
16383    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {
16384        self._request = new_value;
16385        self
16386    }
16387    /// Required. Example format: properties/1234
16388    ///
16389    /// Sets the *parent* path property to the given value.
16390    ///
16391    /// Even though the property as already been set when instantiating this call,
16392    /// we provide this method for API completeness.
16393    pub fn parent(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {
16394        self._parent = new_value.to_string();
16395        self
16396    }
16397    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16398    /// while executing the actual API request.
16399    /// 
16400    /// ````text
16401    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16402    /// ````
16403    ///
16404    /// Sets the *delegate* property to the given value.
16405    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {
16406        self._delegate = Some(new_value);
16407        self
16408    }
16409
16410    /// Set any additional parameter of the query string used in the request.
16411    /// It should be used to set parameters which are not yet available through their own
16412    /// setters.
16413    ///
16414    /// Please note that this method must not be used to set any of the known parameters
16415    /// which have their own setter method. If done anyway, the request will fail.
16416    ///
16417    /// # Additional Parameters
16418    ///
16419    /// * *$.xgafv* (query-string) - V1 error format.
16420    /// * *access_token* (query-string) - OAuth access token.
16421    /// * *alt* (query-string) - Data format for response.
16422    /// * *callback* (query-string) - JSONP
16423    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16424    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16425    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16426    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16427    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16428    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16429    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16430    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S>
16431                                                        where T: AsRef<str> {
16432        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
16433        self
16434    }
16435
16436    /// Identifies the authorization scope for the method you are building.
16437    ///
16438    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16439    /// [`Scope::AnalyticEdit`].
16440    ///
16441    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16442    /// tokens for more than one scope.
16443    ///
16444    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16445    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16446    /// sufficient, a read-write scope will do as well.
16447    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S>
16448                                                        where St: AsRef<str> {
16449        self._scopes.insert(String::from(scope.as_ref()));
16450        self
16451    }
16452    /// Identifies the authorization scope(s) for the method you are building.
16453    ///
16454    /// See [`Self::add_scope()`] for details.
16455    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S>
16456                                                        where I: IntoIterator<Item = St>,
16457                                                         St: AsRef<str> {
16458        self._scopes
16459            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16460        self
16461    }
16462
16463    /// Removes all scopes, and no default scope will be used either.
16464    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16465    /// for details).
16466    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalCreateCall<'a, S> {
16467        self._scopes.clear();
16468        self
16469    }
16470}
16471
16472
16473/// Deletes a DisplayVideo360AdvertiserLinkProposal on a property. This can only be used on cancelled proposals.
16474///
16475/// A builder for the *displayVideo360AdvertiserLinkProposals.delete* method supported by a *property* resource.
16476/// It is not used directly, but through a [`PropertyMethods`] instance.
16477///
16478/// # Example
16479///
16480/// Instantiate a resource method builder
16481///
16482/// ```test_harness,no_run
16483/// # extern crate hyper;
16484/// # extern crate hyper_rustls;
16485/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
16486/// # async fn dox() {
16487/// # use std::default::Default;
16488/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
16489/// 
16490/// # let secret: oauth2::ApplicationSecret = Default::default();
16491/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
16492/// #         secret,
16493/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16494/// #     ).build().await.unwrap();
16495/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
16496/// // You can configure optional parameters by calling the respective setters at will, and
16497/// // execute the final call using `doit()`.
16498/// // Values shown here are possibly random and not representative !
16499/// let result = hub.properties().display_video360_advertiser_link_proposals_delete("name")
16500///              .doit().await;
16501/// # }
16502/// ```
16503pub struct PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S>
16504    where S: 'a {
16505
16506    hub: &'a GoogleAnalyticsAdmin<S>,
16507    _name: String,
16508    _delegate: Option<&'a mut dyn client::Delegate>,
16509    _additional_params: HashMap<String, String>,
16510    _scopes: BTreeSet<String>
16511}
16512
16513impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S> {}
16514
16515impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S>
16516where
16517    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
16518    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
16519    S::Future: Send + Unpin + 'static,
16520    S::Error: Into<Box<dyn StdError + Send + Sync>>,
16521{
16522
16523
16524    /// Perform the operation you have build so far.
16525    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
16526        use std::io::{Read, Seek};
16527        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
16528        use client::{ToParts, url::Params};
16529        use std::borrow::Cow;
16530
16531        let mut dd = client::DefaultDelegate;
16532        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
16533        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.delete",
16534                               http_method: hyper::Method::DELETE });
16535
16536        for &field in ["alt", "name"].iter() {
16537            if self._additional_params.contains_key(field) {
16538                dlg.finished(false);
16539                return Err(client::Error::FieldClash(field));
16540            }
16541        }
16542
16543        let mut params = Params::with_capacity(3 + self._additional_params.len());
16544        params.push("name", self._name);
16545
16546        params.extend(self._additional_params.iter());
16547
16548        params.push("alt", "json");
16549        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
16550        if self._scopes.is_empty() {
16551            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
16552        }
16553
16554        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16555            url = params.uri_replacement(url, param_name, find_this, true);
16556        }
16557        {
16558            let to_remove = ["name"];
16559            params.remove_params(&to_remove);
16560        }
16561
16562        let url = params.parse_with_url(&url);
16563
16564
16565
16566        loop {
16567            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
16568                Ok(token) => token,
16569                Err(e) => {
16570                    match dlg.token(e) {
16571                        Ok(token) => token,
16572                        Err(e) => {
16573                            dlg.finished(false);
16574                            return Err(client::Error::MissingToken(e));
16575                        }
16576                    }
16577                }
16578            };
16579            let mut req_result = {
16580                let client = &self.hub.client;
16581                dlg.pre_request();
16582                let mut req_builder = hyper::Request::builder()
16583                    .method(hyper::Method::DELETE)
16584                    .uri(url.as_str())
16585                    .header(USER_AGENT, self.hub._user_agent.clone());
16586
16587                if let Some(token) = token.as_ref() {
16588                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16589                }
16590
16591
16592                        let request = req_builder
16593                        .body(hyper::body::Body::empty());
16594
16595                client.request(request.unwrap()).await
16596
16597            };
16598
16599            match req_result {
16600                Err(err) => {
16601                    if let client::Retry::After(d) = dlg.http_error(&err) {
16602                        sleep(d).await;
16603                        continue;
16604                    }
16605                    dlg.finished(false);
16606                    return Err(client::Error::HttpError(err))
16607                }
16608                Ok(mut res) => {
16609                    if !res.status().is_success() {
16610                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16611                        let (parts, _) = res.into_parts();
16612                        let body = hyper::Body::from(res_body_string.clone());
16613                        let restored_response = hyper::Response::from_parts(parts, body);
16614
16615                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
16616
16617                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
16618                            sleep(d).await;
16619                            continue;
16620                        }
16621
16622                        dlg.finished(false);
16623
16624                        return match server_response {
16625                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
16626                            None => Err(client::Error::Failure(restored_response)),
16627                        }
16628                    }
16629                    let result_value = {
16630                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16631
16632                        match json::from_str(&res_body_string) {
16633                            Ok(decoded) => (res, decoded),
16634                            Err(err) => {
16635                                dlg.response_json_decode_error(&res_body_string, &err);
16636                                return Err(client::Error::JsonDecodeError(res_body_string, err));
16637                            }
16638                        }
16639                    };
16640
16641                    dlg.finished(true);
16642                    return Ok(result_value)
16643                }
16644            }
16645        }
16646    }
16647
16648
16649    /// Required. The name of the DisplayVideo360AdvertiserLinkProposal to delete. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
16650    ///
16651    /// Sets the *name* path property to the given value.
16652    ///
16653    /// Even though the property as already been set when instantiating this call,
16654    /// we provide this method for API completeness.
16655    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S> {
16656        self._name = new_value.to_string();
16657        self
16658    }
16659    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16660    /// while executing the actual API request.
16661    /// 
16662    /// ````text
16663    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16664    /// ````
16665    ///
16666    /// Sets the *delegate* property to the given value.
16667    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S> {
16668        self._delegate = Some(new_value);
16669        self
16670    }
16671
16672    /// Set any additional parameter of the query string used in the request.
16673    /// It should be used to set parameters which are not yet available through their own
16674    /// setters.
16675    ///
16676    /// Please note that this method must not be used to set any of the known parameters
16677    /// which have their own setter method. If done anyway, the request will fail.
16678    ///
16679    /// # Additional Parameters
16680    ///
16681    /// * *$.xgafv* (query-string) - V1 error format.
16682    /// * *access_token* (query-string) - OAuth access token.
16683    /// * *alt* (query-string) - Data format for response.
16684    /// * *callback* (query-string) - JSONP
16685    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16686    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16687    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16688    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16689    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16690    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16691    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16692    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S>
16693                                                        where T: AsRef<str> {
16694        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
16695        self
16696    }
16697
16698    /// Identifies the authorization scope for the method you are building.
16699    ///
16700    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16701    /// [`Scope::AnalyticEdit`].
16702    ///
16703    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16704    /// tokens for more than one scope.
16705    ///
16706    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16707    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16708    /// sufficient, a read-write scope will do as well.
16709    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S>
16710                                                        where St: AsRef<str> {
16711        self._scopes.insert(String::from(scope.as_ref()));
16712        self
16713    }
16714    /// Identifies the authorization scope(s) for the method you are building.
16715    ///
16716    /// See [`Self::add_scope()`] for details.
16717    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S>
16718                                                        where I: IntoIterator<Item = St>,
16719                                                         St: AsRef<str> {
16720        self._scopes
16721            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16722        self
16723    }
16724
16725    /// Removes all scopes, and no default scope will be used either.
16726    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16727    /// for details).
16728    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalDeleteCall<'a, S> {
16729        self._scopes.clear();
16730        self
16731    }
16732}
16733
16734
16735/// Lookup for a single DisplayVideo360AdvertiserLinkProposal.
16736///
16737/// A builder for the *displayVideo360AdvertiserLinkProposals.get* method supported by a *property* resource.
16738/// It is not used directly, but through a [`PropertyMethods`] instance.
16739///
16740/// # Example
16741///
16742/// Instantiate a resource method builder
16743///
16744/// ```test_harness,no_run
16745/// # extern crate hyper;
16746/// # extern crate hyper_rustls;
16747/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
16748/// # async fn dox() {
16749/// # use std::default::Default;
16750/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
16751/// 
16752/// # let secret: oauth2::ApplicationSecret = Default::default();
16753/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
16754/// #         secret,
16755/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16756/// #     ).build().await.unwrap();
16757/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
16758/// // You can configure optional parameters by calling the respective setters at will, and
16759/// // execute the final call using `doit()`.
16760/// // Values shown here are possibly random and not representative !
16761/// let result = hub.properties().display_video360_advertiser_link_proposals_get("name")
16762///              .doit().await;
16763/// # }
16764/// ```
16765pub struct PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S>
16766    where S: 'a {
16767
16768    hub: &'a GoogleAnalyticsAdmin<S>,
16769    _name: String,
16770    _delegate: Option<&'a mut dyn client::Delegate>,
16771    _additional_params: HashMap<String, String>,
16772    _scopes: BTreeSet<String>
16773}
16774
16775impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S> {}
16776
16777impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S>
16778where
16779    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
16780    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
16781    S::Future: Send + Unpin + 'static,
16782    S::Error: Into<Box<dyn StdError + Send + Sync>>,
16783{
16784
16785
16786    /// Perform the operation you have build so far.
16787    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLinkProposal)> {
16788        use std::io::{Read, Seek};
16789        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
16790        use client::{ToParts, url::Params};
16791        use std::borrow::Cow;
16792
16793        let mut dd = client::DefaultDelegate;
16794        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
16795        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.get",
16796                               http_method: hyper::Method::GET });
16797
16798        for &field in ["alt", "name"].iter() {
16799            if self._additional_params.contains_key(field) {
16800                dlg.finished(false);
16801                return Err(client::Error::FieldClash(field));
16802            }
16803        }
16804
16805        let mut params = Params::with_capacity(3 + self._additional_params.len());
16806        params.push("name", self._name);
16807
16808        params.extend(self._additional_params.iter());
16809
16810        params.push("alt", "json");
16811        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
16812        if self._scopes.is_empty() {
16813            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
16814        }
16815
16816        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16817            url = params.uri_replacement(url, param_name, find_this, true);
16818        }
16819        {
16820            let to_remove = ["name"];
16821            params.remove_params(&to_remove);
16822        }
16823
16824        let url = params.parse_with_url(&url);
16825
16826
16827
16828        loop {
16829            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
16830                Ok(token) => token,
16831                Err(e) => {
16832                    match dlg.token(e) {
16833                        Ok(token) => token,
16834                        Err(e) => {
16835                            dlg.finished(false);
16836                            return Err(client::Error::MissingToken(e));
16837                        }
16838                    }
16839                }
16840            };
16841            let mut req_result = {
16842                let client = &self.hub.client;
16843                dlg.pre_request();
16844                let mut req_builder = hyper::Request::builder()
16845                    .method(hyper::Method::GET)
16846                    .uri(url.as_str())
16847                    .header(USER_AGENT, self.hub._user_agent.clone());
16848
16849                if let Some(token) = token.as_ref() {
16850                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16851                }
16852
16853
16854                        let request = req_builder
16855                        .body(hyper::body::Body::empty());
16856
16857                client.request(request.unwrap()).await
16858
16859            };
16860
16861            match req_result {
16862                Err(err) => {
16863                    if let client::Retry::After(d) = dlg.http_error(&err) {
16864                        sleep(d).await;
16865                        continue;
16866                    }
16867                    dlg.finished(false);
16868                    return Err(client::Error::HttpError(err))
16869                }
16870                Ok(mut res) => {
16871                    if !res.status().is_success() {
16872                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16873                        let (parts, _) = res.into_parts();
16874                        let body = hyper::Body::from(res_body_string.clone());
16875                        let restored_response = hyper::Response::from_parts(parts, body);
16876
16877                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
16878
16879                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
16880                            sleep(d).await;
16881                            continue;
16882                        }
16883
16884                        dlg.finished(false);
16885
16886                        return match server_response {
16887                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
16888                            None => Err(client::Error::Failure(restored_response)),
16889                        }
16890                    }
16891                    let result_value = {
16892                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
16893
16894                        match json::from_str(&res_body_string) {
16895                            Ok(decoded) => (res, decoded),
16896                            Err(err) => {
16897                                dlg.response_json_decode_error(&res_body_string, &err);
16898                                return Err(client::Error::JsonDecodeError(res_body_string, err));
16899                            }
16900                        }
16901                    };
16902
16903                    dlg.finished(true);
16904                    return Ok(result_value)
16905                }
16906            }
16907        }
16908    }
16909
16910
16911    /// Required. The name of the DisplayVideo360AdvertiserLinkProposal to get. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
16912    ///
16913    /// Sets the *name* path property to the given value.
16914    ///
16915    /// Even though the property as already been set when instantiating this call,
16916    /// we provide this method for API completeness.
16917    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S> {
16918        self._name = new_value.to_string();
16919        self
16920    }
16921    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16922    /// while executing the actual API request.
16923    /// 
16924    /// ````text
16925    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16926    /// ````
16927    ///
16928    /// Sets the *delegate* property to the given value.
16929    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S> {
16930        self._delegate = Some(new_value);
16931        self
16932    }
16933
16934    /// Set any additional parameter of the query string used in the request.
16935    /// It should be used to set parameters which are not yet available through their own
16936    /// setters.
16937    ///
16938    /// Please note that this method must not be used to set any of the known parameters
16939    /// which have their own setter method. If done anyway, the request will fail.
16940    ///
16941    /// # Additional Parameters
16942    ///
16943    /// * *$.xgafv* (query-string) - V1 error format.
16944    /// * *access_token* (query-string) - OAuth access token.
16945    /// * *alt* (query-string) - Data format for response.
16946    /// * *callback* (query-string) - JSONP
16947    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16948    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16949    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16950    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16951    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16952    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16953    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16954    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S>
16955                                                        where T: AsRef<str> {
16956        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
16957        self
16958    }
16959
16960    /// Identifies the authorization scope for the method you are building.
16961    ///
16962    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16963    /// [`Scope::AnalyticReadonly`].
16964    ///
16965    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16966    /// tokens for more than one scope.
16967    ///
16968    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16969    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16970    /// sufficient, a read-write scope will do as well.
16971    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S>
16972                                                        where St: AsRef<str> {
16973        self._scopes.insert(String::from(scope.as_ref()));
16974        self
16975    }
16976    /// Identifies the authorization scope(s) for the method you are building.
16977    ///
16978    /// See [`Self::add_scope()`] for details.
16979    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S>
16980                                                        where I: IntoIterator<Item = St>,
16981                                                         St: AsRef<str> {
16982        self._scopes
16983            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16984        self
16985    }
16986
16987    /// Removes all scopes, and no default scope will be used either.
16988    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16989    /// for details).
16990    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalGetCall<'a, S> {
16991        self._scopes.clear();
16992        self
16993    }
16994}
16995
16996
16997/// Lists DisplayVideo360AdvertiserLinkProposals on a property.
16998///
16999/// A builder for the *displayVideo360AdvertiserLinkProposals.list* method supported by a *property* resource.
17000/// It is not used directly, but through a [`PropertyMethods`] instance.
17001///
17002/// # Example
17003///
17004/// Instantiate a resource method builder
17005///
17006/// ```test_harness,no_run
17007/// # extern crate hyper;
17008/// # extern crate hyper_rustls;
17009/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
17010/// # async fn dox() {
17011/// # use std::default::Default;
17012/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
17013/// 
17014/// # let secret: oauth2::ApplicationSecret = Default::default();
17015/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
17016/// #         secret,
17017/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17018/// #     ).build().await.unwrap();
17019/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
17020/// // You can configure optional parameters by calling the respective setters at will, and
17021/// // execute the final call using `doit()`.
17022/// // Values shown here are possibly random and not representative !
17023/// let result = hub.properties().display_video360_advertiser_link_proposals_list("parent")
17024///              .page_token("vero")
17025///              .page_size(-44)
17026///              .doit().await;
17027/// # }
17028/// ```
17029pub struct PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S>
17030    where S: 'a {
17031
17032    hub: &'a GoogleAnalyticsAdmin<S>,
17033    _parent: String,
17034    _page_token: Option<String>,
17035    _page_size: Option<i32>,
17036    _delegate: Option<&'a mut dyn client::Delegate>,
17037    _additional_params: HashMap<String, String>,
17038    _scopes: BTreeSet<String>
17039}
17040
17041impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {}
17042
17043impl<'a, S> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S>
17044where
17045    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
17046    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
17047    S::Future: Send + Unpin + 'static,
17048    S::Error: Into<Box<dyn StdError + Send + Sync>>,
17049{
17050
17051
17052    /// Perform the operation you have build so far.
17053    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinkProposalsResponse)> {
17054        use std::io::{Read, Seek};
17055        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
17056        use client::{ToParts, url::Params};
17057        use std::borrow::Cow;
17058
17059        let mut dd = client::DefaultDelegate;
17060        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
17061        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinkProposals.list",
17062                               http_method: hyper::Method::GET });
17063
17064        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
17065            if self._additional_params.contains_key(field) {
17066                dlg.finished(false);
17067                return Err(client::Error::FieldClash(field));
17068            }
17069        }
17070
17071        let mut params = Params::with_capacity(5 + self._additional_params.len());
17072        params.push("parent", self._parent);
17073        if let Some(value) = self._page_token.as_ref() {
17074            params.push("pageToken", value);
17075        }
17076        if let Some(value) = self._page_size.as_ref() {
17077            params.push("pageSize", value.to_string());
17078        }
17079
17080        params.extend(self._additional_params.iter());
17081
17082        params.push("alt", "json");
17083        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/displayVideo360AdvertiserLinkProposals";
17084        if self._scopes.is_empty() {
17085            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
17086        }
17087
17088        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17089            url = params.uri_replacement(url, param_name, find_this, true);
17090        }
17091        {
17092            let to_remove = ["parent"];
17093            params.remove_params(&to_remove);
17094        }
17095
17096        let url = params.parse_with_url(&url);
17097
17098
17099
17100        loop {
17101            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
17102                Ok(token) => token,
17103                Err(e) => {
17104                    match dlg.token(e) {
17105                        Ok(token) => token,
17106                        Err(e) => {
17107                            dlg.finished(false);
17108                            return Err(client::Error::MissingToken(e));
17109                        }
17110                    }
17111                }
17112            };
17113            let mut req_result = {
17114                let client = &self.hub.client;
17115                dlg.pre_request();
17116                let mut req_builder = hyper::Request::builder()
17117                    .method(hyper::Method::GET)
17118                    .uri(url.as_str())
17119                    .header(USER_AGENT, self.hub._user_agent.clone());
17120
17121                if let Some(token) = token.as_ref() {
17122                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17123                }
17124
17125
17126                        let request = req_builder
17127                        .body(hyper::body::Body::empty());
17128
17129                client.request(request.unwrap()).await
17130
17131            };
17132
17133            match req_result {
17134                Err(err) => {
17135                    if let client::Retry::After(d) = dlg.http_error(&err) {
17136                        sleep(d).await;
17137                        continue;
17138                    }
17139                    dlg.finished(false);
17140                    return Err(client::Error::HttpError(err))
17141                }
17142                Ok(mut res) => {
17143                    if !res.status().is_success() {
17144                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17145                        let (parts, _) = res.into_parts();
17146                        let body = hyper::Body::from(res_body_string.clone());
17147                        let restored_response = hyper::Response::from_parts(parts, body);
17148
17149                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
17150
17151                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
17152                            sleep(d).await;
17153                            continue;
17154                        }
17155
17156                        dlg.finished(false);
17157
17158                        return match server_response {
17159                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
17160                            None => Err(client::Error::Failure(restored_response)),
17161                        }
17162                    }
17163                    let result_value = {
17164                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17165
17166                        match json::from_str(&res_body_string) {
17167                            Ok(decoded) => (res, decoded),
17168                            Err(err) => {
17169                                dlg.response_json_decode_error(&res_body_string, &err);
17170                                return Err(client::Error::JsonDecodeError(res_body_string, err));
17171                            }
17172                        }
17173                    };
17174
17175                    dlg.finished(true);
17176                    return Ok(result_value)
17177                }
17178            }
17179        }
17180    }
17181
17182
17183    /// Required. Example format: properties/1234
17184    ///
17185    /// Sets the *parent* path property to the given value.
17186    ///
17187    /// Even though the property as already been set when instantiating this call,
17188    /// we provide this method for API completeness.
17189    pub fn parent(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
17190        self._parent = new_value.to_string();
17191        self
17192    }
17193    /// A page token, received from a previous `ListDisplayVideo360AdvertiserLinkProposals` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDisplayVideo360AdvertiserLinkProposals` must match the call that provided the page token.
17194    ///
17195    /// Sets the *page token* query property to the given value.
17196    pub fn page_token(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
17197        self._page_token = Some(new_value.to_string());
17198        self
17199    }
17200    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
17201    ///
17202    /// Sets the *page size* query property to the given value.
17203    pub fn page_size(mut self, new_value: i32) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
17204        self._page_size = Some(new_value);
17205        self
17206    }
17207    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17208    /// while executing the actual API request.
17209    /// 
17210    /// ````text
17211    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17212    /// ````
17213    ///
17214    /// Sets the *delegate* property to the given value.
17215    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
17216        self._delegate = Some(new_value);
17217        self
17218    }
17219
17220    /// Set any additional parameter of the query string used in the request.
17221    /// It should be used to set parameters which are not yet available through their own
17222    /// setters.
17223    ///
17224    /// Please note that this method must not be used to set any of the known parameters
17225    /// which have their own setter method. If done anyway, the request will fail.
17226    ///
17227    /// # Additional Parameters
17228    ///
17229    /// * *$.xgafv* (query-string) - V1 error format.
17230    /// * *access_token* (query-string) - OAuth access token.
17231    /// * *alt* (query-string) - Data format for response.
17232    /// * *callback* (query-string) - JSONP
17233    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17234    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17235    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17236    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17237    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17238    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17239    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17240    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S>
17241                                                        where T: AsRef<str> {
17242        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
17243        self
17244    }
17245
17246    /// Identifies the authorization scope for the method you are building.
17247    ///
17248    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17249    /// [`Scope::AnalyticReadonly`].
17250    ///
17251    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17252    /// tokens for more than one scope.
17253    ///
17254    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17255    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17256    /// sufficient, a read-write scope will do as well.
17257    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S>
17258                                                        where St: AsRef<str> {
17259        self._scopes.insert(String::from(scope.as_ref()));
17260        self
17261    }
17262    /// Identifies the authorization scope(s) for the method you are building.
17263    ///
17264    /// See [`Self::add_scope()`] for details.
17265    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S>
17266                                                        where I: IntoIterator<Item = St>,
17267                                                         St: AsRef<str> {
17268        self._scopes
17269            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17270        self
17271    }
17272
17273    /// Removes all scopes, and no default scope will be used either.
17274    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17275    /// for details).
17276    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkProposalListCall<'a, S> {
17277        self._scopes.clear();
17278        self
17279    }
17280}
17281
17282
17283/// Creates a DisplayVideo360AdvertiserLink. This can only be utilized by users who have proper authorization both on the Google Analytics property and on the Display & Video 360 advertiser. Users who do not have access to the Display & Video 360 advertiser should instead seek to create a DisplayVideo360LinkProposal.
17284///
17285/// A builder for the *displayVideo360AdvertiserLinks.create* method supported by a *property* resource.
17286/// It is not used directly, but through a [`PropertyMethods`] instance.
17287///
17288/// # Example
17289///
17290/// Instantiate a resource method builder
17291///
17292/// ```test_harness,no_run
17293/// # extern crate hyper;
17294/// # extern crate hyper_rustls;
17295/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
17296/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink;
17297/// # async fn dox() {
17298/// # use std::default::Default;
17299/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
17300/// 
17301/// # let secret: oauth2::ApplicationSecret = Default::default();
17302/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
17303/// #         secret,
17304/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17305/// #     ).build().await.unwrap();
17306/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
17307/// // As the method needs a request, you would usually fill it with the desired information
17308/// // into the respective structure. Some of the parts shown here might not be applicable !
17309/// // Values shown here are possibly random and not representative !
17310/// let mut req = GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink::default();
17311/// 
17312/// // You can configure optional parameters by calling the respective setters at will, and
17313/// // execute the final call using `doit()`.
17314/// // Values shown here are possibly random and not representative !
17315/// let result = hub.properties().display_video360_advertiser_links_create(req, "parent")
17316///              .doit().await;
17317/// # }
17318/// ```
17319pub struct PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S>
17320    where S: 'a {
17321
17322    hub: &'a GoogleAnalyticsAdmin<S>,
17323    _request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink,
17324    _parent: String,
17325    _delegate: Option<&'a mut dyn client::Delegate>,
17326    _additional_params: HashMap<String, String>,
17327    _scopes: BTreeSet<String>
17328}
17329
17330impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {}
17331
17332impl<'a, S> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S>
17333where
17334    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
17335    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
17336    S::Future: Send + Unpin + 'static,
17337    S::Error: Into<Box<dyn StdError + Send + Sync>>,
17338{
17339
17340
17341    /// Perform the operation you have build so far.
17342    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink)> {
17343        use std::io::{Read, Seek};
17344        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
17345        use client::{ToParts, url::Params};
17346        use std::borrow::Cow;
17347
17348        let mut dd = client::DefaultDelegate;
17349        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
17350        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinks.create",
17351                               http_method: hyper::Method::POST });
17352
17353        for &field in ["alt", "parent"].iter() {
17354            if self._additional_params.contains_key(field) {
17355                dlg.finished(false);
17356                return Err(client::Error::FieldClash(field));
17357            }
17358        }
17359
17360        let mut params = Params::with_capacity(4 + self._additional_params.len());
17361        params.push("parent", self._parent);
17362
17363        params.extend(self._additional_params.iter());
17364
17365        params.push("alt", "json");
17366        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/displayVideo360AdvertiserLinks";
17367        if self._scopes.is_empty() {
17368            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
17369        }
17370
17371        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17372            url = params.uri_replacement(url, param_name, find_this, true);
17373        }
17374        {
17375            let to_remove = ["parent"];
17376            params.remove_params(&to_remove);
17377        }
17378
17379        let url = params.parse_with_url(&url);
17380
17381        let mut json_mime_type = mime::APPLICATION_JSON;
17382        let mut request_value_reader =
17383            {
17384                let mut value = json::value::to_value(&self._request).expect("serde to work");
17385                client::remove_json_null_values(&mut value);
17386                let mut dst = io::Cursor::new(Vec::with_capacity(128));
17387                json::to_writer(&mut dst, &value).unwrap();
17388                dst
17389            };
17390        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
17391        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
17392
17393
17394        loop {
17395            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
17396                Ok(token) => token,
17397                Err(e) => {
17398                    match dlg.token(e) {
17399                        Ok(token) => token,
17400                        Err(e) => {
17401                            dlg.finished(false);
17402                            return Err(client::Error::MissingToken(e));
17403                        }
17404                    }
17405                }
17406            };
17407            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
17408            let mut req_result = {
17409                let client = &self.hub.client;
17410                dlg.pre_request();
17411                let mut req_builder = hyper::Request::builder()
17412                    .method(hyper::Method::POST)
17413                    .uri(url.as_str())
17414                    .header(USER_AGENT, self.hub._user_agent.clone());
17415
17416                if let Some(token) = token.as_ref() {
17417                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17418                }
17419
17420
17421                        let request = req_builder
17422                        .header(CONTENT_TYPE, json_mime_type.to_string())
17423                        .header(CONTENT_LENGTH, request_size as u64)
17424                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
17425
17426                client.request(request.unwrap()).await
17427
17428            };
17429
17430            match req_result {
17431                Err(err) => {
17432                    if let client::Retry::After(d) = dlg.http_error(&err) {
17433                        sleep(d).await;
17434                        continue;
17435                    }
17436                    dlg.finished(false);
17437                    return Err(client::Error::HttpError(err))
17438                }
17439                Ok(mut res) => {
17440                    if !res.status().is_success() {
17441                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17442                        let (parts, _) = res.into_parts();
17443                        let body = hyper::Body::from(res_body_string.clone());
17444                        let restored_response = hyper::Response::from_parts(parts, body);
17445
17446                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
17447
17448                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
17449                            sleep(d).await;
17450                            continue;
17451                        }
17452
17453                        dlg.finished(false);
17454
17455                        return match server_response {
17456                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
17457                            None => Err(client::Error::Failure(restored_response)),
17458                        }
17459                    }
17460                    let result_value = {
17461                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17462
17463                        match json::from_str(&res_body_string) {
17464                            Ok(decoded) => (res, decoded),
17465                            Err(err) => {
17466                                dlg.response_json_decode_error(&res_body_string, &err);
17467                                return Err(client::Error::JsonDecodeError(res_body_string, err));
17468                            }
17469                        }
17470                    };
17471
17472                    dlg.finished(true);
17473                    return Ok(result_value)
17474                }
17475            }
17476        }
17477    }
17478
17479
17480    ///
17481    /// Sets the *request* property to the given value.
17482    ///
17483    /// Even though the property as already been set when instantiating this call,
17484    /// we provide this method for API completeness.
17485    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {
17486        self._request = new_value;
17487        self
17488    }
17489    /// Required. Example format: properties/1234
17490    ///
17491    /// Sets the *parent* path property to the given value.
17492    ///
17493    /// Even though the property as already been set when instantiating this call,
17494    /// we provide this method for API completeness.
17495    pub fn parent(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {
17496        self._parent = new_value.to_string();
17497        self
17498    }
17499    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17500    /// while executing the actual API request.
17501    /// 
17502    /// ````text
17503    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17504    /// ````
17505    ///
17506    /// Sets the *delegate* property to the given value.
17507    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {
17508        self._delegate = Some(new_value);
17509        self
17510    }
17511
17512    /// Set any additional parameter of the query string used in the request.
17513    /// It should be used to set parameters which are not yet available through their own
17514    /// setters.
17515    ///
17516    /// Please note that this method must not be used to set any of the known parameters
17517    /// which have their own setter method. If done anyway, the request will fail.
17518    ///
17519    /// # Additional Parameters
17520    ///
17521    /// * *$.xgafv* (query-string) - V1 error format.
17522    /// * *access_token* (query-string) - OAuth access token.
17523    /// * *alt* (query-string) - Data format for response.
17524    /// * *callback* (query-string) - JSONP
17525    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17526    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17527    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17528    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17529    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17530    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17531    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17532    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S>
17533                                                        where T: AsRef<str> {
17534        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
17535        self
17536    }
17537
17538    /// Identifies the authorization scope for the method you are building.
17539    ///
17540    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17541    /// [`Scope::AnalyticEdit`].
17542    ///
17543    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17544    /// tokens for more than one scope.
17545    ///
17546    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17547    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17548    /// sufficient, a read-write scope will do as well.
17549    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S>
17550                                                        where St: AsRef<str> {
17551        self._scopes.insert(String::from(scope.as_ref()));
17552        self
17553    }
17554    /// Identifies the authorization scope(s) for the method you are building.
17555    ///
17556    /// See [`Self::add_scope()`] for details.
17557    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S>
17558                                                        where I: IntoIterator<Item = St>,
17559                                                         St: AsRef<str> {
17560        self._scopes
17561            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17562        self
17563    }
17564
17565    /// Removes all scopes, and no default scope will be used either.
17566    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17567    /// for details).
17568    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkCreateCall<'a, S> {
17569        self._scopes.clear();
17570        self
17571    }
17572}
17573
17574
17575/// Deletes a DisplayVideo360AdvertiserLink on a property.
17576///
17577/// A builder for the *displayVideo360AdvertiserLinks.delete* method supported by a *property* resource.
17578/// It is not used directly, but through a [`PropertyMethods`] instance.
17579///
17580/// # Example
17581///
17582/// Instantiate a resource method builder
17583///
17584/// ```test_harness,no_run
17585/// # extern crate hyper;
17586/// # extern crate hyper_rustls;
17587/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
17588/// # async fn dox() {
17589/// # use std::default::Default;
17590/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
17591/// 
17592/// # let secret: oauth2::ApplicationSecret = Default::default();
17593/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
17594/// #         secret,
17595/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17596/// #     ).build().await.unwrap();
17597/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
17598/// // You can configure optional parameters by calling the respective setters at will, and
17599/// // execute the final call using `doit()`.
17600/// // Values shown here are possibly random and not representative !
17601/// let result = hub.properties().display_video360_advertiser_links_delete("name")
17602///              .doit().await;
17603/// # }
17604/// ```
17605pub struct PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S>
17606    where S: 'a {
17607
17608    hub: &'a GoogleAnalyticsAdmin<S>,
17609    _name: String,
17610    _delegate: Option<&'a mut dyn client::Delegate>,
17611    _additional_params: HashMap<String, String>,
17612    _scopes: BTreeSet<String>
17613}
17614
17615impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S> {}
17616
17617impl<'a, S> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S>
17618where
17619    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
17620    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
17621    S::Future: Send + Unpin + 'static,
17622    S::Error: Into<Box<dyn StdError + Send + Sync>>,
17623{
17624
17625
17626    /// Perform the operation you have build so far.
17627    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
17628        use std::io::{Read, Seek};
17629        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
17630        use client::{ToParts, url::Params};
17631        use std::borrow::Cow;
17632
17633        let mut dd = client::DefaultDelegate;
17634        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
17635        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinks.delete",
17636                               http_method: hyper::Method::DELETE });
17637
17638        for &field in ["alt", "name"].iter() {
17639            if self._additional_params.contains_key(field) {
17640                dlg.finished(false);
17641                return Err(client::Error::FieldClash(field));
17642            }
17643        }
17644
17645        let mut params = Params::with_capacity(3 + self._additional_params.len());
17646        params.push("name", self._name);
17647
17648        params.extend(self._additional_params.iter());
17649
17650        params.push("alt", "json");
17651        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
17652        if self._scopes.is_empty() {
17653            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
17654        }
17655
17656        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17657            url = params.uri_replacement(url, param_name, find_this, true);
17658        }
17659        {
17660            let to_remove = ["name"];
17661            params.remove_params(&to_remove);
17662        }
17663
17664        let url = params.parse_with_url(&url);
17665
17666
17667
17668        loop {
17669            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
17670                Ok(token) => token,
17671                Err(e) => {
17672                    match dlg.token(e) {
17673                        Ok(token) => token,
17674                        Err(e) => {
17675                            dlg.finished(false);
17676                            return Err(client::Error::MissingToken(e));
17677                        }
17678                    }
17679                }
17680            };
17681            let mut req_result = {
17682                let client = &self.hub.client;
17683                dlg.pre_request();
17684                let mut req_builder = hyper::Request::builder()
17685                    .method(hyper::Method::DELETE)
17686                    .uri(url.as_str())
17687                    .header(USER_AGENT, self.hub._user_agent.clone());
17688
17689                if let Some(token) = token.as_ref() {
17690                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17691                }
17692
17693
17694                        let request = req_builder
17695                        .body(hyper::body::Body::empty());
17696
17697                client.request(request.unwrap()).await
17698
17699            };
17700
17701            match req_result {
17702                Err(err) => {
17703                    if let client::Retry::After(d) = dlg.http_error(&err) {
17704                        sleep(d).await;
17705                        continue;
17706                    }
17707                    dlg.finished(false);
17708                    return Err(client::Error::HttpError(err))
17709                }
17710                Ok(mut res) => {
17711                    if !res.status().is_success() {
17712                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17713                        let (parts, _) = res.into_parts();
17714                        let body = hyper::Body::from(res_body_string.clone());
17715                        let restored_response = hyper::Response::from_parts(parts, body);
17716
17717                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
17718
17719                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
17720                            sleep(d).await;
17721                            continue;
17722                        }
17723
17724                        dlg.finished(false);
17725
17726                        return match server_response {
17727                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
17728                            None => Err(client::Error::Failure(restored_response)),
17729                        }
17730                    }
17731                    let result_value = {
17732                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17733
17734                        match json::from_str(&res_body_string) {
17735                            Ok(decoded) => (res, decoded),
17736                            Err(err) => {
17737                                dlg.response_json_decode_error(&res_body_string, &err);
17738                                return Err(client::Error::JsonDecodeError(res_body_string, err));
17739                            }
17740                        }
17741                    };
17742
17743                    dlg.finished(true);
17744                    return Ok(result_value)
17745                }
17746            }
17747        }
17748    }
17749
17750
17751    /// Required. The name of the DisplayVideo360AdvertiserLink to delete. Example format: properties/1234/displayVideo360AdvertiserLinks/5678
17752    ///
17753    /// Sets the *name* path property to the given value.
17754    ///
17755    /// Even though the property as already been set when instantiating this call,
17756    /// we provide this method for API completeness.
17757    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S> {
17758        self._name = new_value.to_string();
17759        self
17760    }
17761    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17762    /// while executing the actual API request.
17763    /// 
17764    /// ````text
17765    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17766    /// ````
17767    ///
17768    /// Sets the *delegate* property to the given value.
17769    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S> {
17770        self._delegate = Some(new_value);
17771        self
17772    }
17773
17774    /// Set any additional parameter of the query string used in the request.
17775    /// It should be used to set parameters which are not yet available through their own
17776    /// setters.
17777    ///
17778    /// Please note that this method must not be used to set any of the known parameters
17779    /// which have their own setter method. If done anyway, the request will fail.
17780    ///
17781    /// # Additional Parameters
17782    ///
17783    /// * *$.xgafv* (query-string) - V1 error format.
17784    /// * *access_token* (query-string) - OAuth access token.
17785    /// * *alt* (query-string) - Data format for response.
17786    /// * *callback* (query-string) - JSONP
17787    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17788    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17789    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17790    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17791    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17792    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17793    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17794    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S>
17795                                                        where T: AsRef<str> {
17796        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
17797        self
17798    }
17799
17800    /// Identifies the authorization scope for the method you are building.
17801    ///
17802    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17803    /// [`Scope::AnalyticEdit`].
17804    ///
17805    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17806    /// tokens for more than one scope.
17807    ///
17808    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17809    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17810    /// sufficient, a read-write scope will do as well.
17811    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S>
17812                                                        where St: AsRef<str> {
17813        self._scopes.insert(String::from(scope.as_ref()));
17814        self
17815    }
17816    /// Identifies the authorization scope(s) for the method you are building.
17817    ///
17818    /// See [`Self::add_scope()`] for details.
17819    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S>
17820                                                        where I: IntoIterator<Item = St>,
17821                                                         St: AsRef<str> {
17822        self._scopes
17823            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17824        self
17825    }
17826
17827    /// Removes all scopes, and no default scope will be used either.
17828    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17829    /// for details).
17830    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkDeleteCall<'a, S> {
17831        self._scopes.clear();
17832        self
17833    }
17834}
17835
17836
17837/// Look up a single DisplayVideo360AdvertiserLink
17838///
17839/// A builder for the *displayVideo360AdvertiserLinks.get* method supported by a *property* resource.
17840/// It is not used directly, but through a [`PropertyMethods`] instance.
17841///
17842/// # Example
17843///
17844/// Instantiate a resource method builder
17845///
17846/// ```test_harness,no_run
17847/// # extern crate hyper;
17848/// # extern crate hyper_rustls;
17849/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
17850/// # async fn dox() {
17851/// # use std::default::Default;
17852/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
17853/// 
17854/// # let secret: oauth2::ApplicationSecret = Default::default();
17855/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
17856/// #         secret,
17857/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17858/// #     ).build().await.unwrap();
17859/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
17860/// // You can configure optional parameters by calling the respective setters at will, and
17861/// // execute the final call using `doit()`.
17862/// // Values shown here are possibly random and not representative !
17863/// let result = hub.properties().display_video360_advertiser_links_get("name")
17864///              .doit().await;
17865/// # }
17866/// ```
17867pub struct PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S>
17868    where S: 'a {
17869
17870    hub: &'a GoogleAnalyticsAdmin<S>,
17871    _name: String,
17872    _delegate: Option<&'a mut dyn client::Delegate>,
17873    _additional_params: HashMap<String, String>,
17874    _scopes: BTreeSet<String>
17875}
17876
17877impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S> {}
17878
17879impl<'a, S> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S>
17880where
17881    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
17882    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
17883    S::Future: Send + Unpin + 'static,
17884    S::Error: Into<Box<dyn StdError + Send + Sync>>,
17885{
17886
17887
17888    /// Perform the operation you have build so far.
17889    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink)> {
17890        use std::io::{Read, Seek};
17891        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
17892        use client::{ToParts, url::Params};
17893        use std::borrow::Cow;
17894
17895        let mut dd = client::DefaultDelegate;
17896        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
17897        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinks.get",
17898                               http_method: hyper::Method::GET });
17899
17900        for &field in ["alt", "name"].iter() {
17901            if self._additional_params.contains_key(field) {
17902                dlg.finished(false);
17903                return Err(client::Error::FieldClash(field));
17904            }
17905        }
17906
17907        let mut params = Params::with_capacity(3 + self._additional_params.len());
17908        params.push("name", self._name);
17909
17910        params.extend(self._additional_params.iter());
17911
17912        params.push("alt", "json");
17913        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
17914        if self._scopes.is_empty() {
17915            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
17916        }
17917
17918        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17919            url = params.uri_replacement(url, param_name, find_this, true);
17920        }
17921        {
17922            let to_remove = ["name"];
17923            params.remove_params(&to_remove);
17924        }
17925
17926        let url = params.parse_with_url(&url);
17927
17928
17929
17930        loop {
17931            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
17932                Ok(token) => token,
17933                Err(e) => {
17934                    match dlg.token(e) {
17935                        Ok(token) => token,
17936                        Err(e) => {
17937                            dlg.finished(false);
17938                            return Err(client::Error::MissingToken(e));
17939                        }
17940                    }
17941                }
17942            };
17943            let mut req_result = {
17944                let client = &self.hub.client;
17945                dlg.pre_request();
17946                let mut req_builder = hyper::Request::builder()
17947                    .method(hyper::Method::GET)
17948                    .uri(url.as_str())
17949                    .header(USER_AGENT, self.hub._user_agent.clone());
17950
17951                if let Some(token) = token.as_ref() {
17952                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17953                }
17954
17955
17956                        let request = req_builder
17957                        .body(hyper::body::Body::empty());
17958
17959                client.request(request.unwrap()).await
17960
17961            };
17962
17963            match req_result {
17964                Err(err) => {
17965                    if let client::Retry::After(d) = dlg.http_error(&err) {
17966                        sleep(d).await;
17967                        continue;
17968                    }
17969                    dlg.finished(false);
17970                    return Err(client::Error::HttpError(err))
17971                }
17972                Ok(mut res) => {
17973                    if !res.status().is_success() {
17974                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17975                        let (parts, _) = res.into_parts();
17976                        let body = hyper::Body::from(res_body_string.clone());
17977                        let restored_response = hyper::Response::from_parts(parts, body);
17978
17979                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
17980
17981                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
17982                            sleep(d).await;
17983                            continue;
17984                        }
17985
17986                        dlg.finished(false);
17987
17988                        return match server_response {
17989                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
17990                            None => Err(client::Error::Failure(restored_response)),
17991                        }
17992                    }
17993                    let result_value = {
17994                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
17995
17996                        match json::from_str(&res_body_string) {
17997                            Ok(decoded) => (res, decoded),
17998                            Err(err) => {
17999                                dlg.response_json_decode_error(&res_body_string, &err);
18000                                return Err(client::Error::JsonDecodeError(res_body_string, err));
18001                            }
18002                        }
18003                    };
18004
18005                    dlg.finished(true);
18006                    return Ok(result_value)
18007                }
18008            }
18009        }
18010    }
18011
18012
18013    /// Required. The name of the DisplayVideo360AdvertiserLink to get. Example format: properties/1234/displayVideo360AdvertiserLink/5678
18014    ///
18015    /// Sets the *name* path property to the given value.
18016    ///
18017    /// Even though the property as already been set when instantiating this call,
18018    /// we provide this method for API completeness.
18019    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S> {
18020        self._name = new_value.to_string();
18021        self
18022    }
18023    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18024    /// while executing the actual API request.
18025    /// 
18026    /// ````text
18027    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18028    /// ````
18029    ///
18030    /// Sets the *delegate* property to the given value.
18031    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S> {
18032        self._delegate = Some(new_value);
18033        self
18034    }
18035
18036    /// Set any additional parameter of the query string used in the request.
18037    /// It should be used to set parameters which are not yet available through their own
18038    /// setters.
18039    ///
18040    /// Please note that this method must not be used to set any of the known parameters
18041    /// which have their own setter method. If done anyway, the request will fail.
18042    ///
18043    /// # Additional Parameters
18044    ///
18045    /// * *$.xgafv* (query-string) - V1 error format.
18046    /// * *access_token* (query-string) - OAuth access token.
18047    /// * *alt* (query-string) - Data format for response.
18048    /// * *callback* (query-string) - JSONP
18049    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18050    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18051    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18052    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18053    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18054    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18055    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18056    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S>
18057                                                        where T: AsRef<str> {
18058        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
18059        self
18060    }
18061
18062    /// Identifies the authorization scope for the method you are building.
18063    ///
18064    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18065    /// [`Scope::AnalyticReadonly`].
18066    ///
18067    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18068    /// tokens for more than one scope.
18069    ///
18070    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18071    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18072    /// sufficient, a read-write scope will do as well.
18073    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S>
18074                                                        where St: AsRef<str> {
18075        self._scopes.insert(String::from(scope.as_ref()));
18076        self
18077    }
18078    /// Identifies the authorization scope(s) for the method you are building.
18079    ///
18080    /// See [`Self::add_scope()`] for details.
18081    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S>
18082                                                        where I: IntoIterator<Item = St>,
18083                                                         St: AsRef<str> {
18084        self._scopes
18085            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18086        self
18087    }
18088
18089    /// Removes all scopes, and no default scope will be used either.
18090    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18091    /// for details).
18092    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkGetCall<'a, S> {
18093        self._scopes.clear();
18094        self
18095    }
18096}
18097
18098
18099/// Lists all DisplayVideo360AdvertiserLinks on a property.
18100///
18101/// A builder for the *displayVideo360AdvertiserLinks.list* method supported by a *property* resource.
18102/// It is not used directly, but through a [`PropertyMethods`] instance.
18103///
18104/// # Example
18105///
18106/// Instantiate a resource method builder
18107///
18108/// ```test_harness,no_run
18109/// # extern crate hyper;
18110/// # extern crate hyper_rustls;
18111/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
18112/// # async fn dox() {
18113/// # use std::default::Default;
18114/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
18115/// 
18116/// # let secret: oauth2::ApplicationSecret = Default::default();
18117/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
18118/// #         secret,
18119/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18120/// #     ).build().await.unwrap();
18121/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
18122/// // You can configure optional parameters by calling the respective setters at will, and
18123/// // execute the final call using `doit()`.
18124/// // Values shown here are possibly random and not representative !
18125/// let result = hub.properties().display_video360_advertiser_links_list("parent")
18126///              .page_token("accusam")
18127///              .page_size(-59)
18128///              .doit().await;
18129/// # }
18130/// ```
18131pub struct PropertyDisplayVideo360AdvertiserLinkListCall<'a, S>
18132    where S: 'a {
18133
18134    hub: &'a GoogleAnalyticsAdmin<S>,
18135    _parent: String,
18136    _page_token: Option<String>,
18137    _page_size: Option<i32>,
18138    _delegate: Option<&'a mut dyn client::Delegate>,
18139    _additional_params: HashMap<String, String>,
18140    _scopes: BTreeSet<String>
18141}
18142
18143impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {}
18144
18145impl<'a, S> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S>
18146where
18147    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
18148    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
18149    S::Future: Send + Unpin + 'static,
18150    S::Error: Into<Box<dyn StdError + Send + Sync>>,
18151{
18152
18153
18154    /// Perform the operation you have build so far.
18155    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListDisplayVideo360AdvertiserLinksResponse)> {
18156        use std::io::{Read, Seek};
18157        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
18158        use client::{ToParts, url::Params};
18159        use std::borrow::Cow;
18160
18161        let mut dd = client::DefaultDelegate;
18162        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
18163        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinks.list",
18164                               http_method: hyper::Method::GET });
18165
18166        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
18167            if self._additional_params.contains_key(field) {
18168                dlg.finished(false);
18169                return Err(client::Error::FieldClash(field));
18170            }
18171        }
18172
18173        let mut params = Params::with_capacity(5 + self._additional_params.len());
18174        params.push("parent", self._parent);
18175        if let Some(value) = self._page_token.as_ref() {
18176            params.push("pageToken", value);
18177        }
18178        if let Some(value) = self._page_size.as_ref() {
18179            params.push("pageSize", value.to_string());
18180        }
18181
18182        params.extend(self._additional_params.iter());
18183
18184        params.push("alt", "json");
18185        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/displayVideo360AdvertiserLinks";
18186        if self._scopes.is_empty() {
18187            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
18188        }
18189
18190        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18191            url = params.uri_replacement(url, param_name, find_this, true);
18192        }
18193        {
18194            let to_remove = ["parent"];
18195            params.remove_params(&to_remove);
18196        }
18197
18198        let url = params.parse_with_url(&url);
18199
18200
18201
18202        loop {
18203            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
18204                Ok(token) => token,
18205                Err(e) => {
18206                    match dlg.token(e) {
18207                        Ok(token) => token,
18208                        Err(e) => {
18209                            dlg.finished(false);
18210                            return Err(client::Error::MissingToken(e));
18211                        }
18212                    }
18213                }
18214            };
18215            let mut req_result = {
18216                let client = &self.hub.client;
18217                dlg.pre_request();
18218                let mut req_builder = hyper::Request::builder()
18219                    .method(hyper::Method::GET)
18220                    .uri(url.as_str())
18221                    .header(USER_AGENT, self.hub._user_agent.clone());
18222
18223                if let Some(token) = token.as_ref() {
18224                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18225                }
18226
18227
18228                        let request = req_builder
18229                        .body(hyper::body::Body::empty());
18230
18231                client.request(request.unwrap()).await
18232
18233            };
18234
18235            match req_result {
18236                Err(err) => {
18237                    if let client::Retry::After(d) = dlg.http_error(&err) {
18238                        sleep(d).await;
18239                        continue;
18240                    }
18241                    dlg.finished(false);
18242                    return Err(client::Error::HttpError(err))
18243                }
18244                Ok(mut res) => {
18245                    if !res.status().is_success() {
18246                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18247                        let (parts, _) = res.into_parts();
18248                        let body = hyper::Body::from(res_body_string.clone());
18249                        let restored_response = hyper::Response::from_parts(parts, body);
18250
18251                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
18252
18253                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
18254                            sleep(d).await;
18255                            continue;
18256                        }
18257
18258                        dlg.finished(false);
18259
18260                        return match server_response {
18261                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
18262                            None => Err(client::Error::Failure(restored_response)),
18263                        }
18264                    }
18265                    let result_value = {
18266                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18267
18268                        match json::from_str(&res_body_string) {
18269                            Ok(decoded) => (res, decoded),
18270                            Err(err) => {
18271                                dlg.response_json_decode_error(&res_body_string, &err);
18272                                return Err(client::Error::JsonDecodeError(res_body_string, err));
18273                            }
18274                        }
18275                    };
18276
18277                    dlg.finished(true);
18278                    return Ok(result_value)
18279                }
18280            }
18281        }
18282    }
18283
18284
18285    /// Required. Example format: properties/1234
18286    ///
18287    /// Sets the *parent* path property to the given value.
18288    ///
18289    /// Even though the property as already been set when instantiating this call,
18290    /// we provide this method for API completeness.
18291    pub fn parent(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
18292        self._parent = new_value.to_string();
18293        self
18294    }
18295    /// A page token, received from a previous `ListDisplayVideo360AdvertiserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDisplayVideo360AdvertiserLinks` must match the call that provided the page token.
18296    ///
18297    /// Sets the *page token* query property to the given value.
18298    pub fn page_token(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
18299        self._page_token = Some(new_value.to_string());
18300        self
18301    }
18302    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
18303    ///
18304    /// Sets the *page size* query property to the given value.
18305    pub fn page_size(mut self, new_value: i32) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
18306        self._page_size = Some(new_value);
18307        self
18308    }
18309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18310    /// while executing the actual API request.
18311    /// 
18312    /// ````text
18313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18314    /// ````
18315    ///
18316    /// Sets the *delegate* property to the given value.
18317    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
18318        self._delegate = Some(new_value);
18319        self
18320    }
18321
18322    /// Set any additional parameter of the query string used in the request.
18323    /// It should be used to set parameters which are not yet available through their own
18324    /// setters.
18325    ///
18326    /// Please note that this method must not be used to set any of the known parameters
18327    /// which have their own setter method. If done anyway, the request will fail.
18328    ///
18329    /// # Additional Parameters
18330    ///
18331    /// * *$.xgafv* (query-string) - V1 error format.
18332    /// * *access_token* (query-string) - OAuth access token.
18333    /// * *alt* (query-string) - Data format for response.
18334    /// * *callback* (query-string) - JSONP
18335    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18336    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18337    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18338    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18339    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18340    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18341    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18342    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S>
18343                                                        where T: AsRef<str> {
18344        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
18345        self
18346    }
18347
18348    /// Identifies the authorization scope for the method you are building.
18349    ///
18350    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18351    /// [`Scope::AnalyticReadonly`].
18352    ///
18353    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18354    /// tokens for more than one scope.
18355    ///
18356    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18357    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18358    /// sufficient, a read-write scope will do as well.
18359    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S>
18360                                                        where St: AsRef<str> {
18361        self._scopes.insert(String::from(scope.as_ref()));
18362        self
18363    }
18364    /// Identifies the authorization scope(s) for the method you are building.
18365    ///
18366    /// See [`Self::add_scope()`] for details.
18367    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S>
18368                                                        where I: IntoIterator<Item = St>,
18369                                                         St: AsRef<str> {
18370        self._scopes
18371            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18372        self
18373    }
18374
18375    /// Removes all scopes, and no default scope will be used either.
18376    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18377    /// for details).
18378    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkListCall<'a, S> {
18379        self._scopes.clear();
18380        self
18381    }
18382}
18383
18384
18385/// Updates a DisplayVideo360AdvertiserLink on a property.
18386///
18387/// A builder for the *displayVideo360AdvertiserLinks.patch* method supported by a *property* resource.
18388/// It is not used directly, but through a [`PropertyMethods`] instance.
18389///
18390/// # Example
18391///
18392/// Instantiate a resource method builder
18393///
18394/// ```test_harness,no_run
18395/// # extern crate hyper;
18396/// # extern crate hyper_rustls;
18397/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
18398/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink;
18399/// # async fn dox() {
18400/// # use std::default::Default;
18401/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
18402/// 
18403/// # let secret: oauth2::ApplicationSecret = Default::default();
18404/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
18405/// #         secret,
18406/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18407/// #     ).build().await.unwrap();
18408/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
18409/// // As the method needs a request, you would usually fill it with the desired information
18410/// // into the respective structure. Some of the parts shown here might not be applicable !
18411/// // Values shown here are possibly random and not representative !
18412/// let mut req = GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink::default();
18413/// 
18414/// // You can configure optional parameters by calling the respective setters at will, and
18415/// // execute the final call using `doit()`.
18416/// // Values shown here are possibly random and not representative !
18417/// let result = hub.properties().display_video360_advertiser_links_patch(req, "name")
18418///              .update_mask(&Default::default())
18419///              .doit().await;
18420/// # }
18421/// ```
18422pub struct PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S>
18423    where S: 'a {
18424
18425    hub: &'a GoogleAnalyticsAdmin<S>,
18426    _request: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink,
18427    _name: String,
18428    _update_mask: Option<client::FieldMask>,
18429    _delegate: Option<&'a mut dyn client::Delegate>,
18430    _additional_params: HashMap<String, String>,
18431    _scopes: BTreeSet<String>
18432}
18433
18434impl<'a, S> client::CallBuilder for PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {}
18435
18436impl<'a, S> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S>
18437where
18438    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
18439    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
18440    S::Future: Send + Unpin + 'static,
18441    S::Error: Into<Box<dyn StdError + Send + Sync>>,
18442{
18443
18444
18445    /// Perform the operation you have build so far.
18446    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink)> {
18447        use std::io::{Read, Seek};
18448        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
18449        use client::{ToParts, url::Params};
18450        use std::borrow::Cow;
18451
18452        let mut dd = client::DefaultDelegate;
18453        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
18454        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.displayVideo360AdvertiserLinks.patch",
18455                               http_method: hyper::Method::PATCH });
18456
18457        for &field in ["alt", "name", "updateMask"].iter() {
18458            if self._additional_params.contains_key(field) {
18459                dlg.finished(false);
18460                return Err(client::Error::FieldClash(field));
18461            }
18462        }
18463
18464        let mut params = Params::with_capacity(5 + self._additional_params.len());
18465        params.push("name", self._name);
18466        if let Some(value) = self._update_mask.as_ref() {
18467            params.push("updateMask", value.to_string());
18468        }
18469
18470        params.extend(self._additional_params.iter());
18471
18472        params.push("alt", "json");
18473        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
18474        if self._scopes.is_empty() {
18475            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
18476        }
18477
18478        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18479            url = params.uri_replacement(url, param_name, find_this, true);
18480        }
18481        {
18482            let to_remove = ["name"];
18483            params.remove_params(&to_remove);
18484        }
18485
18486        let url = params.parse_with_url(&url);
18487
18488        let mut json_mime_type = mime::APPLICATION_JSON;
18489        let mut request_value_reader =
18490            {
18491                let mut value = json::value::to_value(&self._request).expect("serde to work");
18492                client::remove_json_null_values(&mut value);
18493                let mut dst = io::Cursor::new(Vec::with_capacity(128));
18494                json::to_writer(&mut dst, &value).unwrap();
18495                dst
18496            };
18497        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
18498        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
18499
18500
18501        loop {
18502            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
18503                Ok(token) => token,
18504                Err(e) => {
18505                    match dlg.token(e) {
18506                        Ok(token) => token,
18507                        Err(e) => {
18508                            dlg.finished(false);
18509                            return Err(client::Error::MissingToken(e));
18510                        }
18511                    }
18512                }
18513            };
18514            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
18515            let mut req_result = {
18516                let client = &self.hub.client;
18517                dlg.pre_request();
18518                let mut req_builder = hyper::Request::builder()
18519                    .method(hyper::Method::PATCH)
18520                    .uri(url.as_str())
18521                    .header(USER_AGENT, self.hub._user_agent.clone());
18522
18523                if let Some(token) = token.as_ref() {
18524                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18525                }
18526
18527
18528                        let request = req_builder
18529                        .header(CONTENT_TYPE, json_mime_type.to_string())
18530                        .header(CONTENT_LENGTH, request_size as u64)
18531                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
18532
18533                client.request(request.unwrap()).await
18534
18535            };
18536
18537            match req_result {
18538                Err(err) => {
18539                    if let client::Retry::After(d) = dlg.http_error(&err) {
18540                        sleep(d).await;
18541                        continue;
18542                    }
18543                    dlg.finished(false);
18544                    return Err(client::Error::HttpError(err))
18545                }
18546                Ok(mut res) => {
18547                    if !res.status().is_success() {
18548                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18549                        let (parts, _) = res.into_parts();
18550                        let body = hyper::Body::from(res_body_string.clone());
18551                        let restored_response = hyper::Response::from_parts(parts, body);
18552
18553                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
18554
18555                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
18556                            sleep(d).await;
18557                            continue;
18558                        }
18559
18560                        dlg.finished(false);
18561
18562                        return match server_response {
18563                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
18564                            None => Err(client::Error::Failure(restored_response)),
18565                        }
18566                    }
18567                    let result_value = {
18568                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18569
18570                        match json::from_str(&res_body_string) {
18571                            Ok(decoded) => (res, decoded),
18572                            Err(err) => {
18573                                dlg.response_json_decode_error(&res_body_string, &err);
18574                                return Err(client::Error::JsonDecodeError(res_body_string, err));
18575                            }
18576                        }
18577                    };
18578
18579                    dlg.finished(true);
18580                    return Ok(result_value)
18581                }
18582            }
18583        }
18584    }
18585
18586
18587    ///
18588    /// Sets the *request* property to the given value.
18589    ///
18590    /// Even though the property as already been set when instantiating this call,
18591    /// we provide this method for API completeness.
18592    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDisplayVideo360AdvertiserLink) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
18593        self._request = new_value;
18594        self
18595    }
18596    /// Output only. The resource name for this DisplayVideo360AdvertiserLink resource. Format: properties/{propertyId}/displayVideo360AdvertiserLinks/{linkId} Note: linkId is not the Display & Video 360 Advertiser ID
18597    ///
18598    /// Sets the *name* path property to the given value.
18599    ///
18600    /// Even though the property as already been set when instantiating this call,
18601    /// we provide this method for API completeness.
18602    pub fn name(mut self, new_value: &str) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
18603        self._name = new_value.to_string();
18604        self
18605    }
18606    /// Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
18607    ///
18608    /// Sets the *update mask* query property to the given value.
18609    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
18610        self._update_mask = Some(new_value);
18611        self
18612    }
18613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18614    /// while executing the actual API request.
18615    /// 
18616    /// ````text
18617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18618    /// ````
18619    ///
18620    /// Sets the *delegate* property to the given value.
18621    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
18622        self._delegate = Some(new_value);
18623        self
18624    }
18625
18626    /// Set any additional parameter of the query string used in the request.
18627    /// It should be used to set parameters which are not yet available through their own
18628    /// setters.
18629    ///
18630    /// Please note that this method must not be used to set any of the known parameters
18631    /// which have their own setter method. If done anyway, the request will fail.
18632    ///
18633    /// # Additional Parameters
18634    ///
18635    /// * *$.xgafv* (query-string) - V1 error format.
18636    /// * *access_token* (query-string) - OAuth access token.
18637    /// * *alt* (query-string) - Data format for response.
18638    /// * *callback* (query-string) - JSONP
18639    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18640    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18641    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18642    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18643    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18644    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18645    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18646    pub fn param<T>(mut self, name: T, value: T) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S>
18647                                                        where T: AsRef<str> {
18648        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
18649        self
18650    }
18651
18652    /// Identifies the authorization scope for the method you are building.
18653    ///
18654    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18655    /// [`Scope::AnalyticEdit`].
18656    ///
18657    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18658    /// tokens for more than one scope.
18659    ///
18660    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18661    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18662    /// sufficient, a read-write scope will do as well.
18663    pub fn add_scope<St>(mut self, scope: St) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S>
18664                                                        where St: AsRef<str> {
18665        self._scopes.insert(String::from(scope.as_ref()));
18666        self
18667    }
18668    /// Identifies the authorization scope(s) for the method you are building.
18669    ///
18670    /// See [`Self::add_scope()`] for details.
18671    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S>
18672                                                        where I: IntoIterator<Item = St>,
18673                                                         St: AsRef<str> {
18674        self._scopes
18675            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18676        self
18677    }
18678
18679    /// Removes all scopes, and no default scope will be used either.
18680    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18681    /// for details).
18682    pub fn clear_scopes(mut self) -> PropertyDisplayVideo360AdvertiserLinkPatchCall<'a, S> {
18683        self._scopes.clear();
18684        self
18685    }
18686}
18687
18688
18689/// Creates a FirebaseLink. Properties can have at most one FirebaseLink.
18690///
18691/// A builder for the *firebaseLinks.create* method supported by a *property* resource.
18692/// It is not used directly, but through a [`PropertyMethods`] instance.
18693///
18694/// # Example
18695///
18696/// Instantiate a resource method builder
18697///
18698/// ```test_harness,no_run
18699/// # extern crate hyper;
18700/// # extern crate hyper_rustls;
18701/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
18702/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaFirebaseLink;
18703/// # async fn dox() {
18704/// # use std::default::Default;
18705/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
18706/// 
18707/// # let secret: oauth2::ApplicationSecret = Default::default();
18708/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
18709/// #         secret,
18710/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18711/// #     ).build().await.unwrap();
18712/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
18713/// // As the method needs a request, you would usually fill it with the desired information
18714/// // into the respective structure. Some of the parts shown here might not be applicable !
18715/// // Values shown here are possibly random and not representative !
18716/// let mut req = GoogleAnalyticsAdminV1alphaFirebaseLink::default();
18717/// 
18718/// // You can configure optional parameters by calling the respective setters at will, and
18719/// // execute the final call using `doit()`.
18720/// // Values shown here are possibly random and not representative !
18721/// let result = hub.properties().firebase_links_create(req, "parent")
18722///              .doit().await;
18723/// # }
18724/// ```
18725pub struct PropertyFirebaseLinkCreateCall<'a, S>
18726    where S: 'a {
18727
18728    hub: &'a GoogleAnalyticsAdmin<S>,
18729    _request: GoogleAnalyticsAdminV1alphaFirebaseLink,
18730    _parent: String,
18731    _delegate: Option<&'a mut dyn client::Delegate>,
18732    _additional_params: HashMap<String, String>,
18733    _scopes: BTreeSet<String>
18734}
18735
18736impl<'a, S> client::CallBuilder for PropertyFirebaseLinkCreateCall<'a, S> {}
18737
18738impl<'a, S> PropertyFirebaseLinkCreateCall<'a, S>
18739where
18740    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
18741    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
18742    S::Future: Send + Unpin + 'static,
18743    S::Error: Into<Box<dyn StdError + Send + Sync>>,
18744{
18745
18746
18747    /// Perform the operation you have build so far.
18748    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaFirebaseLink)> {
18749        use std::io::{Read, Seek};
18750        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
18751        use client::{ToParts, url::Params};
18752        use std::borrow::Cow;
18753
18754        let mut dd = client::DefaultDelegate;
18755        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
18756        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.firebaseLinks.create",
18757                               http_method: hyper::Method::POST });
18758
18759        for &field in ["alt", "parent"].iter() {
18760            if self._additional_params.contains_key(field) {
18761                dlg.finished(false);
18762                return Err(client::Error::FieldClash(field));
18763            }
18764        }
18765
18766        let mut params = Params::with_capacity(4 + self._additional_params.len());
18767        params.push("parent", self._parent);
18768
18769        params.extend(self._additional_params.iter());
18770
18771        params.push("alt", "json");
18772        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/firebaseLinks";
18773        if self._scopes.is_empty() {
18774            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
18775        }
18776
18777        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18778            url = params.uri_replacement(url, param_name, find_this, true);
18779        }
18780        {
18781            let to_remove = ["parent"];
18782            params.remove_params(&to_remove);
18783        }
18784
18785        let url = params.parse_with_url(&url);
18786
18787        let mut json_mime_type = mime::APPLICATION_JSON;
18788        let mut request_value_reader =
18789            {
18790                let mut value = json::value::to_value(&self._request).expect("serde to work");
18791                client::remove_json_null_values(&mut value);
18792                let mut dst = io::Cursor::new(Vec::with_capacity(128));
18793                json::to_writer(&mut dst, &value).unwrap();
18794                dst
18795            };
18796        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
18797        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
18798
18799
18800        loop {
18801            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
18802                Ok(token) => token,
18803                Err(e) => {
18804                    match dlg.token(e) {
18805                        Ok(token) => token,
18806                        Err(e) => {
18807                            dlg.finished(false);
18808                            return Err(client::Error::MissingToken(e));
18809                        }
18810                    }
18811                }
18812            };
18813            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
18814            let mut req_result = {
18815                let client = &self.hub.client;
18816                dlg.pre_request();
18817                let mut req_builder = hyper::Request::builder()
18818                    .method(hyper::Method::POST)
18819                    .uri(url.as_str())
18820                    .header(USER_AGENT, self.hub._user_agent.clone());
18821
18822                if let Some(token) = token.as_ref() {
18823                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18824                }
18825
18826
18827                        let request = req_builder
18828                        .header(CONTENT_TYPE, json_mime_type.to_string())
18829                        .header(CONTENT_LENGTH, request_size as u64)
18830                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
18831
18832                client.request(request.unwrap()).await
18833
18834            };
18835
18836            match req_result {
18837                Err(err) => {
18838                    if let client::Retry::After(d) = dlg.http_error(&err) {
18839                        sleep(d).await;
18840                        continue;
18841                    }
18842                    dlg.finished(false);
18843                    return Err(client::Error::HttpError(err))
18844                }
18845                Ok(mut res) => {
18846                    if !res.status().is_success() {
18847                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18848                        let (parts, _) = res.into_parts();
18849                        let body = hyper::Body::from(res_body_string.clone());
18850                        let restored_response = hyper::Response::from_parts(parts, body);
18851
18852                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
18853
18854                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
18855                            sleep(d).await;
18856                            continue;
18857                        }
18858
18859                        dlg.finished(false);
18860
18861                        return match server_response {
18862                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
18863                            None => Err(client::Error::Failure(restored_response)),
18864                        }
18865                    }
18866                    let result_value = {
18867                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
18868
18869                        match json::from_str(&res_body_string) {
18870                            Ok(decoded) => (res, decoded),
18871                            Err(err) => {
18872                                dlg.response_json_decode_error(&res_body_string, &err);
18873                                return Err(client::Error::JsonDecodeError(res_body_string, err));
18874                            }
18875                        }
18876                    };
18877
18878                    dlg.finished(true);
18879                    return Ok(result_value)
18880                }
18881            }
18882        }
18883    }
18884
18885
18886    ///
18887    /// Sets the *request* property to the given value.
18888    ///
18889    /// Even though the property as already been set when instantiating this call,
18890    /// we provide this method for API completeness.
18891    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaFirebaseLink) -> PropertyFirebaseLinkCreateCall<'a, S> {
18892        self._request = new_value;
18893        self
18894    }
18895    /// Required. Format: properties/{property_id} Example: properties/1234
18896    ///
18897    /// Sets the *parent* path property to the given value.
18898    ///
18899    /// Even though the property as already been set when instantiating this call,
18900    /// we provide this method for API completeness.
18901    pub fn parent(mut self, new_value: &str) -> PropertyFirebaseLinkCreateCall<'a, S> {
18902        self._parent = new_value.to_string();
18903        self
18904    }
18905    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18906    /// while executing the actual API request.
18907    /// 
18908    /// ````text
18909    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18910    /// ````
18911    ///
18912    /// Sets the *delegate* property to the given value.
18913    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyFirebaseLinkCreateCall<'a, S> {
18914        self._delegate = Some(new_value);
18915        self
18916    }
18917
18918    /// Set any additional parameter of the query string used in the request.
18919    /// It should be used to set parameters which are not yet available through their own
18920    /// setters.
18921    ///
18922    /// Please note that this method must not be used to set any of the known parameters
18923    /// which have their own setter method. If done anyway, the request will fail.
18924    ///
18925    /// # Additional Parameters
18926    ///
18927    /// * *$.xgafv* (query-string) - V1 error format.
18928    /// * *access_token* (query-string) - OAuth access token.
18929    /// * *alt* (query-string) - Data format for response.
18930    /// * *callback* (query-string) - JSONP
18931    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18932    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18933    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18934    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18935    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18936    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18937    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18938    pub fn param<T>(mut self, name: T, value: T) -> PropertyFirebaseLinkCreateCall<'a, S>
18939                                                        where T: AsRef<str> {
18940        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
18941        self
18942    }
18943
18944    /// Identifies the authorization scope for the method you are building.
18945    ///
18946    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18947    /// [`Scope::AnalyticEdit`].
18948    ///
18949    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18950    /// tokens for more than one scope.
18951    ///
18952    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18953    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18954    /// sufficient, a read-write scope will do as well.
18955    pub fn add_scope<St>(mut self, scope: St) -> PropertyFirebaseLinkCreateCall<'a, S>
18956                                                        where St: AsRef<str> {
18957        self._scopes.insert(String::from(scope.as_ref()));
18958        self
18959    }
18960    /// Identifies the authorization scope(s) for the method you are building.
18961    ///
18962    /// See [`Self::add_scope()`] for details.
18963    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyFirebaseLinkCreateCall<'a, S>
18964                                                        where I: IntoIterator<Item = St>,
18965                                                         St: AsRef<str> {
18966        self._scopes
18967            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18968        self
18969    }
18970
18971    /// Removes all scopes, and no default scope will be used either.
18972    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18973    /// for details).
18974    pub fn clear_scopes(mut self) -> PropertyFirebaseLinkCreateCall<'a, S> {
18975        self._scopes.clear();
18976        self
18977    }
18978}
18979
18980
18981/// Deletes a FirebaseLink on a property
18982///
18983/// A builder for the *firebaseLinks.delete* method supported by a *property* resource.
18984/// It is not used directly, but through a [`PropertyMethods`] instance.
18985///
18986/// # Example
18987///
18988/// Instantiate a resource method builder
18989///
18990/// ```test_harness,no_run
18991/// # extern crate hyper;
18992/// # extern crate hyper_rustls;
18993/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
18994/// # async fn dox() {
18995/// # use std::default::Default;
18996/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
18997/// 
18998/// # let secret: oauth2::ApplicationSecret = Default::default();
18999/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
19000/// #         secret,
19001/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19002/// #     ).build().await.unwrap();
19003/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
19004/// // You can configure optional parameters by calling the respective setters at will, and
19005/// // execute the final call using `doit()`.
19006/// // Values shown here are possibly random and not representative !
19007/// let result = hub.properties().firebase_links_delete("name")
19008///              .doit().await;
19009/// # }
19010/// ```
19011pub struct PropertyFirebaseLinkDeleteCall<'a, S>
19012    where S: 'a {
19013
19014    hub: &'a GoogleAnalyticsAdmin<S>,
19015    _name: String,
19016    _delegate: Option<&'a mut dyn client::Delegate>,
19017    _additional_params: HashMap<String, String>,
19018    _scopes: BTreeSet<String>
19019}
19020
19021impl<'a, S> client::CallBuilder for PropertyFirebaseLinkDeleteCall<'a, S> {}
19022
19023impl<'a, S> PropertyFirebaseLinkDeleteCall<'a, S>
19024where
19025    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
19026    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
19027    S::Future: Send + Unpin + 'static,
19028    S::Error: Into<Box<dyn StdError + Send + Sync>>,
19029{
19030
19031
19032    /// Perform the operation you have build so far.
19033    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
19034        use std::io::{Read, Seek};
19035        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
19036        use client::{ToParts, url::Params};
19037        use std::borrow::Cow;
19038
19039        let mut dd = client::DefaultDelegate;
19040        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
19041        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.firebaseLinks.delete",
19042                               http_method: hyper::Method::DELETE });
19043
19044        for &field in ["alt", "name"].iter() {
19045            if self._additional_params.contains_key(field) {
19046                dlg.finished(false);
19047                return Err(client::Error::FieldClash(field));
19048            }
19049        }
19050
19051        let mut params = Params::with_capacity(3 + self._additional_params.len());
19052        params.push("name", self._name);
19053
19054        params.extend(self._additional_params.iter());
19055
19056        params.push("alt", "json");
19057        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
19058        if self._scopes.is_empty() {
19059            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
19060        }
19061
19062        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19063            url = params.uri_replacement(url, param_name, find_this, true);
19064        }
19065        {
19066            let to_remove = ["name"];
19067            params.remove_params(&to_remove);
19068        }
19069
19070        let url = params.parse_with_url(&url);
19071
19072
19073
19074        loop {
19075            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
19076                Ok(token) => token,
19077                Err(e) => {
19078                    match dlg.token(e) {
19079                        Ok(token) => token,
19080                        Err(e) => {
19081                            dlg.finished(false);
19082                            return Err(client::Error::MissingToken(e));
19083                        }
19084                    }
19085                }
19086            };
19087            let mut req_result = {
19088                let client = &self.hub.client;
19089                dlg.pre_request();
19090                let mut req_builder = hyper::Request::builder()
19091                    .method(hyper::Method::DELETE)
19092                    .uri(url.as_str())
19093                    .header(USER_AGENT, self.hub._user_agent.clone());
19094
19095                if let Some(token) = token.as_ref() {
19096                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19097                }
19098
19099
19100                        let request = req_builder
19101                        .body(hyper::body::Body::empty());
19102
19103                client.request(request.unwrap()).await
19104
19105            };
19106
19107            match req_result {
19108                Err(err) => {
19109                    if let client::Retry::After(d) = dlg.http_error(&err) {
19110                        sleep(d).await;
19111                        continue;
19112                    }
19113                    dlg.finished(false);
19114                    return Err(client::Error::HttpError(err))
19115                }
19116                Ok(mut res) => {
19117                    if !res.status().is_success() {
19118                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19119                        let (parts, _) = res.into_parts();
19120                        let body = hyper::Body::from(res_body_string.clone());
19121                        let restored_response = hyper::Response::from_parts(parts, body);
19122
19123                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
19124
19125                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
19126                            sleep(d).await;
19127                            continue;
19128                        }
19129
19130                        dlg.finished(false);
19131
19132                        return match server_response {
19133                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
19134                            None => Err(client::Error::Failure(restored_response)),
19135                        }
19136                    }
19137                    let result_value = {
19138                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19139
19140                        match json::from_str(&res_body_string) {
19141                            Ok(decoded) => (res, decoded),
19142                            Err(err) => {
19143                                dlg.response_json_decode_error(&res_body_string, &err);
19144                                return Err(client::Error::JsonDecodeError(res_body_string, err));
19145                            }
19146                        }
19147                    };
19148
19149                    dlg.finished(true);
19150                    return Ok(result_value)
19151                }
19152            }
19153        }
19154    }
19155
19156
19157    /// Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} Example: properties/1234/firebaseLinks/5678
19158    ///
19159    /// Sets the *name* path property to the given value.
19160    ///
19161    /// Even though the property as already been set when instantiating this call,
19162    /// we provide this method for API completeness.
19163    pub fn name(mut self, new_value: &str) -> PropertyFirebaseLinkDeleteCall<'a, S> {
19164        self._name = new_value.to_string();
19165        self
19166    }
19167    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19168    /// while executing the actual API request.
19169    /// 
19170    /// ````text
19171    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19172    /// ````
19173    ///
19174    /// Sets the *delegate* property to the given value.
19175    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyFirebaseLinkDeleteCall<'a, S> {
19176        self._delegate = Some(new_value);
19177        self
19178    }
19179
19180    /// Set any additional parameter of the query string used in the request.
19181    /// It should be used to set parameters which are not yet available through their own
19182    /// setters.
19183    ///
19184    /// Please note that this method must not be used to set any of the known parameters
19185    /// which have their own setter method. If done anyway, the request will fail.
19186    ///
19187    /// # Additional Parameters
19188    ///
19189    /// * *$.xgafv* (query-string) - V1 error format.
19190    /// * *access_token* (query-string) - OAuth access token.
19191    /// * *alt* (query-string) - Data format for response.
19192    /// * *callback* (query-string) - JSONP
19193    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19194    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19195    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19196    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19197    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19198    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19199    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19200    pub fn param<T>(mut self, name: T, value: T) -> PropertyFirebaseLinkDeleteCall<'a, S>
19201                                                        where T: AsRef<str> {
19202        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
19203        self
19204    }
19205
19206    /// Identifies the authorization scope for the method you are building.
19207    ///
19208    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19209    /// [`Scope::AnalyticEdit`].
19210    ///
19211    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19212    /// tokens for more than one scope.
19213    ///
19214    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19215    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19216    /// sufficient, a read-write scope will do as well.
19217    pub fn add_scope<St>(mut self, scope: St) -> PropertyFirebaseLinkDeleteCall<'a, S>
19218                                                        where St: AsRef<str> {
19219        self._scopes.insert(String::from(scope.as_ref()));
19220        self
19221    }
19222    /// Identifies the authorization scope(s) for the method you are building.
19223    ///
19224    /// See [`Self::add_scope()`] for details.
19225    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyFirebaseLinkDeleteCall<'a, S>
19226                                                        where I: IntoIterator<Item = St>,
19227                                                         St: AsRef<str> {
19228        self._scopes
19229            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19230        self
19231    }
19232
19233    /// Removes all scopes, and no default scope will be used either.
19234    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19235    /// for details).
19236    pub fn clear_scopes(mut self) -> PropertyFirebaseLinkDeleteCall<'a, S> {
19237        self._scopes.clear();
19238        self
19239    }
19240}
19241
19242
19243/// Lists FirebaseLinks on a property. Properties can have at most one FirebaseLink.
19244///
19245/// A builder for the *firebaseLinks.list* method supported by a *property* resource.
19246/// It is not used directly, but through a [`PropertyMethods`] instance.
19247///
19248/// # Example
19249///
19250/// Instantiate a resource method builder
19251///
19252/// ```test_harness,no_run
19253/// # extern crate hyper;
19254/// # extern crate hyper_rustls;
19255/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
19256/// # async fn dox() {
19257/// # use std::default::Default;
19258/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
19259/// 
19260/// # let secret: oauth2::ApplicationSecret = Default::default();
19261/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
19262/// #         secret,
19263/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19264/// #     ).build().await.unwrap();
19265/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
19266/// // You can configure optional parameters by calling the respective setters at will, and
19267/// // execute the final call using `doit()`.
19268/// // Values shown here are possibly random and not representative !
19269/// let result = hub.properties().firebase_links_list("parent")
19270///              .page_token("consetetur")
19271///              .page_size(-2)
19272///              .doit().await;
19273/// # }
19274/// ```
19275pub struct PropertyFirebaseLinkListCall<'a, S>
19276    where S: 'a {
19277
19278    hub: &'a GoogleAnalyticsAdmin<S>,
19279    _parent: String,
19280    _page_token: Option<String>,
19281    _page_size: Option<i32>,
19282    _delegate: Option<&'a mut dyn client::Delegate>,
19283    _additional_params: HashMap<String, String>,
19284    _scopes: BTreeSet<String>
19285}
19286
19287impl<'a, S> client::CallBuilder for PropertyFirebaseLinkListCall<'a, S> {}
19288
19289impl<'a, S> PropertyFirebaseLinkListCall<'a, S>
19290where
19291    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
19292    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
19293    S::Future: Send + Unpin + 'static,
19294    S::Error: Into<Box<dyn StdError + Send + Sync>>,
19295{
19296
19297
19298    /// Perform the operation you have build so far.
19299    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListFirebaseLinksResponse)> {
19300        use std::io::{Read, Seek};
19301        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
19302        use client::{ToParts, url::Params};
19303        use std::borrow::Cow;
19304
19305        let mut dd = client::DefaultDelegate;
19306        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
19307        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.firebaseLinks.list",
19308                               http_method: hyper::Method::GET });
19309
19310        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19311            if self._additional_params.contains_key(field) {
19312                dlg.finished(false);
19313                return Err(client::Error::FieldClash(field));
19314            }
19315        }
19316
19317        let mut params = Params::with_capacity(5 + self._additional_params.len());
19318        params.push("parent", self._parent);
19319        if let Some(value) = self._page_token.as_ref() {
19320            params.push("pageToken", value);
19321        }
19322        if let Some(value) = self._page_size.as_ref() {
19323            params.push("pageSize", value.to_string());
19324        }
19325
19326        params.extend(self._additional_params.iter());
19327
19328        params.push("alt", "json");
19329        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/firebaseLinks";
19330        if self._scopes.is_empty() {
19331            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
19332        }
19333
19334        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19335            url = params.uri_replacement(url, param_name, find_this, true);
19336        }
19337        {
19338            let to_remove = ["parent"];
19339            params.remove_params(&to_remove);
19340        }
19341
19342        let url = params.parse_with_url(&url);
19343
19344
19345
19346        loop {
19347            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
19348                Ok(token) => token,
19349                Err(e) => {
19350                    match dlg.token(e) {
19351                        Ok(token) => token,
19352                        Err(e) => {
19353                            dlg.finished(false);
19354                            return Err(client::Error::MissingToken(e));
19355                        }
19356                    }
19357                }
19358            };
19359            let mut req_result = {
19360                let client = &self.hub.client;
19361                dlg.pre_request();
19362                let mut req_builder = hyper::Request::builder()
19363                    .method(hyper::Method::GET)
19364                    .uri(url.as_str())
19365                    .header(USER_AGENT, self.hub._user_agent.clone());
19366
19367                if let Some(token) = token.as_ref() {
19368                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19369                }
19370
19371
19372                        let request = req_builder
19373                        .body(hyper::body::Body::empty());
19374
19375                client.request(request.unwrap()).await
19376
19377            };
19378
19379            match req_result {
19380                Err(err) => {
19381                    if let client::Retry::After(d) = dlg.http_error(&err) {
19382                        sleep(d).await;
19383                        continue;
19384                    }
19385                    dlg.finished(false);
19386                    return Err(client::Error::HttpError(err))
19387                }
19388                Ok(mut res) => {
19389                    if !res.status().is_success() {
19390                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19391                        let (parts, _) = res.into_parts();
19392                        let body = hyper::Body::from(res_body_string.clone());
19393                        let restored_response = hyper::Response::from_parts(parts, body);
19394
19395                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
19396
19397                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
19398                            sleep(d).await;
19399                            continue;
19400                        }
19401
19402                        dlg.finished(false);
19403
19404                        return match server_response {
19405                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
19406                            None => Err(client::Error::Failure(restored_response)),
19407                        }
19408                    }
19409                    let result_value = {
19410                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19411
19412                        match json::from_str(&res_body_string) {
19413                            Ok(decoded) => (res, decoded),
19414                            Err(err) => {
19415                                dlg.response_json_decode_error(&res_body_string, &err);
19416                                return Err(client::Error::JsonDecodeError(res_body_string, err));
19417                            }
19418                        }
19419                    };
19420
19421                    dlg.finished(true);
19422                    return Ok(result_value)
19423                }
19424            }
19425        }
19426    }
19427
19428
19429    /// Required. Format: properties/{property_id} Example: properties/1234
19430    ///
19431    /// Sets the *parent* path property to the given value.
19432    ///
19433    /// Even though the property as already been set when instantiating this call,
19434    /// we provide this method for API completeness.
19435    pub fn parent(mut self, new_value: &str) -> PropertyFirebaseLinkListCall<'a, S> {
19436        self._parent = new_value.to_string();
19437        self
19438    }
19439    /// A page token, received from a previous `ListFirebaseLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListProperties` must match the call that provided the page token.
19440    ///
19441    /// Sets the *page token* query property to the given value.
19442    pub fn page_token(mut self, new_value: &str) -> PropertyFirebaseLinkListCall<'a, S> {
19443        self._page_token = Some(new_value.to_string());
19444        self
19445    }
19446    /// The maximum number of resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
19447    ///
19448    /// Sets the *page size* query property to the given value.
19449    pub fn page_size(mut self, new_value: i32) -> PropertyFirebaseLinkListCall<'a, S> {
19450        self._page_size = Some(new_value);
19451        self
19452    }
19453    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19454    /// while executing the actual API request.
19455    /// 
19456    /// ````text
19457    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19458    /// ````
19459    ///
19460    /// Sets the *delegate* property to the given value.
19461    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyFirebaseLinkListCall<'a, S> {
19462        self._delegate = Some(new_value);
19463        self
19464    }
19465
19466    /// Set any additional parameter of the query string used in the request.
19467    /// It should be used to set parameters which are not yet available through their own
19468    /// setters.
19469    ///
19470    /// Please note that this method must not be used to set any of the known parameters
19471    /// which have their own setter method. If done anyway, the request will fail.
19472    ///
19473    /// # Additional Parameters
19474    ///
19475    /// * *$.xgafv* (query-string) - V1 error format.
19476    /// * *access_token* (query-string) - OAuth access token.
19477    /// * *alt* (query-string) - Data format for response.
19478    /// * *callback* (query-string) - JSONP
19479    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19480    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19481    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19482    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19483    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19484    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19485    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19486    pub fn param<T>(mut self, name: T, value: T) -> PropertyFirebaseLinkListCall<'a, S>
19487                                                        where T: AsRef<str> {
19488        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
19489        self
19490    }
19491
19492    /// Identifies the authorization scope for the method you are building.
19493    ///
19494    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19495    /// [`Scope::AnalyticReadonly`].
19496    ///
19497    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19498    /// tokens for more than one scope.
19499    ///
19500    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19501    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19502    /// sufficient, a read-write scope will do as well.
19503    pub fn add_scope<St>(mut self, scope: St) -> PropertyFirebaseLinkListCall<'a, S>
19504                                                        where St: AsRef<str> {
19505        self._scopes.insert(String::from(scope.as_ref()));
19506        self
19507    }
19508    /// Identifies the authorization scope(s) for the method you are building.
19509    ///
19510    /// See [`Self::add_scope()`] for details.
19511    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyFirebaseLinkListCall<'a, S>
19512                                                        where I: IntoIterator<Item = St>,
19513                                                         St: AsRef<str> {
19514        self._scopes
19515            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19516        self
19517    }
19518
19519    /// Removes all scopes, and no default scope will be used either.
19520    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19521    /// for details).
19522    pub fn clear_scopes(mut self) -> PropertyFirebaseLinkListCall<'a, S> {
19523        self._scopes.clear();
19524        self
19525    }
19526}
19527
19528
19529/// Creates a GoogleAdsLink.
19530///
19531/// A builder for the *googleAdsLinks.create* method supported by a *property* resource.
19532/// It is not used directly, but through a [`PropertyMethods`] instance.
19533///
19534/// # Example
19535///
19536/// Instantiate a resource method builder
19537///
19538/// ```test_harness,no_run
19539/// # extern crate hyper;
19540/// # extern crate hyper_rustls;
19541/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
19542/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaGoogleAdsLink;
19543/// # async fn dox() {
19544/// # use std::default::Default;
19545/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
19546/// 
19547/// # let secret: oauth2::ApplicationSecret = Default::default();
19548/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
19549/// #         secret,
19550/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19551/// #     ).build().await.unwrap();
19552/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
19553/// // As the method needs a request, you would usually fill it with the desired information
19554/// // into the respective structure. Some of the parts shown here might not be applicable !
19555/// // Values shown here are possibly random and not representative !
19556/// let mut req = GoogleAnalyticsAdminV1alphaGoogleAdsLink::default();
19557/// 
19558/// // You can configure optional parameters by calling the respective setters at will, and
19559/// // execute the final call using `doit()`.
19560/// // Values shown here are possibly random and not representative !
19561/// let result = hub.properties().google_ads_links_create(req, "parent")
19562///              .doit().await;
19563/// # }
19564/// ```
19565pub struct PropertyGoogleAdsLinkCreateCall<'a, S>
19566    where S: 'a {
19567
19568    hub: &'a GoogleAnalyticsAdmin<S>,
19569    _request: GoogleAnalyticsAdminV1alphaGoogleAdsLink,
19570    _parent: String,
19571    _delegate: Option<&'a mut dyn client::Delegate>,
19572    _additional_params: HashMap<String, String>,
19573    _scopes: BTreeSet<String>
19574}
19575
19576impl<'a, S> client::CallBuilder for PropertyGoogleAdsLinkCreateCall<'a, S> {}
19577
19578impl<'a, S> PropertyGoogleAdsLinkCreateCall<'a, S>
19579where
19580    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
19581    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
19582    S::Future: Send + Unpin + 'static,
19583    S::Error: Into<Box<dyn StdError + Send + Sync>>,
19584{
19585
19586
19587    /// Perform the operation you have build so far.
19588    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaGoogleAdsLink)> {
19589        use std::io::{Read, Seek};
19590        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
19591        use client::{ToParts, url::Params};
19592        use std::borrow::Cow;
19593
19594        let mut dd = client::DefaultDelegate;
19595        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
19596        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.googleAdsLinks.create",
19597                               http_method: hyper::Method::POST });
19598
19599        for &field in ["alt", "parent"].iter() {
19600            if self._additional_params.contains_key(field) {
19601                dlg.finished(false);
19602                return Err(client::Error::FieldClash(field));
19603            }
19604        }
19605
19606        let mut params = Params::with_capacity(4 + self._additional_params.len());
19607        params.push("parent", self._parent);
19608
19609        params.extend(self._additional_params.iter());
19610
19611        params.push("alt", "json");
19612        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/googleAdsLinks";
19613        if self._scopes.is_empty() {
19614            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
19615        }
19616
19617        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19618            url = params.uri_replacement(url, param_name, find_this, true);
19619        }
19620        {
19621            let to_remove = ["parent"];
19622            params.remove_params(&to_remove);
19623        }
19624
19625        let url = params.parse_with_url(&url);
19626
19627        let mut json_mime_type = mime::APPLICATION_JSON;
19628        let mut request_value_reader =
19629            {
19630                let mut value = json::value::to_value(&self._request).expect("serde to work");
19631                client::remove_json_null_values(&mut value);
19632                let mut dst = io::Cursor::new(Vec::with_capacity(128));
19633                json::to_writer(&mut dst, &value).unwrap();
19634                dst
19635            };
19636        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
19637        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
19638
19639
19640        loop {
19641            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
19642                Ok(token) => token,
19643                Err(e) => {
19644                    match dlg.token(e) {
19645                        Ok(token) => token,
19646                        Err(e) => {
19647                            dlg.finished(false);
19648                            return Err(client::Error::MissingToken(e));
19649                        }
19650                    }
19651                }
19652            };
19653            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
19654            let mut req_result = {
19655                let client = &self.hub.client;
19656                dlg.pre_request();
19657                let mut req_builder = hyper::Request::builder()
19658                    .method(hyper::Method::POST)
19659                    .uri(url.as_str())
19660                    .header(USER_AGENT, self.hub._user_agent.clone());
19661
19662                if let Some(token) = token.as_ref() {
19663                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19664                }
19665
19666
19667                        let request = req_builder
19668                        .header(CONTENT_TYPE, json_mime_type.to_string())
19669                        .header(CONTENT_LENGTH, request_size as u64)
19670                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
19671
19672                client.request(request.unwrap()).await
19673
19674            };
19675
19676            match req_result {
19677                Err(err) => {
19678                    if let client::Retry::After(d) = dlg.http_error(&err) {
19679                        sleep(d).await;
19680                        continue;
19681                    }
19682                    dlg.finished(false);
19683                    return Err(client::Error::HttpError(err))
19684                }
19685                Ok(mut res) => {
19686                    if !res.status().is_success() {
19687                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19688                        let (parts, _) = res.into_parts();
19689                        let body = hyper::Body::from(res_body_string.clone());
19690                        let restored_response = hyper::Response::from_parts(parts, body);
19691
19692                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
19693
19694                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
19695                            sleep(d).await;
19696                            continue;
19697                        }
19698
19699                        dlg.finished(false);
19700
19701                        return match server_response {
19702                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
19703                            None => Err(client::Error::Failure(restored_response)),
19704                        }
19705                    }
19706                    let result_value = {
19707                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19708
19709                        match json::from_str(&res_body_string) {
19710                            Ok(decoded) => (res, decoded),
19711                            Err(err) => {
19712                                dlg.response_json_decode_error(&res_body_string, &err);
19713                                return Err(client::Error::JsonDecodeError(res_body_string, err));
19714                            }
19715                        }
19716                    };
19717
19718                    dlg.finished(true);
19719                    return Ok(result_value)
19720                }
19721            }
19722        }
19723    }
19724
19725
19726    ///
19727    /// Sets the *request* property to the given value.
19728    ///
19729    /// Even though the property as already been set when instantiating this call,
19730    /// we provide this method for API completeness.
19731    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaGoogleAdsLink) -> PropertyGoogleAdsLinkCreateCall<'a, S> {
19732        self._request = new_value;
19733        self
19734    }
19735    /// Required. Example format: properties/1234
19736    ///
19737    /// Sets the *parent* path property to the given value.
19738    ///
19739    /// Even though the property as already been set when instantiating this call,
19740    /// we provide this method for API completeness.
19741    pub fn parent(mut self, new_value: &str) -> PropertyGoogleAdsLinkCreateCall<'a, S> {
19742        self._parent = new_value.to_string();
19743        self
19744    }
19745    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19746    /// while executing the actual API request.
19747    /// 
19748    /// ````text
19749    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19750    /// ````
19751    ///
19752    /// Sets the *delegate* property to the given value.
19753    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGoogleAdsLinkCreateCall<'a, S> {
19754        self._delegate = Some(new_value);
19755        self
19756    }
19757
19758    /// Set any additional parameter of the query string used in the request.
19759    /// It should be used to set parameters which are not yet available through their own
19760    /// setters.
19761    ///
19762    /// Please note that this method must not be used to set any of the known parameters
19763    /// which have their own setter method. If done anyway, the request will fail.
19764    ///
19765    /// # Additional Parameters
19766    ///
19767    /// * *$.xgafv* (query-string) - V1 error format.
19768    /// * *access_token* (query-string) - OAuth access token.
19769    /// * *alt* (query-string) - Data format for response.
19770    /// * *callback* (query-string) - JSONP
19771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19772    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19775    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19778    pub fn param<T>(mut self, name: T, value: T) -> PropertyGoogleAdsLinkCreateCall<'a, S>
19779                                                        where T: AsRef<str> {
19780        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
19781        self
19782    }
19783
19784    /// Identifies the authorization scope for the method you are building.
19785    ///
19786    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19787    /// [`Scope::AnalyticEdit`].
19788    ///
19789    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19790    /// tokens for more than one scope.
19791    ///
19792    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19793    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19794    /// sufficient, a read-write scope will do as well.
19795    pub fn add_scope<St>(mut self, scope: St) -> PropertyGoogleAdsLinkCreateCall<'a, S>
19796                                                        where St: AsRef<str> {
19797        self._scopes.insert(String::from(scope.as_ref()));
19798        self
19799    }
19800    /// Identifies the authorization scope(s) for the method you are building.
19801    ///
19802    /// See [`Self::add_scope()`] for details.
19803    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGoogleAdsLinkCreateCall<'a, S>
19804                                                        where I: IntoIterator<Item = St>,
19805                                                         St: AsRef<str> {
19806        self._scopes
19807            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19808        self
19809    }
19810
19811    /// Removes all scopes, and no default scope will be used either.
19812    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19813    /// for details).
19814    pub fn clear_scopes(mut self) -> PropertyGoogleAdsLinkCreateCall<'a, S> {
19815        self._scopes.clear();
19816        self
19817    }
19818}
19819
19820
19821/// Deletes a GoogleAdsLink on a property
19822///
19823/// A builder for the *googleAdsLinks.delete* method supported by a *property* resource.
19824/// It is not used directly, but through a [`PropertyMethods`] instance.
19825///
19826/// # Example
19827///
19828/// Instantiate a resource method builder
19829///
19830/// ```test_harness,no_run
19831/// # extern crate hyper;
19832/// # extern crate hyper_rustls;
19833/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
19834/// # async fn dox() {
19835/// # use std::default::Default;
19836/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
19837/// 
19838/// # let secret: oauth2::ApplicationSecret = Default::default();
19839/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
19840/// #         secret,
19841/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19842/// #     ).build().await.unwrap();
19843/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
19844/// // You can configure optional parameters by calling the respective setters at will, and
19845/// // execute the final call using `doit()`.
19846/// // Values shown here are possibly random and not representative !
19847/// let result = hub.properties().google_ads_links_delete("name")
19848///              .doit().await;
19849/// # }
19850/// ```
19851pub struct PropertyGoogleAdsLinkDeleteCall<'a, S>
19852    where S: 'a {
19853
19854    hub: &'a GoogleAnalyticsAdmin<S>,
19855    _name: String,
19856    _delegate: Option<&'a mut dyn client::Delegate>,
19857    _additional_params: HashMap<String, String>,
19858    _scopes: BTreeSet<String>
19859}
19860
19861impl<'a, S> client::CallBuilder for PropertyGoogleAdsLinkDeleteCall<'a, S> {}
19862
19863impl<'a, S> PropertyGoogleAdsLinkDeleteCall<'a, S>
19864where
19865    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
19866    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
19867    S::Future: Send + Unpin + 'static,
19868    S::Error: Into<Box<dyn StdError + Send + Sync>>,
19869{
19870
19871
19872    /// Perform the operation you have build so far.
19873    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
19874        use std::io::{Read, Seek};
19875        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
19876        use client::{ToParts, url::Params};
19877        use std::borrow::Cow;
19878
19879        let mut dd = client::DefaultDelegate;
19880        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
19881        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.googleAdsLinks.delete",
19882                               http_method: hyper::Method::DELETE });
19883
19884        for &field in ["alt", "name"].iter() {
19885            if self._additional_params.contains_key(field) {
19886                dlg.finished(false);
19887                return Err(client::Error::FieldClash(field));
19888            }
19889        }
19890
19891        let mut params = Params::with_capacity(3 + self._additional_params.len());
19892        params.push("name", self._name);
19893
19894        params.extend(self._additional_params.iter());
19895
19896        params.push("alt", "json");
19897        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
19898        if self._scopes.is_empty() {
19899            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
19900        }
19901
19902        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19903            url = params.uri_replacement(url, param_name, find_this, true);
19904        }
19905        {
19906            let to_remove = ["name"];
19907            params.remove_params(&to_remove);
19908        }
19909
19910        let url = params.parse_with_url(&url);
19911
19912
19913
19914        loop {
19915            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
19916                Ok(token) => token,
19917                Err(e) => {
19918                    match dlg.token(e) {
19919                        Ok(token) => token,
19920                        Err(e) => {
19921                            dlg.finished(false);
19922                            return Err(client::Error::MissingToken(e));
19923                        }
19924                    }
19925                }
19926            };
19927            let mut req_result = {
19928                let client = &self.hub.client;
19929                dlg.pre_request();
19930                let mut req_builder = hyper::Request::builder()
19931                    .method(hyper::Method::DELETE)
19932                    .uri(url.as_str())
19933                    .header(USER_AGENT, self.hub._user_agent.clone());
19934
19935                if let Some(token) = token.as_ref() {
19936                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19937                }
19938
19939
19940                        let request = req_builder
19941                        .body(hyper::body::Body::empty());
19942
19943                client.request(request.unwrap()).await
19944
19945            };
19946
19947            match req_result {
19948                Err(err) => {
19949                    if let client::Retry::After(d) = dlg.http_error(&err) {
19950                        sleep(d).await;
19951                        continue;
19952                    }
19953                    dlg.finished(false);
19954                    return Err(client::Error::HttpError(err))
19955                }
19956                Ok(mut res) => {
19957                    if !res.status().is_success() {
19958                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19959                        let (parts, _) = res.into_parts();
19960                        let body = hyper::Body::from(res_body_string.clone());
19961                        let restored_response = hyper::Response::from_parts(parts, body);
19962
19963                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
19964
19965                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
19966                            sleep(d).await;
19967                            continue;
19968                        }
19969
19970                        dlg.finished(false);
19971
19972                        return match server_response {
19973                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
19974                            None => Err(client::Error::Failure(restored_response)),
19975                        }
19976                    }
19977                    let result_value = {
19978                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
19979
19980                        match json::from_str(&res_body_string) {
19981                            Ok(decoded) => (res, decoded),
19982                            Err(err) => {
19983                                dlg.response_json_decode_error(&res_body_string, &err);
19984                                return Err(client::Error::JsonDecodeError(res_body_string, err));
19985                            }
19986                        }
19987                    };
19988
19989                    dlg.finished(true);
19990                    return Ok(result_value)
19991                }
19992            }
19993        }
19994    }
19995
19996
19997    /// Required. Example format: properties/1234/googleAdsLinks/5678
19998    ///
19999    /// Sets the *name* path property to the given value.
20000    ///
20001    /// Even though the property as already been set when instantiating this call,
20002    /// we provide this method for API completeness.
20003    pub fn name(mut self, new_value: &str) -> PropertyGoogleAdsLinkDeleteCall<'a, S> {
20004        self._name = new_value.to_string();
20005        self
20006    }
20007    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20008    /// while executing the actual API request.
20009    /// 
20010    /// ````text
20011    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20012    /// ````
20013    ///
20014    /// Sets the *delegate* property to the given value.
20015    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGoogleAdsLinkDeleteCall<'a, S> {
20016        self._delegate = Some(new_value);
20017        self
20018    }
20019
20020    /// Set any additional parameter of the query string used in the request.
20021    /// It should be used to set parameters which are not yet available through their own
20022    /// setters.
20023    ///
20024    /// Please note that this method must not be used to set any of the known parameters
20025    /// which have their own setter method. If done anyway, the request will fail.
20026    ///
20027    /// # Additional Parameters
20028    ///
20029    /// * *$.xgafv* (query-string) - V1 error format.
20030    /// * *access_token* (query-string) - OAuth access token.
20031    /// * *alt* (query-string) - Data format for response.
20032    /// * *callback* (query-string) - JSONP
20033    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20034    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20035    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20036    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20037    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20038    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20039    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20040    pub fn param<T>(mut self, name: T, value: T) -> PropertyGoogleAdsLinkDeleteCall<'a, S>
20041                                                        where T: AsRef<str> {
20042        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
20043        self
20044    }
20045
20046    /// Identifies the authorization scope for the method you are building.
20047    ///
20048    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20049    /// [`Scope::AnalyticEdit`].
20050    ///
20051    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20052    /// tokens for more than one scope.
20053    ///
20054    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20055    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20056    /// sufficient, a read-write scope will do as well.
20057    pub fn add_scope<St>(mut self, scope: St) -> PropertyGoogleAdsLinkDeleteCall<'a, S>
20058                                                        where St: AsRef<str> {
20059        self._scopes.insert(String::from(scope.as_ref()));
20060        self
20061    }
20062    /// Identifies the authorization scope(s) for the method you are building.
20063    ///
20064    /// See [`Self::add_scope()`] for details.
20065    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGoogleAdsLinkDeleteCall<'a, S>
20066                                                        where I: IntoIterator<Item = St>,
20067                                                         St: AsRef<str> {
20068        self._scopes
20069            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20070        self
20071    }
20072
20073    /// Removes all scopes, and no default scope will be used either.
20074    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20075    /// for details).
20076    pub fn clear_scopes(mut self) -> PropertyGoogleAdsLinkDeleteCall<'a, S> {
20077        self._scopes.clear();
20078        self
20079    }
20080}
20081
20082
20083/// Lists GoogleAdsLinks on a property.
20084///
20085/// A builder for the *googleAdsLinks.list* method supported by a *property* resource.
20086/// It is not used directly, but through a [`PropertyMethods`] instance.
20087///
20088/// # Example
20089///
20090/// Instantiate a resource method builder
20091///
20092/// ```test_harness,no_run
20093/// # extern crate hyper;
20094/// # extern crate hyper_rustls;
20095/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
20096/// # async fn dox() {
20097/// # use std::default::Default;
20098/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
20099/// 
20100/// # let secret: oauth2::ApplicationSecret = Default::default();
20101/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
20102/// #         secret,
20103/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20104/// #     ).build().await.unwrap();
20105/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
20106/// // You can configure optional parameters by calling the respective setters at will, and
20107/// // execute the final call using `doit()`.
20108/// // Values shown here are possibly random and not representative !
20109/// let result = hub.properties().google_ads_links_list("parent")
20110///              .page_token("gubergren")
20111///              .page_size(-74)
20112///              .doit().await;
20113/// # }
20114/// ```
20115pub struct PropertyGoogleAdsLinkListCall<'a, S>
20116    where S: 'a {
20117
20118    hub: &'a GoogleAnalyticsAdmin<S>,
20119    _parent: String,
20120    _page_token: Option<String>,
20121    _page_size: Option<i32>,
20122    _delegate: Option<&'a mut dyn client::Delegate>,
20123    _additional_params: HashMap<String, String>,
20124    _scopes: BTreeSet<String>
20125}
20126
20127impl<'a, S> client::CallBuilder for PropertyGoogleAdsLinkListCall<'a, S> {}
20128
20129impl<'a, S> PropertyGoogleAdsLinkListCall<'a, S>
20130where
20131    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
20132    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
20133    S::Future: Send + Unpin + 'static,
20134    S::Error: Into<Box<dyn StdError + Send + Sync>>,
20135{
20136
20137
20138    /// Perform the operation you have build so far.
20139    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListGoogleAdsLinksResponse)> {
20140        use std::io::{Read, Seek};
20141        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
20142        use client::{ToParts, url::Params};
20143        use std::borrow::Cow;
20144
20145        let mut dd = client::DefaultDelegate;
20146        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
20147        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.googleAdsLinks.list",
20148                               http_method: hyper::Method::GET });
20149
20150        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
20151            if self._additional_params.contains_key(field) {
20152                dlg.finished(false);
20153                return Err(client::Error::FieldClash(field));
20154            }
20155        }
20156
20157        let mut params = Params::with_capacity(5 + self._additional_params.len());
20158        params.push("parent", self._parent);
20159        if let Some(value) = self._page_token.as_ref() {
20160            params.push("pageToken", value);
20161        }
20162        if let Some(value) = self._page_size.as_ref() {
20163            params.push("pageSize", value.to_string());
20164        }
20165
20166        params.extend(self._additional_params.iter());
20167
20168        params.push("alt", "json");
20169        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/googleAdsLinks";
20170        if self._scopes.is_empty() {
20171            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
20172        }
20173
20174        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20175            url = params.uri_replacement(url, param_name, find_this, true);
20176        }
20177        {
20178            let to_remove = ["parent"];
20179            params.remove_params(&to_remove);
20180        }
20181
20182        let url = params.parse_with_url(&url);
20183
20184
20185
20186        loop {
20187            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
20188                Ok(token) => token,
20189                Err(e) => {
20190                    match dlg.token(e) {
20191                        Ok(token) => token,
20192                        Err(e) => {
20193                            dlg.finished(false);
20194                            return Err(client::Error::MissingToken(e));
20195                        }
20196                    }
20197                }
20198            };
20199            let mut req_result = {
20200                let client = &self.hub.client;
20201                dlg.pre_request();
20202                let mut req_builder = hyper::Request::builder()
20203                    .method(hyper::Method::GET)
20204                    .uri(url.as_str())
20205                    .header(USER_AGENT, self.hub._user_agent.clone());
20206
20207                if let Some(token) = token.as_ref() {
20208                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20209                }
20210
20211
20212                        let request = req_builder
20213                        .body(hyper::body::Body::empty());
20214
20215                client.request(request.unwrap()).await
20216
20217            };
20218
20219            match req_result {
20220                Err(err) => {
20221                    if let client::Retry::After(d) = dlg.http_error(&err) {
20222                        sleep(d).await;
20223                        continue;
20224                    }
20225                    dlg.finished(false);
20226                    return Err(client::Error::HttpError(err))
20227                }
20228                Ok(mut res) => {
20229                    if !res.status().is_success() {
20230                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20231                        let (parts, _) = res.into_parts();
20232                        let body = hyper::Body::from(res_body_string.clone());
20233                        let restored_response = hyper::Response::from_parts(parts, body);
20234
20235                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
20236
20237                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
20238                            sleep(d).await;
20239                            continue;
20240                        }
20241
20242                        dlg.finished(false);
20243
20244                        return match server_response {
20245                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
20246                            None => Err(client::Error::Failure(restored_response)),
20247                        }
20248                    }
20249                    let result_value = {
20250                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20251
20252                        match json::from_str(&res_body_string) {
20253                            Ok(decoded) => (res, decoded),
20254                            Err(err) => {
20255                                dlg.response_json_decode_error(&res_body_string, &err);
20256                                return Err(client::Error::JsonDecodeError(res_body_string, err));
20257                            }
20258                        }
20259                    };
20260
20261                    dlg.finished(true);
20262                    return Ok(result_value)
20263                }
20264            }
20265        }
20266    }
20267
20268
20269    /// Required. Example format: properties/1234
20270    ///
20271    /// Sets the *parent* path property to the given value.
20272    ///
20273    /// Even though the property as already been set when instantiating this call,
20274    /// we provide this method for API completeness.
20275    pub fn parent(mut self, new_value: &str) -> PropertyGoogleAdsLinkListCall<'a, S> {
20276        self._parent = new_value.to_string();
20277        self
20278    }
20279    /// A page token, received from a previous `ListGoogleAdsLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListGoogleAdsLinks` must match the call that provided the page token.
20280    ///
20281    /// Sets the *page token* query property to the given value.
20282    pub fn page_token(mut self, new_value: &str) -> PropertyGoogleAdsLinkListCall<'a, S> {
20283        self._page_token = Some(new_value.to_string());
20284        self
20285    }
20286    /// The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum).
20287    ///
20288    /// Sets the *page size* query property to the given value.
20289    pub fn page_size(mut self, new_value: i32) -> PropertyGoogleAdsLinkListCall<'a, S> {
20290        self._page_size = Some(new_value);
20291        self
20292    }
20293    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20294    /// while executing the actual API request.
20295    /// 
20296    /// ````text
20297    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20298    /// ````
20299    ///
20300    /// Sets the *delegate* property to the given value.
20301    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGoogleAdsLinkListCall<'a, S> {
20302        self._delegate = Some(new_value);
20303        self
20304    }
20305
20306    /// Set any additional parameter of the query string used in the request.
20307    /// It should be used to set parameters which are not yet available through their own
20308    /// setters.
20309    ///
20310    /// Please note that this method must not be used to set any of the known parameters
20311    /// which have their own setter method. If done anyway, the request will fail.
20312    ///
20313    /// # Additional Parameters
20314    ///
20315    /// * *$.xgafv* (query-string) - V1 error format.
20316    /// * *access_token* (query-string) - OAuth access token.
20317    /// * *alt* (query-string) - Data format for response.
20318    /// * *callback* (query-string) - JSONP
20319    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20320    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20321    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20322    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20323    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20324    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20325    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20326    pub fn param<T>(mut self, name: T, value: T) -> PropertyGoogleAdsLinkListCall<'a, S>
20327                                                        where T: AsRef<str> {
20328        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
20329        self
20330    }
20331
20332    /// Identifies the authorization scope for the method you are building.
20333    ///
20334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20335    /// [`Scope::AnalyticReadonly`].
20336    ///
20337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20338    /// tokens for more than one scope.
20339    ///
20340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20342    /// sufficient, a read-write scope will do as well.
20343    pub fn add_scope<St>(mut self, scope: St) -> PropertyGoogleAdsLinkListCall<'a, S>
20344                                                        where St: AsRef<str> {
20345        self._scopes.insert(String::from(scope.as_ref()));
20346        self
20347    }
20348    /// Identifies the authorization scope(s) for the method you are building.
20349    ///
20350    /// See [`Self::add_scope()`] for details.
20351    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGoogleAdsLinkListCall<'a, S>
20352                                                        where I: IntoIterator<Item = St>,
20353                                                         St: AsRef<str> {
20354        self._scopes
20355            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20356        self
20357    }
20358
20359    /// Removes all scopes, and no default scope will be used either.
20360    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20361    /// for details).
20362    pub fn clear_scopes(mut self) -> PropertyGoogleAdsLinkListCall<'a, S> {
20363        self._scopes.clear();
20364        self
20365    }
20366}
20367
20368
20369/// Updates a GoogleAdsLink on a property
20370///
20371/// A builder for the *googleAdsLinks.patch* method supported by a *property* resource.
20372/// It is not used directly, but through a [`PropertyMethods`] instance.
20373///
20374/// # Example
20375///
20376/// Instantiate a resource method builder
20377///
20378/// ```test_harness,no_run
20379/// # extern crate hyper;
20380/// # extern crate hyper_rustls;
20381/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
20382/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaGoogleAdsLink;
20383/// # async fn dox() {
20384/// # use std::default::Default;
20385/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
20386/// 
20387/// # let secret: oauth2::ApplicationSecret = Default::default();
20388/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
20389/// #         secret,
20390/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20391/// #     ).build().await.unwrap();
20392/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
20393/// // As the method needs a request, you would usually fill it with the desired information
20394/// // into the respective structure. Some of the parts shown here might not be applicable !
20395/// // Values shown here are possibly random and not representative !
20396/// let mut req = GoogleAnalyticsAdminV1alphaGoogleAdsLink::default();
20397/// 
20398/// // You can configure optional parameters by calling the respective setters at will, and
20399/// // execute the final call using `doit()`.
20400/// // Values shown here are possibly random and not representative !
20401/// let result = hub.properties().google_ads_links_patch(req, "name")
20402///              .update_mask(&Default::default())
20403///              .doit().await;
20404/// # }
20405/// ```
20406pub struct PropertyGoogleAdsLinkPatchCall<'a, S>
20407    where S: 'a {
20408
20409    hub: &'a GoogleAnalyticsAdmin<S>,
20410    _request: GoogleAnalyticsAdminV1alphaGoogleAdsLink,
20411    _name: String,
20412    _update_mask: Option<client::FieldMask>,
20413    _delegate: Option<&'a mut dyn client::Delegate>,
20414    _additional_params: HashMap<String, String>,
20415    _scopes: BTreeSet<String>
20416}
20417
20418impl<'a, S> client::CallBuilder for PropertyGoogleAdsLinkPatchCall<'a, S> {}
20419
20420impl<'a, S> PropertyGoogleAdsLinkPatchCall<'a, S>
20421where
20422    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
20423    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
20424    S::Future: Send + Unpin + 'static,
20425    S::Error: Into<Box<dyn StdError + Send + Sync>>,
20426{
20427
20428
20429    /// Perform the operation you have build so far.
20430    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaGoogleAdsLink)> {
20431        use std::io::{Read, Seek};
20432        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
20433        use client::{ToParts, url::Params};
20434        use std::borrow::Cow;
20435
20436        let mut dd = client::DefaultDelegate;
20437        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
20438        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.googleAdsLinks.patch",
20439                               http_method: hyper::Method::PATCH });
20440
20441        for &field in ["alt", "name", "updateMask"].iter() {
20442            if self._additional_params.contains_key(field) {
20443                dlg.finished(false);
20444                return Err(client::Error::FieldClash(field));
20445            }
20446        }
20447
20448        let mut params = Params::with_capacity(5 + self._additional_params.len());
20449        params.push("name", self._name);
20450        if let Some(value) = self._update_mask.as_ref() {
20451            params.push("updateMask", value.to_string());
20452        }
20453
20454        params.extend(self._additional_params.iter());
20455
20456        params.push("alt", "json");
20457        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
20458        if self._scopes.is_empty() {
20459            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
20460        }
20461
20462        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20463            url = params.uri_replacement(url, param_name, find_this, true);
20464        }
20465        {
20466            let to_remove = ["name"];
20467            params.remove_params(&to_remove);
20468        }
20469
20470        let url = params.parse_with_url(&url);
20471
20472        let mut json_mime_type = mime::APPLICATION_JSON;
20473        let mut request_value_reader =
20474            {
20475                let mut value = json::value::to_value(&self._request).expect("serde to work");
20476                client::remove_json_null_values(&mut value);
20477                let mut dst = io::Cursor::new(Vec::with_capacity(128));
20478                json::to_writer(&mut dst, &value).unwrap();
20479                dst
20480            };
20481        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
20482        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
20483
20484
20485        loop {
20486            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
20487                Ok(token) => token,
20488                Err(e) => {
20489                    match dlg.token(e) {
20490                        Ok(token) => token,
20491                        Err(e) => {
20492                            dlg.finished(false);
20493                            return Err(client::Error::MissingToken(e));
20494                        }
20495                    }
20496                }
20497            };
20498            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
20499            let mut req_result = {
20500                let client = &self.hub.client;
20501                dlg.pre_request();
20502                let mut req_builder = hyper::Request::builder()
20503                    .method(hyper::Method::PATCH)
20504                    .uri(url.as_str())
20505                    .header(USER_AGENT, self.hub._user_agent.clone());
20506
20507                if let Some(token) = token.as_ref() {
20508                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20509                }
20510
20511
20512                        let request = req_builder
20513                        .header(CONTENT_TYPE, json_mime_type.to_string())
20514                        .header(CONTENT_LENGTH, request_size as u64)
20515                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
20516
20517                client.request(request.unwrap()).await
20518
20519            };
20520
20521            match req_result {
20522                Err(err) => {
20523                    if let client::Retry::After(d) = dlg.http_error(&err) {
20524                        sleep(d).await;
20525                        continue;
20526                    }
20527                    dlg.finished(false);
20528                    return Err(client::Error::HttpError(err))
20529                }
20530                Ok(mut res) => {
20531                    if !res.status().is_success() {
20532                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20533                        let (parts, _) = res.into_parts();
20534                        let body = hyper::Body::from(res_body_string.clone());
20535                        let restored_response = hyper::Response::from_parts(parts, body);
20536
20537                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
20538
20539                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
20540                            sleep(d).await;
20541                            continue;
20542                        }
20543
20544                        dlg.finished(false);
20545
20546                        return match server_response {
20547                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
20548                            None => Err(client::Error::Failure(restored_response)),
20549                        }
20550                    }
20551                    let result_value = {
20552                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20553
20554                        match json::from_str(&res_body_string) {
20555                            Ok(decoded) => (res, decoded),
20556                            Err(err) => {
20557                                dlg.response_json_decode_error(&res_body_string, &err);
20558                                return Err(client::Error::JsonDecodeError(res_body_string, err));
20559                            }
20560                        }
20561                    };
20562
20563                    dlg.finished(true);
20564                    return Ok(result_value)
20565                }
20566            }
20567        }
20568    }
20569
20570
20571    ///
20572    /// Sets the *request* property to the given value.
20573    ///
20574    /// Even though the property as already been set when instantiating this call,
20575    /// we provide this method for API completeness.
20576    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaGoogleAdsLink) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
20577        self._request = new_value;
20578        self
20579    }
20580    /// Output only. Format: properties/{propertyId}/googleAdsLinks/{googleAdsLinkId} Note: googleAdsLinkId is not the Google Ads customer ID.
20581    ///
20582    /// Sets the *name* path property to the given value.
20583    ///
20584    /// Even though the property as already been set when instantiating this call,
20585    /// we provide this method for API completeness.
20586    pub fn name(mut self, new_value: &str) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
20587        self._name = new_value.to_string();
20588        self
20589    }
20590    /// Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
20591    ///
20592    /// Sets the *update mask* query property to the given value.
20593    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
20594        self._update_mask = Some(new_value);
20595        self
20596    }
20597    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20598    /// while executing the actual API request.
20599    /// 
20600    /// ````text
20601    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20602    /// ````
20603    ///
20604    /// Sets the *delegate* property to the given value.
20605    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
20606        self._delegate = Some(new_value);
20607        self
20608    }
20609
20610    /// Set any additional parameter of the query string used in the request.
20611    /// It should be used to set parameters which are not yet available through their own
20612    /// setters.
20613    ///
20614    /// Please note that this method must not be used to set any of the known parameters
20615    /// which have their own setter method. If done anyway, the request will fail.
20616    ///
20617    /// # Additional Parameters
20618    ///
20619    /// * *$.xgafv* (query-string) - V1 error format.
20620    /// * *access_token* (query-string) - OAuth access token.
20621    /// * *alt* (query-string) - Data format for response.
20622    /// * *callback* (query-string) - JSONP
20623    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20624    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20625    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20626    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20627    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20628    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20629    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20630    pub fn param<T>(mut self, name: T, value: T) -> PropertyGoogleAdsLinkPatchCall<'a, S>
20631                                                        where T: AsRef<str> {
20632        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
20633        self
20634    }
20635
20636    /// Identifies the authorization scope for the method you are building.
20637    ///
20638    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20639    /// [`Scope::AnalyticEdit`].
20640    ///
20641    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20642    /// tokens for more than one scope.
20643    ///
20644    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20645    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20646    /// sufficient, a read-write scope will do as well.
20647    pub fn add_scope<St>(mut self, scope: St) -> PropertyGoogleAdsLinkPatchCall<'a, S>
20648                                                        where St: AsRef<str> {
20649        self._scopes.insert(String::from(scope.as_ref()));
20650        self
20651    }
20652    /// Identifies the authorization scope(s) for the method you are building.
20653    ///
20654    /// See [`Self::add_scope()`] for details.
20655    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGoogleAdsLinkPatchCall<'a, S>
20656                                                        where I: IntoIterator<Item = St>,
20657                                                         St: AsRef<str> {
20658        self._scopes
20659            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20660        self
20661    }
20662
20663    /// Removes all scopes, and no default scope will be used either.
20664    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20665    /// for details).
20666    pub fn clear_scopes(mut self) -> PropertyGoogleAdsLinkPatchCall<'a, S> {
20667        self._scopes.clear();
20668        self
20669    }
20670}
20671
20672
20673/// Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.
20674///
20675/// A builder for the *userLinks.audit* method supported by a *property* resource.
20676/// It is not used directly, but through a [`PropertyMethods`] instance.
20677///
20678/// # Example
20679///
20680/// Instantiate a resource method builder
20681///
20682/// ```test_harness,no_run
20683/// # extern crate hyper;
20684/// # extern crate hyper_rustls;
20685/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
20686/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaAuditUserLinksRequest;
20687/// # async fn dox() {
20688/// # use std::default::Default;
20689/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
20690/// 
20691/// # let secret: oauth2::ApplicationSecret = Default::default();
20692/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
20693/// #         secret,
20694/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20695/// #     ).build().await.unwrap();
20696/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
20697/// // As the method needs a request, you would usually fill it with the desired information
20698/// // into the respective structure. Some of the parts shown here might not be applicable !
20699/// // Values shown here are possibly random and not representative !
20700/// let mut req = GoogleAnalyticsAdminV1alphaAuditUserLinksRequest::default();
20701/// 
20702/// // You can configure optional parameters by calling the respective setters at will, and
20703/// // execute the final call using `doit()`.
20704/// // Values shown here are possibly random and not representative !
20705/// let result = hub.properties().user_links_audit(req, "parent")
20706///              .doit().await;
20707/// # }
20708/// ```
20709pub struct PropertyUserLinkAuditCall<'a, S>
20710    where S: 'a {
20711
20712    hub: &'a GoogleAnalyticsAdmin<S>,
20713    _request: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest,
20714    _parent: String,
20715    _delegate: Option<&'a mut dyn client::Delegate>,
20716    _additional_params: HashMap<String, String>,
20717    _scopes: BTreeSet<String>
20718}
20719
20720impl<'a, S> client::CallBuilder for PropertyUserLinkAuditCall<'a, S> {}
20721
20722impl<'a, S> PropertyUserLinkAuditCall<'a, S>
20723where
20724    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
20725    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
20726    S::Future: Send + Unpin + 'static,
20727    S::Error: Into<Box<dyn StdError + Send + Sync>>,
20728{
20729
20730
20731    /// Perform the operation you have build so far.
20732    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaAuditUserLinksResponse)> {
20733        use std::io::{Read, Seek};
20734        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
20735        use client::{ToParts, url::Params};
20736        use std::borrow::Cow;
20737
20738        let mut dd = client::DefaultDelegate;
20739        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
20740        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.audit",
20741                               http_method: hyper::Method::POST });
20742
20743        for &field in ["alt", "parent"].iter() {
20744            if self._additional_params.contains_key(field) {
20745                dlg.finished(false);
20746                return Err(client::Error::FieldClash(field));
20747            }
20748        }
20749
20750        let mut params = Params::with_capacity(4 + self._additional_params.len());
20751        params.push("parent", self._parent);
20752
20753        params.extend(self._additional_params.iter());
20754
20755        params.push("alt", "json");
20756        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:audit";
20757        if self._scopes.is_empty() {
20758            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
20759        }
20760
20761        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20762            url = params.uri_replacement(url, param_name, find_this, true);
20763        }
20764        {
20765            let to_remove = ["parent"];
20766            params.remove_params(&to_remove);
20767        }
20768
20769        let url = params.parse_with_url(&url);
20770
20771        let mut json_mime_type = mime::APPLICATION_JSON;
20772        let mut request_value_reader =
20773            {
20774                let mut value = json::value::to_value(&self._request).expect("serde to work");
20775                client::remove_json_null_values(&mut value);
20776                let mut dst = io::Cursor::new(Vec::with_capacity(128));
20777                json::to_writer(&mut dst, &value).unwrap();
20778                dst
20779            };
20780        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
20781        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
20782
20783
20784        loop {
20785            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
20786                Ok(token) => token,
20787                Err(e) => {
20788                    match dlg.token(e) {
20789                        Ok(token) => token,
20790                        Err(e) => {
20791                            dlg.finished(false);
20792                            return Err(client::Error::MissingToken(e));
20793                        }
20794                    }
20795                }
20796            };
20797            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
20798            let mut req_result = {
20799                let client = &self.hub.client;
20800                dlg.pre_request();
20801                let mut req_builder = hyper::Request::builder()
20802                    .method(hyper::Method::POST)
20803                    .uri(url.as_str())
20804                    .header(USER_AGENT, self.hub._user_agent.clone());
20805
20806                if let Some(token) = token.as_ref() {
20807                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20808                }
20809
20810
20811                        let request = req_builder
20812                        .header(CONTENT_TYPE, json_mime_type.to_string())
20813                        .header(CONTENT_LENGTH, request_size as u64)
20814                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
20815
20816                client.request(request.unwrap()).await
20817
20818            };
20819
20820            match req_result {
20821                Err(err) => {
20822                    if let client::Retry::After(d) = dlg.http_error(&err) {
20823                        sleep(d).await;
20824                        continue;
20825                    }
20826                    dlg.finished(false);
20827                    return Err(client::Error::HttpError(err))
20828                }
20829                Ok(mut res) => {
20830                    if !res.status().is_success() {
20831                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20832                        let (parts, _) = res.into_parts();
20833                        let body = hyper::Body::from(res_body_string.clone());
20834                        let restored_response = hyper::Response::from_parts(parts, body);
20835
20836                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
20837
20838                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
20839                            sleep(d).await;
20840                            continue;
20841                        }
20842
20843                        dlg.finished(false);
20844
20845                        return match server_response {
20846                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
20847                            None => Err(client::Error::Failure(restored_response)),
20848                        }
20849                    }
20850                    let result_value = {
20851                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
20852
20853                        match json::from_str(&res_body_string) {
20854                            Ok(decoded) => (res, decoded),
20855                            Err(err) => {
20856                                dlg.response_json_decode_error(&res_body_string, &err);
20857                                return Err(client::Error::JsonDecodeError(res_body_string, err));
20858                            }
20859                        }
20860                    };
20861
20862                    dlg.finished(true);
20863                    return Ok(result_value)
20864                }
20865            }
20866        }
20867    }
20868
20869
20870    ///
20871    /// Sets the *request* property to the given value.
20872    ///
20873    /// Even though the property as already been set when instantiating this call,
20874    /// we provide this method for API completeness.
20875    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaAuditUserLinksRequest) -> PropertyUserLinkAuditCall<'a, S> {
20876        self._request = new_value;
20877        self
20878    }
20879    /// Required. Example format: accounts/1234
20880    ///
20881    /// Sets the *parent* path property to the given value.
20882    ///
20883    /// Even though the property as already been set when instantiating this call,
20884    /// we provide this method for API completeness.
20885    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkAuditCall<'a, S> {
20886        self._parent = new_value.to_string();
20887        self
20888    }
20889    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20890    /// while executing the actual API request.
20891    /// 
20892    /// ````text
20893    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20894    /// ````
20895    ///
20896    /// Sets the *delegate* property to the given value.
20897    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkAuditCall<'a, S> {
20898        self._delegate = Some(new_value);
20899        self
20900    }
20901
20902    /// Set any additional parameter of the query string used in the request.
20903    /// It should be used to set parameters which are not yet available through their own
20904    /// setters.
20905    ///
20906    /// Please note that this method must not be used to set any of the known parameters
20907    /// which have their own setter method. If done anyway, the request will fail.
20908    ///
20909    /// # Additional Parameters
20910    ///
20911    /// * *$.xgafv* (query-string) - V1 error format.
20912    /// * *access_token* (query-string) - OAuth access token.
20913    /// * *alt* (query-string) - Data format for response.
20914    /// * *callback* (query-string) - JSONP
20915    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20916    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20917    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20918    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20919    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20920    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20921    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20922    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkAuditCall<'a, S>
20923                                                        where T: AsRef<str> {
20924        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
20925        self
20926    }
20927
20928    /// Identifies the authorization scope for the method you are building.
20929    ///
20930    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20931    /// [`Scope::AnalyticManageUser`].
20932    ///
20933    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20934    /// tokens for more than one scope.
20935    ///
20936    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20937    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20938    /// sufficient, a read-write scope will do as well.
20939    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkAuditCall<'a, S>
20940                                                        where St: AsRef<str> {
20941        self._scopes.insert(String::from(scope.as_ref()));
20942        self
20943    }
20944    /// Identifies the authorization scope(s) for the method you are building.
20945    ///
20946    /// See [`Self::add_scope()`] for details.
20947    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkAuditCall<'a, S>
20948                                                        where I: IntoIterator<Item = St>,
20949                                                         St: AsRef<str> {
20950        self._scopes
20951            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20952        self
20953    }
20954
20955    /// Removes all scopes, and no default scope will be used either.
20956    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20957    /// for details).
20958    pub fn clear_scopes(mut self) -> PropertyUserLinkAuditCall<'a, S> {
20959        self._scopes.clear();
20960        self
20961    }
20962}
20963
20964
20965/// Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.
20966///
20967/// A builder for the *userLinks.batchCreate* method supported by a *property* resource.
20968/// It is not used directly, but through a [`PropertyMethods`] instance.
20969///
20970/// # Example
20971///
20972/// Instantiate a resource method builder
20973///
20974/// ```test_harness,no_run
20975/// # extern crate hyper;
20976/// # extern crate hyper_rustls;
20977/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
20978/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest;
20979/// # async fn dox() {
20980/// # use std::default::Default;
20981/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
20982/// 
20983/// # let secret: oauth2::ApplicationSecret = Default::default();
20984/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
20985/// #         secret,
20986/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20987/// #     ).build().await.unwrap();
20988/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
20989/// // As the method needs a request, you would usually fill it with the desired information
20990/// // into the respective structure. Some of the parts shown here might not be applicable !
20991/// // Values shown here are possibly random and not representative !
20992/// let mut req = GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest::default();
20993/// 
20994/// // You can configure optional parameters by calling the respective setters at will, and
20995/// // execute the final call using `doit()`.
20996/// // Values shown here are possibly random and not representative !
20997/// let result = hub.properties().user_links_batch_create(req, "parent")
20998///              .doit().await;
20999/// # }
21000/// ```
21001pub struct PropertyUserLinkBatchCreateCall<'a, S>
21002    where S: 'a {
21003
21004    hub: &'a GoogleAnalyticsAdmin<S>,
21005    _request: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest,
21006    _parent: String,
21007    _delegate: Option<&'a mut dyn client::Delegate>,
21008    _additional_params: HashMap<String, String>,
21009    _scopes: BTreeSet<String>
21010}
21011
21012impl<'a, S> client::CallBuilder for PropertyUserLinkBatchCreateCall<'a, S> {}
21013
21014impl<'a, S> PropertyUserLinkBatchCreateCall<'a, S>
21015where
21016    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
21017    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
21018    S::Future: Send + Unpin + 'static,
21019    S::Error: Into<Box<dyn StdError + Send + Sync>>,
21020{
21021
21022
21023    /// Perform the operation you have build so far.
21024    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse)> {
21025        use std::io::{Read, Seek};
21026        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
21027        use client::{ToParts, url::Params};
21028        use std::borrow::Cow;
21029
21030        let mut dd = client::DefaultDelegate;
21031        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
21032        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.batchCreate",
21033                               http_method: hyper::Method::POST });
21034
21035        for &field in ["alt", "parent"].iter() {
21036            if self._additional_params.contains_key(field) {
21037                dlg.finished(false);
21038                return Err(client::Error::FieldClash(field));
21039            }
21040        }
21041
21042        let mut params = Params::with_capacity(4 + self._additional_params.len());
21043        params.push("parent", self._parent);
21044
21045        params.extend(self._additional_params.iter());
21046
21047        params.push("alt", "json");
21048        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchCreate";
21049        if self._scopes.is_empty() {
21050            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
21051        }
21052
21053        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21054            url = params.uri_replacement(url, param_name, find_this, true);
21055        }
21056        {
21057            let to_remove = ["parent"];
21058            params.remove_params(&to_remove);
21059        }
21060
21061        let url = params.parse_with_url(&url);
21062
21063        let mut json_mime_type = mime::APPLICATION_JSON;
21064        let mut request_value_reader =
21065            {
21066                let mut value = json::value::to_value(&self._request).expect("serde to work");
21067                client::remove_json_null_values(&mut value);
21068                let mut dst = io::Cursor::new(Vec::with_capacity(128));
21069                json::to_writer(&mut dst, &value).unwrap();
21070                dst
21071            };
21072        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
21073        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21074
21075
21076        loop {
21077            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
21078                Ok(token) => token,
21079                Err(e) => {
21080                    match dlg.token(e) {
21081                        Ok(token) => token,
21082                        Err(e) => {
21083                            dlg.finished(false);
21084                            return Err(client::Error::MissingToken(e));
21085                        }
21086                    }
21087                }
21088            };
21089            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21090            let mut req_result = {
21091                let client = &self.hub.client;
21092                dlg.pre_request();
21093                let mut req_builder = hyper::Request::builder()
21094                    .method(hyper::Method::POST)
21095                    .uri(url.as_str())
21096                    .header(USER_AGENT, self.hub._user_agent.clone());
21097
21098                if let Some(token) = token.as_ref() {
21099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21100                }
21101
21102
21103                        let request = req_builder
21104                        .header(CONTENT_TYPE, json_mime_type.to_string())
21105                        .header(CONTENT_LENGTH, request_size as u64)
21106                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
21107
21108                client.request(request.unwrap()).await
21109
21110            };
21111
21112            match req_result {
21113                Err(err) => {
21114                    if let client::Retry::After(d) = dlg.http_error(&err) {
21115                        sleep(d).await;
21116                        continue;
21117                    }
21118                    dlg.finished(false);
21119                    return Err(client::Error::HttpError(err))
21120                }
21121                Ok(mut res) => {
21122                    if !res.status().is_success() {
21123                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21124                        let (parts, _) = res.into_parts();
21125                        let body = hyper::Body::from(res_body_string.clone());
21126                        let restored_response = hyper::Response::from_parts(parts, body);
21127
21128                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
21129
21130                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
21131                            sleep(d).await;
21132                            continue;
21133                        }
21134
21135                        dlg.finished(false);
21136
21137                        return match server_response {
21138                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
21139                            None => Err(client::Error::Failure(restored_response)),
21140                        }
21141                    }
21142                    let result_value = {
21143                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21144
21145                        match json::from_str(&res_body_string) {
21146                            Ok(decoded) => (res, decoded),
21147                            Err(err) => {
21148                                dlg.response_json_decode_error(&res_body_string, &err);
21149                                return Err(client::Error::JsonDecodeError(res_body_string, err));
21150                            }
21151                        }
21152                    };
21153
21154                    dlg.finished(true);
21155                    return Ok(result_value)
21156                }
21157            }
21158        }
21159    }
21160
21161
21162    ///
21163    /// Sets the *request* property to the given value.
21164    ///
21165    /// Even though the property as already been set when instantiating this call,
21166    /// we provide this method for API completeness.
21167    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest) -> PropertyUserLinkBatchCreateCall<'a, S> {
21168        self._request = new_value;
21169        self
21170    }
21171    /// Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
21172    ///
21173    /// Sets the *parent* path property to the given value.
21174    ///
21175    /// Even though the property as already been set when instantiating this call,
21176    /// we provide this method for API completeness.
21177    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkBatchCreateCall<'a, S> {
21178        self._parent = new_value.to_string();
21179        self
21180    }
21181    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21182    /// while executing the actual API request.
21183    /// 
21184    /// ````text
21185    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21186    /// ````
21187    ///
21188    /// Sets the *delegate* property to the given value.
21189    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkBatchCreateCall<'a, S> {
21190        self._delegate = Some(new_value);
21191        self
21192    }
21193
21194    /// Set any additional parameter of the query string used in the request.
21195    /// It should be used to set parameters which are not yet available through their own
21196    /// setters.
21197    ///
21198    /// Please note that this method must not be used to set any of the known parameters
21199    /// which have their own setter method. If done anyway, the request will fail.
21200    ///
21201    /// # Additional Parameters
21202    ///
21203    /// * *$.xgafv* (query-string) - V1 error format.
21204    /// * *access_token* (query-string) - OAuth access token.
21205    /// * *alt* (query-string) - Data format for response.
21206    /// * *callback* (query-string) - JSONP
21207    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21208    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21209    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21210    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21211    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21212    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21213    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21214    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkBatchCreateCall<'a, S>
21215                                                        where T: AsRef<str> {
21216        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
21217        self
21218    }
21219
21220    /// Identifies the authorization scope for the method you are building.
21221    ///
21222    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21223    /// [`Scope::AnalyticManageUser`].
21224    ///
21225    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21226    /// tokens for more than one scope.
21227    ///
21228    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21229    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21230    /// sufficient, a read-write scope will do as well.
21231    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkBatchCreateCall<'a, S>
21232                                                        where St: AsRef<str> {
21233        self._scopes.insert(String::from(scope.as_ref()));
21234        self
21235    }
21236    /// Identifies the authorization scope(s) for the method you are building.
21237    ///
21238    /// See [`Self::add_scope()`] for details.
21239    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkBatchCreateCall<'a, S>
21240                                                        where I: IntoIterator<Item = St>,
21241                                                         St: AsRef<str> {
21242        self._scopes
21243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21244        self
21245    }
21246
21247    /// Removes all scopes, and no default scope will be used either.
21248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21249    /// for details).
21250    pub fn clear_scopes(mut self) -> PropertyUserLinkBatchCreateCall<'a, S> {
21251        self._scopes.clear();
21252        self
21253    }
21254}
21255
21256
21257/// Deletes information about multiple users' links to an account or property.
21258///
21259/// A builder for the *userLinks.batchDelete* method supported by a *property* resource.
21260/// It is not used directly, but through a [`PropertyMethods`] instance.
21261///
21262/// # Example
21263///
21264/// Instantiate a resource method builder
21265///
21266/// ```test_harness,no_run
21267/// # extern crate hyper;
21268/// # extern crate hyper_rustls;
21269/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
21270/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest;
21271/// # async fn dox() {
21272/// # use std::default::Default;
21273/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
21274/// 
21275/// # let secret: oauth2::ApplicationSecret = Default::default();
21276/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
21277/// #         secret,
21278/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21279/// #     ).build().await.unwrap();
21280/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
21281/// // As the method needs a request, you would usually fill it with the desired information
21282/// // into the respective structure. Some of the parts shown here might not be applicable !
21283/// // Values shown here are possibly random and not representative !
21284/// let mut req = GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest::default();
21285/// 
21286/// // You can configure optional parameters by calling the respective setters at will, and
21287/// // execute the final call using `doit()`.
21288/// // Values shown here are possibly random and not representative !
21289/// let result = hub.properties().user_links_batch_delete(req, "parent")
21290///              .doit().await;
21291/// # }
21292/// ```
21293pub struct PropertyUserLinkBatchDeleteCall<'a, S>
21294    where S: 'a {
21295
21296    hub: &'a GoogleAnalyticsAdmin<S>,
21297    _request: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest,
21298    _parent: String,
21299    _delegate: Option<&'a mut dyn client::Delegate>,
21300    _additional_params: HashMap<String, String>,
21301    _scopes: BTreeSet<String>
21302}
21303
21304impl<'a, S> client::CallBuilder for PropertyUserLinkBatchDeleteCall<'a, S> {}
21305
21306impl<'a, S> PropertyUserLinkBatchDeleteCall<'a, S>
21307where
21308    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
21309    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
21310    S::Future: Send + Unpin + 'static,
21311    S::Error: Into<Box<dyn StdError + Send + Sync>>,
21312{
21313
21314
21315    /// Perform the operation you have build so far.
21316    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
21317        use std::io::{Read, Seek};
21318        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
21319        use client::{ToParts, url::Params};
21320        use std::borrow::Cow;
21321
21322        let mut dd = client::DefaultDelegate;
21323        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
21324        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.batchDelete",
21325                               http_method: hyper::Method::POST });
21326
21327        for &field in ["alt", "parent"].iter() {
21328            if self._additional_params.contains_key(field) {
21329                dlg.finished(false);
21330                return Err(client::Error::FieldClash(field));
21331            }
21332        }
21333
21334        let mut params = Params::with_capacity(4 + self._additional_params.len());
21335        params.push("parent", self._parent);
21336
21337        params.extend(self._additional_params.iter());
21338
21339        params.push("alt", "json");
21340        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchDelete";
21341        if self._scopes.is_empty() {
21342            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
21343        }
21344
21345        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21346            url = params.uri_replacement(url, param_name, find_this, true);
21347        }
21348        {
21349            let to_remove = ["parent"];
21350            params.remove_params(&to_remove);
21351        }
21352
21353        let url = params.parse_with_url(&url);
21354
21355        let mut json_mime_type = mime::APPLICATION_JSON;
21356        let mut request_value_reader =
21357            {
21358                let mut value = json::value::to_value(&self._request).expect("serde to work");
21359                client::remove_json_null_values(&mut value);
21360                let mut dst = io::Cursor::new(Vec::with_capacity(128));
21361                json::to_writer(&mut dst, &value).unwrap();
21362                dst
21363            };
21364        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
21365        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21366
21367
21368        loop {
21369            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
21370                Ok(token) => token,
21371                Err(e) => {
21372                    match dlg.token(e) {
21373                        Ok(token) => token,
21374                        Err(e) => {
21375                            dlg.finished(false);
21376                            return Err(client::Error::MissingToken(e));
21377                        }
21378                    }
21379                }
21380            };
21381            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21382            let mut req_result = {
21383                let client = &self.hub.client;
21384                dlg.pre_request();
21385                let mut req_builder = hyper::Request::builder()
21386                    .method(hyper::Method::POST)
21387                    .uri(url.as_str())
21388                    .header(USER_AGENT, self.hub._user_agent.clone());
21389
21390                if let Some(token) = token.as_ref() {
21391                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21392                }
21393
21394
21395                        let request = req_builder
21396                        .header(CONTENT_TYPE, json_mime_type.to_string())
21397                        .header(CONTENT_LENGTH, request_size as u64)
21398                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
21399
21400                client.request(request.unwrap()).await
21401
21402            };
21403
21404            match req_result {
21405                Err(err) => {
21406                    if let client::Retry::After(d) = dlg.http_error(&err) {
21407                        sleep(d).await;
21408                        continue;
21409                    }
21410                    dlg.finished(false);
21411                    return Err(client::Error::HttpError(err))
21412                }
21413                Ok(mut res) => {
21414                    if !res.status().is_success() {
21415                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21416                        let (parts, _) = res.into_parts();
21417                        let body = hyper::Body::from(res_body_string.clone());
21418                        let restored_response = hyper::Response::from_parts(parts, body);
21419
21420                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
21421
21422                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
21423                            sleep(d).await;
21424                            continue;
21425                        }
21426
21427                        dlg.finished(false);
21428
21429                        return match server_response {
21430                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
21431                            None => Err(client::Error::Failure(restored_response)),
21432                        }
21433                    }
21434                    let result_value = {
21435                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21436
21437                        match json::from_str(&res_body_string) {
21438                            Ok(decoded) => (res, decoded),
21439                            Err(err) => {
21440                                dlg.response_json_decode_error(&res_body_string, &err);
21441                                return Err(client::Error::JsonDecodeError(res_body_string, err));
21442                            }
21443                        }
21444                    };
21445
21446                    dlg.finished(true);
21447                    return Ok(result_value)
21448                }
21449            }
21450        }
21451    }
21452
21453
21454    ///
21455    /// Sets the *request* property to the given value.
21456    ///
21457    /// Even though the property as already been set when instantiating this call,
21458    /// we provide this method for API completeness.
21459    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest) -> PropertyUserLinkBatchDeleteCall<'a, S> {
21460        self._request = new_value;
21461        self
21462    }
21463    /// Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234
21464    ///
21465    /// Sets the *parent* path property to the given value.
21466    ///
21467    /// Even though the property as already been set when instantiating this call,
21468    /// we provide this method for API completeness.
21469    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkBatchDeleteCall<'a, S> {
21470        self._parent = new_value.to_string();
21471        self
21472    }
21473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21474    /// while executing the actual API request.
21475    /// 
21476    /// ````text
21477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21478    /// ````
21479    ///
21480    /// Sets the *delegate* property to the given value.
21481    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkBatchDeleteCall<'a, S> {
21482        self._delegate = Some(new_value);
21483        self
21484    }
21485
21486    /// Set any additional parameter of the query string used in the request.
21487    /// It should be used to set parameters which are not yet available through their own
21488    /// setters.
21489    ///
21490    /// Please note that this method must not be used to set any of the known parameters
21491    /// which have their own setter method. If done anyway, the request will fail.
21492    ///
21493    /// # Additional Parameters
21494    ///
21495    /// * *$.xgafv* (query-string) - V1 error format.
21496    /// * *access_token* (query-string) - OAuth access token.
21497    /// * *alt* (query-string) - Data format for response.
21498    /// * *callback* (query-string) - JSONP
21499    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21500    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21501    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21502    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21503    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21504    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21505    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21506    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkBatchDeleteCall<'a, S>
21507                                                        where T: AsRef<str> {
21508        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
21509        self
21510    }
21511
21512    /// Identifies the authorization scope for the method you are building.
21513    ///
21514    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21515    /// [`Scope::AnalyticManageUser`].
21516    ///
21517    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21518    /// tokens for more than one scope.
21519    ///
21520    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21521    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21522    /// sufficient, a read-write scope will do as well.
21523    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkBatchDeleteCall<'a, S>
21524                                                        where St: AsRef<str> {
21525        self._scopes.insert(String::from(scope.as_ref()));
21526        self
21527    }
21528    /// Identifies the authorization scope(s) for the method you are building.
21529    ///
21530    /// See [`Self::add_scope()`] for details.
21531    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkBatchDeleteCall<'a, S>
21532                                                        where I: IntoIterator<Item = St>,
21533                                                         St: AsRef<str> {
21534        self._scopes
21535            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21536        self
21537    }
21538
21539    /// Removes all scopes, and no default scope will be used either.
21540    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21541    /// for details).
21542    pub fn clear_scopes(mut self) -> PropertyUserLinkBatchDeleteCall<'a, S> {
21543        self._scopes.clear();
21544        self
21545    }
21546}
21547
21548
21549/// Gets information about multiple users' links to an account or property.
21550///
21551/// A builder for the *userLinks.batchGet* method supported by a *property* resource.
21552/// It is not used directly, but through a [`PropertyMethods`] instance.
21553///
21554/// # Example
21555///
21556/// Instantiate a resource method builder
21557///
21558/// ```test_harness,no_run
21559/// # extern crate hyper;
21560/// # extern crate hyper_rustls;
21561/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
21562/// # async fn dox() {
21563/// # use std::default::Default;
21564/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
21565/// 
21566/// # let secret: oauth2::ApplicationSecret = Default::default();
21567/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
21568/// #         secret,
21569/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21570/// #     ).build().await.unwrap();
21571/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
21572/// // You can configure optional parameters by calling the respective setters at will, and
21573/// // execute the final call using `doit()`.
21574/// // Values shown here are possibly random and not representative !
21575/// let result = hub.properties().user_links_batch_get("parent")
21576///              .add_names("voluptua.")
21577///              .doit().await;
21578/// # }
21579/// ```
21580pub struct PropertyUserLinkBatchGetCall<'a, S>
21581    where S: 'a {
21582
21583    hub: &'a GoogleAnalyticsAdmin<S>,
21584    _parent: String,
21585    _names: Vec<String>,
21586    _delegate: Option<&'a mut dyn client::Delegate>,
21587    _additional_params: HashMap<String, String>,
21588    _scopes: BTreeSet<String>
21589}
21590
21591impl<'a, S> client::CallBuilder for PropertyUserLinkBatchGetCall<'a, S> {}
21592
21593impl<'a, S> PropertyUserLinkBatchGetCall<'a, S>
21594where
21595    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
21596    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
21597    S::Future: Send + Unpin + 'static,
21598    S::Error: Into<Box<dyn StdError + Send + Sync>>,
21599{
21600
21601
21602    /// Perform the operation you have build so far.
21603    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse)> {
21604        use std::io::{Read, Seek};
21605        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
21606        use client::{ToParts, url::Params};
21607        use std::borrow::Cow;
21608
21609        let mut dd = client::DefaultDelegate;
21610        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
21611        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.batchGet",
21612                               http_method: hyper::Method::GET });
21613
21614        for &field in ["alt", "parent", "names"].iter() {
21615            if self._additional_params.contains_key(field) {
21616                dlg.finished(false);
21617                return Err(client::Error::FieldClash(field));
21618            }
21619        }
21620
21621        let mut params = Params::with_capacity(4 + self._additional_params.len());
21622        params.push("parent", self._parent);
21623        if self._names.len() > 0 {
21624            for f in self._names.iter() {
21625                params.push("names", f);
21626            }
21627        }
21628
21629        params.extend(self._additional_params.iter());
21630
21631        params.push("alt", "json");
21632        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchGet";
21633        if self._scopes.is_empty() {
21634            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
21635        }
21636
21637        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21638            url = params.uri_replacement(url, param_name, find_this, true);
21639        }
21640        {
21641            let to_remove = ["parent"];
21642            params.remove_params(&to_remove);
21643        }
21644
21645        let url = params.parse_with_url(&url);
21646
21647
21648
21649        loop {
21650            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
21651                Ok(token) => token,
21652                Err(e) => {
21653                    match dlg.token(e) {
21654                        Ok(token) => token,
21655                        Err(e) => {
21656                            dlg.finished(false);
21657                            return Err(client::Error::MissingToken(e));
21658                        }
21659                    }
21660                }
21661            };
21662            let mut req_result = {
21663                let client = &self.hub.client;
21664                dlg.pre_request();
21665                let mut req_builder = hyper::Request::builder()
21666                    .method(hyper::Method::GET)
21667                    .uri(url.as_str())
21668                    .header(USER_AGENT, self.hub._user_agent.clone());
21669
21670                if let Some(token) = token.as_ref() {
21671                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21672                }
21673
21674
21675                        let request = req_builder
21676                        .body(hyper::body::Body::empty());
21677
21678                client.request(request.unwrap()).await
21679
21680            };
21681
21682            match req_result {
21683                Err(err) => {
21684                    if let client::Retry::After(d) = dlg.http_error(&err) {
21685                        sleep(d).await;
21686                        continue;
21687                    }
21688                    dlg.finished(false);
21689                    return Err(client::Error::HttpError(err))
21690                }
21691                Ok(mut res) => {
21692                    if !res.status().is_success() {
21693                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21694                        let (parts, _) = res.into_parts();
21695                        let body = hyper::Body::from(res_body_string.clone());
21696                        let restored_response = hyper::Response::from_parts(parts, body);
21697
21698                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
21699
21700                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
21701                            sleep(d).await;
21702                            continue;
21703                        }
21704
21705                        dlg.finished(false);
21706
21707                        return match server_response {
21708                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
21709                            None => Err(client::Error::Failure(restored_response)),
21710                        }
21711                    }
21712                    let result_value = {
21713                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21714
21715                        match json::from_str(&res_body_string) {
21716                            Ok(decoded) => (res, decoded),
21717                            Err(err) => {
21718                                dlg.response_json_decode_error(&res_body_string, &err);
21719                                return Err(client::Error::JsonDecodeError(res_body_string, err));
21720                            }
21721                        }
21722                    };
21723
21724                    dlg.finished(true);
21725                    return Ok(result_value)
21726                }
21727            }
21728        }
21729    }
21730
21731
21732    /// Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234
21733    ///
21734    /// Sets the *parent* path property to the given value.
21735    ///
21736    /// Even though the property as already been set when instantiating this call,
21737    /// we provide this method for API completeness.
21738    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkBatchGetCall<'a, S> {
21739        self._parent = new_value.to_string();
21740        self
21741    }
21742    /// Required. The names of the user links to retrieve. A maximum of 1000 user links can be retrieved in a batch. Format: accounts/{accountId}/userLinks/{userLinkId}
21743    ///
21744    /// Append the given value to the *names* query property.
21745    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
21746    pub fn add_names(mut self, new_value: &str) -> PropertyUserLinkBatchGetCall<'a, S> {
21747        self._names.push(new_value.to_string());
21748        self
21749    }
21750    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21751    /// while executing the actual API request.
21752    /// 
21753    /// ````text
21754    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21755    /// ````
21756    ///
21757    /// Sets the *delegate* property to the given value.
21758    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkBatchGetCall<'a, S> {
21759        self._delegate = Some(new_value);
21760        self
21761    }
21762
21763    /// Set any additional parameter of the query string used in the request.
21764    /// It should be used to set parameters which are not yet available through their own
21765    /// setters.
21766    ///
21767    /// Please note that this method must not be used to set any of the known parameters
21768    /// which have their own setter method. If done anyway, the request will fail.
21769    ///
21770    /// # Additional Parameters
21771    ///
21772    /// * *$.xgafv* (query-string) - V1 error format.
21773    /// * *access_token* (query-string) - OAuth access token.
21774    /// * *alt* (query-string) - Data format for response.
21775    /// * *callback* (query-string) - JSONP
21776    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21777    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21778    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21779    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21780    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21781    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21782    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21783    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkBatchGetCall<'a, S>
21784                                                        where T: AsRef<str> {
21785        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
21786        self
21787    }
21788
21789    /// Identifies the authorization scope for the method you are building.
21790    ///
21791    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21792    /// [`Scope::AnalyticManageUserReadonly`].
21793    ///
21794    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21795    /// tokens for more than one scope.
21796    ///
21797    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21798    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21799    /// sufficient, a read-write scope will do as well.
21800    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkBatchGetCall<'a, S>
21801                                                        where St: AsRef<str> {
21802        self._scopes.insert(String::from(scope.as_ref()));
21803        self
21804    }
21805    /// Identifies the authorization scope(s) for the method you are building.
21806    ///
21807    /// See [`Self::add_scope()`] for details.
21808    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkBatchGetCall<'a, S>
21809                                                        where I: IntoIterator<Item = St>,
21810                                                         St: AsRef<str> {
21811        self._scopes
21812            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21813        self
21814    }
21815
21816    /// Removes all scopes, and no default scope will be used either.
21817    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21818    /// for details).
21819    pub fn clear_scopes(mut self) -> PropertyUserLinkBatchGetCall<'a, S> {
21820        self._scopes.clear();
21821        self
21822    }
21823}
21824
21825
21826/// Updates information about multiple users' links to an account or property.
21827///
21828/// A builder for the *userLinks.batchUpdate* method supported by a *property* resource.
21829/// It is not used directly, but through a [`PropertyMethods`] instance.
21830///
21831/// # Example
21832///
21833/// Instantiate a resource method builder
21834///
21835/// ```test_harness,no_run
21836/// # extern crate hyper;
21837/// # extern crate hyper_rustls;
21838/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
21839/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest;
21840/// # async fn dox() {
21841/// # use std::default::Default;
21842/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
21843/// 
21844/// # let secret: oauth2::ApplicationSecret = Default::default();
21845/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
21846/// #         secret,
21847/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21848/// #     ).build().await.unwrap();
21849/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
21850/// // As the method needs a request, you would usually fill it with the desired information
21851/// // into the respective structure. Some of the parts shown here might not be applicable !
21852/// // Values shown here are possibly random and not representative !
21853/// let mut req = GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest::default();
21854/// 
21855/// // You can configure optional parameters by calling the respective setters at will, and
21856/// // execute the final call using `doit()`.
21857/// // Values shown here are possibly random and not representative !
21858/// let result = hub.properties().user_links_batch_update(req, "parent")
21859///              .doit().await;
21860/// # }
21861/// ```
21862pub struct PropertyUserLinkBatchUpdateCall<'a, S>
21863    where S: 'a {
21864
21865    hub: &'a GoogleAnalyticsAdmin<S>,
21866    _request: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest,
21867    _parent: String,
21868    _delegate: Option<&'a mut dyn client::Delegate>,
21869    _additional_params: HashMap<String, String>,
21870    _scopes: BTreeSet<String>
21871}
21872
21873impl<'a, S> client::CallBuilder for PropertyUserLinkBatchUpdateCall<'a, S> {}
21874
21875impl<'a, S> PropertyUserLinkBatchUpdateCall<'a, S>
21876where
21877    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
21878    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
21879    S::Future: Send + Unpin + 'static,
21880    S::Error: Into<Box<dyn StdError + Send + Sync>>,
21881{
21882
21883
21884    /// Perform the operation you have build so far.
21885    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse)> {
21886        use std::io::{Read, Seek};
21887        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
21888        use client::{ToParts, url::Params};
21889        use std::borrow::Cow;
21890
21891        let mut dd = client::DefaultDelegate;
21892        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
21893        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.batchUpdate",
21894                               http_method: hyper::Method::POST });
21895
21896        for &field in ["alt", "parent"].iter() {
21897            if self._additional_params.contains_key(field) {
21898                dlg.finished(false);
21899                return Err(client::Error::FieldClash(field));
21900            }
21901        }
21902
21903        let mut params = Params::with_capacity(4 + self._additional_params.len());
21904        params.push("parent", self._parent);
21905
21906        params.extend(self._additional_params.iter());
21907
21908        params.push("alt", "json");
21909        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks:batchUpdate";
21910        if self._scopes.is_empty() {
21911            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
21912        }
21913
21914        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21915            url = params.uri_replacement(url, param_name, find_this, true);
21916        }
21917        {
21918            let to_remove = ["parent"];
21919            params.remove_params(&to_remove);
21920        }
21921
21922        let url = params.parse_with_url(&url);
21923
21924        let mut json_mime_type = mime::APPLICATION_JSON;
21925        let mut request_value_reader =
21926            {
21927                let mut value = json::value::to_value(&self._request).expect("serde to work");
21928                client::remove_json_null_values(&mut value);
21929                let mut dst = io::Cursor::new(Vec::with_capacity(128));
21930                json::to_writer(&mut dst, &value).unwrap();
21931                dst
21932            };
21933        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
21934        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21935
21936
21937        loop {
21938            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
21939                Ok(token) => token,
21940                Err(e) => {
21941                    match dlg.token(e) {
21942                        Ok(token) => token,
21943                        Err(e) => {
21944                            dlg.finished(false);
21945                            return Err(client::Error::MissingToken(e));
21946                        }
21947                    }
21948                }
21949            };
21950            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
21951            let mut req_result = {
21952                let client = &self.hub.client;
21953                dlg.pre_request();
21954                let mut req_builder = hyper::Request::builder()
21955                    .method(hyper::Method::POST)
21956                    .uri(url.as_str())
21957                    .header(USER_AGENT, self.hub._user_agent.clone());
21958
21959                if let Some(token) = token.as_ref() {
21960                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21961                }
21962
21963
21964                        let request = req_builder
21965                        .header(CONTENT_TYPE, json_mime_type.to_string())
21966                        .header(CONTENT_LENGTH, request_size as u64)
21967                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
21968
21969                client.request(request.unwrap()).await
21970
21971            };
21972
21973            match req_result {
21974                Err(err) => {
21975                    if let client::Retry::After(d) = dlg.http_error(&err) {
21976                        sleep(d).await;
21977                        continue;
21978                    }
21979                    dlg.finished(false);
21980                    return Err(client::Error::HttpError(err))
21981                }
21982                Ok(mut res) => {
21983                    if !res.status().is_success() {
21984                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
21985                        let (parts, _) = res.into_parts();
21986                        let body = hyper::Body::from(res_body_string.clone());
21987                        let restored_response = hyper::Response::from_parts(parts, body);
21988
21989                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
21990
21991                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
21992                            sleep(d).await;
21993                            continue;
21994                        }
21995
21996                        dlg.finished(false);
21997
21998                        return match server_response {
21999                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
22000                            None => Err(client::Error::Failure(restored_response)),
22001                        }
22002                    }
22003                    let result_value = {
22004                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22005
22006                        match json::from_str(&res_body_string) {
22007                            Ok(decoded) => (res, decoded),
22008                            Err(err) => {
22009                                dlg.response_json_decode_error(&res_body_string, &err);
22010                                return Err(client::Error::JsonDecodeError(res_body_string, err));
22011                            }
22012                        }
22013                    };
22014
22015                    dlg.finished(true);
22016                    return Ok(result_value)
22017                }
22018            }
22019        }
22020    }
22021
22022
22023    ///
22024    /// Sets the *request* property to the given value.
22025    ///
22026    /// Even though the property as already been set when instantiating this call,
22027    /// we provide this method for API completeness.
22028    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest) -> PropertyUserLinkBatchUpdateCall<'a, S> {
22029        self._request = new_value;
22030        self
22031    }
22032    /// Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234
22033    ///
22034    /// Sets the *parent* path property to the given value.
22035    ///
22036    /// Even though the property as already been set when instantiating this call,
22037    /// we provide this method for API completeness.
22038    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkBatchUpdateCall<'a, S> {
22039        self._parent = new_value.to_string();
22040        self
22041    }
22042    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22043    /// while executing the actual API request.
22044    /// 
22045    /// ````text
22046    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22047    /// ````
22048    ///
22049    /// Sets the *delegate* property to the given value.
22050    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkBatchUpdateCall<'a, S> {
22051        self._delegate = Some(new_value);
22052        self
22053    }
22054
22055    /// Set any additional parameter of the query string used in the request.
22056    /// It should be used to set parameters which are not yet available through their own
22057    /// setters.
22058    ///
22059    /// Please note that this method must not be used to set any of the known parameters
22060    /// which have their own setter method. If done anyway, the request will fail.
22061    ///
22062    /// # Additional Parameters
22063    ///
22064    /// * *$.xgafv* (query-string) - V1 error format.
22065    /// * *access_token* (query-string) - OAuth access token.
22066    /// * *alt* (query-string) - Data format for response.
22067    /// * *callback* (query-string) - JSONP
22068    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22069    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22070    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22071    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22072    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22073    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22074    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22075    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkBatchUpdateCall<'a, S>
22076                                                        where T: AsRef<str> {
22077        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
22078        self
22079    }
22080
22081    /// Identifies the authorization scope for the method you are building.
22082    ///
22083    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22084    /// [`Scope::AnalyticManageUser`].
22085    ///
22086    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22087    /// tokens for more than one scope.
22088    ///
22089    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22090    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22091    /// sufficient, a read-write scope will do as well.
22092    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkBatchUpdateCall<'a, S>
22093                                                        where St: AsRef<str> {
22094        self._scopes.insert(String::from(scope.as_ref()));
22095        self
22096    }
22097    /// Identifies the authorization scope(s) for the method you are building.
22098    ///
22099    /// See [`Self::add_scope()`] for details.
22100    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkBatchUpdateCall<'a, S>
22101                                                        where I: IntoIterator<Item = St>,
22102                                                         St: AsRef<str> {
22103        self._scopes
22104            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22105        self
22106    }
22107
22108    /// Removes all scopes, and no default scope will be used either.
22109    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22110    /// for details).
22111    pub fn clear_scopes(mut self) -> PropertyUserLinkBatchUpdateCall<'a, S> {
22112        self._scopes.clear();
22113        self
22114    }
22115}
22116
22117
22118/// Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.
22119///
22120/// A builder for the *userLinks.create* method supported by a *property* resource.
22121/// It is not used directly, but through a [`PropertyMethods`] instance.
22122///
22123/// # Example
22124///
22125/// Instantiate a resource method builder
22126///
22127/// ```test_harness,no_run
22128/// # extern crate hyper;
22129/// # extern crate hyper_rustls;
22130/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
22131/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaUserLink;
22132/// # async fn dox() {
22133/// # use std::default::Default;
22134/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
22135/// 
22136/// # let secret: oauth2::ApplicationSecret = Default::default();
22137/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
22138/// #         secret,
22139/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22140/// #     ).build().await.unwrap();
22141/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
22142/// // As the method needs a request, you would usually fill it with the desired information
22143/// // into the respective structure. Some of the parts shown here might not be applicable !
22144/// // Values shown here are possibly random and not representative !
22145/// let mut req = GoogleAnalyticsAdminV1alphaUserLink::default();
22146/// 
22147/// // You can configure optional parameters by calling the respective setters at will, and
22148/// // execute the final call using `doit()`.
22149/// // Values shown here are possibly random and not representative !
22150/// let result = hub.properties().user_links_create(req, "parent")
22151///              .notify_new_user(false)
22152///              .doit().await;
22153/// # }
22154/// ```
22155pub struct PropertyUserLinkCreateCall<'a, S>
22156    where S: 'a {
22157
22158    hub: &'a GoogleAnalyticsAdmin<S>,
22159    _request: GoogleAnalyticsAdminV1alphaUserLink,
22160    _parent: String,
22161    _notify_new_user: Option<bool>,
22162    _delegate: Option<&'a mut dyn client::Delegate>,
22163    _additional_params: HashMap<String, String>,
22164    _scopes: BTreeSet<String>
22165}
22166
22167impl<'a, S> client::CallBuilder for PropertyUserLinkCreateCall<'a, S> {}
22168
22169impl<'a, S> PropertyUserLinkCreateCall<'a, S>
22170where
22171    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
22172    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
22173    S::Future: Send + Unpin + 'static,
22174    S::Error: Into<Box<dyn StdError + Send + Sync>>,
22175{
22176
22177
22178    /// Perform the operation you have build so far.
22179    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
22180        use std::io::{Read, Seek};
22181        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
22182        use client::{ToParts, url::Params};
22183        use std::borrow::Cow;
22184
22185        let mut dd = client::DefaultDelegate;
22186        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
22187        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.create",
22188                               http_method: hyper::Method::POST });
22189
22190        for &field in ["alt", "parent", "notifyNewUser"].iter() {
22191            if self._additional_params.contains_key(field) {
22192                dlg.finished(false);
22193                return Err(client::Error::FieldClash(field));
22194            }
22195        }
22196
22197        let mut params = Params::with_capacity(5 + self._additional_params.len());
22198        params.push("parent", self._parent);
22199        if let Some(value) = self._notify_new_user.as_ref() {
22200            params.push("notifyNewUser", value.to_string());
22201        }
22202
22203        params.extend(self._additional_params.iter());
22204
22205        params.push("alt", "json");
22206        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks";
22207        if self._scopes.is_empty() {
22208            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
22209        }
22210
22211        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22212            url = params.uri_replacement(url, param_name, find_this, true);
22213        }
22214        {
22215            let to_remove = ["parent"];
22216            params.remove_params(&to_remove);
22217        }
22218
22219        let url = params.parse_with_url(&url);
22220
22221        let mut json_mime_type = mime::APPLICATION_JSON;
22222        let mut request_value_reader =
22223            {
22224                let mut value = json::value::to_value(&self._request).expect("serde to work");
22225                client::remove_json_null_values(&mut value);
22226                let mut dst = io::Cursor::new(Vec::with_capacity(128));
22227                json::to_writer(&mut dst, &value).unwrap();
22228                dst
22229            };
22230        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
22231        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
22232
22233
22234        loop {
22235            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
22236                Ok(token) => token,
22237                Err(e) => {
22238                    match dlg.token(e) {
22239                        Ok(token) => token,
22240                        Err(e) => {
22241                            dlg.finished(false);
22242                            return Err(client::Error::MissingToken(e));
22243                        }
22244                    }
22245                }
22246            };
22247            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
22248            let mut req_result = {
22249                let client = &self.hub.client;
22250                dlg.pre_request();
22251                let mut req_builder = hyper::Request::builder()
22252                    .method(hyper::Method::POST)
22253                    .uri(url.as_str())
22254                    .header(USER_AGENT, self.hub._user_agent.clone());
22255
22256                if let Some(token) = token.as_ref() {
22257                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22258                }
22259
22260
22261                        let request = req_builder
22262                        .header(CONTENT_TYPE, json_mime_type.to_string())
22263                        .header(CONTENT_LENGTH, request_size as u64)
22264                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
22265
22266                client.request(request.unwrap()).await
22267
22268            };
22269
22270            match req_result {
22271                Err(err) => {
22272                    if let client::Retry::After(d) = dlg.http_error(&err) {
22273                        sleep(d).await;
22274                        continue;
22275                    }
22276                    dlg.finished(false);
22277                    return Err(client::Error::HttpError(err))
22278                }
22279                Ok(mut res) => {
22280                    if !res.status().is_success() {
22281                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22282                        let (parts, _) = res.into_parts();
22283                        let body = hyper::Body::from(res_body_string.clone());
22284                        let restored_response = hyper::Response::from_parts(parts, body);
22285
22286                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
22287
22288                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
22289                            sleep(d).await;
22290                            continue;
22291                        }
22292
22293                        dlg.finished(false);
22294
22295                        return match server_response {
22296                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
22297                            None => Err(client::Error::Failure(restored_response)),
22298                        }
22299                    }
22300                    let result_value = {
22301                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22302
22303                        match json::from_str(&res_body_string) {
22304                            Ok(decoded) => (res, decoded),
22305                            Err(err) => {
22306                                dlg.response_json_decode_error(&res_body_string, &err);
22307                                return Err(client::Error::JsonDecodeError(res_body_string, err));
22308                            }
22309                        }
22310                    };
22311
22312                    dlg.finished(true);
22313                    return Ok(result_value)
22314                }
22315            }
22316        }
22317    }
22318
22319
22320    ///
22321    /// Sets the *request* property to the given value.
22322    ///
22323    /// Even though the property as already been set when instantiating this call,
22324    /// we provide this method for API completeness.
22325    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaUserLink) -> PropertyUserLinkCreateCall<'a, S> {
22326        self._request = new_value;
22327        self
22328    }
22329    /// Required. Example format: accounts/1234
22330    ///
22331    /// Sets the *parent* path property to the given value.
22332    ///
22333    /// Even though the property as already been set when instantiating this call,
22334    /// we provide this method for API completeness.
22335    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkCreateCall<'a, S> {
22336        self._parent = new_value.to_string();
22337        self
22338    }
22339    /// Optional. If set, then email the new user notifying them that they've been granted permissions to the resource.
22340    ///
22341    /// Sets the *notify new user* query property to the given value.
22342    pub fn notify_new_user(mut self, new_value: bool) -> PropertyUserLinkCreateCall<'a, S> {
22343        self._notify_new_user = Some(new_value);
22344        self
22345    }
22346    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22347    /// while executing the actual API request.
22348    /// 
22349    /// ````text
22350    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22351    /// ````
22352    ///
22353    /// Sets the *delegate* property to the given value.
22354    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkCreateCall<'a, S> {
22355        self._delegate = Some(new_value);
22356        self
22357    }
22358
22359    /// Set any additional parameter of the query string used in the request.
22360    /// It should be used to set parameters which are not yet available through their own
22361    /// setters.
22362    ///
22363    /// Please note that this method must not be used to set any of the known parameters
22364    /// which have their own setter method. If done anyway, the request will fail.
22365    ///
22366    /// # Additional Parameters
22367    ///
22368    /// * *$.xgafv* (query-string) - V1 error format.
22369    /// * *access_token* (query-string) - OAuth access token.
22370    /// * *alt* (query-string) - Data format for response.
22371    /// * *callback* (query-string) - JSONP
22372    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22373    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22374    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22375    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22376    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22377    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22378    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22379    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkCreateCall<'a, S>
22380                                                        where T: AsRef<str> {
22381        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
22382        self
22383    }
22384
22385    /// Identifies the authorization scope for the method you are building.
22386    ///
22387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22388    /// [`Scope::AnalyticManageUser`].
22389    ///
22390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22391    /// tokens for more than one scope.
22392    ///
22393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22395    /// sufficient, a read-write scope will do as well.
22396    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkCreateCall<'a, S>
22397                                                        where St: AsRef<str> {
22398        self._scopes.insert(String::from(scope.as_ref()));
22399        self
22400    }
22401    /// Identifies the authorization scope(s) for the method you are building.
22402    ///
22403    /// See [`Self::add_scope()`] for details.
22404    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkCreateCall<'a, S>
22405                                                        where I: IntoIterator<Item = St>,
22406                                                         St: AsRef<str> {
22407        self._scopes
22408            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22409        self
22410    }
22411
22412    /// Removes all scopes, and no default scope will be used either.
22413    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22414    /// for details).
22415    pub fn clear_scopes(mut self) -> PropertyUserLinkCreateCall<'a, S> {
22416        self._scopes.clear();
22417        self
22418    }
22419}
22420
22421
22422/// Deletes a user link on an account or property.
22423///
22424/// A builder for the *userLinks.delete* method supported by a *property* resource.
22425/// It is not used directly, but through a [`PropertyMethods`] instance.
22426///
22427/// # Example
22428///
22429/// Instantiate a resource method builder
22430///
22431/// ```test_harness,no_run
22432/// # extern crate hyper;
22433/// # extern crate hyper_rustls;
22434/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
22435/// # async fn dox() {
22436/// # use std::default::Default;
22437/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
22438/// 
22439/// # let secret: oauth2::ApplicationSecret = Default::default();
22440/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
22441/// #         secret,
22442/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22443/// #     ).build().await.unwrap();
22444/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
22445/// // You can configure optional parameters by calling the respective setters at will, and
22446/// // execute the final call using `doit()`.
22447/// // Values shown here are possibly random and not representative !
22448/// let result = hub.properties().user_links_delete("name")
22449///              .doit().await;
22450/// # }
22451/// ```
22452pub struct PropertyUserLinkDeleteCall<'a, S>
22453    where S: 'a {
22454
22455    hub: &'a GoogleAnalyticsAdmin<S>,
22456    _name: String,
22457    _delegate: Option<&'a mut dyn client::Delegate>,
22458    _additional_params: HashMap<String, String>,
22459    _scopes: BTreeSet<String>
22460}
22461
22462impl<'a, S> client::CallBuilder for PropertyUserLinkDeleteCall<'a, S> {}
22463
22464impl<'a, S> PropertyUserLinkDeleteCall<'a, S>
22465where
22466    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
22467    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
22468    S::Future: Send + Unpin + 'static,
22469    S::Error: Into<Box<dyn StdError + Send + Sync>>,
22470{
22471
22472
22473    /// Perform the operation you have build so far.
22474    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleProtobufEmpty)> {
22475        use std::io::{Read, Seek};
22476        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
22477        use client::{ToParts, url::Params};
22478        use std::borrow::Cow;
22479
22480        let mut dd = client::DefaultDelegate;
22481        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
22482        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.delete",
22483                               http_method: hyper::Method::DELETE });
22484
22485        for &field in ["alt", "name"].iter() {
22486            if self._additional_params.contains_key(field) {
22487                dlg.finished(false);
22488                return Err(client::Error::FieldClash(field));
22489            }
22490        }
22491
22492        let mut params = Params::with_capacity(3 + self._additional_params.len());
22493        params.push("name", self._name);
22494
22495        params.extend(self._additional_params.iter());
22496
22497        params.push("alt", "json");
22498        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
22499        if self._scopes.is_empty() {
22500            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
22501        }
22502
22503        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22504            url = params.uri_replacement(url, param_name, find_this, true);
22505        }
22506        {
22507            let to_remove = ["name"];
22508            params.remove_params(&to_remove);
22509        }
22510
22511        let url = params.parse_with_url(&url);
22512
22513
22514
22515        loop {
22516            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
22517                Ok(token) => token,
22518                Err(e) => {
22519                    match dlg.token(e) {
22520                        Ok(token) => token,
22521                        Err(e) => {
22522                            dlg.finished(false);
22523                            return Err(client::Error::MissingToken(e));
22524                        }
22525                    }
22526                }
22527            };
22528            let mut req_result = {
22529                let client = &self.hub.client;
22530                dlg.pre_request();
22531                let mut req_builder = hyper::Request::builder()
22532                    .method(hyper::Method::DELETE)
22533                    .uri(url.as_str())
22534                    .header(USER_AGENT, self.hub._user_agent.clone());
22535
22536                if let Some(token) = token.as_ref() {
22537                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22538                }
22539
22540
22541                        let request = req_builder
22542                        .body(hyper::body::Body::empty());
22543
22544                client.request(request.unwrap()).await
22545
22546            };
22547
22548            match req_result {
22549                Err(err) => {
22550                    if let client::Retry::After(d) = dlg.http_error(&err) {
22551                        sleep(d).await;
22552                        continue;
22553                    }
22554                    dlg.finished(false);
22555                    return Err(client::Error::HttpError(err))
22556                }
22557                Ok(mut res) => {
22558                    if !res.status().is_success() {
22559                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22560                        let (parts, _) = res.into_parts();
22561                        let body = hyper::Body::from(res_body_string.clone());
22562                        let restored_response = hyper::Response::from_parts(parts, body);
22563
22564                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
22565
22566                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
22567                            sleep(d).await;
22568                            continue;
22569                        }
22570
22571                        dlg.finished(false);
22572
22573                        return match server_response {
22574                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
22575                            None => Err(client::Error::Failure(restored_response)),
22576                        }
22577                    }
22578                    let result_value = {
22579                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22580
22581                        match json::from_str(&res_body_string) {
22582                            Ok(decoded) => (res, decoded),
22583                            Err(err) => {
22584                                dlg.response_json_decode_error(&res_body_string, &err);
22585                                return Err(client::Error::JsonDecodeError(res_body_string, err));
22586                            }
22587                        }
22588                    };
22589
22590                    dlg.finished(true);
22591                    return Ok(result_value)
22592                }
22593            }
22594        }
22595    }
22596
22597
22598    /// Required. Example format: accounts/1234/userLinks/5678
22599    ///
22600    /// Sets the *name* path property to the given value.
22601    ///
22602    /// Even though the property as already been set when instantiating this call,
22603    /// we provide this method for API completeness.
22604    pub fn name(mut self, new_value: &str) -> PropertyUserLinkDeleteCall<'a, S> {
22605        self._name = new_value.to_string();
22606        self
22607    }
22608    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22609    /// while executing the actual API request.
22610    /// 
22611    /// ````text
22612    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22613    /// ````
22614    ///
22615    /// Sets the *delegate* property to the given value.
22616    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkDeleteCall<'a, S> {
22617        self._delegate = Some(new_value);
22618        self
22619    }
22620
22621    /// Set any additional parameter of the query string used in the request.
22622    /// It should be used to set parameters which are not yet available through their own
22623    /// setters.
22624    ///
22625    /// Please note that this method must not be used to set any of the known parameters
22626    /// which have their own setter method. If done anyway, the request will fail.
22627    ///
22628    /// # Additional Parameters
22629    ///
22630    /// * *$.xgafv* (query-string) - V1 error format.
22631    /// * *access_token* (query-string) - OAuth access token.
22632    /// * *alt* (query-string) - Data format for response.
22633    /// * *callback* (query-string) - JSONP
22634    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22635    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22636    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22637    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22638    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22639    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22640    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22641    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkDeleteCall<'a, S>
22642                                                        where T: AsRef<str> {
22643        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
22644        self
22645    }
22646
22647    /// Identifies the authorization scope for the method you are building.
22648    ///
22649    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22650    /// [`Scope::AnalyticManageUser`].
22651    ///
22652    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22653    /// tokens for more than one scope.
22654    ///
22655    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22656    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22657    /// sufficient, a read-write scope will do as well.
22658    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkDeleteCall<'a, S>
22659                                                        where St: AsRef<str> {
22660        self._scopes.insert(String::from(scope.as_ref()));
22661        self
22662    }
22663    /// Identifies the authorization scope(s) for the method you are building.
22664    ///
22665    /// See [`Self::add_scope()`] for details.
22666    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkDeleteCall<'a, S>
22667                                                        where I: IntoIterator<Item = St>,
22668                                                         St: AsRef<str> {
22669        self._scopes
22670            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22671        self
22672    }
22673
22674    /// Removes all scopes, and no default scope will be used either.
22675    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22676    /// for details).
22677    pub fn clear_scopes(mut self) -> PropertyUserLinkDeleteCall<'a, S> {
22678        self._scopes.clear();
22679        self
22680    }
22681}
22682
22683
22684/// Gets information about a user's link to an account or property.
22685///
22686/// A builder for the *userLinks.get* method supported by a *property* resource.
22687/// It is not used directly, but through a [`PropertyMethods`] instance.
22688///
22689/// # Example
22690///
22691/// Instantiate a resource method builder
22692///
22693/// ```test_harness,no_run
22694/// # extern crate hyper;
22695/// # extern crate hyper_rustls;
22696/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
22697/// # async fn dox() {
22698/// # use std::default::Default;
22699/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
22700/// 
22701/// # let secret: oauth2::ApplicationSecret = Default::default();
22702/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
22703/// #         secret,
22704/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22705/// #     ).build().await.unwrap();
22706/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
22707/// // You can configure optional parameters by calling the respective setters at will, and
22708/// // execute the final call using `doit()`.
22709/// // Values shown here are possibly random and not representative !
22710/// let result = hub.properties().user_links_get("name")
22711///              .doit().await;
22712/// # }
22713/// ```
22714pub struct PropertyUserLinkGetCall<'a, S>
22715    where S: 'a {
22716
22717    hub: &'a GoogleAnalyticsAdmin<S>,
22718    _name: String,
22719    _delegate: Option<&'a mut dyn client::Delegate>,
22720    _additional_params: HashMap<String, String>,
22721    _scopes: BTreeSet<String>
22722}
22723
22724impl<'a, S> client::CallBuilder for PropertyUserLinkGetCall<'a, S> {}
22725
22726impl<'a, S> PropertyUserLinkGetCall<'a, S>
22727where
22728    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
22729    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
22730    S::Future: Send + Unpin + 'static,
22731    S::Error: Into<Box<dyn StdError + Send + Sync>>,
22732{
22733
22734
22735    /// Perform the operation you have build so far.
22736    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
22737        use std::io::{Read, Seek};
22738        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
22739        use client::{ToParts, url::Params};
22740        use std::borrow::Cow;
22741
22742        let mut dd = client::DefaultDelegate;
22743        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
22744        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.get",
22745                               http_method: hyper::Method::GET });
22746
22747        for &field in ["alt", "name"].iter() {
22748            if self._additional_params.contains_key(field) {
22749                dlg.finished(false);
22750                return Err(client::Error::FieldClash(field));
22751            }
22752        }
22753
22754        let mut params = Params::with_capacity(3 + self._additional_params.len());
22755        params.push("name", self._name);
22756
22757        params.extend(self._additional_params.iter());
22758
22759        params.push("alt", "json");
22760        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
22761        if self._scopes.is_empty() {
22762            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
22763        }
22764
22765        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22766            url = params.uri_replacement(url, param_name, find_this, true);
22767        }
22768        {
22769            let to_remove = ["name"];
22770            params.remove_params(&to_remove);
22771        }
22772
22773        let url = params.parse_with_url(&url);
22774
22775
22776
22777        loop {
22778            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
22779                Ok(token) => token,
22780                Err(e) => {
22781                    match dlg.token(e) {
22782                        Ok(token) => token,
22783                        Err(e) => {
22784                            dlg.finished(false);
22785                            return Err(client::Error::MissingToken(e));
22786                        }
22787                    }
22788                }
22789            };
22790            let mut req_result = {
22791                let client = &self.hub.client;
22792                dlg.pre_request();
22793                let mut req_builder = hyper::Request::builder()
22794                    .method(hyper::Method::GET)
22795                    .uri(url.as_str())
22796                    .header(USER_AGENT, self.hub._user_agent.clone());
22797
22798                if let Some(token) = token.as_ref() {
22799                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22800                }
22801
22802
22803                        let request = req_builder
22804                        .body(hyper::body::Body::empty());
22805
22806                client.request(request.unwrap()).await
22807
22808            };
22809
22810            match req_result {
22811                Err(err) => {
22812                    if let client::Retry::After(d) = dlg.http_error(&err) {
22813                        sleep(d).await;
22814                        continue;
22815                    }
22816                    dlg.finished(false);
22817                    return Err(client::Error::HttpError(err))
22818                }
22819                Ok(mut res) => {
22820                    if !res.status().is_success() {
22821                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22822                        let (parts, _) = res.into_parts();
22823                        let body = hyper::Body::from(res_body_string.clone());
22824                        let restored_response = hyper::Response::from_parts(parts, body);
22825
22826                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
22827
22828                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
22829                            sleep(d).await;
22830                            continue;
22831                        }
22832
22833                        dlg.finished(false);
22834
22835                        return match server_response {
22836                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
22837                            None => Err(client::Error::Failure(restored_response)),
22838                        }
22839                    }
22840                    let result_value = {
22841                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
22842
22843                        match json::from_str(&res_body_string) {
22844                            Ok(decoded) => (res, decoded),
22845                            Err(err) => {
22846                                dlg.response_json_decode_error(&res_body_string, &err);
22847                                return Err(client::Error::JsonDecodeError(res_body_string, err));
22848                            }
22849                        }
22850                    };
22851
22852                    dlg.finished(true);
22853                    return Ok(result_value)
22854                }
22855            }
22856        }
22857    }
22858
22859
22860    /// Required. Example format: accounts/1234/userLinks/5678
22861    ///
22862    /// Sets the *name* path property to the given value.
22863    ///
22864    /// Even though the property as already been set when instantiating this call,
22865    /// we provide this method for API completeness.
22866    pub fn name(mut self, new_value: &str) -> PropertyUserLinkGetCall<'a, S> {
22867        self._name = new_value.to_string();
22868        self
22869    }
22870    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22871    /// while executing the actual API request.
22872    /// 
22873    /// ````text
22874    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22875    /// ````
22876    ///
22877    /// Sets the *delegate* property to the given value.
22878    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkGetCall<'a, S> {
22879        self._delegate = Some(new_value);
22880        self
22881    }
22882
22883    /// Set any additional parameter of the query string used in the request.
22884    /// It should be used to set parameters which are not yet available through their own
22885    /// setters.
22886    ///
22887    /// Please note that this method must not be used to set any of the known parameters
22888    /// which have their own setter method. If done anyway, the request will fail.
22889    ///
22890    /// # Additional Parameters
22891    ///
22892    /// * *$.xgafv* (query-string) - V1 error format.
22893    /// * *access_token* (query-string) - OAuth access token.
22894    /// * *alt* (query-string) - Data format for response.
22895    /// * *callback* (query-string) - JSONP
22896    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22897    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22898    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22899    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22900    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22901    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22902    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22903    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkGetCall<'a, S>
22904                                                        where T: AsRef<str> {
22905        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
22906        self
22907    }
22908
22909    /// Identifies the authorization scope for the method you are building.
22910    ///
22911    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22912    /// [`Scope::AnalyticManageUserReadonly`].
22913    ///
22914    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22915    /// tokens for more than one scope.
22916    ///
22917    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22918    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22919    /// sufficient, a read-write scope will do as well.
22920    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkGetCall<'a, S>
22921                                                        where St: AsRef<str> {
22922        self._scopes.insert(String::from(scope.as_ref()));
22923        self
22924    }
22925    /// Identifies the authorization scope(s) for the method you are building.
22926    ///
22927    /// See [`Self::add_scope()`] for details.
22928    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkGetCall<'a, S>
22929                                                        where I: IntoIterator<Item = St>,
22930                                                         St: AsRef<str> {
22931        self._scopes
22932            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22933        self
22934    }
22935
22936    /// Removes all scopes, and no default scope will be used either.
22937    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22938    /// for details).
22939    pub fn clear_scopes(mut self) -> PropertyUserLinkGetCall<'a, S> {
22940        self._scopes.clear();
22941        self
22942    }
22943}
22944
22945
22946/// Lists all user links on an account or property.
22947///
22948/// A builder for the *userLinks.list* method supported by a *property* resource.
22949/// It is not used directly, but through a [`PropertyMethods`] instance.
22950///
22951/// # Example
22952///
22953/// Instantiate a resource method builder
22954///
22955/// ```test_harness,no_run
22956/// # extern crate hyper;
22957/// # extern crate hyper_rustls;
22958/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
22959/// # async fn dox() {
22960/// # use std::default::Default;
22961/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
22962/// 
22963/// # let secret: oauth2::ApplicationSecret = Default::default();
22964/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
22965/// #         secret,
22966/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22967/// #     ).build().await.unwrap();
22968/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
22969/// // You can configure optional parameters by calling the respective setters at will, and
22970/// // execute the final call using `doit()`.
22971/// // Values shown here are possibly random and not representative !
22972/// let result = hub.properties().user_links_list("parent")
22973///              .page_token("est")
22974///              .page_size(-27)
22975///              .doit().await;
22976/// # }
22977/// ```
22978pub struct PropertyUserLinkListCall<'a, S>
22979    where S: 'a {
22980
22981    hub: &'a GoogleAnalyticsAdmin<S>,
22982    _parent: String,
22983    _page_token: Option<String>,
22984    _page_size: Option<i32>,
22985    _delegate: Option<&'a mut dyn client::Delegate>,
22986    _additional_params: HashMap<String, String>,
22987    _scopes: BTreeSet<String>
22988}
22989
22990impl<'a, S> client::CallBuilder for PropertyUserLinkListCall<'a, S> {}
22991
22992impl<'a, S> PropertyUserLinkListCall<'a, S>
22993where
22994    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
22995    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
22996    S::Future: Send + Unpin + 'static,
22997    S::Error: Into<Box<dyn StdError + Send + Sync>>,
22998{
22999
23000
23001    /// Perform the operation you have build so far.
23002    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListUserLinksResponse)> {
23003        use std::io::{Read, Seek};
23004        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
23005        use client::{ToParts, url::Params};
23006        use std::borrow::Cow;
23007
23008        let mut dd = client::DefaultDelegate;
23009        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
23010        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.list",
23011                               http_method: hyper::Method::GET });
23012
23013        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
23014            if self._additional_params.contains_key(field) {
23015                dlg.finished(false);
23016                return Err(client::Error::FieldClash(field));
23017            }
23018        }
23019
23020        let mut params = Params::with_capacity(5 + self._additional_params.len());
23021        params.push("parent", self._parent);
23022        if let Some(value) = self._page_token.as_ref() {
23023            params.push("pageToken", value);
23024        }
23025        if let Some(value) = self._page_size.as_ref() {
23026            params.push("pageSize", value.to_string());
23027        }
23028
23029        params.extend(self._additional_params.iter());
23030
23031        params.push("alt", "json");
23032        let mut url = self.hub._base_url.clone() + "v1alpha/{+parent}/userLinks";
23033        if self._scopes.is_empty() {
23034            self._scopes.insert(Scope::AnalyticManageUserReadonly.as_ref().to_string());
23035        }
23036
23037        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23038            url = params.uri_replacement(url, param_name, find_this, true);
23039        }
23040        {
23041            let to_remove = ["parent"];
23042            params.remove_params(&to_remove);
23043        }
23044
23045        let url = params.parse_with_url(&url);
23046
23047
23048
23049        loop {
23050            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
23051                Ok(token) => token,
23052                Err(e) => {
23053                    match dlg.token(e) {
23054                        Ok(token) => token,
23055                        Err(e) => {
23056                            dlg.finished(false);
23057                            return Err(client::Error::MissingToken(e));
23058                        }
23059                    }
23060                }
23061            };
23062            let mut req_result = {
23063                let client = &self.hub.client;
23064                dlg.pre_request();
23065                let mut req_builder = hyper::Request::builder()
23066                    .method(hyper::Method::GET)
23067                    .uri(url.as_str())
23068                    .header(USER_AGENT, self.hub._user_agent.clone());
23069
23070                if let Some(token) = token.as_ref() {
23071                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23072                }
23073
23074
23075                        let request = req_builder
23076                        .body(hyper::body::Body::empty());
23077
23078                client.request(request.unwrap()).await
23079
23080            };
23081
23082            match req_result {
23083                Err(err) => {
23084                    if let client::Retry::After(d) = dlg.http_error(&err) {
23085                        sleep(d).await;
23086                        continue;
23087                    }
23088                    dlg.finished(false);
23089                    return Err(client::Error::HttpError(err))
23090                }
23091                Ok(mut res) => {
23092                    if !res.status().is_success() {
23093                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23094                        let (parts, _) = res.into_parts();
23095                        let body = hyper::Body::from(res_body_string.clone());
23096                        let restored_response = hyper::Response::from_parts(parts, body);
23097
23098                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
23099
23100                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
23101                            sleep(d).await;
23102                            continue;
23103                        }
23104
23105                        dlg.finished(false);
23106
23107                        return match server_response {
23108                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
23109                            None => Err(client::Error::Failure(restored_response)),
23110                        }
23111                    }
23112                    let result_value = {
23113                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23114
23115                        match json::from_str(&res_body_string) {
23116                            Ok(decoded) => (res, decoded),
23117                            Err(err) => {
23118                                dlg.response_json_decode_error(&res_body_string, &err);
23119                                return Err(client::Error::JsonDecodeError(res_body_string, err));
23120                            }
23121                        }
23122                    };
23123
23124                    dlg.finished(true);
23125                    return Ok(result_value)
23126                }
23127            }
23128        }
23129    }
23130
23131
23132    /// Required. Example format: accounts/1234
23133    ///
23134    /// Sets the *parent* path property to the given value.
23135    ///
23136    /// Even though the property as already been set when instantiating this call,
23137    /// we provide this method for API completeness.
23138    pub fn parent(mut self, new_value: &str) -> PropertyUserLinkListCall<'a, S> {
23139        self._parent = new_value.to_string();
23140        self
23141    }
23142    /// A page token, received from a previous `ListUserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListUserLinks` must match the call that provided the page token.
23143    ///
23144    /// Sets the *page token* query property to the given value.
23145    pub fn page_token(mut self, new_value: &str) -> PropertyUserLinkListCall<'a, S> {
23146        self._page_token = Some(new_value.to_string());
23147        self
23148    }
23149    /// The maximum number of user links to return. The service may return fewer than this value. If unspecified, at most 200 user links will be returned. The maximum value is 500; values above 500 will be coerced to 500.
23150    ///
23151    /// Sets the *page size* query property to the given value.
23152    pub fn page_size(mut self, new_value: i32) -> PropertyUserLinkListCall<'a, S> {
23153        self._page_size = Some(new_value);
23154        self
23155    }
23156    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23157    /// while executing the actual API request.
23158    /// 
23159    /// ````text
23160    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23161    /// ````
23162    ///
23163    /// Sets the *delegate* property to the given value.
23164    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkListCall<'a, S> {
23165        self._delegate = Some(new_value);
23166        self
23167    }
23168
23169    /// Set any additional parameter of the query string used in the request.
23170    /// It should be used to set parameters which are not yet available through their own
23171    /// setters.
23172    ///
23173    /// Please note that this method must not be used to set any of the known parameters
23174    /// which have their own setter method. If done anyway, the request will fail.
23175    ///
23176    /// # Additional Parameters
23177    ///
23178    /// * *$.xgafv* (query-string) - V1 error format.
23179    /// * *access_token* (query-string) - OAuth access token.
23180    /// * *alt* (query-string) - Data format for response.
23181    /// * *callback* (query-string) - JSONP
23182    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23183    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23184    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23185    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23186    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23187    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23188    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23189    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkListCall<'a, S>
23190                                                        where T: AsRef<str> {
23191        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
23192        self
23193    }
23194
23195    /// Identifies the authorization scope for the method you are building.
23196    ///
23197    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23198    /// [`Scope::AnalyticManageUserReadonly`].
23199    ///
23200    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23201    /// tokens for more than one scope.
23202    ///
23203    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23204    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23205    /// sufficient, a read-write scope will do as well.
23206    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkListCall<'a, S>
23207                                                        where St: AsRef<str> {
23208        self._scopes.insert(String::from(scope.as_ref()));
23209        self
23210    }
23211    /// Identifies the authorization scope(s) for the method you are building.
23212    ///
23213    /// See [`Self::add_scope()`] for details.
23214    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkListCall<'a, S>
23215                                                        where I: IntoIterator<Item = St>,
23216                                                         St: AsRef<str> {
23217        self._scopes
23218            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23219        self
23220    }
23221
23222    /// Removes all scopes, and no default scope will be used either.
23223    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23224    /// for details).
23225    pub fn clear_scopes(mut self) -> PropertyUserLinkListCall<'a, S> {
23226        self._scopes.clear();
23227        self
23228    }
23229}
23230
23231
23232/// Updates a user link on an account or property.
23233///
23234/// A builder for the *userLinks.patch* method supported by a *property* resource.
23235/// It is not used directly, but through a [`PropertyMethods`] instance.
23236///
23237/// # Example
23238///
23239/// Instantiate a resource method builder
23240///
23241/// ```test_harness,no_run
23242/// # extern crate hyper;
23243/// # extern crate hyper_rustls;
23244/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
23245/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaUserLink;
23246/// # async fn dox() {
23247/// # use std::default::Default;
23248/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
23249/// 
23250/// # let secret: oauth2::ApplicationSecret = Default::default();
23251/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
23252/// #         secret,
23253/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23254/// #     ).build().await.unwrap();
23255/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
23256/// // As the method needs a request, you would usually fill it with the desired information
23257/// // into the respective structure. Some of the parts shown here might not be applicable !
23258/// // Values shown here are possibly random and not representative !
23259/// let mut req = GoogleAnalyticsAdminV1alphaUserLink::default();
23260/// 
23261/// // You can configure optional parameters by calling the respective setters at will, and
23262/// // execute the final call using `doit()`.
23263/// // Values shown here are possibly random and not representative !
23264/// let result = hub.properties().user_links_patch(req, "name")
23265///              .doit().await;
23266/// # }
23267/// ```
23268pub struct PropertyUserLinkPatchCall<'a, S>
23269    where S: 'a {
23270
23271    hub: &'a GoogleAnalyticsAdmin<S>,
23272    _request: GoogleAnalyticsAdminV1alphaUserLink,
23273    _name: String,
23274    _delegate: Option<&'a mut dyn client::Delegate>,
23275    _additional_params: HashMap<String, String>,
23276    _scopes: BTreeSet<String>
23277}
23278
23279impl<'a, S> client::CallBuilder for PropertyUserLinkPatchCall<'a, S> {}
23280
23281impl<'a, S> PropertyUserLinkPatchCall<'a, S>
23282where
23283    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
23284    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
23285    S::Future: Send + Unpin + 'static,
23286    S::Error: Into<Box<dyn StdError + Send + Sync>>,
23287{
23288
23289
23290    /// Perform the operation you have build so far.
23291    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaUserLink)> {
23292        use std::io::{Read, Seek};
23293        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
23294        use client::{ToParts, url::Params};
23295        use std::borrow::Cow;
23296
23297        let mut dd = client::DefaultDelegate;
23298        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
23299        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.userLinks.patch",
23300                               http_method: hyper::Method::PATCH });
23301
23302        for &field in ["alt", "name"].iter() {
23303            if self._additional_params.contains_key(field) {
23304                dlg.finished(false);
23305                return Err(client::Error::FieldClash(field));
23306            }
23307        }
23308
23309        let mut params = Params::with_capacity(4 + self._additional_params.len());
23310        params.push("name", self._name);
23311
23312        params.extend(self._additional_params.iter());
23313
23314        params.push("alt", "json");
23315        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
23316        if self._scopes.is_empty() {
23317            self._scopes.insert(Scope::AnalyticManageUser.as_ref().to_string());
23318        }
23319
23320        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23321            url = params.uri_replacement(url, param_name, find_this, true);
23322        }
23323        {
23324            let to_remove = ["name"];
23325            params.remove_params(&to_remove);
23326        }
23327
23328        let url = params.parse_with_url(&url);
23329
23330        let mut json_mime_type = mime::APPLICATION_JSON;
23331        let mut request_value_reader =
23332            {
23333                let mut value = json::value::to_value(&self._request).expect("serde to work");
23334                client::remove_json_null_values(&mut value);
23335                let mut dst = io::Cursor::new(Vec::with_capacity(128));
23336                json::to_writer(&mut dst, &value).unwrap();
23337                dst
23338            };
23339        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
23340        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23341
23342
23343        loop {
23344            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
23345                Ok(token) => token,
23346                Err(e) => {
23347                    match dlg.token(e) {
23348                        Ok(token) => token,
23349                        Err(e) => {
23350                            dlg.finished(false);
23351                            return Err(client::Error::MissingToken(e));
23352                        }
23353                    }
23354                }
23355            };
23356            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23357            let mut req_result = {
23358                let client = &self.hub.client;
23359                dlg.pre_request();
23360                let mut req_builder = hyper::Request::builder()
23361                    .method(hyper::Method::PATCH)
23362                    .uri(url.as_str())
23363                    .header(USER_AGENT, self.hub._user_agent.clone());
23364
23365                if let Some(token) = token.as_ref() {
23366                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23367                }
23368
23369
23370                        let request = req_builder
23371                        .header(CONTENT_TYPE, json_mime_type.to_string())
23372                        .header(CONTENT_LENGTH, request_size as u64)
23373                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
23374
23375                client.request(request.unwrap()).await
23376
23377            };
23378
23379            match req_result {
23380                Err(err) => {
23381                    if let client::Retry::After(d) = dlg.http_error(&err) {
23382                        sleep(d).await;
23383                        continue;
23384                    }
23385                    dlg.finished(false);
23386                    return Err(client::Error::HttpError(err))
23387                }
23388                Ok(mut res) => {
23389                    if !res.status().is_success() {
23390                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23391                        let (parts, _) = res.into_parts();
23392                        let body = hyper::Body::from(res_body_string.clone());
23393                        let restored_response = hyper::Response::from_parts(parts, body);
23394
23395                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
23396
23397                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
23398                            sleep(d).await;
23399                            continue;
23400                        }
23401
23402                        dlg.finished(false);
23403
23404                        return match server_response {
23405                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
23406                            None => Err(client::Error::Failure(restored_response)),
23407                        }
23408                    }
23409                    let result_value = {
23410                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23411
23412                        match json::from_str(&res_body_string) {
23413                            Ok(decoded) => (res, decoded),
23414                            Err(err) => {
23415                                dlg.response_json_decode_error(&res_body_string, &err);
23416                                return Err(client::Error::JsonDecodeError(res_body_string, err));
23417                            }
23418                        }
23419                    };
23420
23421                    dlg.finished(true);
23422                    return Ok(result_value)
23423                }
23424            }
23425        }
23426    }
23427
23428
23429    ///
23430    /// Sets the *request* property to the given value.
23431    ///
23432    /// Even though the property as already been set when instantiating this call,
23433    /// we provide this method for API completeness.
23434    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaUserLink) -> PropertyUserLinkPatchCall<'a, S> {
23435        self._request = new_value;
23436        self
23437    }
23438    /// Output only. Example format: properties/1234/userLinks/5678
23439    ///
23440    /// Sets the *name* path property to the given value.
23441    ///
23442    /// Even though the property as already been set when instantiating this call,
23443    /// we provide this method for API completeness.
23444    pub fn name(mut self, new_value: &str) -> PropertyUserLinkPatchCall<'a, S> {
23445        self._name = new_value.to_string();
23446        self
23447    }
23448    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23449    /// while executing the actual API request.
23450    /// 
23451    /// ````text
23452    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23453    /// ````
23454    ///
23455    /// Sets the *delegate* property to the given value.
23456    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUserLinkPatchCall<'a, S> {
23457        self._delegate = Some(new_value);
23458        self
23459    }
23460
23461    /// Set any additional parameter of the query string used in the request.
23462    /// It should be used to set parameters which are not yet available through their own
23463    /// setters.
23464    ///
23465    /// Please note that this method must not be used to set any of the known parameters
23466    /// which have their own setter method. If done anyway, the request will fail.
23467    ///
23468    /// # Additional Parameters
23469    ///
23470    /// * *$.xgafv* (query-string) - V1 error format.
23471    /// * *access_token* (query-string) - OAuth access token.
23472    /// * *alt* (query-string) - Data format for response.
23473    /// * *callback* (query-string) - JSONP
23474    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23475    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23476    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23477    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23478    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23479    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23480    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23481    pub fn param<T>(mut self, name: T, value: T) -> PropertyUserLinkPatchCall<'a, S>
23482                                                        where T: AsRef<str> {
23483        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
23484        self
23485    }
23486
23487    /// Identifies the authorization scope for the method you are building.
23488    ///
23489    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23490    /// [`Scope::AnalyticManageUser`].
23491    ///
23492    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23493    /// tokens for more than one scope.
23494    ///
23495    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23496    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23497    /// sufficient, a read-write scope will do as well.
23498    pub fn add_scope<St>(mut self, scope: St) -> PropertyUserLinkPatchCall<'a, S>
23499                                                        where St: AsRef<str> {
23500        self._scopes.insert(String::from(scope.as_ref()));
23501        self
23502    }
23503    /// Identifies the authorization scope(s) for the method you are building.
23504    ///
23505    /// See [`Self::add_scope()`] for details.
23506    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUserLinkPatchCall<'a, S>
23507                                                        where I: IntoIterator<Item = St>,
23508                                                         St: AsRef<str> {
23509        self._scopes
23510            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23511        self
23512    }
23513
23514    /// Removes all scopes, and no default scope will be used either.
23515    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23516    /// for details).
23517    pub fn clear_scopes(mut self) -> PropertyUserLinkPatchCall<'a, S> {
23518        self._scopes.clear();
23519        self
23520    }
23521}
23522
23523
23524/// Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or via this API) before MeasurementProtocolSecret resources may be created.
23525///
23526/// A builder for the *acknowledgeUserDataCollection* method supported by a *property* resource.
23527/// It is not used directly, but through a [`PropertyMethods`] instance.
23528///
23529/// # Example
23530///
23531/// Instantiate a resource method builder
23532///
23533/// ```test_harness,no_run
23534/// # extern crate hyper;
23535/// # extern crate hyper_rustls;
23536/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
23537/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest;
23538/// # async fn dox() {
23539/// # use std::default::Default;
23540/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
23541/// 
23542/// # let secret: oauth2::ApplicationSecret = Default::default();
23543/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
23544/// #         secret,
23545/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23546/// #     ).build().await.unwrap();
23547/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
23548/// // As the method needs a request, you would usually fill it with the desired information
23549/// // into the respective structure. Some of the parts shown here might not be applicable !
23550/// // Values shown here are possibly random and not representative !
23551/// let mut req = GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest::default();
23552/// 
23553/// // You can configure optional parameters by calling the respective setters at will, and
23554/// // execute the final call using `doit()`.
23555/// // Values shown here are possibly random and not representative !
23556/// let result = hub.properties().acknowledge_user_data_collection(req, "property")
23557///              .doit().await;
23558/// # }
23559/// ```
23560pub struct PropertyAcknowledgeUserDataCollectionCall<'a, S>
23561    where S: 'a {
23562
23563    hub: &'a GoogleAnalyticsAdmin<S>,
23564    _request: GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest,
23565    _property: String,
23566    _delegate: Option<&'a mut dyn client::Delegate>,
23567    _additional_params: HashMap<String, String>,
23568    _scopes: BTreeSet<String>
23569}
23570
23571impl<'a, S> client::CallBuilder for PropertyAcknowledgeUserDataCollectionCall<'a, S> {}
23572
23573impl<'a, S> PropertyAcknowledgeUserDataCollectionCall<'a, S>
23574where
23575    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
23576    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
23577    S::Future: Send + Unpin + 'static,
23578    S::Error: Into<Box<dyn StdError + Send + Sync>>,
23579{
23580
23581
23582    /// Perform the operation you have build so far.
23583    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse)> {
23584        use std::io::{Read, Seek};
23585        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
23586        use client::{ToParts, url::Params};
23587        use std::borrow::Cow;
23588
23589        let mut dd = client::DefaultDelegate;
23590        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
23591        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.acknowledgeUserDataCollection",
23592                               http_method: hyper::Method::POST });
23593
23594        for &field in ["alt", "property"].iter() {
23595            if self._additional_params.contains_key(field) {
23596                dlg.finished(false);
23597                return Err(client::Error::FieldClash(field));
23598            }
23599        }
23600
23601        let mut params = Params::with_capacity(4 + self._additional_params.len());
23602        params.push("property", self._property);
23603
23604        params.extend(self._additional_params.iter());
23605
23606        params.push("alt", "json");
23607        let mut url = self.hub._base_url.clone() + "v1alpha/{+property}:acknowledgeUserDataCollection";
23608        if self._scopes.is_empty() {
23609            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
23610        }
23611
23612        for &(find_this, param_name) in [("{+property}", "property")].iter() {
23613            url = params.uri_replacement(url, param_name, find_this, true);
23614        }
23615        {
23616            let to_remove = ["property"];
23617            params.remove_params(&to_remove);
23618        }
23619
23620        let url = params.parse_with_url(&url);
23621
23622        let mut json_mime_type = mime::APPLICATION_JSON;
23623        let mut request_value_reader =
23624            {
23625                let mut value = json::value::to_value(&self._request).expect("serde to work");
23626                client::remove_json_null_values(&mut value);
23627                let mut dst = io::Cursor::new(Vec::with_capacity(128));
23628                json::to_writer(&mut dst, &value).unwrap();
23629                dst
23630            };
23631        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
23632        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23633
23634
23635        loop {
23636            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
23637                Ok(token) => token,
23638                Err(e) => {
23639                    match dlg.token(e) {
23640                        Ok(token) => token,
23641                        Err(e) => {
23642                            dlg.finished(false);
23643                            return Err(client::Error::MissingToken(e));
23644                        }
23645                    }
23646                }
23647            };
23648            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23649            let mut req_result = {
23650                let client = &self.hub.client;
23651                dlg.pre_request();
23652                let mut req_builder = hyper::Request::builder()
23653                    .method(hyper::Method::POST)
23654                    .uri(url.as_str())
23655                    .header(USER_AGENT, self.hub._user_agent.clone());
23656
23657                if let Some(token) = token.as_ref() {
23658                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23659                }
23660
23661
23662                        let request = req_builder
23663                        .header(CONTENT_TYPE, json_mime_type.to_string())
23664                        .header(CONTENT_LENGTH, request_size as u64)
23665                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
23666
23667                client.request(request.unwrap()).await
23668
23669            };
23670
23671            match req_result {
23672                Err(err) => {
23673                    if let client::Retry::After(d) = dlg.http_error(&err) {
23674                        sleep(d).await;
23675                        continue;
23676                    }
23677                    dlg.finished(false);
23678                    return Err(client::Error::HttpError(err))
23679                }
23680                Ok(mut res) => {
23681                    if !res.status().is_success() {
23682                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23683                        let (parts, _) = res.into_parts();
23684                        let body = hyper::Body::from(res_body_string.clone());
23685                        let restored_response = hyper::Response::from_parts(parts, body);
23686
23687                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
23688
23689                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
23690                            sleep(d).await;
23691                            continue;
23692                        }
23693
23694                        dlg.finished(false);
23695
23696                        return match server_response {
23697                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
23698                            None => Err(client::Error::Failure(restored_response)),
23699                        }
23700                    }
23701                    let result_value = {
23702                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23703
23704                        match json::from_str(&res_body_string) {
23705                            Ok(decoded) => (res, decoded),
23706                            Err(err) => {
23707                                dlg.response_json_decode_error(&res_body_string, &err);
23708                                return Err(client::Error::JsonDecodeError(res_body_string, err));
23709                            }
23710                        }
23711                    };
23712
23713                    dlg.finished(true);
23714                    return Ok(result_value)
23715                }
23716            }
23717        }
23718    }
23719
23720
23721    ///
23722    /// Sets the *request* property to the given value.
23723    ///
23724    /// Even though the property as already been set when instantiating this call,
23725    /// we provide this method for API completeness.
23726    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest) -> PropertyAcknowledgeUserDataCollectionCall<'a, S> {
23727        self._request = new_value;
23728        self
23729    }
23730    /// Required. The property for which to acknowledge user data collection.
23731    ///
23732    /// Sets the *property* path property to the given value.
23733    ///
23734    /// Even though the property as already been set when instantiating this call,
23735    /// we provide this method for API completeness.
23736    pub fn property(mut self, new_value: &str) -> PropertyAcknowledgeUserDataCollectionCall<'a, S> {
23737        self._property = new_value.to_string();
23738        self
23739    }
23740    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23741    /// while executing the actual API request.
23742    /// 
23743    /// ````text
23744    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23745    /// ````
23746    ///
23747    /// Sets the *delegate* property to the given value.
23748    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyAcknowledgeUserDataCollectionCall<'a, S> {
23749        self._delegate = Some(new_value);
23750        self
23751    }
23752
23753    /// Set any additional parameter of the query string used in the request.
23754    /// It should be used to set parameters which are not yet available through their own
23755    /// setters.
23756    ///
23757    /// Please note that this method must not be used to set any of the known parameters
23758    /// which have their own setter method. If done anyway, the request will fail.
23759    ///
23760    /// # Additional Parameters
23761    ///
23762    /// * *$.xgafv* (query-string) - V1 error format.
23763    /// * *access_token* (query-string) - OAuth access token.
23764    /// * *alt* (query-string) - Data format for response.
23765    /// * *callback* (query-string) - JSONP
23766    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23767    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23768    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23769    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23770    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23771    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23772    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23773    pub fn param<T>(mut self, name: T, value: T) -> PropertyAcknowledgeUserDataCollectionCall<'a, S>
23774                                                        where T: AsRef<str> {
23775        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
23776        self
23777    }
23778
23779    /// Identifies the authorization scope for the method you are building.
23780    ///
23781    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23782    /// [`Scope::AnalyticEdit`].
23783    ///
23784    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23785    /// tokens for more than one scope.
23786    ///
23787    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23788    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23789    /// sufficient, a read-write scope will do as well.
23790    pub fn add_scope<St>(mut self, scope: St) -> PropertyAcknowledgeUserDataCollectionCall<'a, S>
23791                                                        where St: AsRef<str> {
23792        self._scopes.insert(String::from(scope.as_ref()));
23793        self
23794    }
23795    /// Identifies the authorization scope(s) for the method you are building.
23796    ///
23797    /// See [`Self::add_scope()`] for details.
23798    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyAcknowledgeUserDataCollectionCall<'a, S>
23799                                                        where I: IntoIterator<Item = St>,
23800                                                         St: AsRef<str> {
23801        self._scopes
23802            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23803        self
23804    }
23805
23806    /// Removes all scopes, and no default scope will be used either.
23807    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23808    /// for details).
23809    pub fn clear_scopes(mut self) -> PropertyAcknowledgeUserDataCollectionCall<'a, S> {
23810        self._scopes.clear();
23811        self
23812    }
23813}
23814
23815
23816/// Creates an "GA4" property with the specified location and attributes.
23817///
23818/// A builder for the *create* method supported by a *property* resource.
23819/// It is not used directly, but through a [`PropertyMethods`] instance.
23820///
23821/// # Example
23822///
23823/// Instantiate a resource method builder
23824///
23825/// ```test_harness,no_run
23826/// # extern crate hyper;
23827/// # extern crate hyper_rustls;
23828/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
23829/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaProperty;
23830/// # async fn dox() {
23831/// # use std::default::Default;
23832/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
23833/// 
23834/// # let secret: oauth2::ApplicationSecret = Default::default();
23835/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
23836/// #         secret,
23837/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23838/// #     ).build().await.unwrap();
23839/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
23840/// // As the method needs a request, you would usually fill it with the desired information
23841/// // into the respective structure. Some of the parts shown here might not be applicable !
23842/// // Values shown here are possibly random and not representative !
23843/// let mut req = GoogleAnalyticsAdminV1alphaProperty::default();
23844/// 
23845/// // You can configure optional parameters by calling the respective setters at will, and
23846/// // execute the final call using `doit()`.
23847/// // Values shown here are possibly random and not representative !
23848/// let result = hub.properties().create(req)
23849///              .doit().await;
23850/// # }
23851/// ```
23852pub struct PropertyCreateCall<'a, S>
23853    where S: 'a {
23854
23855    hub: &'a GoogleAnalyticsAdmin<S>,
23856    _request: GoogleAnalyticsAdminV1alphaProperty,
23857    _delegate: Option<&'a mut dyn client::Delegate>,
23858    _additional_params: HashMap<String, String>,
23859    _scopes: BTreeSet<String>
23860}
23861
23862impl<'a, S> client::CallBuilder for PropertyCreateCall<'a, S> {}
23863
23864impl<'a, S> PropertyCreateCall<'a, S>
23865where
23866    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
23867    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
23868    S::Future: Send + Unpin + 'static,
23869    S::Error: Into<Box<dyn StdError + Send + Sync>>,
23870{
23871
23872
23873    /// Perform the operation you have build so far.
23874    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaProperty)> {
23875        use std::io::{Read, Seek};
23876        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
23877        use client::{ToParts, url::Params};
23878        use std::borrow::Cow;
23879
23880        let mut dd = client::DefaultDelegate;
23881        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
23882        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.create",
23883                               http_method: hyper::Method::POST });
23884
23885        for &field in ["alt"].iter() {
23886            if self._additional_params.contains_key(field) {
23887                dlg.finished(false);
23888                return Err(client::Error::FieldClash(field));
23889            }
23890        }
23891
23892        let mut params = Params::with_capacity(3 + self._additional_params.len());
23893
23894        params.extend(self._additional_params.iter());
23895
23896        params.push("alt", "json");
23897        let mut url = self.hub._base_url.clone() + "v1alpha/properties";
23898        if self._scopes.is_empty() {
23899            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
23900        }
23901
23902
23903        let url = params.parse_with_url(&url);
23904
23905        let mut json_mime_type = mime::APPLICATION_JSON;
23906        let mut request_value_reader =
23907            {
23908                let mut value = json::value::to_value(&self._request).expect("serde to work");
23909                client::remove_json_null_values(&mut value);
23910                let mut dst = io::Cursor::new(Vec::with_capacity(128));
23911                json::to_writer(&mut dst, &value).unwrap();
23912                dst
23913            };
23914        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
23915        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23916
23917
23918        loop {
23919            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
23920                Ok(token) => token,
23921                Err(e) => {
23922                    match dlg.token(e) {
23923                        Ok(token) => token,
23924                        Err(e) => {
23925                            dlg.finished(false);
23926                            return Err(client::Error::MissingToken(e));
23927                        }
23928                    }
23929                }
23930            };
23931            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
23932            let mut req_result = {
23933                let client = &self.hub.client;
23934                dlg.pre_request();
23935                let mut req_builder = hyper::Request::builder()
23936                    .method(hyper::Method::POST)
23937                    .uri(url.as_str())
23938                    .header(USER_AGENT, self.hub._user_agent.clone());
23939
23940                if let Some(token) = token.as_ref() {
23941                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23942                }
23943
23944
23945                        let request = req_builder
23946                        .header(CONTENT_TYPE, json_mime_type.to_string())
23947                        .header(CONTENT_LENGTH, request_size as u64)
23948                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
23949
23950                client.request(request.unwrap()).await
23951
23952            };
23953
23954            match req_result {
23955                Err(err) => {
23956                    if let client::Retry::After(d) = dlg.http_error(&err) {
23957                        sleep(d).await;
23958                        continue;
23959                    }
23960                    dlg.finished(false);
23961                    return Err(client::Error::HttpError(err))
23962                }
23963                Ok(mut res) => {
23964                    if !res.status().is_success() {
23965                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23966                        let (parts, _) = res.into_parts();
23967                        let body = hyper::Body::from(res_body_string.clone());
23968                        let restored_response = hyper::Response::from_parts(parts, body);
23969
23970                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
23971
23972                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
23973                            sleep(d).await;
23974                            continue;
23975                        }
23976
23977                        dlg.finished(false);
23978
23979                        return match server_response {
23980                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
23981                            None => Err(client::Error::Failure(restored_response)),
23982                        }
23983                    }
23984                    let result_value = {
23985                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
23986
23987                        match json::from_str(&res_body_string) {
23988                            Ok(decoded) => (res, decoded),
23989                            Err(err) => {
23990                                dlg.response_json_decode_error(&res_body_string, &err);
23991                                return Err(client::Error::JsonDecodeError(res_body_string, err));
23992                            }
23993                        }
23994                    };
23995
23996                    dlg.finished(true);
23997                    return Ok(result_value)
23998                }
23999            }
24000        }
24001    }
24002
24003
24004    ///
24005    /// Sets the *request* property to the given value.
24006    ///
24007    /// Even though the property as already been set when instantiating this call,
24008    /// we provide this method for API completeness.
24009    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaProperty) -> PropertyCreateCall<'a, S> {
24010        self._request = new_value;
24011        self
24012    }
24013    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24014    /// while executing the actual API request.
24015    /// 
24016    /// ````text
24017    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24018    /// ````
24019    ///
24020    /// Sets the *delegate* property to the given value.
24021    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyCreateCall<'a, S> {
24022        self._delegate = Some(new_value);
24023        self
24024    }
24025
24026    /// Set any additional parameter of the query string used in the request.
24027    /// It should be used to set parameters which are not yet available through their own
24028    /// setters.
24029    ///
24030    /// Please note that this method must not be used to set any of the known parameters
24031    /// which have their own setter method. If done anyway, the request will fail.
24032    ///
24033    /// # Additional Parameters
24034    ///
24035    /// * *$.xgafv* (query-string) - V1 error format.
24036    /// * *access_token* (query-string) - OAuth access token.
24037    /// * *alt* (query-string) - Data format for response.
24038    /// * *callback* (query-string) - JSONP
24039    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24040    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24041    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24042    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24043    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24044    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24045    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24046    pub fn param<T>(mut self, name: T, value: T) -> PropertyCreateCall<'a, S>
24047                                                        where T: AsRef<str> {
24048        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
24049        self
24050    }
24051
24052    /// Identifies the authorization scope for the method you are building.
24053    ///
24054    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24055    /// [`Scope::AnalyticEdit`].
24056    ///
24057    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24058    /// tokens for more than one scope.
24059    ///
24060    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24061    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24062    /// sufficient, a read-write scope will do as well.
24063    pub fn add_scope<St>(mut self, scope: St) -> PropertyCreateCall<'a, S>
24064                                                        where St: AsRef<str> {
24065        self._scopes.insert(String::from(scope.as_ref()));
24066        self
24067    }
24068    /// Identifies the authorization scope(s) for the method you are building.
24069    ///
24070    /// See [`Self::add_scope()`] for details.
24071    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCreateCall<'a, S>
24072                                                        where I: IntoIterator<Item = St>,
24073                                                         St: AsRef<str> {
24074        self._scopes
24075            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24076        self
24077    }
24078
24079    /// Removes all scopes, and no default scope will be used either.
24080    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24081    /// for details).
24082    pub fn clear_scopes(mut self) -> PropertyCreateCall<'a, S> {
24083        self._scopes.clear();
24084        self
24085    }
24086}
24087
24088
24089/// Marks target Property as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI. If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not an GA4 Property.
24090///
24091/// A builder for the *delete* method supported by a *property* resource.
24092/// It is not used directly, but through a [`PropertyMethods`] instance.
24093///
24094/// # Example
24095///
24096/// Instantiate a resource method builder
24097///
24098/// ```test_harness,no_run
24099/// # extern crate hyper;
24100/// # extern crate hyper_rustls;
24101/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
24102/// # async fn dox() {
24103/// # use std::default::Default;
24104/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
24105/// 
24106/// # let secret: oauth2::ApplicationSecret = Default::default();
24107/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
24108/// #         secret,
24109/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24110/// #     ).build().await.unwrap();
24111/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
24112/// // You can configure optional parameters by calling the respective setters at will, and
24113/// // execute the final call using `doit()`.
24114/// // Values shown here are possibly random and not representative !
24115/// let result = hub.properties().delete("name")
24116///              .doit().await;
24117/// # }
24118/// ```
24119pub struct PropertyDeleteCall<'a, S>
24120    where S: 'a {
24121
24122    hub: &'a GoogleAnalyticsAdmin<S>,
24123    _name: String,
24124    _delegate: Option<&'a mut dyn client::Delegate>,
24125    _additional_params: HashMap<String, String>,
24126    _scopes: BTreeSet<String>
24127}
24128
24129impl<'a, S> client::CallBuilder for PropertyDeleteCall<'a, S> {}
24130
24131impl<'a, S> PropertyDeleteCall<'a, S>
24132where
24133    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
24134    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
24135    S::Future: Send + Unpin + 'static,
24136    S::Error: Into<Box<dyn StdError + Send + Sync>>,
24137{
24138
24139
24140    /// Perform the operation you have build so far.
24141    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaProperty)> {
24142        use std::io::{Read, Seek};
24143        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
24144        use client::{ToParts, url::Params};
24145        use std::borrow::Cow;
24146
24147        let mut dd = client::DefaultDelegate;
24148        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
24149        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.delete",
24150                               http_method: hyper::Method::DELETE });
24151
24152        for &field in ["alt", "name"].iter() {
24153            if self._additional_params.contains_key(field) {
24154                dlg.finished(false);
24155                return Err(client::Error::FieldClash(field));
24156            }
24157        }
24158
24159        let mut params = Params::with_capacity(3 + self._additional_params.len());
24160        params.push("name", self._name);
24161
24162        params.extend(self._additional_params.iter());
24163
24164        params.push("alt", "json");
24165        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
24166        if self._scopes.is_empty() {
24167            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
24168        }
24169
24170        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24171            url = params.uri_replacement(url, param_name, find_this, true);
24172        }
24173        {
24174            let to_remove = ["name"];
24175            params.remove_params(&to_remove);
24176        }
24177
24178        let url = params.parse_with_url(&url);
24179
24180
24181
24182        loop {
24183            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
24184                Ok(token) => token,
24185                Err(e) => {
24186                    match dlg.token(e) {
24187                        Ok(token) => token,
24188                        Err(e) => {
24189                            dlg.finished(false);
24190                            return Err(client::Error::MissingToken(e));
24191                        }
24192                    }
24193                }
24194            };
24195            let mut req_result = {
24196                let client = &self.hub.client;
24197                dlg.pre_request();
24198                let mut req_builder = hyper::Request::builder()
24199                    .method(hyper::Method::DELETE)
24200                    .uri(url.as_str())
24201                    .header(USER_AGENT, self.hub._user_agent.clone());
24202
24203                if let Some(token) = token.as_ref() {
24204                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24205                }
24206
24207
24208                        let request = req_builder
24209                        .body(hyper::body::Body::empty());
24210
24211                client.request(request.unwrap()).await
24212
24213            };
24214
24215            match req_result {
24216                Err(err) => {
24217                    if let client::Retry::After(d) = dlg.http_error(&err) {
24218                        sleep(d).await;
24219                        continue;
24220                    }
24221                    dlg.finished(false);
24222                    return Err(client::Error::HttpError(err))
24223                }
24224                Ok(mut res) => {
24225                    if !res.status().is_success() {
24226                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24227                        let (parts, _) = res.into_parts();
24228                        let body = hyper::Body::from(res_body_string.clone());
24229                        let restored_response = hyper::Response::from_parts(parts, body);
24230
24231                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
24232
24233                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
24234                            sleep(d).await;
24235                            continue;
24236                        }
24237
24238                        dlg.finished(false);
24239
24240                        return match server_response {
24241                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
24242                            None => Err(client::Error::Failure(restored_response)),
24243                        }
24244                    }
24245                    let result_value = {
24246                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24247
24248                        match json::from_str(&res_body_string) {
24249                            Ok(decoded) => (res, decoded),
24250                            Err(err) => {
24251                                dlg.response_json_decode_error(&res_body_string, &err);
24252                                return Err(client::Error::JsonDecodeError(res_body_string, err));
24253                            }
24254                        }
24255                    };
24256
24257                    dlg.finished(true);
24258                    return Ok(result_value)
24259                }
24260            }
24261        }
24262    }
24263
24264
24265    /// Required. The name of the Property to soft-delete. Format: properties/{property_id} Example: "properties/1000"
24266    ///
24267    /// Sets the *name* path property to the given value.
24268    ///
24269    /// Even though the property as already been set when instantiating this call,
24270    /// we provide this method for API completeness.
24271    pub fn name(mut self, new_value: &str) -> PropertyDeleteCall<'a, S> {
24272        self._name = new_value.to_string();
24273        self
24274    }
24275    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24276    /// while executing the actual API request.
24277    /// 
24278    /// ````text
24279    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24280    /// ````
24281    ///
24282    /// Sets the *delegate* property to the given value.
24283    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyDeleteCall<'a, S> {
24284        self._delegate = Some(new_value);
24285        self
24286    }
24287
24288    /// Set any additional parameter of the query string used in the request.
24289    /// It should be used to set parameters which are not yet available through their own
24290    /// setters.
24291    ///
24292    /// Please note that this method must not be used to set any of the known parameters
24293    /// which have their own setter method. If done anyway, the request will fail.
24294    ///
24295    /// # Additional Parameters
24296    ///
24297    /// * *$.xgafv* (query-string) - V1 error format.
24298    /// * *access_token* (query-string) - OAuth access token.
24299    /// * *alt* (query-string) - Data format for response.
24300    /// * *callback* (query-string) - JSONP
24301    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24302    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24303    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24304    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24305    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24306    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24307    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24308    pub fn param<T>(mut self, name: T, value: T) -> PropertyDeleteCall<'a, S>
24309                                                        where T: AsRef<str> {
24310        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
24311        self
24312    }
24313
24314    /// Identifies the authorization scope for the method you are building.
24315    ///
24316    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24317    /// [`Scope::AnalyticEdit`].
24318    ///
24319    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24320    /// tokens for more than one scope.
24321    ///
24322    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24323    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24324    /// sufficient, a read-write scope will do as well.
24325    pub fn add_scope<St>(mut self, scope: St) -> PropertyDeleteCall<'a, S>
24326                                                        where St: AsRef<str> {
24327        self._scopes.insert(String::from(scope.as_ref()));
24328        self
24329    }
24330    /// Identifies the authorization scope(s) for the method you are building.
24331    ///
24332    /// See [`Self::add_scope()`] for details.
24333    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyDeleteCall<'a, S>
24334                                                        where I: IntoIterator<Item = St>,
24335                                                         St: AsRef<str> {
24336        self._scopes
24337            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24338        self
24339    }
24340
24341    /// Removes all scopes, and no default scope will be used either.
24342    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24343    /// for details).
24344    pub fn clear_scopes(mut self) -> PropertyDeleteCall<'a, S> {
24345        self._scopes.clear();
24346        self
24347    }
24348}
24349
24350
24351/// Lookup for a single "GA4" Property.
24352///
24353/// A builder for the *get* method supported by a *property* resource.
24354/// It is not used directly, but through a [`PropertyMethods`] instance.
24355///
24356/// # Example
24357///
24358/// Instantiate a resource method builder
24359///
24360/// ```test_harness,no_run
24361/// # extern crate hyper;
24362/// # extern crate hyper_rustls;
24363/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
24364/// # async fn dox() {
24365/// # use std::default::Default;
24366/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
24367/// 
24368/// # let secret: oauth2::ApplicationSecret = Default::default();
24369/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
24370/// #         secret,
24371/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24372/// #     ).build().await.unwrap();
24373/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
24374/// // You can configure optional parameters by calling the respective setters at will, and
24375/// // execute the final call using `doit()`.
24376/// // Values shown here are possibly random and not representative !
24377/// let result = hub.properties().get("name")
24378///              .doit().await;
24379/// # }
24380/// ```
24381pub struct PropertyGetCall<'a, S>
24382    where S: 'a {
24383
24384    hub: &'a GoogleAnalyticsAdmin<S>,
24385    _name: String,
24386    _delegate: Option<&'a mut dyn client::Delegate>,
24387    _additional_params: HashMap<String, String>,
24388    _scopes: BTreeSet<String>
24389}
24390
24391impl<'a, S> client::CallBuilder for PropertyGetCall<'a, S> {}
24392
24393impl<'a, S> PropertyGetCall<'a, S>
24394where
24395    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
24396    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
24397    S::Future: Send + Unpin + 'static,
24398    S::Error: Into<Box<dyn StdError + Send + Sync>>,
24399{
24400
24401
24402    /// Perform the operation you have build so far.
24403    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaProperty)> {
24404        use std::io::{Read, Seek};
24405        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
24406        use client::{ToParts, url::Params};
24407        use std::borrow::Cow;
24408
24409        let mut dd = client::DefaultDelegate;
24410        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
24411        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.get",
24412                               http_method: hyper::Method::GET });
24413
24414        for &field in ["alt", "name"].iter() {
24415            if self._additional_params.contains_key(field) {
24416                dlg.finished(false);
24417                return Err(client::Error::FieldClash(field));
24418            }
24419        }
24420
24421        let mut params = Params::with_capacity(3 + self._additional_params.len());
24422        params.push("name", self._name);
24423
24424        params.extend(self._additional_params.iter());
24425
24426        params.push("alt", "json");
24427        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
24428        if self._scopes.is_empty() {
24429            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
24430        }
24431
24432        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24433            url = params.uri_replacement(url, param_name, find_this, true);
24434        }
24435        {
24436            let to_remove = ["name"];
24437            params.remove_params(&to_remove);
24438        }
24439
24440        let url = params.parse_with_url(&url);
24441
24442
24443
24444        loop {
24445            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
24446                Ok(token) => token,
24447                Err(e) => {
24448                    match dlg.token(e) {
24449                        Ok(token) => token,
24450                        Err(e) => {
24451                            dlg.finished(false);
24452                            return Err(client::Error::MissingToken(e));
24453                        }
24454                    }
24455                }
24456            };
24457            let mut req_result = {
24458                let client = &self.hub.client;
24459                dlg.pre_request();
24460                let mut req_builder = hyper::Request::builder()
24461                    .method(hyper::Method::GET)
24462                    .uri(url.as_str())
24463                    .header(USER_AGENT, self.hub._user_agent.clone());
24464
24465                if let Some(token) = token.as_ref() {
24466                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24467                }
24468
24469
24470                        let request = req_builder
24471                        .body(hyper::body::Body::empty());
24472
24473                client.request(request.unwrap()).await
24474
24475            };
24476
24477            match req_result {
24478                Err(err) => {
24479                    if let client::Retry::After(d) = dlg.http_error(&err) {
24480                        sleep(d).await;
24481                        continue;
24482                    }
24483                    dlg.finished(false);
24484                    return Err(client::Error::HttpError(err))
24485                }
24486                Ok(mut res) => {
24487                    if !res.status().is_success() {
24488                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24489                        let (parts, _) = res.into_parts();
24490                        let body = hyper::Body::from(res_body_string.clone());
24491                        let restored_response = hyper::Response::from_parts(parts, body);
24492
24493                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
24494
24495                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
24496                            sleep(d).await;
24497                            continue;
24498                        }
24499
24500                        dlg.finished(false);
24501
24502                        return match server_response {
24503                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
24504                            None => Err(client::Error::Failure(restored_response)),
24505                        }
24506                    }
24507                    let result_value = {
24508                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24509
24510                        match json::from_str(&res_body_string) {
24511                            Ok(decoded) => (res, decoded),
24512                            Err(err) => {
24513                                dlg.response_json_decode_error(&res_body_string, &err);
24514                                return Err(client::Error::JsonDecodeError(res_body_string, err));
24515                            }
24516                        }
24517                    };
24518
24519                    dlg.finished(true);
24520                    return Ok(result_value)
24521                }
24522            }
24523        }
24524    }
24525
24526
24527    /// Required. The name of the property to lookup. Format: properties/{property_id} Example: "properties/1000"
24528    ///
24529    /// Sets the *name* path property to the given value.
24530    ///
24531    /// Even though the property as already been set when instantiating this call,
24532    /// we provide this method for API completeness.
24533    pub fn name(mut self, new_value: &str) -> PropertyGetCall<'a, S> {
24534        self._name = new_value.to_string();
24535        self
24536    }
24537    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24538    /// while executing the actual API request.
24539    /// 
24540    /// ````text
24541    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24542    /// ````
24543    ///
24544    /// Sets the *delegate* property to the given value.
24545    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGetCall<'a, S> {
24546        self._delegate = Some(new_value);
24547        self
24548    }
24549
24550    /// Set any additional parameter of the query string used in the request.
24551    /// It should be used to set parameters which are not yet available through their own
24552    /// setters.
24553    ///
24554    /// Please note that this method must not be used to set any of the known parameters
24555    /// which have their own setter method. If done anyway, the request will fail.
24556    ///
24557    /// # Additional Parameters
24558    ///
24559    /// * *$.xgafv* (query-string) - V1 error format.
24560    /// * *access_token* (query-string) - OAuth access token.
24561    /// * *alt* (query-string) - Data format for response.
24562    /// * *callback* (query-string) - JSONP
24563    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24564    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24565    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24566    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24567    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24568    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24569    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24570    pub fn param<T>(mut self, name: T, value: T) -> PropertyGetCall<'a, S>
24571                                                        where T: AsRef<str> {
24572        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
24573        self
24574    }
24575
24576    /// Identifies the authorization scope for the method you are building.
24577    ///
24578    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24579    /// [`Scope::AnalyticReadonly`].
24580    ///
24581    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24582    /// tokens for more than one scope.
24583    ///
24584    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24585    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24586    /// sufficient, a read-write scope will do as well.
24587    pub fn add_scope<St>(mut self, scope: St) -> PropertyGetCall<'a, S>
24588                                                        where St: AsRef<str> {
24589        self._scopes.insert(String::from(scope.as_ref()));
24590        self
24591    }
24592    /// Identifies the authorization scope(s) for the method you are building.
24593    ///
24594    /// See [`Self::add_scope()`] for details.
24595    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGetCall<'a, S>
24596                                                        where I: IntoIterator<Item = St>,
24597                                                         St: AsRef<str> {
24598        self._scopes
24599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24600        self
24601    }
24602
24603    /// Removes all scopes, and no default scope will be used either.
24604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24605    /// for details).
24606    pub fn clear_scopes(mut self) -> PropertyGetCall<'a, S> {
24607        self._scopes.clear();
24608        self
24609    }
24610}
24611
24612
24613/// Returns the singleton data retention settings for this property.
24614///
24615/// A builder for the *getDataRetentionSettings* method supported by a *property* resource.
24616/// It is not used directly, but through a [`PropertyMethods`] instance.
24617///
24618/// # Example
24619///
24620/// Instantiate a resource method builder
24621///
24622/// ```test_harness,no_run
24623/// # extern crate hyper;
24624/// # extern crate hyper_rustls;
24625/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
24626/// # async fn dox() {
24627/// # use std::default::Default;
24628/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
24629/// 
24630/// # let secret: oauth2::ApplicationSecret = Default::default();
24631/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
24632/// #         secret,
24633/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24634/// #     ).build().await.unwrap();
24635/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
24636/// // You can configure optional parameters by calling the respective setters at will, and
24637/// // execute the final call using `doit()`.
24638/// // Values shown here are possibly random and not representative !
24639/// let result = hub.properties().get_data_retention_settings("name")
24640///              .doit().await;
24641/// # }
24642/// ```
24643pub struct PropertyGetDataRetentionSettingCall<'a, S>
24644    where S: 'a {
24645
24646    hub: &'a GoogleAnalyticsAdmin<S>,
24647    _name: String,
24648    _delegate: Option<&'a mut dyn client::Delegate>,
24649    _additional_params: HashMap<String, String>,
24650    _scopes: BTreeSet<String>
24651}
24652
24653impl<'a, S> client::CallBuilder for PropertyGetDataRetentionSettingCall<'a, S> {}
24654
24655impl<'a, S> PropertyGetDataRetentionSettingCall<'a, S>
24656where
24657    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
24658    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
24659    S::Future: Send + Unpin + 'static,
24660    S::Error: Into<Box<dyn StdError + Send + Sync>>,
24661{
24662
24663
24664    /// Perform the operation you have build so far.
24665    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataRetentionSettings)> {
24666        use std::io::{Read, Seek};
24667        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
24668        use client::{ToParts, url::Params};
24669        use std::borrow::Cow;
24670
24671        let mut dd = client::DefaultDelegate;
24672        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
24673        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.getDataRetentionSettings",
24674                               http_method: hyper::Method::GET });
24675
24676        for &field in ["alt", "name"].iter() {
24677            if self._additional_params.contains_key(field) {
24678                dlg.finished(false);
24679                return Err(client::Error::FieldClash(field));
24680            }
24681        }
24682
24683        let mut params = Params::with_capacity(3 + self._additional_params.len());
24684        params.push("name", self._name);
24685
24686        params.extend(self._additional_params.iter());
24687
24688        params.push("alt", "json");
24689        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
24690        if self._scopes.is_empty() {
24691            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
24692        }
24693
24694        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24695            url = params.uri_replacement(url, param_name, find_this, true);
24696        }
24697        {
24698            let to_remove = ["name"];
24699            params.remove_params(&to_remove);
24700        }
24701
24702        let url = params.parse_with_url(&url);
24703
24704
24705
24706        loop {
24707            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
24708                Ok(token) => token,
24709                Err(e) => {
24710                    match dlg.token(e) {
24711                        Ok(token) => token,
24712                        Err(e) => {
24713                            dlg.finished(false);
24714                            return Err(client::Error::MissingToken(e));
24715                        }
24716                    }
24717                }
24718            };
24719            let mut req_result = {
24720                let client = &self.hub.client;
24721                dlg.pre_request();
24722                let mut req_builder = hyper::Request::builder()
24723                    .method(hyper::Method::GET)
24724                    .uri(url.as_str())
24725                    .header(USER_AGENT, self.hub._user_agent.clone());
24726
24727                if let Some(token) = token.as_ref() {
24728                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24729                }
24730
24731
24732                        let request = req_builder
24733                        .body(hyper::body::Body::empty());
24734
24735                client.request(request.unwrap()).await
24736
24737            };
24738
24739            match req_result {
24740                Err(err) => {
24741                    if let client::Retry::After(d) = dlg.http_error(&err) {
24742                        sleep(d).await;
24743                        continue;
24744                    }
24745                    dlg.finished(false);
24746                    return Err(client::Error::HttpError(err))
24747                }
24748                Ok(mut res) => {
24749                    if !res.status().is_success() {
24750                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24751                        let (parts, _) = res.into_parts();
24752                        let body = hyper::Body::from(res_body_string.clone());
24753                        let restored_response = hyper::Response::from_parts(parts, body);
24754
24755                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
24756
24757                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
24758                            sleep(d).await;
24759                            continue;
24760                        }
24761
24762                        dlg.finished(false);
24763
24764                        return match server_response {
24765                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
24766                            None => Err(client::Error::Failure(restored_response)),
24767                        }
24768                    }
24769                    let result_value = {
24770                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
24771
24772                        match json::from_str(&res_body_string) {
24773                            Ok(decoded) => (res, decoded),
24774                            Err(err) => {
24775                                dlg.response_json_decode_error(&res_body_string, &err);
24776                                return Err(client::Error::JsonDecodeError(res_body_string, err));
24777                            }
24778                        }
24779                    };
24780
24781                    dlg.finished(true);
24782                    return Ok(result_value)
24783                }
24784            }
24785        }
24786    }
24787
24788
24789    /// Required. The name of the settings to lookup. Format: properties/{property}/dataRetentionSettings Example: "properties/1000/dataRetentionSettings"
24790    ///
24791    /// Sets the *name* path property to the given value.
24792    ///
24793    /// Even though the property as already been set when instantiating this call,
24794    /// we provide this method for API completeness.
24795    pub fn name(mut self, new_value: &str) -> PropertyGetDataRetentionSettingCall<'a, S> {
24796        self._name = new_value.to_string();
24797        self
24798    }
24799    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24800    /// while executing the actual API request.
24801    /// 
24802    /// ````text
24803    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24804    /// ````
24805    ///
24806    /// Sets the *delegate* property to the given value.
24807    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGetDataRetentionSettingCall<'a, S> {
24808        self._delegate = Some(new_value);
24809        self
24810    }
24811
24812    /// Set any additional parameter of the query string used in the request.
24813    /// It should be used to set parameters which are not yet available through their own
24814    /// setters.
24815    ///
24816    /// Please note that this method must not be used to set any of the known parameters
24817    /// which have their own setter method. If done anyway, the request will fail.
24818    ///
24819    /// # Additional Parameters
24820    ///
24821    /// * *$.xgafv* (query-string) - V1 error format.
24822    /// * *access_token* (query-string) - OAuth access token.
24823    /// * *alt* (query-string) - Data format for response.
24824    /// * *callback* (query-string) - JSONP
24825    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24826    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24827    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24828    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24829    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24830    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24831    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24832    pub fn param<T>(mut self, name: T, value: T) -> PropertyGetDataRetentionSettingCall<'a, S>
24833                                                        where T: AsRef<str> {
24834        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
24835        self
24836    }
24837
24838    /// Identifies the authorization scope for the method you are building.
24839    ///
24840    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24841    /// [`Scope::AnalyticReadonly`].
24842    ///
24843    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24844    /// tokens for more than one scope.
24845    ///
24846    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24847    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24848    /// sufficient, a read-write scope will do as well.
24849    pub fn add_scope<St>(mut self, scope: St) -> PropertyGetDataRetentionSettingCall<'a, S>
24850                                                        where St: AsRef<str> {
24851        self._scopes.insert(String::from(scope.as_ref()));
24852        self
24853    }
24854    /// Identifies the authorization scope(s) for the method you are building.
24855    ///
24856    /// See [`Self::add_scope()`] for details.
24857    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGetDataRetentionSettingCall<'a, S>
24858                                                        where I: IntoIterator<Item = St>,
24859                                                         St: AsRef<str> {
24860        self._scopes
24861            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24862        self
24863    }
24864
24865    /// Removes all scopes, and no default scope will be used either.
24866    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24867    /// for details).
24868    pub fn clear_scopes(mut self) -> PropertyGetDataRetentionSettingCall<'a, S> {
24869        self._scopes.clear();
24870        self
24871    }
24872}
24873
24874
24875/// Lookup for Google Signals settings for a property.
24876///
24877/// A builder for the *getGoogleSignalsSettings* method supported by a *property* resource.
24878/// It is not used directly, but through a [`PropertyMethods`] instance.
24879///
24880/// # Example
24881///
24882/// Instantiate a resource method builder
24883///
24884/// ```test_harness,no_run
24885/// # extern crate hyper;
24886/// # extern crate hyper_rustls;
24887/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
24888/// # async fn dox() {
24889/// # use std::default::Default;
24890/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
24891/// 
24892/// # let secret: oauth2::ApplicationSecret = Default::default();
24893/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
24894/// #         secret,
24895/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24896/// #     ).build().await.unwrap();
24897/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
24898/// // You can configure optional parameters by calling the respective setters at will, and
24899/// // execute the final call using `doit()`.
24900/// // Values shown here are possibly random and not representative !
24901/// let result = hub.properties().get_google_signals_settings("name")
24902///              .doit().await;
24903/// # }
24904/// ```
24905pub struct PropertyGetGoogleSignalsSettingCall<'a, S>
24906    where S: 'a {
24907
24908    hub: &'a GoogleAnalyticsAdmin<S>,
24909    _name: String,
24910    _delegate: Option<&'a mut dyn client::Delegate>,
24911    _additional_params: HashMap<String, String>,
24912    _scopes: BTreeSet<String>
24913}
24914
24915impl<'a, S> client::CallBuilder for PropertyGetGoogleSignalsSettingCall<'a, S> {}
24916
24917impl<'a, S> PropertyGetGoogleSignalsSettingCall<'a, S>
24918where
24919    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
24920    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
24921    S::Future: Send + Unpin + 'static,
24922    S::Error: Into<Box<dyn StdError + Send + Sync>>,
24923{
24924
24925
24926    /// Perform the operation you have build so far.
24927    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaGoogleSignalsSettings)> {
24928        use std::io::{Read, Seek};
24929        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
24930        use client::{ToParts, url::Params};
24931        use std::borrow::Cow;
24932
24933        let mut dd = client::DefaultDelegate;
24934        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
24935        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.getGoogleSignalsSettings",
24936                               http_method: hyper::Method::GET });
24937
24938        for &field in ["alt", "name"].iter() {
24939            if self._additional_params.contains_key(field) {
24940                dlg.finished(false);
24941                return Err(client::Error::FieldClash(field));
24942            }
24943        }
24944
24945        let mut params = Params::with_capacity(3 + self._additional_params.len());
24946        params.push("name", self._name);
24947
24948        params.extend(self._additional_params.iter());
24949
24950        params.push("alt", "json");
24951        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
24952        if self._scopes.is_empty() {
24953            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
24954        }
24955
24956        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24957            url = params.uri_replacement(url, param_name, find_this, true);
24958        }
24959        {
24960            let to_remove = ["name"];
24961            params.remove_params(&to_remove);
24962        }
24963
24964        let url = params.parse_with_url(&url);
24965
24966
24967
24968        loop {
24969            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
24970                Ok(token) => token,
24971                Err(e) => {
24972                    match dlg.token(e) {
24973                        Ok(token) => token,
24974                        Err(e) => {
24975                            dlg.finished(false);
24976                            return Err(client::Error::MissingToken(e));
24977                        }
24978                    }
24979                }
24980            };
24981            let mut req_result = {
24982                let client = &self.hub.client;
24983                dlg.pre_request();
24984                let mut req_builder = hyper::Request::builder()
24985                    .method(hyper::Method::GET)
24986                    .uri(url.as_str())
24987                    .header(USER_AGENT, self.hub._user_agent.clone());
24988
24989                if let Some(token) = token.as_ref() {
24990                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24991                }
24992
24993
24994                        let request = req_builder
24995                        .body(hyper::body::Body::empty());
24996
24997                client.request(request.unwrap()).await
24998
24999            };
25000
25001            match req_result {
25002                Err(err) => {
25003                    if let client::Retry::After(d) = dlg.http_error(&err) {
25004                        sleep(d).await;
25005                        continue;
25006                    }
25007                    dlg.finished(false);
25008                    return Err(client::Error::HttpError(err))
25009                }
25010                Ok(mut res) => {
25011                    if !res.status().is_success() {
25012                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25013                        let (parts, _) = res.into_parts();
25014                        let body = hyper::Body::from(res_body_string.clone());
25015                        let restored_response = hyper::Response::from_parts(parts, body);
25016
25017                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
25018
25019                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
25020                            sleep(d).await;
25021                            continue;
25022                        }
25023
25024                        dlg.finished(false);
25025
25026                        return match server_response {
25027                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
25028                            None => Err(client::Error::Failure(restored_response)),
25029                        }
25030                    }
25031                    let result_value = {
25032                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25033
25034                        match json::from_str(&res_body_string) {
25035                            Ok(decoded) => (res, decoded),
25036                            Err(err) => {
25037                                dlg.response_json_decode_error(&res_body_string, &err);
25038                                return Err(client::Error::JsonDecodeError(res_body_string, err));
25039                            }
25040                        }
25041                    };
25042
25043                    dlg.finished(true);
25044                    return Ok(result_value)
25045                }
25046            }
25047        }
25048    }
25049
25050
25051    /// Required. The name of the google signals settings to retrieve. Format: properties/{property}/googleSignalsSettings
25052    ///
25053    /// Sets the *name* path property to the given value.
25054    ///
25055    /// Even though the property as already been set when instantiating this call,
25056    /// we provide this method for API completeness.
25057    pub fn name(mut self, new_value: &str) -> PropertyGetGoogleSignalsSettingCall<'a, S> {
25058        self._name = new_value.to_string();
25059        self
25060    }
25061    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25062    /// while executing the actual API request.
25063    /// 
25064    /// ````text
25065    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25066    /// ````
25067    ///
25068    /// Sets the *delegate* property to the given value.
25069    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyGetGoogleSignalsSettingCall<'a, S> {
25070        self._delegate = Some(new_value);
25071        self
25072    }
25073
25074    /// Set any additional parameter of the query string used in the request.
25075    /// It should be used to set parameters which are not yet available through their own
25076    /// setters.
25077    ///
25078    /// Please note that this method must not be used to set any of the known parameters
25079    /// which have their own setter method. If done anyway, the request will fail.
25080    ///
25081    /// # Additional Parameters
25082    ///
25083    /// * *$.xgafv* (query-string) - V1 error format.
25084    /// * *access_token* (query-string) - OAuth access token.
25085    /// * *alt* (query-string) - Data format for response.
25086    /// * *callback* (query-string) - JSONP
25087    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25088    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25089    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25090    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25091    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25092    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25093    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25094    pub fn param<T>(mut self, name: T, value: T) -> PropertyGetGoogleSignalsSettingCall<'a, S>
25095                                                        where T: AsRef<str> {
25096        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
25097        self
25098    }
25099
25100    /// Identifies the authorization scope for the method you are building.
25101    ///
25102    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25103    /// [`Scope::AnalyticReadonly`].
25104    ///
25105    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25106    /// tokens for more than one scope.
25107    ///
25108    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25109    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25110    /// sufficient, a read-write scope will do as well.
25111    pub fn add_scope<St>(mut self, scope: St) -> PropertyGetGoogleSignalsSettingCall<'a, S>
25112                                                        where St: AsRef<str> {
25113        self._scopes.insert(String::from(scope.as_ref()));
25114        self
25115    }
25116    /// Identifies the authorization scope(s) for the method you are building.
25117    ///
25118    /// See [`Self::add_scope()`] for details.
25119    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGetGoogleSignalsSettingCall<'a, S>
25120                                                        where I: IntoIterator<Item = St>,
25121                                                         St: AsRef<str> {
25122        self._scopes
25123            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25124        self
25125    }
25126
25127    /// Removes all scopes, and no default scope will be used either.
25128    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25129    /// for details).
25130    pub fn clear_scopes(mut self) -> PropertyGetGoogleSignalsSettingCall<'a, S> {
25131        self._scopes.clear();
25132        self
25133    }
25134}
25135
25136
25137/// Returns child Properties under the specified parent Account. Only "GA4" properties will be returned. Properties will be excluded if the caller does not have access. Soft-deleted (ie: "trashed") properties are excluded by default. Returns an empty list if no relevant properties are found.
25138///
25139/// A builder for the *list* method supported by a *property* resource.
25140/// It is not used directly, but through a [`PropertyMethods`] instance.
25141///
25142/// # Example
25143///
25144/// Instantiate a resource method builder
25145///
25146/// ```test_harness,no_run
25147/// # extern crate hyper;
25148/// # extern crate hyper_rustls;
25149/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
25150/// # async fn dox() {
25151/// # use std::default::Default;
25152/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
25153/// 
25154/// # let secret: oauth2::ApplicationSecret = Default::default();
25155/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
25156/// #         secret,
25157/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25158/// #     ).build().await.unwrap();
25159/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
25160/// // You can configure optional parameters by calling the respective setters at will, and
25161/// // execute the final call using `doit()`.
25162/// // Values shown here are possibly random and not representative !
25163/// let result = hub.properties().list()
25164///              .show_deleted(true)
25165///              .page_token("est")
25166///              .page_size(-30)
25167///              .filter("diam")
25168///              .doit().await;
25169/// # }
25170/// ```
25171pub struct PropertyListCall<'a, S>
25172    where S: 'a {
25173
25174    hub: &'a GoogleAnalyticsAdmin<S>,
25175    _show_deleted: Option<bool>,
25176    _page_token: Option<String>,
25177    _page_size: Option<i32>,
25178    _filter: Option<String>,
25179    _delegate: Option<&'a mut dyn client::Delegate>,
25180    _additional_params: HashMap<String, String>,
25181    _scopes: BTreeSet<String>
25182}
25183
25184impl<'a, S> client::CallBuilder for PropertyListCall<'a, S> {}
25185
25186impl<'a, S> PropertyListCall<'a, S>
25187where
25188    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
25189    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
25190    S::Future: Send + Unpin + 'static,
25191    S::Error: Into<Box<dyn StdError + Send + Sync>>,
25192{
25193
25194
25195    /// Perform the operation you have build so far.
25196    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaListPropertiesResponse)> {
25197        use std::io::{Read, Seek};
25198        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
25199        use client::{ToParts, url::Params};
25200        use std::borrow::Cow;
25201
25202        let mut dd = client::DefaultDelegate;
25203        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
25204        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.list",
25205                               http_method: hyper::Method::GET });
25206
25207        for &field in ["alt", "showDeleted", "pageToken", "pageSize", "filter"].iter() {
25208            if self._additional_params.contains_key(field) {
25209                dlg.finished(false);
25210                return Err(client::Error::FieldClash(field));
25211            }
25212        }
25213
25214        let mut params = Params::with_capacity(6 + self._additional_params.len());
25215        if let Some(value) = self._show_deleted.as_ref() {
25216            params.push("showDeleted", value.to_string());
25217        }
25218        if let Some(value) = self._page_token.as_ref() {
25219            params.push("pageToken", value);
25220        }
25221        if let Some(value) = self._page_size.as_ref() {
25222            params.push("pageSize", value.to_string());
25223        }
25224        if let Some(value) = self._filter.as_ref() {
25225            params.push("filter", value);
25226        }
25227
25228        params.extend(self._additional_params.iter());
25229
25230        params.push("alt", "json");
25231        let mut url = self.hub._base_url.clone() + "v1alpha/properties";
25232        if self._scopes.is_empty() {
25233            self._scopes.insert(Scope::AnalyticReadonly.as_ref().to_string());
25234        }
25235
25236
25237        let url = params.parse_with_url(&url);
25238
25239
25240
25241        loop {
25242            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
25243                Ok(token) => token,
25244                Err(e) => {
25245                    match dlg.token(e) {
25246                        Ok(token) => token,
25247                        Err(e) => {
25248                            dlg.finished(false);
25249                            return Err(client::Error::MissingToken(e));
25250                        }
25251                    }
25252                }
25253            };
25254            let mut req_result = {
25255                let client = &self.hub.client;
25256                dlg.pre_request();
25257                let mut req_builder = hyper::Request::builder()
25258                    .method(hyper::Method::GET)
25259                    .uri(url.as_str())
25260                    .header(USER_AGENT, self.hub._user_agent.clone());
25261
25262                if let Some(token) = token.as_ref() {
25263                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25264                }
25265
25266
25267                        let request = req_builder
25268                        .body(hyper::body::Body::empty());
25269
25270                client.request(request.unwrap()).await
25271
25272            };
25273
25274            match req_result {
25275                Err(err) => {
25276                    if let client::Retry::After(d) = dlg.http_error(&err) {
25277                        sleep(d).await;
25278                        continue;
25279                    }
25280                    dlg.finished(false);
25281                    return Err(client::Error::HttpError(err))
25282                }
25283                Ok(mut res) => {
25284                    if !res.status().is_success() {
25285                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25286                        let (parts, _) = res.into_parts();
25287                        let body = hyper::Body::from(res_body_string.clone());
25288                        let restored_response = hyper::Response::from_parts(parts, body);
25289
25290                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
25291
25292                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
25293                            sleep(d).await;
25294                            continue;
25295                        }
25296
25297                        dlg.finished(false);
25298
25299                        return match server_response {
25300                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
25301                            None => Err(client::Error::Failure(restored_response)),
25302                        }
25303                    }
25304                    let result_value = {
25305                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25306
25307                        match json::from_str(&res_body_string) {
25308                            Ok(decoded) => (res, decoded),
25309                            Err(err) => {
25310                                dlg.response_json_decode_error(&res_body_string, &err);
25311                                return Err(client::Error::JsonDecodeError(res_body_string, err));
25312                            }
25313                        }
25314                    };
25315
25316                    dlg.finished(true);
25317                    return Ok(result_value)
25318                }
25319            }
25320        }
25321    }
25322
25323
25324    /// Whether to include soft-deleted (ie: "trashed") Properties in the results. Properties can be inspected to determine whether they are deleted or not.
25325    ///
25326    /// Sets the *show deleted* query property to the given value.
25327    pub fn show_deleted(mut self, new_value: bool) -> PropertyListCall<'a, S> {
25328        self._show_deleted = Some(new_value);
25329        self
25330    }
25331    /// A page token, received from a previous `ListProperties` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListProperties` must match the call that provided the page token.
25332    ///
25333    /// Sets the *page token* query property to the given value.
25334    pub fn page_token(mut self, new_value: &str) -> PropertyListCall<'a, S> {
25335        self._page_token = Some(new_value.to_string());
25336        self
25337    }
25338    /// The maximum number of resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
25339    ///
25340    /// Sets the *page size* query property to the given value.
25341    pub fn page_size(mut self, new_value: i32) -> PropertyListCall<'a, S> {
25342        self._page_size = Some(new_value);
25343        self
25344    }
25345    /// Required. An expression for filtering the results of the request. Fields eligible for filtering are: `parent:`(The resource name of the parent account/property) or `ancestor:`(The resource name of the parent account) or `firebase_project:`(The id or number of the linked firebase project). Some examples of filters: ``` | Filter | Description | |-----------------------------|-------------------------------------------| | parent:accounts/123 | The account with account id: 123. | | parent:properties/123 | The property with property id: 123. | | ancestor:accounts/123 | The account with account id: 123. | | firebase_project:project-id | The firebase project with id: project-id. | | firebase_project:123 | The firebase project with number: 123. | ```
25346    ///
25347    /// Sets the *filter* query property to the given value.
25348    pub fn filter(mut self, new_value: &str) -> PropertyListCall<'a, S> {
25349        self._filter = Some(new_value.to_string());
25350        self
25351    }
25352    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25353    /// while executing the actual API request.
25354    /// 
25355    /// ````text
25356    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25357    /// ````
25358    ///
25359    /// Sets the *delegate* property to the given value.
25360    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyListCall<'a, S> {
25361        self._delegate = Some(new_value);
25362        self
25363    }
25364
25365    /// Set any additional parameter of the query string used in the request.
25366    /// It should be used to set parameters which are not yet available through their own
25367    /// setters.
25368    ///
25369    /// Please note that this method must not be used to set any of the known parameters
25370    /// which have their own setter method. If done anyway, the request will fail.
25371    ///
25372    /// # Additional Parameters
25373    ///
25374    /// * *$.xgafv* (query-string) - V1 error format.
25375    /// * *access_token* (query-string) - OAuth access token.
25376    /// * *alt* (query-string) - Data format for response.
25377    /// * *callback* (query-string) - JSONP
25378    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25379    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25380    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25381    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25382    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25383    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25384    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25385    pub fn param<T>(mut self, name: T, value: T) -> PropertyListCall<'a, S>
25386                                                        where T: AsRef<str> {
25387        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
25388        self
25389    }
25390
25391    /// Identifies the authorization scope for the method you are building.
25392    ///
25393    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25394    /// [`Scope::AnalyticReadonly`].
25395    ///
25396    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25397    /// tokens for more than one scope.
25398    ///
25399    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25400    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25401    /// sufficient, a read-write scope will do as well.
25402    pub fn add_scope<St>(mut self, scope: St) -> PropertyListCall<'a, S>
25403                                                        where St: AsRef<str> {
25404        self._scopes.insert(String::from(scope.as_ref()));
25405        self
25406    }
25407    /// Identifies the authorization scope(s) for the method you are building.
25408    ///
25409    /// See [`Self::add_scope()`] for details.
25410    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyListCall<'a, S>
25411                                                        where I: IntoIterator<Item = St>,
25412                                                         St: AsRef<str> {
25413        self._scopes
25414            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25415        self
25416    }
25417
25418    /// Removes all scopes, and no default scope will be used either.
25419    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25420    /// for details).
25421    pub fn clear_scopes(mut self) -> PropertyListCall<'a, S> {
25422        self._scopes.clear();
25423        self
25424    }
25425}
25426
25427
25428/// Updates a property.
25429///
25430/// A builder for the *patch* method supported by a *property* resource.
25431/// It is not used directly, but through a [`PropertyMethods`] instance.
25432///
25433/// # Example
25434///
25435/// Instantiate a resource method builder
25436///
25437/// ```test_harness,no_run
25438/// # extern crate hyper;
25439/// # extern crate hyper_rustls;
25440/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
25441/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaProperty;
25442/// # async fn dox() {
25443/// # use std::default::Default;
25444/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
25445/// 
25446/// # let secret: oauth2::ApplicationSecret = Default::default();
25447/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
25448/// #         secret,
25449/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25450/// #     ).build().await.unwrap();
25451/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
25452/// // As the method needs a request, you would usually fill it with the desired information
25453/// // into the respective structure. Some of the parts shown here might not be applicable !
25454/// // Values shown here are possibly random and not representative !
25455/// let mut req = GoogleAnalyticsAdminV1alphaProperty::default();
25456/// 
25457/// // You can configure optional parameters by calling the respective setters at will, and
25458/// // execute the final call using `doit()`.
25459/// // Values shown here are possibly random and not representative !
25460/// let result = hub.properties().patch(req, "name")
25461///              .update_mask(&Default::default())
25462///              .doit().await;
25463/// # }
25464/// ```
25465pub struct PropertyPatchCall<'a, S>
25466    where S: 'a {
25467
25468    hub: &'a GoogleAnalyticsAdmin<S>,
25469    _request: GoogleAnalyticsAdminV1alphaProperty,
25470    _name: String,
25471    _update_mask: Option<client::FieldMask>,
25472    _delegate: Option<&'a mut dyn client::Delegate>,
25473    _additional_params: HashMap<String, String>,
25474    _scopes: BTreeSet<String>
25475}
25476
25477impl<'a, S> client::CallBuilder for PropertyPatchCall<'a, S> {}
25478
25479impl<'a, S> PropertyPatchCall<'a, S>
25480where
25481    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
25482    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
25483    S::Future: Send + Unpin + 'static,
25484    S::Error: Into<Box<dyn StdError + Send + Sync>>,
25485{
25486
25487
25488    /// Perform the operation you have build so far.
25489    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaProperty)> {
25490        use std::io::{Read, Seek};
25491        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
25492        use client::{ToParts, url::Params};
25493        use std::borrow::Cow;
25494
25495        let mut dd = client::DefaultDelegate;
25496        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
25497        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.patch",
25498                               http_method: hyper::Method::PATCH });
25499
25500        for &field in ["alt", "name", "updateMask"].iter() {
25501            if self._additional_params.contains_key(field) {
25502                dlg.finished(false);
25503                return Err(client::Error::FieldClash(field));
25504            }
25505        }
25506
25507        let mut params = Params::with_capacity(5 + self._additional_params.len());
25508        params.push("name", self._name);
25509        if let Some(value) = self._update_mask.as_ref() {
25510            params.push("updateMask", value.to_string());
25511        }
25512
25513        params.extend(self._additional_params.iter());
25514
25515        params.push("alt", "json");
25516        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
25517        if self._scopes.is_empty() {
25518            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
25519        }
25520
25521        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25522            url = params.uri_replacement(url, param_name, find_this, true);
25523        }
25524        {
25525            let to_remove = ["name"];
25526            params.remove_params(&to_remove);
25527        }
25528
25529        let url = params.parse_with_url(&url);
25530
25531        let mut json_mime_type = mime::APPLICATION_JSON;
25532        let mut request_value_reader =
25533            {
25534                let mut value = json::value::to_value(&self._request).expect("serde to work");
25535                client::remove_json_null_values(&mut value);
25536                let mut dst = io::Cursor::new(Vec::with_capacity(128));
25537                json::to_writer(&mut dst, &value).unwrap();
25538                dst
25539            };
25540        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
25541        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
25542
25543
25544        loop {
25545            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
25546                Ok(token) => token,
25547                Err(e) => {
25548                    match dlg.token(e) {
25549                        Ok(token) => token,
25550                        Err(e) => {
25551                            dlg.finished(false);
25552                            return Err(client::Error::MissingToken(e));
25553                        }
25554                    }
25555                }
25556            };
25557            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
25558            let mut req_result = {
25559                let client = &self.hub.client;
25560                dlg.pre_request();
25561                let mut req_builder = hyper::Request::builder()
25562                    .method(hyper::Method::PATCH)
25563                    .uri(url.as_str())
25564                    .header(USER_AGENT, self.hub._user_agent.clone());
25565
25566                if let Some(token) = token.as_ref() {
25567                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25568                }
25569
25570
25571                        let request = req_builder
25572                        .header(CONTENT_TYPE, json_mime_type.to_string())
25573                        .header(CONTENT_LENGTH, request_size as u64)
25574                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
25575
25576                client.request(request.unwrap()).await
25577
25578            };
25579
25580            match req_result {
25581                Err(err) => {
25582                    if let client::Retry::After(d) = dlg.http_error(&err) {
25583                        sleep(d).await;
25584                        continue;
25585                    }
25586                    dlg.finished(false);
25587                    return Err(client::Error::HttpError(err))
25588                }
25589                Ok(mut res) => {
25590                    if !res.status().is_success() {
25591                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25592                        let (parts, _) = res.into_parts();
25593                        let body = hyper::Body::from(res_body_string.clone());
25594                        let restored_response = hyper::Response::from_parts(parts, body);
25595
25596                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
25597
25598                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
25599                            sleep(d).await;
25600                            continue;
25601                        }
25602
25603                        dlg.finished(false);
25604
25605                        return match server_response {
25606                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
25607                            None => Err(client::Error::Failure(restored_response)),
25608                        }
25609                    }
25610                    let result_value = {
25611                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25612
25613                        match json::from_str(&res_body_string) {
25614                            Ok(decoded) => (res, decoded),
25615                            Err(err) => {
25616                                dlg.response_json_decode_error(&res_body_string, &err);
25617                                return Err(client::Error::JsonDecodeError(res_body_string, err));
25618                            }
25619                        }
25620                    };
25621
25622                    dlg.finished(true);
25623                    return Ok(result_value)
25624                }
25625            }
25626        }
25627    }
25628
25629
25630    ///
25631    /// Sets the *request* property to the given value.
25632    ///
25633    /// Even though the property as already been set when instantiating this call,
25634    /// we provide this method for API completeness.
25635    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaProperty) -> PropertyPatchCall<'a, S> {
25636        self._request = new_value;
25637        self
25638    }
25639    /// Output only. Resource name of this property. Format: properties/{property_id} Example: "properties/1000"
25640    ///
25641    /// Sets the *name* path property to the given value.
25642    ///
25643    /// Even though the property as already been set when instantiating this call,
25644    /// we provide this method for API completeness.
25645    pub fn name(mut self, new_value: &str) -> PropertyPatchCall<'a, S> {
25646        self._name = new_value.to_string();
25647        self
25648    }
25649    /// Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
25650    ///
25651    /// Sets the *update mask* query property to the given value.
25652    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyPatchCall<'a, S> {
25653        self._update_mask = Some(new_value);
25654        self
25655    }
25656    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25657    /// while executing the actual API request.
25658    /// 
25659    /// ````text
25660    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25661    /// ````
25662    ///
25663    /// Sets the *delegate* property to the given value.
25664    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyPatchCall<'a, S> {
25665        self._delegate = Some(new_value);
25666        self
25667    }
25668
25669    /// Set any additional parameter of the query string used in the request.
25670    /// It should be used to set parameters which are not yet available through their own
25671    /// setters.
25672    ///
25673    /// Please note that this method must not be used to set any of the known parameters
25674    /// which have their own setter method. If done anyway, the request will fail.
25675    ///
25676    /// # Additional Parameters
25677    ///
25678    /// * *$.xgafv* (query-string) - V1 error format.
25679    /// * *access_token* (query-string) - OAuth access token.
25680    /// * *alt* (query-string) - Data format for response.
25681    /// * *callback* (query-string) - JSONP
25682    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25683    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25684    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25685    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25686    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25687    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25688    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25689    pub fn param<T>(mut self, name: T, value: T) -> PropertyPatchCall<'a, S>
25690                                                        where T: AsRef<str> {
25691        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
25692        self
25693    }
25694
25695    /// Identifies the authorization scope for the method you are building.
25696    ///
25697    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25698    /// [`Scope::AnalyticEdit`].
25699    ///
25700    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25701    /// tokens for more than one scope.
25702    ///
25703    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25704    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25705    /// sufficient, a read-write scope will do as well.
25706    pub fn add_scope<St>(mut self, scope: St) -> PropertyPatchCall<'a, S>
25707                                                        where St: AsRef<str> {
25708        self._scopes.insert(String::from(scope.as_ref()));
25709        self
25710    }
25711    /// Identifies the authorization scope(s) for the method you are building.
25712    ///
25713    /// See [`Self::add_scope()`] for details.
25714    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyPatchCall<'a, S>
25715                                                        where I: IntoIterator<Item = St>,
25716                                                         St: AsRef<str> {
25717        self._scopes
25718            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25719        self
25720    }
25721
25722    /// Removes all scopes, and no default scope will be used either.
25723    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25724    /// for details).
25725    pub fn clear_scopes(mut self) -> PropertyPatchCall<'a, S> {
25726        self._scopes.clear();
25727        self
25728    }
25729}
25730
25731
25732/// Updates the singleton data retention settings for this property.
25733///
25734/// A builder for the *updateDataRetentionSettings* method supported by a *property* resource.
25735/// It is not used directly, but through a [`PropertyMethods`] instance.
25736///
25737/// # Example
25738///
25739/// Instantiate a resource method builder
25740///
25741/// ```test_harness,no_run
25742/// # extern crate hyper;
25743/// # extern crate hyper_rustls;
25744/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
25745/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaDataRetentionSettings;
25746/// # async fn dox() {
25747/// # use std::default::Default;
25748/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
25749/// 
25750/// # let secret: oauth2::ApplicationSecret = Default::default();
25751/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
25752/// #         secret,
25753/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25754/// #     ).build().await.unwrap();
25755/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
25756/// // As the method needs a request, you would usually fill it with the desired information
25757/// // into the respective structure. Some of the parts shown here might not be applicable !
25758/// // Values shown here are possibly random and not representative !
25759/// let mut req = GoogleAnalyticsAdminV1alphaDataRetentionSettings::default();
25760/// 
25761/// // You can configure optional parameters by calling the respective setters at will, and
25762/// // execute the final call using `doit()`.
25763/// // Values shown here are possibly random and not representative !
25764/// let result = hub.properties().update_data_retention_settings(req, "name")
25765///              .update_mask(&Default::default())
25766///              .doit().await;
25767/// # }
25768/// ```
25769pub struct PropertyUpdateDataRetentionSettingCall<'a, S>
25770    where S: 'a {
25771
25772    hub: &'a GoogleAnalyticsAdmin<S>,
25773    _request: GoogleAnalyticsAdminV1alphaDataRetentionSettings,
25774    _name: String,
25775    _update_mask: Option<client::FieldMask>,
25776    _delegate: Option<&'a mut dyn client::Delegate>,
25777    _additional_params: HashMap<String, String>,
25778    _scopes: BTreeSet<String>
25779}
25780
25781impl<'a, S> client::CallBuilder for PropertyUpdateDataRetentionSettingCall<'a, S> {}
25782
25783impl<'a, S> PropertyUpdateDataRetentionSettingCall<'a, S>
25784where
25785    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
25786    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
25787    S::Future: Send + Unpin + 'static,
25788    S::Error: Into<Box<dyn StdError + Send + Sync>>,
25789{
25790
25791
25792    /// Perform the operation you have build so far.
25793    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaDataRetentionSettings)> {
25794        use std::io::{Read, Seek};
25795        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
25796        use client::{ToParts, url::Params};
25797        use std::borrow::Cow;
25798
25799        let mut dd = client::DefaultDelegate;
25800        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
25801        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.updateDataRetentionSettings",
25802                               http_method: hyper::Method::PATCH });
25803
25804        for &field in ["alt", "name", "updateMask"].iter() {
25805            if self._additional_params.contains_key(field) {
25806                dlg.finished(false);
25807                return Err(client::Error::FieldClash(field));
25808            }
25809        }
25810
25811        let mut params = Params::with_capacity(5 + self._additional_params.len());
25812        params.push("name", self._name);
25813        if let Some(value) = self._update_mask.as_ref() {
25814            params.push("updateMask", value.to_string());
25815        }
25816
25817        params.extend(self._additional_params.iter());
25818
25819        params.push("alt", "json");
25820        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
25821        if self._scopes.is_empty() {
25822            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
25823        }
25824
25825        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25826            url = params.uri_replacement(url, param_name, find_this, true);
25827        }
25828        {
25829            let to_remove = ["name"];
25830            params.remove_params(&to_remove);
25831        }
25832
25833        let url = params.parse_with_url(&url);
25834
25835        let mut json_mime_type = mime::APPLICATION_JSON;
25836        let mut request_value_reader =
25837            {
25838                let mut value = json::value::to_value(&self._request).expect("serde to work");
25839                client::remove_json_null_values(&mut value);
25840                let mut dst = io::Cursor::new(Vec::with_capacity(128));
25841                json::to_writer(&mut dst, &value).unwrap();
25842                dst
25843            };
25844        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
25845        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
25846
25847
25848        loop {
25849            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
25850                Ok(token) => token,
25851                Err(e) => {
25852                    match dlg.token(e) {
25853                        Ok(token) => token,
25854                        Err(e) => {
25855                            dlg.finished(false);
25856                            return Err(client::Error::MissingToken(e));
25857                        }
25858                    }
25859                }
25860            };
25861            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
25862            let mut req_result = {
25863                let client = &self.hub.client;
25864                dlg.pre_request();
25865                let mut req_builder = hyper::Request::builder()
25866                    .method(hyper::Method::PATCH)
25867                    .uri(url.as_str())
25868                    .header(USER_AGENT, self.hub._user_agent.clone());
25869
25870                if let Some(token) = token.as_ref() {
25871                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25872                }
25873
25874
25875                        let request = req_builder
25876                        .header(CONTENT_TYPE, json_mime_type.to_string())
25877                        .header(CONTENT_LENGTH, request_size as u64)
25878                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
25879
25880                client.request(request.unwrap()).await
25881
25882            };
25883
25884            match req_result {
25885                Err(err) => {
25886                    if let client::Retry::After(d) = dlg.http_error(&err) {
25887                        sleep(d).await;
25888                        continue;
25889                    }
25890                    dlg.finished(false);
25891                    return Err(client::Error::HttpError(err))
25892                }
25893                Ok(mut res) => {
25894                    if !res.status().is_success() {
25895                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25896                        let (parts, _) = res.into_parts();
25897                        let body = hyper::Body::from(res_body_string.clone());
25898                        let restored_response = hyper::Response::from_parts(parts, body);
25899
25900                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
25901
25902                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
25903                            sleep(d).await;
25904                            continue;
25905                        }
25906
25907                        dlg.finished(false);
25908
25909                        return match server_response {
25910                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
25911                            None => Err(client::Error::Failure(restored_response)),
25912                        }
25913                    }
25914                    let result_value = {
25915                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
25916
25917                        match json::from_str(&res_body_string) {
25918                            Ok(decoded) => (res, decoded),
25919                            Err(err) => {
25920                                dlg.response_json_decode_error(&res_body_string, &err);
25921                                return Err(client::Error::JsonDecodeError(res_body_string, err));
25922                            }
25923                        }
25924                    };
25925
25926                    dlg.finished(true);
25927                    return Ok(result_value)
25928                }
25929            }
25930        }
25931    }
25932
25933
25934    ///
25935    /// Sets the *request* property to the given value.
25936    ///
25937    /// Even though the property as already been set when instantiating this call,
25938    /// we provide this method for API completeness.
25939    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaDataRetentionSettings) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
25940        self._request = new_value;
25941        self
25942    }
25943    /// Output only. Resource name for this DataRetentionSetting resource. Format: properties/{property}/dataRetentionSettings
25944    ///
25945    /// Sets the *name* path property to the given value.
25946    ///
25947    /// Even though the property as already been set when instantiating this call,
25948    /// we provide this method for API completeness.
25949    pub fn name(mut self, new_value: &str) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
25950        self._name = new_value.to_string();
25951        self
25952    }
25953    /// Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
25954    ///
25955    /// Sets the *update mask* query property to the given value.
25956    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
25957        self._update_mask = Some(new_value);
25958        self
25959    }
25960    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25961    /// while executing the actual API request.
25962    /// 
25963    /// ````text
25964    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25965    /// ````
25966    ///
25967    /// Sets the *delegate* property to the given value.
25968    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
25969        self._delegate = Some(new_value);
25970        self
25971    }
25972
25973    /// Set any additional parameter of the query string used in the request.
25974    /// It should be used to set parameters which are not yet available through their own
25975    /// setters.
25976    ///
25977    /// Please note that this method must not be used to set any of the known parameters
25978    /// which have their own setter method. If done anyway, the request will fail.
25979    ///
25980    /// # Additional Parameters
25981    ///
25982    /// * *$.xgafv* (query-string) - V1 error format.
25983    /// * *access_token* (query-string) - OAuth access token.
25984    /// * *alt* (query-string) - Data format for response.
25985    /// * *callback* (query-string) - JSONP
25986    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25987    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25988    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25989    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25990    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25991    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25992    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25993    pub fn param<T>(mut self, name: T, value: T) -> PropertyUpdateDataRetentionSettingCall<'a, S>
25994                                                        where T: AsRef<str> {
25995        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
25996        self
25997    }
25998
25999    /// Identifies the authorization scope for the method you are building.
26000    ///
26001    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26002    /// [`Scope::AnalyticEdit`].
26003    ///
26004    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26005    /// tokens for more than one scope.
26006    ///
26007    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26008    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26009    /// sufficient, a read-write scope will do as well.
26010    pub fn add_scope<St>(mut self, scope: St) -> PropertyUpdateDataRetentionSettingCall<'a, S>
26011                                                        where St: AsRef<str> {
26012        self._scopes.insert(String::from(scope.as_ref()));
26013        self
26014    }
26015    /// Identifies the authorization scope(s) for the method you are building.
26016    ///
26017    /// See [`Self::add_scope()`] for details.
26018    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUpdateDataRetentionSettingCall<'a, S>
26019                                                        where I: IntoIterator<Item = St>,
26020                                                         St: AsRef<str> {
26021        self._scopes
26022            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26023        self
26024    }
26025
26026    /// Removes all scopes, and no default scope will be used either.
26027    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26028    /// for details).
26029    pub fn clear_scopes(mut self) -> PropertyUpdateDataRetentionSettingCall<'a, S> {
26030        self._scopes.clear();
26031        self
26032    }
26033}
26034
26035
26036/// Updates Google Signals settings for a property.
26037///
26038/// A builder for the *updateGoogleSignalsSettings* method supported by a *property* resource.
26039/// It is not used directly, but through a [`PropertyMethods`] instance.
26040///
26041/// # Example
26042///
26043/// Instantiate a resource method builder
26044///
26045/// ```test_harness,no_run
26046/// # extern crate hyper;
26047/// # extern crate hyper_rustls;
26048/// # extern crate google_analyticsadmin1_alpha as analyticsadmin1_alpha;
26049/// use analyticsadmin1_alpha::api::GoogleAnalyticsAdminV1alphaGoogleSignalsSettings;
26050/// # async fn dox() {
26051/// # use std::default::Default;
26052/// # use analyticsadmin1_alpha::{GoogleAnalyticsAdmin, oauth2, hyper, hyper_rustls, chrono, FieldMask};
26053/// 
26054/// # let secret: oauth2::ApplicationSecret = Default::default();
26055/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
26056/// #         secret,
26057/// #         oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26058/// #     ).build().await.unwrap();
26059/// # let mut hub = GoogleAnalyticsAdmin::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
26060/// // As the method needs a request, you would usually fill it with the desired information
26061/// // into the respective structure. Some of the parts shown here might not be applicable !
26062/// // Values shown here are possibly random and not representative !
26063/// let mut req = GoogleAnalyticsAdminV1alphaGoogleSignalsSettings::default();
26064/// 
26065/// // You can configure optional parameters by calling the respective setters at will, and
26066/// // execute the final call using `doit()`.
26067/// // Values shown here are possibly random and not representative !
26068/// let result = hub.properties().update_google_signals_settings(req, "name")
26069///              .update_mask(&Default::default())
26070///              .doit().await;
26071/// # }
26072/// ```
26073pub struct PropertyUpdateGoogleSignalsSettingCall<'a, S>
26074    where S: 'a {
26075
26076    hub: &'a GoogleAnalyticsAdmin<S>,
26077    _request: GoogleAnalyticsAdminV1alphaGoogleSignalsSettings,
26078    _name: String,
26079    _update_mask: Option<client::FieldMask>,
26080    _delegate: Option<&'a mut dyn client::Delegate>,
26081    _additional_params: HashMap<String, String>,
26082    _scopes: BTreeSet<String>
26083}
26084
26085impl<'a, S> client::CallBuilder for PropertyUpdateGoogleSignalsSettingCall<'a, S> {}
26086
26087impl<'a, S> PropertyUpdateGoogleSignalsSettingCall<'a, S>
26088where
26089    S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
26090    S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
26091    S::Future: Send + Unpin + 'static,
26092    S::Error: Into<Box<dyn StdError + Send + Sync>>,
26093{
26094
26095
26096    /// Perform the operation you have build so far.
26097    pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GoogleAnalyticsAdminV1alphaGoogleSignalsSettings)> {
26098        use std::io::{Read, Seek};
26099        use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
26100        use client::{ToParts, url::Params};
26101        use std::borrow::Cow;
26102
26103        let mut dd = client::DefaultDelegate;
26104        let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
26105        dlg.begin(client::MethodInfo { id: "analyticsadmin.properties.updateGoogleSignalsSettings",
26106                               http_method: hyper::Method::PATCH });
26107
26108        for &field in ["alt", "name", "updateMask"].iter() {
26109            if self._additional_params.contains_key(field) {
26110                dlg.finished(false);
26111                return Err(client::Error::FieldClash(field));
26112            }
26113        }
26114
26115        let mut params = Params::with_capacity(5 + self._additional_params.len());
26116        params.push("name", self._name);
26117        if let Some(value) = self._update_mask.as_ref() {
26118            params.push("updateMask", value.to_string());
26119        }
26120
26121        params.extend(self._additional_params.iter());
26122
26123        params.push("alt", "json");
26124        let mut url = self.hub._base_url.clone() + "v1alpha/{+name}";
26125        if self._scopes.is_empty() {
26126            self._scopes.insert(Scope::AnalyticEdit.as_ref().to_string());
26127        }
26128
26129        for &(find_this, param_name) in [("{+name}", "name")].iter() {
26130            url = params.uri_replacement(url, param_name, find_this, true);
26131        }
26132        {
26133            let to_remove = ["name"];
26134            params.remove_params(&to_remove);
26135        }
26136
26137        let url = params.parse_with_url(&url);
26138
26139        let mut json_mime_type = mime::APPLICATION_JSON;
26140        let mut request_value_reader =
26141            {
26142                let mut value = json::value::to_value(&self._request).expect("serde to work");
26143                client::remove_json_null_values(&mut value);
26144                let mut dst = io::Cursor::new(Vec::with_capacity(128));
26145                json::to_writer(&mut dst, &value).unwrap();
26146                dst
26147            };
26148        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
26149        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
26150
26151
26152        loop {
26153            let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
26154                Ok(token) => token,
26155                Err(e) => {
26156                    match dlg.token(e) {
26157                        Ok(token) => token,
26158                        Err(e) => {
26159                            dlg.finished(false);
26160                            return Err(client::Error::MissingToken(e));
26161                        }
26162                    }
26163                }
26164            };
26165            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
26166            let mut req_result = {
26167                let client = &self.hub.client;
26168                dlg.pre_request();
26169                let mut req_builder = hyper::Request::builder()
26170                    .method(hyper::Method::PATCH)
26171                    .uri(url.as_str())
26172                    .header(USER_AGENT, self.hub._user_agent.clone());
26173
26174                if let Some(token) = token.as_ref() {
26175                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26176                }
26177
26178
26179                        let request = req_builder
26180                        .header(CONTENT_TYPE, json_mime_type.to_string())
26181                        .header(CONTENT_LENGTH, request_size as u64)
26182                        .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
26183
26184                client.request(request.unwrap()).await
26185
26186            };
26187
26188            match req_result {
26189                Err(err) => {
26190                    if let client::Retry::After(d) = dlg.http_error(&err) {
26191                        sleep(d).await;
26192                        continue;
26193                    }
26194                    dlg.finished(false);
26195                    return Err(client::Error::HttpError(err))
26196                }
26197                Ok(mut res) => {
26198                    if !res.status().is_success() {
26199                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
26200                        let (parts, _) = res.into_parts();
26201                        let body = hyper::Body::from(res_body_string.clone());
26202                        let restored_response = hyper::Response::from_parts(parts, body);
26203
26204                        let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
26205
26206                        if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
26207                            sleep(d).await;
26208                            continue;
26209                        }
26210
26211                        dlg.finished(false);
26212
26213                        return match server_response {
26214                            Some(error_value) => Err(client::Error::BadRequest(error_value)),
26215                            None => Err(client::Error::Failure(restored_response)),
26216                        }
26217                    }
26218                    let result_value = {
26219                        let res_body_string = client::get_body_as_string(res.body_mut()).await;
26220
26221                        match json::from_str(&res_body_string) {
26222                            Ok(decoded) => (res, decoded),
26223                            Err(err) => {
26224                                dlg.response_json_decode_error(&res_body_string, &err);
26225                                return Err(client::Error::JsonDecodeError(res_body_string, err));
26226                            }
26227                        }
26228                    };
26229
26230                    dlg.finished(true);
26231                    return Ok(result_value)
26232                }
26233            }
26234        }
26235    }
26236
26237
26238    ///
26239    /// Sets the *request* property to the given value.
26240    ///
26241    /// Even though the property as already been set when instantiating this call,
26242    /// we provide this method for API completeness.
26243    pub fn request(mut self, new_value: GoogleAnalyticsAdminV1alphaGoogleSignalsSettings) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
26244        self._request = new_value;
26245        self
26246    }
26247    /// Output only. Resource name of this setting. Format: properties/{property_id}/googleSignalsSettings Example: "properties/1000/googleSignalsSettings"
26248    ///
26249    /// Sets the *name* path property to the given value.
26250    ///
26251    /// Even though the property as already been set when instantiating this call,
26252    /// we provide this method for API completeness.
26253    pub fn name(mut self, new_value: &str) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
26254        self._name = new_value.to_string();
26255        self
26256    }
26257    /// Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.
26258    ///
26259    /// Sets the *update mask* query property to the given value.
26260    pub fn update_mask(mut self, new_value: client::FieldMask) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
26261        self._update_mask = Some(new_value);
26262        self
26263    }
26264    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26265    /// while executing the actual API request.
26266    /// 
26267    /// ````text
26268    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26269    /// ````
26270    ///
26271    /// Sets the *delegate* property to the given value.
26272    pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
26273        self._delegate = Some(new_value);
26274        self
26275    }
26276
26277    /// Set any additional parameter of the query string used in the request.
26278    /// It should be used to set parameters which are not yet available through their own
26279    /// setters.
26280    ///
26281    /// Please note that this method must not be used to set any of the known parameters
26282    /// which have their own setter method. If done anyway, the request will fail.
26283    ///
26284    /// # Additional Parameters
26285    ///
26286    /// * *$.xgafv* (query-string) - V1 error format.
26287    /// * *access_token* (query-string) - OAuth access token.
26288    /// * *alt* (query-string) - Data format for response.
26289    /// * *callback* (query-string) - JSONP
26290    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26291    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26292    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26293    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26294    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26295    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26296    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26297    pub fn param<T>(mut self, name: T, value: T) -> PropertyUpdateGoogleSignalsSettingCall<'a, S>
26298                                                        where T: AsRef<str> {
26299        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
26300        self
26301    }
26302
26303    /// Identifies the authorization scope for the method you are building.
26304    ///
26305    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26306    /// [`Scope::AnalyticEdit`].
26307    ///
26308    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26309    /// tokens for more than one scope.
26310    ///
26311    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26312    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26313    /// sufficient, a read-write scope will do as well.
26314    pub fn add_scope<St>(mut self, scope: St) -> PropertyUpdateGoogleSignalsSettingCall<'a, S>
26315                                                        where St: AsRef<str> {
26316        self._scopes.insert(String::from(scope.as_ref()));
26317        self
26318    }
26319    /// Identifies the authorization scope(s) for the method you are building.
26320    ///
26321    /// See [`Self::add_scope()`] for details.
26322    pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyUpdateGoogleSignalsSettingCall<'a, S>
26323                                                        where I: IntoIterator<Item = St>,
26324                                                         St: AsRef<str> {
26325        self._scopes
26326            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26327        self
26328    }
26329
26330    /// Removes all scopes, and no default scope will be used either.
26331    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26332    /// for details).
26333    pub fn clear_scopes(mut self) -> PropertyUpdateGoogleSignalsSettingCall<'a, S> {
26334        self._scopes.clear();
26335        self
26336    }
26337}
26338
26339